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AAE,MAAOhwC,EAAG,CAAE2zC,EAAK,CAAC,EAAG3zC,EAAE,CAAEhB,EAAI,CAAG,QAAU,CAAEiB,EAAI8K,EAAI,CAAG,CACzD,GAAI4oC,EAAAA,CAAE,CAAC,EAAE,CAAM,MAAMA,CAAE,CAAC,EAAE,CAAE,MAAO,CAAEpuB,MAAOouB,CAAE,CAAC,EAAE,CAAGA,CAAE,CAAC,EAAE,CAAG,KAAK,EAAGmnB,KAAM,EAAK,CACnF,EAtBqD,CAACpqB,EAAGplC,EAAE,CAAG,CAAG,CAuBrE,CA8CO,SAASohE,IACZ,IAAK,IAAI/hE,EAAI,EAAGV,EAAI,EAAG0iE,EAAK9oC,UAAUv7B,MAAM,CAAE2B,EAAI0iE,EAAI1iE,IAAKU,GAAKk5B,SAAS,CAAC55B,EAAE,CAAC3B,MAAM,CACnF,IAAK,IAAInJ,EAAIgL,MAAMQ,GAAIyhD,EAAI,EAAGniD,EAAI,EAAGA,EAAI0iE,EAAI1iE,IACzC,IAAK,IAAIpK,EAAIgkC,SAAS,CAAC55B,EAAE,CAAE4kB,EAAI,EAAG+9C,EAAK/sE,EAAEyI,MAAM,CAAEumB,EAAI+9C,EAAI/9C,IAAKu9B,IAC1DjtD,CAAC,CAACitD,EAAE,CAAGvsD,CAAC,CAACgvB,EAAE,CACnB,OAAO1vB,CACX,C","sources":["webpack://@affine/web/../../../node_modules/pdf-lib/es/api/rotations.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/operators.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/colors.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/text/alignment.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/image/alignment.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/StandardFonts.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/PDFDocumentOptions.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/PDFPageOptions.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/objects.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/svgPath.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/operations.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/errors.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/text/layout.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/form/appearances.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/PDFEmbeddedPage.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/PDFFont.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/PDFImage.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/form/PDFField.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/form/PDFCheckBox.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/form/PDFDropdown.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/form/PDFOptionList.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/form/PDFRadioGroup.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/form/PDFSignature.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/form/PDFTextField.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/form/PDFForm.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/sizes.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/PDFEmbeddedFile.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/PDFJavaScript.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/embedders/JavaScriptEmbedder.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/PDFDocument.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/PDFPage.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/api/form/PDFButton.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/embedders/FileEmbedder.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/errors.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/operators/PDFOperatorNames.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/structures/PDFCrossRefStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/embedders/JpegEmbedder.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/png.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/interactive/ViewerPreferences.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/flags.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/annotation/flags.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/document/PDFHeader.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFNumber.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFArray.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFBool.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/syntax/Delimiters.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/syntax/Whitespace.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/syntax/Irregular.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFName.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFNull.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFDict.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFRawStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFRef.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/operators/PDFOperator.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/structures/PDFFlateStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/structures/PDFContentStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/rng.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/PDFContext.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/structures/PDFPageLeaf.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/PDFObjectCopier.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/document/PDFCrossRefSection.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/document/PDFTrailer.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/document/PDFTrailerDict.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/structures/PDFObjectStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/writers/PDFWriter.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFInvalidObject.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/writers/PDFStreamWriter.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/embedders/StandardFontEmbedder.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/embedders/CMap.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/embedders/FontFlags.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/embedders/CustomFontEmbedder.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/embedders/CustomFontSubsetEmbedder.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/embedders/PngEmbedder.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/streams/Stream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/streams/DecodeStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/streams/Ascii85Stream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/streams/AsciiHexStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/streams/FlateStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/streams/LZWStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/streams/RunLengthStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/streams/decode.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/embedders/PDFPageEmbedder.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroField.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/annotation/BorderStyle.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/annotation/PDFAnnotation.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/annotation/AppearanceCharacteristics.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/annotation/PDFWidgetAnnotation.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroTerminal.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroButton.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroCheckBox.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroChoice.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroComboBox.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroNonTerminal.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroSignature.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroText.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroPushButton.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroRadioButton.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroListBox.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/utils.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/acroform/PDFAcroForm.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/structures/PDFCatalog.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/structures/PDFPageTree.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/syntax/Numeric.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/parser/BaseParser.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/parser/ByteStream.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/syntax/Keywords.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/parser/PDFObjectParser.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/parser/PDFObjectStreamParser.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/parser/PDFXRefStreamParser.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/parser/PDFParser.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFHexString.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFObject.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/objects/PDFString.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/core/syntax/CharCodes.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/base64.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/pdfDocEncoding.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/arrays.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/async.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/numbers.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/errors.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/objects.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/validators.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/Cache.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/strings.js","webpack://@affine/web/../../../node_modules/pdf-lib/es/utils/unicode.js","webpack://@affine/web/../../../node_modules/pdf-lib/node_modules/tslib/tslib.es6.js"],"sourcesContent":["import { assertIs, error } from \"../utils\";\nexport var RotationTypes;\n(function (RotationTypes) {\n RotationTypes[\"Degrees\"] = \"degrees\";\n RotationTypes[\"Radians\"] = \"radians\";\n})(RotationTypes || (RotationTypes = {}));\nexport var radians = function (radianAngle) {\n assertIs(radianAngle, 'radianAngle', ['number']);\n return { type: RotationTypes.Radians, angle: radianAngle };\n};\nexport var degrees = function (degreeAngle) {\n assertIs(degreeAngle, 'degreeAngle', ['number']);\n return { type: RotationTypes.Degrees, angle: degreeAngle };\n};\nvar Radians = RotationTypes.Radians, Degrees = RotationTypes.Degrees;\nexport var degreesToRadians = function (degree) { return (degree * Math.PI) / 180; };\nexport var radiansToDegrees = function (radian) { return (radian * 180) / Math.PI; };\n// prettier-ignore\nexport var toRadians = function (rotation) {\n return rotation.type === Radians ? rotation.angle\n : rotation.type === Degrees ? degreesToRadians(rotation.angle)\n : error(\"Invalid rotation: \" + JSON.stringify(rotation));\n};\n// prettier-ignore\nexport var toDegrees = function (rotation) {\n return rotation.type === Radians ? radiansToDegrees(rotation.angle)\n : rotation.type === Degrees ? rotation.angle\n : error(\"Invalid rotation: \" + JSON.stringify(rotation));\n};\nexport var reduceRotation = function (degreeAngle) {\n if (degreeAngle === void 0) { degreeAngle = 0; }\n var quadrants = (degreeAngle / 90) % 4;\n if (quadrants === 0)\n return 0;\n if (quadrants === 1)\n return 90;\n if (quadrants === 2)\n return 180;\n if (quadrants === 3)\n return 270;\n return 0; // `degreeAngle` is not a multiple of 90\n};\nexport var adjustDimsForRotation = function (dims, degreeAngle) {\n if (degreeAngle === void 0) { degreeAngle = 0; }\n var rotation = reduceRotation(degreeAngle);\n return rotation === 90 || rotation === 270\n ? { width: dims.height, height: dims.width }\n : { width: dims.width, height: dims.height };\n};\nexport var rotateRectangle = function (rectangle, borderWidth, degreeAngle) {\n if (borderWidth === void 0) { borderWidth = 0; }\n if (degreeAngle === void 0) { degreeAngle = 0; }\n var x = rectangle.x, y = rectangle.y, w = rectangle.width, h = rectangle.height;\n var r = reduceRotation(degreeAngle);\n var b = borderWidth / 2;\n // prettier-ignore\n if (r === 0)\n return { x: x - b, y: y - b, width: w, height: h };\n else if (r === 90)\n return { x: x - h + b, y: y - b, width: h, height: w };\n else if (r === 180)\n return { x: x - w + b, y: y - h + b, width: w, height: h };\n else if (r === 270)\n return { x: x - b, y: y - w + b, width: h, height: w };\n else\n return { x: x - b, y: y - b, width: w, height: h };\n};\n//# sourceMappingURL=rotations.js.map","import { asNumber, asPDFName, asPDFNumber } from \"./objects\";\nimport { degreesToRadians } from \"./rotations\";\nimport { PDFOperator, PDFOperatorNames as Ops, } from \"../core\";\n/* ==================== Clipping Path Operators ==================== */\nexport var clip = function () { return PDFOperator.of(Ops.ClipNonZero); };\nexport var clipEvenOdd = function () { return PDFOperator.of(Ops.ClipEvenOdd); };\n/* ==================== Graphics State Operators ==================== */\nvar cos = Math.cos, sin = Math.sin, tan = Math.tan;\nexport var concatTransformationMatrix = function (a, b, c, d, e, f) {\n return PDFOperator.of(Ops.ConcatTransformationMatrix, [\n asPDFNumber(a),\n asPDFNumber(b),\n asPDFNumber(c),\n asPDFNumber(d),\n asPDFNumber(e),\n asPDFNumber(f),\n ]);\n};\nexport var translate = function (xPos, yPos) {\n return concatTransformationMatrix(1, 0, 0, 1, xPos, yPos);\n};\nexport var scale = function (xPos, yPos) {\n return concatTransformationMatrix(xPos, 0, 0, yPos, 0, 0);\n};\nexport var rotateRadians = function (angle) {\n return concatTransformationMatrix(cos(asNumber(angle)), sin(asNumber(angle)), -sin(asNumber(angle)), cos(asNumber(angle)), 0, 0);\n};\nexport var rotateDegrees = function (angle) {\n return rotateRadians(degreesToRadians(asNumber(angle)));\n};\nexport var skewRadians = function (xSkewAngle, ySkewAngle) {\n return concatTransformationMatrix(1, tan(asNumber(xSkewAngle)), tan(asNumber(ySkewAngle)), 1, 0, 0);\n};\nexport var skewDegrees = function (xSkewAngle, ySkewAngle) {\n return skewRadians(degreesToRadians(asNumber(xSkewAngle)), degreesToRadians(asNumber(ySkewAngle)));\n};\nexport var setDashPattern = function (dashArray, dashPhase) {\n return PDFOperator.of(Ops.SetLineDashPattern, [\n \"[\" + dashArray.map(asPDFNumber).join(' ') + \"]\",\n asPDFNumber(dashPhase),\n ]);\n};\nexport var restoreDashPattern = function () { return setDashPattern([], 0); };\nexport var LineCapStyle;\n(function (LineCapStyle) {\n LineCapStyle[LineCapStyle[\"Butt\"] = 0] = \"Butt\";\n LineCapStyle[LineCapStyle[\"Round\"] = 1] = \"Round\";\n LineCapStyle[LineCapStyle[\"Projecting\"] = 2] = \"Projecting\";\n})(LineCapStyle || (LineCapStyle = {}));\nexport var setLineCap = function (style) {\n return PDFOperator.of(Ops.SetLineCapStyle, [asPDFNumber(style)]);\n};\nexport var LineJoinStyle;\n(function (LineJoinStyle) {\n LineJoinStyle[LineJoinStyle[\"Miter\"] = 0] = \"Miter\";\n LineJoinStyle[LineJoinStyle[\"Round\"] = 1] = \"Round\";\n LineJoinStyle[LineJoinStyle[\"Bevel\"] = 2] = \"Bevel\";\n})(LineJoinStyle || (LineJoinStyle = {}));\nexport var setLineJoin = function (style) {\n return PDFOperator.of(Ops.SetLineJoinStyle, [asPDFNumber(style)]);\n};\nexport var setGraphicsState = function (state) {\n return PDFOperator.of(Ops.SetGraphicsStateParams, [asPDFName(state)]);\n};\nexport var pushGraphicsState = function () { return PDFOperator.of(Ops.PushGraphicsState); };\nexport var popGraphicsState = function () { return PDFOperator.of(Ops.PopGraphicsState); };\nexport var setLineWidth = function (width) {\n return PDFOperator.of(Ops.SetLineWidth, [asPDFNumber(width)]);\n};\n/* ==================== Path Construction Operators ==================== */\nexport var appendBezierCurve = function (x1, y1, x2, y2, x3, y3) {\n return PDFOperator.of(Ops.AppendBezierCurve, [\n asPDFNumber(x1),\n asPDFNumber(y1),\n asPDFNumber(x2),\n asPDFNumber(y2),\n asPDFNumber(x3),\n asPDFNumber(y3),\n ]);\n};\nexport var appendQuadraticCurve = function (x1, y1, x2, y2) {\n return PDFOperator.of(Ops.CurveToReplicateInitialPoint, [\n asPDFNumber(x1),\n asPDFNumber(y1),\n asPDFNumber(x2),\n asPDFNumber(y2),\n ]);\n};\nexport var closePath = function () { return PDFOperator.of(Ops.ClosePath); };\nexport var moveTo = function (xPos, yPos) {\n return PDFOperator.of(Ops.MoveTo, [asPDFNumber(xPos), asPDFNumber(yPos)]);\n};\nexport var lineTo = function (xPos, yPos) {\n return PDFOperator.of(Ops.LineTo, [asPDFNumber(xPos), asPDFNumber(yPos)]);\n};\n/**\n * @param xPos x coordinate for the lower left corner of the rectangle\n * @param yPos y coordinate for the lower left corner of the rectangle\n * @param width width of the rectangle\n * @param height height of the rectangle\n */\nexport var rectangle = function (xPos, yPos, width, height) {\n return PDFOperator.of(Ops.AppendRectangle, [\n asPDFNumber(xPos),\n asPDFNumber(yPos),\n asPDFNumber(width),\n asPDFNumber(height),\n ]);\n};\n/**\n * @param xPos x coordinate for the lower left corner of the square\n * @param yPos y coordinate for the lower left corner of the square\n * @param size width and height of the square\n */\nexport var square = function (xPos, yPos, size) {\n return rectangle(xPos, yPos, size, size);\n};\n/* ==================== Path Painting Operators ==================== */\nexport var stroke = function () { return PDFOperator.of(Ops.StrokePath); };\nexport var fill = function () { return PDFOperator.of(Ops.FillNonZero); };\nexport var fillAndStroke = function () { return PDFOperator.of(Ops.FillNonZeroAndStroke); };\nexport var endPath = function () { return PDFOperator.of(Ops.EndPath); };\n/* ==================== Text Positioning Operators ==================== */\nexport var nextLine = function () { return PDFOperator.of(Ops.NextLine); };\nexport var moveText = function (x, y) {\n return PDFOperator.of(Ops.MoveText, [asPDFNumber(x), asPDFNumber(y)]);\n};\n/* ==================== Text Showing Operators ==================== */\nexport var showText = function (text) {\n return PDFOperator.of(Ops.ShowText, [text]);\n};\n/* ==================== Text State Operators ==================== */\nexport var beginText = function () { return PDFOperator.of(Ops.BeginText); };\nexport var endText = function () { return PDFOperator.of(Ops.EndText); };\nexport var setFontAndSize = function (name, size) { return PDFOperator.of(Ops.SetFontAndSize, [asPDFName(name), asPDFNumber(size)]); };\nexport var setCharacterSpacing = function (spacing) {\n return PDFOperator.of(Ops.SetCharacterSpacing, [asPDFNumber(spacing)]);\n};\nexport var setWordSpacing = function (spacing) {\n return PDFOperator.of(Ops.SetWordSpacing, [asPDFNumber(spacing)]);\n};\n/** @param squeeze horizontal character spacing */\nexport var setCharacterSqueeze = function (squeeze) {\n return PDFOperator.of(Ops.SetTextHorizontalScaling, [asPDFNumber(squeeze)]);\n};\nexport var setLineHeight = function (lineHeight) {\n return PDFOperator.of(Ops.SetTextLineHeight, [asPDFNumber(lineHeight)]);\n};\nexport var setTextRise = function (rise) {\n return PDFOperator.of(Ops.SetTextRise, [asPDFNumber(rise)]);\n};\nexport var TextRenderingMode;\n(function (TextRenderingMode) {\n TextRenderingMode[TextRenderingMode[\"Fill\"] = 0] = \"Fill\";\n TextRenderingMode[TextRenderingMode[\"Outline\"] = 1] = \"Outline\";\n TextRenderingMode[TextRenderingMode[\"FillAndOutline\"] = 2] = \"FillAndOutline\";\n TextRenderingMode[TextRenderingMode[\"Invisible\"] = 3] = \"Invisible\";\n TextRenderingMode[TextRenderingMode[\"FillAndClip\"] = 4] = \"FillAndClip\";\n TextRenderingMode[TextRenderingMode[\"OutlineAndClip\"] = 5] = \"OutlineAndClip\";\n TextRenderingMode[TextRenderingMode[\"FillAndOutlineAndClip\"] = 6] = \"FillAndOutlineAndClip\";\n TextRenderingMode[TextRenderingMode[\"Clip\"] = 7] = \"Clip\";\n})(TextRenderingMode || (TextRenderingMode = {}));\nexport var setTextRenderingMode = function (mode) {\n return PDFOperator.of(Ops.SetTextRenderingMode, [asPDFNumber(mode)]);\n};\nexport var setTextMatrix = function (a, b, c, d, e, f) {\n return PDFOperator.of(Ops.SetTextMatrix, [\n asPDFNumber(a),\n asPDFNumber(b),\n asPDFNumber(c),\n asPDFNumber(d),\n asPDFNumber(e),\n asPDFNumber(f),\n ]);\n};\nexport var rotateAndSkewTextRadiansAndTranslate = function (rotationAngle, xSkewAngle, ySkewAngle, x, y) {\n return setTextMatrix(cos(asNumber(rotationAngle)), sin(asNumber(rotationAngle)) + tan(asNumber(xSkewAngle)), -sin(asNumber(rotationAngle)) + tan(asNumber(ySkewAngle)), cos(asNumber(rotationAngle)), x, y);\n};\nexport var rotateAndSkewTextDegreesAndTranslate = function (rotationAngle, xSkewAngle, ySkewAngle, x, y) {\n return rotateAndSkewTextRadiansAndTranslate(degreesToRadians(asNumber(rotationAngle)), degreesToRadians(asNumber(xSkewAngle)), degreesToRadians(asNumber(ySkewAngle)), x, y);\n};\n/* ==================== XObject Operator ==================== */\nexport var drawObject = function (name) {\n return PDFOperator.of(Ops.DrawObject, [asPDFName(name)]);\n};\n/* ==================== Color Operators ==================== */\nexport var setFillingGrayscaleColor = function (gray) {\n return PDFOperator.of(Ops.NonStrokingColorGray, [asPDFNumber(gray)]);\n};\nexport var setStrokingGrayscaleColor = function (gray) {\n return PDFOperator.of(Ops.StrokingColorGray, [asPDFNumber(gray)]);\n};\nexport var setFillingRgbColor = function (red, green, blue) {\n return PDFOperator.of(Ops.NonStrokingColorRgb, [\n asPDFNumber(red),\n asPDFNumber(green),\n asPDFNumber(blue),\n ]);\n};\nexport var setStrokingRgbColor = function (red, green, blue) {\n return PDFOperator.of(Ops.StrokingColorRgb, [\n asPDFNumber(red),\n asPDFNumber(green),\n asPDFNumber(blue),\n ]);\n};\nexport var setFillingCmykColor = function (cyan, magenta, yellow, key) {\n return PDFOperator.of(Ops.NonStrokingColorCmyk, [\n asPDFNumber(cyan),\n asPDFNumber(magenta),\n asPDFNumber(yellow),\n asPDFNumber(key),\n ]);\n};\nexport var setStrokingCmykColor = function (cyan, magenta, yellow, key) {\n return PDFOperator.of(Ops.StrokingColorCmyk, [\n asPDFNumber(cyan),\n asPDFNumber(magenta),\n asPDFNumber(yellow),\n asPDFNumber(key),\n ]);\n};\n/* ==================== Marked Content Operators ==================== */\nexport var beginMarkedContent = function (tag) {\n return PDFOperator.of(Ops.BeginMarkedContent, [asPDFName(tag)]);\n};\nexport var endMarkedContent = function () { return PDFOperator.of(Ops.EndMarkedContent); };\n//# sourceMappingURL=operators.js.map","import { setFillingCmykColor, setFillingGrayscaleColor, setFillingRgbColor, setStrokingCmykColor, setStrokingGrayscaleColor, setStrokingRgbColor, } from \"./operators\";\nimport { assertRange, error } from \"../utils\";\nexport var ColorTypes;\n(function (ColorTypes) {\n ColorTypes[\"Grayscale\"] = \"Grayscale\";\n ColorTypes[\"RGB\"] = \"RGB\";\n ColorTypes[\"CMYK\"] = \"CMYK\";\n})(ColorTypes || (ColorTypes = {}));\nexport var grayscale = function (gray) {\n assertRange(gray, 'gray', 0.0, 1.0);\n return { type: ColorTypes.Grayscale, gray: gray };\n};\nexport var rgb = function (red, green, blue) {\n assertRange(red, 'red', 0, 1);\n assertRange(green, 'green', 0, 1);\n assertRange(blue, 'blue', 0, 1);\n return { type: ColorTypes.RGB, red: red, green: green, blue: blue };\n};\nexport var cmyk = function (cyan, magenta, yellow, key) {\n assertRange(cyan, 'cyan', 0, 1);\n assertRange(magenta, 'magenta', 0, 1);\n assertRange(yellow, 'yellow', 0, 1);\n assertRange(key, 'key', 0, 1);\n return { type: ColorTypes.CMYK, cyan: cyan, magenta: magenta, yellow: yellow, key: key };\n};\nvar Grayscale = ColorTypes.Grayscale, RGB = ColorTypes.RGB, CMYK = ColorTypes.CMYK;\n// prettier-ignore\nexport var setFillingColor = function (color) {\n return color.type === Grayscale ? setFillingGrayscaleColor(color.gray)\n : color.type === RGB ? setFillingRgbColor(color.red, color.green, color.blue)\n : color.type === CMYK ? setFillingCmykColor(color.cyan, color.magenta, color.yellow, color.key)\n : error(\"Invalid color: \" + JSON.stringify(color));\n};\n// prettier-ignore\nexport var setStrokingColor = function (color) {\n return color.type === Grayscale ? setStrokingGrayscaleColor(color.gray)\n : color.type === RGB ? setStrokingRgbColor(color.red, color.green, color.blue)\n : color.type === CMYK ? setStrokingCmykColor(color.cyan, color.magenta, color.yellow, color.key)\n : error(\"Invalid color: \" + JSON.stringify(color));\n};\n// prettier-ignore\nexport var componentsToColor = function (comps, scale) {\n if (scale === void 0) { scale = 1; }\n return ((comps === null || comps === void 0 ? void 0 : comps.length) === 1 ? grayscale(comps[0] * scale)\n : (comps === null || comps === void 0 ? void 0 : comps.length) === 3 ? rgb(comps[0] * scale, comps[1] * scale, comps[2] * scale)\n : (comps === null || comps === void 0 ? void 0 : comps.length) === 4 ? cmyk(comps[0] * scale, comps[1] * scale, comps[2] * scale, comps[3] * scale)\n : undefined);\n};\n// prettier-ignore\nexport var colorToComponents = function (color) {\n return color.type === Grayscale ? [color.gray]\n : color.type === RGB ? [color.red, color.green, color.blue]\n : color.type === CMYK ? [color.cyan, color.magenta, color.yellow, color.key]\n : error(\"Invalid color: \" + JSON.stringify(color));\n};\n//# sourceMappingURL=colors.js.map","export var TextAlignment;\n(function (TextAlignment) {\n TextAlignment[TextAlignment[\"Left\"] = 0] = \"Left\";\n TextAlignment[TextAlignment[\"Center\"] = 1] = \"Center\";\n TextAlignment[TextAlignment[\"Right\"] = 2] = \"Right\";\n})(TextAlignment || (TextAlignment = {}));\n//# sourceMappingURL=alignment.js.map","export var ImageAlignment;\n(function (ImageAlignment) {\n ImageAlignment[ImageAlignment[\"Left\"] = 0] = \"Left\";\n ImageAlignment[ImageAlignment[\"Center\"] = 1] = \"Center\";\n ImageAlignment[ImageAlignment[\"Right\"] = 2] = \"Right\";\n})(ImageAlignment || (ImageAlignment = {}));\n//# sourceMappingURL=alignment.js.map","export var StandardFonts;\n(function (StandardFonts) {\n StandardFonts[\"Courier\"] = \"Courier\";\n StandardFonts[\"CourierBold\"] = \"Courier-Bold\";\n StandardFonts[\"CourierOblique\"] = \"Courier-Oblique\";\n StandardFonts[\"CourierBoldOblique\"] = \"Courier-BoldOblique\";\n StandardFonts[\"Helvetica\"] = \"Helvetica\";\n StandardFonts[\"HelveticaBold\"] = \"Helvetica-Bold\";\n StandardFonts[\"HelveticaOblique\"] = \"Helvetica-Oblique\";\n StandardFonts[\"HelveticaBoldOblique\"] = \"Helvetica-BoldOblique\";\n StandardFonts[\"TimesRoman\"] = \"Times-Roman\";\n StandardFonts[\"TimesRomanBold\"] = \"Times-Bold\";\n StandardFonts[\"TimesRomanItalic\"] = \"Times-Italic\";\n StandardFonts[\"TimesRomanBoldItalic\"] = \"Times-BoldItalic\";\n StandardFonts[\"Symbol\"] = \"Symbol\";\n StandardFonts[\"ZapfDingbats\"] = \"ZapfDingbats\";\n})(StandardFonts || (StandardFonts = {}));\n//# sourceMappingURL=StandardFonts.js.map","export var ParseSpeeds;\n(function (ParseSpeeds) {\n ParseSpeeds[ParseSpeeds[\"Fastest\"] = Infinity] = \"Fastest\";\n ParseSpeeds[ParseSpeeds[\"Fast\"] = 1500] = \"Fast\";\n ParseSpeeds[ParseSpeeds[\"Medium\"] = 500] = \"Medium\";\n ParseSpeeds[ParseSpeeds[\"Slow\"] = 100] = \"Slow\";\n})(ParseSpeeds || (ParseSpeeds = {}));\n//# sourceMappingURL=PDFDocumentOptions.js.map","export var BlendMode;\n(function (BlendMode) {\n BlendMode[\"Normal\"] = \"Normal\";\n BlendMode[\"Multiply\"] = \"Multiply\";\n BlendMode[\"Screen\"] = \"Screen\";\n BlendMode[\"Overlay\"] = \"Overlay\";\n BlendMode[\"Darken\"] = \"Darken\";\n BlendMode[\"Lighten\"] = \"Lighten\";\n BlendMode[\"ColorDodge\"] = \"ColorDodge\";\n BlendMode[\"ColorBurn\"] = \"ColorBurn\";\n BlendMode[\"HardLight\"] = \"HardLight\";\n BlendMode[\"SoftLight\"] = \"SoftLight\";\n BlendMode[\"Difference\"] = \"Difference\";\n BlendMode[\"Exclusion\"] = \"Exclusion\";\n})(BlendMode || (BlendMode = {}));\n//# sourceMappingURL=PDFPageOptions.js.map","import { PDFName, PDFNumber } from \"../core\";\nexport var asPDFName = function (name) {\n return name instanceof PDFName ? name : PDFName.of(name);\n};\nexport var asPDFNumber = function (num) {\n return num instanceof PDFNumber ? num : PDFNumber.of(num);\n};\nexport var asNumber = function (num) {\n return num instanceof PDFNumber ? num.asNumber() : num;\n};\n//# sourceMappingURL=objects.js.map","// Originated from pdfkit Copyright (c) 2014 Devon Govett\n// https://github.com/foliojs/pdfkit/blob/1e62e6ffe24b378eb890df507a47610f4c4a7b24/lib/path.js\n// MIT LICENSE\n// Updated for pdf-lib & TypeScript by Jeremy Messenger\nimport { appendBezierCurve, appendQuadraticCurve, closePath, lineTo, moveTo, } from \"./operators\";\nvar cx = 0;\nvar cy = 0;\nvar px = 0;\nvar py = 0;\nvar sx = 0;\nvar sy = 0;\nvar parameters = new Map([\n ['A', 7],\n ['a', 7],\n ['C', 6],\n ['c', 6],\n ['H', 1],\n ['h', 1],\n ['L', 2],\n ['l', 2],\n ['M', 2],\n ['m', 2],\n ['Q', 4],\n ['q', 4],\n ['S', 4],\n ['s', 4],\n ['T', 2],\n ['t', 2],\n ['V', 1],\n ['v', 1],\n ['Z', 0],\n ['z', 0],\n]);\nvar parse = function (path) {\n var cmd;\n var ret = [];\n var args = [];\n var curArg = '';\n var foundDecimal = false;\n var params = 0;\n for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {\n var c = path_1[_i];\n if (parameters.has(c)) {\n params = parameters.get(c);\n if (cmd) {\n // save existing command\n if (curArg.length > 0) {\n args[args.length] = +curArg;\n }\n ret[ret.length] = { cmd: cmd, args: args };\n args = [];\n curArg = '';\n foundDecimal = false;\n }\n cmd = c;\n }\n else if ([' ', ','].includes(c) ||\n (c === '-' && curArg.length > 0 && curArg[curArg.length - 1] !== 'e') ||\n (c === '.' && foundDecimal)) {\n if (curArg.length === 0) {\n continue;\n }\n if (args.length === params) {\n // handle reused commands\n ret[ret.length] = { cmd: cmd, args: args };\n args = [+curArg];\n // handle assumed commands\n if (cmd === 'M') {\n cmd = 'L';\n }\n if (cmd === 'm') {\n cmd = 'l';\n }\n }\n else {\n args[args.length] = +curArg;\n }\n foundDecimal = c === '.';\n // fix for negative numbers or repeated decimals with no delimeter between commands\n curArg = ['-', '.'].includes(c) ? c : '';\n }\n else {\n curArg += c;\n if (c === '.') {\n foundDecimal = true;\n }\n }\n }\n // add the last command\n if (curArg.length > 0) {\n if (args.length === params) {\n // handle reused commands\n ret[ret.length] = { cmd: cmd, args: args };\n args = [+curArg];\n // handle assumed commands\n if (cmd === 'M') {\n cmd = 'L';\n }\n if (cmd === 'm') {\n cmd = 'l';\n }\n }\n else {\n args[args.length] = +curArg;\n }\n }\n ret[ret.length] = { cmd: cmd, args: args };\n return ret;\n};\nvar apply = function (commands) {\n // current point, control point, and subpath starting point\n cx = cy = px = py = sx = sy = 0;\n // run the commands\n var cmds = [];\n for (var i = 0; i < commands.length; i++) {\n var c = commands[i];\n if (c.cmd && typeof runners[c.cmd] === 'function') {\n var cmd = runners[c.cmd](c.args);\n if (Array.isArray(cmd)) {\n cmds = cmds.concat(cmd);\n }\n else {\n cmds.push(cmd);\n }\n }\n }\n return cmds;\n};\nvar runners = {\n M: function (a) {\n cx = a[0];\n cy = a[1];\n px = py = null;\n sx = cx;\n sy = cy;\n return moveTo(cx, cy);\n },\n m: function (a) {\n cx += a[0];\n cy += a[1];\n px = py = null;\n sx = cx;\n sy = cy;\n return moveTo(cx, cy);\n },\n C: function (a) {\n cx = a[4];\n cy = a[5];\n px = a[2];\n py = a[3];\n return appendBezierCurve(a[0], a[1], a[2], a[3], a[4], a[5]);\n },\n c: function (a) {\n var cmd = appendBezierCurve(a[0] + cx, a[1] + cy, a[2] + cx, a[3] + cy, a[4] + cx, a[5] + cy);\n px = cx + a[2];\n py = cy + a[3];\n cx += a[4];\n cy += a[5];\n return cmd;\n },\n S: function (a) {\n if (px === null || py === null) {\n px = cx;\n py = cy;\n }\n var cmd = appendBezierCurve(cx - (px - cx), cy - (py - cy), a[0], a[1], a[2], a[3]);\n px = a[0];\n py = a[1];\n cx = a[2];\n cy = a[3];\n return cmd;\n },\n s: function (a) {\n if (px === null || py === null) {\n px = cx;\n py = cy;\n }\n var cmd = appendBezierCurve(cx - (px - cx), cy - (py - cy), cx + a[0], cy + a[1], cx + a[2], cy + a[3]);\n px = cx + a[0];\n py = cy + a[1];\n cx += a[2];\n cy += a[3];\n return cmd;\n },\n Q: function (a) {\n px = a[0];\n py = a[1];\n cx = a[2];\n cy = a[3];\n return appendQuadraticCurve(a[0], a[1], cx, cy);\n },\n q: function (a) {\n var cmd = appendQuadraticCurve(a[0] + cx, a[1] + cy, a[2] + cx, a[3] + cy);\n px = cx + a[0];\n py = cy + a[1];\n cx += a[2];\n cy += a[3];\n return cmd;\n },\n T: function (a) {\n if (px === null || py === null) {\n px = cx;\n py = cy;\n }\n else {\n px = cx - (px - cx);\n py = cy - (py - cy);\n }\n var cmd = appendQuadraticCurve(px, py, a[0], a[1]);\n px = cx - (px - cx);\n py = cy - (py - cy);\n cx = a[0];\n cy = a[1];\n return cmd;\n },\n t: function (a) {\n if (px === null || py === null) {\n px = cx;\n py = cy;\n }\n else {\n px = cx - (px - cx);\n py = cy - (py - cy);\n }\n var cmd = appendQuadraticCurve(px, py, cx + a[0], cy + a[1]);\n cx += a[0];\n cy += a[1];\n return cmd;\n },\n A: function (a) {\n var cmds = solveArc(cx, cy, a);\n cx = a[5];\n cy = a[6];\n return cmds;\n },\n a: function (a) {\n a[5] += cx;\n a[6] += cy;\n var cmds = solveArc(cx, cy, a);\n cx = a[5];\n cy = a[6];\n return cmds;\n },\n L: function (a) {\n cx = a[0];\n cy = a[1];\n px = py = null;\n return lineTo(cx, cy);\n },\n l: function (a) {\n cx += a[0];\n cy += a[1];\n px = py = null;\n return lineTo(cx, cy);\n },\n H: function (a) {\n cx = a[0];\n px = py = null;\n return lineTo(cx, cy);\n },\n h: function (a) {\n cx += a[0];\n px = py = null;\n return lineTo(cx, cy);\n },\n V: function (a) {\n cy = a[0];\n px = py = null;\n return lineTo(cx, cy);\n },\n v: function (a) {\n cy += a[0];\n px = py = null;\n return lineTo(cx, cy);\n },\n Z: function () {\n var cmd = closePath();\n cx = sx;\n cy = sy;\n return cmd;\n },\n z: function () {\n var cmd = closePath();\n cx = sx;\n cy = sy;\n return cmd;\n },\n};\nvar solveArc = function (x, y, coords) {\n var rx = coords[0], ry = coords[1], rot = coords[2], large = coords[3], sweep = coords[4], ex = coords[5], ey = coords[6];\n var segs = arcToSegments(ex, ey, rx, ry, large, sweep, rot, x, y);\n var cmds = [];\n for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {\n var seg = segs_1[_i];\n var bez = segmentToBezier.apply(void 0, seg);\n cmds.push(appendBezierCurve.apply(void 0, bez));\n }\n return cmds;\n};\n// from Inkscape svgtopdf, thanks!\nvar arcToSegments = function (x, y, rx, ry, large, sweep, rotateX, ox, oy) {\n var th = rotateX * (Math.PI / 180);\n var sinTh = Math.sin(th);\n var cosTh = Math.cos(th);\n rx = Math.abs(rx);\n ry = Math.abs(ry);\n px = cosTh * (ox - x) * 0.5 + sinTh * (oy - y) * 0.5;\n py = cosTh * (oy - y) * 0.5 - sinTh * (ox - x) * 0.5;\n var pl = (px * px) / (rx * rx) + (py * py) / (ry * ry);\n if (pl > 1) {\n pl = Math.sqrt(pl);\n rx *= pl;\n ry *= pl;\n }\n var a00 = cosTh / rx;\n var a01 = sinTh / rx;\n var a10 = -sinTh / ry;\n var a11 = cosTh / ry;\n var x0 = a00 * ox + a01 * oy;\n var y0 = a10 * ox + a11 * oy;\n var x1 = a00 * x + a01 * y;\n var y1 = a10 * x + a11 * y;\n var d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0);\n var sfactorSq = 1 / d - 0.25;\n if (sfactorSq < 0) {\n sfactorSq = 0;\n }\n var sfactor = Math.sqrt(sfactorSq);\n if (sweep === large) {\n sfactor = -sfactor;\n }\n var xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0);\n var yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);\n var th0 = Math.atan2(y0 - yc, x0 - xc);\n var th1 = Math.atan2(y1 - yc, x1 - xc);\n var thArc = th1 - th0;\n if (thArc < 0 && sweep === 1) {\n thArc += 2 * Math.PI;\n }\n else if (thArc > 0 && sweep === 0) {\n thArc -= 2 * Math.PI;\n }\n var segments = Math.ceil(Math.abs(thArc / (Math.PI * 0.5 + 0.001)));\n var result = [];\n for (var i = 0; i < segments; i++) {\n var th2 = th0 + (i * thArc) / segments;\n var th3 = th0 + ((i + 1) * thArc) / segments;\n result[i] = [xc, yc, th2, th3, rx, ry, sinTh, cosTh];\n }\n return result;\n};\nvar segmentToBezier = function (cx1, cy1, th0, th1, rx, ry, sinTh, cosTh) {\n var a00 = cosTh * rx;\n var a01 = -sinTh * ry;\n var a10 = sinTh * rx;\n var a11 = cosTh * ry;\n var thHalf = 0.5 * (th1 - th0);\n var t = ((8 / 3) * Math.sin(thHalf * 0.5) * Math.sin(thHalf * 0.5)) /\n Math.sin(thHalf);\n var x1 = cx1 + Math.cos(th0) - t * Math.sin(th0);\n var y1 = cy1 + Math.sin(th0) + t * Math.cos(th0);\n var x3 = cx1 + Math.cos(th1);\n var y3 = cy1 + Math.sin(th1);\n var x2 = x3 + t * Math.sin(th1);\n var y2 = y3 - t * Math.cos(th1);\n var result = [\n a00 * x1 + a01 * y1,\n a10 * x1 + a11 * y1,\n a00 * x2 + a01 * y2,\n a10 * x2 + a11 * y2,\n a00 * x3 + a01 * y3,\n a10 * x3 + a11 * y3,\n ];\n return result;\n};\nexport var svgPathToOperators = function (path) { return apply(parse(path)); };\n//# sourceMappingURL=svgPath.js.map","import { __spreadArrays } from \"tslib\";\nimport { setFillingColor, setStrokingColor } from \"./colors\";\nimport { beginText, closePath, drawObject, endText, fill, fillAndStroke, lineTo, moveTo, nextLine, popGraphicsState, pushGraphicsState, rotateAndSkewTextRadiansAndTranslate, rotateRadians, scale, setFontAndSize, setLineHeight, setLineWidth, showText, skewRadians, stroke, translate, setLineCap, rotateDegrees, setGraphicsState, setDashPattern, beginMarkedContent, endMarkedContent, clip, endPath, appendBezierCurve, } from \"./operators\";\nimport { degrees, toRadians } from \"./rotations\";\nimport { svgPathToOperators } from \"./svgPath\";\nimport { asNumber } from \"./objects\";\nexport var drawText = function (line, options) {\n return [\n pushGraphicsState(),\n options.graphicsState && setGraphicsState(options.graphicsState),\n beginText(),\n setFillingColor(options.color),\n setFontAndSize(options.font, options.size),\n rotateAndSkewTextRadiansAndTranslate(toRadians(options.rotate), toRadians(options.xSkew), toRadians(options.ySkew), options.x, options.y),\n showText(line),\n endText(),\n popGraphicsState(),\n ].filter(Boolean);\n};\nexport var drawLinesOfText = function (lines, options) {\n var operators = [\n pushGraphicsState(),\n options.graphicsState && setGraphicsState(options.graphicsState),\n beginText(),\n setFillingColor(options.color),\n setFontAndSize(options.font, options.size),\n setLineHeight(options.lineHeight),\n rotateAndSkewTextRadiansAndTranslate(toRadians(options.rotate), toRadians(options.xSkew), toRadians(options.ySkew), options.x, options.y),\n ].filter(Boolean);\n for (var idx = 0, len = lines.length; idx < len; idx++) {\n operators.push(showText(lines[idx]), nextLine());\n }\n operators.push(endText(), popGraphicsState());\n return operators;\n};\nexport var drawImage = function (name, options) {\n return [\n pushGraphicsState(),\n options.graphicsState && setGraphicsState(options.graphicsState),\n translate(options.x, options.y),\n rotateRadians(toRadians(options.rotate)),\n scale(options.width, options.height),\n skewRadians(toRadians(options.xSkew), toRadians(options.ySkew)),\n drawObject(name),\n popGraphicsState(),\n ].filter(Boolean);\n};\nexport var drawPage = function (name, options) {\n return [\n pushGraphicsState(),\n options.graphicsState && setGraphicsState(options.graphicsState),\n translate(options.x, options.y),\n rotateRadians(toRadians(options.rotate)),\n scale(options.xScale, options.yScale),\n skewRadians(toRadians(options.xSkew), toRadians(options.ySkew)),\n drawObject(name),\n popGraphicsState(),\n ].filter(Boolean);\n};\nexport var drawLine = function (options) {\n var _a, _b;\n return [\n pushGraphicsState(),\n options.graphicsState && setGraphicsState(options.graphicsState),\n options.color && setStrokingColor(options.color),\n setLineWidth(options.thickness),\n setDashPattern((_a = options.dashArray) !== null && _a !== void 0 ? _a : [], (_b = options.dashPhase) !== null && _b !== void 0 ? _b : 0),\n moveTo(options.start.x, options.start.y),\n options.lineCap && setLineCap(options.lineCap),\n moveTo(options.start.x, options.start.y),\n lineTo(options.end.x, options.end.y),\n stroke(),\n popGraphicsState(),\n ].filter(Boolean);\n};\nexport var drawRectangle = function (options) {\n var _a, _b;\n return [\n pushGraphicsState(),\n options.graphicsState && setGraphicsState(options.graphicsState),\n options.color && setFillingColor(options.color),\n options.borderColor && setStrokingColor(options.borderColor),\n setLineWidth(options.borderWidth),\n options.borderLineCap && setLineCap(options.borderLineCap),\n setDashPattern((_a = options.borderDashArray) !== null && _a !== void 0 ? _a : [], (_b = options.borderDashPhase) !== null && _b !== void 0 ? _b : 0),\n translate(options.x, options.y),\n rotateRadians(toRadians(options.rotate)),\n skewRadians(toRadians(options.xSkew), toRadians(options.ySkew)),\n moveTo(0, 0),\n lineTo(0, options.height),\n lineTo(options.width, options.height),\n lineTo(options.width, 0),\n closePath(),\n // prettier-ignore\n options.color && options.borderWidth ? fillAndStroke()\n : options.color ? fill()\n : options.borderColor ? stroke()\n : closePath(),\n popGraphicsState(),\n ].filter(Boolean);\n};\nvar KAPPA = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0);\n/** @deprecated */\nexport var drawEllipsePath = function (config) {\n var x = asNumber(config.x);\n var y = asNumber(config.y);\n var xScale = asNumber(config.xScale);\n var yScale = asNumber(config.yScale);\n x -= xScale;\n y -= yScale;\n var ox = xScale * KAPPA;\n var oy = yScale * KAPPA;\n var xe = x + xScale * 2;\n var ye = y + yScale * 2;\n var xm = x + xScale;\n var ym = y + yScale;\n return [\n pushGraphicsState(),\n moveTo(x, ym),\n appendBezierCurve(x, ym - oy, xm - ox, y, xm, y),\n appendBezierCurve(xm + ox, y, xe, ym - oy, xe, ym),\n appendBezierCurve(xe, ym + oy, xm + ox, ye, xm, ye),\n appendBezierCurve(xm - ox, ye, x, ym + oy, x, ym),\n popGraphicsState(),\n ];\n};\nvar drawEllipseCurves = function (config) {\n var centerX = asNumber(config.x);\n var centerY = asNumber(config.y);\n var xScale = asNumber(config.xScale);\n var yScale = asNumber(config.yScale);\n var x = -xScale;\n var y = -yScale;\n var ox = xScale * KAPPA;\n var oy = yScale * KAPPA;\n var xe = x + xScale * 2;\n var ye = y + yScale * 2;\n var xm = x + xScale;\n var ym = y + yScale;\n return [\n translate(centerX, centerY),\n rotateRadians(toRadians(config.rotate)),\n moveTo(x, ym),\n appendBezierCurve(x, ym - oy, xm - ox, y, xm, y),\n appendBezierCurve(xm + ox, y, xe, ym - oy, xe, ym),\n appendBezierCurve(xe, ym + oy, xm + ox, ye, xm, ye),\n appendBezierCurve(xm - ox, ye, x, ym + oy, x, ym),\n ];\n};\nexport var drawEllipse = function (options) {\n var _a, _b, _c;\n return __spreadArrays([\n pushGraphicsState(),\n options.graphicsState && setGraphicsState(options.graphicsState),\n options.color && setFillingColor(options.color),\n options.borderColor && setStrokingColor(options.borderColor),\n setLineWidth(options.borderWidth),\n options.borderLineCap && setLineCap(options.borderLineCap),\n setDashPattern((_a = options.borderDashArray) !== null && _a !== void 0 ? _a : [], (_b = options.borderDashPhase) !== null && _b !== void 0 ? _b : 0)\n ], (options.rotate === undefined\n ? drawEllipsePath({\n x: options.x,\n y: options.y,\n xScale: options.xScale,\n yScale: options.yScale,\n })\n : drawEllipseCurves({\n x: options.x,\n y: options.y,\n xScale: options.xScale,\n yScale: options.yScale,\n rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : degrees(0),\n })), [\n // prettier-ignore\n options.color && options.borderWidth ? fillAndStroke()\n : options.color ? fill()\n : options.borderColor ? stroke()\n : closePath(),\n popGraphicsState(),\n ]).filter(Boolean);\n};\nexport var drawSvgPath = function (path, options) {\n var _a, _b, _c;\n return __spreadArrays([\n pushGraphicsState(),\n options.graphicsState && setGraphicsState(options.graphicsState),\n translate(options.x, options.y),\n rotateRadians(toRadians((_a = options.rotate) !== null && _a !== void 0 ? _a : degrees(0))),\n // SVG path Y axis is opposite pdf-lib's\n options.scale ? scale(options.scale, -options.scale) : scale(1, -1),\n options.color && setFillingColor(options.color),\n options.borderColor && setStrokingColor(options.borderColor),\n options.borderWidth && setLineWidth(options.borderWidth),\n options.borderLineCap && setLineCap(options.borderLineCap),\n setDashPattern((_b = options.borderDashArray) !== null && _b !== void 0 ? _b : [], (_c = options.borderDashPhase) !== null && _c !== void 0 ? _c : 0)\n ], svgPathToOperators(path), [\n // prettier-ignore\n options.color && options.borderWidth ? fillAndStroke()\n : options.color ? fill()\n : options.borderColor ? stroke()\n : closePath(),\n popGraphicsState(),\n ]).filter(Boolean);\n};\nexport var drawCheckMark = function (options) {\n var size = asNumber(options.size);\n /*********************** Define Check Mark Points ***************************/\n // A check mark is defined by three points in some coordinate space. Here, we\n // define these points in a unit coordinate system, where the range of the x\n // and y axis are both [-1, 1].\n //\n // Note that we do not hard code `p1y` in case we wish to change the\n // size/shape of the check mark in the future. We want the check mark to\n // always form a right angle. This means that the dot product between (p1-p2)\n // and (p3-p2) should be zero:\n //\n // (p1x-p2x) * (p3x-p2x) + (p1y-p2y) * (p3y-p2y) = 0\n //\n // We can now rejigger this equation to solve for `p1y`:\n //\n // (p1y-p2y) * (p3y-p2y) = -((p1x-p2x) * (p3x-p2x))\n // (p1y-p2y) = -((p1x-p2x) * (p3x-p2x)) / (p3y-p2y)\n // p1y = -((p1x-p2x) * (p3x-p2x)) / (p3y-p2y) + p2y\n //\n // Thanks to my friend Joel Walker (https://github.com/JWalker1995) for\n // devising the above equation and unit coordinate system approach!\n // (x, y) coords of the check mark's bottommost point\n var p2x = -1 + 0.75;\n var p2y = -1 + 0.51;\n // (x, y) coords of the check mark's topmost point\n var p3y = 1 - 0.525;\n var p3x = 1 - 0.31;\n // (x, y) coords of the check mark's center (vertically) point\n var p1x = -1 + 0.325;\n var p1y = -((p1x - p2x) * (p3x - p2x)) / (p3y - p2y) + p2y;\n /****************************************************************************/\n return [\n pushGraphicsState(),\n options.color && setStrokingColor(options.color),\n setLineWidth(options.thickness),\n translate(options.x, options.y),\n moveTo(p1x * size, p1y * size),\n lineTo(p2x * size, p2y * size),\n lineTo(p3x * size, p3y * size),\n stroke(),\n popGraphicsState(),\n ].filter(Boolean);\n};\n// prettier-ignore\nexport var rotateInPlace = function (options) {\n return options.rotation === 0 ? [\n translate(0, 0),\n rotateDegrees(0)\n ]\n : options.rotation === 90 ? [\n translate(options.width, 0),\n rotateDegrees(90)\n ]\n : options.rotation === 180 ? [\n translate(options.width, options.height),\n rotateDegrees(180)\n ]\n : options.rotation === 270 ? [\n translate(0, options.height),\n rotateDegrees(270)\n ]\n : [];\n}; // Invalid rotation - noop\nexport var drawCheckBox = function (options) {\n var outline = drawRectangle({\n x: options.x,\n y: options.y,\n width: options.width,\n height: options.height,\n borderWidth: options.borderWidth,\n color: options.color,\n borderColor: options.borderColor,\n rotate: degrees(0),\n xSkew: degrees(0),\n ySkew: degrees(0),\n });\n if (!options.filled)\n return outline;\n var width = asNumber(options.width);\n var height = asNumber(options.height);\n var checkMarkSize = Math.min(width, height) / 2;\n var checkMark = drawCheckMark({\n x: width / 2,\n y: height / 2,\n size: checkMarkSize,\n thickness: options.thickness,\n color: options.markColor,\n });\n return __spreadArrays([pushGraphicsState()], outline, checkMark, [popGraphicsState()]);\n};\nexport var drawRadioButton = function (options) {\n var width = asNumber(options.width);\n var height = asNumber(options.height);\n var outlineScale = Math.min(width, height) / 2;\n var outline = drawEllipse({\n x: options.x,\n y: options.y,\n xScale: outlineScale,\n yScale: outlineScale,\n color: options.color,\n borderColor: options.borderColor,\n borderWidth: options.borderWidth,\n });\n if (!options.filled)\n return outline;\n var dot = drawEllipse({\n x: options.x,\n y: options.y,\n xScale: outlineScale * 0.45,\n yScale: outlineScale * 0.45,\n color: options.dotColor,\n borderColor: undefined,\n borderWidth: 0,\n });\n return __spreadArrays([pushGraphicsState()], outline, dot, [popGraphicsState()]);\n};\nexport var drawButton = function (options) {\n var x = asNumber(options.x);\n var y = asNumber(options.y);\n var width = asNumber(options.width);\n var height = asNumber(options.height);\n var background = drawRectangle({\n x: x,\n y: y,\n width: width,\n height: height,\n borderWidth: options.borderWidth,\n color: options.color,\n borderColor: options.borderColor,\n rotate: degrees(0),\n xSkew: degrees(0),\n ySkew: degrees(0),\n });\n var lines = drawTextLines(options.textLines, {\n color: options.textColor,\n font: options.font,\n size: options.fontSize,\n rotate: degrees(0),\n xSkew: degrees(0),\n ySkew: degrees(0),\n });\n return __spreadArrays([pushGraphicsState()], background, lines, [popGraphicsState()]);\n};\nexport var drawTextLines = function (lines, options) {\n var operators = [\n beginText(),\n setFillingColor(options.color),\n setFontAndSize(options.font, options.size),\n ];\n for (var idx = 0, len = lines.length; idx < len; idx++) {\n var _a = lines[idx], encoded = _a.encoded, x = _a.x, y = _a.y;\n operators.push(rotateAndSkewTextRadiansAndTranslate(toRadians(options.rotate), toRadians(options.xSkew), toRadians(options.ySkew), x, y), showText(encoded));\n }\n operators.push(endText());\n return operators;\n};\nexport var drawTextField = function (options) {\n var x = asNumber(options.x);\n var y = asNumber(options.y);\n var width = asNumber(options.width);\n var height = asNumber(options.height);\n var borderWidth = asNumber(options.borderWidth);\n var padding = asNumber(options.padding);\n var clipX = x + borderWidth / 2 + padding;\n var clipY = y + borderWidth / 2 + padding;\n var clipWidth = width - (borderWidth / 2 + padding) * 2;\n var clipHeight = height - (borderWidth / 2 + padding) * 2;\n var clippingArea = [\n moveTo(clipX, clipY),\n lineTo(clipX, clipY + clipHeight),\n lineTo(clipX + clipWidth, clipY + clipHeight),\n lineTo(clipX + clipWidth, clipY),\n closePath(),\n clip(),\n endPath(),\n ];\n var background = drawRectangle({\n x: x,\n y: y,\n width: width,\n height: height,\n borderWidth: options.borderWidth,\n color: options.color,\n borderColor: options.borderColor,\n rotate: degrees(0),\n xSkew: degrees(0),\n ySkew: degrees(0),\n });\n var lines = drawTextLines(options.textLines, {\n color: options.textColor,\n font: options.font,\n size: options.fontSize,\n rotate: degrees(0),\n xSkew: degrees(0),\n ySkew: degrees(0),\n });\n var markedContent = __spreadArrays([\n beginMarkedContent('Tx'),\n pushGraphicsState()\n ], lines, [\n popGraphicsState(),\n endMarkedContent(),\n ]);\n return __spreadArrays([\n pushGraphicsState()\n ], background, clippingArea, markedContent, [\n popGraphicsState(),\n ]);\n};\nexport var drawOptionList = function (options) {\n var x = asNumber(options.x);\n var y = asNumber(options.y);\n var width = asNumber(options.width);\n var height = asNumber(options.height);\n var lineHeight = asNumber(options.lineHeight);\n var borderWidth = asNumber(options.borderWidth);\n var padding = asNumber(options.padding);\n var clipX = x + borderWidth / 2 + padding;\n var clipY = y + borderWidth / 2 + padding;\n var clipWidth = width - (borderWidth / 2 + padding) * 2;\n var clipHeight = height - (borderWidth / 2 + padding) * 2;\n var clippingArea = [\n moveTo(clipX, clipY),\n lineTo(clipX, clipY + clipHeight),\n lineTo(clipX + clipWidth, clipY + clipHeight),\n lineTo(clipX + clipWidth, clipY),\n closePath(),\n clip(),\n endPath(),\n ];\n var background = drawRectangle({\n x: x,\n y: y,\n width: width,\n height: height,\n borderWidth: options.borderWidth,\n color: options.color,\n borderColor: options.borderColor,\n rotate: degrees(0),\n xSkew: degrees(0),\n ySkew: degrees(0),\n });\n var highlights = [];\n for (var idx = 0, len = options.selectedLines.length; idx < len; idx++) {\n var line = options.textLines[options.selectedLines[idx]];\n highlights.push.apply(highlights, drawRectangle({\n x: line.x - padding,\n y: line.y - (lineHeight - line.height) / 2,\n width: width - borderWidth,\n height: line.height + (lineHeight - line.height) / 2,\n borderWidth: 0,\n color: options.selectedColor,\n borderColor: undefined,\n rotate: degrees(0),\n xSkew: degrees(0),\n ySkew: degrees(0),\n }));\n }\n var lines = drawTextLines(options.textLines, {\n color: options.textColor,\n font: options.font,\n size: options.fontSize,\n rotate: degrees(0),\n xSkew: degrees(0),\n ySkew: degrees(0),\n });\n var markedContent = __spreadArrays([\n beginMarkedContent('Tx'),\n pushGraphicsState()\n ], lines, [\n popGraphicsState(),\n endMarkedContent(),\n ]);\n return __spreadArrays([\n pushGraphicsState()\n ], background, highlights, clippingArea, markedContent, [\n popGraphicsState(),\n ]);\n};\n//# sourceMappingURL=operations.js.map","// tslint:disable: max-classes-per-file\nimport { __extends } from \"tslib\";\n// TODO: Include link to documentation with example\nvar EncryptedPDFError = /** @class */ (function (_super) {\n __extends(EncryptedPDFError, _super);\n function EncryptedPDFError() {\n var _this = this;\n var msg = 'Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.';\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return EncryptedPDFError;\n}(Error));\nexport { EncryptedPDFError };\n// TODO: Include link to documentation with example\nvar FontkitNotRegisteredError = /** @class */ (function (_super) {\n __extends(FontkitNotRegisteredError, _super);\n function FontkitNotRegisteredError() {\n var _this = this;\n 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.';\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return FontkitNotRegisteredError;\n}(Error));\nexport { FontkitNotRegisteredError };\n// TODO: Include link to documentation with example\nvar ForeignPageError = /** @class */ (function (_super) {\n __extends(ForeignPageError, _super);\n function ForeignPageError() {\n var _this = this;\n 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.';\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return ForeignPageError;\n}(Error));\nexport { ForeignPageError };\n// TODO: Include link to documentation with example\nvar RemovePageFromEmptyDocumentError = /** @class */ (function (_super) {\n __extends(RemovePageFromEmptyDocumentError, _super);\n function RemovePageFromEmptyDocumentError() {\n var _this = this;\n var msg = 'PDFDocument has no pages so `PDFDocument.removePage` cannot be called';\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return RemovePageFromEmptyDocumentError;\n}(Error));\nexport { RemovePageFromEmptyDocumentError };\nvar NoSuchFieldError = /** @class */ (function (_super) {\n __extends(NoSuchFieldError, _super);\n function NoSuchFieldError(name) {\n var _this = this;\n var msg = \"PDFDocument has no form field with the name \\\"\" + name + \"\\\"\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return NoSuchFieldError;\n}(Error));\nexport { NoSuchFieldError };\nvar UnexpectedFieldTypeError = /** @class */ (function (_super) {\n __extends(UnexpectedFieldTypeError, _super);\n function UnexpectedFieldTypeError(name, expected, actual) {\n var _a, _b;\n var _this = this;\n var expectedType = expected === null || expected === void 0 ? void 0 : expected.name;\n 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;\n var msg = \"Expected field \\\"\" + name + \"\\\" to be of type \" + expectedType + \", \" +\n (\"but it is actually of type \" + actualType);\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return UnexpectedFieldTypeError;\n}(Error));\nexport { UnexpectedFieldTypeError };\nvar MissingOnValueCheckError = /** @class */ (function (_super) {\n __extends(MissingOnValueCheckError, _super);\n function MissingOnValueCheckError(onValue) {\n var _this = this;\n var msg = \"Failed to select check box due to missing onValue: \\\"\" + onValue + \"\\\"\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return MissingOnValueCheckError;\n}(Error));\nexport { MissingOnValueCheckError };\nvar FieldAlreadyExistsError = /** @class */ (function (_super) {\n __extends(FieldAlreadyExistsError, _super);\n function FieldAlreadyExistsError(name) {\n var _this = this;\n var msg = \"A field already exists with the specified name: \\\"\" + name + \"\\\"\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return FieldAlreadyExistsError;\n}(Error));\nexport { FieldAlreadyExistsError };\nvar InvalidFieldNamePartError = /** @class */ (function (_super) {\n __extends(InvalidFieldNamePartError, _super);\n function InvalidFieldNamePartError(namePart) {\n var _this = this;\n var msg = \"Field name contains invalid component: \\\"\" + namePart + \"\\\"\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return InvalidFieldNamePartError;\n}(Error));\nexport { InvalidFieldNamePartError };\nvar FieldExistsAsNonTerminalError = /** @class */ (function (_super) {\n __extends(FieldExistsAsNonTerminalError, _super);\n function FieldExistsAsNonTerminalError(name) {\n var _this = this;\n var msg = \"A non-terminal field already exists with the specified name: \\\"\" + name + \"\\\"\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return FieldExistsAsNonTerminalError;\n}(Error));\nexport { FieldExistsAsNonTerminalError };\nvar RichTextFieldReadError = /** @class */ (function (_super) {\n __extends(RichTextFieldReadError, _super);\n function RichTextFieldReadError(fieldName) {\n var _this = this;\n var msg = \"Reading rich text fields is not supported: Attempted to read rich text field: \" + fieldName;\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return RichTextFieldReadError;\n}(Error));\nexport { RichTextFieldReadError };\nvar CombedTextLayoutError = /** @class */ (function (_super) {\n __extends(CombedTextLayoutError, _super);\n function CombedTextLayoutError(lineLength, cellCount) {\n var _this = this;\n var msg = \"Failed to layout combed text as lineLength=\" + lineLength + \" is greater than cellCount=\" + cellCount;\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return CombedTextLayoutError;\n}(Error));\nexport { CombedTextLayoutError };\nvar ExceededMaxLengthError = /** @class */ (function (_super) {\n __extends(ExceededMaxLengthError, _super);\n function ExceededMaxLengthError(textLength, maxLength, name) {\n var _this = this;\n var msg = \"Attempted to set text with length=\" + textLength + \" for TextField with maxLength=\" + maxLength + \" and name=\" + name;\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return ExceededMaxLengthError;\n}(Error));\nexport { ExceededMaxLengthError };\nvar InvalidMaxLengthError = /** @class */ (function (_super) {\n __extends(InvalidMaxLengthError, _super);\n function InvalidMaxLengthError(textLength, maxLength, name) {\n var _this = this;\n var msg = \"Attempted to set maxLength=\" + maxLength + \", which is less than \" + textLength + \", the length of this field's current value (name=\" + name + \")\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return InvalidMaxLengthError;\n}(Error));\nexport { InvalidMaxLengthError };\n//# sourceMappingURL=errors.js.map","import { CombedTextLayoutError } from \"../errors\";\nimport { TextAlignment } from \"./alignment\";\nimport { cleanText, lineSplit, mergeLines, charAtIndex, charSplit, } from \"../../utils\";\nvar MIN_FONT_SIZE = 4;\nvar MAX_FONT_SIZE = 500;\nvar computeFontSize = function (lines, font, bounds, multiline) {\n if (multiline === void 0) { multiline = false; }\n var fontSize = MIN_FONT_SIZE;\n while (fontSize < MAX_FONT_SIZE) {\n var linesUsed = 0;\n for (var lineIdx = 0, lineLen = lines.length; lineIdx < lineLen; lineIdx++) {\n linesUsed += 1;\n var line = lines[lineIdx];\n var words = line.split(' ');\n // Layout the words using the current `fontSize`, line wrapping\n // whenever we reach the end of the current line.\n var spaceInLineRemaining = bounds.width;\n for (var idx = 0, len = words.length; idx < len; idx++) {\n var isLastWord = idx === len - 1;\n var word = isLastWord ? words[idx] : words[idx] + ' ';\n var widthOfWord = font.widthOfTextAtSize(word, fontSize);\n spaceInLineRemaining -= widthOfWord;\n if (spaceInLineRemaining <= 0) {\n linesUsed += 1;\n spaceInLineRemaining = bounds.width - widthOfWord;\n }\n }\n }\n // Return if we exceeded the allowed width\n if (!multiline && linesUsed > lines.length)\n return fontSize - 1;\n var height = font.heightAtSize(fontSize);\n var lineHeight = height + height * 0.2;\n var totalHeight = lineHeight * linesUsed;\n // Return if we exceeded the allowed height\n if (totalHeight > Math.abs(bounds.height))\n return fontSize - 1;\n fontSize += 1;\n }\n return fontSize;\n};\nvar computeCombedFontSize = function (line, font, bounds, cellCount) {\n var cellWidth = bounds.width / cellCount;\n var cellHeight = bounds.height;\n var fontSize = MIN_FONT_SIZE;\n var chars = charSplit(line);\n while (fontSize < MAX_FONT_SIZE) {\n for (var idx = 0, len = chars.length; idx < len; idx++) {\n var c = chars[idx];\n var tooLong = font.widthOfTextAtSize(c, fontSize) > cellWidth * 0.75;\n if (tooLong)\n return fontSize - 1;\n }\n var height = font.heightAtSize(fontSize, { descender: false });\n if (height > cellHeight)\n return fontSize - 1;\n fontSize += 1;\n }\n return fontSize;\n};\nvar lastIndexOfWhitespace = function (line) {\n for (var idx = line.length; idx > 0; idx--) {\n if (/\\s/.test(line[idx]))\n return idx;\n }\n return undefined;\n};\nvar splitOutLines = function (input, maxWidth, font, fontSize) {\n var _a;\n var lastWhitespaceIdx = input.length;\n while (lastWhitespaceIdx > 0) {\n var line = input.substring(0, lastWhitespaceIdx);\n var encoded = font.encodeText(line);\n var width = font.widthOfTextAtSize(line, fontSize);\n if (width < maxWidth) {\n var remainder = input.substring(lastWhitespaceIdx) || undefined;\n return { line: line, encoded: encoded, width: width, remainder: remainder };\n }\n lastWhitespaceIdx = (_a = lastIndexOfWhitespace(line)) !== null && _a !== void 0 ? _a : 0;\n }\n // We were unable to split the input enough to get a chunk that would fit\n // within the specified `maxWidth` so we'll just return everything\n return {\n line: input,\n encoded: font.encodeText(input),\n width: font.widthOfTextAtSize(input, fontSize),\n remainder: undefined,\n };\n};\nexport var layoutMultilineText = function (text, _a) {\n var alignment = _a.alignment, fontSize = _a.fontSize, font = _a.font, bounds = _a.bounds;\n var lines = lineSplit(cleanText(text));\n if (fontSize === undefined || fontSize === 0) {\n fontSize = computeFontSize(lines, font, bounds, true);\n }\n var height = font.heightAtSize(fontSize);\n var lineHeight = height + height * 0.2;\n var textLines = [];\n var minX = bounds.x;\n var minY = bounds.y;\n var maxX = bounds.x + bounds.width;\n var maxY = bounds.y + bounds.height;\n var y = bounds.y + bounds.height;\n for (var idx = 0, len = lines.length; idx < len; idx++) {\n var prevRemainder = lines[idx];\n while (prevRemainder !== undefined) {\n var _b = splitOutLines(prevRemainder, bounds.width, font, fontSize), line = _b.line, encoded = _b.encoded, width = _b.width, remainder = _b.remainder;\n // prettier-ignore\n var x = (alignment === TextAlignment.Left ? bounds.x\n : alignment === TextAlignment.Center ? bounds.x + (bounds.width / 2) - (width / 2)\n : alignment === TextAlignment.Right ? bounds.x + bounds.width - width\n : bounds.x);\n y -= lineHeight;\n if (x < minX)\n minX = x;\n if (y < minY)\n minY = y;\n if (x + width > maxX)\n maxX = x + width;\n if (y + height > maxY)\n maxY = y + height;\n textLines.push({ text: line, encoded: encoded, width: width, height: height, x: x, y: y });\n // Only trim lines that we had to split ourselves. So we won't trim lines\n // that the user provided themselves with whitespace.\n prevRemainder = remainder === null || remainder === void 0 ? void 0 : remainder.trim();\n }\n }\n return {\n fontSize: fontSize,\n lineHeight: lineHeight,\n lines: textLines,\n bounds: {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY,\n },\n };\n};\nexport var layoutCombedText = function (text, _a) {\n var fontSize = _a.fontSize, font = _a.font, bounds = _a.bounds, cellCount = _a.cellCount;\n var line = mergeLines(cleanText(text));\n if (line.length > cellCount) {\n throw new CombedTextLayoutError(line.length, cellCount);\n }\n if (fontSize === undefined || fontSize === 0) {\n fontSize = computeCombedFontSize(line, font, bounds, cellCount);\n }\n var cellWidth = bounds.width / cellCount;\n var height = font.heightAtSize(fontSize, { descender: false });\n var y = bounds.y + (bounds.height / 2 - height / 2);\n var cells = [];\n var minX = bounds.x;\n var minY = bounds.y;\n var maxX = bounds.x + bounds.width;\n var maxY = bounds.y + bounds.height;\n var cellOffset = 0;\n var charOffset = 0;\n while (cellOffset < cellCount) {\n var _b = charAtIndex(line, charOffset), char = _b[0], charLength = _b[1];\n var encoded = font.encodeText(char);\n var width = font.widthOfTextAtSize(char, fontSize);\n var cellCenter = bounds.x + (cellWidth * cellOffset + cellWidth / 2);\n var x = cellCenter - width / 2;\n if (x < minX)\n minX = x;\n if (y < minY)\n minY = y;\n if (x + width > maxX)\n maxX = x + width;\n if (y + height > maxY)\n maxY = y + height;\n cells.push({ text: line, encoded: encoded, width: width, height: height, x: x, y: y });\n cellOffset += 1;\n charOffset += charLength;\n }\n return {\n fontSize: fontSize,\n cells: cells,\n bounds: {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY,\n },\n };\n};\nexport var layoutSinglelineText = function (text, _a) {\n var alignment = _a.alignment, fontSize = _a.fontSize, font = _a.font, bounds = _a.bounds;\n var line = mergeLines(cleanText(text));\n if (fontSize === undefined || fontSize === 0) {\n fontSize = computeFontSize([line], font, bounds);\n }\n var encoded = font.encodeText(line);\n var width = font.widthOfTextAtSize(line, fontSize);\n var height = font.heightAtSize(fontSize, { descender: false });\n // prettier-ignore\n var x = (alignment === TextAlignment.Left ? bounds.x\n : alignment === TextAlignment.Center ? bounds.x + (bounds.width / 2) - (width / 2)\n : alignment === TextAlignment.Right ? bounds.x + bounds.width - width\n : bounds.x);\n var y = bounds.y + (bounds.height / 2 - height / 2);\n return {\n fontSize: fontSize,\n line: { text: line, encoded: encoded, width: width, height: height, x: x, y: y },\n bounds: { x: x, y: y, width: width, height: height },\n };\n};\n//# sourceMappingURL=layout.js.map","import { __assign, __spreadArrays } from \"tslib\";\nimport { drawCheckBox, rotateInPlace, drawRadioButton, drawButton, drawTextField, drawOptionList, } from \"../operations\";\nimport { rgb, componentsToColor, setFillingColor, grayscale, cmyk, } from \"../colors\";\nimport { reduceRotation, adjustDimsForRotation } from \"../rotations\";\nimport { layoutMultilineText, layoutCombedText, layoutSinglelineText, } from \"../text/layout\";\nimport { TextAlignment } from \"../text/alignment\";\nimport { setFontAndSize } from \"../operators\";\nimport { findLastMatch } from \"../../utils\";\n/********************* Appearance Provider Functions **************************/\nexport var normalizeAppearance = function (appearance) {\n if ('normal' in appearance)\n return appearance;\n return { normal: appearance };\n};\n// Examples:\n// `/Helv 12 Tf` -> ['/Helv 12 Tf', 'Helv', '12']\n// `/HeBo 8.00 Tf` -> ['/HeBo 8 Tf', 'HeBo', '8.00']\nvar tfRegex = /\\/([^\\0\\t\\n\\f\\r\\ ]+)[\\0\\t\\n\\f\\r\\ ]+(\\d*\\.\\d+|\\d+)[\\0\\t\\n\\f\\r\\ ]+Tf/;\nvar getDefaultFontSize = function (field) {\n var _a, _b;\n var da = (_a = field.getDefaultAppearance()) !== null && _a !== void 0 ? _a : '';\n var daMatch = (_b = findLastMatch(da, tfRegex).match) !== null && _b !== void 0 ? _b : [];\n var defaultFontSize = Number(daMatch[2]);\n return isFinite(defaultFontSize) ? defaultFontSize : undefined;\n};\n// Examples:\n// `0.3 g` -> ['0.3', 'g']\n// `0.3 1 .3 rg` -> ['0.3', '1', '.3', 'rg']\n// `0.3 1 .3 0 k` -> ['0.3', '1', '.3', '0', 'k']\nvar 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)/;\nvar getDefaultColor = function (field) {\n var _a;\n var da = (_a = field.getDefaultAppearance()) !== null && _a !== void 0 ? _a : '';\n var daMatch = findLastMatch(da, colorRegex).match;\n var _b = daMatch !== null && daMatch !== void 0 ? daMatch : [], c1 = _b[1], c2 = _b[2], c3 = _b[3], c4 = _b[4], colorSpace = _b[5];\n if (colorSpace === 'g' && c1) {\n return grayscale(Number(c1));\n }\n if (colorSpace === 'rg' && c1 && c2 && c3) {\n return rgb(Number(c1), Number(c2), Number(c3));\n }\n if (colorSpace === 'k' && c1 && c2 && c3 && c4) {\n return cmyk(Number(c1), Number(c2), Number(c3), Number(c4));\n }\n return undefined;\n};\nvar updateDefaultAppearance = function (field, color, font, fontSize) {\n var _a;\n if (fontSize === void 0) { fontSize = 0; }\n var da = [\n setFillingColor(color).toString(),\n setFontAndSize((_a = font === null || font === void 0 ? void 0 : font.name) !== null && _a !== void 0 ? _a : 'dummy__noop', fontSize).toString(),\n ].join('\\n');\n field.setDefaultAppearance(da);\n};\nexport var defaultCheckBoxAppearanceProvider = function (checkBox, widget) {\n var _a, _b, _c;\n // The `/DA` entry can be at the widget or field level - so we handle both\n var widgetColor = getDefaultColor(widget);\n var fieldColor = getDefaultColor(checkBox.acroField);\n var rectangle = widget.getRectangle();\n var ap = widget.getAppearanceCharacteristics();\n var bs = widget.getBorderStyle();\n var borderWidth = (_a = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _a !== void 0 ? _a : 0;\n var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation());\n var _d = adjustDimsForRotation(rectangle, rotation), width = _d.width, height = _d.height;\n var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation: rotation }));\n var black = rgb(0, 0, 0);\n var borderColor = (_b = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor())) !== null && _b !== void 0 ? _b : black;\n var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor());\n var downBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor(), 0.8);\n // Update color\n var textColor = (_c = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _c !== void 0 ? _c : black;\n if (widgetColor) {\n updateDefaultAppearance(widget, textColor);\n }\n else {\n updateDefaultAppearance(checkBox.acroField, textColor);\n }\n var options = {\n x: 0 + borderWidth / 2,\n y: 0 + borderWidth / 2,\n width: width - borderWidth,\n height: height - borderWidth,\n thickness: 1.5,\n borderWidth: borderWidth,\n borderColor: borderColor,\n markColor: textColor,\n };\n return {\n normal: {\n on: __spreadArrays(rotate, drawCheckBox(__assign(__assign({}, options), { color: normalBackgroundColor, filled: true }))),\n off: __spreadArrays(rotate, drawCheckBox(__assign(__assign({}, options), { color: normalBackgroundColor, filled: false }))),\n },\n down: {\n on: __spreadArrays(rotate, drawCheckBox(__assign(__assign({}, options), { color: downBackgroundColor, filled: true }))),\n off: __spreadArrays(rotate, drawCheckBox(__assign(__assign({}, options), { color: downBackgroundColor, filled: false }))),\n },\n };\n};\nexport var defaultRadioGroupAppearanceProvider = function (radioGroup, widget) {\n var _a, _b, _c;\n // The `/DA` entry can be at the widget or field level - so we handle both\n var widgetColor = getDefaultColor(widget);\n var fieldColor = getDefaultColor(radioGroup.acroField);\n var rectangle = widget.getRectangle();\n var ap = widget.getAppearanceCharacteristics();\n var bs = widget.getBorderStyle();\n var borderWidth = (_a = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _a !== void 0 ? _a : 0;\n var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation());\n var _d = adjustDimsForRotation(rectangle, rotation), width = _d.width, height = _d.height;\n var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation: rotation }));\n var black = rgb(0, 0, 0);\n var borderColor = (_b = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor())) !== null && _b !== void 0 ? _b : black;\n var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor());\n var downBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor(), 0.8);\n // Update color\n var textColor = (_c = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _c !== void 0 ? _c : black;\n if (widgetColor) {\n updateDefaultAppearance(widget, textColor);\n }\n else {\n updateDefaultAppearance(radioGroup.acroField, textColor);\n }\n var options = {\n x: width / 2,\n y: height / 2,\n width: width - borderWidth,\n height: height - borderWidth,\n borderWidth: borderWidth,\n borderColor: borderColor,\n dotColor: textColor,\n };\n return {\n normal: {\n on: __spreadArrays(rotate, drawRadioButton(__assign(__assign({}, options), { color: normalBackgroundColor, filled: true }))),\n off: __spreadArrays(rotate, drawRadioButton(__assign(__assign({}, options), { color: normalBackgroundColor, filled: false }))),\n },\n down: {\n on: __spreadArrays(rotate, drawRadioButton(__assign(__assign({}, options), { color: downBackgroundColor, filled: true }))),\n off: __spreadArrays(rotate, drawRadioButton(__assign(__assign({}, options), { color: downBackgroundColor, filled: false }))),\n },\n };\n};\nexport var defaultButtonAppearanceProvider = function (button, widget, font) {\n var _a, _b, _c, _d, _e;\n // The `/DA` entry can be at the widget or field level - so we handle both\n var widgetColor = getDefaultColor(widget);\n var fieldColor = getDefaultColor(button.acroField);\n var widgetFontSize = getDefaultFontSize(widget);\n var fieldFontSize = getDefaultFontSize(button.acroField);\n var rectangle = widget.getRectangle();\n var ap = widget.getAppearanceCharacteristics();\n var bs = widget.getBorderStyle();\n var captions = ap === null || ap === void 0 ? void 0 : ap.getCaptions();\n var normalText = (_a = captions === null || captions === void 0 ? void 0 : captions.normal) !== null && _a !== void 0 ? _a : '';\n var downText = (_c = (_b = captions === null || captions === void 0 ? void 0 : captions.down) !== null && _b !== void 0 ? _b : normalText) !== null && _c !== void 0 ? _c : '';\n var borderWidth = (_d = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _d !== void 0 ? _d : 0;\n var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation());\n var _f = adjustDimsForRotation(rectangle, rotation), width = _f.width, height = _f.height;\n var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation: rotation }));\n var black = rgb(0, 0, 0);\n var borderColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor());\n var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor());\n var downBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor(), 0.8);\n var bounds = {\n x: borderWidth,\n y: borderWidth,\n width: width - borderWidth * 2,\n height: height - borderWidth * 2,\n };\n var normalLayout = layoutSinglelineText(normalText, {\n alignment: TextAlignment.Center,\n fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize,\n font: font,\n bounds: bounds,\n });\n var downLayout = layoutSinglelineText(downText, {\n alignment: TextAlignment.Center,\n fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize,\n font: font,\n bounds: bounds,\n });\n // Update font size and color\n var fontSize = Math.min(normalLayout.fontSize, downLayout.fontSize);\n var textColor = (_e = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _e !== void 0 ? _e : black;\n if (widgetColor || widgetFontSize !== undefined) {\n updateDefaultAppearance(widget, textColor, font, fontSize);\n }\n else {\n updateDefaultAppearance(button.acroField, textColor, font, fontSize);\n }\n var options = {\n x: 0 + borderWidth / 2,\n y: 0 + borderWidth / 2,\n width: width - borderWidth,\n height: height - borderWidth,\n borderWidth: borderWidth,\n borderColor: borderColor,\n textColor: textColor,\n font: font.name,\n fontSize: fontSize,\n };\n return {\n normal: __spreadArrays(rotate, drawButton(__assign(__assign({}, options), { color: normalBackgroundColor, textLines: [normalLayout.line] }))),\n down: __spreadArrays(rotate, drawButton(__assign(__assign({}, options), { color: downBackgroundColor, textLines: [downLayout.line] }))),\n };\n};\nexport var defaultTextFieldAppearanceProvider = function (textField, widget, font) {\n var _a, _b, _c, _d;\n // The `/DA` entry can be at the widget or field level - so we handle both\n var widgetColor = getDefaultColor(widget);\n var fieldColor = getDefaultColor(textField.acroField);\n var widgetFontSize = getDefaultFontSize(widget);\n var fieldFontSize = getDefaultFontSize(textField.acroField);\n var rectangle = widget.getRectangle();\n var ap = widget.getAppearanceCharacteristics();\n var bs = widget.getBorderStyle();\n var text = (_a = textField.getText()) !== null && _a !== void 0 ? _a : '';\n var borderWidth = (_b = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _b !== void 0 ? _b : 0;\n var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation());\n var _e = adjustDimsForRotation(rectangle, rotation), width = _e.width, height = _e.height;\n var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation: rotation }));\n var black = rgb(0, 0, 0);\n var borderColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor());\n var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor());\n var textLines;\n var fontSize;\n var padding = textField.isCombed() ? 0 : 1;\n var bounds = {\n x: borderWidth + padding,\n y: borderWidth + padding,\n width: width - (borderWidth + padding) * 2,\n height: height - (borderWidth + padding) * 2,\n };\n if (textField.isMultiline()) {\n var layout = layoutMultilineText(text, {\n alignment: textField.getAlignment(),\n fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize,\n font: font,\n bounds: bounds,\n });\n textLines = layout.lines;\n fontSize = layout.fontSize;\n }\n else if (textField.isCombed()) {\n var layout = layoutCombedText(text, {\n fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize,\n font: font,\n bounds: bounds,\n cellCount: (_c = textField.getMaxLength()) !== null && _c !== void 0 ? _c : 0,\n });\n textLines = layout.cells;\n fontSize = layout.fontSize;\n }\n else {\n var layout = layoutSinglelineText(text, {\n alignment: textField.getAlignment(),\n fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize,\n font: font,\n bounds: bounds,\n });\n textLines = [layout.line];\n fontSize = layout.fontSize;\n }\n // Update font size and color\n var textColor = (_d = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _d !== void 0 ? _d : black;\n if (widgetColor || widgetFontSize !== undefined) {\n updateDefaultAppearance(widget, textColor, font, fontSize);\n }\n else {\n updateDefaultAppearance(textField.acroField, textColor, font, fontSize);\n }\n var options = {\n x: 0 + borderWidth / 2,\n y: 0 + borderWidth / 2,\n width: width - borderWidth,\n height: height - borderWidth,\n borderWidth: borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0,\n borderColor: borderColor,\n textColor: textColor,\n font: font.name,\n fontSize: fontSize,\n color: normalBackgroundColor,\n textLines: textLines,\n padding: padding,\n };\n return __spreadArrays(rotate, drawTextField(options));\n};\nexport var defaultDropdownAppearanceProvider = function (dropdown, widget, font) {\n var _a, _b, _c;\n // The `/DA` entry can be at the widget or field level - so we handle both\n var widgetColor = getDefaultColor(widget);\n var fieldColor = getDefaultColor(dropdown.acroField);\n var widgetFontSize = getDefaultFontSize(widget);\n var fieldFontSize = getDefaultFontSize(dropdown.acroField);\n var rectangle = widget.getRectangle();\n var ap = widget.getAppearanceCharacteristics();\n var bs = widget.getBorderStyle();\n var text = (_a = dropdown.getSelected()[0]) !== null && _a !== void 0 ? _a : '';\n var borderWidth = (_b = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _b !== void 0 ? _b : 0;\n var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation());\n var _d = adjustDimsForRotation(rectangle, rotation), width = _d.width, height = _d.height;\n var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation: rotation }));\n var black = rgb(0, 0, 0);\n var borderColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor());\n var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor());\n var padding = 1;\n var bounds = {\n x: borderWidth + padding,\n y: borderWidth + padding,\n width: width - (borderWidth + padding) * 2,\n height: height - (borderWidth + padding) * 2,\n };\n var _e = layoutSinglelineText(text, {\n alignment: TextAlignment.Left,\n fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize,\n font: font,\n bounds: bounds,\n }), line = _e.line, fontSize = _e.fontSize;\n // Update font size and color\n var textColor = (_c = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _c !== void 0 ? _c : black;\n if (widgetColor || widgetFontSize !== undefined) {\n updateDefaultAppearance(widget, textColor, font, fontSize);\n }\n else {\n updateDefaultAppearance(dropdown.acroField, textColor, font, fontSize);\n }\n var options = {\n x: 0 + borderWidth / 2,\n y: 0 + borderWidth / 2,\n width: width - borderWidth,\n height: height - borderWidth,\n borderWidth: borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0,\n borderColor: borderColor,\n textColor: textColor,\n font: font.name,\n fontSize: fontSize,\n color: normalBackgroundColor,\n textLines: [line],\n padding: padding,\n };\n return __spreadArrays(rotate, drawTextField(options));\n};\nexport var defaultOptionListAppearanceProvider = function (optionList, widget, font) {\n var _a, _b;\n // The `/DA` entry can be at the widget or field level - so we handle both\n var widgetColor = getDefaultColor(widget);\n var fieldColor = getDefaultColor(optionList.acroField);\n var widgetFontSize = getDefaultFontSize(widget);\n var fieldFontSize = getDefaultFontSize(optionList.acroField);\n var rectangle = widget.getRectangle();\n var ap = widget.getAppearanceCharacteristics();\n var bs = widget.getBorderStyle();\n var borderWidth = (_a = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _a !== void 0 ? _a : 0;\n var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation());\n var _c = adjustDimsForRotation(rectangle, rotation), width = _c.width, height = _c.height;\n var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation: rotation }));\n var black = rgb(0, 0, 0);\n var borderColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBorderColor());\n var normalBackgroundColor = componentsToColor(ap === null || ap === void 0 ? void 0 : ap.getBackgroundColor());\n var options = optionList.getOptions();\n var selected = optionList.getSelected();\n if (optionList.isSorted())\n options.sort();\n var text = '';\n for (var idx = 0, len = options.length; idx < len; idx++) {\n text += options[idx];\n if (idx < len - 1)\n text += '\\n';\n }\n var padding = 1;\n var bounds = {\n x: borderWidth + padding,\n y: borderWidth + padding,\n width: width - (borderWidth + padding) * 2,\n height: height - (borderWidth + padding) * 2,\n };\n var _d = layoutMultilineText(text, {\n alignment: TextAlignment.Left,\n fontSize: widgetFontSize !== null && widgetFontSize !== void 0 ? widgetFontSize : fieldFontSize,\n font: font,\n bounds: bounds,\n }), lines = _d.lines, fontSize = _d.fontSize, lineHeight = _d.lineHeight;\n var selectedLines = [];\n for (var idx = 0, len = lines.length; idx < len; idx++) {\n var line = lines[idx];\n if (selected.includes(line.text))\n selectedLines.push(idx);\n }\n var blue = rgb(153 / 255, 193 / 255, 218 / 255);\n // Update font size and color\n var textColor = (_b = widgetColor !== null && widgetColor !== void 0 ? widgetColor : fieldColor) !== null && _b !== void 0 ? _b : black;\n if (widgetColor || widgetFontSize !== undefined) {\n updateDefaultAppearance(widget, textColor, font, fontSize);\n }\n else {\n updateDefaultAppearance(optionList.acroField, textColor, font, fontSize);\n }\n return __spreadArrays(rotate, drawOptionList({\n x: 0 + borderWidth / 2,\n y: 0 + borderWidth / 2,\n width: width - borderWidth,\n height: height - borderWidth,\n borderWidth: borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0,\n borderColor: borderColor,\n textColor: textColor,\n font: font.name,\n fontSize: fontSize,\n color: normalBackgroundColor,\n textLines: lines,\n lineHeight: lineHeight,\n selectedColor: blue,\n selectedLines: selectedLines,\n padding: padding,\n }));\n};\n//# sourceMappingURL=appearances.js.map","import { __awaiter, __generator } from \"tslib\";\nimport PDFDocument from \"./PDFDocument\";\nimport { PDFPageEmbedder, PDFRef } from \"../core\";\nimport { assertIs } from \"../utils\";\n/**\n * Represents a PDF page that has been embedded in a [[PDFDocument]].\n */\nvar PDFEmbeddedPage = /** @class */ (function () {\n function PDFEmbeddedPage(ref, doc, embedder) {\n this.alreadyEmbedded = false;\n assertIs(ref, 'ref', [[PDFRef, 'PDFRef']]);\n assertIs(doc, 'doc', [[PDFDocument, 'PDFDocument']]);\n assertIs(embedder, 'embedder', [[PDFPageEmbedder, 'PDFPageEmbedder']]);\n this.ref = ref;\n this.doc = doc;\n this.width = embedder.width;\n this.height = embedder.height;\n this.embedder = embedder;\n }\n /**\n * Compute the width and height of this page after being scaled by the\n * given `factor`. For example:\n * ```js\n * embeddedPage.width // => 500\n * embeddedPage.height // => 250\n *\n * const scaled = embeddedPage.scale(0.5)\n * scaled.width // => 250\n * scaled.height // => 125\n * ```\n * This operation is often useful before drawing a page with\n * [[PDFPage.drawPage]] to compute the `width` and `height` options.\n * @param factor The factor by which this page should be scaled.\n * @returns The width and height of the page after being scaled.\n */\n PDFEmbeddedPage.prototype.scale = function (factor) {\n assertIs(factor, 'factor', ['number']);\n return { width: this.width * factor, height: this.height * factor };\n };\n /**\n * Get the width and height of this page. For example:\n * ```js\n * const { width, height } = embeddedPage.size()\n * ```\n * @returns The width and height of the page.\n */\n PDFEmbeddedPage.prototype.size = function () {\n return this.scale(1);\n };\n /**\n * > **NOTE:** You probably don't need to call this method directly. The\n * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will\n * > automatically ensure all embeddable pages get embedded.\n *\n * Embed this embeddable page in its document.\n *\n * @returns Resolves when the embedding is complete.\n */\n PDFEmbeddedPage.prototype.embed = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!this.alreadyEmbedded) return [3 /*break*/, 2];\n return [4 /*yield*/, this.embedder.embedIntoContext(this.doc.context, this.ref)];\n case 1:\n _a.sent();\n this.alreadyEmbedded = true;\n _a.label = 2;\n case 2: return [2 /*return*/];\n }\n });\n });\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFDocument.embedPdf]] and\n * > [[PDFDocument.embedPage]] methods, which will create instances of\n * > [[PDFEmbeddedPage]] for you.\n *\n * Create an instance of [[PDFEmbeddedPage]] from an existing ref and embedder\n *\n * @param ref The unique reference for this embedded page.\n * @param doc The document to which the embedded page will belong.\n * @param embedder The embedder that will be used to embed the page.\n */\n PDFEmbeddedPage.of = function (ref, doc, embedder) {\n return new PDFEmbeddedPage(ref, doc, embedder);\n };\n return PDFEmbeddedPage;\n}());\nexport default PDFEmbeddedPage;\n//# sourceMappingURL=PDFEmbeddedPage.js.map","import { __awaiter, __generator } from \"tslib\";\nimport PDFDocument from \"./PDFDocument\";\nimport { CustomFontEmbedder, PDFRef, StandardFontEmbedder, } from \"../core\";\nimport { assertIs, assertOrUndefined } from \"../utils\";\n/**\n * Represents a font that has been embedded in a [[PDFDocument]].\n */\nvar PDFFont = /** @class */ (function () {\n function PDFFont(ref, doc, embedder) {\n this.modified = true;\n assertIs(ref, 'ref', [[PDFRef, 'PDFRef']]);\n assertIs(doc, 'doc', [[PDFDocument, 'PDFDocument']]);\n assertIs(embedder, 'embedder', [\n [CustomFontEmbedder, 'CustomFontEmbedder'],\n [StandardFontEmbedder, 'StandardFontEmbedder'],\n ]);\n this.ref = ref;\n this.doc = doc;\n this.name = embedder.fontName;\n this.embedder = embedder;\n }\n /**\n * > **NOTE:** You probably don't need to call this method directly. The\n * > [[PDFPage.drawText]] method will automatically encode the text it is\n * > given.\n *\n * Encodes a string of text in this font.\n *\n * @param text The text to be encoded.\n * @returns The encoded text as a hex string.\n */\n PDFFont.prototype.encodeText = function (text) {\n assertIs(text, 'text', ['string']);\n this.modified = true;\n return this.embedder.encodeText(text);\n };\n /**\n * Measure the width of a string of text drawn in this font at a given size.\n * For example:\n * ```js\n * const width = font.widthOfTextAtSize('Foo Bar Qux Baz', 36)\n * ```\n * @param text The string of text to be measured.\n * @param size The font size to be used for this measurement.\n * @returns The width of the string of text when drawn in this font at the\n * given size.\n */\n PDFFont.prototype.widthOfTextAtSize = function (text, size) {\n assertIs(text, 'text', ['string']);\n assertIs(size, 'size', ['number']);\n return this.embedder.widthOfTextAtSize(text, size);\n };\n /**\n * Measure the height of this font at a given size. For example:\n * ```js\n * const height = font.heightAtSize(24)\n * ```\n *\n * The `options.descender` value controls whether or not the font's\n * descender is included in the height calculation.\n *\n * @param size The font size to be used for this measurement.\n * @param options The options to be used when computing this measurement.\n * @returns The height of this font at the given size.\n */\n PDFFont.prototype.heightAtSize = function (size, options) {\n var _a;\n assertIs(size, 'size', ['number']);\n assertOrUndefined(options === null || options === void 0 ? void 0 : options.descender, 'options.descender', ['boolean']);\n return this.embedder.heightOfFontAtSize(size, {\n descender: (_a = options === null || options === void 0 ? void 0 : options.descender) !== null && _a !== void 0 ? _a : true,\n });\n };\n /**\n * Compute the font size at which this font is a given height. For example:\n * ```js\n * const fontSize = font.sizeAtHeight(12)\n * ```\n * @param height The height to be used for this calculation.\n * @returns The font size at which this font is the given height.\n */\n PDFFont.prototype.sizeAtHeight = function (height) {\n assertIs(height, 'height', ['number']);\n return this.embedder.sizeOfFontAtHeight(height);\n };\n /**\n * Get the set of unicode code points that can be represented by this font.\n * @returns The set of unicode code points supported by this font.\n */\n PDFFont.prototype.getCharacterSet = function () {\n if (this.embedder instanceof StandardFontEmbedder) {\n return this.embedder.encoding.supportedCodePoints;\n }\n else {\n return this.embedder.font.characterSet;\n }\n };\n /**\n * > **NOTE:** You probably don't need to call this method directly. The\n * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will\n * > automatically ensure all fonts get embedded.\n *\n * Embed this font in its document.\n *\n * @returns Resolves when the embedding is complete.\n */\n PDFFont.prototype.embed = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.modified) return [3 /*break*/, 2];\n return [4 /*yield*/, this.embedder.embedIntoContext(this.doc.context, this.ref)];\n case 1:\n _a.sent();\n this.modified = false;\n _a.label = 2;\n case 2: return [2 /*return*/];\n }\n });\n });\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFDocument.embedFont]] and\n * > [[PDFDocument.embedStandardFont]] methods, which will create instances\n * > of [[PDFFont]] for you.\n *\n * Create an instance of [[PDFFont]] from an existing ref and embedder\n *\n * @param ref The unique reference for this font.\n * @param doc The document to which the font will belong.\n * @param embedder The embedder that will be used to embed the font.\n */\n PDFFont.of = function (ref, doc, embedder) {\n return new PDFFont(ref, doc, embedder);\n };\n return PDFFont;\n}());\nexport default PDFFont;\n//# sourceMappingURL=PDFFont.js.map","import { __awaiter, __generator } from \"tslib\";\nimport PDFDocument from \"./PDFDocument\";\nimport { JpegEmbedder, PDFRef, PngEmbedder } from \"../core\";\nimport { assertIs } from \"../utils\";\n/**\n * Represents an image that has been embedded in a [[PDFDocument]].\n */\nvar PDFImage = /** @class */ (function () {\n function PDFImage(ref, doc, embedder) {\n assertIs(ref, 'ref', [[PDFRef, 'PDFRef']]);\n assertIs(doc, 'doc', [[PDFDocument, 'PDFDocument']]);\n assertIs(embedder, 'embedder', [\n [JpegEmbedder, 'JpegEmbedder'],\n [PngEmbedder, 'PngEmbedder'],\n ]);\n this.ref = ref;\n this.doc = doc;\n this.width = embedder.width;\n this.height = embedder.height;\n this.embedder = embedder;\n }\n /**\n * Compute the width and height of this image after being scaled by the\n * given `factor`. For example:\n * ```js\n * image.width // => 500\n * image.height // => 250\n *\n * const scaled = image.scale(0.5)\n * scaled.width // => 250\n * scaled.height // => 125\n * ```\n * This operation is often useful before drawing an image with\n * [[PDFPage.drawImage]] to compute the `width` and `height` options.\n * @param factor The factor by which this image should be scaled.\n * @returns The width and height of the image after being scaled.\n */\n PDFImage.prototype.scale = function (factor) {\n assertIs(factor, 'factor', ['number']);\n return { width: this.width * factor, height: this.height * factor };\n };\n /**\n * Get the width and height of this image after scaling it as large as\n * possible while maintaining its aspect ratio and not exceeding the\n * specified `width` and `height`. For example:\n * ```\n * image.width // => 500\n * image.height // => 250\n *\n * const scaled = image.scaleToFit(750, 1000)\n * scaled.width // => 750\n * scaled.height // => 375\n * ```\n * The `width` and `height` parameters can also be thought of as the width\n * and height of a box that the scaled image must fit within.\n * @param width The bounding box's width.\n * @param height The bounding box's height.\n * @returns The width and height of the image after being scaled.\n */\n PDFImage.prototype.scaleToFit = function (width, height) {\n assertIs(width, 'width', ['number']);\n assertIs(height, 'height', ['number']);\n var imgWidthScale = width / this.width;\n var imgHeightScale = height / this.height;\n var scale = Math.min(imgWidthScale, imgHeightScale);\n return this.scale(scale);\n };\n /**\n * Get the width and height of this image. For example:\n * ```js\n * const { width, height } = image.size()\n * ```\n * @returns The width and height of the image.\n */\n PDFImage.prototype.size = function () {\n return this.scale(1);\n };\n /**\n * > **NOTE:** You probably don't need to call this method directly. The\n * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will\n * > automatically ensure all images get embedded.\n *\n * Embed this image in its document.\n *\n * @returns Resolves when the embedding is complete.\n */\n PDFImage.prototype.embed = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _a, doc, ref;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!this.embedder)\n return [2 /*return*/];\n // The image should only be embedded once. If there's a pending embed\n // operation then wait on it. Otherwise we need to start the embed.\n if (!this.embedTask) {\n _a = this, doc = _a.doc, ref = _a.ref;\n this.embedTask = this.embedder.embedIntoContext(doc.context, ref);\n }\n return [4 /*yield*/, this.embedTask];\n case 1:\n _b.sent();\n // We clear `this.embedder` so that the indirectly referenced image data\n // can be garbage collected, thus avoiding a memory leak.\n // See https://github.com/Hopding/pdf-lib/pull/1032/files.\n this.embedder = undefined;\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFDocument.embedPng]] and [[PDFDocument.embedJpg]]\n * > methods, which will create instances of [[PDFImage]] for you.\n *\n * Create an instance of [[PDFImage]] from an existing ref and embedder\n *\n * @param ref The unique reference for this image.\n * @param doc The document to which the image will belong.\n * @param embedder The embedder that will be used to embed the image.\n */\n PDFImage.of = function (ref, doc, embedder) {\n return new PDFImage(ref, doc, embedder);\n };\n return PDFImage;\n}());\nexport default PDFImage;\n//# sourceMappingURL=PDFImage.js.map","import { __assign, __spreadArrays } from \"tslib\";\nimport PDFDocument from \"../PDFDocument\";\nimport { colorToComponents, setFillingColor } from \"../colors\";\nimport { toDegrees, rotateRectangle, reduceRotation, adjustDimsForRotation, degrees, } from \"../rotations\";\nimport { PDFRef, PDFWidgetAnnotation, PDFName, MethodNotImplementedError, AcroFieldFlags, PDFAcroTerminal, AnnotationFlags, } from \"../../core\";\nimport { assertIs, assertMultiple, assertOrUndefined } from \"../../utils\";\nimport { ImageAlignment } from '../image';\nimport { drawImage, rotateInPlace } from '../operations';\nexport var assertFieldAppearanceOptions = function (options) {\n assertOrUndefined(options === null || options === void 0 ? void 0 : options.x, 'options.x', ['number']);\n assertOrUndefined(options === null || options === void 0 ? void 0 : options.y, 'options.y', ['number']);\n assertOrUndefined(options === null || options === void 0 ? void 0 : options.width, 'options.width', ['number']);\n assertOrUndefined(options === null || options === void 0 ? void 0 : options.height, 'options.height', ['number']);\n assertOrUndefined(options === null || options === void 0 ? void 0 : options.textColor, 'options.textColor', [\n [Object, 'Color'],\n ]);\n assertOrUndefined(options === null || options === void 0 ? void 0 : options.backgroundColor, 'options.backgroundColor', [\n [Object, 'Color'],\n ]);\n assertOrUndefined(options === null || options === void 0 ? void 0 : options.borderColor, 'options.borderColor', [\n [Object, 'Color'],\n ]);\n assertOrUndefined(options === null || options === void 0 ? void 0 : options.borderWidth, 'options.borderWidth', ['number']);\n assertOrUndefined(options === null || options === void 0 ? void 0 : options.rotate, 'options.rotate', [[Object, 'Rotation']]);\n};\n/**\n * Represents a field of a [[PDFForm]].\n *\n * This class is effectively abstract. All fields in a [[PDFForm]] will\n * actually be an instance of a subclass of this class.\n *\n * Note that each field in a PDF is represented by a single field object.\n * However, a given field object may be rendered at multiple locations within\n * the document (across one or more pages). The rendering of a field is\n * controlled by its widgets. Each widget causes its field to be displayed at a\n * particular location in the document.\n *\n * Most of the time each field in a PDF has only a single widget, and thus is\n * only rendered once. However, if a field is rendered multiple times, it will\n * have multiple widgets - one for each location it is rendered.\n *\n * This abstraction of field objects and widgets is defined in the PDF\n * specification and dictates how PDF files store fields and where they are\n * to be rendered.\n */\nvar PDFField = /** @class */ (function () {\n function PDFField(acroField, ref, doc) {\n assertIs(acroField, 'acroField', [[PDFAcroTerminal, 'PDFAcroTerminal']]);\n assertIs(ref, 'ref', [[PDFRef, 'PDFRef']]);\n assertIs(doc, 'doc', [[PDFDocument, 'PDFDocument']]);\n this.acroField = acroField;\n this.ref = ref;\n this.doc = doc;\n }\n /**\n * Get the fully qualified name of this field. For example:\n * ```js\n * const fields = form.getFields()\n * fields.forEach(field => {\n * const name = field.getName()\n * console.log('Field name:', name)\n * })\n * ```\n * Note that PDF fields are structured as a tree. Each field is the\n * descendent of a series of ancestor nodes all the way up to the form node,\n * which is always the root of the tree. Each node in the tree (except for\n * the form node) has a partial name. Partial names can be composed of any\n * unicode characters except a period (`.`). The fully qualified name of a\n * field is composed of the partial names of all its ancestors joined\n * with periods. This means that splitting the fully qualified name on\n * periods and taking the last element of the resulting array will give you\n * the partial name of a specific field.\n * @returns The fully qualified name of this field.\n */\n PDFField.prototype.getName = function () {\n var _a;\n return (_a = this.acroField.getFullyQualifiedName()) !== null && _a !== void 0 ? _a : '';\n };\n /**\n * Returns `true` if this field is read only. This means that PDF readers\n * will not allow users to interact with the field or change its value. See\n * [[PDFField.enableReadOnly]] and [[PDFField.disableReadOnly]].\n * For example:\n * ```js\n * const field = form.getField('some.field')\n * if (field.isReadOnly()) console.log('Read only is enabled')\n * ```\n * @returns Whether or not this is a read only field.\n */\n PDFField.prototype.isReadOnly = function () {\n return this.acroField.hasFlag(AcroFieldFlags.ReadOnly);\n };\n /**\n * Prevent PDF readers from allowing users to interact with this field or\n * change its value. The field will not respond to mouse or keyboard input.\n * For example:\n * ```js\n * const field = form.getField('some.field')\n * field.enableReadOnly()\n * ```\n * Useful for fields whose values are computed, imported from a database, or\n * prefilled by software before being displayed to the user.\n */\n PDFField.prototype.enableReadOnly = function () {\n this.acroField.setFlagTo(AcroFieldFlags.ReadOnly, true);\n };\n /**\n * Allow users to interact with this field and change its value in PDF\n * readers via mouse and keyboard input. For example:\n * ```js\n * const field = form.getField('some.field')\n * field.disableReadOnly()\n * ```\n */\n PDFField.prototype.disableReadOnly = function () {\n this.acroField.setFlagTo(AcroFieldFlags.ReadOnly, false);\n };\n /**\n * Returns `true` if this field must have a value when the form is submitted.\n * See [[PDFField.enableRequired]] and [[PDFField.disableRequired]].\n * For example:\n * ```js\n * const field = form.getField('some.field')\n * if (field.isRequired()) console.log('Field is required')\n * ```\n * @returns Whether or not this field is required.\n */\n PDFField.prototype.isRequired = function () {\n return this.acroField.hasFlag(AcroFieldFlags.Required);\n };\n /**\n * Require this field to have a value when the form is submitted.\n * For example:\n * ```js\n * const field = form.getField('some.field')\n * field.enableRequired()\n * ```\n */\n PDFField.prototype.enableRequired = function () {\n this.acroField.setFlagTo(AcroFieldFlags.Required, true);\n };\n /**\n * Do not require this field to have a value when the form is submitted.\n * For example:\n * ```js\n * const field = form.getField('some.field')\n * field.disableRequired()\n * ```\n */\n PDFField.prototype.disableRequired = function () {\n this.acroField.setFlagTo(AcroFieldFlags.Required, false);\n };\n /**\n * Returns `true` if this field's value should be exported when the form is\n * submitted. See [[PDFField.enableExporting]] and\n * [[PDFField.disableExporting]].\n * For example:\n * ```js\n * const field = form.getField('some.field')\n * if (field.isExported()) console.log('Exporting is enabled')\n * ```\n * @returns Whether or not this field's value should be exported.\n */\n PDFField.prototype.isExported = function () {\n return !this.acroField.hasFlag(AcroFieldFlags.NoExport);\n };\n /**\n * Indicate that this field's value should be exported when the form is\n * submitted in a PDF reader. For example:\n * ```js\n * const field = form.getField('some.field')\n * field.enableExporting()\n * ```\n */\n PDFField.prototype.enableExporting = function () {\n this.acroField.setFlagTo(AcroFieldFlags.NoExport, false);\n };\n /**\n * Indicate that this field's value should **not** be exported when the form\n * is submitted in a PDF reader. For example:\n * ```js\n * const field = form.getField('some.field')\n * field.disableExporting()\n * ```\n */\n PDFField.prototype.disableExporting = function () {\n this.acroField.setFlagTo(AcroFieldFlags.NoExport, true);\n };\n /** @ignore */\n PDFField.prototype.needsAppearancesUpdate = function () {\n throw new MethodNotImplementedError(this.constructor.name, 'needsAppearancesUpdate');\n };\n /** @ignore */\n PDFField.prototype.defaultUpdateAppearances = function (_font) {\n throw new MethodNotImplementedError(this.constructor.name, 'defaultUpdateAppearances');\n };\n PDFField.prototype.markAsDirty = function () {\n this.doc.getForm().markFieldAsDirty(this.ref);\n };\n PDFField.prototype.markAsClean = function () {\n this.doc.getForm().markFieldAsClean(this.ref);\n };\n PDFField.prototype.isDirty = function () {\n return this.doc.getForm().fieldIsDirty(this.ref);\n };\n PDFField.prototype.createWidget = function (options) {\n var _a;\n var textColor = options.textColor;\n var backgroundColor = options.backgroundColor;\n var borderColor = options.borderColor;\n var borderWidth = options.borderWidth;\n var degreesAngle = toDegrees(options.rotate);\n var caption = options.caption;\n var x = options.x;\n var y = options.y;\n var width = options.width + borderWidth;\n var height = options.height + borderWidth;\n var hidden = Boolean(options.hidden);\n var pageRef = options.page;\n assertMultiple(degreesAngle, 'degreesAngle', 90);\n // Create a widget for this field\n var widget = PDFWidgetAnnotation.create(this.doc.context, this.ref);\n // Set widget properties\n var rect = rotateRectangle({ x: x, y: y, width: width, height: height }, borderWidth, degreesAngle);\n widget.setRectangle(rect);\n if (pageRef)\n widget.setP(pageRef);\n var ac = widget.getOrCreateAppearanceCharacteristics();\n if (backgroundColor) {\n ac.setBackgroundColor(colorToComponents(backgroundColor));\n }\n ac.setRotation(degreesAngle);\n if (caption)\n ac.setCaptions({ normal: caption });\n if (borderColor)\n ac.setBorderColor(colorToComponents(borderColor));\n var bs = widget.getOrCreateBorderStyle();\n if (borderWidth !== undefined)\n bs.setWidth(borderWidth);\n widget.setFlagTo(AnnotationFlags.Print, true);\n widget.setFlagTo(AnnotationFlags.Hidden, hidden);\n widget.setFlagTo(AnnotationFlags.Invisible, false);\n // Set acrofield properties\n if (textColor) {\n var da = (_a = this.acroField.getDefaultAppearance()) !== null && _a !== void 0 ? _a : '';\n var newDa = da + '\\n' + setFillingColor(textColor).toString();\n this.acroField.setDefaultAppearance(newDa);\n }\n return widget;\n };\n PDFField.prototype.updateWidgetAppearanceWithFont = function (widget, font, _a) {\n var normal = _a.normal, rollover = _a.rollover, down = _a.down;\n this.updateWidgetAppearances(widget, {\n normal: this.createAppearanceStream(widget, normal, font),\n rollover: rollover && this.createAppearanceStream(widget, rollover, font),\n down: down && this.createAppearanceStream(widget, down, font),\n });\n };\n PDFField.prototype.updateOnOffWidgetAppearance = function (widget, onValue, _a) {\n var normal = _a.normal, rollover = _a.rollover, down = _a.down;\n this.updateWidgetAppearances(widget, {\n normal: this.createAppearanceDict(widget, normal, onValue),\n rollover: rollover && this.createAppearanceDict(widget, rollover, onValue),\n down: down && this.createAppearanceDict(widget, down, onValue),\n });\n };\n PDFField.prototype.updateWidgetAppearances = function (widget, _a) {\n var normal = _a.normal, rollover = _a.rollover, down = _a.down;\n widget.setNormalAppearance(normal);\n if (rollover) {\n widget.setRolloverAppearance(rollover);\n }\n else {\n widget.removeRolloverAppearance();\n }\n if (down) {\n widget.setDownAppearance(down);\n }\n else {\n widget.removeDownAppearance();\n }\n };\n // // TODO: Do we need to do this...?\n // private foo(font: PDFFont, dict: PDFDict) {\n // if (!dict.lookup(PDFName.of('DR'))) {\n // dict.set(PDFName.of('DR'), dict.context.obj({}));\n // }\n // const DR = dict.lookup(PDFName.of('DR'), PDFDict);\n // if (!DR.lookup(PDFName.of('Font'))) {\n // DR.set(PDFName.of('Font'), dict.context.obj({}));\n // }\n // const Font = DR.lookup(PDFName.of('Font'), PDFDict);\n // Font.set(PDFName.of(font.name), font.ref);\n // }\n PDFField.prototype.createAppearanceStream = function (widget, appearance, font) {\n var _a;\n var context = this.acroField.dict.context;\n var _b = widget.getRectangle(), width = _b.width, height = _b.height;\n // TODO: Do we need to do this...?\n // if (font) {\n // this.foo(font, widget.dict);\n // this.foo(font, this.doc.getForm().acroForm.dict);\n // }\n // END TODO\n var Resources = font && { Font: (_a = {}, _a[font.name] = font.ref, _a) };\n var stream = context.formXObject(appearance, {\n Resources: Resources,\n BBox: context.obj([0, 0, width, height]),\n Matrix: context.obj([1, 0, 0, 1, 0, 0]),\n });\n var streamRef = context.register(stream);\n return streamRef;\n };\n /**\n * Create a FormXObject of the supplied image and add it to context.\n * The FormXObject size is calculated based on the widget (including\n * the alignment).\n * @param widget The widget that should display the image.\n * @param alignment The alignment of the image.\n * @param image The image that should be displayed.\n * @returns The ref for the FormXObject that was added to the context.\n */\n PDFField.prototype.createImageAppearanceStream = function (widget, image, alignment) {\n // NOTE: This implementation doesn't handle image borders.\n // NOTE: Acrobat seems to resize the image (maybe even skewing its aspect\n // ratio) to fit perfectly within the widget's rectangle. This method\n // does not currently do that. Should there be an option for that?\n var _a;\n var _b;\n var context = this.acroField.dict.context;\n var rectangle = widget.getRectangle();\n var ap = widget.getAppearanceCharacteristics();\n var bs = widget.getBorderStyle();\n var borderWidth = (_b = bs === null || bs === void 0 ? void 0 : bs.getWidth()) !== null && _b !== void 0 ? _b : 0;\n var rotation = reduceRotation(ap === null || ap === void 0 ? void 0 : ap.getRotation());\n var rotate = rotateInPlace(__assign(__assign({}, rectangle), { rotation: rotation }));\n var adj = adjustDimsForRotation(rectangle, rotation);\n var imageDims = image.scaleToFit(adj.width - borderWidth * 2, adj.height - borderWidth * 2);\n // Support borders on images and maybe other properties\n var options = {\n x: borderWidth,\n y: borderWidth,\n width: imageDims.width,\n height: imageDims.height,\n //\n rotate: degrees(0),\n xSkew: degrees(0),\n ySkew: degrees(0),\n };\n if (alignment === ImageAlignment.Center) {\n options.x += (adj.width - borderWidth * 2) / 2 - imageDims.width / 2;\n options.y += (adj.height - borderWidth * 2) / 2 - imageDims.height / 2;\n }\n else if (alignment === ImageAlignment.Right) {\n options.x = adj.width - borderWidth - imageDims.width;\n options.y = adj.height - borderWidth - imageDims.height;\n }\n var imageName = this.doc.context.addRandomSuffix('Image', 10);\n var appearance = __spreadArrays(rotate, drawImage(imageName, options));\n ////////////\n var Resources = { XObject: (_a = {}, _a[imageName] = image.ref, _a) };\n var stream = context.formXObject(appearance, {\n Resources: Resources,\n BBox: context.obj([0, 0, rectangle.width, rectangle.height]),\n Matrix: context.obj([1, 0, 0, 1, 0, 0]),\n });\n return context.register(stream);\n };\n PDFField.prototype.createAppearanceDict = function (widget, appearance, onValue) {\n var context = this.acroField.dict.context;\n var onStreamRef = this.createAppearanceStream(widget, appearance.on);\n var offStreamRef = this.createAppearanceStream(widget, appearance.off);\n var appearanceDict = context.obj({});\n appearanceDict.set(onValue, onStreamRef);\n appearanceDict.set(PDFName.of('Off'), offStreamRef);\n return appearanceDict;\n };\n return PDFField;\n}());\nexport default PDFField;\n//# sourceMappingURL=PDFField.js.map","import { __extends } from \"tslib\";\nimport PDFPage from \"../PDFPage\";\nimport { normalizeAppearance, defaultCheckBoxAppearanceProvider, } from \"./appearances\";\nimport { rgb } from \"../colors\";\nimport { degrees } from \"../rotations\";\nimport PDFField, { assertFieldAppearanceOptions, } from \"./PDFField\";\nimport { PDFName, PDFDict, PDFAcroCheckBox, } from \"../../core\";\nimport { assertIs, assertOrUndefined } from \"../../utils\";\n/**\n * Represents a check box field of a [[PDFForm]].\n *\n * [[PDFCheckBox]] fields are interactive boxes that users can click with their\n * mouse. This type of [[PDFField]] has two states: `on` and `off`. The purpose\n * of a check box is to enable users to select from one or more options, where\n * each option is represented by a single check box. Check boxes are typically\n * square in shape and display a check mark when they are in the `on` state.\n */\nvar PDFCheckBox = /** @class */ (function (_super) {\n __extends(PDFCheckBox, _super);\n function PDFCheckBox(acroCheckBox, ref, doc) {\n var _this = _super.call(this, acroCheckBox, ref, doc) || this;\n assertIs(acroCheckBox, 'acroCheckBox', [\n [PDFAcroCheckBox, 'PDFAcroCheckBox'],\n ]);\n _this.acroField = acroCheckBox;\n return _this;\n }\n /**\n * Mark this check box. This operation is analogous to a human user clicking\n * a check box to fill it in a PDF reader. This method will update the\n * underlying state of the check box field to indicate it has been selected.\n * PDF libraries and readers will be able to extract this value from the\n * saved document and determine that it was selected.\n *\n * For example:\n * ```js\n * const checkBox = form.getCheckBox('some.checkBox.field')\n * checkBox.check()\n * ```\n *\n * This method will mark this check box as dirty, causing its appearance\n * streams to be updated when either [[PDFDocument.save]] or\n * [[PDFForm.updateFieldAppearances]] is called. The updated appearance\n * streams will display a check mark inside the widgets of this check box\n * field.\n */\n PDFCheckBox.prototype.check = function () {\n var _a;\n var onValue = (_a = this.acroField.getOnValue()) !== null && _a !== void 0 ? _a : PDFName.of('Yes');\n this.markAsDirty();\n this.acroField.setValue(onValue);\n };\n /**\n * Clears this check box. This operation is analogous to a human user clicking\n * a check box to unmark it in a PDF reader. This method will update the\n * underlying state of the check box field to indicate it has been deselected.\n * PDF libraries and readers will be able to extract this value from the\n * saved document and determine that it was not selected.\n *\n * For example:\n * ```js\n * const checkBox = form.getCheckBox('some.checkBox.field')\n * checkBox.uncheck()\n * ```\n *\n * This method will mark this check box as dirty. See [[PDFCheckBox.check]]\n * for more details about what this means.\n */\n PDFCheckBox.prototype.uncheck = function () {\n this.markAsDirty();\n this.acroField.setValue(PDFName.of('Off'));\n };\n /**\n * Returns `true` if this check box is selected (either by a human user via\n * a PDF reader, or else programmatically via software). For example:\n * ```js\n * const checkBox = form.getCheckBox('some.checkBox.field')\n * if (checkBox.isChecked()) console.log('check box is selected')\n * ```\n * @returns Whether or not this check box is selected.\n */\n PDFCheckBox.prototype.isChecked = function () {\n var onValue = this.acroField.getOnValue();\n return !!onValue && onValue === this.acroField.getValue();\n };\n /**\n * Show this check box on the specified page. For example:\n * ```js\n * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const checkBox = form.createCheckBox('some.checkBox.field')\n *\n * checkBox.addToPage(page, {\n * x: 50,\n * y: 75,\n * width: 25,\n * height: 25,\n * textColor: rgb(1, 0, 0),\n * backgroundColor: rgb(0, 1, 0),\n * borderColor: rgb(0, 0, 1),\n * borderWidth: 2,\n * rotate: degrees(90),\n * })\n * ```\n * This will create a new widget for this check box field.\n * @param page The page to which this check box widget should be added.\n * @param options The options to be used when adding this check box widget.\n */\n PDFCheckBox.prototype.addToPage = function (page, options) {\n var _a, _b, _c, _d, _e, _f;\n assertIs(page, 'page', [[PDFPage, 'PDFPage']]);\n assertFieldAppearanceOptions(options);\n if (!options)\n options = {};\n if (!('textColor' in options))\n options.textColor = rgb(0, 0, 0);\n if (!('backgroundColor' in options))\n options.backgroundColor = rgb(1, 1, 1);\n if (!('borderColor' in options))\n options.borderColor = rgb(0, 0, 0);\n if (!('borderWidth' in options))\n options.borderWidth = 1;\n // Create a widget for this check box\n var widget = this.createWidget({\n x: (_a = options.x) !== null && _a !== void 0 ? _a : 0,\n y: (_b = options.y) !== null && _b !== void 0 ? _b : 0,\n width: (_c = options.width) !== null && _c !== void 0 ? _c : 50,\n height: (_d = options.height) !== null && _d !== void 0 ? _d : 50,\n textColor: options.textColor,\n backgroundColor: options.backgroundColor,\n borderColor: options.borderColor,\n borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0,\n rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : degrees(0),\n hidden: options.hidden,\n page: page.ref,\n });\n var widgetRef = this.doc.context.register(widget.dict);\n // Add widget to this field\n this.acroField.addWidget(widgetRef);\n // Set appearance streams for widget\n widget.setAppearanceState(PDFName.of('Off'));\n this.updateWidgetAppearance(widget, PDFName.of('Yes'));\n // Add widget to the given page\n page.node.addAnnot(widgetRef);\n };\n /**\n * Returns `true` if any of this check box's widgets do not have an\n * appearance stream for its current state. For example:\n * ```js\n * const checkBox = form.getCheckBox('some.checkBox.field')\n * if (checkBox.needsAppearancesUpdate()) console.log('Needs update')\n * ```\n * @returns Whether or not this check box needs an appearance update.\n */\n PDFCheckBox.prototype.needsAppearancesUpdate = function () {\n var _a;\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var state = widget.getAppearanceState();\n var normal = (_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal;\n if (!(normal instanceof PDFDict))\n return true;\n if (state && !normal.has(state))\n return true;\n }\n return false;\n };\n /**\n * Update the appearance streams for each of this check box's widgets using\n * the default appearance provider for check boxes. For example:\n * ```js\n * const checkBox = form.getCheckBox('some.checkBox.field')\n * checkBox.defaultUpdateAppearances()\n * ```\n */\n PDFCheckBox.prototype.defaultUpdateAppearances = function () {\n this.updateAppearances();\n };\n /**\n * Update the appearance streams for each of this check box's widgets using\n * the given appearance provider. If no `provider` is passed, the default\n * appearance provider for check boxs will be used. For example:\n * ```js\n * const checkBox = form.getCheckBox('some.checkBox.field')\n * checkBox.updateAppearances((field, widget) => {\n * ...\n * return {\n * normal: { on: drawCheckBox(...), off: drawCheckBox(...) },\n * down: { on: drawCheckBox(...), off: drawCheckBox(...) },\n * }\n * })\n * ```\n * @param provider Optionally, the appearance provider to be used for\n * generating the contents of the appearance streams.\n */\n PDFCheckBox.prototype.updateAppearances = function (provider) {\n var _a;\n assertOrUndefined(provider, 'provider', [Function]);\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var onValue = (_a = widget.getOnValue()) !== null && _a !== void 0 ? _a : PDFName.of('Yes');\n if (!onValue)\n continue;\n this.updateWidgetAppearance(widget, onValue, provider);\n }\n this.markAsClean();\n };\n PDFCheckBox.prototype.updateWidgetAppearance = function (widget, onValue, provider) {\n var apProvider = provider !== null && provider !== void 0 ? provider : defaultCheckBoxAppearanceProvider;\n var appearances = normalizeAppearance(apProvider(this, widget));\n this.updateOnOffWidgetAppearance(widget, onValue, appearances);\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFForm.getCheckBox]] method, which will create an\n * > instance of [[PDFCheckBox]] for you.\n *\n * Create an instance of [[PDFCheckBox]] from an existing acroCheckBox and ref\n *\n * @param acroCheckBox The underlying `PDFAcroCheckBox` for this check box.\n * @param ref The unique reference for this check box.\n * @param doc The document to which this check box will belong.\n */\n PDFCheckBox.of = function (acroCheckBox, ref, doc) {\n return new PDFCheckBox(acroCheckBox, ref, doc);\n };\n return PDFCheckBox;\n}(PDFField));\nexport default PDFCheckBox;\n//# sourceMappingURL=PDFCheckBox.js.map","import { __extends } from \"tslib\";\nimport PDFPage from \"../PDFPage\";\nimport PDFFont from \"../PDFFont\";\nimport PDFField, { assertFieldAppearanceOptions, } from \"./PDFField\";\nimport { normalizeAppearance, defaultDropdownAppearanceProvider, } from \"./appearances\";\nimport { rgb } from \"../colors\";\nimport { degrees } from \"../rotations\";\nimport { PDFHexString, PDFStream, PDFAcroComboBox, AcroChoiceFlags, } from \"../../core\";\nimport { assertIs, assertOrUndefined, assertPositive } from \"../../utils\";\n/**\n * Represents a dropdown field of a [[PDFForm]].\n *\n * [[PDFDropdown]] fields are interactive text boxes that display a single\n * element (the currently selected value). The purpose of a dropdown is to\n * enable users to select a single option from a set of possible options. Users\n * can click on a dropdown to view the full list of options it provides.\n * Clicking on an option in the list will cause it to be selected and displayed\n * in the dropdown's text box. Some dropdowns allow users to enter text\n * directly into the box from their keyboard, rather than only being allowed to\n * choose an option from the list (see [[PDFDropdown.isEditable]]).\n */\nvar PDFDropdown = /** @class */ (function (_super) {\n __extends(PDFDropdown, _super);\n function PDFDropdown(acroComboBox, ref, doc) {\n var _this = _super.call(this, acroComboBox, ref, doc) || this;\n assertIs(acroComboBox, 'acroComboBox', [\n [PDFAcroComboBox, 'PDFAcroComboBox'],\n ]);\n _this.acroField = acroComboBox;\n return _this;\n }\n /**\n * Get the list of available options for this dropdown. These options will be\n * displayed to users who click on this dropdown in a PDF reader.\n * For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * const options = dropdown.getOptions()\n * console.log('Dropdown options:', options)\n * ```\n * @returns The options for this dropdown.\n */\n PDFDropdown.prototype.getOptions = function () {\n var rawOptions = this.acroField.getOptions();\n var options = new Array(rawOptions.length);\n for (var idx = 0, len = options.length; idx < len; idx++) {\n var _a = rawOptions[idx], display = _a.display, value = _a.value;\n options[idx] = (display !== null && display !== void 0 ? display : value).decodeText();\n }\n return options;\n };\n /**\n * Get the selected options for this dropdown. These are the values that were\n * selected by a human user via a PDF reader, or programatically via\n * software.\n * For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * const selections = dropdown.getSelected()\n * console.log('Dropdown selections:', selections)\n * ```\n * > **NOTE:** Note that PDF readers only display one selected option when\n * > rendering dropdowns. However, the PDF specification does allow for\n * > multiple values to be selected in a dropdown. As such, the `pdf-lib`\n * > API supports this. However, in most cases the array returned by this\n * > method will contain only a single element (or no elements).\n * @returns The selected options in this dropdown.\n */\n PDFDropdown.prototype.getSelected = function () {\n var values = this.acroField.getValues();\n var selected = new Array(values.length);\n for (var idx = 0, len = values.length; idx < len; idx++) {\n selected[idx] = values[idx].decodeText();\n }\n return selected;\n };\n /**\n * Set the list of options that are available for this dropdown. These are\n * the values that will be available for users to select when they view this\n * dropdown in a PDF reader. Note that preexisting options for this dropdown\n * will be removed. Only the values passed as `options` will be available to\n * select.\n * For example:\n * ```js\n * const dropdown = form.getDropdown('planets.dropdown')\n * dropdown.setOptions(['Earth', 'Mars', 'Pluto', 'Venus'])\n * ```\n * @param options The options that should be available in this dropdown.\n */\n PDFDropdown.prototype.setOptions = function (options) {\n assertIs(options, 'options', [Array]);\n var optionObjects = new Array(options.length);\n for (var idx = 0, len = options.length; idx < len; idx++) {\n optionObjects[idx] = { value: PDFHexString.fromText(options[idx]) };\n }\n this.acroField.setOptions(optionObjects);\n };\n /**\n * Add to the list of options that are available for this dropdown. Users\n * will be able to select these values in a PDF reader. In addition to the\n * values passed as `options`, any preexisting options for this dropdown will\n * still be available for users to select.\n * For example:\n * ```js\n * const dropdown = form.getDropdown('rockets.dropdown')\n * dropdown.addOptions(['Saturn IV', 'Falcon Heavy'])\n * ```\n * @param options New options that should be available in this dropdown.\n */\n PDFDropdown.prototype.addOptions = function (options) {\n assertIs(options, 'options', ['string', Array]);\n var optionsArr = Array.isArray(options) ? options : [options];\n var existingOptions = this.acroField.getOptions();\n var newOptions = new Array(optionsArr.length);\n for (var idx = 0, len = optionsArr.length; idx < len; idx++) {\n newOptions[idx] = { value: PDFHexString.fromText(optionsArr[idx]) };\n }\n this.acroField.setOptions(existingOptions.concat(newOptions));\n };\n /**\n * Select one or more values for this dropdown. This operation is analogous\n * to a human user opening the dropdown in a PDF reader and clicking on a\n * value to select it. This method will update the underlying state of the\n * dropdown to indicate which values have been selected. PDF libraries and\n * readers will be able to extract these values from the saved document and\n * determine which values were selected.\n *\n * For example:\n * ```js\n * const dropdown = form.getDropdown('best.superhero.dropdown')\n * dropdown.select('One Punch Man')\n * ```\n *\n * This method will mark this dropdown as dirty, causing its appearance\n * streams to be updated when either [[PDFDocument.save]] or\n * [[PDFForm.updateFieldAppearances]] is called. The updated streams will\n * display the selected option inside the widgets of this dropdown.\n *\n * **IMPORTANT:** The default font used to update appearance streams is\n * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means\n * that encoding errors will be thrown if the selected option for this field\n * contains characters outside the WinAnsi character set (the latin alphabet).\n *\n * Embedding a custom font and passing it to\n * [[PDFForm.updateFieldAppearances]] or [[PDFDropdown.updateAppearances]]\n * allows you to generate appearance streams with characters outside the\n * latin alphabet (assuming the custom font supports them).\n *\n * Selecting an option that does not exist in this dropdown's option list\n * (see [[PDFDropdown.getOptions]]) will enable editing on this dropdown\n * (see [[PDFDropdown.enableEditing]]).\n *\n * > **NOTE:** PDF readers only display one selected option when rendering\n * > dropdowns. However, the PDF specification does allow for multiple values\n * > to be selected in a dropdown. As such, the `pdf-lib` API supports this.\n * > However, it is not recommended to select more than one value with this\n * > method, as only one will be visible. [[PDFOptionList]] fields are better\n * > suited for displaying multiple selected values.\n *\n * @param options The options to be selected.\n * @param merge Whether or not existing selections should be preserved.\n */\n PDFDropdown.prototype.select = function (options, merge) {\n if (merge === void 0) { merge = false; }\n assertIs(options, 'options', ['string', Array]);\n assertIs(merge, 'merge', ['boolean']);\n var optionsArr = Array.isArray(options) ? options : [options];\n var validOptions = this.getOptions();\n var hasCustomOption = optionsArr.find(function (option) { return !validOptions.includes(option); });\n if (hasCustomOption)\n this.enableEditing();\n this.markAsDirty();\n if (optionsArr.length > 1 || (optionsArr.length === 1 && merge)) {\n this.enableMultiselect();\n }\n var values = new Array(optionsArr.length);\n for (var idx = 0, len = optionsArr.length; idx < len; idx++) {\n values[idx] = PDFHexString.fromText(optionsArr[idx]);\n }\n if (merge) {\n var existingValues = this.acroField.getValues();\n this.acroField.setValues(existingValues.concat(values));\n }\n else {\n this.acroField.setValues(values);\n }\n };\n /**\n * Clear all selected values for this dropdown. This operation is equivalent\n * to selecting an empty list. This method will update the underlying state\n * of the dropdown to indicate that no values have been selected.\n * For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.clear()\n * ```\n * This method will mark this text field as dirty. See [[PDFDropdown.select]]\n * for more details about what this means.\n */\n PDFDropdown.prototype.clear = function () {\n this.markAsDirty();\n this.acroField.setValues([]);\n };\n /**\n * Set the font size for this field. Larger font sizes will result in larger\n * text being displayed when PDF readers render this dropdown. Font sizes may\n * be integer or floating point numbers. Supplying a negative font size will\n * cause this method to throw an error.\n *\n * For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.setFontSize(4)\n * dropdown.setFontSize(15.7)\n * ```\n *\n * > This method depends upon the existence of a default appearance\n * > (`/DA`) string. If this field does not have a default appearance string,\n * > or that string does not contain a font size (via the `Tf` operator),\n * > then this method will throw an error.\n *\n * @param fontSize The font size to be used when rendering text in this field.\n */\n PDFDropdown.prototype.setFontSize = function (fontSize) {\n assertPositive(fontSize, 'fontSize');\n this.acroField.setFontSize(fontSize);\n this.markAsDirty();\n };\n /**\n * Returns `true` if users are allowed to edit the selected value of this\n * dropdown directly and are not constrained by the list of available\n * options. See [[PDFDropdown.enableEditing]] and\n * [[PDFDropdown.disableEditing]]. For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * if (dropdown.isEditable()) console.log('Editing is enabled')\n * ```\n * @returns Whether or not this dropdown is editable.\n */\n PDFDropdown.prototype.isEditable = function () {\n return this.acroField.hasFlag(AcroChoiceFlags.Edit);\n };\n /**\n * Allow users to edit the selected value of this dropdown in PDF readers\n * with their keyboard. This means that the selected value of this dropdown\n * will not be constrained by the list of available options. However, if this\n * dropdown has any available options, users will still be allowed to select\n * from that list.\n * For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.enableEditing()\n * ```\n */\n PDFDropdown.prototype.enableEditing = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.Edit, true);\n };\n /**\n * Do not allow users to edit the selected value of this dropdown in PDF\n * readers with their keyboard. This will constrain the selected value of\n * this dropdown to the list of available options. Users will only be able\n * to select an option from that list.\n * For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.disableEditing()\n * ```\n */\n PDFDropdown.prototype.disableEditing = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.Edit, false);\n };\n /**\n * Returns `true` if the option list of this dropdown is always displayed\n * in alphabetical order, irrespective of the order in which the options\n * were added to the dropdown. See [[PDFDropdown.enableSorting]] and\n * [[PDFDropdown.disableSorting]]. For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * if (dropdown.isSorted()) console.log('Sorting is enabled')\n * ```\n * @returns Whether or not this dropdown's options are sorted.\n */\n PDFDropdown.prototype.isSorted = function () {\n return this.acroField.hasFlag(AcroChoiceFlags.Sort);\n };\n /**\n * Always display the option list of this dropdown in alphabetical order,\n * irrespective of the order in which the options were added to this dropdown.\n * For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.enableSorting()\n * ```\n */\n PDFDropdown.prototype.enableSorting = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.Sort, true);\n };\n /**\n * Do not always display the option list of this dropdown in alphabetical\n * order. Instead, display the options in whichever order they were added\n * to the list. For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.disableSorting()\n * ```\n */\n PDFDropdown.prototype.disableSorting = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.Sort, false);\n };\n /**\n * Returns `true` if multiple options can be selected from this dropdown's\n * option list. See [[PDFDropdown.enableMultiselect]] and\n * [[PDFDropdown.disableMultiselect]]. For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * if (dropdown.isMultiselect()) console.log('Multiselect is enabled')\n * ```\n * @returns Whether or not multiple options can be selected.\n */\n PDFDropdown.prototype.isMultiselect = function () {\n return this.acroField.hasFlag(AcroChoiceFlags.MultiSelect);\n };\n /**\n * Allow users to select more than one option from this dropdown's option\n * list. For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.enableMultiselect()\n * ```\n */\n PDFDropdown.prototype.enableMultiselect = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.MultiSelect, true);\n };\n /**\n * Do not allow users to select more than one option from this dropdown's\n * option list. For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.disableMultiselect()\n * ```\n */\n PDFDropdown.prototype.disableMultiselect = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.MultiSelect, false);\n };\n /**\n * Returns `true` if the selected option should be spell checked by PDF\n * readers. Spell checking will only be performed if this dropdown allows\n * editing (see [[PDFDropdown.isEditable]]). See\n * [[PDFDropdown.enableSpellChecking]] and\n * [[PDFDropdown.disableSpellChecking]]. For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * if (dropdown.isSpellChecked()) console.log('Spell checking is enabled')\n * ```\n * @returns Whether or not this dropdown can be spell checked.\n */\n PDFDropdown.prototype.isSpellChecked = function () {\n return !this.acroField.hasFlag(AcroChoiceFlags.DoNotSpellCheck);\n };\n /**\n * Allow PDF readers to spell check the selected option of this dropdown.\n * For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.enableSpellChecking()\n * ```\n */\n PDFDropdown.prototype.enableSpellChecking = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.DoNotSpellCheck, false);\n };\n /**\n * Do not allow PDF readers to spell check the selected option of this\n * dropdown. For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.disableSpellChecking()\n * ```\n */\n PDFDropdown.prototype.disableSpellChecking = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.DoNotSpellCheck, true);\n };\n /**\n * Returns `true` if the option selected by a user is stored, or \"committed\",\n * when the user clicks the option. The alternative is that the user's\n * selection is stored when the user leaves this dropdown field (by clicking\n * outside of it - on another field, for example). See\n * [[PDFDropdown.enableSelectOnClick]] and\n * [[PDFDropdown.disableSelectOnClick]]. For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * if (dropdown.isSelectOnClick()) console.log('Select on click is enabled')\n * ```\n * @returns Whether or not options are selected immediately after they are\n * clicked.\n */\n PDFDropdown.prototype.isSelectOnClick = function () {\n return this.acroField.hasFlag(AcroChoiceFlags.CommitOnSelChange);\n };\n /**\n * Store the option selected by a user immediately after the user clicks the\n * option. Do not wait for the user to leave this dropdown field (by clicking\n * outside of it - on another field, for example). For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.enableSelectOnClick()\n * ```\n */\n PDFDropdown.prototype.enableSelectOnClick = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.CommitOnSelChange, true);\n };\n /**\n * Wait to store the option selected by a user until they leave this dropdown\n * field (by clicking outside of it - on another field, for example).\n * For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.disableSelectOnClick()\n * ```\n */\n PDFDropdown.prototype.disableSelectOnClick = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.CommitOnSelChange, false);\n };\n /**\n * Show this dropdown on the specified page. For example:\n * ```js\n * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const dropdown = form.createDropdown('best.gundam')\n * dropdown.setOptions(['Exia', 'Dynames'])\n * dropdown.select('Exia')\n *\n * dropdown.addToPage(page, {\n * x: 50,\n * y: 75,\n * width: 200,\n * height: 100,\n * textColor: rgb(1, 0, 0),\n * backgroundColor: rgb(0, 1, 0),\n * borderColor: rgb(0, 0, 1),\n * borderWidth: 2,\n * rotate: degrees(90),\n * font: ubuntuFont,\n * })\n * ```\n * This will create a new widget for this dropdown field.\n * @param page The page to which this dropdown widget should be added.\n * @param options The options to be used when adding this dropdown widget.\n */\n PDFDropdown.prototype.addToPage = function (page, options) {\n var _a, _b, _c, _d, _e, _f, _g;\n assertIs(page, 'page', [[PDFPage, 'PDFPage']]);\n assertFieldAppearanceOptions(options);\n if (!options)\n options = {};\n if (!('textColor' in options))\n options.textColor = rgb(0, 0, 0);\n if (!('backgroundColor' in options))\n options.backgroundColor = rgb(1, 1, 1);\n if (!('borderColor' in options))\n options.borderColor = rgb(0, 0, 0);\n if (!('borderWidth' in options))\n options.borderWidth = 1;\n // Create a widget for this dropdown\n var widget = this.createWidget({\n x: (_a = options.x) !== null && _a !== void 0 ? _a : 0,\n y: (_b = options.y) !== null && _b !== void 0 ? _b : 0,\n width: (_c = options.width) !== null && _c !== void 0 ? _c : 200,\n height: (_d = options.height) !== null && _d !== void 0 ? _d : 50,\n textColor: options.textColor,\n backgroundColor: options.backgroundColor,\n borderColor: options.borderColor,\n borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0,\n rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : degrees(0),\n hidden: options.hidden,\n page: page.ref,\n });\n var widgetRef = this.doc.context.register(widget.dict);\n // Add widget to this field\n this.acroField.addWidget(widgetRef);\n // Set appearance streams for widget\n var font = (_g = options.font) !== null && _g !== void 0 ? _g : this.doc.getForm().getDefaultFont();\n this.updateWidgetAppearance(widget, font);\n // Add widget to the given page\n page.node.addAnnot(widgetRef);\n };\n /**\n * Returns `true` if this dropdown has been marked as dirty, or if any of\n * this dropdown's widgets do not have an appearance stream. For example:\n * ```js\n * const dropdown = form.getDropdown('some.dropdown.field')\n * if (dropdown.needsAppearancesUpdate()) console.log('Needs update')\n * ```\n * @returns Whether or not this dropdown needs an appearance update.\n */\n PDFDropdown.prototype.needsAppearancesUpdate = function () {\n var _a;\n if (this.isDirty())\n return true;\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var hasAppearances = ((_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal) instanceof PDFStream;\n if (!hasAppearances)\n return true;\n }\n return false;\n };\n /**\n * Update the appearance streams for each of this dropdown's widgets using\n * the default appearance provider for dropdowns. For example:\n * ```js\n * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.defaultUpdateAppearances(helvetica)\n * ```\n * @param font The font to be used for creating the appearance streams.\n */\n PDFDropdown.prototype.defaultUpdateAppearances = function (font) {\n assertIs(font, 'font', [[PDFFont, 'PDFFont']]);\n this.updateAppearances(font);\n };\n /**\n * Update the appearance streams for each of this dropdown's widgets using\n * the given appearance provider. If no `provider` is passed, the default\n * appearance provider for dropdowns will be used. For example:\n * ```js\n * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const dropdown = form.getDropdown('some.dropdown.field')\n * dropdown.updateAppearances(helvetica, (field, widget, font) => {\n * ...\n * return drawTextField(...)\n * })\n * ```\n * @param font The font to be used for creating the appearance streams.\n * @param provider Optionally, the appearance provider to be used for\n * generating the contents of the appearance streams.\n */\n PDFDropdown.prototype.updateAppearances = function (font, provider) {\n assertIs(font, 'font', [[PDFFont, 'PDFFont']]);\n assertOrUndefined(provider, 'provider', [Function]);\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n this.updateWidgetAppearance(widget, font, provider);\n }\n this.markAsClean();\n };\n // getOption(index: number): string {}\n // getSelectedIndices(): number[] {}\n // removeOptions(option: string | string[]) {}\n // removeIndices(option: number[]) {}\n // deselect(options: string | string[]) {}\n // deselectIndices(optionIndices: number[]) {}\n PDFDropdown.prototype.updateWidgetAppearance = function (widget, font, provider) {\n var apProvider = provider !== null && provider !== void 0 ? provider : defaultDropdownAppearanceProvider;\n var appearances = normalizeAppearance(apProvider(this, widget, font));\n this.updateWidgetAppearanceWithFont(widget, font, appearances);\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFForm.getDropdown]] method, which will create an\n * > instance of [[PDFDropdown]] for you.\n *\n * Create an instance of [[PDFDropdown]] from an existing acroComboBox and ref\n *\n * @param acroComboBox The underlying `PDFAcroComboBox` for this dropdown.\n * @param ref The unique reference for this dropdown.\n * @param doc The document to which this dropdown will belong.\n */\n PDFDropdown.of = function (acroComboBox, ref, doc) {\n return new PDFDropdown(acroComboBox, ref, doc);\n };\n return PDFDropdown;\n}(PDFField));\nexport default PDFDropdown;\n//# sourceMappingURL=PDFDropdown.js.map","import { __extends } from \"tslib\";\nimport PDFPage from \"../PDFPage\";\nimport PDFFont from \"../PDFFont\";\nimport PDFField, { assertFieldAppearanceOptions, } from \"./PDFField\";\nimport { normalizeAppearance, defaultOptionListAppearanceProvider, } from \"./appearances\";\nimport { rgb } from \"../colors\";\nimport { degrees } from \"../rotations\";\nimport { PDFHexString, PDFStream, PDFAcroListBox, AcroChoiceFlags, } from \"../../core\";\nimport { assertIs, assertIsSubset, assertOrUndefined, assertPositive, } from \"../../utils\";\n/**\n * Represents an option list field of a [[PDFForm]].\n *\n * [[PDFOptionList]] fields are interactive lists of options. The purpose of an\n * option list is to enable users to select one or more options from a set of\n * possible options. Users are able to see the full set of options without\n * first having to click on the field (though scrolling may be necessary).\n * Clicking an option in the list will cause it to be selected and displayed\n * with a highlighted background. Some option lists allow users to select\n * more than one option (see [[PDFOptionList.isMultiselect]]).\n */\nvar PDFOptionList = /** @class */ (function (_super) {\n __extends(PDFOptionList, _super);\n function PDFOptionList(acroListBox, ref, doc) {\n var _this = _super.call(this, acroListBox, ref, doc) || this;\n assertIs(acroListBox, 'acroListBox', [[PDFAcroListBox, 'PDFAcroListBox']]);\n _this.acroField = acroListBox;\n return _this;\n }\n /**\n * Get the list of available options for this option list. These options will\n * be displayed to users who view this option list in a PDF reader.\n * For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * const options = optionList.getOptions()\n * console.log('Option List options:', options)\n * ```\n * @returns The options for this option list.\n */\n PDFOptionList.prototype.getOptions = function () {\n var rawOptions = this.acroField.getOptions();\n var options = new Array(rawOptions.length);\n for (var idx = 0, len = options.length; idx < len; idx++) {\n var _a = rawOptions[idx], display = _a.display, value = _a.value;\n options[idx] = (display !== null && display !== void 0 ? display : value).decodeText();\n }\n return options;\n };\n /**\n * Get the selected options for this option list. These are the values that\n * were selected by a human user via a PDF reader, or programatically via\n * software.\n * For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * const selections = optionList.getSelected()\n * console.log('Option List selections:', selections)\n * ```\n * @returns The selected options for this option list.\n */\n PDFOptionList.prototype.getSelected = function () {\n var values = this.acroField.getValues();\n var selected = new Array(values.length);\n for (var idx = 0, len = values.length; idx < len; idx++) {\n selected[idx] = values[idx].decodeText();\n }\n return selected;\n };\n /**\n * Set the list of options that are available for this option list. These are\n * the values that will be available for users to select when they view this\n * option list in a PDF reader. Note that preexisting options for this\n * option list will be removed. Only the values passed as `options` will be\n * available to select.\n *\n * For example:\n * ```js\n * const optionList = form.getOptionList('planets.optionList')\n * optionList.setOptions(['Earth', 'Mars', 'Pluto', 'Venus'])\n * ```\n *\n * This method will mark this option list as dirty, causing its appearance\n * streams to be updated when either [[PDFDocument.save]] or\n * [[PDFForm.updateFieldAppearances]] is called. The updated streams will\n * display the options this field contains inside the widgets of this text\n * field (with selected options highlighted).\n *\n * **IMPORTANT:** The default font used to update appearance streams is\n * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means\n * that encoding errors will be thrown if this field contains any options\n * with characters outside the WinAnsi character set (the latin alphabet).\n *\n * Embedding a custom font and passing it to\n * [[PDFForm.updateFieldAppearances]] or [[PDFOptionList.updateAppearances]]\n * allows you to generate appearance streams with characters outside the\n * latin alphabet (assuming the custom font supports them).\n *\n * @param options The options that should be available in this option list.\n */\n PDFOptionList.prototype.setOptions = function (options) {\n assertIs(options, 'options', [Array]);\n this.markAsDirty();\n var optionObjects = new Array(options.length);\n for (var idx = 0, len = options.length; idx < len; idx++) {\n optionObjects[idx] = { value: PDFHexString.fromText(options[idx]) };\n }\n this.acroField.setOptions(optionObjects);\n };\n /**\n * Add to the list of options that are available for this option list. Users\n * will be able to select these values in a PDF reader. In addition to the\n * values passed as `options`, any preexisting options for this option list\n * will still be available for users to select.\n * For example:\n * ```js\n * const optionList = form.getOptionList('rockets.optionList')\n * optionList.addOptions(['Saturn IV', 'Falcon Heavy'])\n * ```\n * This method will mark this option list as dirty. See\n * [[PDFOptionList.setOptions]] for more details about what this means.\n * @param options New options that should be available in this option list.\n */\n PDFOptionList.prototype.addOptions = function (options) {\n assertIs(options, 'options', ['string', Array]);\n this.markAsDirty();\n var optionsArr = Array.isArray(options) ? options : [options];\n var existingOptions = this.acroField.getOptions();\n var newOptions = new Array(optionsArr.length);\n for (var idx = 0, len = optionsArr.length; idx < len; idx++) {\n newOptions[idx] = { value: PDFHexString.fromText(optionsArr[idx]) };\n }\n this.acroField.setOptions(existingOptions.concat(newOptions));\n };\n /**\n * Select one or more values for this option list. This operation is analogous\n * to a human user opening the option list in a PDF reader and clicking on one\n * or more values to select them. This method will update the underlying state\n * of the option list to indicate which values have been selected. PDF\n * libraries and readers will be able to extract these values from the saved\n * document and determine which values were selected.\n * For example:\n * ```js\n * const optionList = form.getOptionList('best.superheroes.optionList')\n * optionList.select(['One Punch Man', 'Iron Man'])\n * ```\n * This method will mark this option list as dirty. See\n * [[PDFOptionList.setOptions]] for more details about what this means.\n * @param options The options to be selected.\n * @param merge Whether or not existing selections should be preserved.\n */\n PDFOptionList.prototype.select = function (options, merge) {\n if (merge === void 0) { merge = false; }\n assertIs(options, 'options', ['string', Array]);\n assertIs(merge, 'merge', ['boolean']);\n var optionsArr = Array.isArray(options) ? options : [options];\n var validOptions = this.getOptions();\n assertIsSubset(optionsArr, 'option', validOptions);\n this.markAsDirty();\n if (optionsArr.length > 1 || (optionsArr.length === 1 && merge)) {\n this.enableMultiselect();\n }\n var values = new Array(optionsArr.length);\n for (var idx = 0, len = optionsArr.length; idx < len; idx++) {\n values[idx] = PDFHexString.fromText(optionsArr[idx]);\n }\n if (merge) {\n var existingValues = this.acroField.getValues();\n this.acroField.setValues(existingValues.concat(values));\n }\n else {\n this.acroField.setValues(values);\n }\n };\n /**\n * Clear all selected values for this option list. This operation is\n * equivalent to selecting an empty list. This method will update the\n * underlying state of the option list to indicate that no values have been\n * selected.\n * For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.clear()\n * ```\n * This method will mark this option list as dirty. See\n * [[PDFOptionList.setOptions]] for more details about what this means.\n */\n PDFOptionList.prototype.clear = function () {\n this.markAsDirty();\n this.acroField.setValues([]);\n };\n /**\n * Set the font size for the text in this field. There needs to be a\n * default appearance string (DA) set with a font value specified\n * for this to work. For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.setFontSize(4);\n * ```\n * @param fontSize The font size to set the font to.\n */\n /**\n * Set the font size for this field. Larger font sizes will result in larger\n * text being displayed when PDF readers render this option list. Font sizes\n * may be integer or floating point numbers. Supplying a negative font size\n * will cause this method to throw an error.\n *\n * For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.setFontSize(4)\n * optionList.setFontSize(15.7)\n * ```\n *\n * > This method depends upon the existence of a default appearance\n * > (`/DA`) string. If this field does not have a default appearance string,\n * > or that string does not contain a font size (via the `Tf` operator),\n * > then this method will throw an error.\n *\n * @param fontSize The font size to be used when rendering text in this field.\n */\n PDFOptionList.prototype.setFontSize = function (fontSize) {\n assertPositive(fontSize, 'fontSize');\n this.acroField.setFontSize(fontSize);\n this.markAsDirty();\n };\n /**\n * Returns `true` if the options of this option list are always displayed\n * in alphabetical order, irrespective of the order in which the options\n * were added to the option list. See [[PDFOptionList.enableSorting]] and\n * [[PDFOptionList.disableSorting]]. For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * if (optionList.isSorted()) console.log('Sorting is enabled')\n * ```\n * @returns Whether or not this option list is sorted.\n */\n PDFOptionList.prototype.isSorted = function () {\n return this.acroField.hasFlag(AcroChoiceFlags.Sort);\n };\n /**\n * Always display the options of this option list in alphabetical order,\n * irrespective of the order in which the options were added to this option\n * list.\n * For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.enableSorting()\n * ```\n */\n PDFOptionList.prototype.enableSorting = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.Sort, true);\n };\n /**\n * Do not always display the options of this option list in alphabetical\n * order. Instead, display the options in whichever order they were added\n * to this option list. For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.disableSorting()\n * ```\n */\n PDFOptionList.prototype.disableSorting = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.Sort, false);\n };\n /**\n * Returns `true` if multiple options can be selected from this option list.\n * See [[PDFOptionList.enableMultiselect]] and\n * [[PDFOptionList.disableMultiselect]]. For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * if (optionList.isMultiselect()) console.log('Multiselect is enabled')\n * ```\n * @returns Whether or not multiple options can be selected.\n */\n PDFOptionList.prototype.isMultiselect = function () {\n return this.acroField.hasFlag(AcroChoiceFlags.MultiSelect);\n };\n /**\n * Allow users to select more than one option from this option list.\n * For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.enableMultiselect()\n * ```\n */\n PDFOptionList.prototype.enableMultiselect = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.MultiSelect, true);\n };\n /**\n * Do not allow users to select more than one option from this option list.\n * For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.disableMultiselect()\n * ```\n */\n PDFOptionList.prototype.disableMultiselect = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.MultiSelect, false);\n };\n /**\n * Returns `true` if the option selected by a user is stored, or \"committed\",\n * when the user clicks the option. The alternative is that the user's\n * selection is stored when the user leaves this option list field (by\n * clicking outside of it - on another field, for example). See\n * [[PDFOptionList.enableSelectOnClick]] and\n * [[PDFOptionList.disableSelectOnClick]]. For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * if (optionList.isSelectOnClick()) console.log('Select on click is enabled')\n * ```\n * @returns Whether or not options are selected immediately after they are\n * clicked.\n */\n PDFOptionList.prototype.isSelectOnClick = function () {\n return this.acroField.hasFlag(AcroChoiceFlags.CommitOnSelChange);\n };\n /**\n * Store the option selected by a user immediately after the user clicks the\n * option. Do not wait for the user to leave this option list field (by\n * clicking outside of it - on another field, for example). For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.enableSelectOnClick()\n * ```\n */\n PDFOptionList.prototype.enableSelectOnClick = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.CommitOnSelChange, true);\n };\n /**\n * Wait to store the option selected by a user until they leave this option\n * list field (by clicking outside of it - on another field, for example).\n * For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.disableSelectOnClick()\n * ```\n */\n PDFOptionList.prototype.disableSelectOnClick = function () {\n this.acroField.setFlagTo(AcroChoiceFlags.CommitOnSelChange, false);\n };\n /**\n * Show this option list on the specified page. For example:\n * ```js\n * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const optionList = form.createOptionList('best.gundams')\n * optionList.setOptions(['Exia', 'Dynames', 'Kyrios', 'Virtue'])\n * optionList.select(['Exia', 'Virtue'])\n *\n * optionList.addToPage(page, {\n * x: 50,\n * y: 75,\n * width: 200,\n * height: 100,\n * textColor: rgb(1, 0, 0),\n * backgroundColor: rgb(0, 1, 0),\n * borderColor: rgb(0, 0, 1),\n * borderWidth: 2,\n * rotate: degrees(90),\n * font: ubuntuFont,\n * })\n * ```\n * This will create a new widget for this option list field.\n * @param page The page to which this option list widget should be added.\n * @param options The options to be used when adding this option list widget.\n */\n PDFOptionList.prototype.addToPage = function (page, options) {\n var _a, _b, _c, _d, _e, _f, _g;\n assertIs(page, 'page', [[PDFPage, 'PDFPage']]);\n assertFieldAppearanceOptions(options);\n if (!options)\n options = {};\n if (!('textColor' in options))\n options.textColor = rgb(0, 0, 0);\n if (!('backgroundColor' in options))\n options.backgroundColor = rgb(1, 1, 1);\n if (!('borderColor' in options))\n options.borderColor = rgb(0, 0, 0);\n if (!('borderWidth' in options))\n options.borderWidth = 1;\n // Create a widget for this option list\n var widget = this.createWidget({\n x: (_a = options.x) !== null && _a !== void 0 ? _a : 0,\n y: (_b = options.y) !== null && _b !== void 0 ? _b : 0,\n width: (_c = options.width) !== null && _c !== void 0 ? _c : 200,\n height: (_d = options.height) !== null && _d !== void 0 ? _d : 100,\n textColor: options.textColor,\n backgroundColor: options.backgroundColor,\n borderColor: options.borderColor,\n borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0,\n rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : degrees(0),\n hidden: options.hidden,\n page: page.ref,\n });\n var widgetRef = this.doc.context.register(widget.dict);\n // Add widget to this field\n this.acroField.addWidget(widgetRef);\n // Set appearance streams for widget\n var font = (_g = options.font) !== null && _g !== void 0 ? _g : this.doc.getForm().getDefaultFont();\n this.updateWidgetAppearance(widget, font);\n // Add widget to the given page\n page.node.addAnnot(widgetRef);\n };\n /**\n * Returns `true` if this option list has been marked as dirty, or if any of\n * this option list's widgets do not have an appearance stream. For example:\n * ```js\n * const optionList = form.getOptionList('some.optionList.field')\n * if (optionList.needsAppearancesUpdate()) console.log('Needs update')\n * ```\n * @returns Whether or not this option list needs an appearance update.\n */\n PDFOptionList.prototype.needsAppearancesUpdate = function () {\n var _a;\n if (this.isDirty())\n return true;\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var hasAppearances = ((_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal) instanceof PDFStream;\n if (!hasAppearances)\n return true;\n }\n return false;\n };\n /**\n * Update the appearance streams for each of this option list's widgets using\n * the default appearance provider for option lists. For example:\n * ```js\n * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.defaultUpdateAppearances(helvetica)\n * ```\n * @param font The font to be used for creating the appearance streams.\n */\n PDFOptionList.prototype.defaultUpdateAppearances = function (font) {\n assertIs(font, 'font', [[PDFFont, 'PDFFont']]);\n this.updateAppearances(font);\n };\n /**\n * Update the appearance streams for each of this option list's widgets using\n * the given appearance provider. If no `provider` is passed, the default\n * appearance provider for option lists will be used. For example:\n * ```js\n * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const optionList = form.getOptionList('some.optionList.field')\n * optionList.updateAppearances(helvetica, (field, widget, font) => {\n * ...\n * return drawOptionList(...)\n * })\n * ```\n * @param font The font to be used for creating the appearance streams.\n * @param provider Optionally, the appearance provider to be used for\n * generating the contents of the appearance streams.\n */\n PDFOptionList.prototype.updateAppearances = function (font, provider) {\n assertIs(font, 'font', [[PDFFont, 'PDFFont']]);\n assertOrUndefined(provider, 'provider', [Function]);\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n this.updateWidgetAppearance(widget, font, provider);\n }\n this.markAsClean();\n };\n // getOption(index: number): string {}\n // getSelectedIndices(): number[] {}\n // removeOptions(option: string | string[]) {}\n // removeIndices(option: number[]) {}\n // deselect(options: string | string[]) {}\n // deselectIndices(optionIndices: number[]) {}\n PDFOptionList.prototype.updateWidgetAppearance = function (widget, font, provider) {\n var apProvider = provider !== null && provider !== void 0 ? provider : defaultOptionListAppearanceProvider;\n var appearances = normalizeAppearance(apProvider(this, widget, font));\n this.updateWidgetAppearanceWithFont(widget, font, appearances);\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFForm.getOptionList]] method, which will create\n * > an instance of [[PDFOptionList]] for you.\n *\n * Create an instance of [[PDFOptionList]] from an existing acroListBox and\n * ref\n *\n * @param acroComboBox The underlying `PDFAcroListBox` for this option list.\n * @param ref The unique reference for this option list.\n * @param doc The document to which this option list will belong.\n */\n PDFOptionList.of = function (acroListBox, ref, doc) {\n return new PDFOptionList(acroListBox, ref, doc);\n };\n return PDFOptionList;\n}(PDFField));\nexport default PDFOptionList;\n//# sourceMappingURL=PDFOptionList.js.map","import { __extends } from \"tslib\";\nimport PDFPage from \"../PDFPage\";\nimport PDFField, { assertFieldAppearanceOptions, } from \"./PDFField\";\nimport { normalizeAppearance, defaultRadioGroupAppearanceProvider, } from \"./appearances\";\nimport { rgb } from \"../colors\";\nimport { degrees } from \"../rotations\";\nimport { PDFName, PDFHexString, PDFDict, PDFAcroRadioButton, AcroButtonFlags, } from \"../../core\";\nimport { assertIs, assertOrUndefined, assertIsOneOf } from \"../../utils\";\n/**\n * Represents a radio group field of a [[PDFForm]].\n *\n * [[PDFRadioGroup]] fields are collections of radio buttons. The purpose of a\n * radio group is to enable users to select one option from a set of mutually\n * exclusive choices. Each choice in a radio group is represented by a radio\n * button. Radio buttons each have two states: `on` and `off`. At most one\n * radio button in a group may be in the `on` state at any time. Users can\n * click on a radio button to select it (and thereby automatically deselect any\n * other radio button that might have already been selected). Some radio\n * groups allow users to toggle a selected radio button `off` by clicking on\n * it (see [[PDFRadioGroup.isOffToggleable]]).\n *\n * Note that some radio groups allow multiple radio buttons to be in the `on`\n * state at the same type **if** they represent the same underlying value (see\n * [[PDFRadioGroup.isMutuallyExclusive]]).\n */\nvar PDFRadioGroup = /** @class */ (function (_super) {\n __extends(PDFRadioGroup, _super);\n function PDFRadioGroup(acroRadioButton, ref, doc) {\n var _this = _super.call(this, acroRadioButton, ref, doc) || this;\n assertIs(acroRadioButton, 'acroRadioButton', [\n [PDFAcroRadioButton, 'PDFAcroRadioButton'],\n ]);\n _this.acroField = acroRadioButton;\n return _this;\n }\n /**\n * Get the list of available options for this radio group. Each option is\n * represented by a radio button. These radio buttons are displayed at\n * various locations in the document, potentially on different pages (though\n * typically they are stacked horizontally or vertically on the same page).\n * For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * const options = radioGroup.getOptions()\n * console.log('Radio Group options:', options)\n * ```\n * @returns The options for this radio group.\n */\n PDFRadioGroup.prototype.getOptions = function () {\n var exportValues = this.acroField.getExportValues();\n if (exportValues) {\n var exportOptions = new Array(exportValues.length);\n for (var idx = 0, len = exportValues.length; idx < len; idx++) {\n exportOptions[idx] = exportValues[idx].decodeText();\n }\n return exportOptions;\n }\n var onValues = this.acroField.getOnValues();\n var onOptions = new Array(onValues.length);\n for (var idx = 0, len = onOptions.length; idx < len; idx++) {\n onOptions[idx] = onValues[idx].decodeText();\n }\n return onOptions;\n };\n /**\n * Get the selected option for this radio group. The selected option is\n * represented by the radio button in this group that is turned on. At most\n * one radio button in a group can be selected. If no buttons in this group\n * are selected, `undefined` is returned.\n * For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * const selected = radioGroup.getSelected()\n * console.log('Selected radio button:', selected)\n * ```\n * @returns The selected option for this radio group.\n */\n PDFRadioGroup.prototype.getSelected = function () {\n var value = this.acroField.getValue();\n if (value === PDFName.of('Off'))\n return undefined;\n var exportValues = this.acroField.getExportValues();\n if (exportValues) {\n var onValues = this.acroField.getOnValues();\n for (var idx = 0, len = onValues.length; idx < len; idx++) {\n if (onValues[idx] === value)\n return exportValues[idx].decodeText();\n }\n }\n return value.decodeText();\n };\n // // TODO: Figure out why this seems to crash Acrobat. Maybe it's because we\n // // aren't removing the widget reference from the page's Annots?\n // removeOption(option: string) {\n // assertIs(option, 'option', ['string']);\n // // TODO: Assert is valid `option`!\n // const onValues = this.acroField.getOnValues();\n // const exportValues = this.acroField.getExportValues();\n // if (exportValues) {\n // for (let idx = 0, len = exportValues.length; idx < len; idx++) {\n // if (exportValues[idx].decodeText() === option) {\n // this.acroField.removeWidget(idx);\n // this.acroField.removeExportValue(idx);\n // }\n // }\n // } else {\n // for (let idx = 0, len = onValues.length; idx < len; idx++) {\n // const value = onValues[idx];\n // if (value.decodeText() === option) {\n // this.acroField.removeWidget(idx);\n // this.acroField.removeExportValue(idx);\n // }\n // }\n // }\n // }\n /**\n * Select an option for this radio group. This operation is analogous to a\n * human user clicking one of the radio buttons in this group via a PDF\n * reader to toggle it on. This method will update the underlying state of\n * the radio group to indicate which option has been selected. PDF libraries\n * and readers will be able to extract this value from the saved document and\n * determine which option was selected.\n *\n * For example:\n * ```js\n * const radioGroup = form.getRadioGroup('best.superhero.radioGroup')\n * radioGroup.select('One Punch Man')\n * ```\n *\n * This method will mark this radio group as dirty, causing its appearance\n * streams to be updated when either [[PDFDocument.save]] or\n * [[PDFForm.updateFieldAppearances]] is called. The updated appearance\n * streams will display a dot inside the widget of this check box field\n * that represents the selected option.\n *\n * @param option The option to be selected.\n */\n PDFRadioGroup.prototype.select = function (option) {\n assertIs(option, 'option', ['string']);\n var validOptions = this.getOptions();\n assertIsOneOf(option, 'option', validOptions);\n this.markAsDirty();\n var onValues = this.acroField.getOnValues();\n var exportValues = this.acroField.getExportValues();\n if (exportValues) {\n for (var idx = 0, len = exportValues.length; idx < len; idx++) {\n if (exportValues[idx].decodeText() === option) {\n this.acroField.setValue(onValues[idx]);\n }\n }\n }\n else {\n for (var idx = 0, len = onValues.length; idx < len; idx++) {\n var value = onValues[idx];\n if (value.decodeText() === option)\n this.acroField.setValue(value);\n }\n }\n };\n /**\n * Clear any selected option for this dropdown. This will result in all\n * radio buttons in this group being toggled off. This method will update\n * the underlying state of the dropdown to indicate that no radio buttons\n * have been selected.\n * For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * radioGroup.clear()\n * ```\n * This method will mark this radio group as dirty. See\n * [[PDFRadioGroup.select]] for more details about what this means.\n */\n PDFRadioGroup.prototype.clear = function () {\n this.markAsDirty();\n this.acroField.setValue(PDFName.of('Off'));\n };\n /**\n * Returns `true` if users can click on radio buttons in this group to toggle\n * them off. The alternative is that once a user clicks on a radio button\n * to select it, the only way to deselect it is by selecting on another radio\n * button in the group. See [[PDFRadioGroup.enableOffToggling]] and\n * [[PDFRadioGroup.disableOffToggling]]. For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * if (radioGroup.isOffToggleable()) console.log('Off toggling is enabled')\n * ```\n */\n PDFRadioGroup.prototype.isOffToggleable = function () {\n return !this.acroField.hasFlag(AcroButtonFlags.NoToggleToOff);\n };\n /**\n * Allow users to click on selected radio buttons in this group to toggle\n * them off. For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * radioGroup.enableOffToggling()\n * ```\n * > **NOTE:** This feature is documented in the PDF specification\n * > (Table 226). However, most PDF readers do not respect this option and\n * > prevent users from toggling radio buttons off even when it is enabled.\n * > At the time of this writing (9/6/2020) Mac's Preview software did\n * > respect the option. Adobe Acrobat, Foxit Reader, and Google Chrome did\n * > not.\n */\n PDFRadioGroup.prototype.enableOffToggling = function () {\n this.acroField.setFlagTo(AcroButtonFlags.NoToggleToOff, false);\n };\n /**\n * Prevent users from clicking on selected radio buttons in this group to\n * toggle them off. Clicking on a selected radio button will have no effect.\n * The only way to deselect a selected radio button is to click on a\n * different radio button in the group. For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * radioGroup.disableOffToggling()\n * ```\n */\n PDFRadioGroup.prototype.disableOffToggling = function () {\n this.acroField.setFlagTo(AcroButtonFlags.NoToggleToOff, true);\n };\n /**\n * Returns `true` if the radio buttons in this group are mutually exclusive.\n * This means that when the user selects a radio button, only that specific\n * button will be turned on. Even if other radio buttons in the group\n * represent the same value, they will not be enabled. The alternative to\n * this is that clicking a radio button will select that button along with\n * any other radio buttons in the group that share the same value. See\n * [[PDFRadioGroup.enableMutualExclusion]] and\n * [[PDFRadioGroup.disableMutualExclusion]].\n * For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * if (radioGroup.isMutuallyExclusive()) console.log('Mutual exclusion is enabled')\n * ```\n */\n PDFRadioGroup.prototype.isMutuallyExclusive = function () {\n return !this.acroField.hasFlag(AcroButtonFlags.RadiosInUnison);\n };\n /**\n * When the user clicks a radio button in this group it will be selected. In\n * addition, any other radio buttons in this group that share the same\n * underlying value will also be selected. For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * radioGroup.enableMutualExclusion()\n * ```\n * Note that this option must be enabled prior to adding options to the\n * radio group. It does not currently apply retroactively to existing\n * radio buttons in the group.\n */\n PDFRadioGroup.prototype.enableMutualExclusion = function () {\n this.acroField.setFlagTo(AcroButtonFlags.RadiosInUnison, false);\n };\n /**\n * When the user clicks a radio button in this group only it will be selected.\n * No other radio buttons in the group will be selected, even if they share\n * the same underlying value. For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * radioGroup.disableMutualExclusion()\n * ```\n * Note that this option must be disabled prior to adding options to the\n * radio group. It does not currently apply retroactively to existing\n * radio buttons in the group.\n */\n PDFRadioGroup.prototype.disableMutualExclusion = function () {\n this.acroField.setFlagTo(AcroButtonFlags.RadiosInUnison, true);\n };\n /**\n * Add a new radio button to this group on the specified page. For example:\n * ```js\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const radioGroup = form.createRadioGroup('best.gundam')\n *\n * const options = {\n * x: 50,\n * width: 25,\n * height: 25,\n * textColor: rgb(1, 0, 0),\n * backgroundColor: rgb(0, 1, 0),\n * borderColor: rgb(0, 0, 1),\n * borderWidth: 2,\n * rotate: degrees(90),\n * }\n *\n * radioGroup.addOptionToPage('Exia', page, { ...options, y: 50 })\n * radioGroup.addOptionToPage('Dynames', page, { ...options, y: 110 })\n * ```\n * This will create a new radio button widget for this radio group field.\n * @param option The option that the radio button widget represents.\n * @param page The page to which the radio button widget should be added.\n * @param options The options to be used when adding the radio button widget.\n */\n PDFRadioGroup.prototype.addOptionToPage = function (option, page, options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n assertIs(option, 'option', ['string']);\n assertIs(page, 'page', [[PDFPage, 'PDFPage']]);\n assertFieldAppearanceOptions(options);\n // Create a widget for this radio button\n var widget = this.createWidget({\n x: (_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0,\n y: (_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : 0,\n width: (_c = options === null || options === void 0 ? void 0 : options.width) !== null && _c !== void 0 ? _c : 50,\n height: (_d = options === null || options === void 0 ? void 0 : options.height) !== null && _d !== void 0 ? _d : 50,\n textColor: (_e = options === null || options === void 0 ? void 0 : options.textColor) !== null && _e !== void 0 ? _e : rgb(0, 0, 0),\n backgroundColor: (_f = options === null || options === void 0 ? void 0 : options.backgroundColor) !== null && _f !== void 0 ? _f : rgb(1, 1, 1),\n borderColor: (_g = options === null || options === void 0 ? void 0 : options.borderColor) !== null && _g !== void 0 ? _g : rgb(0, 0, 0),\n borderWidth: (_h = options === null || options === void 0 ? void 0 : options.borderWidth) !== null && _h !== void 0 ? _h : 1,\n rotate: (_j = options === null || options === void 0 ? void 0 : options.rotate) !== null && _j !== void 0 ? _j : degrees(0),\n hidden: options === null || options === void 0 ? void 0 : options.hidden,\n page: page.ref,\n });\n var widgetRef = this.doc.context.register(widget.dict);\n // Add widget to this field\n var apStateValue = this.acroField.addWidgetWithOpt(widgetRef, PDFHexString.fromText(option), !this.isMutuallyExclusive());\n // Set appearance streams for widget\n widget.setAppearanceState(PDFName.of('Off'));\n this.updateWidgetAppearance(widget, apStateValue);\n // Add widget to the given page\n page.node.addAnnot(widgetRef);\n };\n /**\n * Returns `true` if any of this group's radio button widgets do not have an\n * appearance stream for their current state. For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * if (radioGroup.needsAppearancesUpdate()) console.log('Needs update')\n * ```\n * @returns Whether or not this radio group needs an appearance update.\n */\n PDFRadioGroup.prototype.needsAppearancesUpdate = function () {\n var _a;\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var state = widget.getAppearanceState();\n var normal = (_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal;\n if (!(normal instanceof PDFDict))\n return true;\n if (state && !normal.has(state))\n return true;\n }\n return false;\n };\n /**\n * Update the appearance streams for each of this group's radio button widgets\n * using the default appearance provider for radio groups. For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * radioGroup.defaultUpdateAppearances()\n * ```\n */\n PDFRadioGroup.prototype.defaultUpdateAppearances = function () {\n this.updateAppearances();\n };\n // rg.updateAppearances((field: any, widget: any) => {\n // assert(field === rg);\n // assert(widget instanceof PDFWidgetAnnotation);\n // return { on: [...rectangle, ...circle], off: [...rectangle, ...circle] };\n // });\n /**\n * Update the appearance streams for each of this group's radio button widgets\n * using the given appearance provider. If no `provider` is passed, the\n * default appearance provider for radio groups will be used. For example:\n * ```js\n * const radioGroup = form.getRadioGroup('some.radioGroup.field')\n * radioGroup.updateAppearances((field, widget) => {\n * ...\n * return {\n * normal: { on: drawRadioButton(...), off: drawRadioButton(...) },\n * down: { on: drawRadioButton(...), off: drawRadioButton(...) },\n * }\n * })\n * ```\n * @param provider Optionally, the appearance provider to be used for\n * generating the contents of the appearance streams.\n */\n PDFRadioGroup.prototype.updateAppearances = function (provider) {\n assertOrUndefined(provider, 'provider', [Function]);\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var onValue = widget.getOnValue();\n if (!onValue)\n continue;\n this.updateWidgetAppearance(widget, onValue, provider);\n }\n };\n PDFRadioGroup.prototype.updateWidgetAppearance = function (widget, onValue, provider) {\n var apProvider = provider !== null && provider !== void 0 ? provider : defaultRadioGroupAppearanceProvider;\n var appearances = normalizeAppearance(apProvider(this, widget));\n this.updateOnOffWidgetAppearance(widget, onValue, appearances);\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFForm.getOptionList]] method, which will create an\n * > instance of [[PDFOptionList]] for you.\n *\n * Create an instance of [[PDFOptionList]] from an existing acroRadioButton\n * and ref\n *\n * @param acroRadioButton The underlying `PDFAcroRadioButton` for this\n * radio group.\n * @param ref The unique reference for this radio group.\n * @param doc The document to which this radio group will belong.\n */\n PDFRadioGroup.of = function (acroRadioButton, ref, doc) { return new PDFRadioGroup(acroRadioButton, ref, doc); };\n return PDFRadioGroup;\n}(PDFField));\nexport default PDFRadioGroup;\n//# sourceMappingURL=PDFRadioGroup.js.map","import { __extends } from \"tslib\";\nimport PDFField from \"./PDFField\";\nimport { PDFAcroSignature } from \"../../core\";\nimport { assertIs } from \"../../utils\";\n/**\n * Represents a signature field of a [[PDFForm]].\n *\n * [[PDFSignature]] fields are digital signatures. `pdf-lib` does not\n * currently provide any specialized APIs for creating digital signatures or\n * reading the contents of existing digital signatures.\n */\nvar PDFSignature = /** @class */ (function (_super) {\n __extends(PDFSignature, _super);\n function PDFSignature(acroSignature, ref, doc) {\n var _this = _super.call(this, acroSignature, ref, doc) || this;\n assertIs(acroSignature, 'acroSignature', [\n [PDFAcroSignature, 'PDFAcroSignature'],\n ]);\n _this.acroField = acroSignature;\n return _this;\n }\n PDFSignature.prototype.needsAppearancesUpdate = function () {\n return false;\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFForm.getSignature]] method, which will create an\n * > instance of [[PDFSignature]] for you.\n *\n * Create an instance of [[PDFSignature]] from an existing acroSignature and\n * ref\n *\n * @param acroSignature The underlying `PDFAcroSignature` for this signature.\n * @param ref The unique reference for this signature.\n * @param doc The document to which this signature will belong.\n */\n PDFSignature.of = function (acroSignature, ref, doc) { return new PDFSignature(acroSignature, ref, doc); };\n return PDFSignature;\n}(PDFField));\nexport default PDFSignature;\n//# sourceMappingURL=PDFSignature.js.map","import { __extends } from \"tslib\";\nimport PDFPage from \"../PDFPage\";\nimport PDFFont from \"../PDFFont\";\nimport PDFField, { assertFieldAppearanceOptions, } from \"./PDFField\";\nimport { normalizeAppearance, defaultTextFieldAppearanceProvider, } from \"./appearances\";\nimport { rgb } from \"../colors\";\nimport { degrees } from \"../rotations\";\nimport { RichTextFieldReadError, ExceededMaxLengthError, InvalidMaxLengthError, } from \"../errors\";\nimport { ImageAlignment } from \"../image/alignment\";\nimport { TextAlignment } from \"../text/alignment\";\nimport { PDFHexString, PDFStream, PDFAcroText, AcroTextFlags, } from \"../../core\";\nimport { assertIs, assertIsOneOf, assertOrUndefined, assertPositive, assertRangeOrUndefined, } from \"../../utils\";\n/**\n * Represents a text field of a [[PDFForm]].\n *\n * [[PDFTextField]] fields are boxes that display text entered by the user. The\n * purpose of a text field is to enable users to enter text or view text values\n * in the document prefilled by software. Users can click on a text field and\n * input text via their keyboard. Some text fields allow multiple lines of text\n * to be entered (see [[PDFTextField.isMultiline]]).\n */\nvar PDFTextField = /** @class */ (function (_super) {\n __extends(PDFTextField, _super);\n function PDFTextField(acroText, ref, doc) {\n var _this = _super.call(this, acroText, ref, doc) || this;\n assertIs(acroText, 'acroText', [[PDFAcroText, 'PDFAcroText']]);\n _this.acroField = acroText;\n return _this;\n }\n /**\n * Get the text that this field contains. This text is visible to users who\n * view this field in a PDF reader.\n *\n * For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * const text = textField.getText()\n * console.log('Text field contents:', text)\n * ```\n *\n * Note that if this text field contains no underlying value, `undefined`\n * will be returned. Text fields may also contain an underlying value that\n * is simply an empty string (`''`). This detail is largely irrelevant for\n * most applications. In general, you'll want to treat both cases the same\n * way and simply consider the text field to be empty. In either case, the\n * text field will appear empty to users when viewed in a PDF reader.\n *\n * An error will be thrown if this is a rich text field. `pdf-lib` does not\n * support reading rich text fields. Nor do most PDF readers and writers.\n * Rich text fields are based on XFA (XML Forms Architecture). Relatively few\n * PDFs use rich text fields or XFA. Unlike PDF itself, XFA is not an ISO\n * standard. XFA has been deprecated in PDF 2.0:\n * * https://en.wikipedia.org/wiki/XFA\n * * http://blog.pdfshareforms.com/pdf-2-0-release-bid-farewell-xfa-forms/\n *\n * @returns The text contained in this text field.\n */\n PDFTextField.prototype.getText = function () {\n var value = this.acroField.getValue();\n if (!value && this.isRichFormatted()) {\n throw new RichTextFieldReadError(this.getName());\n }\n return value === null || value === void 0 ? void 0 : value.decodeText();\n };\n /**\n * Set the text for this field. This operation is analogous to a human user\n * clicking on the text field in a PDF reader and typing in text via their\n * keyboard. This method will update the underlying state of the text field\n * to indicate what text has been set. PDF libraries and readers will be able\n * to extract these values from the saved document and determine what text\n * was set.\n *\n * For example:\n * ```js\n * const textField = form.getTextField('best.superhero.text.field')\n * textField.setText('One Punch Man')\n * ```\n *\n * This method will mark this text field as dirty, causing its appearance\n * streams to be updated when either [[PDFDocument.save]] or\n * [[PDFForm.updateFieldAppearances]] is called. The updated streams will\n * display the text this field contains inside the widgets of this text\n * field.\n *\n * **IMPORTANT:** The default font used to update appearance streams is\n * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means\n * that encoding errors will be thrown if this field contains text outside\n * the WinAnsi character set (the latin alphabet).\n *\n * Embedding a custom font and passing it to\n * [[PDFForm.updateFieldAppearances]] or [[PDFTextField.updateAppearances]]\n * allows you to generate appearance streams with characters outside the\n * latin alphabet (assuming the custom font supports them).\n *\n * If this is a rich text field, it will be converted to a standard text\n * field in order to set the text. `pdf-lib` does not support writing rich\n * text strings. Nor do most PDF readers and writers. See\n * [[PDFTextField.getText]] for more information about rich text fields and\n * their deprecation in PDF 2.0.\n *\n * @param text The text this field should contain.\n */\n PDFTextField.prototype.setText = function (text) {\n assertOrUndefined(text, 'text', ['string']);\n var maxLength = this.getMaxLength();\n if (maxLength !== undefined && text && text.length > maxLength) {\n throw new ExceededMaxLengthError(text.length, maxLength, this.getName());\n }\n this.markAsDirty();\n this.disableRichFormatting();\n if (text) {\n this.acroField.setValue(PDFHexString.fromText(text));\n }\n else {\n this.acroField.removeValue();\n }\n };\n /**\n * Get the alignment for this text field. This value represents the\n * justification of the text when it is displayed to the user in PDF readers.\n * There are three possible alignments: left, center, and right. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * const alignment = textField.getAlignment()\n * if (alignment === TextAlignment.Left) console.log('Text is left justified')\n * if (alignment === TextAlignment.Center) console.log('Text is centered')\n * if (alignment === TextAlignment.Right) console.log('Text is right justified')\n * ```\n * @returns The alignment of this text field.\n */\n PDFTextField.prototype.getAlignment = function () {\n var quadding = this.acroField.getQuadding();\n // prettier-ignore\n return (quadding === 0 ? TextAlignment.Left\n : quadding === 1 ? TextAlignment.Center\n : quadding === 2 ? TextAlignment.Right\n : TextAlignment.Left);\n };\n /**\n * Set the alignment for this text field. This will determine the\n * justification of the text when it is displayed to the user in PDF readers.\n * There are three possible alignments: left, center, and right. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n *\n * // Text will be left justified when displayed\n * textField.setAlignment(TextAlignment.Left)\n *\n * // Text will be centered when displayed\n * textField.setAlignment(TextAlignment.Center)\n *\n * // Text will be right justified when displayed\n * textField.setAlignment(TextAlignment.Right)\n * ```\n * This method will mark this text field as dirty. See\n * [[PDFTextField.setText]] for more details about what this means.\n * @param alignment The alignment for this text field.\n */\n PDFTextField.prototype.setAlignment = function (alignment) {\n assertIsOneOf(alignment, 'alignment', TextAlignment);\n this.markAsDirty();\n this.acroField.setQuadding(alignment);\n };\n /**\n * Get the maximum length of this field. This value represents the maximum\n * number of characters that can be typed into this field by the user. If\n * this field does not have a maximum length, `undefined` is returned.\n * For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * const maxLength = textField.getMaxLength()\n * if (maxLength === undefined) console.log('No max length')\n * else console.log(`Max length is ${maxLength}`)\n * ```\n * @returns The maximum number of characters allowed in this field, or\n * `undefined` if no limit exists.\n */\n PDFTextField.prototype.getMaxLength = function () {\n return this.acroField.getMaxLength();\n };\n /**\n * Set the maximum length of this field. This limits the number of characters\n * that can be typed into this field by the user. This also limits the length\n * of the string that can be passed to [[PDFTextField.setText]]. This limit\n * can be removed by passing `undefined` as `maxLength`. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n *\n * // Allow between 0 and 5 characters to be entered\n * textField.setMaxLength(5)\n *\n * // Allow any number of characters to be entered\n * textField.setMaxLength(undefined)\n * ```\n * This method will mark this text field as dirty. See\n * [[PDFTextField.setText]] for more details about what this means.\n * @param maxLength The maximum number of characters allowed in this field, or\n * `undefined` to remove the limit.\n */\n PDFTextField.prototype.setMaxLength = function (maxLength) {\n assertRangeOrUndefined(maxLength, 'maxLength', 0, Number.MAX_SAFE_INTEGER);\n this.markAsDirty();\n if (maxLength === undefined) {\n this.acroField.removeMaxLength();\n }\n else {\n var text = this.getText();\n if (text && text.length > maxLength) {\n throw new InvalidMaxLengthError(text.length, maxLength, this.getName());\n }\n this.acroField.setMaxLength(maxLength);\n }\n };\n /**\n * Remove the maximum length for this text field. This allows any number of\n * characters to be typed into this field by the user. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.removeMaxLength()\n * ```\n * Calling this method is equivalent to passing `undefined` to\n * [[PDFTextField.setMaxLength]].\n */\n PDFTextField.prototype.removeMaxLength = function () {\n this.markAsDirty();\n this.acroField.removeMaxLength();\n };\n /**\n * Display an image inside the bounds of this text field's widgets. For example:\n * ```js\n * const pngImage = await pdfDoc.embedPng(...)\n * const textField = form.getTextField('some.text.field')\n * textField.setImage(pngImage)\n * ```\n * This will update the appearances streams for each of this text field's widgets.\n * @param image The image that should be displayed.\n */\n PDFTextField.prototype.setImage = function (image) {\n var fieldAlignment = this.getAlignment();\n // prettier-ignore\n var alignment = fieldAlignment === TextAlignment.Center ? ImageAlignment.Center\n : fieldAlignment === TextAlignment.Right ? ImageAlignment.Right\n : ImageAlignment.Left;\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var streamRef = this.createImageAppearanceStream(widget, image, alignment);\n this.updateWidgetAppearances(widget, { normal: streamRef });\n }\n this.markAsClean();\n };\n /**\n * Set the font size for this field. Larger font sizes will result in larger\n * text being displayed when PDF readers render this text field. Font sizes\n * may be integer or floating point numbers. Supplying a negative font size\n * will cause this method to throw an error.\n *\n * For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.setFontSize(4)\n * textField.setFontSize(15.7)\n * ```\n *\n * > This method depends upon the existence of a default appearance\n * > (`/DA`) string. If this field does not have a default appearance string,\n * > or that string does not contain a font size (via the `Tf` operator),\n * > then this method will throw an error.\n *\n * @param fontSize The font size to be used when rendering text in this field.\n */\n PDFTextField.prototype.setFontSize = function (fontSize) {\n assertPositive(fontSize, 'fontSize');\n this.acroField.setFontSize(fontSize);\n this.markAsDirty();\n };\n /**\n * Returns `true` if each line of text is shown on a new line when this\n * field is displayed in a PDF reader. The alternative is that all lines of\n * text are merged onto a single line when displayed. See\n * [[PDFTextField.enableMultiline]] and [[PDFTextField.disableMultiline]].\n * For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * if (textField.isMultiline()) console.log('Multiline is enabled')\n * ```\n * @returns Whether or not this is a multiline text field.\n */\n PDFTextField.prototype.isMultiline = function () {\n return this.acroField.hasFlag(AcroTextFlags.Multiline);\n };\n /**\n * Display each line of text on a new line when this field is displayed in a\n * PDF reader. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.enableMultiline()\n * ```\n * This method will mark this text field as dirty. See\n * [[PDFTextField.setText]] for more details about what this means.\n */\n PDFTextField.prototype.enableMultiline = function () {\n this.markAsDirty();\n this.acroField.setFlagTo(AcroTextFlags.Multiline, true);\n };\n /**\n * Display each line of text on the same line when this field is displayed\n * in a PDF reader. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.disableMultiline()\n * ```\n * This method will mark this text field as dirty. See\n * [[PDFTextField.setText]] for more details about what this means.\n */\n PDFTextField.prototype.disableMultiline = function () {\n this.markAsDirty();\n this.acroField.setFlagTo(AcroTextFlags.Multiline, false);\n };\n /**\n * Returns `true` if this is a password text field. This means that the field\n * is intended for storing a secure password. See\n * [[PDFTextField.enablePassword]] and [[PDFTextField.disablePassword]].\n * For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * if (textField.isPassword()) console.log('Password is enabled')\n * ```\n * @returns Whether or not this is a password text field.\n */\n PDFTextField.prototype.isPassword = function () {\n return this.acroField.hasFlag(AcroTextFlags.Password);\n };\n /**\n * Indicate that this text field is intended for storing a secure password.\n * For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.enablePassword()\n * ```\n * Values entered into password text fields should not be displayed on the\n * screen by PDF readers. Most PDF readers will display the value as\n * asterisks or bullets. PDF readers should never store values entered by the\n * user into password text fields. Similarly, applications should not\n * write data to a password text field.\n *\n * **Please note that this method does not cause entered values to be\n * encrypted or secured in any way! It simply sets a flag that PDF software\n * and readers can access to determine the _purpose_ of this field.**\n */\n PDFTextField.prototype.enablePassword = function () {\n this.acroField.setFlagTo(AcroTextFlags.Password, true);\n };\n /**\n * Indicate that this text field is **not** intended for storing a secure\n * password. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.disablePassword()\n * ```\n */\n PDFTextField.prototype.disablePassword = function () {\n this.acroField.setFlagTo(AcroTextFlags.Password, false);\n };\n /**\n * Returns `true` if the contents of this text field represent a file path.\n * See [[PDFTextField.enableFileSelection]] and\n * [[PDFTextField.disableFileSelection]]. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * if (textField.isFileSelector()) console.log('Is a file selector')\n * ```\n * @returns Whether or not this field should contain file paths.\n */\n PDFTextField.prototype.isFileSelector = function () {\n return this.acroField.hasFlag(AcroTextFlags.FileSelect);\n };\n /**\n * Indicate that this text field is intended to store a file path. The\n * contents of the file stored at that path should be submitted as the value\n * of the field. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.enableFileSelection()\n * ```\n */\n PDFTextField.prototype.enableFileSelection = function () {\n this.acroField.setFlagTo(AcroTextFlags.FileSelect, true);\n };\n /**\n * Indicate that this text field is **not** intended to store a file path.\n * For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.disableFileSelection()\n * ```\n */\n PDFTextField.prototype.disableFileSelection = function () {\n this.acroField.setFlagTo(AcroTextFlags.FileSelect, false);\n };\n /**\n * Returns `true` if the text entered in this field should be spell checked\n * by PDF readers. See [[PDFTextField.enableSpellChecking]] and\n * [[PDFTextField.disableSpellChecking]]. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * if (textField.isSpellChecked()) console.log('Spell checking is enabled')\n * ```\n * @returns Whether or not this field should be spell checked.\n */\n PDFTextField.prototype.isSpellChecked = function () {\n return !this.acroField.hasFlag(AcroTextFlags.DoNotSpellCheck);\n };\n /**\n * Allow PDF readers to spell check the text entered in this field.\n * For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.enableSpellChecking()\n * ```\n */\n PDFTextField.prototype.enableSpellChecking = function () {\n this.acroField.setFlagTo(AcroTextFlags.DoNotSpellCheck, false);\n };\n /**\n * Do not allow PDF readers to spell check the text entered in this field.\n * For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.disableSpellChecking()\n * ```\n */\n PDFTextField.prototype.disableSpellChecking = function () {\n this.acroField.setFlagTo(AcroTextFlags.DoNotSpellCheck, true);\n };\n /**\n * Returns `true` if PDF readers should allow the user to scroll the text\n * field when its contents do not fit within the field's view bounds. See\n * [[PDFTextField.enableScrolling]] and [[PDFTextField.disableScrolling]].\n * For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * if (textField.isScrollable()) console.log('Scrolling is enabled')\n * ```\n * @returns Whether or not the field is scrollable in PDF readers.\n */\n PDFTextField.prototype.isScrollable = function () {\n return !this.acroField.hasFlag(AcroTextFlags.DoNotScroll);\n };\n /**\n * Allow PDF readers to present a scroll bar to the user when the contents\n * of this text field do not fit within its view bounds. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.enableScrolling()\n * ```\n * A horizontal scroll bar should be shown for singleline fields. A vertical\n * scroll bar should be shown for multiline fields.\n */\n PDFTextField.prototype.enableScrolling = function () {\n this.acroField.setFlagTo(AcroTextFlags.DoNotScroll, false);\n };\n /**\n * Do not allow PDF readers to present a scroll bar to the user when the\n * contents of this text field do not fit within its view bounds. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.disableScrolling()\n * ```\n */\n PDFTextField.prototype.disableScrolling = function () {\n this.acroField.setFlagTo(AcroTextFlags.DoNotScroll, true);\n };\n /**\n * Returns `true` if this is a combed text field. This means that the field\n * is split into `n` equal size cells with one character in each (where `n`\n * is equal to the max length of the text field). The result is that all\n * characters in this field are displayed an equal distance apart from one\n * another. See [[PDFTextField.enableCombing]] and\n * [[PDFTextField.disableCombing]]. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * if (textField.isCombed()) console.log('Combing is enabled')\n * ```\n * Note that in order for a text field to be combed, the following must be\n * true (in addition to enabling combing):\n * * It must not be a multiline field (see [[PDFTextField.isMultiline]])\n * * It must not be a password field (see [[PDFTextField.isPassword]])\n * * It must not be a file selector field (see [[PDFTextField.isFileSelector]])\n * * It must have a max length defined (see [[PDFTextField.setMaxLength]])\n * @returns Whether or not this field is combed.\n */\n PDFTextField.prototype.isCombed = function () {\n return (this.acroField.hasFlag(AcroTextFlags.Comb) &&\n !this.isMultiline() &&\n !this.isPassword() &&\n !this.isFileSelector() &&\n this.getMaxLength() !== undefined);\n };\n /**\n * Split this field into `n` equal size cells with one character in each\n * (where `n` is equal to the max length of the text field). This will cause\n * all characters in the field to be displayed an equal distance apart from\n * one another. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.enableCombing()\n * ```\n *\n * In addition to calling this method, text fields must have a max length\n * defined in order to be combed (see [[PDFTextField.setMaxLength]]).\n *\n * This method will also call the following three methods internally:\n * * [[PDFTextField.disableMultiline]]\n * * [[PDFTextField.disablePassword]]\n * * [[PDFTextField.disableFileSelection]]\n *\n * This method will mark this text field as dirty. See\n * [[PDFTextField.setText]] for more details about what this means.\n */\n PDFTextField.prototype.enableCombing = function () {\n if (this.getMaxLength() === undefined) {\n var msg = \"PDFTextFields must have a max length in order to be combed\";\n console.warn(msg);\n }\n this.markAsDirty();\n this.disableMultiline();\n this.disablePassword();\n this.disableFileSelection();\n this.acroField.setFlagTo(AcroTextFlags.Comb, true);\n };\n /**\n * Turn off combing for this text field. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.disableCombing()\n * ```\n * See [[PDFTextField.isCombed]] and [[PDFTextField.enableCombing]] for more\n * information about what combing is.\n *\n * This method will mark this text field as dirty. See\n * [[PDFTextField.setText]] for more details about what this means.\n */\n PDFTextField.prototype.disableCombing = function () {\n this.markAsDirty();\n this.acroField.setFlagTo(AcroTextFlags.Comb, false);\n };\n /**\n * Returns `true` if this text field contains rich text. See\n * [[PDFTextField.enableRichFormatting]] and\n * [[PDFTextField.disableRichFormatting]]. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * if (textField.isRichFormatted()) console.log('Rich formatting enabled')\n * ```\n * @returns Whether or not this field contains rich text.\n */\n PDFTextField.prototype.isRichFormatted = function () {\n return this.acroField.hasFlag(AcroTextFlags.RichText);\n };\n /**\n * Indicate that this field contains XFA data - or rich text. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.enableRichFormatting()\n * ```\n * Note that `pdf-lib` does not support reading or writing rich text fields.\n * Nor do most PDF readers and writers. Rich text fields are based on XFA\n * (XML Forms Architecture). Relatively few PDFs use rich text fields or XFA.\n * Unlike PDF itself, XFA is not an ISO standard. XFA has been deprecated in\n * PDF 2.0:\n * * https://en.wikipedia.org/wiki/XFA\n * * http://blog.pdfshareforms.com/pdf-2-0-release-bid-farewell-xfa-forms/\n */\n PDFTextField.prototype.enableRichFormatting = function () {\n this.acroField.setFlagTo(AcroTextFlags.RichText, true);\n };\n /**\n * Indicate that this is a standard text field that does not XFA data (rich\n * text). For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * textField.disableRichFormatting()\n * ```\n */\n PDFTextField.prototype.disableRichFormatting = function () {\n this.acroField.setFlagTo(AcroTextFlags.RichText, false);\n };\n /**\n * Show this text field on the specified page. For example:\n * ```js\n * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const textField = form.createTextField('best.gundam')\n * textField.setText('Exia')\n *\n * textField.addToPage(page, {\n * x: 50,\n * y: 75,\n * width: 200,\n * height: 100,\n * textColor: rgb(1, 0, 0),\n * backgroundColor: rgb(0, 1, 0),\n * borderColor: rgb(0, 0, 1),\n * borderWidth: 2,\n * rotate: degrees(90),\n * font: ubuntuFont,\n * })\n * ```\n * This will create a new widget for this text field.\n * @param page The page to which this text field widget should be added.\n * @param options The options to be used when adding this text field widget.\n */\n PDFTextField.prototype.addToPage = function (page, options) {\n var _a, _b, _c, _d, _e, _f, _g;\n assertIs(page, 'page', [[PDFPage, 'PDFPage']]);\n assertFieldAppearanceOptions(options);\n if (!options)\n options = {};\n if (!('textColor' in options))\n options.textColor = rgb(0, 0, 0);\n if (!('backgroundColor' in options))\n options.backgroundColor = rgb(1, 1, 1);\n if (!('borderColor' in options))\n options.borderColor = rgb(0, 0, 0);\n if (!('borderWidth' in options))\n options.borderWidth = 1;\n // Create a widget for this text field\n var widget = this.createWidget({\n x: (_a = options.x) !== null && _a !== void 0 ? _a : 0,\n y: (_b = options.y) !== null && _b !== void 0 ? _b : 0,\n width: (_c = options.width) !== null && _c !== void 0 ? _c : 200,\n height: (_d = options.height) !== null && _d !== void 0 ? _d : 50,\n textColor: options.textColor,\n backgroundColor: options.backgroundColor,\n borderColor: options.borderColor,\n borderWidth: (_e = options.borderWidth) !== null && _e !== void 0 ? _e : 0,\n rotate: (_f = options.rotate) !== null && _f !== void 0 ? _f : degrees(0),\n hidden: options.hidden,\n page: page.ref,\n });\n var widgetRef = this.doc.context.register(widget.dict);\n // Add widget to this field\n this.acroField.addWidget(widgetRef);\n // Set appearance streams for widget\n var font = (_g = options.font) !== null && _g !== void 0 ? _g : this.doc.getForm().getDefaultFont();\n this.updateWidgetAppearance(widget, font);\n // Add widget to the given page\n page.node.addAnnot(widgetRef);\n };\n /**\n * Returns `true` if this text field has been marked as dirty, or if any of\n * this text field's widgets do not have an appearance stream. For example:\n * ```js\n * const textField = form.getTextField('some.text.field')\n * if (textField.needsAppearancesUpdate()) console.log('Needs update')\n * ```\n * @returns Whether or not this text field needs an appearance update.\n */\n PDFTextField.prototype.needsAppearancesUpdate = function () {\n var _a;\n if (this.isDirty())\n return true;\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var hasAppearances = ((_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal) instanceof PDFStream;\n if (!hasAppearances)\n return true;\n }\n return false;\n };\n /**\n * Update the appearance streams for each of this text field's widgets using\n * the default appearance provider for text fields. For example:\n * ```js\n * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const textField = form.getTextField('some.text.field')\n * textField.defaultUpdateAppearances(helvetica)\n * ```\n * @param font The font to be used for creating the appearance streams.\n */\n PDFTextField.prototype.defaultUpdateAppearances = function (font) {\n assertIs(font, 'font', [[PDFFont, 'PDFFont']]);\n this.updateAppearances(font);\n };\n /**\n * Update the appearance streams for each of this text field's widgets using\n * the given appearance provider. If no `provider` is passed, the default\n * appearance provider for text fields will be used. For example:\n * ```js\n * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const textField = form.getTextField('some.text.field')\n * textField.updateAppearances(helvetica, (field, widget, font) => {\n * ...\n * return drawTextField(...)\n * })\n * ```\n * @param font The font to be used for creating the appearance streams.\n * @param provider Optionally, the appearance provider to be used for\n * generating the contents of the appearance streams.\n */\n PDFTextField.prototype.updateAppearances = function (font, provider) {\n assertIs(font, 'font', [[PDFFont, 'PDFFont']]);\n assertOrUndefined(provider, 'provider', [Function]);\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n this.updateWidgetAppearance(widget, font, provider);\n }\n this.markAsClean();\n };\n PDFTextField.prototype.updateWidgetAppearance = function (widget, font, provider) {\n var apProvider = provider !== null && provider !== void 0 ? provider : defaultTextFieldAppearanceProvider;\n var appearances = normalizeAppearance(apProvider(this, widget, font));\n this.updateWidgetAppearanceWithFont(widget, font, appearances);\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFForm.getTextField]] method, which will create an\n * > instance of [[PDFTextField]] for you.\n *\n * Create an instance of [[PDFTextField]] from an existing acroText and ref\n *\n * @param acroText The underlying `PDFAcroText` for this text field.\n * @param ref The unique reference for this text field.\n * @param doc The document to which this text field will belong.\n */\n PDFTextField.of = function (acroText, ref, doc) {\n return new PDFTextField(acroText, ref, doc);\n };\n return PDFTextField;\n}(PDFField));\nexport default PDFTextField;\n//# sourceMappingURL=PDFTextField.js.map","import { __assign, __spreadArrays } from \"tslib\";\nimport PDFDocument from \"../PDFDocument\";\nimport PDFButton from \"./PDFButton\";\nimport PDFCheckBox from \"./PDFCheckBox\";\nimport PDFDropdown from \"./PDFDropdown\";\nimport PDFOptionList from \"./PDFOptionList\";\nimport PDFRadioGroup from \"./PDFRadioGroup\";\nimport PDFSignature from \"./PDFSignature\";\nimport PDFTextField from \"./PDFTextField\";\nimport { NoSuchFieldError, UnexpectedFieldTypeError, FieldAlreadyExistsError, InvalidFieldNamePartError, } from \"../errors\";\nimport PDFFont from \"../PDFFont\";\nimport { StandardFonts } from \"../StandardFonts\";\nimport { rotateInPlace } from \"../operations\";\nimport { drawObject, popGraphicsState, pushGraphicsState, translate, } from \"../operators\";\nimport { PDFAcroForm, PDFAcroCheckBox, PDFAcroComboBox, PDFAcroListBox, PDFAcroRadioButton, PDFAcroSignature, PDFAcroText, PDFAcroPushButton, PDFAcroNonTerminal, PDFDict, PDFRef, createPDFAcroFields, PDFName, } from \"../../core\";\nimport { assertIs, Cache, assertOrUndefined } from \"../../utils\";\n/**\n * Represents the interactive form of a [[PDFDocument]].\n *\n * Interactive forms (sometimes called _AcroForms_) are collections of fields\n * designed to gather information from a user. A PDF document may contains any\n * number of fields that appear on various pages, all of which make up a single,\n * global interactive form spanning the entire document. This means that\n * instances of [[PDFDocument]] shall contain at most one [[PDFForm]].\n *\n * The fields of an interactive form are represented by [[PDFField]] instances.\n */\nvar PDFForm = /** @class */ (function () {\n function PDFForm(acroForm, doc) {\n var _this = this;\n this.embedDefaultFont = function () {\n return _this.doc.embedStandardFont(StandardFonts.Helvetica);\n };\n assertIs(acroForm, 'acroForm', [[PDFAcroForm, 'PDFAcroForm']]);\n assertIs(doc, 'doc', [[PDFDocument, 'PDFDocument']]);\n this.acroForm = acroForm;\n this.doc = doc;\n this.dirtyFields = new Set();\n this.defaultFontCache = Cache.populatedBy(this.embedDefaultFont);\n }\n /**\n * Returns `true` if this [[PDFForm]] has XFA data. Most PDFs with form\n * fields do not use XFA as it is not widely supported by PDF readers.\n *\n * > `pdf-lib` does not support creation, modification, or reading of XFA\n * > fields.\n *\n * For example:\n * ```js\n * const form = pdfDoc.getForm()\n * if (form.hasXFA()) console.log('PDF has XFA data')\n * ```\n * @returns Whether or not this form has XFA data.\n */\n PDFForm.prototype.hasXFA = function () {\n return this.acroForm.dict.has(PDFName.of('XFA'));\n };\n /**\n * Disconnect the XFA data from this [[PDFForm]] (if any exists). This will\n * force readers to fallback to standard fields if the [[PDFDocument]]\n * contains any. For example:\n *\n * For example:\n * ```js\n * const form = pdfDoc.getForm()\n * form.deleteXFA()\n * ```\n */\n PDFForm.prototype.deleteXFA = function () {\n this.acroForm.dict.delete(PDFName.of('XFA'));\n };\n /**\n * Get all fields contained in this [[PDFForm]]. For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const fields = form.getFields()\n * fields.forEach(field => {\n * const type = field.constructor.name\n * const name = field.getName()\n * console.log(`${type}: ${name}`)\n * })\n * ```\n * @returns An array of all fields in this form.\n */\n PDFForm.prototype.getFields = function () {\n var allFields = this.acroForm.getAllFields();\n var fields = [];\n for (var idx = 0, len = allFields.length; idx < len; idx++) {\n var _a = allFields[idx], acroField = _a[0], ref = _a[1];\n var field = convertToPDFField(acroField, ref, this.doc);\n if (field)\n fields.push(field);\n }\n return fields;\n };\n /**\n * Get the field in this [[PDFForm]] with the given name. For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const field = form.getFieldMaybe('Page1.Foo.Bar[0]')\n * if (field) console.log('Field exists!')\n * ```\n * @param name A fully qualified field name.\n * @returns The field with the specified name, if one exists.\n */\n PDFForm.prototype.getFieldMaybe = function (name) {\n assertIs(name, 'name', ['string']);\n var fields = this.getFields();\n for (var idx = 0, len = fields.length; idx < len; idx++) {\n var field = fields[idx];\n if (field.getName() === name)\n return field;\n }\n return undefined;\n };\n /**\n * Get the field in this [[PDFForm]] with the given name. For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const field = form.getField('Page1.Foo.Bar[0]')\n * ```\n * If no field exists with the provided name, an error will be thrown.\n * @param name A fully qualified field name.\n * @returns The field with the specified name.\n */\n PDFForm.prototype.getField = function (name) {\n assertIs(name, 'name', ['string']);\n var field = this.getFieldMaybe(name);\n if (field)\n return field;\n throw new NoSuchFieldError(name);\n };\n /**\n * Get the button field in this [[PDFForm]] with the given name. For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const button = form.getButton('Page1.Foo.Button[0]')\n * ```\n * An error will be thrown if no field exists with the provided name, or if\n * the field exists but is not a button.\n * @param name A fully qualified button name.\n * @returns The button with the specified name.\n */\n PDFForm.prototype.getButton = function (name) {\n assertIs(name, 'name', ['string']);\n var field = this.getField(name);\n if (field instanceof PDFButton)\n return field;\n throw new UnexpectedFieldTypeError(name, PDFButton, field);\n };\n /**\n * Get the check box field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const checkBox = form.getCheckBox('Page1.Foo.CheckBox[0]')\n * checkBox.check()\n * ```\n * An error will be thrown if no field exists with the provided name, or if\n * the field exists but is not a check box.\n * @param name A fully qualified check box name.\n * @returns The check box with the specified name.\n */\n PDFForm.prototype.getCheckBox = function (name) {\n assertIs(name, 'name', ['string']);\n var field = this.getField(name);\n if (field instanceof PDFCheckBox)\n return field;\n throw new UnexpectedFieldTypeError(name, PDFCheckBox, field);\n };\n /**\n * Get the dropdown field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const dropdown = form.getDropdown('Page1.Foo.Dropdown[0]')\n * const options = dropdown.getOptions()\n * dropdown.select(options[0])\n * ```\n * An error will be thrown if no field exists with the provided name, or if\n * the field exists but is not a dropdown.\n * @param name A fully qualified dropdown name.\n * @returns The dropdown with the specified name.\n */\n PDFForm.prototype.getDropdown = function (name) {\n assertIs(name, 'name', ['string']);\n var field = this.getField(name);\n if (field instanceof PDFDropdown)\n return field;\n throw new UnexpectedFieldTypeError(name, PDFDropdown, field);\n };\n /**\n * Get the option list field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const optionList = form.getOptionList('Page1.Foo.OptionList[0]')\n * const options = optionList.getOptions()\n * optionList.select(options[0])\n * ```\n * An error will be thrown if no field exists with the provided name, or if\n * the field exists but is not an option list.\n * @param name A fully qualified option list name.\n * @returns The option list with the specified name.\n */\n PDFForm.prototype.getOptionList = function (name) {\n assertIs(name, 'name', ['string']);\n var field = this.getField(name);\n if (field instanceof PDFOptionList)\n return field;\n throw new UnexpectedFieldTypeError(name, PDFOptionList, field);\n };\n /**\n * Get the radio group field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const radioGroup = form.getRadioGroup('Page1.Foo.RadioGroup[0]')\n * const options = radioGroup.getOptions()\n * radioGroup.select(options[0])\n * ```\n * An error will be thrown if no field exists with the provided name, or if\n * the field exists but is not a radio group.\n * @param name A fully qualified radio group name.\n * @returns The radio group with the specified name.\n */\n PDFForm.prototype.getRadioGroup = function (name) {\n assertIs(name, 'name', ['string']);\n var field = this.getField(name);\n if (field instanceof PDFRadioGroup)\n return field;\n throw new UnexpectedFieldTypeError(name, PDFRadioGroup, field);\n };\n /**\n * Get the signature field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const signature = form.getSignature('Page1.Foo.Signature[0]')\n * ```\n * An error will be thrown if no field exists with the provided name, or if\n * the field exists but is not a signature.\n * @param name A fully qualified signature name.\n * @returns The signature with the specified name.\n */\n PDFForm.prototype.getSignature = function (name) {\n assertIs(name, 'name', ['string']);\n var field = this.getField(name);\n if (field instanceof PDFSignature)\n return field;\n throw new UnexpectedFieldTypeError(name, PDFSignature, field);\n };\n /**\n * Get the text field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const textField = form.getTextField('Page1.Foo.TextField[0]')\n * textField.setText('Are you designed to act or to be acted upon?')\n * ```\n * An error will be thrown if no field exists with the provided name, or if\n * the field exists but is not a text field.\n * @param name A fully qualified text field name.\n * @returns The text field with the specified name.\n */\n PDFForm.prototype.getTextField = function (name) {\n assertIs(name, 'name', ['string']);\n var field = this.getField(name);\n if (field instanceof PDFTextField)\n return field;\n throw new UnexpectedFieldTypeError(name, PDFTextField, field);\n };\n /**\n * Create a new button field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const font = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const button = form.createButton('cool.new.button')\n *\n * button.addToPage('Do Stuff', font, page)\n * ```\n * An error will be thrown if a field already exists with the provided name.\n * @param name The fully qualified name for the new button.\n * @returns The new button field.\n */\n PDFForm.prototype.createButton = function (name) {\n assertIs(name, 'name', ['string']);\n var nameParts = splitFieldName(name);\n var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal);\n var button = PDFAcroPushButton.create(this.doc.context);\n button.setPartialName(nameParts.terminal);\n addFieldToParent(parent, [button, button.ref], nameParts.terminal);\n return PDFButton.of(button, button.ref, this.doc);\n };\n /**\n * Create a new check box field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const font = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const checkBox = form.createCheckBox('cool.new.checkBox')\n *\n * checkBox.addToPage(page)\n * ```\n * An error will be thrown if a field already exists with the provided name.\n * @param name The fully qualified name for the new check box.\n * @returns The new check box field.\n */\n PDFForm.prototype.createCheckBox = function (name) {\n assertIs(name, 'name', ['string']);\n var nameParts = splitFieldName(name);\n var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal);\n var checkBox = PDFAcroCheckBox.create(this.doc.context);\n checkBox.setPartialName(nameParts.terminal);\n addFieldToParent(parent, [checkBox, checkBox.ref], nameParts.terminal);\n return PDFCheckBox.of(checkBox, checkBox.ref, this.doc);\n };\n /**\n * Create a new dropdown field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const font = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const dropdown = form.createDropdown('cool.new.dropdown')\n *\n * dropdown.addToPage(font, page)\n * ```\n * An error will be thrown if a field already exists with the provided name.\n * @param name The fully qualified name for the new dropdown.\n * @returns The new dropdown field.\n */\n PDFForm.prototype.createDropdown = function (name) {\n assertIs(name, 'name', ['string']);\n var nameParts = splitFieldName(name);\n var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal);\n var comboBox = PDFAcroComboBox.create(this.doc.context);\n comboBox.setPartialName(nameParts.terminal);\n addFieldToParent(parent, [comboBox, comboBox.ref], nameParts.terminal);\n return PDFDropdown.of(comboBox, comboBox.ref, this.doc);\n };\n /**\n * Create a new option list field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const font = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const optionList = form.createOptionList('cool.new.optionList')\n *\n * optionList.addToPage(font, page)\n * ```\n * An error will be thrown if a field already exists with the provided name.\n * @param name The fully qualified name for the new option list.\n * @returns The new option list field.\n */\n PDFForm.prototype.createOptionList = function (name) {\n assertIs(name, 'name', ['string']);\n var nameParts = splitFieldName(name);\n var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal);\n var listBox = PDFAcroListBox.create(this.doc.context);\n listBox.setPartialName(nameParts.terminal);\n addFieldToParent(parent, [listBox, listBox.ref], nameParts.terminal);\n return PDFOptionList.of(listBox, listBox.ref, this.doc);\n };\n /**\n * Create a new radio group field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const font = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const radioGroup = form.createRadioGroup('cool.new.radioGroup')\n *\n * radioGroup.addOptionToPage('is-dog', page, { y: 0 })\n * radioGroup.addOptionToPage('is-cat', page, { y: 75 })\n * ```\n * An error will be thrown if a field already exists with the provided name.\n * @param name The fully qualified name for the new radio group.\n * @returns The new radio group field.\n */\n PDFForm.prototype.createRadioGroup = function (name) {\n assertIs(name, 'name', ['string']);\n var nameParts = splitFieldName(name);\n var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal);\n var radioButton = PDFAcroRadioButton.create(this.doc.context);\n radioButton.setPartialName(nameParts.terminal);\n addFieldToParent(parent, [radioButton, radioButton.ref], nameParts.terminal);\n return PDFRadioGroup.of(radioButton, radioButton.ref, this.doc);\n };\n /**\n * Create a new text field in this [[PDFForm]] with the given name.\n * For example:\n * ```js\n * const font = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const textField = form.createTextField('cool.new.textField')\n *\n * textField.addToPage(font, page)\n * ```\n * An error will be thrown if a field already exists with the provided name.\n * @param name The fully qualified name for the new radio group.\n * @returns The new radio group field.\n */\n PDFForm.prototype.createTextField = function (name) {\n assertIs(name, 'name', ['string']);\n var nameParts = splitFieldName(name);\n var parent = this.findOrCreateNonTerminals(nameParts.nonTerminal);\n var text = PDFAcroText.create(this.doc.context);\n text.setPartialName(nameParts.terminal);\n addFieldToParent(parent, [text, text.ref], nameParts.terminal);\n return PDFTextField.of(text, text.ref, this.doc);\n };\n /**\n * Flatten all fields in this [[PDFForm]].\n *\n * Flattening a form field will take the current appearance for each of that\n * field's widgets and make them part of their page's content stream. All form\n * fields and annotations associated are then removed. Note that once a form\n * has been flattened its fields can no longer be accessed or edited.\n *\n * This operation is often used after filling form fields to ensure a\n * consistent appearance across different PDF readers and/or printers.\n * Another common use case is to copy a template document with form fields\n * into another document. In this scenario you would load the template\n * document, fill its fields, flatten it, and then copy its pages into the\n * recipient document - the filled fields will be copied over.\n *\n * For example:\n * ```js\n * const form = pdfDoc.getForm();\n * form.flatten();\n * ```\n */\n PDFForm.prototype.flatten = function (options) {\n if (options === void 0) { options = { updateFieldAppearances: true }; }\n if (options.updateFieldAppearances) {\n this.updateFieldAppearances();\n }\n var fields = this.getFields();\n for (var i = 0, lenFields = fields.length; i < lenFields; i++) {\n var field = fields[i];\n var widgets = field.acroField.getWidgets();\n for (var j = 0, lenWidgets = widgets.length; j < lenWidgets; j++) {\n var widget = widgets[j];\n var page = this.findWidgetPage(widget);\n var widgetRef = this.findWidgetAppearanceRef(field, widget);\n var xObjectKey = page.node.newXObject('FlatWidget', widgetRef);\n var rectangle = widget.getRectangle();\n var operators = __spreadArrays([\n pushGraphicsState(),\n translate(rectangle.x, rectangle.y)\n ], rotateInPlace(__assign(__assign({}, rectangle), { rotation: 0 })), [\n drawObject(xObjectKey),\n popGraphicsState(),\n ]).filter(Boolean);\n page.pushOperators.apply(page, operators);\n }\n this.removeField(field);\n }\n };\n /**\n * Remove a field from this [[PDFForm]].\n *\n * For example:\n * ```js\n * const form = pdfDoc.getForm();\n * const ageField = form.getFields().find(x => x.getName() === 'Age');\n * form.removeField(ageField);\n * ```\n */\n PDFForm.prototype.removeField = function (field) {\n var widgets = field.acroField.getWidgets();\n var pages = new Set();\n for (var i = 0, len = widgets.length; i < len; i++) {\n var widget = widgets[i];\n var widgetRef = this.findWidgetAppearanceRef(field, widget);\n var page = this.findWidgetPage(widget);\n pages.add(page);\n page.node.removeAnnot(widgetRef);\n }\n pages.forEach(function (page) { return page.node.removeAnnot(field.ref); });\n this.acroForm.removeField(field.acroField);\n var fieldKids = field.acroField.normalizedEntries().Kids;\n var kidsCount = fieldKids.size();\n for (var childIndex = 0; childIndex < kidsCount; childIndex++) {\n var child = fieldKids.get(childIndex);\n if (child instanceof PDFRef) {\n this.doc.context.delete(child);\n }\n }\n this.doc.context.delete(field.ref);\n };\n /**\n * Update the appearance streams for all widgets of all fields in this\n * [[PDFForm]]. Appearance streams will only be created for a widget if it\n * does not have any existing appearance streams, or the field's value has\n * changed (e.g. by calling [[PDFTextField.setText]] or\n * [[PDFDropdown.select]]).\n *\n * For example:\n * ```js\n * const courier = await pdfDoc.embedFont(StandardFonts.Courier)\n * const form = pdfDoc.getForm()\n * form.updateFieldAppearances(courier)\n * ```\n *\n * **IMPORTANT:** The default value for the `font` parameter is\n * [[StandardFonts.Helvetica]]. Note that this is a WinAnsi font. This means\n * that encoding errors will be thrown if any fields contain text with\n * characters outside the WinAnsi character set (the latin alphabet).\n *\n * Embedding a custom font and passing that as the `font`\n * parameter allows you to generate appearance streams with non WinAnsi\n * characters (assuming your custom font supports them).\n *\n * > **NOTE:** The [[PDFDocument.save]] method will call this method to\n * > update appearances automatically if a form was accessed via the\n * > [[PDFDocument.getForm]] method prior to saving.\n *\n * @param font Optionally, the font to use when creating new appearances.\n */\n PDFForm.prototype.updateFieldAppearances = function (font) {\n assertOrUndefined(font, 'font', [[PDFFont, 'PDFFont']]);\n font = font !== null && font !== void 0 ? font : this.getDefaultFont();\n var fields = this.getFields();\n for (var idx = 0, len = fields.length; idx < len; idx++) {\n var field = fields[idx];\n if (field.needsAppearancesUpdate()) {\n field.defaultUpdateAppearances(font);\n }\n }\n };\n /**\n * Mark a field as dirty. This will cause its appearance streams to be\n * updated by [[PDFForm.updateFieldAppearances]].\n * ```js\n * const form = pdfDoc.getForm()\n * const field = form.getField('foo.bar')\n * form.markFieldAsDirty(field.ref)\n * ```\n * @param fieldRef The reference to the field that should be marked.\n */\n PDFForm.prototype.markFieldAsDirty = function (fieldRef) {\n assertOrUndefined(fieldRef, 'fieldRef', [[PDFRef, 'PDFRef']]);\n this.dirtyFields.add(fieldRef);\n };\n /**\n * Mark a field as dirty. This will cause its appearance streams to not be\n * updated by [[PDFForm.updateFieldAppearances]].\n * ```js\n * const form = pdfDoc.getForm()\n * const field = form.getField('foo.bar')\n * form.markFieldAsClean(field.ref)\n * ```\n * @param fieldRef The reference to the field that should be marked.\n */\n PDFForm.prototype.markFieldAsClean = function (fieldRef) {\n assertOrUndefined(fieldRef, 'fieldRef', [[PDFRef, 'PDFRef']]);\n this.dirtyFields.delete(fieldRef);\n };\n /**\n * Returns `true` is the specified field has been marked as dirty.\n * ```js\n * const form = pdfDoc.getForm()\n * const field = form.getField('foo.bar')\n * if (form.fieldIsDirty(field.ref)) console.log('Field is dirty')\n * ```\n * @param fieldRef The reference to the field that should be checked.\n * @returns Whether or not the specified field is dirty.\n */\n PDFForm.prototype.fieldIsDirty = function (fieldRef) {\n assertOrUndefined(fieldRef, 'fieldRef', [[PDFRef, 'PDFRef']]);\n return this.dirtyFields.has(fieldRef);\n };\n PDFForm.prototype.getDefaultFont = function () {\n return this.defaultFontCache.access();\n };\n PDFForm.prototype.findWidgetPage = function (widget) {\n var pageRef = widget.P();\n var page = this.doc.getPages().find(function (x) { return x.ref === pageRef; });\n if (page === undefined) {\n var widgetRef = this.doc.context.getObjectRef(widget.dict);\n if (widgetRef === undefined) {\n throw new Error('Could not find PDFRef for PDFObject');\n }\n page = this.doc.findPageForAnnotationRef(widgetRef);\n if (page === undefined) {\n throw new Error(\"Could not find page for PDFRef \" + widgetRef);\n }\n }\n return page;\n };\n PDFForm.prototype.findWidgetAppearanceRef = function (field, widget) {\n var _a;\n var refOrDict = widget.getNormalAppearance();\n if (refOrDict instanceof PDFDict &&\n (field instanceof PDFCheckBox || field instanceof PDFRadioGroup)) {\n var value = field.acroField.getValue();\n var ref = (_a = refOrDict.get(value)) !== null && _a !== void 0 ? _a : refOrDict.get(PDFName.of('Off'));\n if (ref instanceof PDFRef) {\n refOrDict = ref;\n }\n }\n if (!(refOrDict instanceof PDFRef)) {\n var name_1 = field.getName();\n throw new Error(\"Failed to extract appearance ref for: \" + name_1);\n }\n return refOrDict;\n };\n PDFForm.prototype.findOrCreateNonTerminals = function (partialNames) {\n var nonTerminal = [\n this.acroForm,\n ];\n for (var idx = 0, len = partialNames.length; idx < len; idx++) {\n var namePart = partialNames[idx];\n if (!namePart)\n throw new InvalidFieldNamePartError(namePart);\n var parent_1 = nonTerminal[0], parentRef = nonTerminal[1];\n var res = this.findNonTerminal(namePart, parent_1);\n if (res) {\n nonTerminal = res;\n }\n else {\n var node = PDFAcroNonTerminal.create(this.doc.context);\n node.setPartialName(namePart);\n node.setParent(parentRef);\n var nodeRef = this.doc.context.register(node.dict);\n parent_1.addField(nodeRef);\n nonTerminal = [node, nodeRef];\n }\n }\n return nonTerminal;\n };\n PDFForm.prototype.findNonTerminal = function (partialName, parent) {\n var fields = parent instanceof PDFAcroForm\n ? this.acroForm.getFields()\n : createPDFAcroFields(parent.Kids());\n for (var idx = 0, len = fields.length; idx < len; idx++) {\n var _a = fields[idx], field = _a[0], ref = _a[1];\n if (field.getPartialName() === partialName) {\n if (field instanceof PDFAcroNonTerminal)\n return [field, ref];\n throw new FieldAlreadyExistsError(partialName);\n }\n }\n return undefined;\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFDocument.getForm]] method, which will create an\n * > instance of [[PDFForm]] for you.\n *\n * Create an instance of [[PDFForm]] from an existing acroForm and embedder\n *\n * @param acroForm The underlying `PDFAcroForm` for this form.\n * @param doc The document to which the form will belong.\n */\n PDFForm.of = function (acroForm, doc) {\n return new PDFForm(acroForm, doc);\n };\n return PDFForm;\n}());\nexport default PDFForm;\nvar convertToPDFField = function (field, ref, doc) {\n if (field instanceof PDFAcroPushButton)\n return PDFButton.of(field, ref, doc);\n if (field instanceof PDFAcroCheckBox)\n return PDFCheckBox.of(field, ref, doc);\n if (field instanceof PDFAcroComboBox)\n return PDFDropdown.of(field, ref, doc);\n if (field instanceof PDFAcroListBox)\n return PDFOptionList.of(field, ref, doc);\n if (field instanceof PDFAcroText)\n return PDFTextField.of(field, ref, doc);\n if (field instanceof PDFAcroRadioButton) {\n return PDFRadioGroup.of(field, ref, doc);\n }\n if (field instanceof PDFAcroSignature) {\n return PDFSignature.of(field, ref, doc);\n }\n return undefined;\n};\nvar splitFieldName = function (fullyQualifiedName) {\n if (fullyQualifiedName.length === 0) {\n throw new Error('PDF field names must not be empty strings');\n }\n var parts = fullyQualifiedName.split('.');\n for (var idx = 0, len = parts.length; idx < len; idx++) {\n if (parts[idx] === '') {\n throw new Error(\"Periods in PDF field names must be separated by at least one character: \\\"\" + fullyQualifiedName + \"\\\"\");\n }\n }\n if (parts.length === 1)\n return { nonTerminal: [], terminal: parts[0] };\n return {\n nonTerminal: parts.slice(0, parts.length - 1),\n terminal: parts[parts.length - 1],\n };\n};\nvar addFieldToParent = function (_a, _b, partialName) {\n var parent = _a[0], parentRef = _a[1];\n var field = _b[0], fieldRef = _b[1];\n var entries = parent.normalizedEntries();\n var fields = createPDFAcroFields('Kids' in entries ? entries.Kids : entries.Fields);\n for (var idx = 0, len = fields.length; idx < len; idx++) {\n if (fields[idx][0].getPartialName() === partialName) {\n throw new FieldAlreadyExistsError(partialName);\n }\n }\n parent.addField(fieldRef);\n field.setParent(parentRef);\n};\n//# sourceMappingURL=PDFForm.js.map","export var PageSizes = {\n '4A0': [4767.87, 6740.79],\n '2A0': [3370.39, 4767.87],\n A0: [2383.94, 3370.39],\n A1: [1683.78, 2383.94],\n A2: [1190.55, 1683.78],\n A3: [841.89, 1190.55],\n A4: [595.28, 841.89],\n A5: [419.53, 595.28],\n A6: [297.64, 419.53],\n A7: [209.76, 297.64],\n A8: [147.4, 209.76],\n A9: [104.88, 147.4],\n A10: [73.7, 104.88],\n B0: [2834.65, 4008.19],\n B1: [2004.09, 2834.65],\n B2: [1417.32, 2004.09],\n B3: [1000.63, 1417.32],\n B4: [708.66, 1000.63],\n B5: [498.9, 708.66],\n B6: [354.33, 498.9],\n B7: [249.45, 354.33],\n B8: [175.75, 249.45],\n B9: [124.72, 175.75],\n B10: [87.87, 124.72],\n C0: [2599.37, 3676.54],\n C1: [1836.85, 2599.37],\n C2: [1298.27, 1836.85],\n C3: [918.43, 1298.27],\n C4: [649.13, 918.43],\n C5: [459.21, 649.13],\n C6: [323.15, 459.21],\n C7: [229.61, 323.15],\n C8: [161.57, 229.61],\n C9: [113.39, 161.57],\n C10: [79.37, 113.39],\n RA0: [2437.8, 3458.27],\n RA1: [1729.13, 2437.8],\n RA2: [1218.9, 1729.13],\n RA3: [864.57, 1218.9],\n RA4: [609.45, 864.57],\n SRA0: [2551.18, 3628.35],\n SRA1: [1814.17, 2551.18],\n SRA2: [1275.59, 1814.17],\n SRA3: [907.09, 1275.59],\n SRA4: [637.8, 907.09],\n Executive: [521.86, 756.0],\n Folio: [612.0, 936.0],\n Legal: [612.0, 1008.0],\n Letter: [612.0, 792.0],\n Tabloid: [792.0, 1224.0],\n};\n//# sourceMappingURL=sizes.js.map","import { __awaiter, __generator } from \"tslib\";\nimport { PDFName, PDFArray, PDFDict, PDFHexString } from \"../core\";\n/**\n * Represents a file that has been embedded in a [[PDFDocument]].\n */\nvar PDFEmbeddedFile = /** @class */ (function () {\n function PDFEmbeddedFile(ref, doc, embedder) {\n this.alreadyEmbedded = false;\n this.ref = ref;\n this.doc = doc;\n this.embedder = embedder;\n }\n /**\n * > **NOTE:** You probably don't need to call this method directly. The\n * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will\n * > automatically ensure all embeddable files get embedded.\n *\n * Embed this embeddable file in its document.\n *\n * @returns Resolves when the embedding is complete.\n */\n PDFEmbeddedFile.prototype.embed = function () {\n return __awaiter(this, void 0, void 0, function () {\n var ref, Names, EmbeddedFiles, EFNames, AF;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!this.alreadyEmbedded) return [3 /*break*/, 2];\n return [4 /*yield*/, this.embedder.embedIntoContext(this.doc.context, this.ref)];\n case 1:\n ref = _a.sent();\n if (!this.doc.catalog.has(PDFName.of('Names'))) {\n this.doc.catalog.set(PDFName.of('Names'), this.doc.context.obj({}));\n }\n Names = this.doc.catalog.lookup(PDFName.of('Names'), PDFDict);\n if (!Names.has(PDFName.of('EmbeddedFiles'))) {\n Names.set(PDFName.of('EmbeddedFiles'), this.doc.context.obj({}));\n }\n EmbeddedFiles = Names.lookup(PDFName.of('EmbeddedFiles'), PDFDict);\n if (!EmbeddedFiles.has(PDFName.of('Names'))) {\n EmbeddedFiles.set(PDFName.of('Names'), this.doc.context.obj([]));\n }\n EFNames = EmbeddedFiles.lookup(PDFName.of('Names'), PDFArray);\n EFNames.push(PDFHexString.fromText(this.embedder.fileName));\n EFNames.push(ref);\n /**\n * The AF-Tag is needed to achieve PDF-A3 compliance for embedded files\n *\n * The following document outlines the uses cases of the associated files (AF) tag.\n * See:\n * https://www.pdfa.org/wp-content/uploads/2018/10/PDF20_AN002-AF.pdf\n */\n if (!this.doc.catalog.has(PDFName.of('AF'))) {\n this.doc.catalog.set(PDFName.of('AF'), this.doc.context.obj([]));\n }\n AF = this.doc.catalog.lookup(PDFName.of('AF'), PDFArray);\n AF.push(ref);\n this.alreadyEmbedded = true;\n _a.label = 2;\n case 2: return [2 /*return*/];\n }\n });\n });\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFDocument.attach]] method, which will create\n * instances of [[PDFEmbeddedFile]] for you.\n *\n * Create an instance of [[PDFEmbeddedFile]] from an existing ref and embedder\n *\n * @param ref The unique reference for this file.\n * @param doc The document to which the file will belong.\n * @param embedder The embedder that will be used to embed the file.\n */\n PDFEmbeddedFile.of = function (ref, doc, embedder) {\n return new PDFEmbeddedFile(ref, doc, embedder);\n };\n return PDFEmbeddedFile;\n}());\nexport default PDFEmbeddedFile;\n//# sourceMappingURL=PDFEmbeddedFile.js.map","import { __awaiter, __generator } from \"tslib\";\nimport { PDFName, PDFArray, PDFDict, PDFHexString } from \"../core\";\n/**\n * Represents JavaScript that has been embedded in a [[PDFDocument]].\n */\nvar PDFJavaScript = /** @class */ (function () {\n function PDFJavaScript(ref, doc, embedder) {\n this.alreadyEmbedded = false;\n this.ref = ref;\n this.doc = doc;\n this.embedder = embedder;\n }\n /**\n * > **NOTE:** You probably don't need to call this method directly. The\n * > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will\n * > automatically ensure all JavaScripts get embedded.\n *\n * Embed this JavaScript in its document.\n *\n * @returns Resolves when the embedding is complete.\n */\n PDFJavaScript.prototype.embed = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _a, catalog, context, ref, Names, Javascript, JSNames;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!!this.alreadyEmbedded) return [3 /*break*/, 2];\n _a = this.doc, catalog = _a.catalog, context = _a.context;\n return [4 /*yield*/, this.embedder.embedIntoContext(this.doc.context, this.ref)];\n case 1:\n ref = _b.sent();\n if (!catalog.has(PDFName.of('Names'))) {\n catalog.set(PDFName.of('Names'), context.obj({}));\n }\n Names = catalog.lookup(PDFName.of('Names'), PDFDict);\n if (!Names.has(PDFName.of('JavaScript'))) {\n Names.set(PDFName.of('JavaScript'), context.obj({}));\n }\n Javascript = Names.lookup(PDFName.of('JavaScript'), PDFDict);\n if (!Javascript.has(PDFName.of('Names'))) {\n Javascript.set(PDFName.of('Names'), context.obj([]));\n }\n JSNames = Javascript.lookup(PDFName.of('Names'), PDFArray);\n JSNames.push(PDFHexString.fromText(this.embedder.scriptName));\n JSNames.push(ref);\n this.alreadyEmbedded = true;\n _b.label = 2;\n case 2: return [2 /*return*/];\n }\n });\n });\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFDocument.addJavaScript]] method, which will\n * create instances of [[PDFJavaScript]] for you.\n *\n * Create an instance of [[PDFJavaScript]] from an existing ref and script\n *\n * @param ref The unique reference for this script.\n * @param doc The document to which the script will belong.\n * @param embedder The embedder that will be used to embed the script.\n */\n PDFJavaScript.of = function (ref, doc, embedder) {\n return new PDFJavaScript(ref, doc, embedder);\n };\n return PDFJavaScript;\n}());\nexport default PDFJavaScript;\n//# sourceMappingURL=PDFJavaScript.js.map","import { __awaiter, __generator } from \"tslib\";\nimport PDFHexString from \"../objects/PDFHexString\";\nvar JavaScriptEmbedder = /** @class */ (function () {\n function JavaScriptEmbedder(script, scriptName) {\n this.script = script;\n this.scriptName = scriptName;\n }\n JavaScriptEmbedder.for = function (script, scriptName) {\n return new JavaScriptEmbedder(script, scriptName);\n };\n JavaScriptEmbedder.prototype.embedIntoContext = function (context, ref) {\n return __awaiter(this, void 0, void 0, function () {\n var jsActionDict;\n return __generator(this, function (_a) {\n jsActionDict = context.obj({\n Type: 'Action',\n S: 'JavaScript',\n JS: PDFHexString.fromText(this.script),\n });\n if (ref) {\n context.assign(ref, jsActionDict);\n return [2 /*return*/, ref];\n }\n else {\n return [2 /*return*/, context.register(jsActionDict)];\n }\n return [2 /*return*/];\n });\n });\n };\n return JavaScriptEmbedder;\n}());\nexport default JavaScriptEmbedder;\n//# sourceMappingURL=JavaScriptEmbedder.js.map","import { __awaiter, __generator, __rest } from \"tslib\";\nimport { EncryptedPDFError, FontkitNotRegisteredError, ForeignPageError, RemovePageFromEmptyDocumentError, } from \"./errors\";\nimport PDFEmbeddedPage from \"./PDFEmbeddedPage\";\nimport PDFFont from \"./PDFFont\";\nimport PDFImage from \"./PDFImage\";\nimport PDFPage from \"./PDFPage\";\nimport PDFForm from \"./form/PDFForm\";\nimport { PageSizes } from \"./sizes\";\nimport { CustomFontEmbedder, CustomFontSubsetEmbedder, JpegEmbedder, PageEmbeddingMismatchedContextError, PDFCatalog, PDFContext, PDFDict, PDFHexString, PDFName, PDFObjectCopier, PDFPageEmbedder, PDFPageLeaf, PDFPageTree, PDFParser, PDFStreamWriter, PDFString, PDFWriter, PngEmbedder, StandardFontEmbedder, UnexpectedObjectTypeError, } from \"../core\";\nimport { ParseSpeeds, } from \"./PDFDocumentOptions\";\nimport { assertIs, assertIsOneOfOrUndefined, assertOrUndefined, assertRange, Cache, canBeConvertedToUint8Array, encodeToBase64, isStandardFont, pluckIndices, range, toUint8Array, } from \"../utils\";\nimport FileEmbedder, { AFRelationship } from \"../core/embedders/FileEmbedder\";\nimport PDFEmbeddedFile from \"./PDFEmbeddedFile\";\nimport PDFJavaScript from \"./PDFJavaScript\";\nimport JavaScriptEmbedder from \"../core/embedders/JavaScriptEmbedder\";\n/**\n * Represents a PDF document.\n */\nvar PDFDocument = /** @class */ (function () {\n function PDFDocument(context, ignoreEncryption, updateMetadata) {\n var _this = this;\n /** The default word breaks used in PDFPage.drawText */\n this.defaultWordBreaks = [' '];\n this.computePages = function () {\n var pages = [];\n _this.catalog.Pages().traverse(function (node, ref) {\n if (node instanceof PDFPageLeaf) {\n var page = _this.pageMap.get(node);\n if (!page) {\n page = PDFPage.of(node, ref, _this);\n _this.pageMap.set(node, page);\n }\n pages.push(page);\n }\n });\n return pages;\n };\n this.getOrCreateForm = function () {\n var acroForm = _this.catalog.getOrCreateAcroForm();\n return PDFForm.of(acroForm, _this);\n };\n assertIs(context, 'context', [[PDFContext, 'PDFContext']]);\n assertIs(ignoreEncryption, 'ignoreEncryption', ['boolean']);\n this.context = context;\n this.catalog = context.lookup(context.trailerInfo.Root);\n this.isEncrypted = !!context.lookup(context.trailerInfo.Encrypt);\n this.pageCache = Cache.populatedBy(this.computePages);\n this.pageMap = new Map();\n this.formCache = Cache.populatedBy(this.getOrCreateForm);\n this.fonts = [];\n this.images = [];\n this.embeddedPages = [];\n this.embeddedFiles = [];\n this.javaScripts = [];\n if (!ignoreEncryption && this.isEncrypted)\n throw new EncryptedPDFError();\n if (updateMetadata)\n this.updateInfoDict();\n }\n /**\n * Load an existing [[PDFDocument]]. The input data can be provided in\n * multiple formats:\n *\n * | Type | Contents |\n * | ------------- | ------------------------------------------------------ |\n * | `string` | A base64 encoded string (or data URI) containing a PDF |\n * | `Uint8Array` | The raw bytes of a PDF |\n * | `ArrayBuffer` | The raw bytes of a PDF |\n *\n * For example:\n * ```js\n * import { PDFDocument } from 'pdf-lib'\n *\n * // pdf=string\n * const base64 =\n * 'JVBERi0xLjcKJYGBgYEKCjUgMCBvYmoKPDwKL0ZpbHRlciAvRmxhdGVEZWNvZGUKL0xlbm' +\n * 'd0aCAxMDQKPj4Kc3RyZWFtCniccwrhMlAAwaJ0Ln2P1Jyy1JLM5ERdc0MjCwUjE4WQNC4Q' +\n * '6cNlCFZkqGCqYGSqEJLLZWNuYGZiZmbkYuZsZmlmZGRgZmluDCQNzc3NTM2NzdzMXMxMjQ' +\n * 'ztFEKyuEK0uFxDuAAOERdVCmVuZHN0cmVhbQplbmRvYmoKCjYgMCBvYmoKPDwKL0ZpbHRl' +\n * 'ciAvRmxhdGVEZWNvZGUKL1R5cGUgL09ialN0bQovTiA0Ci9GaXJzdCAyMAovTGVuZ3RoID' +\n * 'IxNQo+PgpzdHJlYW0KeJxVj9GqwjAMhu/zFHkBzTo3nCCCiiKIHPEICuJF3cKoSCu2E8/b' +\n * '20wPIr1p8v9/8kVhgilmGfawX2CGaVrgcAi0/bsy0lrX7IGWpvJ4iJYEN3gEmrrGBlQwGs' +\n * 'HHO9VBX1wNrxAqMX87RBD5xpJuddqwd82tjAHxzV1U5LPgy52DKXWnr1Lheg+j/c/pzGVr' +\n * 'iqV0VlwZPXGPCJjElw/ybkwUmeoWgxesDXGhHJC/D/iikp1Av80ptKU0FdBEe25pPihAM1' +\n * 'u6ytgaaWfs2Hrz35CJT1+EWmAKZW5kc3RyZWFtCmVuZG9iagoKNyAwIG9iago8PAovU2l6' +\n * 'ZSA4Ci9Sb290IDIgMCBSCi9GaWx0ZXIgL0ZsYXRlRGVjb2RlCi9UeXBlIC9YUmVmCi9MZW' +\n * '5ndGggMzgKL1cgWyAxIDIgMiBdCi9JbmRleCBbIDAgOCBdCj4+CnN0cmVhbQp4nBXEwREA' +\n * 'EBAEsCwz3vrvRmOOyyOoGhZdutHN2MT55fIAVocD+AplbmRzdHJlYW0KZW5kb2JqCgpzdG' +\n * 'FydHhyZWYKNTEwCiUlRU9G'\n *\n * const dataUri = 'data:application/pdf;base64,' + base64\n *\n * const pdfDoc1 = await PDFDocument.load(base64)\n * const pdfDoc2 = await PDFDocument.load(dataUri)\n *\n * // pdf=Uint8Array\n * import fs from 'fs'\n * const uint8Array = fs.readFileSync('with_update_sections.pdf')\n * const pdfDoc3 = await PDFDocument.load(uint8Array)\n *\n * // pdf=ArrayBuffer\n * const url = 'https://pdf-lib.js.org/assets/with_update_sections.pdf'\n * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer())\n * const pdfDoc4 = await PDFDocument.load(arrayBuffer)\n *\n * ```\n *\n * @param pdf The input data containing a PDF document.\n * @param options The options to be used when loading the document.\n * @returns Resolves with a document loaded from the input.\n */\n PDFDocument.load = function (pdf, options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var _a, ignoreEncryption, _b, parseSpeed, _c, throwOnInvalidObject, _d, updateMetadata, _e, capNumbers, bytes, context;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n _a = options.ignoreEncryption, ignoreEncryption = _a === void 0 ? false : _a, _b = options.parseSpeed, parseSpeed = _b === void 0 ? 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;\n assertIs(pdf, 'pdf', ['string', Uint8Array, ArrayBuffer]);\n assertIs(ignoreEncryption, 'ignoreEncryption', ['boolean']);\n assertIs(parseSpeed, 'parseSpeed', ['number']);\n assertIs(throwOnInvalidObject, 'throwOnInvalidObject', ['boolean']);\n bytes = toUint8Array(pdf);\n return [4 /*yield*/, PDFParser.forBytesWithOptions(bytes, parseSpeed, throwOnInvalidObject, capNumbers).parseDocument()];\n case 1:\n context = _f.sent();\n return [2 /*return*/, new PDFDocument(context, ignoreEncryption, updateMetadata)];\n }\n });\n });\n };\n /**\n * Create a new [[PDFDocument]].\n * @returns Resolves with the newly created document.\n */\n PDFDocument.create = function (options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var _a, updateMetadata, context, pageTree, pageTreeRef, catalog;\n return __generator(this, function (_b) {\n _a = options.updateMetadata, updateMetadata = _a === void 0 ? true : _a;\n context = PDFContext.create();\n pageTree = PDFPageTree.withContext(context);\n pageTreeRef = context.register(pageTree);\n catalog = PDFCatalog.withContextAndPages(context, pageTreeRef);\n context.trailerInfo.Root = context.register(catalog);\n return [2 /*return*/, new PDFDocument(context, false, updateMetadata)];\n });\n });\n };\n /**\n * Register a fontkit instance. This must be done before custom fonts can\n * be embedded. See [here](https://github.com/Hopding/pdf-lib/tree/master#fontkit-installation)\n * for instructions on how to install and register a fontkit instance.\n *\n * > You do **not** need to call this method to embed standard fonts.\n *\n * For example:\n * ```js\n * import { PDFDocument } from 'pdf-lib'\n * import fontkit from '@pdf-lib/fontkit'\n *\n * const pdfDoc = await PDFDocument.create()\n * pdfDoc.registerFontkit(fontkit)\n * ```\n *\n * @param fontkit The fontkit instance to be registered.\n */\n PDFDocument.prototype.registerFontkit = function (fontkit) {\n this.fontkit = fontkit;\n };\n /**\n * Get the [[PDFForm]] containing all interactive fields for this document.\n * For example:\n * ```js\n * const form = pdfDoc.getForm()\n * const fields = form.getFields()\n * fields.forEach(field => {\n * const type = field.constructor.name\n * const name = field.getName()\n * console.log(`${type}: ${name}`)\n * })\n * ```\n * @returns The form for this document.\n */\n PDFDocument.prototype.getForm = function () {\n var form = this.formCache.access();\n if (form.hasXFA()) {\n console.warn('Removing XFA form data as pdf-lib does not support reading or writing XFA');\n form.deleteXFA();\n }\n return form;\n };\n /**\n * Get this document's title metadata. The title appears in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * const title = pdfDoc.getTitle()\n * ```\n * @returns A string containing the title of this document, if it has one.\n */\n PDFDocument.prototype.getTitle = function () {\n var title = this.getInfoDict().lookup(PDFName.Title);\n if (!title)\n return undefined;\n assertIsLiteralOrHexString(title);\n return title.decodeText();\n };\n /**\n * Get this document's author metadata. The author appears in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * const author = pdfDoc.getAuthor()\n * ```\n * @returns A string containing the author of this document, if it has one.\n */\n PDFDocument.prototype.getAuthor = function () {\n var author = this.getInfoDict().lookup(PDFName.Author);\n if (!author)\n return undefined;\n assertIsLiteralOrHexString(author);\n return author.decodeText();\n };\n /**\n * Get this document's subject metadata. The subject appears in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * const subject = pdfDoc.getSubject()\n * ```\n * @returns A string containing the subject of this document, if it has one.\n */\n PDFDocument.prototype.getSubject = function () {\n var subject = this.getInfoDict().lookup(PDFName.Subject);\n if (!subject)\n return undefined;\n assertIsLiteralOrHexString(subject);\n return subject.decodeText();\n };\n /**\n * Get this document's keywords metadata. The keywords appear in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * const keywords = pdfDoc.getKeywords()\n * ```\n * @returns A string containing the keywords of this document, if it has any.\n */\n PDFDocument.prototype.getKeywords = function () {\n var keywords = this.getInfoDict().lookup(PDFName.Keywords);\n if (!keywords)\n return undefined;\n assertIsLiteralOrHexString(keywords);\n return keywords.decodeText();\n };\n /**\n * Get this document's creator metadata. The creator appears in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * const creator = pdfDoc.getCreator()\n * ```\n * @returns A string containing the creator of this document, if it has one.\n */\n PDFDocument.prototype.getCreator = function () {\n var creator = this.getInfoDict().lookup(PDFName.Creator);\n if (!creator)\n return undefined;\n assertIsLiteralOrHexString(creator);\n return creator.decodeText();\n };\n /**\n * Get this document's producer metadata. The producer appears in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * const producer = pdfDoc.getProducer()\n * ```\n * @returns A string containing the producer of this document, if it has one.\n */\n PDFDocument.prototype.getProducer = function () {\n var producer = this.getInfoDict().lookup(PDFName.Producer);\n if (!producer)\n return undefined;\n assertIsLiteralOrHexString(producer);\n return producer.decodeText();\n };\n /**\n * Get this document's creation date metadata. The creation date appears in\n * the \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * const creationDate = pdfDoc.getCreationDate()\n * ```\n * @returns A Date containing the creation date of this document,\n * if it has one.\n */\n PDFDocument.prototype.getCreationDate = function () {\n var creationDate = this.getInfoDict().lookup(PDFName.CreationDate);\n if (!creationDate)\n return undefined;\n assertIsLiteralOrHexString(creationDate);\n return creationDate.decodeDate();\n };\n /**\n * Get this document's modification date metadata. The modification date\n * appears in the \"Document Properties\" section of most PDF readers.\n * For example:\n * ```js\n * const modification = pdfDoc.getModificationDate()\n * ```\n * @returns A Date containing the modification date of this document,\n * if it has one.\n */\n PDFDocument.prototype.getModificationDate = function () {\n var modificationDate = this.getInfoDict().lookup(PDFName.ModDate);\n if (!modificationDate)\n return undefined;\n assertIsLiteralOrHexString(modificationDate);\n return modificationDate.decodeDate();\n };\n /**\n * Set this document's title metadata. The title will appear in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * pdfDoc.setTitle('🥚 The Life of an Egg 🍳')\n * ```\n *\n * To display the title in the window's title bar, set the\n * `showInWindowTitleBar` option to `true` (works for _most_ PDF readers).\n * For example:\n * ```js\n * pdfDoc.setTitle('🥚 The Life of an Egg 🍳', { showInWindowTitleBar: true })\n * ```\n *\n * @param title The title of this document.\n * @param options The options to be used when setting the title.\n */\n PDFDocument.prototype.setTitle = function (title, options) {\n assertIs(title, 'title', ['string']);\n var key = PDFName.of('Title');\n this.getInfoDict().set(key, PDFHexString.fromText(title));\n // Indicate that readers should display the title rather than the filename\n if (options === null || options === void 0 ? void 0 : options.showInWindowTitleBar) {\n var prefs = this.catalog.getOrCreateViewerPreferences();\n prefs.setDisplayDocTitle(true);\n }\n };\n /**\n * Set this document's author metadata. The author will appear in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * pdfDoc.setAuthor('Humpty Dumpty')\n * ```\n * @param author The author of this document.\n */\n PDFDocument.prototype.setAuthor = function (author) {\n assertIs(author, 'author', ['string']);\n var key = PDFName.of('Author');\n this.getInfoDict().set(key, PDFHexString.fromText(author));\n };\n /**\n * Set this document's subject metadata. The subject will appear in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * pdfDoc.setSubject('📘 An Epic Tale of Woe 📖')\n * ```\n * @param subject The subject of this document.\n */\n PDFDocument.prototype.setSubject = function (subject) {\n assertIs(subject, 'author', ['string']);\n var key = PDFName.of('Subject');\n this.getInfoDict().set(key, PDFHexString.fromText(subject));\n };\n /**\n * Set this document's keyword metadata. These keywords will appear in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * pdfDoc.setKeywords(['eggs', 'wall', 'fall', 'king', 'horses', 'men'])\n * ```\n * @param keywords An array of keywords associated with this document.\n */\n PDFDocument.prototype.setKeywords = function (keywords) {\n assertIs(keywords, 'keywords', [Array]);\n var key = PDFName.of('Keywords');\n this.getInfoDict().set(key, PDFHexString.fromText(keywords.join(' ')));\n };\n /**\n * Set this document's creator metadata. The creator will appear in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * pdfDoc.setCreator('PDF App 9000 🤖')\n * ```\n * @param creator The creator of this document.\n */\n PDFDocument.prototype.setCreator = function (creator) {\n assertIs(creator, 'creator', ['string']);\n var key = PDFName.of('Creator');\n this.getInfoDict().set(key, PDFHexString.fromText(creator));\n };\n /**\n * Set this document's producer metadata. The producer will appear in the\n * \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * pdfDoc.setProducer('PDF App 9000 🤖')\n * ```\n * @param producer The producer of this document.\n */\n PDFDocument.prototype.setProducer = function (producer) {\n assertIs(producer, 'creator', ['string']);\n var key = PDFName.of('Producer');\n this.getInfoDict().set(key, PDFHexString.fromText(producer));\n };\n /**\n * Set this document's language metadata. The language will appear in the\n * \"Document Properties\" section of some PDF readers. For example:\n * ```js\n * pdfDoc.setLanguage('en-us')\n * ```\n *\n * @param language An RFC 3066 _Language-Tag_ denoting the language of this\n * document, or an empty string if the language is unknown.\n */\n PDFDocument.prototype.setLanguage = function (language) {\n assertIs(language, 'language', ['string']);\n var key = PDFName.of('Lang');\n this.catalog.set(key, PDFString.of(language));\n };\n /**\n * Set this document's creation date metadata. The creation date will appear\n * in the \"Document Properties\" section of most PDF readers. For example:\n * ```js\n * pdfDoc.setCreationDate(new Date())\n * ```\n * @param creationDate The date this document was created.\n */\n PDFDocument.prototype.setCreationDate = function (creationDate) {\n assertIs(creationDate, 'creationDate', [[Date, 'Date']]);\n var key = PDFName.of('CreationDate');\n this.getInfoDict().set(key, PDFString.fromDate(creationDate));\n };\n /**\n * Set this document's modification date metadata. The modification date will\n * appear in the \"Document Properties\" section of most PDF readers. For\n * example:\n * ```js\n * pdfDoc.setModificationDate(new Date())\n * ```\n * @param modificationDate The date this document was last modified.\n */\n PDFDocument.prototype.setModificationDate = function (modificationDate) {\n assertIs(modificationDate, 'modificationDate', [[Date, 'Date']]);\n var key = PDFName.of('ModDate');\n this.getInfoDict().set(key, PDFString.fromDate(modificationDate));\n };\n /**\n * Get the number of pages contained in this document. For example:\n * ```js\n * const totalPages = pdfDoc.getPageCount()\n * ```\n * @returns The number of pages in this document.\n */\n PDFDocument.prototype.getPageCount = function () {\n if (this.pageCount === undefined)\n this.pageCount = this.getPages().length;\n return this.pageCount;\n };\n /**\n * Get an array of all the pages contained in this document. The pages are\n * stored in the array in the same order that they are rendered in the\n * document. For example:\n * ```js\n * const pages = pdfDoc.getPages()\n * pages[0] // The first page of the document\n * pages[2] // The third page of the document\n * pages[197] // The 198th page of the document\n * ```\n * @returns An array of all the pages contained in this document.\n */\n PDFDocument.prototype.getPages = function () {\n return this.pageCache.access();\n };\n /**\n * Get the page rendered at a particular `index` of the document. For example:\n * ```js\n * pdfDoc.getPage(0) // The first page of the document\n * pdfDoc.getPage(2) // The third page of the document\n * pdfDoc.getPage(197) // The 198th page of the document\n * ```\n * @returns The [[PDFPage]] rendered at the given `index` of the document.\n */\n PDFDocument.prototype.getPage = function (index) {\n var pages = this.getPages();\n assertRange(index, 'index', 0, pages.length - 1);\n return pages[index];\n };\n /**\n * Get an array of indices for all the pages contained in this document. The\n * array will contain a range of integers from\n * `0..pdfDoc.getPageCount() - 1`. For example:\n * ```js\n * const pdfDoc = await PDFDocument.create()\n * pdfDoc.addPage()\n * pdfDoc.addPage()\n * pdfDoc.addPage()\n *\n * const indices = pdfDoc.getPageIndices()\n * indices // => [0, 1, 2]\n * ```\n * @returns An array of indices for all pages contained in this document.\n */\n PDFDocument.prototype.getPageIndices = function () {\n return range(0, this.getPageCount());\n };\n /**\n * Remove the page at a given index from this document. For example:\n * ```js\n * pdfDoc.removePage(0) // Remove the first page of the document\n * pdfDoc.removePage(2) // Remove the third page of the document\n * pdfDoc.removePage(197) // Remove the 198th page of the document\n * ```\n * Once a page has been removed, it will no longer be rendered at that index\n * in the document.\n * @param index The index of the page to be removed.\n */\n PDFDocument.prototype.removePage = function (index) {\n var pageCount = this.getPageCount();\n if (this.pageCount === 0)\n throw new RemovePageFromEmptyDocumentError();\n assertRange(index, 'index', 0, pageCount - 1);\n this.catalog.removeLeafNode(index);\n this.pageCount = pageCount - 1;\n };\n /**\n * Add a page to the end of this document. This method accepts three\n * different value types for the `page` parameter:\n *\n * | Type | Behavior |\n * | ------------------ | ----------------------------------------------------------------------------------- |\n * | `undefined` | Create a new page and add it to the end of this document |\n * | `[number, number]` | Create a new page with the given dimensions and add it to the end of this document |\n * | `PDFPage` | Add the existing page to the end of this document |\n *\n * For example:\n * ```js\n * // page=undefined\n * const newPage = pdfDoc.addPage()\n *\n * // page=[number, number]\n * import { PageSizes } from 'pdf-lib'\n * const newPage1 = pdfDoc.addPage(PageSizes.A7)\n * const newPage2 = pdfDoc.addPage(PageSizes.Letter)\n * const newPage3 = pdfDoc.addPage([500, 750])\n *\n * // page=PDFPage\n * const pdfDoc1 = await PDFDocument.create()\n * const pdfDoc2 = await PDFDocument.load(...)\n * const [existingPage] = await pdfDoc1.copyPages(pdfDoc2, [0])\n * pdfDoc1.addPage(existingPage)\n * ```\n *\n * @param page Optionally, the desired dimensions or existing page.\n * @returns The newly created (or existing) page.\n */\n PDFDocument.prototype.addPage = function (page) {\n assertIs(page, 'page', ['undefined', [PDFPage, 'PDFPage'], Array]);\n return this.insertPage(this.getPageCount(), page);\n };\n /**\n * Insert a page at a given index within this document. This method accepts\n * three different value types for the `page` parameter:\n *\n * | Type | Behavior |\n * | ------------------ | ------------------------------------------------------------------------------ |\n * | `undefined` | Create a new page and insert it into this document |\n * | `[number, number]` | Create a new page with the given dimensions and insert it into this document |\n * | `PDFPage` | Insert the existing page into this document |\n *\n * For example:\n * ```js\n * // page=undefined\n * const newPage = pdfDoc.insertPage(2)\n *\n * // page=[number, number]\n * import { PageSizes } from 'pdf-lib'\n * const newPage1 = pdfDoc.insertPage(2, PageSizes.A7)\n * const newPage2 = pdfDoc.insertPage(0, PageSizes.Letter)\n * const newPage3 = pdfDoc.insertPage(198, [500, 750])\n *\n * // page=PDFPage\n * const pdfDoc1 = await PDFDocument.create()\n * const pdfDoc2 = await PDFDocument.load(...)\n * const [existingPage] = await pdfDoc1.copyPages(pdfDoc2, [0])\n * pdfDoc1.insertPage(0, existingPage)\n * ```\n *\n * @param index The index at which the page should be inserted (zero-based).\n * @param page Optionally, the desired dimensions or existing page.\n * @returns The newly created (or existing) page.\n */\n PDFDocument.prototype.insertPage = function (index, page) {\n var pageCount = this.getPageCount();\n assertRange(index, 'index', 0, pageCount);\n assertIs(page, 'page', ['undefined', [PDFPage, 'PDFPage'], Array]);\n if (!page || Array.isArray(page)) {\n var dims = Array.isArray(page) ? page : PageSizes.A4;\n page = PDFPage.create(this);\n page.setSize.apply(page, dims);\n }\n else if (page.doc !== this) {\n throw new ForeignPageError();\n }\n var parentRef = this.catalog.insertLeafNode(page.ref, index);\n page.node.setParent(parentRef);\n this.pageMap.set(page.node, page);\n this.pageCache.invalidate();\n this.pageCount = pageCount + 1;\n return page;\n };\n /**\n * Copy pages from a source document into this document. Allows pages to be\n * copied between different [[PDFDocument]] instances. For example:\n * ```js\n * const pdfDoc = await PDFDocument.create()\n * const srcDoc = await PDFDocument.load(...)\n *\n * const copiedPages = await pdfDoc.copyPages(srcDoc, [0, 3, 89])\n * const [firstPage, fourthPage, ninetiethPage] = copiedPages;\n *\n * pdfDoc.addPage(fourthPage)\n * pdfDoc.insertPage(0, ninetiethPage)\n * pdfDoc.addPage(firstPage)\n * ```\n * @param srcDoc The document from which pages should be copied.\n * @param indices The indices of the pages that should be copied.\n * @returns Resolves with an array of pages copied into this document.\n */\n PDFDocument.prototype.copyPages = function (srcDoc, indices) {\n return __awaiter(this, void 0, void 0, function () {\n var copier, srcPages, copiedPages, idx, len, srcPage, copiedPage, ref;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertIs(srcDoc, 'srcDoc', [[PDFDocument, 'PDFDocument']]);\n assertIs(indices, 'indices', [Array]);\n return [4 /*yield*/, srcDoc.flush()];\n case 1:\n _a.sent();\n copier = PDFObjectCopier.for(srcDoc.context, this.context);\n srcPages = srcDoc.getPages();\n copiedPages = new Array(indices.length);\n for (idx = 0, len = indices.length; idx < len; idx++) {\n srcPage = srcPages[indices[idx]];\n copiedPage = copier.copy(srcPage.node);\n ref = this.context.register(copiedPage);\n copiedPages[idx] = PDFPage.of(copiedPage, ref, this);\n }\n return [2 /*return*/, copiedPages];\n }\n });\n });\n };\n /**\n * Get a copy of this document.\n *\n * For example:\n * ```js\n * const srcDoc = await PDFDocument.load(...)\n * const pdfDoc = await srcDoc.copy()\n * ```\n *\n * > **NOTE:** This method won't copy all information over to the new\n * > document (acroforms, outlines, etc...).\n *\n * @returns Resolves with a copy this document.\n */\n PDFDocument.prototype.copy = function () {\n return __awaiter(this, void 0, void 0, function () {\n var pdfCopy, contentPages, idx, len;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, PDFDocument.create()];\n case 1:\n pdfCopy = _a.sent();\n return [4 /*yield*/, pdfCopy.copyPages(this, this.getPageIndices())];\n case 2:\n contentPages = _a.sent();\n for (idx = 0, len = contentPages.length; idx < len; idx++) {\n pdfCopy.addPage(contentPages[idx]);\n }\n if (this.getAuthor() !== undefined) {\n pdfCopy.setAuthor(this.getAuthor());\n }\n if (this.getCreationDate() !== undefined) {\n pdfCopy.setCreationDate(this.getCreationDate());\n }\n if (this.getCreator() !== undefined) {\n pdfCopy.setCreator(this.getCreator());\n }\n if (this.getModificationDate() !== undefined) {\n pdfCopy.setModificationDate(this.getModificationDate());\n }\n if (this.getProducer() !== undefined) {\n pdfCopy.setProducer(this.getProducer());\n }\n if (this.getSubject() !== undefined) {\n pdfCopy.setSubject(this.getSubject());\n }\n if (this.getTitle() !== undefined) {\n pdfCopy.setTitle(this.getTitle());\n }\n pdfCopy.defaultWordBreaks = this.defaultWordBreaks;\n return [2 /*return*/, pdfCopy];\n }\n });\n });\n };\n /**\n * Add JavaScript to this document. The supplied `script` is executed when the\n * document is opened. The `script` can be used to perform some operation\n * when the document is opened (e.g. logging to the console), or it can be\n * used to define a function that can be referenced later in a JavaScript\n * action. For example:\n * ```js\n * // Show \"Hello World!\" in the console when the PDF is opened\n * pdfDoc.addJavaScript(\n * 'main',\n * 'console.show(); console.println(\"Hello World!\");'\n * );\n *\n * // Define a function named \"foo\" that can be called in JavaScript Actions\n * pdfDoc.addJavaScript(\n * 'foo',\n * 'function foo() { return \"foo\"; }'\n * );\n * ```\n * See the [JavaScript for Acrobat API Reference](https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_api_reference.pdf)\n * for details.\n * @param name The name of the script. Must be unique per document.\n * @param script The JavaScript to execute.\n */\n PDFDocument.prototype.addJavaScript = function (name, script) {\n assertIs(name, 'name', ['string']);\n assertIs(script, 'script', ['string']);\n var embedder = JavaScriptEmbedder.for(script, name);\n var ref = this.context.nextRef();\n var javaScript = PDFJavaScript.of(ref, this, embedder);\n this.javaScripts.push(javaScript);\n };\n /**\n * Add an attachment to this document. Attachments are visible in the\n * \"Attachments\" panel of Adobe Acrobat and some other PDF readers. Any\n * type of file can be added as an attachment. This includes, but is not\n * limited to, `.png`, `.jpg`, `.pdf`, `.csv`, `.docx`, and `.xlsx` files.\n *\n * The input data can be provided in multiple formats:\n *\n * | Type | Contents |\n * | ------------- | -------------------------------------------------------------- |\n * | `string` | A base64 encoded string (or data URI) containing an attachment |\n * | `Uint8Array` | The raw bytes of an attachment |\n * | `ArrayBuffer` | The raw bytes of an attachment |\n *\n * For example:\n * ```js\n * // attachment=string\n * await pdfDoc.attach('/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...', 'cat_riding_unicorn.jpg', {\n * mimeType: 'image/jpeg',\n * description: 'Cool cat riding a unicorn! 🦄🐈🕶️',\n * creationDate: new Date('2019/12/01'),\n * modificationDate: new Date('2020/04/19'),\n * })\n * await pdfDoc.attach('data:image/jpeg;base64,/9j/4AAQ...', 'cat_riding_unicorn.jpg', {\n * mimeType: 'image/jpeg',\n * description: 'Cool cat riding a unicorn! 🦄🐈🕶️',\n * creationDate: new Date('2019/12/01'),\n * modificationDate: new Date('2020/04/19'),\n * })\n *\n * // attachment=Uint8Array\n * import fs from 'fs'\n * const uint8Array = fs.readFileSync('cat_riding_unicorn.jpg')\n * await pdfDoc.attach(uint8Array, 'cat_riding_unicorn.jpg', {\n * mimeType: 'image/jpeg',\n * description: 'Cool cat riding a unicorn! 🦄🐈🕶️',\n * creationDate: new Date('2019/12/01'),\n * modificationDate: new Date('2020/04/19'),\n * })\n *\n * // attachment=ArrayBuffer\n * const url = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg'\n * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer())\n * await pdfDoc.attach(arrayBuffer, 'cat_riding_unicorn.jpg', {\n * mimeType: 'image/jpeg',\n * description: 'Cool cat riding a unicorn! 🦄🐈🕶️',\n * creationDate: new Date('2019/12/01'),\n * modificationDate: new Date('2020/04/19'),\n * })\n * ```\n *\n * @param attachment The input data containing the file to be attached.\n * @param name The name of the file to be attached.\n * @returns Resolves when the attachment is complete.\n */\n PDFDocument.prototype.attach = function (attachment, name, options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var bytes, embedder, ref, embeddedFile;\n return __generator(this, function (_a) {\n assertIs(attachment, 'attachment', ['string', Uint8Array, ArrayBuffer]);\n assertIs(name, 'name', ['string']);\n assertOrUndefined(options.mimeType, 'mimeType', ['string']);\n assertOrUndefined(options.description, 'description', ['string']);\n assertOrUndefined(options.creationDate, 'options.creationDate', [Date]);\n assertOrUndefined(options.modificationDate, 'options.modificationDate', [\n Date,\n ]);\n assertIsOneOfOrUndefined(options.afRelationship, 'options.afRelationship', AFRelationship);\n bytes = toUint8Array(attachment);\n embedder = FileEmbedder.for(bytes, name, options);\n ref = this.context.nextRef();\n embeddedFile = PDFEmbeddedFile.of(ref, this, embedder);\n this.embeddedFiles.push(embeddedFile);\n return [2 /*return*/];\n });\n });\n };\n /**\n * Embed a font into this document. The input data can be provided in multiple\n * formats:\n *\n * | Type | Contents |\n * | --------------- | ------------------------------------------------------- |\n * | `StandardFonts` | One of the standard 14 fonts |\n * | `string` | A base64 encoded string (or data URI) containing a font |\n * | `Uint8Array` | The raw bytes of a font |\n * | `ArrayBuffer` | The raw bytes of a font |\n *\n * For example:\n * ```js\n * // font=StandardFonts\n * import { StandardFonts } from 'pdf-lib'\n * const font1 = await pdfDoc.embedFont(StandardFonts.Helvetica)\n *\n * // font=string\n * const font2 = await pdfDoc.embedFont('AAEAAAAVAQAABABQRFNJRx/upe...')\n * const font3 = await pdfDoc.embedFont('data:font/opentype;base64,AAEAAA...')\n *\n * // font=Uint8Array\n * import fs from 'fs'\n * const font4 = await pdfDoc.embedFont(fs.readFileSync('Ubuntu-R.ttf'))\n *\n * // font=ArrayBuffer\n * const url = 'https://pdf-lib.js.org/assets/ubuntu/Ubuntu-R.ttf'\n * const ubuntuBytes = await fetch(url).then(res => res.arrayBuffer())\n * const font5 = await pdfDoc.embedFont(ubuntuBytes)\n * ```\n * See also: [[registerFontkit]]\n * @param font The input data for a font.\n * @param options The options to be used when embedding the font.\n * @returns Resolves with the embedded font.\n */\n PDFDocument.prototype.embedFont = function (font, options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var _a, subset, customName, features, embedder, bytes, fontkit, _b, ref, pdfFont;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _a = options.subset, subset = _a === void 0 ? false : _a, customName = options.customName, features = options.features;\n assertIs(font, 'font', ['string', Uint8Array, ArrayBuffer]);\n assertIs(subset, 'subset', ['boolean']);\n if (!isStandardFont(font)) return [3 /*break*/, 1];\n embedder = StandardFontEmbedder.for(font, customName);\n return [3 /*break*/, 7];\n case 1:\n if (!canBeConvertedToUint8Array(font)) return [3 /*break*/, 6];\n bytes = toUint8Array(font);\n fontkit = this.assertFontkit();\n if (!subset) return [3 /*break*/, 3];\n return [4 /*yield*/, CustomFontSubsetEmbedder.for(fontkit, bytes, customName, features)];\n case 2:\n _b = _c.sent();\n return [3 /*break*/, 5];\n case 3: return [4 /*yield*/, CustomFontEmbedder.for(fontkit, bytes, customName, features)];\n case 4:\n _b = _c.sent();\n _c.label = 5;\n case 5:\n embedder = _b;\n return [3 /*break*/, 7];\n case 6: throw new TypeError('`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`');\n case 7:\n ref = this.context.nextRef();\n pdfFont = PDFFont.of(ref, this, embedder);\n this.fonts.push(pdfFont);\n return [2 /*return*/, pdfFont];\n }\n });\n });\n };\n /**\n * Embed a standard font into this document.\n * For example:\n * ```js\n * import { StandardFonts } from 'pdf-lib'\n * const helveticaFont = pdfDoc.embedFont(StandardFonts.Helvetica)\n * ```\n * @param font The standard font to be embedded.\n * @param customName The name to be used when embedding the font.\n * @returns The embedded font.\n */\n PDFDocument.prototype.embedStandardFont = function (font, customName) {\n assertIs(font, 'font', ['string']);\n if (!isStandardFont(font)) {\n throw new TypeError('`font` must be one of type `StandardFonts`');\n }\n var embedder = StandardFontEmbedder.for(font, customName);\n var ref = this.context.nextRef();\n var pdfFont = PDFFont.of(ref, this, embedder);\n this.fonts.push(pdfFont);\n return pdfFont;\n };\n /**\n * Embed a JPEG image into this document. The input data can be provided in\n * multiple formats:\n *\n * | Type | Contents |\n * | ------------- | ------------------------------------------------------------- |\n * | `string` | A base64 encoded string (or data URI) containing a JPEG image |\n * | `Uint8Array` | The raw bytes of a JPEG image |\n * | `ArrayBuffer` | The raw bytes of a JPEG image |\n *\n * For example:\n * ```js\n * // jpg=string\n * const image1 = await pdfDoc.embedJpg('/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...')\n * const image2 = await pdfDoc.embedJpg('data:image/jpeg;base64,/9j/4AAQ...')\n *\n * // jpg=Uint8Array\n * import fs from 'fs'\n * const uint8Array = fs.readFileSync('cat_riding_unicorn.jpg')\n * const image3 = await pdfDoc.embedJpg(uint8Array)\n *\n * // jpg=ArrayBuffer\n * const url = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg'\n * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer())\n * const image4 = await pdfDoc.embedJpg(arrayBuffer)\n * ```\n *\n * @param jpg The input data for a JPEG image.\n * @returns Resolves with the embedded image.\n */\n PDFDocument.prototype.embedJpg = function (jpg) {\n return __awaiter(this, void 0, void 0, function () {\n var bytes, embedder, ref, pdfImage;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertIs(jpg, 'jpg', ['string', Uint8Array, ArrayBuffer]);\n bytes = toUint8Array(jpg);\n return [4 /*yield*/, JpegEmbedder.for(bytes)];\n case 1:\n embedder = _a.sent();\n ref = this.context.nextRef();\n pdfImage = PDFImage.of(ref, this, embedder);\n this.images.push(pdfImage);\n return [2 /*return*/, pdfImage];\n }\n });\n });\n };\n /**\n * Embed a PNG image into this document. The input data can be provided in\n * multiple formats:\n *\n * | Type | Contents |\n * | ------------- | ------------------------------------------------------------ |\n * | `string` | A base64 encoded string (or data URI) containing a PNG image |\n * | `Uint8Array` | The raw bytes of a PNG image |\n * | `ArrayBuffer` | The raw bytes of a PNG image |\n *\n * For example:\n * ```js\n * // png=string\n * const image1 = await pdfDoc.embedPng('iVBORw0KGgoAAAANSUhEUgAAAlgAAAF3...')\n * const image2 = await pdfDoc.embedPng('data:image/png;base64,iVBORw0KGg...')\n *\n * // png=Uint8Array\n * import fs from 'fs'\n * const uint8Array = fs.readFileSync('small_mario.png')\n * const image3 = await pdfDoc.embedPng(uint8Array)\n *\n * // png=ArrayBuffer\n * const url = 'https://pdf-lib.js.org/assets/small_mario.png'\n * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer())\n * const image4 = await pdfDoc.embedPng(arrayBuffer)\n * ```\n *\n * @param png The input data for a PNG image.\n * @returns Resolves with the embedded image.\n */\n PDFDocument.prototype.embedPng = function (png) {\n return __awaiter(this, void 0, void 0, function () {\n var bytes, embedder, ref, pdfImage;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertIs(png, 'png', ['string', Uint8Array, ArrayBuffer]);\n bytes = toUint8Array(png);\n return [4 /*yield*/, PngEmbedder.for(bytes)];\n case 1:\n embedder = _a.sent();\n ref = this.context.nextRef();\n pdfImage = PDFImage.of(ref, this, embedder);\n this.images.push(pdfImage);\n return [2 /*return*/, pdfImage];\n }\n });\n });\n };\n /**\n * Embed one or more PDF pages into this document.\n *\n * For example:\n * ```js\n * const pdfDoc = await PDFDocument.create()\n *\n * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf'\n * const sourcePdf = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer())\n *\n * // Embed page 74 of `sourcePdf` into `pdfDoc`\n * const [embeddedPage] = await pdfDoc.embedPdf(sourcePdf, [73])\n * ```\n *\n * See [[PDFDocument.load]] for examples of the allowed input data formats.\n *\n * @param pdf The input data containing a PDF document.\n * @param indices The indices of the pages that should be embedded.\n * @returns Resolves with an array of the embedded pages.\n */\n PDFDocument.prototype.embedPdf = function (pdf, indices) {\n if (indices === void 0) { indices = [0]; }\n return __awaiter(this, void 0, void 0, function () {\n var srcDoc, _a, srcPages;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n assertIs(pdf, 'pdf', [\n 'string',\n Uint8Array,\n ArrayBuffer,\n [PDFDocument, 'PDFDocument'],\n ]);\n assertIs(indices, 'indices', [Array]);\n if (!(pdf instanceof PDFDocument)) return [3 /*break*/, 1];\n _a = pdf;\n return [3 /*break*/, 3];\n case 1: return [4 /*yield*/, PDFDocument.load(pdf)];\n case 2:\n _a = _b.sent();\n _b.label = 3;\n case 3:\n srcDoc = _a;\n srcPages = pluckIndices(srcDoc.getPages(), indices);\n return [2 /*return*/, this.embedPages(srcPages)];\n }\n });\n });\n };\n /**\n * Embed a single PDF page into this document.\n *\n * For example:\n * ```js\n * const pdfDoc = await PDFDocument.create()\n *\n * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf'\n * const sourceBuffer = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer())\n * const sourcePdfDoc = await PDFDocument.load(sourceBuffer)\n * const sourcePdfPage = sourcePdfDoc.getPages()[73]\n *\n * const embeddedPage = await pdfDoc.embedPage(\n * sourcePdfPage,\n *\n * // Clip a section of the source page so that we only embed part of it\n * { left: 100, right: 450, bottom: 330, top: 570 },\n *\n * // Translate all drawings of the embedded page by (10, 200) units\n * [1, 0, 0, 1, 10, 200],\n * )\n * ```\n *\n * @param page The page to be embedded.\n * @param boundingBox\n * Optionally, an area of the source page that should be embedded\n * (defaults to entire page).\n * @param transformationMatrix\n * Optionally, a transformation matrix that is always applied to the embedded\n * page anywhere it is drawn.\n * @returns Resolves with the embedded pdf page.\n */\n PDFDocument.prototype.embedPage = function (page, boundingBox, transformationMatrix) {\n return __awaiter(this, void 0, void 0, function () {\n var embeddedPage;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n assertIs(page, 'page', [[PDFPage, 'PDFPage']]);\n return [4 /*yield*/, this.embedPages([page], [boundingBox], [transformationMatrix])];\n case 1:\n embeddedPage = (_a.sent())[0];\n return [2 /*return*/, embeddedPage];\n }\n });\n });\n };\n /**\n * Embed one or more PDF pages into this document.\n *\n * For example:\n * ```js\n * const pdfDoc = await PDFDocument.create()\n *\n * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf'\n * const sourceBuffer = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer())\n * const sourcePdfDoc = await PDFDocument.load(sourceBuffer)\n *\n * const page1 = sourcePdfDoc.getPages()[0]\n * const page2 = sourcePdfDoc.getPages()[52]\n * const page3 = sourcePdfDoc.getPages()[73]\n *\n * const embeddedPages = await pdfDoc.embedPages([page1, page2, page3])\n * ```\n *\n * @param page\n * The pages to be embedded (they must all share the same context).\n * @param boundingBoxes\n * Optionally, an array of clipping boundaries - one for each page\n * (defaults to entirety of each page).\n * @param transformationMatrices\n * Optionally, an array of transformation matrices - one for each page\n * (each page's transformation will apply anywhere it is drawn).\n * @returns Resolves with an array of the embedded pdf pages.\n */\n PDFDocument.prototype.embedPages = function (pages, boundingBoxes, transformationMatrices) {\n if (boundingBoxes === void 0) { boundingBoxes = []; }\n if (transformationMatrices === void 0) { transformationMatrices = []; }\n return __awaiter(this, void 0, void 0, function () {\n var idx, len, currPage, nextPage, context, maybeCopyPage, embeddedPages, idx, len, page, box, matrix, embedder, ref;\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (pages.length === 0)\n return [2 /*return*/, []];\n // Assert all pages have the same context\n for (idx = 0, len = pages.length - 1; idx < len; idx++) {\n currPage = pages[idx];\n nextPage = pages[idx + 1];\n if (currPage.node.context !== nextPage.node.context) {\n throw new PageEmbeddingMismatchedContextError();\n }\n }\n context = pages[0].node.context;\n maybeCopyPage = context === this.context\n ? function (p) { return p; }\n : PDFObjectCopier.for(context, this.context).copy;\n embeddedPages = new Array(pages.length);\n idx = 0, len = pages.length;\n _b.label = 1;\n case 1:\n if (!(idx < len)) return [3 /*break*/, 4];\n page = maybeCopyPage(pages[idx].node);\n box = boundingBoxes[idx];\n matrix = transformationMatrices[idx];\n return [4 /*yield*/, PDFPageEmbedder.for(page, box, matrix)];\n case 2:\n embedder = _b.sent();\n ref = this.context.nextRef();\n embeddedPages[idx] = PDFEmbeddedPage.of(ref, this, embedder);\n _b.label = 3;\n case 3:\n idx++;\n return [3 /*break*/, 1];\n case 4:\n (_a = this.embeddedPages).push.apply(_a, embeddedPages);\n return [2 /*return*/, embeddedPages];\n }\n });\n });\n };\n /**\n * > **NOTE:** You shouldn't need to call this method directly. The [[save]]\n * > and [[saveAsBase64]] methods will automatically ensure that all embedded\n * > assets are flushed before serializing the document.\n *\n * Flush all embedded fonts, PDF pages, and images to this document's\n * [[context]].\n *\n * @returns Resolves when the flush is complete.\n */\n PDFDocument.prototype.flush = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.embedAll(this.fonts)];\n case 1:\n _a.sent();\n return [4 /*yield*/, this.embedAll(this.images)];\n case 2:\n _a.sent();\n return [4 /*yield*/, this.embedAll(this.embeddedPages)];\n case 3:\n _a.sent();\n return [4 /*yield*/, this.embedAll(this.embeddedFiles)];\n case 4:\n _a.sent();\n return [4 /*yield*/, this.embedAll(this.javaScripts)];\n case 5:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Serialize this document to an array of bytes making up a PDF file.\n * For example:\n * ```js\n * const pdfBytes = await pdfDoc.save()\n * ```\n *\n * There are a number of things you can do with the serialized document,\n * depending on the JavaScript environment you're running in:\n * * Write it to a file in Node or React Native\n * * Download it as a Blob in the browser\n * * Render it in an `iframe`\n *\n * @param options The options to be used when saving the document.\n * @returns Resolves with the bytes of the serialized document.\n */\n PDFDocument.prototype.save = function (options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var _a, useObjectStreams, _b, addDefaultPage, _c, objectsPerTick, _d, updateFieldAppearances, form, Writer;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n _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;\n assertIs(useObjectStreams, 'useObjectStreams', ['boolean']);\n assertIs(addDefaultPage, 'addDefaultPage', ['boolean']);\n assertIs(objectsPerTick, 'objectsPerTick', ['number']);\n assertIs(updateFieldAppearances, 'updateFieldAppearances', ['boolean']);\n if (addDefaultPage && this.getPageCount() === 0)\n this.addPage();\n if (updateFieldAppearances) {\n form = this.formCache.getValue();\n if (form)\n form.updateFieldAppearances();\n }\n return [4 /*yield*/, this.flush()];\n case 1:\n _e.sent();\n Writer = useObjectStreams ? PDFStreamWriter : PDFWriter;\n return [2 /*return*/, Writer.forContext(this.context, objectsPerTick).serializeToBuffer()];\n }\n });\n });\n };\n /**\n * Serialize this document to a base64 encoded string or data URI making up a\n * PDF file. For example:\n * ```js\n * const base64String = await pdfDoc.saveAsBase64()\n * base64String // => 'JVBERi0xLjcKJYGBgYEKC...'\n *\n * const base64DataUri = await pdfDoc.saveAsBase64({ dataUri: true })\n * base64DataUri // => 'data:application/pdf;base64,JVBERi0xLjcKJYGBgYEKC...'\n * ```\n *\n * @param options The options to be used when saving the document.\n * @returns Resolves with a base64 encoded string or data URI of the\n * serialized document.\n */\n PDFDocument.prototype.saveAsBase64 = function (options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var _a, dataUri, otherOptions, bytes, base64;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = options.dataUri, dataUri = _a === void 0 ? false : _a, otherOptions = __rest(options, [\"dataUri\"]);\n assertIs(dataUri, 'dataUri', ['boolean']);\n return [4 /*yield*/, this.save(otherOptions)];\n case 1:\n bytes = _b.sent();\n base64 = encodeToBase64(bytes);\n return [2 /*return*/, dataUri ? \"data:application/pdf;base64,\" + base64 : base64];\n }\n });\n });\n };\n PDFDocument.prototype.findPageForAnnotationRef = function (ref) {\n var pages = this.getPages();\n for (var idx = 0, len = pages.length; idx < len; idx++) {\n var page = pages[idx];\n var annotations = page.node.Annots();\n if ((annotations === null || annotations === void 0 ? void 0 : annotations.indexOf(ref)) !== undefined) {\n return page;\n }\n }\n return undefined;\n };\n PDFDocument.prototype.embedAll = function (embeddables) {\n return __awaiter(this, void 0, void 0, function () {\n var idx, len;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n idx = 0, len = embeddables.length;\n _a.label = 1;\n case 1:\n if (!(idx < len)) return [3 /*break*/, 4];\n return [4 /*yield*/, embeddables[idx].embed()];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3:\n idx++;\n return [3 /*break*/, 1];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n PDFDocument.prototype.updateInfoDict = function () {\n var pdfLib = \"pdf-lib (https://github.com/Hopding/pdf-lib)\";\n var now = new Date();\n var info = this.getInfoDict();\n this.setProducer(pdfLib);\n this.setModificationDate(now);\n if (!info.get(PDFName.of('Creator')))\n this.setCreator(pdfLib);\n if (!info.get(PDFName.of('CreationDate')))\n this.setCreationDate(now);\n };\n PDFDocument.prototype.getInfoDict = function () {\n var existingInfo = this.context.lookup(this.context.trailerInfo.Info);\n if (existingInfo instanceof PDFDict)\n return existingInfo;\n var newInfo = this.context.obj({});\n this.context.trailerInfo.Info = this.context.register(newInfo);\n return newInfo;\n };\n PDFDocument.prototype.assertFontkit = function () {\n if (!this.fontkit)\n throw new FontkitNotRegisteredError();\n return this.fontkit;\n };\n return PDFDocument;\n}());\nexport default PDFDocument;\n/* tslint:disable-next-line only-arrow-functions */\nfunction assertIsLiteralOrHexString(pdfObject) {\n if (!(pdfObject instanceof PDFHexString) &&\n !(pdfObject instanceof PDFString)) {\n throw new UnexpectedObjectTypeError([PDFHexString, PDFString], pdfObject);\n }\n}\n//# sourceMappingURL=PDFDocument.js.map","import { __assign } from \"tslib\";\nimport { rgb } from \"./colors\";\nimport { drawImage, drawLine, drawLinesOfText, drawPage, drawRectangle, drawSvgPath, drawEllipse, } from \"./operations\";\nimport { popGraphicsState, pushGraphicsState, translate, LineCapStyle, scale, } from \"./operators\";\nimport PDFDocument from \"./PDFDocument\";\nimport PDFEmbeddedPage from \"./PDFEmbeddedPage\";\nimport PDFFont from \"./PDFFont\";\nimport PDFImage from \"./PDFImage\";\nimport { BlendMode, } from \"./PDFPageOptions\";\nimport { degrees, toDegrees } from \"./rotations\";\nimport { StandardFonts } from \"./StandardFonts\";\nimport { PDFContentStream, PDFName, PDFOperator, PDFPageLeaf, PDFRef, PDFDict, PDFArray, } from \"../core\";\nimport { assertEachIs, assertIs, assertMultiple, assertOrUndefined, breakTextIntoLines, cleanText, rectanglesAreEqual, lineSplit, assertRangeOrUndefined, assertIsOneOfOrUndefined, } from \"../utils\";\n/**\n * Represents a single page of a [[PDFDocument]].\n */\nvar PDFPage = /** @class */ (function () {\n function PDFPage(leafNode, ref, doc) {\n this.fontSize = 24;\n this.fontColor = rgb(0, 0, 0);\n this.lineHeight = 24;\n this.x = 0;\n this.y = 0;\n assertIs(leafNode, 'leafNode', [[PDFPageLeaf, 'PDFPageLeaf']]);\n assertIs(ref, 'ref', [[PDFRef, 'PDFRef']]);\n assertIs(doc, 'doc', [[PDFDocument, 'PDFDocument']]);\n this.node = leafNode;\n this.ref = ref;\n this.doc = doc;\n }\n /**\n * Rotate this page by a multiple of 90 degrees. For example:\n * ```js\n * import { degrees } from 'pdf-lib'\n *\n * page.setRotation(degrees(-90))\n * page.setRotation(degrees(0))\n * page.setRotation(degrees(90))\n * page.setRotation(degrees(180))\n * page.setRotation(degrees(270))\n * ```\n * @param angle The angle to rotate this page.\n */\n PDFPage.prototype.setRotation = function (angle) {\n var degreesAngle = toDegrees(angle);\n assertMultiple(degreesAngle, 'degreesAngle', 90);\n this.node.set(PDFName.of('Rotate'), this.doc.context.obj(degreesAngle));\n };\n /**\n * Get this page's rotation angle in degrees. For example:\n * ```js\n * const rotationAngle = page.getRotation().angle;\n * ```\n * @returns The rotation angle of the page in degrees (always a multiple of\n * 90 degrees).\n */\n PDFPage.prototype.getRotation = function () {\n var Rotate = this.node.Rotate();\n return degrees(Rotate ? Rotate.asNumber() : 0);\n };\n /**\n * Resize this page by increasing or decreasing its width and height. For\n * example:\n * ```js\n * page.setSize(250, 500)\n * page.setSize(page.getWidth() + 50, page.getHeight() + 100)\n * page.setSize(page.getWidth() - 50, page.getHeight() - 100)\n * ```\n *\n * Note that the PDF specification does not allow for pages to have explicit\n * widths and heights. Instead it defines the \"size\" of a page in terms of\n * five rectangles: the MediaBox, CropBox, BleedBox, TrimBox, and ArtBox. As a\n * result, this method cannot directly change the width and height of a page.\n * Instead, it works by adjusting these five boxes.\n *\n * This method performs the following steps:\n * 1. Set width & height of MediaBox.\n * 2. Set width & height of CropBox, if it has same dimensions as MediaBox.\n * 3. Set width & height of BleedBox, if it has same dimensions as MediaBox.\n * 4. Set width & height of TrimBox, if it has same dimensions as MediaBox.\n * 5. Set width & height of ArtBox, if it has same dimensions as MediaBox.\n *\n * This approach works well for most PDF documents as all PDF pages must\n * have a MediaBox, but relatively few have a CropBox, BleedBox, TrimBox, or\n * ArtBox. And when they do have these additional boxes, they often have the\n * same dimensions as the MediaBox. However, if you find this method does not\n * work for your document, consider setting the boxes directly:\n * * [[PDFPage.setMediaBox]]\n * * [[PDFPage.setCropBox]]\n * * [[PDFPage.setBleedBox]]\n * * [[PDFPage.setTrimBox]]\n * * [[PDFPage.setArtBox]]\n *\n * @param width The new width of the page.\n * @param height The new height of the page.\n */\n PDFPage.prototype.setSize = function (width, height) {\n assertIs(width, 'width', ['number']);\n assertIs(height, 'height', ['number']);\n var mediaBox = this.getMediaBox();\n this.setMediaBox(mediaBox.x, mediaBox.y, width, height);\n var cropBox = this.getCropBox();\n var bleedBox = this.getBleedBox();\n var trimBox = this.getTrimBox();\n var artBox = this.getArtBox();\n var hasCropBox = this.node.CropBox();\n var hasBleedBox = this.node.BleedBox();\n var hasTrimBox = this.node.TrimBox();\n var hasArtBox = this.node.ArtBox();\n if (hasCropBox && rectanglesAreEqual(cropBox, mediaBox)) {\n this.setCropBox(mediaBox.x, mediaBox.y, width, height);\n }\n if (hasBleedBox && rectanglesAreEqual(bleedBox, mediaBox)) {\n this.setBleedBox(mediaBox.x, mediaBox.y, width, height);\n }\n if (hasTrimBox && rectanglesAreEqual(trimBox, mediaBox)) {\n this.setTrimBox(mediaBox.x, mediaBox.y, width, height);\n }\n if (hasArtBox && rectanglesAreEqual(artBox, mediaBox)) {\n this.setArtBox(mediaBox.x, mediaBox.y, width, height);\n }\n };\n /**\n * Resize this page by increasing or decreasing its width. For example:\n * ```js\n * page.setWidth(250)\n * page.setWidth(page.getWidth() + 50)\n * page.setWidth(page.getWidth() - 50)\n * ```\n *\n * This method uses [[PDFPage.setSize]] to set the page's width.\n *\n * @param width The new width of the page.\n */\n PDFPage.prototype.setWidth = function (width) {\n assertIs(width, 'width', ['number']);\n this.setSize(width, this.getSize().height);\n };\n /**\n * Resize this page by increasing or decreasing its height. For example:\n * ```js\n * page.setHeight(500)\n * page.setHeight(page.getWidth() + 100)\n * page.setHeight(page.getWidth() - 100)\n * ```\n *\n * This method uses [[PDFPage.setSize]] to set the page's height.\n *\n * @param height The new height of the page.\n */\n PDFPage.prototype.setHeight = function (height) {\n assertIs(height, 'height', ['number']);\n this.setSize(this.getSize().width, height);\n };\n /**\n * Set the MediaBox of this page. For example:\n * ```js\n * const mediaBox = page.getMediaBox()\n *\n * page.setMediaBox(0, 0, 250, 500)\n * page.setMediaBox(mediaBox.x, mediaBox.y, 50, 100)\n * page.setMediaBox(15, 5, mediaBox.width - 50, mediaBox.height - 100)\n * ```\n *\n * See [[PDFPage.getMediaBox]] for details about what the MediaBox represents.\n *\n * @param x The x coordinate of the lower left corner of the new MediaBox.\n * @param y The y coordinate of the lower left corner of the new MediaBox.\n * @param width The width of the new MediaBox.\n * @param height The height of the new MediaBox.\n */\n PDFPage.prototype.setMediaBox = function (x, y, width, height) {\n assertIs(x, 'x', ['number']);\n assertIs(y, 'y', ['number']);\n assertIs(width, 'width', ['number']);\n assertIs(height, 'height', ['number']);\n var mediaBox = this.doc.context.obj([x, y, x + width, y + height]);\n this.node.set(PDFName.MediaBox, mediaBox);\n };\n /**\n * Set the CropBox of this page. For example:\n * ```js\n * const cropBox = page.getCropBox()\n *\n * page.setCropBox(0, 0, 250, 500)\n * page.setCropBox(cropBox.x, cropBox.y, 50, 100)\n * page.setCropBox(15, 5, cropBox.width - 50, cropBox.height - 100)\n * ```\n *\n * See [[PDFPage.getCropBox]] for details about what the CropBox represents.\n *\n * @param x The x coordinate of the lower left corner of the new CropBox.\n * @param y The y coordinate of the lower left corner of the new CropBox.\n * @param width The width of the new CropBox.\n * @param height The height of the new CropBox.\n */\n PDFPage.prototype.setCropBox = function (x, y, width, height) {\n assertIs(x, 'x', ['number']);\n assertIs(y, 'y', ['number']);\n assertIs(width, 'width', ['number']);\n assertIs(height, 'height', ['number']);\n var cropBox = this.doc.context.obj([x, y, x + width, y + height]);\n this.node.set(PDFName.CropBox, cropBox);\n };\n /**\n * Set the BleedBox of this page. For example:\n * ```js\n * const bleedBox = page.getBleedBox()\n *\n * page.setBleedBox(0, 0, 250, 500)\n * page.setBleedBox(bleedBox.x, bleedBox.y, 50, 100)\n * page.setBleedBox(15, 5, bleedBox.width - 50, bleedBox.height - 100)\n * ```\n *\n * See [[PDFPage.getBleedBox]] for details about what the BleedBox represents.\n *\n * @param x The x coordinate of the lower left corner of the new BleedBox.\n * @param y The y coordinate of the lower left corner of the new BleedBox.\n * @param width The width of the new BleedBox.\n * @param height The height of the new BleedBox.\n */\n PDFPage.prototype.setBleedBox = function (x, y, width, height) {\n assertIs(x, 'x', ['number']);\n assertIs(y, 'y', ['number']);\n assertIs(width, 'width', ['number']);\n assertIs(height, 'height', ['number']);\n var bleedBox = this.doc.context.obj([x, y, x + width, y + height]);\n this.node.set(PDFName.BleedBox, bleedBox);\n };\n /**\n * Set the TrimBox of this page. For example:\n * ```js\n * const trimBox = page.getTrimBox()\n *\n * page.setTrimBox(0, 0, 250, 500)\n * page.setTrimBox(trimBox.x, trimBox.y, 50, 100)\n * page.setTrimBox(15, 5, trimBox.width - 50, trimBox.height - 100)\n * ```\n *\n * See [[PDFPage.getTrimBox]] for details about what the TrimBox represents.\n *\n * @param x The x coordinate of the lower left corner of the new TrimBox.\n * @param y The y coordinate of the lower left corner of the new TrimBox.\n * @param width The width of the new TrimBox.\n * @param height The height of the new TrimBox.\n */\n PDFPage.prototype.setTrimBox = function (x, y, width, height) {\n assertIs(x, 'x', ['number']);\n assertIs(y, 'y', ['number']);\n assertIs(width, 'width', ['number']);\n assertIs(height, 'height', ['number']);\n var trimBox = this.doc.context.obj([x, y, x + width, y + height]);\n this.node.set(PDFName.TrimBox, trimBox);\n };\n /**\n * Set the ArtBox of this page. For example:\n * ```js\n * const artBox = page.getArtBox()\n *\n * page.setArtBox(0, 0, 250, 500)\n * page.setArtBox(artBox.x, artBox.y, 50, 100)\n * page.setArtBox(15, 5, artBox.width - 50, artBox.height - 100)\n * ```\n *\n * See [[PDFPage.getArtBox]] for details about what the ArtBox represents.\n *\n * @param x The x coordinate of the lower left corner of the new ArtBox.\n * @param y The y coordinate of the lower left corner of the new ArtBox.\n * @param width The width of the new ArtBox.\n * @param height The height of the new ArtBox.\n */\n PDFPage.prototype.setArtBox = function (x, y, width, height) {\n assertIs(x, 'x', ['number']);\n assertIs(y, 'y', ['number']);\n assertIs(width, 'width', ['number']);\n assertIs(height, 'height', ['number']);\n var artBox = this.doc.context.obj([x, y, x + width, y + height]);\n this.node.set(PDFName.ArtBox, artBox);\n };\n /**\n * Get this page's width and height. For example:\n * ```js\n * const { width, height } = page.getSize()\n * ```\n *\n * This method uses [[PDFPage.getMediaBox]] to obtain the page's\n * width and height.\n *\n * @returns The width and height of the page.\n */\n PDFPage.prototype.getSize = function () {\n var _a = this.getMediaBox(), width = _a.width, height = _a.height;\n return { width: width, height: height };\n };\n /**\n * Get this page's width. For example:\n * ```js\n * const width = page.getWidth()\n * ```\n *\n * This method uses [[PDFPage.getSize]] to obtain the page's size.\n *\n * @returns The width of the page.\n */\n PDFPage.prototype.getWidth = function () {\n return this.getSize().width;\n };\n /**\n * Get this page's height. For example:\n * ```js\n * const height = page.getHeight()\n * ```\n *\n * This method uses [[PDFPage.getSize]] to obtain the page's size.\n *\n * @returns The height of the page.\n */\n PDFPage.prototype.getHeight = function () {\n return this.getSize().height;\n };\n /**\n * Get the rectangle defining this page's MediaBox. For example:\n * ```js\n * const { x, y, width, height } = page.getMediaBox()\n * ```\n *\n * The MediaBox of a page defines the boundaries of the physical medium on\n * which the page is to be displayed/printed. It may include extended area\n * surrounding the page content for bleed marks, printing marks, etc...\n * It may also include areas close to the edges of the medium that cannot be\n * marked because of physical limitations of the output device. Content\n * falling outside this boundary may safely be discarded without affecting\n * the meaning of the PDF file.\n *\n * @returns An object defining the lower left corner of the MediaBox and its\n * width & height.\n */\n PDFPage.prototype.getMediaBox = function () {\n var mediaBox = this.node.MediaBox();\n return mediaBox.asRectangle();\n };\n /**\n * Get the rectangle defining this page's CropBox. For example:\n * ```js\n * const { x, y, width, height } = page.getCropBox()\n * ```\n *\n * The CropBox of a page defines the region to which the contents of the page\n * shall be clipped when displayed or printed. Unlike the other boxes, the\n * CropBox does not necessarily represent the physical page geometry. It\n * merely imposes clipping on the page contents.\n *\n * The CropBox's default value is the page's MediaBox.\n *\n * @returns An object defining the lower left corner of the CropBox and its\n * width & height.\n */\n PDFPage.prototype.getCropBox = function () {\n var _a;\n var cropBox = this.node.CropBox();\n return (_a = cropBox === null || cropBox === void 0 ? void 0 : cropBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getMediaBox();\n };\n /**\n * Get the rectangle defining this page's BleedBox. For example:\n * ```js\n * const { x, y, width, height } = page.getBleedBox()\n * ```\n *\n * The BleedBox of a page defines the region to which the contents of the\n * page shall be clipped when output in a production environment. This may\n * include any extra bleed area needed to accommodate the physical\n * limitations of cutting, folding, and trimming equipment. The actual\n * printed page may include printing marks that fall outside the BleedBox.\n *\n * The BleedBox's default value is the page's CropBox.\n *\n * @returns An object defining the lower left corner of the BleedBox and its\n * width & height.\n */\n PDFPage.prototype.getBleedBox = function () {\n var _a;\n var bleedBox = this.node.BleedBox();\n return (_a = bleedBox === null || bleedBox === void 0 ? void 0 : bleedBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();\n };\n /**\n * Get the rectangle defining this page's TrimBox. For example:\n * ```js\n * const { x, y, width, height } = page.getTrimBox()\n * ```\n *\n * The TrimBox of a page defines the intended dimensions of the finished\n * page after trimming. It may be smaller than the MediaBox to allow for\n * production-related content, such as printing instructions, cut marks, or\n * color bars.\n *\n * The TrimBox's default value is the page's CropBox.\n *\n * @returns An object defining the lower left corner of the TrimBox and its\n * width & height.\n */\n PDFPage.prototype.getTrimBox = function () {\n var _a;\n var trimBox = this.node.TrimBox();\n return (_a = trimBox === null || trimBox === void 0 ? void 0 : trimBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();\n };\n /**\n * Get the rectangle defining this page's ArtBox. For example:\n * ```js\n * const { x, y, width, height } = page.getArtBox()\n * ```\n *\n * The ArtBox of a page defines the extent of the page's meaningful content\n * (including potential white space).\n *\n * The ArtBox's default value is the page's CropBox.\n *\n * @returns An object defining the lower left corner of the ArtBox and its\n * width & height.\n */\n PDFPage.prototype.getArtBox = function () {\n var _a;\n var artBox = this.node.ArtBox();\n return (_a = artBox === null || artBox === void 0 ? void 0 : artBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();\n };\n /**\n * Translate this page's content to a new location on the page. This operation\n * is often useful after resizing the page with [[setSize]]. For example:\n * ```js\n * // Add 50 units of whitespace to the top and right of the page\n * page.setSize(page.getWidth() + 50, page.getHeight() + 50)\n *\n * // Move the page's content from the lower-left corner of the page\n * // to the top-right corner.\n * page.translateContent(50, 50)\n *\n * // Now there are 50 units of whitespace to the left and bottom of the page\n * ```\n * See also: [[resetPosition]]\n * @param x The new position on the x-axis for this page's content.\n * @param y The new position on the y-axis for this page's content.\n */\n PDFPage.prototype.translateContent = function (x, y) {\n assertIs(x, 'x', ['number']);\n assertIs(y, 'y', ['number']);\n this.node.normalize();\n this.getContentStream();\n var start = this.createContentStream(pushGraphicsState(), translate(x, y));\n var startRef = this.doc.context.register(start);\n var end = this.createContentStream(popGraphicsState());\n var endRef = this.doc.context.register(end);\n this.node.wrapContentStreams(startRef, endRef);\n };\n /**\n * Scale the size, content, and annotations of a page.\n *\n * For example:\n * ```js\n * page.scale(0.5, 0.5);\n * ```\n *\n * @param x The factor by which the width for the page should be scaled\n * (e.g. `0.5` is 50%).\n * @param y The factor by which the height for the page should be scaled\n * (e.g. `2.0` is 200%).\n */\n PDFPage.prototype.scale = function (x, y) {\n assertIs(x, 'x', ['number']);\n assertIs(y, 'y', ['number']);\n this.setSize(this.getWidth() * x, this.getHeight() * y);\n this.scaleContent(x, y);\n this.scaleAnnotations(x, y);\n };\n /**\n * Scale the content of a page. This is useful after resizing an existing\n * page. This scales only the content, not the annotations.\n *\n * For example:\n * ```js\n * // Bisect the size of the page\n * page.setSize(page.getWidth() / 2, page.getHeight() / 2);\n *\n * // Scale the content of the page down by 50% in x and y\n * page.scaleContent(0.5, 0.5);\n * ```\n * See also: [[scaleAnnotations]]\n * @param x The factor by which the x-axis for the content should be scaled\n * (e.g. `0.5` is 50%).\n * @param y The factor by which the y-axis for the content should be scaled\n * (e.g. `2.0` is 200%).\n */\n PDFPage.prototype.scaleContent = function (x, y) {\n assertIs(x, 'x', ['number']);\n assertIs(y, 'y', ['number']);\n this.node.normalize();\n this.getContentStream();\n var start = this.createContentStream(pushGraphicsState(), scale(x, y));\n var startRef = this.doc.context.register(start);\n var end = this.createContentStream(popGraphicsState());\n var endRef = this.doc.context.register(end);\n this.node.wrapContentStreams(startRef, endRef);\n };\n /**\n * Scale the annotations of a page. This is useful if you want to scale a\n * page with comments or other annotations.\n * ```js\n * // Scale the content of the page down by 50% in x and y\n * page.scaleContent(0.5, 0.5);\n *\n * // Scale the content of the page down by 50% in x and y\n * page.scaleAnnotations(0.5, 0.5);\n * ```\n * See also: [[scaleContent]]\n * @param x The factor by which the x-axis for the annotations should be\n * scaled (e.g. `0.5` is 50%).\n * @param y The factor by which the y-axis for the annotations should be\n * scaled (e.g. `2.0` is 200%).\n */\n PDFPage.prototype.scaleAnnotations = function (x, y) {\n assertIs(x, 'x', ['number']);\n assertIs(y, 'y', ['number']);\n var annots = this.node.Annots();\n if (!annots)\n return;\n for (var idx = 0; idx < annots.size(); idx++) {\n var annot = annots.lookup(idx);\n if (annot instanceof PDFDict)\n this.scaleAnnot(annot, x, y);\n }\n };\n /**\n * Reset the x and y coordinates of this page to `(0, 0)`. This operation is\n * often useful after calling [[translateContent]]. For example:\n * ```js\n * // Shift the page's contents up and to the right by 50 units\n * page.translateContent(50, 50)\n *\n * // This text will shifted - it will be drawn at (50, 50)\n * page.drawText('I am shifted')\n *\n * // Move back to (0, 0)\n * page.resetPosition()\n *\n * // This text will not be shifted - it will be drawn at (0, 0)\n * page.drawText('I am not shifted')\n * ```\n */\n PDFPage.prototype.resetPosition = function () {\n this.getContentStream(false);\n this.x = 0;\n this.y = 0;\n };\n /**\n * Choose a default font for this page. The default font will be used whenever\n * text is drawn on this page and no font is specified. For example:\n * ```js\n * import { StandardFonts } from 'pdf-lib'\n *\n * const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)\n * const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const courierFont = await pdfDoc.embedFont(StandardFonts.Courier)\n *\n * const page = pdfDoc.addPage()\n *\n * page.setFont(helveticaFont)\n * page.drawText('I will be drawn in Helvetica')\n *\n * page.setFont(timesRomanFont)\n * page.drawText('I will be drawn in Courier', { font: courierFont })\n * ```\n * @param font The default font to be used when drawing text on this page.\n */\n PDFPage.prototype.setFont = function (font) {\n // TODO: Reuse image Font name if we've already added this image to Resources.Fonts\n assertIs(font, 'font', [[PDFFont, 'PDFFont']]);\n this.font = font;\n this.fontKey = this.node.newFontDictionary(this.font.name, this.font.ref);\n };\n /**\n * Choose a default font size for this page. The default font size will be\n * used whenever text is drawn on this page and no font size is specified.\n * For example:\n * ```js\n * page.setFontSize(12)\n * page.drawText('I will be drawn in size 12')\n *\n * page.setFontSize(36)\n * page.drawText('I will be drawn in size 24', { fontSize: 24 })\n * ```\n * @param fontSize The default font size to be used when drawing text on this\n * page.\n */\n PDFPage.prototype.setFontSize = function (fontSize) {\n assertIs(fontSize, 'fontSize', ['number']);\n this.fontSize = fontSize;\n };\n /**\n * Choose a default font color for this page. The default font color will be\n * used whenever text is drawn on this page and no font color is specified.\n * For example:\n * ```js\n * import { rgb, cmyk, grayscale } from 'pdf-lib'\n *\n * page.setFontColor(rgb(0.97, 0.02, 0.97))\n * page.drawText('I will be drawn in pink')\n *\n * page.setFontColor(cmyk(0.4, 0.7, 0.39, 0.15))\n * page.drawText('I will be drawn in gray', { color: grayscale(0.5) })\n * ```\n * @param fontColor The default font color to be used when drawing text on\n * this page.\n */\n PDFPage.prototype.setFontColor = function (fontColor) {\n assertIs(fontColor, 'fontColor', [[Object, 'Color']]);\n this.fontColor = fontColor;\n };\n /**\n * Choose a default line height for this page. The default line height will be\n * used whenever text is drawn on this page and no line height is specified.\n * For example:\n * ```js\n * page.setLineHeight(12);\n * page.drawText('These lines will be vertically \\n separated by 12 units')\n *\n * page.setLineHeight(36);\n * page.drawText('These lines will be vertically \\n separated by 24 units', {\n * lineHeight: 24\n * })\n * ```\n * @param lineHeight The default line height to be used when drawing text on\n * this page.\n */\n PDFPage.prototype.setLineHeight = function (lineHeight) {\n assertIs(lineHeight, 'lineHeight', ['number']);\n this.lineHeight = lineHeight;\n };\n /**\n * Get the default position of this page. For example:\n * ```js\n * const { x, y } = page.getPosition()\n * ```\n * @returns The default position of the page.\n */\n PDFPage.prototype.getPosition = function () {\n return { x: this.x, y: this.y };\n };\n /**\n * Get the default x coordinate of this page. For example:\n * ```js\n * const x = page.getX()\n * ```\n * @returns The default x coordinate of the page.\n */\n PDFPage.prototype.getX = function () {\n return this.x;\n };\n /**\n * Get the default y coordinate of this page. For example:\n * ```js\n * const y = page.getY()\n * ```\n * @returns The default y coordinate of the page.\n */\n PDFPage.prototype.getY = function () {\n return this.y;\n };\n /**\n * Change the default position of this page. For example:\n * ```js\n * page.moveTo(0, 0)\n * page.drawText('I will be drawn at the origin')\n *\n * page.moveTo(0, 25)\n * page.drawText('I will be drawn 25 units up')\n *\n * page.moveTo(25, 25)\n * page.drawText('I will be drawn 25 units up and 25 units to the right')\n * ```\n * @param x The new default position on the x-axis for this page.\n * @param y The new default position on the y-axis for this page.\n */\n PDFPage.prototype.moveTo = function (x, y) {\n assertIs(x, 'x', ['number']);\n assertIs(y, 'y', ['number']);\n this.x = x;\n this.y = y;\n };\n /**\n * Change the default position of this page to be further down the y-axis.\n * For example:\n * ```js\n * page.moveTo(50, 50)\n * page.drawText('I will be drawn at (50, 50)')\n *\n * page.moveDown(10)\n * page.drawText('I will be drawn at (50, 40)')\n * ```\n * @param yDecrease The amount by which the page's default position along the\n * y-axis should be decreased.\n */\n PDFPage.prototype.moveDown = function (yDecrease) {\n assertIs(yDecrease, 'yDecrease', ['number']);\n this.y -= yDecrease;\n };\n /**\n * Change the default position of this page to be further up the y-axis.\n * For example:\n * ```js\n * page.moveTo(50, 50)\n * page.drawText('I will be drawn at (50, 50)')\n *\n * page.moveUp(10)\n * page.drawText('I will be drawn at (50, 60)')\n * ```\n * @param yIncrease The amount by which the page's default position along the\n * y-axis should be increased.\n */\n PDFPage.prototype.moveUp = function (yIncrease) {\n assertIs(yIncrease, 'yIncrease', ['number']);\n this.y += yIncrease;\n };\n /**\n * Change the default position of this page to be further left on the x-axis.\n * For example:\n * ```js\n * page.moveTo(50, 50)\n * page.drawText('I will be drawn at (50, 50)')\n *\n * page.moveLeft(10)\n * page.drawText('I will be drawn at (40, 50)')\n * ```\n * @param xDecrease The amount by which the page's default position along the\n * x-axis should be decreased.\n */\n PDFPage.prototype.moveLeft = function (xDecrease) {\n assertIs(xDecrease, 'xDecrease', ['number']);\n this.x -= xDecrease;\n };\n /**\n * Change the default position of this page to be further right on the y-axis.\n * For example:\n * ```js\n * page.moveTo(50, 50)\n * page.drawText('I will be drawn at (50, 50)')\n *\n * page.moveRight(10)\n * page.drawText('I will be drawn at (60, 50)')\n * ```\n * @param xIncrease The amount by which the page's default position along the\n * x-axis should be increased.\n */\n PDFPage.prototype.moveRight = function (xIncrease) {\n assertIs(xIncrease, 'xIncrease', ['number']);\n this.x += xIncrease;\n };\n /**\n * Push one or more operators to the end of this page's current content\n * stream. For example:\n * ```js\n * import {\n * pushGraphicsState,\n * moveTo,\n * lineTo,\n * closePath,\n * setFillingColor,\n * rgb,\n * fill,\n * popGraphicsState,\n * } from 'pdf-lib'\n *\n * // Draw a green triangle in the lower-left corner of the page\n * page.pushOperators(\n * pushGraphicsState(),\n * moveTo(0, 0),\n * lineTo(100, 0),\n * lineTo(50, 100),\n * closePath(),\n * setFillingColor(rgb(0.0, 1.0, 0.0)),\n * fill(),\n * popGraphicsState(),\n * )\n * ```\n * @param operator The operators to be pushed.\n */\n PDFPage.prototype.pushOperators = function () {\n var operator = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n operator[_i] = arguments[_i];\n }\n assertEachIs(operator, 'operator', [[PDFOperator, 'PDFOperator']]);\n var contentStream = this.getContentStream();\n contentStream.push.apply(contentStream, operator);\n };\n /**\n * Draw one or more lines of text on this page. For example:\n * ```js\n * import { StandardFonts, rgb } from 'pdf-lib'\n *\n * const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)\n *\n * const page = pdfDoc.addPage()\n *\n * page.setFont(helveticaFont)\n *\n * page.moveTo(5, 200)\n * page.drawText('The Life of an Egg', { size: 36 })\n *\n * page.moveDown(36)\n * page.drawText('An Epic Tale of Woe', { size: 30 })\n *\n * page.drawText(\n * `Humpty Dumpty sat on a wall \\n` +\n * `Humpty Dumpty had a great fall; \\n` +\n * `All the king's horses and all the king's men \\n` +\n * `Couldn't put Humpty together again. \\n`,\n * {\n * x: 25,\n * y: 100,\n * font: timesRomanFont,\n * size: 24,\n * color: rgb(1, 0, 0),\n * lineHeight: 24,\n * opacity: 0.75,\n * },\n * )\n * ```\n * @param text The text to be drawn.\n * @param options The options to be used when drawing the text.\n */\n PDFPage.prototype.drawText = function (text, options) {\n var _a, _b, _c, _d, _e, _f, _g;\n if (options === void 0) { options = {}; }\n assertIs(text, 'text', ['string']);\n assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);\n assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);\n assertOrUndefined(options.font, 'options.font', [[PDFFont, 'PDFFont']]);\n assertOrUndefined(options.size, 'options.size', ['number']);\n assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);\n assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);\n assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);\n assertOrUndefined(options.x, 'options.x', ['number']);\n assertOrUndefined(options.y, 'options.y', ['number']);\n assertOrUndefined(options.lineHeight, 'options.lineHeight', ['number']);\n assertOrUndefined(options.maxWidth, 'options.maxWidth', ['number']);\n assertOrUndefined(options.wordBreaks, 'options.wordBreaks', [Array]);\n assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', BlendMode);\n var _h = this.setOrEmbedFont(options.font), oldFont = _h.oldFont, newFont = _h.newFont, newFontKey = _h.newFontKey;\n var fontSize = options.size || this.fontSize;\n var wordBreaks = options.wordBreaks || this.doc.defaultWordBreaks;\n var textWidth = function (t) { return newFont.widthOfTextAtSize(t, fontSize); };\n var lines = options.maxWidth === undefined\n ? lineSplit(cleanText(text))\n : breakTextIntoLines(text, wordBreaks, options.maxWidth, textWidth);\n var encodedLines = new Array(lines.length);\n for (var idx = 0, len = lines.length; idx < len; idx++) {\n encodedLines[idx] = newFont.encodeText(lines[idx]);\n }\n var graphicsStateKey = this.maybeEmbedGraphicsState({\n opacity: options.opacity,\n blendMode: options.blendMode,\n });\n var contentStream = this.getContentStream();\n contentStream.push.apply(contentStream, drawLinesOfText(encodedLines, {\n color: (_a = options.color) !== null && _a !== void 0 ? _a : this.fontColor,\n font: newFontKey,\n size: fontSize,\n rotate: (_b = options.rotate) !== null && _b !== void 0 ? _b : degrees(0),\n xSkew: (_c = options.xSkew) !== null && _c !== void 0 ? _c : degrees(0),\n ySkew: (_d = options.ySkew) !== null && _d !== void 0 ? _d : degrees(0),\n x: (_e = options.x) !== null && _e !== void 0 ? _e : this.x,\n y: (_f = options.y) !== null && _f !== void 0 ? _f : this.y,\n lineHeight: (_g = options.lineHeight) !== null && _g !== void 0 ? _g : this.lineHeight,\n graphicsState: graphicsStateKey,\n }));\n if (options.font) {\n if (oldFont)\n this.setFont(oldFont);\n else\n this.resetFont();\n }\n };\n /**\n * Draw an image on this page. For example:\n * ```js\n * import { degrees } from 'pdf-lib'\n *\n * const jpgUrl = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg'\n * const jpgImageBytes = await fetch(jpgUrl).then((res) => res.arrayBuffer())\n *\n * const jpgImage = await pdfDoc.embedJpg(jpgImageBytes)\n * const jpgDims = jpgImage.scale(0.5)\n *\n * const page = pdfDoc.addPage()\n *\n * page.drawImage(jpgImage, {\n * x: 25,\n * y: 25,\n * width: jpgDims.width,\n * height: jpgDims.height,\n * rotate: degrees(30),\n * opacity: 0.75,\n * })\n * ```\n * @param image The image to be drawn.\n * @param options The options to be used when drawing the image.\n */\n PDFPage.prototype.drawImage = function (image, options) {\n var _a, _b, _c, _d, _e, _f, _g;\n if (options === void 0) { options = {}; }\n // TODO: Reuse image XObject name if we've already added this image to Resources.XObjects\n assertIs(image, 'image', [[PDFImage, 'PDFImage']]);\n assertOrUndefined(options.x, 'options.x', ['number']);\n assertOrUndefined(options.y, 'options.y', ['number']);\n assertOrUndefined(options.width, 'options.width', ['number']);\n assertOrUndefined(options.height, 'options.height', ['number']);\n assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);\n assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);\n assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);\n assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);\n assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', BlendMode);\n var xObjectKey = this.node.newXObject('Image', image.ref);\n var graphicsStateKey = this.maybeEmbedGraphicsState({\n opacity: options.opacity,\n blendMode: options.blendMode,\n });\n var contentStream = this.getContentStream();\n contentStream.push.apply(contentStream, drawImage(xObjectKey, {\n x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,\n y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,\n width: (_c = options.width) !== null && _c !== void 0 ? _c : image.size().width,\n height: (_d = options.height) !== null && _d !== void 0 ? _d : image.size().height,\n rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : degrees(0),\n xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : degrees(0),\n ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : degrees(0),\n graphicsState: graphicsStateKey,\n }));\n };\n /**\n * Draw an embedded PDF page on this page. For example:\n * ```js\n * import { degrees } from 'pdf-lib'\n *\n * const pdfDoc = await PDFDocument.create()\n * const page = pdfDoc.addPage()\n *\n * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf'\n * const sourcePdf = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer())\n *\n * // Embed page 74 from the PDF\n * const [embeddedPage] = await pdfDoc.embedPdf(sourcePdf, 73)\n *\n * page.drawPage(embeddedPage, {\n * x: 250,\n * y: 200,\n * xScale: 0.5,\n * yScale: 0.5,\n * rotate: degrees(30),\n * opacity: 0.75,\n * })\n * ```\n *\n * The `options` argument accepts both `width`/`height` and `xScale`/`yScale`\n * as options. Since each of these options defines the size of the drawn page,\n * if both options are given, `width` and `height` take precedence and the\n * corresponding scale variants are ignored.\n *\n * @param embeddedPage The embedded page to be drawn.\n * @param options The options to be used when drawing the embedded page.\n */\n PDFPage.prototype.drawPage = function (embeddedPage, options) {\n var _a, _b, _c, _d, _e;\n if (options === void 0) { options = {}; }\n // TODO: Reuse embeddedPage XObject name if we've already added this embeddedPage to Resources.XObjects\n assertIs(embeddedPage, 'embeddedPage', [\n [PDFEmbeddedPage, 'PDFEmbeddedPage'],\n ]);\n assertOrUndefined(options.x, 'options.x', ['number']);\n assertOrUndefined(options.y, 'options.y', ['number']);\n assertOrUndefined(options.xScale, 'options.xScale', ['number']);\n assertOrUndefined(options.yScale, 'options.yScale', ['number']);\n assertOrUndefined(options.width, 'options.width', ['number']);\n assertOrUndefined(options.height, 'options.height', ['number']);\n assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);\n assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);\n assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);\n assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);\n assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', BlendMode);\n var xObjectKey = this.node.newXObject('EmbeddedPdfPage', embeddedPage.ref);\n var graphicsStateKey = this.maybeEmbedGraphicsState({\n opacity: options.opacity,\n blendMode: options.blendMode,\n });\n // prettier-ignore\n var xScale = (options.width !== undefined ? options.width / embeddedPage.width\n : options.xScale !== undefined ? options.xScale\n : 1);\n // prettier-ignore\n var yScale = (options.height !== undefined ? options.height / embeddedPage.height\n : options.yScale !== undefined ? options.yScale\n : 1);\n var contentStream = this.getContentStream();\n contentStream.push.apply(contentStream, drawPage(xObjectKey, {\n x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,\n y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,\n xScale: xScale,\n yScale: yScale,\n rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : degrees(0),\n xSkew: (_d = options.xSkew) !== null && _d !== void 0 ? _d : degrees(0),\n ySkew: (_e = options.ySkew) !== null && _e !== void 0 ? _e : degrees(0),\n graphicsState: graphicsStateKey,\n }));\n };\n /**\n * Draw an SVG path on this page. For example:\n * ```js\n * import { rgb } from 'pdf-lib'\n *\n * const svgPath = 'M 0,20 L 100,160 Q 130,200 150,120 C 190,-40 200,200 300,150 L 400,90'\n *\n * // Draw path as black line\n * page.drawSvgPath(svgPath, { x: 25, y: 75 })\n *\n * // Change border style and opacity\n * page.drawSvgPath(svgPath, {\n * x: 25,\n * y: 275,\n * borderColor: rgb(0.5, 0.5, 0.5),\n * borderWidth: 2,\n * borderOpacity: 0.75,\n * })\n *\n * // Set fill color and opacity\n * page.drawSvgPath(svgPath, {\n * x: 25,\n * y: 475,\n * color: rgb(1.0, 0, 0),\n * opacity: 0.75,\n * })\n *\n * // Draw 50% of original size\n * page.drawSvgPath(svgPath, {\n * x: 25,\n * y: 675,\n * scale: 0.5,\n * })\n * ```\n * @param path The SVG path to be drawn.\n * @param options The options to be used when drawing the SVG path.\n */\n PDFPage.prototype.drawSvgPath = function (path, options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n if (options === void 0) { options = {}; }\n assertIs(path, 'path', ['string']);\n assertOrUndefined(options.x, 'options.x', ['number']);\n assertOrUndefined(options.y, 'options.y', ['number']);\n assertOrUndefined(options.scale, 'options.scale', ['number']);\n assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);\n assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']);\n assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);\n assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);\n assertOrUndefined(options.borderColor, 'options.borderColor', [\n [Object, 'Color'],\n ]);\n assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [\n Array,\n ]);\n assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [\n 'number',\n ]);\n assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', LineCapStyle);\n assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1);\n assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', BlendMode);\n var graphicsStateKey = this.maybeEmbedGraphicsState({\n opacity: options.opacity,\n borderOpacity: options.borderOpacity,\n blendMode: options.blendMode,\n });\n if (!('color' in options) && !('borderColor' in options)) {\n options.borderColor = rgb(0, 0, 0);\n }\n var contentStream = this.getContentStream();\n contentStream.push.apply(contentStream, drawSvgPath(path, {\n x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,\n y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,\n scale: options.scale,\n rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : degrees(0),\n color: (_d = options.color) !== null && _d !== void 0 ? _d : undefined,\n borderColor: (_e = options.borderColor) !== null && _e !== void 0 ? _e : undefined,\n borderWidth: (_f = options.borderWidth) !== null && _f !== void 0 ? _f : 0,\n borderDashArray: (_g = options.borderDashArray) !== null && _g !== void 0 ? _g : undefined,\n borderDashPhase: (_h = options.borderDashPhase) !== null && _h !== void 0 ? _h : undefined,\n borderLineCap: (_j = options.borderLineCap) !== null && _j !== void 0 ? _j : undefined,\n graphicsState: graphicsStateKey,\n }));\n };\n /**\n * Draw a line on this page. For example:\n * ```js\n * import { rgb } from 'pdf-lib'\n *\n * page.drawLine({\n * start: { x: 25, y: 75 },\n * end: { x: 125, y: 175 },\n * thickness: 2,\n * color: rgb(0.75, 0.2, 0.2),\n * opacity: 0.75,\n * })\n * ```\n * @param options The options to be used when drawing the line.\n */\n PDFPage.prototype.drawLine = function (options) {\n var _a, _b, _c, _d, _e;\n assertIs(options.start, 'options.start', [\n [Object, '{ x: number, y: number }'],\n ]);\n assertIs(options.end, 'options.end', [\n [Object, '{ x: number, y: number }'],\n ]);\n assertIs(options.start.x, 'options.start.x', ['number']);\n assertIs(options.start.y, 'options.start.y', ['number']);\n assertIs(options.end.x, 'options.end.x', ['number']);\n assertIs(options.end.y, 'options.end.y', ['number']);\n assertOrUndefined(options.thickness, 'options.thickness', ['number']);\n assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);\n assertOrUndefined(options.dashArray, 'options.dashArray', [Array]);\n assertOrUndefined(options.dashPhase, 'options.dashPhase', ['number']);\n assertIsOneOfOrUndefined(options.lineCap, 'options.lineCap', LineCapStyle);\n assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);\n assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', BlendMode);\n var graphicsStateKey = this.maybeEmbedGraphicsState({\n borderOpacity: options.opacity,\n blendMode: options.blendMode,\n });\n if (!('color' in options)) {\n options.color = rgb(0, 0, 0);\n }\n var contentStream = this.getContentStream();\n contentStream.push.apply(contentStream, drawLine({\n start: options.start,\n end: options.end,\n thickness: (_a = options.thickness) !== null && _a !== void 0 ? _a : 1,\n color: (_b = options.color) !== null && _b !== void 0 ? _b : undefined,\n dashArray: (_c = options.dashArray) !== null && _c !== void 0 ? _c : undefined,\n dashPhase: (_d = options.dashPhase) !== null && _d !== void 0 ? _d : undefined,\n lineCap: (_e = options.lineCap) !== null && _e !== void 0 ? _e : undefined,\n graphicsState: graphicsStateKey,\n }));\n };\n /**\n * Draw a rectangle on this page. For example:\n * ```js\n * import { degrees, grayscale, rgb } from 'pdf-lib'\n *\n * page.drawRectangle({\n * x: 25,\n * y: 75,\n * width: 250,\n * height: 75,\n * rotate: degrees(-15),\n * borderWidth: 5,\n * borderColor: grayscale(0.5),\n * color: rgb(0.75, 0.2, 0.2),\n * opacity: 0.5,\n * borderOpacity: 0.75,\n * })\n * ```\n * @param options The options to be used when drawing the rectangle.\n */\n PDFPage.prototype.drawRectangle = function (options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;\n if (options === void 0) { options = {}; }\n assertOrUndefined(options.x, 'options.x', ['number']);\n assertOrUndefined(options.y, 'options.y', ['number']);\n assertOrUndefined(options.width, 'options.width', ['number']);\n assertOrUndefined(options.height, 'options.height', ['number']);\n assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);\n assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);\n assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);\n assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']);\n assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);\n assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);\n assertOrUndefined(options.borderColor, 'options.borderColor', [\n [Object, 'Color'],\n ]);\n assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [\n Array,\n ]);\n assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [\n 'number',\n ]);\n assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', LineCapStyle);\n assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1);\n assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', BlendMode);\n var graphicsStateKey = this.maybeEmbedGraphicsState({\n opacity: options.opacity,\n borderOpacity: options.borderOpacity,\n blendMode: options.blendMode,\n });\n if (!('color' in options) && !('borderColor' in options)) {\n options.color = rgb(0, 0, 0);\n }\n var contentStream = this.getContentStream();\n contentStream.push.apply(contentStream, drawRectangle({\n x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,\n y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,\n width: (_c = options.width) !== null && _c !== void 0 ? _c : 150,\n height: (_d = options.height) !== null && _d !== void 0 ? _d : 100,\n rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : degrees(0),\n xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : degrees(0),\n ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : degrees(0),\n borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0,\n color: (_j = options.color) !== null && _j !== void 0 ? _j : undefined,\n borderColor: (_k = options.borderColor) !== null && _k !== void 0 ? _k : undefined,\n borderDashArray: (_l = options.borderDashArray) !== null && _l !== void 0 ? _l : undefined,\n borderDashPhase: (_m = options.borderDashPhase) !== null && _m !== void 0 ? _m : undefined,\n graphicsState: graphicsStateKey,\n borderLineCap: (_o = options.borderLineCap) !== null && _o !== void 0 ? _o : undefined,\n }));\n };\n /**\n * Draw a square on this page. For example:\n * ```js\n * import { degrees, grayscale, rgb } from 'pdf-lib'\n *\n * page.drawSquare({\n * x: 25,\n * y: 75,\n * size: 100,\n * rotate: degrees(-15),\n * borderWidth: 5,\n * borderColor: grayscale(0.5),\n * color: rgb(0.75, 0.2, 0.2),\n * opacity: 0.5,\n * borderOpacity: 0.75,\n * })\n * ```\n * @param options The options to be used when drawing the square.\n */\n PDFPage.prototype.drawSquare = function (options) {\n if (options === void 0) { options = {}; }\n var size = options.size;\n assertOrUndefined(size, 'size', ['number']);\n this.drawRectangle(__assign(__assign({}, options), { width: size, height: size }));\n };\n /**\n * Draw an ellipse on this page. For example:\n * ```js\n * import { grayscale, rgb } from 'pdf-lib'\n *\n * page.drawEllipse({\n * x: 200,\n * y: 75,\n * xScale: 100,\n * yScale: 50,\n * borderWidth: 5,\n * borderColor: grayscale(0.5),\n * color: rgb(0.75, 0.2, 0.2),\n * opacity: 0.5,\n * borderOpacity: 0.75,\n * })\n * ```\n * @param options The options to be used when drawing the ellipse.\n */\n PDFPage.prototype.drawEllipse = function (options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\n if (options === void 0) { options = {}; }\n assertOrUndefined(options.x, 'options.x', ['number']);\n assertOrUndefined(options.y, 'options.y', ['number']);\n assertOrUndefined(options.xScale, 'options.xScale', ['number']);\n assertOrUndefined(options.yScale, 'options.yScale', ['number']);\n assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);\n assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);\n assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);\n assertOrUndefined(options.borderColor, 'options.borderColor', [\n [Object, 'Color'],\n ]);\n assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1);\n assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']);\n assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [\n Array,\n ]);\n assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [\n 'number',\n ]);\n assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', LineCapStyle);\n assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', BlendMode);\n var graphicsStateKey = this.maybeEmbedGraphicsState({\n opacity: options.opacity,\n borderOpacity: options.borderOpacity,\n blendMode: options.blendMode,\n });\n if (!('color' in options) && !('borderColor' in options)) {\n options.color = rgb(0, 0, 0);\n }\n var contentStream = this.getContentStream();\n contentStream.push.apply(contentStream, drawEllipse({\n x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,\n y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,\n xScale: (_c = options.xScale) !== null && _c !== void 0 ? _c : 100,\n yScale: (_d = options.yScale) !== null && _d !== void 0 ? _d : 100,\n rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : undefined,\n color: (_f = options.color) !== null && _f !== void 0 ? _f : undefined,\n borderColor: (_g = options.borderColor) !== null && _g !== void 0 ? _g : undefined,\n borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0,\n borderDashArray: (_j = options.borderDashArray) !== null && _j !== void 0 ? _j : undefined,\n borderDashPhase: (_k = options.borderDashPhase) !== null && _k !== void 0 ? _k : undefined,\n borderLineCap: (_l = options.borderLineCap) !== null && _l !== void 0 ? _l : undefined,\n graphicsState: graphicsStateKey,\n }));\n };\n /**\n * Draw a circle on this page. For example:\n * ```js\n * import { grayscale, rgb } from 'pdf-lib'\n *\n * page.drawCircle({\n * x: 200,\n * y: 150,\n * size: 100,\n * borderWidth: 5,\n * borderColor: grayscale(0.5),\n * color: rgb(0.75, 0.2, 0.2),\n * opacity: 0.5,\n * borderOpacity: 0.75,\n * })\n * ```\n * @param options The options to be used when drawing the ellipse.\n */\n PDFPage.prototype.drawCircle = function (options) {\n if (options === void 0) { options = {}; }\n var _a = options.size, size = _a === void 0 ? 100 : _a;\n assertOrUndefined(size, 'size', ['number']);\n this.drawEllipse(__assign(__assign({}, options), { xScale: size, yScale: size }));\n };\n PDFPage.prototype.setOrEmbedFont = function (font) {\n var oldFont = this.font;\n var oldFontKey = this.fontKey;\n if (font)\n this.setFont(font);\n else\n this.getFont();\n var newFont = this.font;\n var newFontKey = this.fontKey;\n return { oldFont: oldFont, oldFontKey: oldFontKey, newFont: newFont, newFontKey: newFontKey };\n };\n PDFPage.prototype.getFont = function () {\n if (!this.font || !this.fontKey) {\n var font = this.doc.embedStandardFont(StandardFonts.Helvetica);\n this.setFont(font);\n }\n return [this.font, this.fontKey];\n };\n PDFPage.prototype.resetFont = function () {\n this.font = undefined;\n this.fontKey = undefined;\n };\n PDFPage.prototype.getContentStream = function (useExisting) {\n if (useExisting === void 0) { useExisting = true; }\n if (useExisting && this.contentStream)\n return this.contentStream;\n this.contentStream = this.createContentStream();\n this.contentStreamRef = this.doc.context.register(this.contentStream);\n this.node.addContentStream(this.contentStreamRef);\n return this.contentStream;\n };\n PDFPage.prototype.createContentStream = function () {\n var operators = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n operators[_i] = arguments[_i];\n }\n var dict = this.doc.context.obj({});\n var contentStream = PDFContentStream.of(dict, operators);\n return contentStream;\n };\n PDFPage.prototype.maybeEmbedGraphicsState = function (options) {\n var opacity = options.opacity, borderOpacity = options.borderOpacity, blendMode = options.blendMode;\n if (opacity === undefined &&\n borderOpacity === undefined &&\n blendMode === undefined) {\n return undefined;\n }\n var graphicsState = this.doc.context.obj({\n Type: 'ExtGState',\n ca: opacity,\n CA: borderOpacity,\n BM: blendMode,\n });\n var key = this.node.newExtGState('GS', graphicsState);\n return key;\n };\n PDFPage.prototype.scaleAnnot = function (annot, x, y) {\n var selectors = ['RD', 'CL', 'Vertices', 'QuadPoints', 'L', 'Rect'];\n for (var idx = 0, len = selectors.length; idx < len; idx++) {\n var list = annot.lookup(PDFName.of(selectors[idx]));\n if (list instanceof PDFArray)\n list.scalePDFNumbers(x, y);\n }\n var inkLists = annot.lookup(PDFName.of('InkList'));\n if (inkLists instanceof PDFArray) {\n for (var idx = 0, len = inkLists.size(); idx < len; idx++) {\n var arr = inkLists.lookup(idx);\n if (arr instanceof PDFArray)\n arr.scalePDFNumbers(x, y);\n }\n }\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]]\n * > methods, which can create instances of [[PDFPage]] for you.\n *\n * Create an instance of [[PDFPage]] from an existing leaf node.\n *\n * @param leafNode The leaf node to be wrapped.\n * @param ref The unique reference for the page.\n * @param doc The document to which the page will belong.\n */\n PDFPage.of = function (leafNode, ref, doc) {\n return new PDFPage(leafNode, ref, doc);\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]]\n * > methods, which can create instances of [[PDFPage]] for you.\n *\n * Create an instance of [[PDFPage]].\n *\n * @param doc The document to which the page will belong.\n */\n PDFPage.create = function (doc) {\n assertIs(doc, 'doc', [[PDFDocument, 'PDFDocument']]);\n var dummyRef = PDFRef.of(-1);\n var pageLeaf = PDFPageLeaf.withContextAndParent(doc.context, dummyRef);\n var pageRef = doc.context.register(pageLeaf);\n return new PDFPage(pageLeaf, pageRef, doc);\n };\n return PDFPage;\n}());\nexport default PDFPage;\n//# sourceMappingURL=PDFPage.js.map","import { __extends } from \"tslib\";\nimport PDFPage from \"../PDFPage\";\nimport PDFFont from \"../PDFFont\";\nimport { ImageAlignment } from \"../image/alignment\";\nimport { normalizeAppearance, defaultButtonAppearanceProvider, } from \"./appearances\";\nimport PDFField, { assertFieldAppearanceOptions, } from \"./PDFField\";\nimport { rgb } from \"../colors\";\nimport { degrees } from \"../rotations\";\nimport { PDFStream, PDFAcroPushButton, } from \"../../core\";\nimport { assertIs, assertOrUndefined, assertPositive } from \"../../utils\";\n/**\n * Represents a button field of a [[PDFForm]].\n *\n * [[PDFButton]] fields are interactive controls that users can click with their\n * mouse. This type of [[PDFField]] is not stateful. The purpose of a button\n * is to perform an action when the user clicks on it, such as opening a print\n * modal or resetting the form. Buttons are typically rectangular in shape and\n * have a text label describing the action that they perform when clicked.\n */\nvar PDFButton = /** @class */ (function (_super) {\n __extends(PDFButton, _super);\n function PDFButton(acroPushButton, ref, doc) {\n var _this = _super.call(this, acroPushButton, ref, doc) || this;\n assertIs(acroPushButton, 'acroButton', [\n [PDFAcroPushButton, 'PDFAcroPushButton'],\n ]);\n _this.acroField = acroPushButton;\n return _this;\n }\n /**\n * Display an image inside the bounds of this button's widgets. For example:\n * ```js\n * const pngImage = await pdfDoc.embedPng(...)\n * const button = form.getButton('some.button.field')\n * button.setImage(pngImage, ImageAlignment.Center)\n * ```\n * This will update the appearances streams for each of this button's widgets.\n * @param image The image that should be displayed.\n * @param alignment The alignment of the image.\n */\n PDFButton.prototype.setImage = function (image, alignment) {\n if (alignment === void 0) { alignment = ImageAlignment.Center; }\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var streamRef = this.createImageAppearanceStream(widget, image, alignment);\n this.updateWidgetAppearances(widget, { normal: streamRef });\n }\n this.markAsClean();\n };\n /**\n * Set the font size for this field. Larger font sizes will result in larger\n * text being displayed when PDF readers render this button. Font sizes may\n * be integer or floating point numbers. Supplying a negative font size will\n * cause this method to throw an error.\n *\n * For example:\n * ```js\n * const button = form.getButton('some.button.field')\n * button.setFontSize(4)\n * button.setFontSize(15.7)\n * ```\n *\n * > This method depends upon the existence of a default appearance\n * > (`/DA`) string. If this field does not have a default appearance string,\n * > or that string does not contain a font size (via the `Tf` operator),\n * > then this method will throw an error.\n *\n * @param fontSize The font size to be used when rendering text in this field.\n */\n PDFButton.prototype.setFontSize = function (fontSize) {\n assertPositive(fontSize, 'fontSize');\n this.acroField.setFontSize(fontSize);\n this.markAsDirty();\n };\n /**\n * Show this button on the specified page with the given text. For example:\n * ```js\n * const ubuntuFont = await pdfDoc.embedFont(ubuntuFontBytes)\n * const page = pdfDoc.addPage()\n *\n * const form = pdfDoc.getForm()\n * const button = form.createButton('some.button.field')\n *\n * button.addToPage('Do Stuff', page, {\n * x: 50,\n * y: 75,\n * width: 200,\n * height: 100,\n * textColor: rgb(1, 0, 0),\n * backgroundColor: rgb(0, 1, 0),\n * borderColor: rgb(0, 0, 1),\n * borderWidth: 2,\n * rotate: degrees(90),\n * font: ubuntuFont,\n * })\n * ```\n * This will create a new widget for this button field.\n * @param text The text to be displayed for this button widget.\n * @param page The page to which this button widget should be added.\n * @param options The options to be used when adding this button widget.\n */\n PDFButton.prototype.addToPage = function (\n // TODO: This needs to be optional, e.g. for image buttons\n text, page, options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\n assertOrUndefined(text, 'text', ['string']);\n assertOrUndefined(page, 'page', [[PDFPage, 'PDFPage']]);\n assertFieldAppearanceOptions(options);\n // Create a widget for this button\n var widget = this.createWidget({\n 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,\n 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,\n width: (_e = options === null || options === void 0 ? void 0 : options.width) !== null && _e !== void 0 ? _e : 100,\n height: (_f = options === null || options === void 0 ? void 0 : options.height) !== null && _f !== void 0 ? _f : 50,\n textColor: (_g = options === null || options === void 0 ? void 0 : options.textColor) !== null && _g !== void 0 ? _g : rgb(0, 0, 0),\n backgroundColor: (_h = options === null || options === void 0 ? void 0 : options.backgroundColor) !== null && _h !== void 0 ? _h : rgb(0.75, 0.75, 0.75),\n borderColor: options === null || options === void 0 ? void 0 : options.borderColor,\n borderWidth: (_j = options === null || options === void 0 ? void 0 : options.borderWidth) !== null && _j !== void 0 ? _j : 0,\n rotate: (_k = options === null || options === void 0 ? void 0 : options.rotate) !== null && _k !== void 0 ? _k : degrees(0),\n caption: text,\n hidden: options === null || options === void 0 ? void 0 : options.hidden,\n page: page.ref,\n });\n var widgetRef = this.doc.context.register(widget.dict);\n // Add widget to this field\n this.acroField.addWidget(widgetRef);\n // Set appearance streams for widget\n var font = (_l = options === null || options === void 0 ? void 0 : options.font) !== null && _l !== void 0 ? _l : this.doc.getForm().getDefaultFont();\n this.updateWidgetAppearance(widget, font);\n // Add widget to the given page\n page.node.addAnnot(widgetRef);\n };\n /**\n * Returns `true` if this button has been marked as dirty, or if any of this\n * button's widgets do not have an appearance stream. For example:\n * ```js\n * const button = form.getButton('some.button.field')\n * if (button.needsAppearancesUpdate()) console.log('Needs update')\n * ```\n * @returns Whether or not this button needs an appearance update.\n */\n PDFButton.prototype.needsAppearancesUpdate = function () {\n var _a;\n if (this.isDirty())\n return true;\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var hasAppearances = ((_a = widget.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal) instanceof PDFStream;\n if (!hasAppearances)\n return true;\n }\n return false;\n };\n /**\n * Update the appearance streams for each of this button's widgets using\n * the default appearance provider for buttons. For example:\n * ```js\n * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const button = form.getButton('some.button.field')\n * button.defaultUpdateAppearances(helvetica)\n * ```\n * @param font The font to be used for creating the appearance streams.\n */\n PDFButton.prototype.defaultUpdateAppearances = function (font) {\n assertIs(font, 'font', [[PDFFont, 'PDFFont']]);\n this.updateAppearances(font);\n };\n /**\n * Update the appearance streams for each of this button's widgets using\n * the given appearance provider. If no `provider` is passed, the default\n * appearance provider for buttons will be used. For example:\n * ```js\n * const helvetica = await pdfDoc.embedFont(StandardFonts.Helvetica)\n * const button = form.getButton('some.button.field')\n * button.updateAppearances(helvetica, (field, widget, font) => {\n * ...\n * return {\n * normal: drawButton(...),\n * down: drawButton(...),\n * }\n * })\n * ```\n * @param font The font to be used for creating the appearance streams.\n * @param provider Optionally, the appearance provider to be used for\n * generating the contents of the appearance streams.\n */\n PDFButton.prototype.updateAppearances = function (font, provider) {\n assertIs(font, 'font', [[PDFFont, 'PDFFont']]);\n assertOrUndefined(provider, 'provider', [Function]);\n var widgets = this.acroField.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n this.updateWidgetAppearance(widget, font, provider);\n }\n };\n PDFButton.prototype.updateWidgetAppearance = function (widget, font, provider) {\n var apProvider = provider !== null && provider !== void 0 ? provider : defaultButtonAppearanceProvider;\n var appearances = normalizeAppearance(apProvider(this, widget, font));\n this.updateWidgetAppearanceWithFont(widget, font, appearances);\n };\n /**\n * > **NOTE:** You probably don't want to call this method directly. Instead,\n * > consider using the [[PDFForm.getButton]] method, which will create an\n * > instance of [[PDFButton]] for you.\n *\n * Create an instance of [[PDFButton]] from an existing acroPushButton and ref\n *\n * @param acroPushButton The underlying `PDFAcroPushButton` for this button.\n * @param ref The unique reference for this button.\n * @param doc The document to which this button will belong.\n */\n PDFButton.of = function (acroPushButton, ref, doc) { return new PDFButton(acroPushButton, ref, doc); };\n return PDFButton;\n}(PDFField));\nexport default PDFButton;\n//# sourceMappingURL=PDFButton.js.map","import { __awaiter, __generator } from \"tslib\";\nimport PDFString from \"../objects/PDFString\";\nimport PDFHexString from \"../objects/PDFHexString\";\n/**\n * From the PDF-A3 specification, section **3.1. Requirements - General**.\n * See:\n * * https://www.pdfa.org/wp-content/uploads/2018/10/PDF20_AN002-AF.pdf\n */\nexport var AFRelationship;\n(function (AFRelationship) {\n AFRelationship[\"Source\"] = \"Source\";\n AFRelationship[\"Data\"] = \"Data\";\n AFRelationship[\"Alternative\"] = \"Alternative\";\n AFRelationship[\"Supplement\"] = \"Supplement\";\n AFRelationship[\"EncryptedPayload\"] = \"EncryptedPayload\";\n AFRelationship[\"FormData\"] = \"EncryptedPayload\";\n AFRelationship[\"Schema\"] = \"Schema\";\n AFRelationship[\"Unspecified\"] = \"Unspecified\";\n})(AFRelationship || (AFRelationship = {}));\nvar FileEmbedder = /** @class */ (function () {\n function FileEmbedder(fileData, fileName, options) {\n if (options === void 0) { options = {}; }\n this.fileData = fileData;\n this.fileName = fileName;\n this.options = options;\n }\n FileEmbedder.for = function (bytes, fileName, options) {\n if (options === void 0) { options = {}; }\n return new FileEmbedder(bytes, fileName, options);\n };\n FileEmbedder.prototype.embedIntoContext = function (context, ref) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, mimeType, description, creationDate, modificationDate, afRelationship, embeddedFileStream, embeddedFileStreamRef, fileSpecDict;\n return __generator(this, function (_b) {\n _a = this.options, mimeType = _a.mimeType, description = _a.description, creationDate = _a.creationDate, modificationDate = _a.modificationDate, afRelationship = _a.afRelationship;\n embeddedFileStream = context.flateStream(this.fileData, {\n Type: 'EmbeddedFile',\n Subtype: mimeType !== null && mimeType !== void 0 ? mimeType : undefined,\n Params: {\n Size: this.fileData.length,\n CreationDate: creationDate\n ? PDFString.fromDate(creationDate)\n : undefined,\n ModDate: modificationDate\n ? PDFString.fromDate(modificationDate)\n : undefined,\n },\n });\n embeddedFileStreamRef = context.register(embeddedFileStream);\n fileSpecDict = context.obj({\n Type: 'Filespec',\n F: PDFString.of(this.fileName),\n UF: PDFHexString.fromText(this.fileName),\n EF: { F: embeddedFileStreamRef },\n Desc: description ? PDFHexString.fromText(description) : undefined,\n AFRelationship: afRelationship !== null && afRelationship !== void 0 ? afRelationship : undefined,\n });\n if (ref) {\n context.assign(ref, fileSpecDict);\n return [2 /*return*/, ref];\n }\n else {\n return [2 /*return*/, context.register(fileSpecDict)];\n }\n return [2 /*return*/];\n });\n });\n };\n return FileEmbedder;\n}());\nexport default FileEmbedder;\n//# sourceMappingURL=FileEmbedder.js.map","import { __extends } from \"tslib\";\nimport { arrayAsString } from \"../utils\";\nvar MethodNotImplementedError = /** @class */ (function (_super) {\n __extends(MethodNotImplementedError, _super);\n function MethodNotImplementedError(className, methodName) {\n var _this = this;\n var msg = \"Method \" + className + \".\" + methodName + \"() not implemented\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return MethodNotImplementedError;\n}(Error));\nexport { MethodNotImplementedError };\nvar PrivateConstructorError = /** @class */ (function (_super) {\n __extends(PrivateConstructorError, _super);\n function PrivateConstructorError(className) {\n var _this = this;\n var msg = \"Cannot construct \" + className + \" - it has a private constructor\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return PrivateConstructorError;\n}(Error));\nexport { PrivateConstructorError };\nvar UnexpectedObjectTypeError = /** @class */ (function (_super) {\n __extends(UnexpectedObjectTypeError, _super);\n function UnexpectedObjectTypeError(expected, actual) {\n var _this = this;\n 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; };\n var expectedTypes = Array.isArray(expected)\n ? expected.map(name)\n : [name(expected)];\n var msg = \"Expected instance of \" + expectedTypes.join(' or ') + \", \" +\n (\"but got instance of \" + (actual ? name(actual) : actual));\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return UnexpectedObjectTypeError;\n}(Error));\nexport { UnexpectedObjectTypeError };\nvar UnsupportedEncodingError = /** @class */ (function (_super) {\n __extends(UnsupportedEncodingError, _super);\n function UnsupportedEncodingError(encoding) {\n var _this = this;\n var msg = encoding + \" stream encoding not supported\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return UnsupportedEncodingError;\n}(Error));\nexport { UnsupportedEncodingError };\nvar ReparseError = /** @class */ (function (_super) {\n __extends(ReparseError, _super);\n function ReparseError(className, methodName) {\n var _this = this;\n var msg = \"Cannot call \" + className + \".\" + methodName + \"() more than once\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return ReparseError;\n}(Error));\nexport { ReparseError };\nvar MissingCatalogError = /** @class */ (function (_super) {\n __extends(MissingCatalogError, _super);\n function MissingCatalogError(ref) {\n var _this = this;\n var msg = \"Missing catalog (ref=\" + ref + \")\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return MissingCatalogError;\n}(Error));\nexport { MissingCatalogError };\nvar MissingPageContentsEmbeddingError = /** @class */ (function (_super) {\n __extends(MissingPageContentsEmbeddingError, _super);\n function MissingPageContentsEmbeddingError() {\n var _this = this;\n var msg = \"Can't embed page with missing Contents\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return MissingPageContentsEmbeddingError;\n}(Error));\nexport { MissingPageContentsEmbeddingError };\nvar UnrecognizedStreamTypeError = /** @class */ (function (_super) {\n __extends(UnrecognizedStreamTypeError, _super);\n function UnrecognizedStreamTypeError(stream) {\n var _a, _b, _c;\n var _this = this;\n 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;\n var msg = \"Unrecognized stream type: \" + streamType;\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return UnrecognizedStreamTypeError;\n}(Error));\nexport { UnrecognizedStreamTypeError };\nvar PageEmbeddingMismatchedContextError = /** @class */ (function (_super) {\n __extends(PageEmbeddingMismatchedContextError, _super);\n function PageEmbeddingMismatchedContextError() {\n var _this = this;\n var msg = \"Found mismatched contexts while embedding pages. All pages in the array passed to `PDFDocument.embedPages()` must be from the same document.\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return PageEmbeddingMismatchedContextError;\n}(Error));\nexport { PageEmbeddingMismatchedContextError };\nvar PDFArrayIsNotRectangleError = /** @class */ (function (_super) {\n __extends(PDFArrayIsNotRectangleError, _super);\n function PDFArrayIsNotRectangleError(size) {\n var _this = this;\n var msg = \"Attempted to convert PDFArray with \" + size + \" elements to rectangle, but must have exactly 4 elements.\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return PDFArrayIsNotRectangleError;\n}(Error));\nexport { PDFArrayIsNotRectangleError };\nvar InvalidPDFDateStringError = /** @class */ (function (_super) {\n __extends(InvalidPDFDateStringError, _super);\n function InvalidPDFDateStringError(value) {\n var _this = this;\n var msg = \"Attempted to convert \\\"\" + value + \"\\\" to a date, but it does not match the PDF date string format.\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return InvalidPDFDateStringError;\n}(Error));\nexport { InvalidPDFDateStringError };\nvar InvalidTargetIndexError = /** @class */ (function (_super) {\n __extends(InvalidTargetIndexError, _super);\n function InvalidTargetIndexError(targetIndex, Count) {\n var _this = this;\n var msg = \"Invalid targetIndex specified: targetIndex=\" + targetIndex + \" must be less than Count=\" + Count;\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return InvalidTargetIndexError;\n}(Error));\nexport { InvalidTargetIndexError };\nvar CorruptPageTreeError = /** @class */ (function (_super) {\n __extends(CorruptPageTreeError, _super);\n function CorruptPageTreeError(targetIndex, operation) {\n var _this = this;\n var msg = \"Failed to \" + operation + \" at targetIndex=\" + targetIndex + \" due to corrupt page tree: It is likely that one or more 'Count' entries are invalid\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return CorruptPageTreeError;\n}(Error));\nexport { CorruptPageTreeError };\nvar IndexOutOfBoundsError = /** @class */ (function (_super) {\n __extends(IndexOutOfBoundsError, _super);\n function IndexOutOfBoundsError(index, min, max) {\n var _this = this;\n var msg = \"index should be at least \" + min + \" and at most \" + max + \", but was actually \" + index;\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return IndexOutOfBoundsError;\n}(Error));\nexport { IndexOutOfBoundsError };\nvar InvalidAcroFieldValueError = /** @class */ (function (_super) {\n __extends(InvalidAcroFieldValueError, _super);\n function InvalidAcroFieldValueError() {\n var _this = this;\n var msg = \"Attempted to set invalid field value\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return InvalidAcroFieldValueError;\n}(Error));\nexport { InvalidAcroFieldValueError };\nvar MultiSelectValueError = /** @class */ (function (_super) {\n __extends(MultiSelectValueError, _super);\n function MultiSelectValueError() {\n var _this = this;\n var msg = \"Attempted to select multiple values for single-select field\";\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return MultiSelectValueError;\n}(Error));\nexport { MultiSelectValueError };\nvar MissingDAEntryError = /** @class */ (function (_super) {\n __extends(MissingDAEntryError, _super);\n function MissingDAEntryError(fieldName) {\n var _this = this;\n var msg = \"No /DA (default appearance) entry found for field: \" + fieldName;\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return MissingDAEntryError;\n}(Error));\nexport { MissingDAEntryError };\nvar MissingTfOperatorError = /** @class */ (function (_super) {\n __extends(MissingTfOperatorError, _super);\n function MissingTfOperatorError(fieldName) {\n var _this = this;\n var msg = \"No Tf operator found for DA of field: \" + fieldName;\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return MissingTfOperatorError;\n}(Error));\nexport { MissingTfOperatorError };\nvar NumberParsingError = /** @class */ (function (_super) {\n __extends(NumberParsingError, _super);\n function NumberParsingError(pos, value) {\n var _this = this;\n var msg = \"Failed to parse number \" +\n (\"(line:\" + pos.line + \" col:\" + pos.column + \" offset=\" + pos.offset + \"): \\\"\" + value + \"\\\"\");\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return NumberParsingError;\n}(Error));\nexport { NumberParsingError };\nvar PDFParsingError = /** @class */ (function (_super) {\n __extends(PDFParsingError, _super);\n function PDFParsingError(pos, details) {\n var _this = this;\n var msg = \"Failed to parse PDF document \" +\n (\"(line:\" + pos.line + \" col:\" + pos.column + \" offset=\" + pos.offset + \"): \" + details);\n _this = _super.call(this, msg) || this;\n return _this;\n }\n return PDFParsingError;\n}(Error));\nexport { PDFParsingError };\nvar NextByteAssertionError = /** @class */ (function (_super) {\n __extends(NextByteAssertionError, _super);\n function NextByteAssertionError(pos, expectedByte, actualByte) {\n var _this = this;\n var msg = \"Expected next byte to be \" + expectedByte + \" but it was actually \" + actualByte;\n _this = _super.call(this, pos, msg) || this;\n return _this;\n }\n return NextByteAssertionError;\n}(PDFParsingError));\nexport { NextByteAssertionError };\nvar PDFObjectParsingError = /** @class */ (function (_super) {\n __extends(PDFObjectParsingError, _super);\n function PDFObjectParsingError(pos, byte) {\n var _this = this;\n var msg = \"Failed to parse PDF object starting with the following byte: \" + byte;\n _this = _super.call(this, pos, msg) || this;\n return _this;\n }\n return PDFObjectParsingError;\n}(PDFParsingError));\nexport { PDFObjectParsingError };\nvar PDFInvalidObjectParsingError = /** @class */ (function (_super) {\n __extends(PDFInvalidObjectParsingError, _super);\n function PDFInvalidObjectParsingError(pos) {\n var _this = this;\n var msg = \"Failed to parse invalid PDF object\";\n _this = _super.call(this, pos, msg) || this;\n return _this;\n }\n return PDFInvalidObjectParsingError;\n}(PDFParsingError));\nexport { PDFInvalidObjectParsingError };\nvar PDFStreamParsingError = /** @class */ (function (_super) {\n __extends(PDFStreamParsingError, _super);\n function PDFStreamParsingError(pos) {\n var _this = this;\n var msg = \"Failed to parse PDF stream\";\n _this = _super.call(this, pos, msg) || this;\n return _this;\n }\n return PDFStreamParsingError;\n}(PDFParsingError));\nexport { PDFStreamParsingError };\nvar UnbalancedParenthesisError = /** @class */ (function (_super) {\n __extends(UnbalancedParenthesisError, _super);\n function UnbalancedParenthesisError(pos) {\n var _this = this;\n var msg = \"Failed to parse PDF literal string due to unbalanced parenthesis\";\n _this = _super.call(this, pos, msg) || this;\n return _this;\n }\n return UnbalancedParenthesisError;\n}(PDFParsingError));\nexport { UnbalancedParenthesisError };\nvar StalledParserError = /** @class */ (function (_super) {\n __extends(StalledParserError, _super);\n function StalledParserError(pos) {\n var _this = this;\n var msg = \"Parser stalled\";\n _this = _super.call(this, pos, msg) || this;\n return _this;\n }\n return StalledParserError;\n}(PDFParsingError));\nexport { StalledParserError };\nvar MissingPDFHeaderError = /** @class */ (function (_super) {\n __extends(MissingPDFHeaderError, _super);\n function MissingPDFHeaderError(pos) {\n var _this = this;\n var msg = \"No PDF header found\";\n _this = _super.call(this, pos, msg) || this;\n return _this;\n }\n return MissingPDFHeaderError;\n}(PDFParsingError));\nexport { MissingPDFHeaderError };\nvar MissingKeywordError = /** @class */ (function (_super) {\n __extends(MissingKeywordError, _super);\n function MissingKeywordError(pos, keyword) {\n var _this = this;\n var msg = \"Did not find expected keyword '\" + arrayAsString(keyword) + \"'\";\n _this = _super.call(this, pos, msg) || this;\n return _this;\n }\n return MissingKeywordError;\n}(PDFParsingError));\nexport { MissingKeywordError };\n//# sourceMappingURL=errors.js.map","var PDFOperatorNames;\n(function (PDFOperatorNames) {\n // Non Stroking Color Operators\n PDFOperatorNames[\"NonStrokingColor\"] = \"sc\";\n PDFOperatorNames[\"NonStrokingColorN\"] = \"scn\";\n PDFOperatorNames[\"NonStrokingColorRgb\"] = \"rg\";\n PDFOperatorNames[\"NonStrokingColorGray\"] = \"g\";\n PDFOperatorNames[\"NonStrokingColorCmyk\"] = \"k\";\n PDFOperatorNames[\"NonStrokingColorspace\"] = \"cs\";\n // Stroking Color Operators\n PDFOperatorNames[\"StrokingColor\"] = \"SC\";\n PDFOperatorNames[\"StrokingColorN\"] = \"SCN\";\n PDFOperatorNames[\"StrokingColorRgb\"] = \"RG\";\n PDFOperatorNames[\"StrokingColorGray\"] = \"G\";\n PDFOperatorNames[\"StrokingColorCmyk\"] = \"K\";\n PDFOperatorNames[\"StrokingColorspace\"] = \"CS\";\n // Marked Content Operators\n PDFOperatorNames[\"BeginMarkedContentSequence\"] = \"BDC\";\n PDFOperatorNames[\"BeginMarkedContent\"] = \"BMC\";\n PDFOperatorNames[\"EndMarkedContent\"] = \"EMC\";\n PDFOperatorNames[\"MarkedContentPointWithProps\"] = \"DP\";\n PDFOperatorNames[\"MarkedContentPoint\"] = \"MP\";\n PDFOperatorNames[\"DrawObject\"] = \"Do\";\n // Graphics State Operators\n PDFOperatorNames[\"ConcatTransformationMatrix\"] = \"cm\";\n PDFOperatorNames[\"PopGraphicsState\"] = \"Q\";\n PDFOperatorNames[\"PushGraphicsState\"] = \"q\";\n PDFOperatorNames[\"SetFlatness\"] = \"i\";\n PDFOperatorNames[\"SetGraphicsStateParams\"] = \"gs\";\n PDFOperatorNames[\"SetLineCapStyle\"] = \"J\";\n PDFOperatorNames[\"SetLineDashPattern\"] = \"d\";\n PDFOperatorNames[\"SetLineJoinStyle\"] = \"j\";\n PDFOperatorNames[\"SetLineMiterLimit\"] = \"M\";\n PDFOperatorNames[\"SetLineWidth\"] = \"w\";\n PDFOperatorNames[\"SetTextMatrix\"] = \"Tm\";\n PDFOperatorNames[\"SetRenderingIntent\"] = \"ri\";\n // Graphics Operators\n PDFOperatorNames[\"AppendRectangle\"] = \"re\";\n PDFOperatorNames[\"BeginInlineImage\"] = \"BI\";\n PDFOperatorNames[\"BeginInlineImageData\"] = \"ID\";\n PDFOperatorNames[\"EndInlineImage\"] = \"EI\";\n PDFOperatorNames[\"ClipEvenOdd\"] = \"W*\";\n PDFOperatorNames[\"ClipNonZero\"] = \"W\";\n PDFOperatorNames[\"CloseAndStroke\"] = \"s\";\n PDFOperatorNames[\"CloseFillEvenOddAndStroke\"] = \"b*\";\n PDFOperatorNames[\"CloseFillNonZeroAndStroke\"] = \"b\";\n PDFOperatorNames[\"ClosePath\"] = \"h\";\n PDFOperatorNames[\"AppendBezierCurve\"] = \"c\";\n PDFOperatorNames[\"CurveToReplicateFinalPoint\"] = \"y\";\n PDFOperatorNames[\"CurveToReplicateInitialPoint\"] = \"v\";\n PDFOperatorNames[\"EndPath\"] = \"n\";\n PDFOperatorNames[\"FillEvenOddAndStroke\"] = \"B*\";\n PDFOperatorNames[\"FillEvenOdd\"] = \"f*\";\n PDFOperatorNames[\"FillNonZeroAndStroke\"] = \"B\";\n PDFOperatorNames[\"FillNonZero\"] = \"f\";\n PDFOperatorNames[\"LegacyFillNonZero\"] = \"F\";\n PDFOperatorNames[\"LineTo\"] = \"l\";\n PDFOperatorNames[\"MoveTo\"] = \"m\";\n PDFOperatorNames[\"ShadingFill\"] = \"sh\";\n PDFOperatorNames[\"StrokePath\"] = \"S\";\n // Text Operators\n PDFOperatorNames[\"BeginText\"] = \"BT\";\n PDFOperatorNames[\"EndText\"] = \"ET\";\n PDFOperatorNames[\"MoveText\"] = \"Td\";\n PDFOperatorNames[\"MoveTextSetLeading\"] = \"TD\";\n PDFOperatorNames[\"NextLine\"] = \"T*\";\n PDFOperatorNames[\"SetCharacterSpacing\"] = \"Tc\";\n PDFOperatorNames[\"SetFontAndSize\"] = \"Tf\";\n PDFOperatorNames[\"SetTextHorizontalScaling\"] = \"Tz\";\n PDFOperatorNames[\"SetTextLineHeight\"] = \"TL\";\n PDFOperatorNames[\"SetTextRenderingMode\"] = \"Tr\";\n PDFOperatorNames[\"SetTextRise\"] = \"Ts\";\n PDFOperatorNames[\"SetWordSpacing\"] = \"Tw\";\n PDFOperatorNames[\"ShowText\"] = \"Tj\";\n PDFOperatorNames[\"ShowTextAdjusted\"] = \"TJ\";\n PDFOperatorNames[\"ShowTextLine\"] = \"'\";\n PDFOperatorNames[\"ShowTextLineAndSpace\"] = \"\\\"\";\n // Type3 Font Operators\n PDFOperatorNames[\"Type3D0\"] = \"d0\";\n PDFOperatorNames[\"Type3D1\"] = \"d1\";\n // Compatibility Section Operators\n PDFOperatorNames[\"BeginCompatibilitySection\"] = \"BX\";\n PDFOperatorNames[\"EndCompatibilitySection\"] = \"EX\";\n})(PDFOperatorNames || (PDFOperatorNames = {}));\nexport default PDFOperatorNames;\n//# sourceMappingURL=PDFOperatorNames.js.map","import { __extends } from \"tslib\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFRef from \"../objects/PDFRef\";\nimport PDFFlateStream from \"./PDFFlateStream\";\nimport { bytesFor, Cache, reverseArray, sizeInBytes, sum } from \"../../utils\";\nexport var EntryType;\n(function (EntryType) {\n EntryType[EntryType[\"Deleted\"] = 0] = \"Deleted\";\n EntryType[EntryType[\"Uncompressed\"] = 1] = \"Uncompressed\";\n EntryType[EntryType[\"Compressed\"] = 2] = \"Compressed\";\n})(EntryType || (EntryType = {}));\n/**\n * Entries should be added using the [[addDeletedEntry]],\n * [[addUncompressedEntry]], and [[addCompressedEntry]] methods\n * **in order of ascending object number**.\n */\nvar PDFCrossRefStream = /** @class */ (function (_super) {\n __extends(PDFCrossRefStream, _super);\n function PDFCrossRefStream(dict, entries, encode) {\n if (encode === void 0) { encode = true; }\n var _this = _super.call(this, dict, encode) || this;\n // Returns an array of integer pairs for each subsection of the cross ref\n // section, where each integer pair represents:\n // firstObjectNumber(OfSection), length(OfSection)\n _this.computeIndex = function () {\n var subsections = [];\n var subsectionLength = 0;\n for (var idx = 0, len = _this.entries.length; idx < len; idx++) {\n var currEntry = _this.entries[idx];\n var prevEntry = _this.entries[idx - 1];\n if (idx === 0) {\n subsections.push(currEntry.ref.objectNumber);\n }\n else if (currEntry.ref.objectNumber - prevEntry.ref.objectNumber > 1) {\n subsections.push(subsectionLength);\n subsections.push(currEntry.ref.objectNumber);\n subsectionLength = 0;\n }\n subsectionLength += 1;\n }\n subsections.push(subsectionLength);\n return subsections;\n };\n _this.computeEntryTuples = function () {\n var entryTuples = new Array(_this.entries.length);\n for (var idx = 0, len = _this.entries.length; idx < len; idx++) {\n var entry = _this.entries[idx];\n if (entry.type === EntryType.Deleted) {\n var type = entry.type, nextFreeObjectNumber = entry.nextFreeObjectNumber, ref = entry.ref;\n entryTuples[idx] = [type, nextFreeObjectNumber, ref.generationNumber];\n }\n if (entry.type === EntryType.Uncompressed) {\n var type = entry.type, offset = entry.offset, ref = entry.ref;\n entryTuples[idx] = [type, offset, ref.generationNumber];\n }\n if (entry.type === EntryType.Compressed) {\n var type = entry.type, objectStreamRef = entry.objectStreamRef, index = entry.index;\n entryTuples[idx] = [type, objectStreamRef.objectNumber, index];\n }\n }\n return entryTuples;\n };\n _this.computeMaxEntryByteWidths = function () {\n var entryTuples = _this.entryTuplesCache.access();\n var widths = [0, 0, 0];\n for (var idx = 0, len = entryTuples.length; idx < len; idx++) {\n var _a = entryTuples[idx], first = _a[0], second = _a[1], third = _a[2];\n var firstSize = sizeInBytes(first);\n var secondSize = sizeInBytes(second);\n var thirdSize = sizeInBytes(third);\n if (firstSize > widths[0])\n widths[0] = firstSize;\n if (secondSize > widths[1])\n widths[1] = secondSize;\n if (thirdSize > widths[2])\n widths[2] = thirdSize;\n }\n return widths;\n };\n _this.entries = entries || [];\n _this.entryTuplesCache = Cache.populatedBy(_this.computeEntryTuples);\n _this.maxByteWidthsCache = Cache.populatedBy(_this.computeMaxEntryByteWidths);\n _this.indexCache = Cache.populatedBy(_this.computeIndex);\n dict.set(PDFName.of('Type'), PDFName.of('XRef'));\n return _this;\n }\n PDFCrossRefStream.prototype.addDeletedEntry = function (ref, nextFreeObjectNumber) {\n var type = EntryType.Deleted;\n this.entries.push({ type: type, ref: ref, nextFreeObjectNumber: nextFreeObjectNumber });\n this.entryTuplesCache.invalidate();\n this.maxByteWidthsCache.invalidate();\n this.indexCache.invalidate();\n this.contentsCache.invalidate();\n };\n PDFCrossRefStream.prototype.addUncompressedEntry = function (ref, offset) {\n var type = EntryType.Uncompressed;\n this.entries.push({ type: type, ref: ref, offset: offset });\n this.entryTuplesCache.invalidate();\n this.maxByteWidthsCache.invalidate();\n this.indexCache.invalidate();\n this.contentsCache.invalidate();\n };\n PDFCrossRefStream.prototype.addCompressedEntry = function (ref, objectStreamRef, index) {\n var type = EntryType.Compressed;\n this.entries.push({ type: type, ref: ref, objectStreamRef: objectStreamRef, index: index });\n this.entryTuplesCache.invalidate();\n this.maxByteWidthsCache.invalidate();\n this.indexCache.invalidate();\n this.contentsCache.invalidate();\n };\n PDFCrossRefStream.prototype.clone = function (context) {\n var _a = this, dict = _a.dict, entries = _a.entries, encode = _a.encode;\n return PDFCrossRefStream.of(dict.clone(context), entries.slice(), encode);\n };\n PDFCrossRefStream.prototype.getContentsString = function () {\n var entryTuples = this.entryTuplesCache.access();\n var byteWidths = this.maxByteWidthsCache.access();\n var value = '';\n for (var entryIdx = 0, entriesLen = entryTuples.length; entryIdx < entriesLen; entryIdx++) {\n var _a = entryTuples[entryIdx], first = _a[0], second = _a[1], third = _a[2];\n var firstBytes = reverseArray(bytesFor(first));\n var secondBytes = reverseArray(bytesFor(second));\n var thirdBytes = reverseArray(bytesFor(third));\n for (var idx = byteWidths[0] - 1; idx >= 0; idx--) {\n value += (firstBytes[idx] || 0).toString(2);\n }\n for (var idx = byteWidths[1] - 1; idx >= 0; idx--) {\n value += (secondBytes[idx] || 0).toString(2);\n }\n for (var idx = byteWidths[2] - 1; idx >= 0; idx--) {\n value += (thirdBytes[idx] || 0).toString(2);\n }\n }\n return value;\n };\n PDFCrossRefStream.prototype.getUnencodedContents = function () {\n var entryTuples = this.entryTuplesCache.access();\n var byteWidths = this.maxByteWidthsCache.access();\n var buffer = new Uint8Array(this.getUnencodedContentsSize());\n var offset = 0;\n for (var entryIdx = 0, entriesLen = entryTuples.length; entryIdx < entriesLen; entryIdx++) {\n var _a = entryTuples[entryIdx], first = _a[0], second = _a[1], third = _a[2];\n var firstBytes = reverseArray(bytesFor(first));\n var secondBytes = reverseArray(bytesFor(second));\n var thirdBytes = reverseArray(bytesFor(third));\n for (var idx = byteWidths[0] - 1; idx >= 0; idx--) {\n buffer[offset++] = firstBytes[idx] || 0;\n }\n for (var idx = byteWidths[1] - 1; idx >= 0; idx--) {\n buffer[offset++] = secondBytes[idx] || 0;\n }\n for (var idx = byteWidths[2] - 1; idx >= 0; idx--) {\n buffer[offset++] = thirdBytes[idx] || 0;\n }\n }\n return buffer;\n };\n PDFCrossRefStream.prototype.getUnencodedContentsSize = function () {\n var byteWidths = this.maxByteWidthsCache.access();\n var entryWidth = sum(byteWidths);\n return entryWidth * this.entries.length;\n };\n PDFCrossRefStream.prototype.updateDict = function () {\n _super.prototype.updateDict.call(this);\n var byteWidths = this.maxByteWidthsCache.access();\n var index = this.indexCache.access();\n var context = this.dict.context;\n this.dict.set(PDFName.of('W'), context.obj(byteWidths));\n this.dict.set(PDFName.of('Index'), context.obj(index));\n };\n PDFCrossRefStream.create = function (dict, encode) {\n if (encode === void 0) { encode = true; }\n var stream = new PDFCrossRefStream(dict, [], encode);\n stream.addDeletedEntry(PDFRef.of(0, 65535), 0);\n return stream;\n };\n PDFCrossRefStream.of = function (dict, entries, encode) {\n if (encode === void 0) { encode = true; }\n return new PDFCrossRefStream(dict, entries, encode);\n };\n return PDFCrossRefStream;\n}(PDFFlateStream));\nexport default PDFCrossRefStream;\n//# sourceMappingURL=PDFCrossRefStream.js.map","import { __awaiter, __generator } from \"tslib\";\n// prettier-ignore\nvar MARKERS = [\n 0xffc0, 0xffc1, 0xffc2,\n 0xffc3, 0xffc5, 0xffc6,\n 0xffc7, 0xffc8, 0xffc9,\n 0xffca, 0xffcb, 0xffcc,\n 0xffcd, 0xffce, 0xffcf,\n];\nvar ColorSpace;\n(function (ColorSpace) {\n ColorSpace[\"DeviceGray\"] = \"DeviceGray\";\n ColorSpace[\"DeviceRGB\"] = \"DeviceRGB\";\n ColorSpace[\"DeviceCMYK\"] = \"DeviceCMYK\";\n})(ColorSpace || (ColorSpace = {}));\nvar ChannelToColorSpace = {\n 1: ColorSpace.DeviceGray,\n 3: ColorSpace.DeviceRGB,\n 4: ColorSpace.DeviceCMYK,\n};\n/**\n * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as\n * this class borrows from:\n * https://github.com/foliojs/pdfkit/blob/a6af76467ce06bd6a2af4aa7271ccac9ff152a7d/lib/image/jpeg.js\n */\nvar JpegEmbedder = /** @class */ (function () {\n function JpegEmbedder(imageData, bitsPerComponent, width, height, colorSpace) {\n this.imageData = imageData;\n this.bitsPerComponent = bitsPerComponent;\n this.width = width;\n this.height = height;\n this.colorSpace = colorSpace;\n }\n JpegEmbedder.for = function (imageData) {\n return __awaiter(this, void 0, void 0, function () {\n var dataView, soi, pos, marker, bitsPerComponent, height, width, channelByte, channelName, colorSpace;\n return __generator(this, function (_a) {\n dataView = new DataView(imageData.buffer);\n soi = dataView.getUint16(0);\n if (soi !== 0xffd8)\n throw new Error('SOI not found in JPEG');\n pos = 2;\n while (pos < dataView.byteLength) {\n marker = dataView.getUint16(pos);\n pos += 2;\n if (MARKERS.includes(marker))\n break;\n pos += dataView.getUint16(pos);\n }\n if (!MARKERS.includes(marker))\n throw new Error('Invalid JPEG');\n pos += 2;\n bitsPerComponent = dataView.getUint8(pos++);\n height = dataView.getUint16(pos);\n pos += 2;\n width = dataView.getUint16(pos);\n pos += 2;\n channelByte = dataView.getUint8(pos++);\n channelName = ChannelToColorSpace[channelByte];\n if (!channelName)\n throw new Error('Unknown JPEG channel.');\n colorSpace = channelName;\n return [2 /*return*/, new JpegEmbedder(imageData, bitsPerComponent, width, height, colorSpace)];\n });\n });\n };\n JpegEmbedder.prototype.embedIntoContext = function (context, ref) {\n return __awaiter(this, void 0, void 0, function () {\n var xObject;\n return __generator(this, function (_a) {\n xObject = context.stream(this.imageData, {\n Type: 'XObject',\n Subtype: 'Image',\n BitsPerComponent: this.bitsPerComponent,\n Width: this.width,\n Height: this.height,\n ColorSpace: this.colorSpace,\n Filter: 'DCTDecode',\n // CMYK JPEG streams in PDF are typically stored complemented,\n // with 1 as 'off' and 0 as 'on' (PDF 32000-1:2008, 8.6.4.4).\n //\n // Standalone CMYK JPEG (usually exported by Photoshop) are\n // stored inverse, with 0 as 'off' and 1 as 'on', like RGB.\n //\n // Applying a swap here as a hedge that most bytes passing\n // through this method will benefit from it.\n Decode: this.colorSpace === ColorSpace.DeviceCMYK\n ? [1, 0, 1, 0, 1, 0, 1, 0]\n : undefined,\n });\n if (ref) {\n context.assign(ref, xObject);\n return [2 /*return*/, ref];\n }\n else {\n return [2 /*return*/, context.register(xObject)];\n }\n return [2 /*return*/];\n });\n });\n };\n return JpegEmbedder;\n}());\nexport default JpegEmbedder;\n//# sourceMappingURL=JpegEmbedder.js.map","import UPNG from '@pdf-lib/upng';\nvar getImageType = function (ctype) {\n if (ctype === 0)\n return PngType.Greyscale;\n if (ctype === 2)\n return PngType.Truecolour;\n if (ctype === 3)\n return PngType.IndexedColour;\n if (ctype === 4)\n return PngType.GreyscaleWithAlpha;\n if (ctype === 6)\n return PngType.TruecolourWithAlpha;\n throw new Error(\"Unknown color type: \" + ctype);\n};\nvar splitAlphaChannel = function (rgbaChannel) {\n var pixelCount = Math.floor(rgbaChannel.length / 4);\n var rgbChannel = new Uint8Array(pixelCount * 3);\n var alphaChannel = new Uint8Array(pixelCount * 1);\n var rgbaOffset = 0;\n var rgbOffset = 0;\n var alphaOffset = 0;\n while (rgbaOffset < rgbaChannel.length) {\n rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++];\n rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++];\n rgbChannel[rgbOffset++] = rgbaChannel[rgbaOffset++];\n alphaChannel[alphaOffset++] = rgbaChannel[rgbaOffset++];\n }\n return { rgbChannel: rgbChannel, alphaChannel: alphaChannel };\n};\nexport var PngType;\n(function (PngType) {\n PngType[\"Greyscale\"] = \"Greyscale\";\n PngType[\"Truecolour\"] = \"Truecolour\";\n PngType[\"IndexedColour\"] = \"IndexedColour\";\n PngType[\"GreyscaleWithAlpha\"] = \"GreyscaleWithAlpha\";\n PngType[\"TruecolourWithAlpha\"] = \"TruecolourWithAlpha\";\n})(PngType || (PngType = {}));\nvar PNG = /** @class */ (function () {\n function PNG(pngData) {\n var upng = UPNG.decode(pngData);\n var frames = UPNG.toRGBA8(upng);\n if (frames.length > 1)\n throw new Error(\"Animated PNGs are not supported\");\n var frame = new Uint8Array(frames[0]);\n var _a = splitAlphaChannel(frame), rgbChannel = _a.rgbChannel, alphaChannel = _a.alphaChannel;\n this.rgbChannel = rgbChannel;\n var hasAlphaValues = alphaChannel.some(function (a) { return a < 255; });\n if (hasAlphaValues)\n this.alphaChannel = alphaChannel;\n this.type = getImageType(upng.ctype);\n this.width = upng.width;\n this.height = upng.height;\n this.bitsPerComponent = 8;\n }\n PNG.load = function (pngData) { return new PNG(pngData); };\n return PNG;\n}());\nexport { PNG };\n//# sourceMappingURL=png.js.map","import PDFArray from \"../objects/PDFArray\";\nimport PDFBool from \"../objects/PDFBool\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport { assertEachIs, assertInteger, assertIsOneOf, assertRange, } from \"../../utils\";\nvar asEnum = function (rawValue, enumType) {\n if (rawValue === undefined)\n return undefined;\n return enumType[rawValue];\n};\nexport var NonFullScreenPageMode;\n(function (NonFullScreenPageMode) {\n /**\n * After exiting FullScreen mode, neither the document outline nor thumbnail\n * images should be visible.\n */\n NonFullScreenPageMode[\"UseNone\"] = \"UseNone\";\n /** After exiting FullScreen mode, the document outline should be visible. */\n NonFullScreenPageMode[\"UseOutlines\"] = \"UseOutlines\";\n /** After exiting FullScreen mode, thumbnail images should be visible. */\n NonFullScreenPageMode[\"UseThumbs\"] = \"UseThumbs\";\n /**\n * After exiting FullScreen mode, the optional content group panel should be\n * visible.\n */\n NonFullScreenPageMode[\"UseOC\"] = \"UseOC\";\n})(NonFullScreenPageMode || (NonFullScreenPageMode = {}));\nexport var ReadingDirection;\n(function (ReadingDirection) {\n /** The predominant reading order is Left to Right. */\n ReadingDirection[\"L2R\"] = \"L2R\";\n /**\n * The predominant reading order is Right to left (including vertical writing\n * systems, such as Chinese, Japanese and Korean).\n */\n ReadingDirection[\"R2L\"] = \"R2L\";\n})(ReadingDirection || (ReadingDirection = {}));\nexport var PrintScaling;\n(function (PrintScaling) {\n /** No page scaling. */\n PrintScaling[\"None\"] = \"None\";\n /* Use the PDF reader's default print scaling. */\n PrintScaling[\"AppDefault\"] = \"AppDefault\";\n})(PrintScaling || (PrintScaling = {}));\nexport var Duplex;\n(function (Duplex) {\n /** The PDF reader should print single-sided. */\n Duplex[\"Simplex\"] = \"Simplex\";\n /**\n * The PDF reader should print double sided and flip on the short edge of the\n * sheet.\n */\n Duplex[\"DuplexFlipShortEdge\"] = \"DuplexFlipShortEdge\";\n /**\n * The PDF reader should print double sided and flip on the long edge of the\n * sheet.\n */\n Duplex[\"DuplexFlipLongEdge\"] = \"DuplexFlipLongEdge\";\n})(Duplex || (Duplex = {}));\nvar ViewerPreferences = /** @class */ (function () {\n /** @ignore */\n function ViewerPreferences(dict) {\n this.dict = dict;\n }\n ViewerPreferences.prototype.lookupBool = function (key) {\n var returnObj = this.dict.lookup(PDFName.of(key));\n if (returnObj instanceof PDFBool)\n return returnObj;\n return undefined;\n };\n ViewerPreferences.prototype.lookupName = function (key) {\n var returnObj = this.dict.lookup(PDFName.of(key));\n if (returnObj instanceof PDFName)\n return returnObj;\n return undefined;\n };\n /** @ignore */\n ViewerPreferences.prototype.HideToolbar = function () {\n return this.lookupBool('HideToolbar');\n };\n /** @ignore */\n ViewerPreferences.prototype.HideMenubar = function () {\n return this.lookupBool('HideMenubar');\n };\n /** @ignore */\n ViewerPreferences.prototype.HideWindowUI = function () {\n return this.lookupBool('HideWindowUI');\n };\n /** @ignore */\n ViewerPreferences.prototype.FitWindow = function () {\n return this.lookupBool('FitWindow');\n };\n /** @ignore */\n ViewerPreferences.prototype.CenterWindow = function () {\n return this.lookupBool('CenterWindow');\n };\n /** @ignore */\n ViewerPreferences.prototype.DisplayDocTitle = function () {\n return this.lookupBool('DisplayDocTitle');\n };\n /** @ignore */\n ViewerPreferences.prototype.NonFullScreenPageMode = function () {\n return this.lookupName('NonFullScreenPageMode');\n };\n /** @ignore */\n ViewerPreferences.prototype.Direction = function () {\n return this.lookupName('Direction');\n };\n /** @ignore */\n ViewerPreferences.prototype.PrintScaling = function () {\n return this.lookupName('PrintScaling');\n };\n /** @ignore */\n ViewerPreferences.prototype.Duplex = function () {\n return this.lookupName('Duplex');\n };\n /** @ignore */\n ViewerPreferences.prototype.PickTrayByPDFSize = function () {\n return this.lookupBool('PickTrayByPDFSize');\n };\n /** @ignore */\n ViewerPreferences.prototype.PrintPageRange = function () {\n var PrintPageRange = this.dict.lookup(PDFName.of('PrintPageRange'));\n if (PrintPageRange instanceof PDFArray)\n return PrintPageRange;\n return undefined;\n };\n /** @ignore */\n ViewerPreferences.prototype.NumCopies = function () {\n var NumCopies = this.dict.lookup(PDFName.of('NumCopies'));\n if (NumCopies instanceof PDFNumber)\n return NumCopies;\n return undefined;\n };\n /**\n * Returns `true` if PDF readers should hide the toolbar menus when displaying\n * this document.\n * @returns Whether or not toolbars should be hidden.\n */\n ViewerPreferences.prototype.getHideToolbar = function () {\n var _a, _b;\n return (_b = (_a = this.HideToolbar()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false;\n };\n /**\n * Returns `true` if PDF readers should hide the menu bar when displaying this\n * document.\n * @returns Whether or not the menu bar should be hidden.\n */\n ViewerPreferences.prototype.getHideMenubar = function () {\n var _a, _b;\n return (_b = (_a = this.HideMenubar()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false;\n };\n /**\n * Returns `true` if PDF readers should hide the user interface elements in\n * the document's window (such as scroll bars and navigation controls),\n * leaving only the document's contents displayed.\n * @returns Whether or not user interface elements should be hidden.\n */\n ViewerPreferences.prototype.getHideWindowUI = function () {\n var _a, _b;\n return (_b = (_a = this.HideWindowUI()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false;\n };\n /**\n * Returns `true` if PDF readers should resize the document's window to fit\n * the size of the first displayed page.\n * @returns Whether or not the window should be resized to fit.\n */\n ViewerPreferences.prototype.getFitWindow = function () {\n var _a, _b;\n return (_b = (_a = this.FitWindow()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false;\n };\n /**\n * Returns `true` if PDF readers should position the document's window in the\n * center of the screen.\n * @returns Whether or not to center the document window.\n */\n ViewerPreferences.prototype.getCenterWindow = function () {\n var _a, _b;\n return (_b = (_a = this.CenterWindow()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false;\n };\n /**\n * Returns `true` if the window's title bar should display the document\n * `Title`, taken from the document metadata (see [[PDFDocument.getTitle]]).\n * Returns `false` if the title bar should instead display the filename of the\n * PDF file.\n * @returns Whether to display the document title.\n */\n ViewerPreferences.prototype.getDisplayDocTitle = function () {\n var _a, _b;\n return (_b = (_a = this.DisplayDocTitle()) === null || _a === void 0 ? void 0 : _a.asBoolean()) !== null && _b !== void 0 ? _b : false;\n };\n /**\n * Returns the page mode, which tells the PDF reader how to display the\n * document after exiting full-screen mode.\n * @returns The page mode after exiting full-screen mode.\n */\n ViewerPreferences.prototype.getNonFullScreenPageMode = function () {\n var _a, _b;\n var mode = (_a = this.NonFullScreenPageMode()) === null || _a === void 0 ? void 0 : _a.decodeText();\n return (_b = asEnum(mode, NonFullScreenPageMode)) !== null && _b !== void 0 ? _b : NonFullScreenPageMode.UseNone;\n };\n /**\n * Returns the predominant reading order for text.\n * @returns The text reading order.\n */\n ViewerPreferences.prototype.getReadingDirection = function () {\n var _a, _b;\n var direction = (_a = this.Direction()) === null || _a === void 0 ? void 0 : _a.decodeText();\n return (_b = asEnum(direction, ReadingDirection)) !== null && _b !== void 0 ? _b : ReadingDirection.L2R;\n };\n /**\n * Returns the page scaling option that the PDF reader should select when the\n * print dialog is displayed.\n * @returns The page scaling option.\n */\n ViewerPreferences.prototype.getPrintScaling = function () {\n var _a, _b;\n var scaling = (_a = this.PrintScaling()) === null || _a === void 0 ? void 0 : _a.decodeText();\n return (_b = asEnum(scaling, PrintScaling)) !== null && _b !== void 0 ? _b : PrintScaling.AppDefault;\n };\n /**\n * Returns the paper handling option that should be used when printing the\n * file from the print dialog.\n * @returns The paper handling option.\n */\n ViewerPreferences.prototype.getDuplex = function () {\n var _a;\n var duplex = (_a = this.Duplex()) === null || _a === void 0 ? void 0 : _a.decodeText();\n return asEnum(duplex, Duplex);\n };\n /**\n * Returns `true` if the PDF page size should be used to select the input\n * paper tray.\n * @returns Whether or not the PDF page size should be used to select the\n * input paper tray.\n */\n ViewerPreferences.prototype.getPickTrayByPDFSize = function () {\n var _a;\n return (_a = this.PickTrayByPDFSize()) === null || _a === void 0 ? void 0 : _a.asBoolean();\n };\n /**\n * Returns an array of page number ranges, which are the values used to\n * initialize the print dialog box when the file is printed. Each range\n * specifies the first (`start`) and last (`end`) pages in a sub-range of\n * pages to be printed. The first page of the PDF file is denoted by 0.\n * For example:\n * ```js\n * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()\n * const includesPage3 = viewerPrefs\n * .getPrintRanges()\n * .some(pr => pr.start =< 2 && pr.end >= 2)\n * if (includesPage3) console.log('printRange includes page 3')\n * ```\n * @returns An array of objects, each with the properties `start` and `end`,\n * denoting page indices. If not, specified an empty array is\n * returned.\n */\n ViewerPreferences.prototype.getPrintPageRange = function () {\n var rng = this.PrintPageRange();\n if (!rng)\n return [];\n var pageRanges = [];\n for (var i = 0; i < rng.size(); i += 2) {\n // Despite the spec clearly stating that \"The first page of the PDF file\n // shall be donoted by 1\", several test PDFs (spec 1.7) created in\n // Acrobat XI 11.0 and also read with Reader DC 2020.013 indicate this is\n // actually a 0 based index.\n var start = rng.lookup(i, PDFNumber).asNumber();\n var end = rng.lookup(i + 1, PDFNumber).asNumber();\n pageRanges.push({ start: start, end: end });\n }\n return pageRanges;\n };\n /**\n * Returns the number of copies to be printed when the print dialog is opened\n * for this document.\n * @returns The default number of copies to be printed.\n */\n ViewerPreferences.prototype.getNumCopies = function () {\n var _a, _b;\n return (_b = (_a = this.NumCopies()) === null || _a === void 0 ? void 0 : _a.asNumber()) !== null && _b !== void 0 ? _b : 1;\n };\n /**\n * Choose whether the PDF reader's toolbars should be hidden while the\n * document is active.\n * @param hideToolbar `true` if the toolbar should be hidden.\n */\n ViewerPreferences.prototype.setHideToolbar = function (hideToolbar) {\n var HideToolbar = this.dict.context.obj(hideToolbar);\n this.dict.set(PDFName.of('HideToolbar'), HideToolbar);\n };\n /**\n * Choose whether the PDF reader's menu bar should be hidden while the\n * document is active.\n * @param hideMenubar `true` if the menu bar should be hidden.\n */\n ViewerPreferences.prototype.setHideMenubar = function (hideMenubar) {\n var HideMenubar = this.dict.context.obj(hideMenubar);\n this.dict.set(PDFName.of('HideMenubar'), HideMenubar);\n };\n /**\n * Choose whether the PDF reader should hide user interface elements in the\n * document's window (such as scroll bars and navigation controls), leaving\n * only the document's contents displayed.\n * @param hideWindowUI `true` if the user interface elements should be hidden.\n */\n ViewerPreferences.prototype.setHideWindowUI = function (hideWindowUI) {\n var HideWindowUI = this.dict.context.obj(hideWindowUI);\n this.dict.set(PDFName.of('HideWindowUI'), HideWindowUI);\n };\n /**\n * Choose whether the PDF reader should resize the document's window to fit\n * the size of the first displayed page.\n * @param fitWindow `true` if the window should be resized.\n */\n ViewerPreferences.prototype.setFitWindow = function (fitWindow) {\n var FitWindow = this.dict.context.obj(fitWindow);\n this.dict.set(PDFName.of('FitWindow'), FitWindow);\n };\n /**\n * Choose whether the PDF reader should position the document's window in the\n * center of the screen.\n * @param centerWindow `true` if the window should be centered.\n */\n ViewerPreferences.prototype.setCenterWindow = function (centerWindow) {\n var CenterWindow = this.dict.context.obj(centerWindow);\n this.dict.set(PDFName.of('CenterWindow'), CenterWindow);\n };\n /**\n * Choose whether the window's title bar should display the document `Title`\n * taken from the document metadata (see [[PDFDocument.setTitle]]). If\n * `false`, the title bar should instead display the PDF filename.\n * @param displayTitle `true` if the document title should be displayed.\n */\n ViewerPreferences.prototype.setDisplayDocTitle = function (displayTitle) {\n var DisplayDocTitle = this.dict.context.obj(displayTitle);\n this.dict.set(PDFName.of('DisplayDocTitle'), DisplayDocTitle);\n };\n /**\n * Choose how the PDF reader should display the document upon exiting\n * full-screen mode. This entry is meaningful only if the value of the\n * `PageMode` entry in the document's [[PDFCatalog]] is `FullScreen`.\n *\n * For example:\n * ```js\n * import { PDFDocument, NonFullScreenPageMode, PDFName } from 'pdf-lib'\n *\n * const pdfDoc = await PDFDocument.create()\n *\n * // Set the PageMode\n * pdfDoc.catalog.set(PDFName.of('PageMode'),PDFName.of('FullScreen'))\n *\n * // Set what happens when full-screen is closed\n * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()\n * viewerPrefs.setNonFullScreenPageMode(NonFullScreenPageMode.UseOutlines)\n * ```\n *\n * @param nonFullScreenPageMode How the document should be displayed upon\n * exiting full screen mode.\n */\n ViewerPreferences.prototype.setNonFullScreenPageMode = function (nonFullScreenPageMode) {\n assertIsOneOf(nonFullScreenPageMode, 'nonFullScreenPageMode', NonFullScreenPageMode);\n var mode = PDFName.of(nonFullScreenPageMode);\n this.dict.set(PDFName.of('NonFullScreenPageMode'), mode);\n };\n /**\n * Choose the predominant reading order for text.\n *\n * This entry has no direct effect on the document's contents or page\n * numbering, but may be used to determine the relative positioning of pages\n * when displayed side by side or printed n-up.\n *\n * For example:\n * ```js\n * import { PDFDocument, ReadingDirection } from 'pdf-lib'\n *\n * const pdfDoc = await PDFDocument.create()\n * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()\n * viewerPrefs.setReadingDirection(ReadingDirection.R2L)\n * ```\n *\n * @param readingDirection The reading order for text.\n */\n ViewerPreferences.prototype.setReadingDirection = function (readingDirection) {\n assertIsOneOf(readingDirection, 'readingDirection', ReadingDirection);\n var direction = PDFName.of(readingDirection);\n this.dict.set(PDFName.of('Direction'), direction);\n };\n /**\n * Choose the page scaling option that should be selected when a print dialog\n * is displayed for this document.\n *\n * For example:\n * ```js\n * import { PDFDocument, PrintScaling } from 'pdf-lib'\n *\n * const pdfDoc = await PDFDocument.create()\n * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()\n * viewerPrefs.setPrintScaling(PrintScaling.None)\n * ```\n *\n * @param printScaling The print scaling option.\n */\n ViewerPreferences.prototype.setPrintScaling = function (printScaling) {\n assertIsOneOf(printScaling, 'printScaling', PrintScaling);\n var scaling = PDFName.of(printScaling);\n this.dict.set(PDFName.of('PrintScaling'), scaling);\n };\n /**\n * Choose the paper handling option that should be selected by default in the\n * print dialog.\n *\n * For example:\n * ```js\n * import { PDFDocument, Duplex } from 'pdf-lib'\n *\n * const pdfDoc = await PDFDocument.create()\n * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()\n * viewerPrefs.setDuplex(Duplex.DuplexFlipShortEdge)\n * ```\n *\n * @param duplex The double or single sided printing option.\n */\n ViewerPreferences.prototype.setDuplex = function (duplex) {\n assertIsOneOf(duplex, 'duplex', Duplex);\n var dup = PDFName.of(duplex);\n this.dict.set(PDFName.of('Duplex'), dup);\n };\n /**\n * Choose whether the PDF document's page size should be used to select the\n * input paper tray when printing. This setting influences only the preset\n * values used to populate the print dialog presented by a PDF reader.\n *\n * If PickTrayByPDFSize is true, the check box in the print dialog associated\n * with input paper tray should be checked. This setting has no effect on\n * operating systems that do not provide the ability to pick the input tray\n * by size.\n *\n * @param pickTrayByPDFSize `true` if the document's page size should be used\n * to select the input paper tray.\n */\n ViewerPreferences.prototype.setPickTrayByPDFSize = function (pickTrayByPDFSize) {\n var PickTrayByPDFSize = this.dict.context.obj(pickTrayByPDFSize);\n this.dict.set(PDFName.of('PickTrayByPDFSize'), PickTrayByPDFSize);\n };\n /**\n * Choose the page numbers used to initialize the print dialog box when the\n * file is printed. The first page of the PDF file is denoted by 0.\n *\n * For example:\n * ```js\n * import { PDFDocument } from 'pdf-lib'\n *\n * const pdfDoc = await PDFDocument.create()\n * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()\n *\n * // We can set the default print range to only the first page\n * viewerPrefs.setPrintPageRange({ start: 0, end: 0 })\n *\n * // Or we can supply noncontiguous ranges (e.g. pages 1, 3, and 5-7)\n * viewerPrefs.setPrintPageRange([\n * { start: 0, end: 0 },\n * { start: 2, end: 2 },\n * { start: 4, end: 6 },\n * ])\n * ```\n *\n * @param printPageRange An object or array of objects, each with the\n * properties `start` and `end`, denoting a range of\n * page indices.\n */\n ViewerPreferences.prototype.setPrintPageRange = function (printPageRange) {\n if (!Array.isArray(printPageRange))\n printPageRange = [printPageRange];\n var flatRange = [];\n for (var idx = 0, len = printPageRange.length; idx < len; idx++) {\n flatRange.push(printPageRange[idx].start);\n flatRange.push(printPageRange[idx].end);\n }\n assertEachIs(flatRange, 'printPageRange', ['number']);\n var pageRanges = this.dict.context.obj(flatRange);\n this.dict.set(PDFName.of('PrintPageRange'), pageRanges);\n };\n /**\n * Choose the default number of copies to be printed when the print dialog is\n * opened for this file.\n * @param numCopies The default number of copies.\n */\n ViewerPreferences.prototype.setNumCopies = function (numCopies) {\n assertRange(numCopies, 'numCopies', 1, Number.MAX_VALUE);\n assertInteger(numCopies, 'numCopies');\n var NumCopies = this.dict.context.obj(numCopies);\n this.dict.set(PDFName.of('NumCopies'), NumCopies);\n };\n /** @ignore */\n ViewerPreferences.fromDict = function (dict) {\n return new ViewerPreferences(dict);\n };\n /** @ignore */\n ViewerPreferences.create = function (context) {\n var dict = context.obj({});\n return new ViewerPreferences(dict);\n };\n return ViewerPreferences;\n}());\nexport default ViewerPreferences;\n//# sourceMappingURL=ViewerPreferences.js.map","var flag = function (bitIndex) { return 1 << bitIndex; };\n/** From PDF spec table 221 */\nexport var AcroFieldFlags;\n(function (AcroFieldFlags) {\n /**\n * If set, the user may not change the value of the field. Any associated\n * widget annotations will not interact with the user; that is, they will not\n * respond to mouse clicks or change their appearance in response to mouse\n * motions. This flag is useful for fields whose values are computed or\n * imported from a database.\n */\n AcroFieldFlags[AcroFieldFlags[\"ReadOnly\"] = flag(1 - 1)] = \"ReadOnly\";\n /**\n * If set, the field shall have a value at the time it is exported by a\n * submit-form action (see 12.7.5.2, \"Submit-Form Action\").\n */\n AcroFieldFlags[AcroFieldFlags[\"Required\"] = flag(2 - 1)] = \"Required\";\n /**\n * If set, the field shall not be exported by a submit-form action\n * (see 12.7.5.2, \"Submit-Form Action\").\n */\n AcroFieldFlags[AcroFieldFlags[\"NoExport\"] = flag(3 - 1)] = \"NoExport\";\n})(AcroFieldFlags || (AcroFieldFlags = {}));\n/** From PDF spec table 226 */\nexport var AcroButtonFlags;\n(function (AcroButtonFlags) {\n /**\n * (Radio buttons only) If set, exactly one radio button shall be selected at\n * all times; selecting the currently selected button has no effect. If clear,\n * clicking the selected button deselects it, leaving no button selected.\n */\n AcroButtonFlags[AcroButtonFlags[\"NoToggleToOff\"] = flag(15 - 1)] = \"NoToggleToOff\";\n /**\n * If set, the field is a set of radio buttons; if clear, the field is a check\n * box. This flag may be set only if the Pushbutton flag is clear.\n */\n AcroButtonFlags[AcroButtonFlags[\"Radio\"] = flag(16 - 1)] = \"Radio\";\n /**\n * If set, the field is a pushbutton that does not retain a permanent value.\n */\n AcroButtonFlags[AcroButtonFlags[\"PushButton\"] = flag(17 - 1)] = \"PushButton\";\n /**\n * If set, a group of radio buttons within a radio button field that use the\n * same value for the on state will turn on and off in unison; that is if one\n * is checked, they are all checked. If clear, the buttons are mutually\n * exclusive (the same behavior as HTML radio buttons).\n */\n AcroButtonFlags[AcroButtonFlags[\"RadiosInUnison\"] = flag(26 - 1)] = \"RadiosInUnison\";\n})(AcroButtonFlags || (AcroButtonFlags = {}));\n/** From PDF spec table 228 */\nexport var AcroTextFlags;\n(function (AcroTextFlags) {\n /**\n * If set, the field may contain multiple lines of text; if clear, the field's\n * text shall be restricted to a single line.\n */\n AcroTextFlags[AcroTextFlags[\"Multiline\"] = flag(13 - 1)] = \"Multiline\";\n /**\n * If set, the field is intended for entering a secure password that should\n * not be echoed visibly to the screen. Characters typed from the keyboard\n * shall instead be echoed in some unreadable form, such as asterisks or\n * bullet characters.\n * > NOTE To protect password confidentiality, readers should never store\n * > the value of the text field in the PDF file if this flag is set.\n */\n AcroTextFlags[AcroTextFlags[\"Password\"] = flag(14 - 1)] = \"Password\";\n /**\n * If set, the text entered in the field represents the pathname of a file\n * whose contents shall be submitted as the value of the field.\n */\n AcroTextFlags[AcroTextFlags[\"FileSelect\"] = flag(21 - 1)] = \"FileSelect\";\n /**\n * If set, text entered in the field shall not be spell-checked.\n */\n AcroTextFlags[AcroTextFlags[\"DoNotSpellCheck\"] = flag(23 - 1)] = \"DoNotSpellCheck\";\n /**\n * If set, the field shall not scroll (horizontally for single-line fields,\n * vertically for multiple-line fields) to accommodate more text than fits\n * within its annotation rectangle. Once the field is full, no further text\n * shall be accepted for interactive form filling; for non-interactive form\n * filling, the filler should take care not to add more character than will\n * visibly fit in the defined area.\n */\n AcroTextFlags[AcroTextFlags[\"DoNotScroll\"] = flag(24 - 1)] = \"DoNotScroll\";\n /**\n * May be set only if the MaxLen entry is present in the text field dictionary\n * (see Table 229) and if the Multiline, Password, and FileSelect flags are\n * clear. If set, the field shall be automatically divided into as many\n * equally spaced positions, or combs, as the value of MaxLen, and the text\n * is laid out into those combs.\n */\n AcroTextFlags[AcroTextFlags[\"Comb\"] = flag(25 - 1)] = \"Comb\";\n /**\n * If set, the value of this field shall be a rich text string\n * (see 12.7.3.4, \"Rich Text Strings\"). If the field has a value, the RV\n * entry of the field dictionary (Table 222) shall specify the rich text\n * string.\n */\n AcroTextFlags[AcroTextFlags[\"RichText\"] = flag(26 - 1)] = \"RichText\";\n})(AcroTextFlags || (AcroTextFlags = {}));\n/** From PDF spec table 230 */\nexport var AcroChoiceFlags;\n(function (AcroChoiceFlags) {\n /**\n * If set, the field is a combo box; if clear, the field is a list box.\n */\n AcroChoiceFlags[AcroChoiceFlags[\"Combo\"] = flag(18 - 1)] = \"Combo\";\n /**\n * If set, the combo box shall include an editable text box as well as a\n * drop-down list; if clear, it shall include only a drop-down list. This\n * flag shall be used only if the Combo flag is set.\n */\n AcroChoiceFlags[AcroChoiceFlags[\"Edit\"] = flag(19 - 1)] = \"Edit\";\n /**\n * If set, the field's option items shall be sorted alphabetically. This flag\n * is intended for use by writers, not by readers. Conforming readers shall\n * display the options in the order in which they occur in the Opt array\n * (see Table 231).\n */\n AcroChoiceFlags[AcroChoiceFlags[\"Sort\"] = flag(20 - 1)] = \"Sort\";\n /**\n * If set, more than one of the field's option items may be selected\n * simultaneously; if clear, at most one item shall be selected.\n */\n AcroChoiceFlags[AcroChoiceFlags[\"MultiSelect\"] = flag(22 - 1)] = \"MultiSelect\";\n /**\n * If set, text entered in the field shall not be spell-checked. This flag\n * shall not be used unless the Combo and Edit flags are both set.\n */\n AcroChoiceFlags[AcroChoiceFlags[\"DoNotSpellCheck\"] = flag(23 - 1)] = \"DoNotSpellCheck\";\n /**\n * If set, the new value shall be committed as soon as a selection is made\n * (commonly with the pointing device). In this case, supplying a value for\n * a field involves three actions: selecting the field for fill-in,\n * selecting a choice for the fill-in value, and leaving that field, which\n * finalizes or \"commits\" the data choice and triggers any actions associated\n * with the entry or changing of this data. If this flag is on, then\n * processing does not wait for leaving the field action to occur, but\n * immediately proceeds to the third step.\n *\n * This option enables applications to perform an action once a selection is\n * made, without requiring the user to exit the field. If clear, the new\n * value is not committed until the user exits the field.\n */\n AcroChoiceFlags[AcroChoiceFlags[\"CommitOnSelChange\"] = flag(27 - 1)] = \"CommitOnSelChange\";\n})(AcroChoiceFlags || (AcroChoiceFlags = {}));\n//# sourceMappingURL=flags.js.map","var flag = function (bitIndex) { return 1 << bitIndex; };\n/** From PDF spec table 165 */\nexport var AnnotationFlags;\n(function (AnnotationFlags) {\n /**\n * If set, do not display the annotation if it does not belong to one of the\n * standard annotation types and no annotation handler is available. If clear,\n * display such an unknown annotation using an appearance stream specified by\n * its appearance dictionary, if any.\n */\n AnnotationFlags[AnnotationFlags[\"Invisible\"] = flag(1 - 1)] = \"Invisible\";\n /**\n * If set, do not display or print the annotation or allow it to interact with\n * the user, regardless of its annotation type or whether an annotation\n * handler is available.\n *\n * In cases where screen space is limited, the ability to hide and show\n * annotations selectively can be used in combination with appearance streams\n * to display auxiliary pop-up information similar in function to online help\n * systems.\n */\n AnnotationFlags[AnnotationFlags[\"Hidden\"] = flag(2 - 1)] = \"Hidden\";\n /**\n * If set, print the annotation when the page is printed. If clear, never\n * print the annotation, regardless of whether it is displayed on the screen.\n *\n * This can be useful for annotations representing interactive pushbuttons,\n * which would serve no meaningful purpose on the printed page.\n */\n AnnotationFlags[AnnotationFlags[\"Print\"] = flag(3 - 1)] = \"Print\";\n /**\n * If set, do not scale the annotation’s appearance to match the magnification\n * of the page. The location of the annotation on the page (defined by the\n * upper-left corner of its annotation rectangle) shall remain fixed,\n * regardless of the page magnification.\n */\n AnnotationFlags[AnnotationFlags[\"NoZoom\"] = flag(4 - 1)] = \"NoZoom\";\n /**\n * If set, do not rotate the annotation’s appearance to match the rotation of\n * the page. The upper-left corner of the annotation rectangle shall remain in\n * a fixed location on the page, regardless of the page rotation.\n */\n AnnotationFlags[AnnotationFlags[\"NoRotate\"] = flag(5 - 1)] = \"NoRotate\";\n /**\n * If set, do not display the annotation on the screen or allow it to interact\n * with the user. The annotation may be printed (depending on the setting of\n * the Print flag) but should be considered hidden for purposes of on-screen\n * display and user interaction.\n */\n AnnotationFlags[AnnotationFlags[\"NoView\"] = flag(6 - 1)] = \"NoView\";\n /**\n * If set, do not allow the annotation to interact with the user. The\n * annotation may be displayed or printed (depending on the settings of the\n * NoView and Print flags) but should not respond to mouse clicks or change\n * its appearance in response to mouse motions.\n *\n * This flag shall be ignored for widget annotations; its function is\n * subsumed by the ReadOnly flag of the associated form field.\n */\n AnnotationFlags[AnnotationFlags[\"ReadOnly\"] = flag(7 - 1)] = \"ReadOnly\";\n /**\n * If set, do not allow the annotation to be deleted or its properties\n * (including position and size) to be modified by the user. However, this\n * flag does not restrict changes to the annotation’s contents, such as the\n * value of a form field.\n */\n AnnotationFlags[AnnotationFlags[\"Locked\"] = flag(8 - 1)] = \"Locked\";\n /**\n * If set, invert the interpretation of the NoView flag for certain events.\n *\n * A typical use is to have an annotation that appears only when a mouse\n * cursor is held over it.\n */\n AnnotationFlags[AnnotationFlags[\"ToggleNoView\"] = flag(9 - 1)] = \"ToggleNoView\";\n /**\n * If set, do not allow the contents of the annotation to be modified by the\n * user. This flag does not restrict deletion of the annotation or changes to\n * other annotation properties, such as position and size.\n */\n AnnotationFlags[AnnotationFlags[\"LockedContents\"] = flag(10 - 1)] = \"LockedContents\";\n})(AnnotationFlags || (AnnotationFlags = {}));\n//# sourceMappingURL=flags.js.map","import CharCodes from \"../syntax/CharCodes\";\nimport { charFromCode, copyStringIntoBuffer } from \"../../utils\";\nvar PDFHeader = /** @class */ (function () {\n function PDFHeader(major, minor) {\n this.major = String(major);\n this.minor = String(minor);\n }\n PDFHeader.prototype.toString = function () {\n var bc = charFromCode(129);\n return \"%PDF-\" + this.major + \".\" + this.minor + \"\\n%\" + bc + bc + bc + bc;\n };\n PDFHeader.prototype.sizeInBytes = function () {\n return 12 + this.major.length + this.minor.length;\n };\n PDFHeader.prototype.copyBytesInto = function (buffer, offset) {\n var initialOffset = offset;\n buffer[offset++] = CharCodes.Percent;\n buffer[offset++] = CharCodes.P;\n buffer[offset++] = CharCodes.D;\n buffer[offset++] = CharCodes.F;\n buffer[offset++] = CharCodes.Dash;\n offset += copyStringIntoBuffer(this.major, buffer, offset);\n buffer[offset++] = CharCodes.Period;\n offset += copyStringIntoBuffer(this.minor, buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n buffer[offset++] = CharCodes.Percent;\n buffer[offset++] = 129;\n buffer[offset++] = 129;\n buffer[offset++] = 129;\n buffer[offset++] = 129;\n return offset - initialOffset;\n };\n PDFHeader.forVersion = function (major, minor) {\n return new PDFHeader(major, minor);\n };\n return PDFHeader;\n}());\nexport default PDFHeader;\n//# sourceMappingURL=PDFHeader.js.map","import { __extends } from \"tslib\";\nimport { copyStringIntoBuffer, numberToString } from \"../../utils/index\";\nimport PDFObject from \"./PDFObject\";\nvar PDFNumber = /** @class */ (function (_super) {\n __extends(PDFNumber, _super);\n function PDFNumber(value) {\n var _this = _super.call(this) || this;\n _this.numberValue = value;\n _this.stringValue = numberToString(value);\n return _this;\n }\n PDFNumber.prototype.asNumber = function () {\n return this.numberValue;\n };\n /** @deprecated in favor of [[PDFNumber.asNumber]] */\n PDFNumber.prototype.value = function () {\n return this.numberValue;\n };\n PDFNumber.prototype.clone = function () {\n return PDFNumber.of(this.numberValue);\n };\n PDFNumber.prototype.toString = function () {\n return this.stringValue;\n };\n PDFNumber.prototype.sizeInBytes = function () {\n return this.stringValue.length;\n };\n PDFNumber.prototype.copyBytesInto = function (buffer, offset) {\n offset += copyStringIntoBuffer(this.stringValue, buffer, offset);\n return this.stringValue.length;\n };\n PDFNumber.of = function (value) { return new PDFNumber(value); };\n return PDFNumber;\n}(PDFObject));\nexport default PDFNumber;\n//# sourceMappingURL=PDFNumber.js.map","import { __extends, __spreadArrays } from \"tslib\";\nimport PDFNumber from \"./PDFNumber\";\nimport PDFObject from \"./PDFObject\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { PDFArrayIsNotRectangleError } from \"../errors\";\nvar PDFArray = /** @class */ (function (_super) {\n __extends(PDFArray, _super);\n function PDFArray(context) {\n var _this = _super.call(this) || this;\n _this.array = [];\n _this.context = context;\n return _this;\n }\n PDFArray.prototype.size = function () {\n return this.array.length;\n };\n PDFArray.prototype.push = function (object) {\n this.array.push(object);\n };\n PDFArray.prototype.insert = function (index, object) {\n this.array.splice(index, 0, object);\n };\n PDFArray.prototype.indexOf = function (object) {\n var index = this.array.indexOf(object);\n return index === -1 ? undefined : index;\n };\n PDFArray.prototype.remove = function (index) {\n this.array.splice(index, 1);\n };\n PDFArray.prototype.set = function (idx, object) {\n this.array[idx] = object;\n };\n PDFArray.prototype.get = function (index) {\n return this.array[index];\n };\n PDFArray.prototype.lookupMaybe = function (index) {\n var _a;\n var types = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n types[_i - 1] = arguments[_i];\n }\n return (_a = this.context).lookupMaybe.apply(_a, __spreadArrays([this.get(index)], types));\n };\n PDFArray.prototype.lookup = function (index) {\n var _a;\n var types = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n types[_i - 1] = arguments[_i];\n }\n return (_a = this.context).lookup.apply(_a, __spreadArrays([this.get(index)], types));\n };\n PDFArray.prototype.asRectangle = function () {\n if (this.size() !== 4)\n throw new PDFArrayIsNotRectangleError(this.size());\n var lowerLeftX = this.lookup(0, PDFNumber).asNumber();\n var lowerLeftY = this.lookup(1, PDFNumber).asNumber();\n var upperRightX = this.lookup(2, PDFNumber).asNumber();\n var upperRightY = this.lookup(3, PDFNumber).asNumber();\n var x = lowerLeftX;\n var y = lowerLeftY;\n var width = upperRightX - lowerLeftX;\n var height = upperRightY - lowerLeftY;\n return { x: x, y: y, width: width, height: height };\n };\n PDFArray.prototype.asArray = function () {\n return this.array.slice();\n };\n PDFArray.prototype.clone = function (context) {\n var clone = PDFArray.withContext(context || this.context);\n for (var idx = 0, len = this.size(); idx < len; idx++) {\n clone.push(this.array[idx]);\n }\n return clone;\n };\n PDFArray.prototype.toString = function () {\n var arrayString = '[ ';\n for (var idx = 0, len = this.size(); idx < len; idx++) {\n arrayString += this.get(idx).toString();\n arrayString += ' ';\n }\n arrayString += ']';\n return arrayString;\n };\n PDFArray.prototype.sizeInBytes = function () {\n var size = 3;\n for (var idx = 0, len = this.size(); idx < len; idx++) {\n size += this.get(idx).sizeInBytes() + 1;\n }\n return size;\n };\n PDFArray.prototype.copyBytesInto = function (buffer, offset) {\n var initialOffset = offset;\n buffer[offset++] = CharCodes.LeftSquareBracket;\n buffer[offset++] = CharCodes.Space;\n for (var idx = 0, len = this.size(); idx < len; idx++) {\n offset += this.get(idx).copyBytesInto(buffer, offset);\n buffer[offset++] = CharCodes.Space;\n }\n buffer[offset++] = CharCodes.RightSquareBracket;\n return offset - initialOffset;\n };\n PDFArray.prototype.scalePDFNumbers = function (x, y) {\n for (var idx = 0, len = this.size(); idx < len; idx++) {\n var el = this.lookup(idx);\n if (el instanceof PDFNumber) {\n var factor = idx % 2 === 0 ? x : y;\n this.set(idx, PDFNumber.of(el.asNumber() * factor));\n }\n }\n };\n PDFArray.withContext = function (context) { return new PDFArray(context); };\n return PDFArray;\n}(PDFObject));\nexport default PDFArray;\n//# sourceMappingURL=PDFArray.js.map","import { __extends } from \"tslib\";\nimport { PrivateConstructorError } from \"../errors\";\nimport PDFObject from \"./PDFObject\";\nimport CharCodes from \"../syntax/CharCodes\";\nvar ENFORCER = {};\nvar PDFBool = /** @class */ (function (_super) {\n __extends(PDFBool, _super);\n function PDFBool(enforcer, value) {\n var _this = this;\n if (enforcer !== ENFORCER)\n throw new PrivateConstructorError('PDFBool');\n _this = _super.call(this) || this;\n _this.value = value;\n return _this;\n }\n PDFBool.prototype.asBoolean = function () {\n return this.value;\n };\n PDFBool.prototype.clone = function () {\n return this;\n };\n PDFBool.prototype.toString = function () {\n return String(this.value);\n };\n PDFBool.prototype.sizeInBytes = function () {\n return this.value ? 4 : 5;\n };\n PDFBool.prototype.copyBytesInto = function (buffer, offset) {\n if (this.value) {\n buffer[offset++] = CharCodes.t;\n buffer[offset++] = CharCodes.r;\n buffer[offset++] = CharCodes.u;\n buffer[offset++] = CharCodes.e;\n return 4;\n }\n else {\n buffer[offset++] = CharCodes.f;\n buffer[offset++] = CharCodes.a;\n buffer[offset++] = CharCodes.l;\n buffer[offset++] = CharCodes.s;\n buffer[offset++] = CharCodes.e;\n return 5;\n }\n };\n PDFBool.True = new PDFBool(ENFORCER, true);\n PDFBool.False = new PDFBool(ENFORCER, false);\n return PDFBool;\n}(PDFObject));\nexport default PDFBool;\n//# sourceMappingURL=PDFBool.js.map","import CharCodes from \"./CharCodes\";\nexport var IsDelimiter = new Uint8Array(256);\nIsDelimiter[CharCodes.LeftParen] = 1;\nIsDelimiter[CharCodes.RightParen] = 1;\nIsDelimiter[CharCodes.LessThan] = 1;\nIsDelimiter[CharCodes.GreaterThan] = 1;\nIsDelimiter[CharCodes.LeftSquareBracket] = 1;\nIsDelimiter[CharCodes.RightSquareBracket] = 1;\nIsDelimiter[CharCodes.LeftCurly] = 1;\nIsDelimiter[CharCodes.RightCurly] = 1;\nIsDelimiter[CharCodes.ForwardSlash] = 1;\nIsDelimiter[CharCodes.Percent] = 1;\n//# sourceMappingURL=Delimiters.js.map","import CharCodes from \"./CharCodes\";\nexport var IsWhitespace = new Uint8Array(256);\nIsWhitespace[CharCodes.Null] = 1;\nIsWhitespace[CharCodes.Tab] = 1;\nIsWhitespace[CharCodes.Newline] = 1;\nIsWhitespace[CharCodes.FormFeed] = 1;\nIsWhitespace[CharCodes.CarriageReturn] = 1;\nIsWhitespace[CharCodes.Space] = 1;\n//# sourceMappingURL=Whitespace.js.map","import CharCodes from \"./CharCodes\";\nimport { IsDelimiter } from \"./Delimiters\";\nimport { IsWhitespace } from \"./Whitespace\";\nexport var IsIrregular = new Uint8Array(256);\nfor (var idx = 0, len = 256; idx < len; idx++) {\n IsIrregular[idx] = IsWhitespace[idx] || IsDelimiter[idx] ? 1 : 0;\n}\nIsIrregular[CharCodes.Hash] = 1;\n//# sourceMappingURL=Irregular.js.map","import { __extends } from \"tslib\";\nimport { PrivateConstructorError } from \"../errors\";\nimport PDFObject from \"./PDFObject\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { IsIrregular } from \"../syntax/Irregular\";\nimport { charFromHexCode, copyStringIntoBuffer, toCharCode, toHexString, } from \"../../utils\";\nvar decodeName = function (name) {\n return name.replace(/#([\\dABCDEF]{2})/g, function (_, hex) { return charFromHexCode(hex); });\n};\nvar isRegularChar = function (charCode) {\n return charCode >= CharCodes.ExclamationPoint &&\n charCode <= CharCodes.Tilde &&\n !IsIrregular[charCode];\n};\nvar ENFORCER = {};\nvar pool = new Map();\nvar PDFName = /** @class */ (function (_super) {\n __extends(PDFName, _super);\n function PDFName(enforcer, name) {\n var _this = this;\n if (enforcer !== ENFORCER)\n throw new PrivateConstructorError('PDFName');\n _this = _super.call(this) || this;\n var encodedName = '/';\n for (var idx = 0, len = name.length; idx < len; idx++) {\n var character = name[idx];\n var code = toCharCode(character);\n encodedName += isRegularChar(code) ? character : \"#\" + toHexString(code);\n }\n _this.encodedName = encodedName;\n return _this;\n }\n PDFName.prototype.asBytes = function () {\n var bytes = [];\n var hex = '';\n var escaped = false;\n var pushByte = function (byte) {\n if (byte !== undefined)\n bytes.push(byte);\n escaped = false;\n };\n for (var idx = 1, len = this.encodedName.length; idx < len; idx++) {\n var char = this.encodedName[idx];\n var byte = toCharCode(char);\n var nextChar = this.encodedName[idx + 1];\n if (!escaped) {\n if (byte === CharCodes.Hash)\n escaped = true;\n else\n pushByte(byte);\n }\n else {\n if ((byte >= CharCodes.Zero && byte <= CharCodes.Nine) ||\n (byte >= CharCodes.a && byte <= CharCodes.f) ||\n (byte >= CharCodes.A && byte <= CharCodes.F)) {\n hex += char;\n if (hex.length === 2 ||\n !((nextChar >= '0' && nextChar <= '9') ||\n (nextChar >= 'a' && nextChar <= 'f') ||\n (nextChar >= 'A' && nextChar <= 'F'))) {\n pushByte(parseInt(hex, 16));\n hex = '';\n }\n }\n else {\n pushByte(byte);\n }\n }\n }\n return new Uint8Array(bytes);\n };\n // TODO: This should probably use `utf8Decode()`\n // TODO: Polyfill Array.from?\n PDFName.prototype.decodeText = function () {\n var bytes = this.asBytes();\n return String.fromCharCode.apply(String, Array.from(bytes));\n };\n PDFName.prototype.asString = function () {\n return this.encodedName;\n };\n /** @deprecated in favor of [[PDFName.asString]] */\n PDFName.prototype.value = function () {\n return this.encodedName;\n };\n PDFName.prototype.clone = function () {\n return this;\n };\n PDFName.prototype.toString = function () {\n return this.encodedName;\n };\n PDFName.prototype.sizeInBytes = function () {\n return this.encodedName.length;\n };\n PDFName.prototype.copyBytesInto = function (buffer, offset) {\n offset += copyStringIntoBuffer(this.encodedName, buffer, offset);\n return this.encodedName.length;\n };\n PDFName.of = function (name) {\n var decodedValue = decodeName(name);\n var instance = pool.get(decodedValue);\n if (!instance) {\n instance = new PDFName(ENFORCER, decodedValue);\n pool.set(decodedValue, instance);\n }\n return instance;\n };\n /* tslint:disable member-ordering */\n PDFName.Length = PDFName.of('Length');\n PDFName.FlateDecode = PDFName.of('FlateDecode');\n PDFName.Resources = PDFName.of('Resources');\n PDFName.Font = PDFName.of('Font');\n PDFName.XObject = PDFName.of('XObject');\n PDFName.ExtGState = PDFName.of('ExtGState');\n PDFName.Contents = PDFName.of('Contents');\n PDFName.Type = PDFName.of('Type');\n PDFName.Parent = PDFName.of('Parent');\n PDFName.MediaBox = PDFName.of('MediaBox');\n PDFName.Page = PDFName.of('Page');\n PDFName.Annots = PDFName.of('Annots');\n PDFName.TrimBox = PDFName.of('TrimBox');\n PDFName.ArtBox = PDFName.of('ArtBox');\n PDFName.BleedBox = PDFName.of('BleedBox');\n PDFName.CropBox = PDFName.of('CropBox');\n PDFName.Rotate = PDFName.of('Rotate');\n PDFName.Title = PDFName.of('Title');\n PDFName.Author = PDFName.of('Author');\n PDFName.Subject = PDFName.of('Subject');\n PDFName.Creator = PDFName.of('Creator');\n PDFName.Keywords = PDFName.of('Keywords');\n PDFName.Producer = PDFName.of('Producer');\n PDFName.CreationDate = PDFName.of('CreationDate');\n PDFName.ModDate = PDFName.of('ModDate');\n return PDFName;\n}(PDFObject));\nexport default PDFName;\n//# sourceMappingURL=PDFName.js.map","import { __extends } from \"tslib\";\nimport PDFObject from \"./PDFObject\";\nimport CharCodes from \"../syntax/CharCodes\";\nvar PDFNull = /** @class */ (function (_super) {\n __extends(PDFNull, _super);\n function PDFNull() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFNull.prototype.asNull = function () {\n return null;\n };\n PDFNull.prototype.clone = function () {\n return this;\n };\n PDFNull.prototype.toString = function () {\n return 'null';\n };\n PDFNull.prototype.sizeInBytes = function () {\n return 4;\n };\n PDFNull.prototype.copyBytesInto = function (buffer, offset) {\n buffer[offset++] = CharCodes.n;\n buffer[offset++] = CharCodes.u;\n buffer[offset++] = CharCodes.l;\n buffer[offset++] = CharCodes.l;\n return 4;\n };\n return PDFNull;\n}(PDFObject));\nexport default new PDFNull();\n//# sourceMappingURL=PDFNull.js.map","import { __extends, __spreadArrays } from \"tslib\";\nimport PDFName from \"./PDFName\";\nimport PDFNull from \"./PDFNull\";\nimport PDFObject from \"./PDFObject\";\nimport CharCodes from \"../syntax/CharCodes\";\nvar PDFDict = /** @class */ (function (_super) {\n __extends(PDFDict, _super);\n function PDFDict(map, context) {\n var _this = _super.call(this) || this;\n _this.dict = map;\n _this.context = context;\n return _this;\n }\n PDFDict.prototype.keys = function () {\n return Array.from(this.dict.keys());\n };\n PDFDict.prototype.values = function () {\n return Array.from(this.dict.values());\n };\n PDFDict.prototype.entries = function () {\n return Array.from(this.dict.entries());\n };\n PDFDict.prototype.set = function (key, value) {\n this.dict.set(key, value);\n };\n PDFDict.prototype.get = function (key, \n // TODO: `preservePDFNull` is for backwards compatibility. Should be\n // removed in next breaking API change.\n preservePDFNull) {\n if (preservePDFNull === void 0) { preservePDFNull = false; }\n var value = this.dict.get(key);\n if (value === PDFNull && !preservePDFNull)\n return undefined;\n return value;\n };\n PDFDict.prototype.has = function (key) {\n var value = this.dict.get(key);\n return value !== undefined && value !== PDFNull;\n };\n PDFDict.prototype.lookupMaybe = function (key) {\n var _a;\n var types = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n types[_i - 1] = arguments[_i];\n }\n // TODO: `preservePDFNull` is for backwards compatibility. Should be\n // removed in next breaking API change.\n var preservePDFNull = types.includes(PDFNull);\n var value = (_a = this.context).lookupMaybe.apply(_a, __spreadArrays([this.get(key, preservePDFNull)], types));\n if (value === PDFNull && !preservePDFNull)\n return undefined;\n return value;\n };\n PDFDict.prototype.lookup = function (key) {\n var _a;\n var types = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n types[_i - 1] = arguments[_i];\n }\n // TODO: `preservePDFNull` is for backwards compatibility. Should be\n // removed in next breaking API change.\n var preservePDFNull = types.includes(PDFNull);\n var value = (_a = this.context).lookup.apply(_a, __spreadArrays([this.get(key, preservePDFNull)], types));\n if (value === PDFNull && !preservePDFNull)\n return undefined;\n return value;\n };\n PDFDict.prototype.delete = function (key) {\n return this.dict.delete(key);\n };\n PDFDict.prototype.asMap = function () {\n return new Map(this.dict);\n };\n /** Generate a random key that doesn't exist in current key set */\n PDFDict.prototype.uniqueKey = function (tag) {\n if (tag === void 0) { tag = ''; }\n var existingKeys = this.keys();\n var key = PDFName.of(this.context.addRandomSuffix(tag, 10));\n while (existingKeys.includes(key)) {\n key = PDFName.of(this.context.addRandomSuffix(tag, 10));\n }\n return key;\n };\n PDFDict.prototype.clone = function (context) {\n var clone = PDFDict.withContext(context || this.context);\n var entries = this.entries();\n for (var idx = 0, len = entries.length; idx < len; idx++) {\n var _a = entries[idx], key = _a[0], value = _a[1];\n clone.set(key, value);\n }\n return clone;\n };\n PDFDict.prototype.toString = function () {\n var dictString = '<<\\n';\n var entries = this.entries();\n for (var idx = 0, len = entries.length; idx < len; idx++) {\n var _a = entries[idx], key = _a[0], value = _a[1];\n dictString += key.toString() + ' ' + value.toString() + '\\n';\n }\n dictString += '>>';\n return dictString;\n };\n PDFDict.prototype.sizeInBytes = function () {\n var size = 5;\n var entries = this.entries();\n for (var idx = 0, len = entries.length; idx < len; idx++) {\n var _a = entries[idx], key = _a[0], value = _a[1];\n size += key.sizeInBytes() + value.sizeInBytes() + 2;\n }\n return size;\n };\n PDFDict.prototype.copyBytesInto = function (buffer, offset) {\n var initialOffset = offset;\n buffer[offset++] = CharCodes.LessThan;\n buffer[offset++] = CharCodes.LessThan;\n buffer[offset++] = CharCodes.Newline;\n var entries = this.entries();\n for (var idx = 0, len = entries.length; idx < len; idx++) {\n var _a = entries[idx], key = _a[0], value = _a[1];\n offset += key.copyBytesInto(buffer, offset);\n buffer[offset++] = CharCodes.Space;\n offset += value.copyBytesInto(buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n }\n buffer[offset++] = CharCodes.GreaterThan;\n buffer[offset++] = CharCodes.GreaterThan;\n return offset - initialOffset;\n };\n PDFDict.withContext = function (context) { return new PDFDict(new Map(), context); };\n PDFDict.fromMapWithContext = function (map, context) {\n return new PDFDict(map, context);\n };\n return PDFDict;\n}(PDFObject));\nexport default PDFDict;\n//# sourceMappingURL=PDFDict.js.map","import { __extends } from \"tslib\";\nimport { MethodNotImplementedError } from \"../errors\";\nimport PDFName from \"./PDFName\";\nimport PDFNumber from \"./PDFNumber\";\nimport PDFObject from \"./PDFObject\";\nimport CharCodes from \"../syntax/CharCodes\";\nvar PDFStream = /** @class */ (function (_super) {\n __extends(PDFStream, _super);\n function PDFStream(dict) {\n var _this = _super.call(this) || this;\n _this.dict = dict;\n return _this;\n }\n PDFStream.prototype.clone = function (_context) {\n throw new MethodNotImplementedError(this.constructor.name, 'clone');\n };\n PDFStream.prototype.getContentsString = function () {\n throw new MethodNotImplementedError(this.constructor.name, 'getContentsString');\n };\n PDFStream.prototype.getContents = function () {\n throw new MethodNotImplementedError(this.constructor.name, 'getContents');\n };\n PDFStream.prototype.getContentsSize = function () {\n throw new MethodNotImplementedError(this.constructor.name, 'getContentsSize');\n };\n PDFStream.prototype.updateDict = function () {\n var contentsSize = this.getContentsSize();\n this.dict.set(PDFName.Length, PDFNumber.of(contentsSize));\n };\n PDFStream.prototype.sizeInBytes = function () {\n this.updateDict();\n return this.dict.sizeInBytes() + this.getContentsSize() + 18;\n };\n PDFStream.prototype.toString = function () {\n this.updateDict();\n var streamString = this.dict.toString();\n streamString += '\\nstream\\n';\n streamString += this.getContentsString();\n streamString += '\\nendstream';\n return streamString;\n };\n PDFStream.prototype.copyBytesInto = function (buffer, offset) {\n this.updateDict();\n var initialOffset = offset;\n offset += this.dict.copyBytesInto(buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n buffer[offset++] = CharCodes.s;\n buffer[offset++] = CharCodes.t;\n buffer[offset++] = CharCodes.r;\n buffer[offset++] = CharCodes.e;\n buffer[offset++] = CharCodes.a;\n buffer[offset++] = CharCodes.m;\n buffer[offset++] = CharCodes.Newline;\n var contents = this.getContents();\n for (var idx = 0, len = contents.length; idx < len; idx++) {\n buffer[offset++] = contents[idx];\n }\n buffer[offset++] = CharCodes.Newline;\n buffer[offset++] = CharCodes.e;\n buffer[offset++] = CharCodes.n;\n buffer[offset++] = CharCodes.d;\n buffer[offset++] = CharCodes.s;\n buffer[offset++] = CharCodes.t;\n buffer[offset++] = CharCodes.r;\n buffer[offset++] = CharCodes.e;\n buffer[offset++] = CharCodes.a;\n buffer[offset++] = CharCodes.m;\n return offset - initialOffset;\n };\n return PDFStream;\n}(PDFObject));\nexport default PDFStream;\n//# sourceMappingURL=PDFStream.js.map","import { __extends } from \"tslib\";\nimport PDFStream from \"./PDFStream\";\nimport { arrayAsString } from \"../../utils\";\nvar PDFRawStream = /** @class */ (function (_super) {\n __extends(PDFRawStream, _super);\n function PDFRawStream(dict, contents) {\n var _this = _super.call(this, dict) || this;\n _this.contents = contents;\n return _this;\n }\n PDFRawStream.prototype.asUint8Array = function () {\n return this.contents.slice();\n };\n PDFRawStream.prototype.clone = function (context) {\n return PDFRawStream.of(this.dict.clone(context), this.contents.slice());\n };\n PDFRawStream.prototype.getContentsString = function () {\n return arrayAsString(this.contents);\n };\n PDFRawStream.prototype.getContents = function () {\n return this.contents;\n };\n PDFRawStream.prototype.getContentsSize = function () {\n return this.contents.length;\n };\n PDFRawStream.of = function (dict, contents) {\n return new PDFRawStream(dict, contents);\n };\n return PDFRawStream;\n}(PDFStream));\nexport default PDFRawStream;\n//# sourceMappingURL=PDFRawStream.js.map","import { __extends } from \"tslib\";\nimport { PrivateConstructorError } from \"../errors\";\nimport PDFObject from \"./PDFObject\";\nimport { copyStringIntoBuffer } from \"../../utils\";\nvar ENFORCER = {};\nvar pool = new Map();\nvar PDFRef = /** @class */ (function (_super) {\n __extends(PDFRef, _super);\n function PDFRef(enforcer, objectNumber, generationNumber) {\n var _this = this;\n if (enforcer !== ENFORCER)\n throw new PrivateConstructorError('PDFRef');\n _this = _super.call(this) || this;\n _this.objectNumber = objectNumber;\n _this.generationNumber = generationNumber;\n _this.tag = objectNumber + \" \" + generationNumber + \" R\";\n return _this;\n }\n PDFRef.prototype.clone = function () {\n return this;\n };\n PDFRef.prototype.toString = function () {\n return this.tag;\n };\n PDFRef.prototype.sizeInBytes = function () {\n return this.tag.length;\n };\n PDFRef.prototype.copyBytesInto = function (buffer, offset) {\n offset += copyStringIntoBuffer(this.tag, buffer, offset);\n return this.tag.length;\n };\n PDFRef.of = function (objectNumber, generationNumber) {\n if (generationNumber === void 0) { generationNumber = 0; }\n var tag = objectNumber + \" \" + generationNumber + \" R\";\n var instance = pool.get(tag);\n if (!instance) {\n instance = new PDFRef(ENFORCER, objectNumber, generationNumber);\n pool.set(tag, instance);\n }\n return instance;\n };\n return PDFRef;\n}(PDFObject));\nexport default PDFRef;\n//# sourceMappingURL=PDFRef.js.map","import PDFObject from \"../objects/PDFObject\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { copyStringIntoBuffer } from \"../../utils\";\nvar PDFOperator = /** @class */ (function () {\n function PDFOperator(name, args) {\n this.name = name;\n this.args = args || [];\n }\n PDFOperator.prototype.clone = function (context) {\n var args = new Array(this.args.length);\n for (var idx = 0, len = args.length; idx < len; idx++) {\n var arg = this.args[idx];\n args[idx] = arg instanceof PDFObject ? arg.clone(context) : arg;\n }\n return PDFOperator.of(this.name, args);\n };\n PDFOperator.prototype.toString = function () {\n var value = '';\n for (var idx = 0, len = this.args.length; idx < len; idx++) {\n value += String(this.args[idx]) + ' ';\n }\n value += this.name;\n return value;\n };\n PDFOperator.prototype.sizeInBytes = function () {\n var size = 0;\n for (var idx = 0, len = this.args.length; idx < len; idx++) {\n var arg = this.args[idx];\n size += (arg instanceof PDFObject ? arg.sizeInBytes() : arg.length) + 1;\n }\n size += this.name.length;\n return size;\n };\n PDFOperator.prototype.copyBytesInto = function (buffer, offset) {\n var initialOffset = offset;\n for (var idx = 0, len = this.args.length; idx < len; idx++) {\n var arg = this.args[idx];\n if (arg instanceof PDFObject) {\n offset += arg.copyBytesInto(buffer, offset);\n }\n else {\n offset += copyStringIntoBuffer(arg, buffer, offset);\n }\n buffer[offset++] = CharCodes.Space;\n }\n offset += copyStringIntoBuffer(this.name, buffer, offset);\n return offset - initialOffset;\n };\n PDFOperator.of = function (name, args) {\n return new PDFOperator(name, args);\n };\n return PDFOperator;\n}());\nexport default PDFOperator;\n//# sourceMappingURL=PDFOperator.js.map","import { __extends } from \"tslib\";\nimport pako from 'pako';\nimport { MethodNotImplementedError } from \"../errors\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFStream from \"../objects/PDFStream\";\nimport { Cache } from \"../../utils\";\nvar PDFFlateStream = /** @class */ (function (_super) {\n __extends(PDFFlateStream, _super);\n function PDFFlateStream(dict, encode) {\n var _this = _super.call(this, dict) || this;\n _this.computeContents = function () {\n var unencodedContents = _this.getUnencodedContents();\n return _this.encode ? pako.deflate(unencodedContents) : unencodedContents;\n };\n _this.encode = encode;\n if (encode)\n dict.set(PDFName.of('Filter'), PDFName.of('FlateDecode'));\n _this.contentsCache = Cache.populatedBy(_this.computeContents);\n return _this;\n }\n PDFFlateStream.prototype.getContents = function () {\n return this.contentsCache.access();\n };\n PDFFlateStream.prototype.getContentsSize = function () {\n return this.contentsCache.access().length;\n };\n PDFFlateStream.prototype.getUnencodedContents = function () {\n throw new MethodNotImplementedError(this.constructor.name, 'getUnencodedContents');\n };\n return PDFFlateStream;\n}(PDFStream));\nexport default PDFFlateStream;\n//# sourceMappingURL=PDFFlateStream.js.map","import { __extends } from \"tslib\";\nimport PDFFlateStream from \"./PDFFlateStream\";\nimport CharCodes from \"../syntax/CharCodes\";\nvar PDFContentStream = /** @class */ (function (_super) {\n __extends(PDFContentStream, _super);\n function PDFContentStream(dict, operators, encode) {\n if (encode === void 0) { encode = true; }\n var _this = _super.call(this, dict, encode) || this;\n _this.operators = operators;\n return _this;\n }\n PDFContentStream.prototype.push = function () {\n var _a;\n var operators = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n operators[_i] = arguments[_i];\n }\n (_a = this.operators).push.apply(_a, operators);\n };\n PDFContentStream.prototype.clone = function (context) {\n var operators = new Array(this.operators.length);\n for (var idx = 0, len = this.operators.length; idx < len; idx++) {\n operators[idx] = this.operators[idx].clone(context);\n }\n var _a = this, dict = _a.dict, encode = _a.encode;\n return PDFContentStream.of(dict.clone(context), operators, encode);\n };\n PDFContentStream.prototype.getContentsString = function () {\n var value = '';\n for (var idx = 0, len = this.operators.length; idx < len; idx++) {\n value += this.operators[idx] + \"\\n\";\n }\n return value;\n };\n PDFContentStream.prototype.getUnencodedContents = function () {\n var buffer = new Uint8Array(this.getUnencodedContentsSize());\n var offset = 0;\n for (var idx = 0, len = this.operators.length; idx < len; idx++) {\n offset += this.operators[idx].copyBytesInto(buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n }\n return buffer;\n };\n PDFContentStream.prototype.getUnencodedContentsSize = function () {\n var size = 0;\n for (var idx = 0, len = this.operators.length; idx < len; idx++) {\n size += this.operators[idx].sizeInBytes() + 1;\n }\n return size;\n };\n PDFContentStream.of = function (dict, operators, encode) {\n if (encode === void 0) { encode = true; }\n return new PDFContentStream(dict, operators, encode);\n };\n return PDFContentStream;\n}(PDFFlateStream));\nexport default PDFContentStream;\n//# sourceMappingURL=PDFContentStream.js.map","/**\n * Generates a pseudo random number. Although it is not cryptographically secure\n * and uniformly distributed, it is not a concern for the intended use-case,\n * which is to generate distinct numbers.\n *\n * Credit: https://stackoverflow.com/a/19303725/10254049\n */\nvar SimpleRNG = /** @class */ (function () {\n function SimpleRNG(seed) {\n this.seed = seed;\n }\n SimpleRNG.prototype.nextInt = function () {\n var x = Math.sin(this.seed++) * 10000;\n return x - Math.floor(x);\n };\n SimpleRNG.withSeed = function (seed) { return new SimpleRNG(seed); };\n return SimpleRNG;\n}());\nexport { SimpleRNG };\n//# sourceMappingURL=rng.js.map","import { __assign } from \"tslib\";\nimport pako from 'pako';\nimport PDFHeader from \"./document/PDFHeader\";\nimport { UnexpectedObjectTypeError } from \"./errors\";\nimport PDFArray from \"./objects/PDFArray\";\nimport PDFBool from \"./objects/PDFBool\";\nimport PDFDict from \"./objects/PDFDict\";\nimport PDFName from \"./objects/PDFName\";\nimport PDFNull from \"./objects/PDFNull\";\nimport PDFNumber from \"./objects/PDFNumber\";\nimport PDFObject from \"./objects/PDFObject\";\nimport PDFRawStream from \"./objects/PDFRawStream\";\nimport PDFRef from \"./objects/PDFRef\";\nimport PDFOperator from \"./operators/PDFOperator\";\nimport Ops from \"./operators/PDFOperatorNames\";\nimport PDFContentStream from \"./structures/PDFContentStream\";\nimport { typedArrayFor } from \"../utils\";\nimport { SimpleRNG } from \"../utils/rng\";\nvar byAscendingObjectNumber = function (_a, _b) {\n var a = _a[0];\n var b = _b[0];\n return a.objectNumber - b.objectNumber;\n};\nvar PDFContext = /** @class */ (function () {\n function PDFContext() {\n this.largestObjectNumber = 0;\n this.header = PDFHeader.forVersion(1, 7);\n this.trailerInfo = {};\n this.indirectObjects = new Map();\n this.rng = SimpleRNG.withSeed(1);\n }\n PDFContext.prototype.assign = function (ref, object) {\n this.indirectObjects.set(ref, object);\n if (ref.objectNumber > this.largestObjectNumber) {\n this.largestObjectNumber = ref.objectNumber;\n }\n };\n PDFContext.prototype.nextRef = function () {\n this.largestObjectNumber += 1;\n return PDFRef.of(this.largestObjectNumber);\n };\n PDFContext.prototype.register = function (object) {\n var ref = this.nextRef();\n this.assign(ref, object);\n return ref;\n };\n PDFContext.prototype.delete = function (ref) {\n return this.indirectObjects.delete(ref);\n };\n PDFContext.prototype.lookupMaybe = function (ref) {\n var types = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n types[_i - 1] = arguments[_i];\n }\n // TODO: `preservePDFNull` is for backwards compatibility. Should be\n // removed in next breaking API change.\n var preservePDFNull = types.includes(PDFNull);\n var result = ref instanceof PDFRef ? this.indirectObjects.get(ref) : ref;\n if (!result || (result === PDFNull && !preservePDFNull))\n return undefined;\n for (var idx = 0, len = types.length; idx < len; idx++) {\n var type = types[idx];\n if (type === PDFNull) {\n if (result === PDFNull)\n return result;\n }\n else {\n if (result instanceof type)\n return result;\n }\n }\n throw new UnexpectedObjectTypeError(types, result);\n };\n PDFContext.prototype.lookup = function (ref) {\n var types = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n types[_i - 1] = arguments[_i];\n }\n var result = ref instanceof PDFRef ? this.indirectObjects.get(ref) : ref;\n if (types.length === 0)\n return result;\n for (var idx = 0, len = types.length; idx < len; idx++) {\n var type = types[idx];\n if (type === PDFNull) {\n if (result === PDFNull)\n return result;\n }\n else {\n if (result instanceof type)\n return result;\n }\n }\n throw new UnexpectedObjectTypeError(types, result);\n };\n PDFContext.prototype.getObjectRef = function (pdfObject) {\n var entries = Array.from(this.indirectObjects.entries());\n for (var idx = 0, len = entries.length; idx < len; idx++) {\n var _a = entries[idx], ref = _a[0], object = _a[1];\n if (object === pdfObject) {\n return ref;\n }\n }\n return undefined;\n };\n PDFContext.prototype.enumerateIndirectObjects = function () {\n return Array.from(this.indirectObjects.entries()).sort(byAscendingObjectNumber);\n };\n PDFContext.prototype.obj = function (literal) {\n if (literal instanceof PDFObject) {\n return literal;\n }\n else if (literal === null || literal === undefined) {\n return PDFNull;\n }\n else if (typeof literal === 'string') {\n return PDFName.of(literal);\n }\n else if (typeof literal === 'number') {\n return PDFNumber.of(literal);\n }\n else if (typeof literal === 'boolean') {\n return literal ? PDFBool.True : PDFBool.False;\n }\n else if (Array.isArray(literal)) {\n var array = PDFArray.withContext(this);\n for (var idx = 0, len = literal.length; idx < len; idx++) {\n array.push(this.obj(literal[idx]));\n }\n return array;\n }\n else {\n var dict = PDFDict.withContext(this);\n var keys = Object.keys(literal);\n for (var idx = 0, len = keys.length; idx < len; idx++) {\n var key = keys[idx];\n var value = literal[key];\n if (value !== undefined)\n dict.set(PDFName.of(key), this.obj(value));\n }\n return dict;\n }\n };\n PDFContext.prototype.stream = function (contents, dict) {\n if (dict === void 0) { dict = {}; }\n return PDFRawStream.of(this.obj(dict), typedArrayFor(contents));\n };\n PDFContext.prototype.flateStream = function (contents, dict) {\n if (dict === void 0) { dict = {}; }\n return this.stream(pako.deflate(typedArrayFor(contents)), __assign(__assign({}, dict), { Filter: 'FlateDecode' }));\n };\n PDFContext.prototype.contentStream = function (operators, dict) {\n if (dict === void 0) { dict = {}; }\n return PDFContentStream.of(this.obj(dict), operators);\n };\n PDFContext.prototype.formXObject = function (operators, dict) {\n if (dict === void 0) { dict = {}; }\n return this.contentStream(operators, __assign(__assign({ BBox: this.obj([0, 0, 0, 0]), Matrix: this.obj([1, 0, 0, 1, 0, 0]) }, dict), { Type: 'XObject', Subtype: 'Form' }));\n };\n /*\n * Reference to PDFContentStream that contains a single PDFOperator: `q`.\n * Used by [[PDFPageLeaf]] instances to ensure that when content streams are\n * added to a modified PDF, they start in the default, unchanged graphics\n * state.\n */\n PDFContext.prototype.getPushGraphicsStateContentStream = function () {\n if (this.pushGraphicsStateContentStreamRef) {\n return this.pushGraphicsStateContentStreamRef;\n }\n var dict = this.obj({});\n var op = PDFOperator.of(Ops.PushGraphicsState);\n var stream = PDFContentStream.of(dict, [op]);\n this.pushGraphicsStateContentStreamRef = this.register(stream);\n return this.pushGraphicsStateContentStreamRef;\n };\n /*\n * Reference to PDFContentStream that contains a single PDFOperator: `Q`.\n * Used by [[PDFPageLeaf]] instances to ensure that when content streams are\n * added to a modified PDF, they start in the default, unchanged graphics\n * state.\n */\n PDFContext.prototype.getPopGraphicsStateContentStream = function () {\n if (this.popGraphicsStateContentStreamRef) {\n return this.popGraphicsStateContentStreamRef;\n }\n var dict = this.obj({});\n var op = PDFOperator.of(Ops.PopGraphicsState);\n var stream = PDFContentStream.of(dict, [op]);\n this.popGraphicsStateContentStreamRef = this.register(stream);\n return this.popGraphicsStateContentStreamRef;\n };\n PDFContext.prototype.addRandomSuffix = function (prefix, suffixLength) {\n if (suffixLength === void 0) { suffixLength = 4; }\n return prefix + \"-\" + Math.floor(this.rng.nextInt() * Math.pow(10, suffixLength));\n };\n PDFContext.create = function () { return new PDFContext(); };\n return PDFContext;\n}());\nexport default PDFContext;\n//# sourceMappingURL=PDFContext.js.map","import { __extends } from \"tslib\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFDict from \"../objects/PDFDict\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFStream from \"../objects/PDFStream\";\nvar PDFPageLeaf = /** @class */ (function (_super) {\n __extends(PDFPageLeaf, _super);\n function PDFPageLeaf(map, context, autoNormalizeCTM) {\n if (autoNormalizeCTM === void 0) { autoNormalizeCTM = true; }\n var _this = _super.call(this, map, context) || this;\n _this.normalized = false;\n _this.autoNormalizeCTM = autoNormalizeCTM;\n return _this;\n }\n PDFPageLeaf.prototype.clone = function (context) {\n var clone = PDFPageLeaf.fromMapWithContext(new Map(), context || this.context, this.autoNormalizeCTM);\n var entries = this.entries();\n for (var idx = 0, len = entries.length; idx < len; idx++) {\n var _a = entries[idx], key = _a[0], value = _a[1];\n clone.set(key, value);\n }\n return clone;\n };\n PDFPageLeaf.prototype.Parent = function () {\n return this.lookupMaybe(PDFName.Parent, PDFDict);\n };\n PDFPageLeaf.prototype.Contents = function () {\n return this.lookup(PDFName.of('Contents'));\n };\n PDFPageLeaf.prototype.Annots = function () {\n return this.lookupMaybe(PDFName.Annots, PDFArray);\n };\n PDFPageLeaf.prototype.BleedBox = function () {\n return this.lookupMaybe(PDFName.BleedBox, PDFArray);\n };\n PDFPageLeaf.prototype.TrimBox = function () {\n return this.lookupMaybe(PDFName.TrimBox, PDFArray);\n };\n PDFPageLeaf.prototype.ArtBox = function () {\n return this.lookupMaybe(PDFName.ArtBox, PDFArray);\n };\n PDFPageLeaf.prototype.Resources = function () {\n var dictOrRef = this.getInheritableAttribute(PDFName.Resources);\n return this.context.lookupMaybe(dictOrRef, PDFDict);\n };\n PDFPageLeaf.prototype.MediaBox = function () {\n var arrayOrRef = this.getInheritableAttribute(PDFName.MediaBox);\n return this.context.lookup(arrayOrRef, PDFArray);\n };\n PDFPageLeaf.prototype.CropBox = function () {\n var arrayOrRef = this.getInheritableAttribute(PDFName.CropBox);\n return this.context.lookupMaybe(arrayOrRef, PDFArray);\n };\n PDFPageLeaf.prototype.Rotate = function () {\n var numberOrRef = this.getInheritableAttribute(PDFName.Rotate);\n return this.context.lookupMaybe(numberOrRef, PDFNumber);\n };\n PDFPageLeaf.prototype.getInheritableAttribute = function (name) {\n var attribute;\n this.ascend(function (node) {\n if (!attribute)\n attribute = node.get(name);\n });\n return attribute;\n };\n PDFPageLeaf.prototype.setParent = function (parentRef) {\n this.set(PDFName.Parent, parentRef);\n };\n PDFPageLeaf.prototype.addContentStream = function (contentStreamRef) {\n var Contents = this.normalizedEntries().Contents || this.context.obj([]);\n this.set(PDFName.Contents, Contents);\n Contents.push(contentStreamRef);\n };\n PDFPageLeaf.prototype.wrapContentStreams = function (startStream, endStream) {\n var Contents = this.Contents();\n if (Contents instanceof PDFArray) {\n Contents.insert(0, startStream);\n Contents.push(endStream);\n return true;\n }\n return false;\n };\n PDFPageLeaf.prototype.addAnnot = function (annotRef) {\n var Annots = this.normalizedEntries().Annots;\n Annots.push(annotRef);\n };\n PDFPageLeaf.prototype.removeAnnot = function (annotRef) {\n var Annots = this.normalizedEntries().Annots;\n var index = Annots.indexOf(annotRef);\n if (index !== undefined) {\n Annots.remove(index);\n }\n };\n PDFPageLeaf.prototype.setFontDictionary = function (name, fontDictRef) {\n var Font = this.normalizedEntries().Font;\n Font.set(name, fontDictRef);\n };\n PDFPageLeaf.prototype.newFontDictionaryKey = function (tag) {\n var Font = this.normalizedEntries().Font;\n return Font.uniqueKey(tag);\n };\n PDFPageLeaf.prototype.newFontDictionary = function (tag, fontDictRef) {\n var key = this.newFontDictionaryKey(tag);\n this.setFontDictionary(key, fontDictRef);\n return key;\n };\n PDFPageLeaf.prototype.setXObject = function (name, xObjectRef) {\n var XObject = this.normalizedEntries().XObject;\n XObject.set(name, xObjectRef);\n };\n PDFPageLeaf.prototype.newXObjectKey = function (tag) {\n var XObject = this.normalizedEntries().XObject;\n return XObject.uniqueKey(tag);\n };\n PDFPageLeaf.prototype.newXObject = function (tag, xObjectRef) {\n var key = this.newXObjectKey(tag);\n this.setXObject(key, xObjectRef);\n return key;\n };\n PDFPageLeaf.prototype.setExtGState = function (name, extGStateRef) {\n var ExtGState = this.normalizedEntries().ExtGState;\n ExtGState.set(name, extGStateRef);\n };\n PDFPageLeaf.prototype.newExtGStateKey = function (tag) {\n var ExtGState = this.normalizedEntries().ExtGState;\n return ExtGState.uniqueKey(tag);\n };\n PDFPageLeaf.prototype.newExtGState = function (tag, extGStateRef) {\n var key = this.newExtGStateKey(tag);\n this.setExtGState(key, extGStateRef);\n return key;\n };\n PDFPageLeaf.prototype.ascend = function (visitor) {\n visitor(this);\n var Parent = this.Parent();\n if (Parent)\n Parent.ascend(visitor);\n };\n PDFPageLeaf.prototype.normalize = function () {\n if (this.normalized)\n return;\n var context = this.context;\n var contentsRef = this.get(PDFName.Contents);\n var contents = this.context.lookup(contentsRef);\n if (contents instanceof PDFStream) {\n this.set(PDFName.Contents, context.obj([contentsRef]));\n }\n if (this.autoNormalizeCTM) {\n this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(), this.context.getPopGraphicsStateContentStream());\n }\n // TODO: Clone `Resources` if it is inherited\n var dictOrRef = this.getInheritableAttribute(PDFName.Resources);\n var Resources = context.lookupMaybe(dictOrRef, PDFDict) || context.obj({});\n this.set(PDFName.Resources, Resources);\n // TODO: Clone `Font` if it is inherited\n var Font = Resources.lookupMaybe(PDFName.Font, PDFDict) || context.obj({});\n Resources.set(PDFName.Font, Font);\n // TODO: Clone `XObject` if it is inherited\n var XObject = Resources.lookupMaybe(PDFName.XObject, PDFDict) || context.obj({});\n Resources.set(PDFName.XObject, XObject);\n // TODO: Clone `ExtGState` if it is inherited\n var ExtGState = Resources.lookupMaybe(PDFName.ExtGState, PDFDict) || context.obj({});\n Resources.set(PDFName.ExtGState, ExtGState);\n var Annots = this.Annots() || context.obj([]);\n this.set(PDFName.Annots, Annots);\n this.normalized = true;\n };\n PDFPageLeaf.prototype.normalizedEntries = function () {\n this.normalize();\n var Annots = this.Annots();\n var Resources = this.Resources();\n var Contents = this.Contents();\n return {\n Annots: Annots,\n Resources: Resources,\n Contents: Contents,\n Font: Resources.lookup(PDFName.Font, PDFDict),\n XObject: Resources.lookup(PDFName.XObject, PDFDict),\n ExtGState: Resources.lookup(PDFName.ExtGState, PDFDict),\n };\n };\n PDFPageLeaf.InheritableEntries = [\n 'Resources',\n 'MediaBox',\n 'CropBox',\n 'Rotate',\n ];\n PDFPageLeaf.withContextAndParent = function (context, parent) {\n var dict = new Map();\n dict.set(PDFName.Type, PDFName.Page);\n dict.set(PDFName.Parent, parent);\n dict.set(PDFName.Resources, context.obj({}));\n dict.set(PDFName.MediaBox, context.obj([0, 0, 612, 792]));\n return new PDFPageLeaf(dict, context, false);\n };\n PDFPageLeaf.fromMapWithContext = function (map, context, autoNormalizeCTM) {\n if (autoNormalizeCTM === void 0) { autoNormalizeCTM = true; }\n return new PDFPageLeaf(map, context, autoNormalizeCTM);\n };\n return PDFPageLeaf;\n}(PDFDict));\nexport default PDFPageLeaf;\n//# sourceMappingURL=PDFPageLeaf.js.map","import PDFArray from \"./objects/PDFArray\";\nimport PDFDict from \"./objects/PDFDict\";\nimport PDFName from \"./objects/PDFName\";\nimport PDFRef from \"./objects/PDFRef\";\nimport PDFStream from \"./objects/PDFStream\";\nimport PDFPageLeaf from \"./structures/PDFPageLeaf\";\n/**\n * PDFObjectCopier copies PDFObjects from a src context to a dest context.\n * The primary use case for this is to copy pages between PDFs.\n *\n * _Copying_ an object with a PDFObjectCopier is different from _cloning_ an\n * object with its [[PDFObject.clone]] method:\n *\n * ```\n * const src: PDFContext = ...\n * const dest: PDFContext = ...\n * const originalObject: PDFObject = ...\n * const copiedObject = PDFObjectCopier.for(src, dest).copy(originalObject);\n * const clonedObject = originalObject.clone();\n * ```\n *\n * Copying an object is equivalent to cloning it and then copying over any other\n * objects that it references. Note that only dictionaries, arrays, and streams\n * (or structures build from them) can contain indirect references to other\n * objects. Copying a PDFObject that is not a dictionary, array, or stream is\n * supported, but is equivalent to cloning it.\n */\nvar PDFObjectCopier = /** @class */ (function () {\n function PDFObjectCopier(src, dest) {\n var _this = this;\n this.traversedObjects = new Map();\n // prettier-ignore\n this.copy = function (object) { return (object instanceof PDFPageLeaf ? _this.copyPDFPage(object)\n : object instanceof PDFDict ? _this.copyPDFDict(object)\n : object instanceof PDFArray ? _this.copyPDFArray(object)\n : object instanceof PDFStream ? _this.copyPDFStream(object)\n : object instanceof PDFRef ? _this.copyPDFIndirectObject(object)\n : object.clone()); };\n this.copyPDFPage = function (originalPage) {\n var clonedPage = originalPage.clone();\n // Move any entries that the originalPage is inheriting from its parent\n // tree nodes directly into originalPage so they are preserved during\n // the copy.\n var InheritableEntries = PDFPageLeaf.InheritableEntries;\n for (var idx = 0, len = InheritableEntries.length; idx < len; idx++) {\n var key = PDFName.of(InheritableEntries[idx]);\n var value = clonedPage.getInheritableAttribute(key);\n if (!clonedPage.get(key) && value)\n clonedPage.set(key, value);\n }\n // Remove the parent reference to prevent the whole donor document's page\n // tree from being copied when we only need a single page.\n clonedPage.delete(PDFName.of('Parent'));\n return _this.copyPDFDict(clonedPage);\n };\n this.copyPDFDict = function (originalDict) {\n if (_this.traversedObjects.has(originalDict)) {\n return _this.traversedObjects.get(originalDict);\n }\n var clonedDict = originalDict.clone(_this.dest);\n _this.traversedObjects.set(originalDict, clonedDict);\n var entries = originalDict.entries();\n for (var idx = 0, len = entries.length; idx < len; idx++) {\n var _a = entries[idx], key = _a[0], value = _a[1];\n clonedDict.set(key, _this.copy(value));\n }\n return clonedDict;\n };\n this.copyPDFArray = function (originalArray) {\n if (_this.traversedObjects.has(originalArray)) {\n return _this.traversedObjects.get(originalArray);\n }\n var clonedArray = originalArray.clone(_this.dest);\n _this.traversedObjects.set(originalArray, clonedArray);\n for (var idx = 0, len = originalArray.size(); idx < len; idx++) {\n var value = originalArray.get(idx);\n clonedArray.set(idx, _this.copy(value));\n }\n return clonedArray;\n };\n this.copyPDFStream = function (originalStream) {\n if (_this.traversedObjects.has(originalStream)) {\n return _this.traversedObjects.get(originalStream);\n }\n var clonedStream = originalStream.clone(_this.dest);\n _this.traversedObjects.set(originalStream, clonedStream);\n var entries = originalStream.dict.entries();\n for (var idx = 0, len = entries.length; idx < len; idx++) {\n var _a = entries[idx], key = _a[0], value = _a[1];\n clonedStream.dict.set(key, _this.copy(value));\n }\n return clonedStream;\n };\n this.copyPDFIndirectObject = function (ref) {\n var alreadyMapped = _this.traversedObjects.has(ref);\n if (!alreadyMapped) {\n var newRef = _this.dest.nextRef();\n _this.traversedObjects.set(ref, newRef);\n var dereferencedValue = _this.src.lookup(ref);\n if (dereferencedValue) {\n var cloned = _this.copy(dereferencedValue);\n _this.dest.assign(newRef, cloned);\n }\n }\n return _this.traversedObjects.get(ref);\n };\n this.src = src;\n this.dest = dest;\n }\n PDFObjectCopier.for = function (src, dest) {\n return new PDFObjectCopier(src, dest);\n };\n return PDFObjectCopier;\n}());\nexport default PDFObjectCopier;\n//# sourceMappingURL=PDFObjectCopier.js.map","import PDFRef from \"../objects/PDFRef\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { copyStringIntoBuffer, padStart } from \"../../utils\";\n/**\n * Entries should be added using the [[addEntry]] and [[addDeletedEntry]]\n * methods **in order of ascending object number**.\n */\nvar PDFCrossRefSection = /** @class */ (function () {\n function PDFCrossRefSection(firstEntry) {\n this.subsections = firstEntry ? [[firstEntry]] : [];\n this.chunkIdx = 0;\n this.chunkLength = firstEntry ? 1 : 0;\n }\n PDFCrossRefSection.prototype.addEntry = function (ref, offset) {\n this.append({ ref: ref, offset: offset, deleted: false });\n };\n PDFCrossRefSection.prototype.addDeletedEntry = function (ref, nextFreeObjectNumber) {\n this.append({ ref: ref, offset: nextFreeObjectNumber, deleted: true });\n };\n PDFCrossRefSection.prototype.toString = function () {\n var section = \"xref\\n\";\n for (var rangeIdx = 0, rangeLen = this.subsections.length; rangeIdx < rangeLen; rangeIdx++) {\n var range = this.subsections[rangeIdx];\n section += range[0].ref.objectNumber + \" \" + range.length + \"\\n\";\n for (var entryIdx = 0, entryLen = range.length; entryIdx < entryLen; entryIdx++) {\n var entry = range[entryIdx];\n section += padStart(String(entry.offset), 10, '0');\n section += ' ';\n section += padStart(String(entry.ref.generationNumber), 5, '0');\n section += ' ';\n section += entry.deleted ? 'f' : 'n';\n section += ' \\n';\n }\n }\n return section;\n };\n PDFCrossRefSection.prototype.sizeInBytes = function () {\n var size = 5;\n for (var idx = 0, len = this.subsections.length; idx < len; idx++) {\n var subsection = this.subsections[idx];\n var subsectionLength = subsection.length;\n var firstEntry = subsection[0];\n size += 2;\n size += String(firstEntry.ref.objectNumber).length;\n size += String(subsectionLength).length;\n size += 20 * subsectionLength;\n }\n return size;\n };\n PDFCrossRefSection.prototype.copyBytesInto = function (buffer, offset) {\n var initialOffset = offset;\n buffer[offset++] = CharCodes.x;\n buffer[offset++] = CharCodes.r;\n buffer[offset++] = CharCodes.e;\n buffer[offset++] = CharCodes.f;\n buffer[offset++] = CharCodes.Newline;\n offset += this.copySubsectionsIntoBuffer(this.subsections, buffer, offset);\n return offset - initialOffset;\n };\n PDFCrossRefSection.prototype.copySubsectionsIntoBuffer = function (subsections, buffer, offset) {\n var initialOffset = offset;\n var length = subsections.length;\n for (var idx = 0; idx < length; idx++) {\n var subsection = this.subsections[idx];\n var firstObjectNumber = String(subsection[0].ref.objectNumber);\n offset += copyStringIntoBuffer(firstObjectNumber, buffer, offset);\n buffer[offset++] = CharCodes.Space;\n var rangeLength = String(subsection.length);\n offset += copyStringIntoBuffer(rangeLength, buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n offset += this.copyEntriesIntoBuffer(subsection, buffer, offset);\n }\n return offset - initialOffset;\n };\n PDFCrossRefSection.prototype.copyEntriesIntoBuffer = function (entries, buffer, offset) {\n var length = entries.length;\n for (var idx = 0; idx < length; idx++) {\n var entry = entries[idx];\n var entryOffset = padStart(String(entry.offset), 10, '0');\n offset += copyStringIntoBuffer(entryOffset, buffer, offset);\n buffer[offset++] = CharCodes.Space;\n var entryGen = padStart(String(entry.ref.generationNumber), 5, '0');\n offset += copyStringIntoBuffer(entryGen, buffer, offset);\n buffer[offset++] = CharCodes.Space;\n buffer[offset++] = entry.deleted ? CharCodes.f : CharCodes.n;\n buffer[offset++] = CharCodes.Space;\n buffer[offset++] = CharCodes.Newline;\n }\n return 20 * length;\n };\n PDFCrossRefSection.prototype.append = function (currEntry) {\n if (this.chunkLength === 0) {\n this.subsections.push([currEntry]);\n this.chunkIdx = 0;\n this.chunkLength = 1;\n return;\n }\n var chunk = this.subsections[this.chunkIdx];\n var prevEntry = chunk[this.chunkLength - 1];\n if (currEntry.ref.objectNumber - prevEntry.ref.objectNumber > 1) {\n this.subsections.push([currEntry]);\n this.chunkIdx += 1;\n this.chunkLength = 1;\n }\n else {\n chunk.push(currEntry);\n this.chunkLength += 1;\n }\n };\n PDFCrossRefSection.create = function () {\n return new PDFCrossRefSection({\n ref: PDFRef.of(0, 65535),\n offset: 0,\n deleted: true,\n });\n };\n PDFCrossRefSection.createEmpty = function () { return new PDFCrossRefSection(); };\n return PDFCrossRefSection;\n}());\nexport default PDFCrossRefSection;\n//# sourceMappingURL=PDFCrossRefSection.js.map","import CharCodes from \"../syntax/CharCodes\";\nimport { copyStringIntoBuffer } from \"../../utils\";\nvar PDFTrailer = /** @class */ (function () {\n function PDFTrailer(lastXRefOffset) {\n this.lastXRefOffset = String(lastXRefOffset);\n }\n PDFTrailer.prototype.toString = function () {\n return \"startxref\\n\" + this.lastXRefOffset + \"\\n%%EOF\";\n };\n PDFTrailer.prototype.sizeInBytes = function () {\n return 16 + this.lastXRefOffset.length;\n };\n PDFTrailer.prototype.copyBytesInto = function (buffer, offset) {\n var initialOffset = offset;\n buffer[offset++] = CharCodes.s;\n buffer[offset++] = CharCodes.t;\n buffer[offset++] = CharCodes.a;\n buffer[offset++] = CharCodes.r;\n buffer[offset++] = CharCodes.t;\n buffer[offset++] = CharCodes.x;\n buffer[offset++] = CharCodes.r;\n buffer[offset++] = CharCodes.e;\n buffer[offset++] = CharCodes.f;\n buffer[offset++] = CharCodes.Newline;\n offset += copyStringIntoBuffer(this.lastXRefOffset, buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n buffer[offset++] = CharCodes.Percent;\n buffer[offset++] = CharCodes.Percent;\n buffer[offset++] = CharCodes.E;\n buffer[offset++] = CharCodes.O;\n buffer[offset++] = CharCodes.F;\n return offset - initialOffset;\n };\n PDFTrailer.forLastCrossRefSectionOffset = function (offset) {\n return new PDFTrailer(offset);\n };\n return PDFTrailer;\n}());\nexport default PDFTrailer;\n//# sourceMappingURL=PDFTrailer.js.map","import CharCodes from \"../syntax/CharCodes\";\nvar PDFTrailerDict = /** @class */ (function () {\n function PDFTrailerDict(dict) {\n this.dict = dict;\n }\n PDFTrailerDict.prototype.toString = function () {\n return \"trailer\\n\" + this.dict.toString();\n };\n PDFTrailerDict.prototype.sizeInBytes = function () {\n return 8 + this.dict.sizeInBytes();\n };\n PDFTrailerDict.prototype.copyBytesInto = function (buffer, offset) {\n var initialOffset = offset;\n buffer[offset++] = CharCodes.t;\n buffer[offset++] = CharCodes.r;\n buffer[offset++] = CharCodes.a;\n buffer[offset++] = CharCodes.i;\n buffer[offset++] = CharCodes.l;\n buffer[offset++] = CharCodes.e;\n buffer[offset++] = CharCodes.r;\n buffer[offset++] = CharCodes.Newline;\n offset += this.dict.copyBytesInto(buffer, offset);\n return offset - initialOffset;\n };\n PDFTrailerDict.of = function (dict) { return new PDFTrailerDict(dict); };\n return PDFTrailerDict;\n}());\nexport default PDFTrailerDict;\n//# sourceMappingURL=PDFTrailerDict.js.map","import { __extends } from \"tslib\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFFlateStream from \"./PDFFlateStream\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { copyStringIntoBuffer, last } from \"../../utils\";\nvar PDFObjectStream = /** @class */ (function (_super) {\n __extends(PDFObjectStream, _super);\n function PDFObjectStream(context, objects, encode) {\n if (encode === void 0) { encode = true; }\n var _this = _super.call(this, context.obj({}), encode) || this;\n _this.objects = objects;\n _this.offsets = _this.computeObjectOffsets();\n _this.offsetsString = _this.computeOffsetsString();\n _this.dict.set(PDFName.of('Type'), PDFName.of('ObjStm'));\n _this.dict.set(PDFName.of('N'), PDFNumber.of(_this.objects.length));\n _this.dict.set(PDFName.of('First'), PDFNumber.of(_this.offsetsString.length));\n return _this;\n }\n PDFObjectStream.prototype.getObjectsCount = function () {\n return this.objects.length;\n };\n PDFObjectStream.prototype.clone = function (context) {\n return PDFObjectStream.withContextAndObjects(context || this.dict.context, this.objects.slice(), this.encode);\n };\n PDFObjectStream.prototype.getContentsString = function () {\n var value = this.offsetsString;\n for (var idx = 0, len = this.objects.length; idx < len; idx++) {\n var _a = this.objects[idx], object = _a[1];\n value += object + \"\\n\";\n }\n return value;\n };\n PDFObjectStream.prototype.getUnencodedContents = function () {\n var buffer = new Uint8Array(this.getUnencodedContentsSize());\n var offset = copyStringIntoBuffer(this.offsetsString, buffer, 0);\n for (var idx = 0, len = this.objects.length; idx < len; idx++) {\n var _a = this.objects[idx], object = _a[1];\n offset += object.copyBytesInto(buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n }\n return buffer;\n };\n PDFObjectStream.prototype.getUnencodedContentsSize = function () {\n return (this.offsetsString.length +\n last(this.offsets)[1] +\n last(this.objects)[1].sizeInBytes() +\n 1);\n };\n PDFObjectStream.prototype.computeOffsetsString = function () {\n var offsetsString = '';\n for (var idx = 0, len = this.offsets.length; idx < len; idx++) {\n var _a = this.offsets[idx], objectNumber = _a[0], offset = _a[1];\n offsetsString += objectNumber + \" \" + offset + \" \";\n }\n return offsetsString;\n };\n PDFObjectStream.prototype.computeObjectOffsets = function () {\n var offset = 0;\n var offsets = new Array(this.objects.length);\n for (var idx = 0, len = this.objects.length; idx < len; idx++) {\n var _a = this.objects[idx], ref = _a[0], object = _a[1];\n offsets[idx] = [ref.objectNumber, offset];\n offset += object.sizeInBytes() + 1; // '\\n'\n }\n return offsets;\n };\n PDFObjectStream.withContextAndObjects = function (context, objects, encode) {\n if (encode === void 0) { encode = true; }\n return new PDFObjectStream(context, objects, encode);\n };\n return PDFObjectStream;\n}(PDFFlateStream));\nexport default PDFObjectStream;\n//# sourceMappingURL=PDFObjectStream.js.map","import { __awaiter, __generator } from \"tslib\";\nimport PDFCrossRefSection from \"../document/PDFCrossRefSection\";\nimport PDFHeader from \"../document/PDFHeader\";\nimport PDFTrailer from \"../document/PDFTrailer\";\nimport PDFTrailerDict from \"../document/PDFTrailerDict\";\nimport PDFObjectStream from \"../structures/PDFObjectStream\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { copyStringIntoBuffer, waitForTick } from \"../../utils\";\nvar PDFWriter = /** @class */ (function () {\n function PDFWriter(context, objectsPerTick) {\n var _this = this;\n this.parsedObjects = 0;\n this.shouldWaitForTick = function (n) {\n _this.parsedObjects += n;\n return _this.parsedObjects % _this.objectsPerTick === 0;\n };\n this.context = context;\n this.objectsPerTick = objectsPerTick;\n }\n PDFWriter.prototype.serializeToBuffer = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _a, size, header, indirectObjects, xref, trailerDict, trailer, offset, buffer, idx, len, _b, ref, object, objectNumber, generationNumber, n;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0: return [4 /*yield*/, this.computeBufferSize()];\n case 1:\n _a = _c.sent(), size = _a.size, header = _a.header, indirectObjects = _a.indirectObjects, xref = _a.xref, trailerDict = _a.trailerDict, trailer = _a.trailer;\n offset = 0;\n buffer = new Uint8Array(size);\n offset += header.copyBytesInto(buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n buffer[offset++] = CharCodes.Newline;\n idx = 0, len = indirectObjects.length;\n _c.label = 2;\n case 2:\n if (!(idx < len)) return [3 /*break*/, 5];\n _b = indirectObjects[idx], ref = _b[0], object = _b[1];\n objectNumber = String(ref.objectNumber);\n offset += copyStringIntoBuffer(objectNumber, buffer, offset);\n buffer[offset++] = CharCodes.Space;\n generationNumber = String(ref.generationNumber);\n offset += copyStringIntoBuffer(generationNumber, buffer, offset);\n buffer[offset++] = CharCodes.Space;\n buffer[offset++] = CharCodes.o;\n buffer[offset++] = CharCodes.b;\n buffer[offset++] = CharCodes.j;\n buffer[offset++] = CharCodes.Newline;\n offset += object.copyBytesInto(buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n buffer[offset++] = CharCodes.e;\n buffer[offset++] = CharCodes.n;\n buffer[offset++] = CharCodes.d;\n buffer[offset++] = CharCodes.o;\n buffer[offset++] = CharCodes.b;\n buffer[offset++] = CharCodes.j;\n buffer[offset++] = CharCodes.Newline;\n buffer[offset++] = CharCodes.Newline;\n n = object instanceof PDFObjectStream ? object.getObjectsCount() : 1;\n if (!this.shouldWaitForTick(n)) return [3 /*break*/, 4];\n return [4 /*yield*/, waitForTick()];\n case 3:\n _c.sent();\n _c.label = 4;\n case 4:\n idx++;\n return [3 /*break*/, 2];\n case 5:\n if (xref) {\n offset += xref.copyBytesInto(buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n }\n if (trailerDict) {\n offset += trailerDict.copyBytesInto(buffer, offset);\n buffer[offset++] = CharCodes.Newline;\n buffer[offset++] = CharCodes.Newline;\n }\n offset += trailer.copyBytesInto(buffer, offset);\n return [2 /*return*/, buffer];\n }\n });\n });\n };\n PDFWriter.prototype.computeIndirectObjectSize = function (_a) {\n var ref = _a[0], object = _a[1];\n var refSize = ref.sizeInBytes() + 3; // 'R' -> 'obj\\n'\n var objectSize = object.sizeInBytes() + 9; // '\\nendobj\\n\\n'\n return refSize + objectSize;\n };\n PDFWriter.prototype.createTrailerDict = function () {\n return this.context.obj({\n Size: this.context.largestObjectNumber + 1,\n Root: this.context.trailerInfo.Root,\n Encrypt: this.context.trailerInfo.Encrypt,\n Info: this.context.trailerInfo.Info,\n ID: this.context.trailerInfo.ID,\n });\n };\n PDFWriter.prototype.computeBufferSize = function () {\n return __awaiter(this, void 0, void 0, function () {\n var header, size, xref, indirectObjects, idx, len, indirectObject, ref, xrefOffset, trailerDict, trailer;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n header = PDFHeader.forVersion(1, 7);\n size = header.sizeInBytes() + 2;\n xref = PDFCrossRefSection.create();\n indirectObjects = this.context.enumerateIndirectObjects();\n idx = 0, len = indirectObjects.length;\n _a.label = 1;\n case 1:\n if (!(idx < len)) return [3 /*break*/, 4];\n indirectObject = indirectObjects[idx];\n ref = indirectObject[0];\n xref.addEntry(ref, size);\n size += this.computeIndirectObjectSize(indirectObject);\n if (!this.shouldWaitForTick(1)) return [3 /*break*/, 3];\n return [4 /*yield*/, waitForTick()];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3:\n idx++;\n return [3 /*break*/, 1];\n case 4:\n xrefOffset = size;\n size += xref.sizeInBytes() + 1; // '\\n'\n trailerDict = PDFTrailerDict.of(this.createTrailerDict());\n size += trailerDict.sizeInBytes() + 2; // '\\n\\n'\n trailer = PDFTrailer.forLastCrossRefSectionOffset(xrefOffset);\n size += trailer.sizeInBytes();\n return [2 /*return*/, { size: size, header: header, indirectObjects: indirectObjects, xref: xref, trailerDict: trailerDict, trailer: trailer }];\n }\n });\n });\n };\n PDFWriter.forContext = function (context, objectsPerTick) {\n return new PDFWriter(context, objectsPerTick);\n };\n return PDFWriter;\n}());\nexport default PDFWriter;\n//# sourceMappingURL=PDFWriter.js.map","import { __extends } from \"tslib\";\nimport PDFObject from \"./PDFObject\";\nvar PDFInvalidObject = /** @class */ (function (_super) {\n __extends(PDFInvalidObject, _super);\n function PDFInvalidObject(data) {\n var _this = _super.call(this) || this;\n _this.data = data;\n return _this;\n }\n PDFInvalidObject.prototype.clone = function () {\n return PDFInvalidObject.of(this.data.slice());\n };\n PDFInvalidObject.prototype.toString = function () {\n return \"PDFInvalidObject(\" + this.data.length + \" bytes)\";\n };\n PDFInvalidObject.prototype.sizeInBytes = function () {\n return this.data.length;\n };\n PDFInvalidObject.prototype.copyBytesInto = function (buffer, offset) {\n var length = this.data.length;\n for (var idx = 0; idx < length; idx++) {\n buffer[offset++] = this.data[idx];\n }\n return length;\n };\n PDFInvalidObject.of = function (data) { return new PDFInvalidObject(data); };\n return PDFInvalidObject;\n}(PDFObject));\nexport default PDFInvalidObject;\n//# sourceMappingURL=PDFInvalidObject.js.map","import { __awaiter, __extends, __generator } from \"tslib\";\nimport PDFHeader from \"../document/PDFHeader\";\nimport PDFTrailer from \"../document/PDFTrailer\";\nimport PDFInvalidObject from \"../objects/PDFInvalidObject\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFRef from \"../objects/PDFRef\";\nimport PDFStream from \"../objects/PDFStream\";\nimport PDFCrossRefStream from \"../structures/PDFCrossRefStream\";\nimport PDFObjectStream from \"../structures/PDFObjectStream\";\nimport PDFWriter from \"./PDFWriter\";\nimport { last, waitForTick } from \"../../utils\";\nvar PDFStreamWriter = /** @class */ (function (_super) {\n __extends(PDFStreamWriter, _super);\n function PDFStreamWriter(context, objectsPerTick, encodeStreams, objectsPerStream) {\n var _this = _super.call(this, context, objectsPerTick) || this;\n _this.encodeStreams = encodeStreams;\n _this.objectsPerStream = objectsPerStream;\n return _this;\n }\n PDFStreamWriter.prototype.computeBufferSize = function () {\n return __awaiter(this, void 0, void 0, function () {\n 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;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n objectNumber = this.context.largestObjectNumber + 1;\n header = PDFHeader.forVersion(1, 7);\n size = header.sizeInBytes() + 2;\n xrefStream = PDFCrossRefStream.create(this.createTrailerDict(), this.encodeStreams);\n uncompressedObjects = [];\n compressedObjects = [];\n objectStreamRefs = [];\n indirectObjects = this.context.enumerateIndirectObjects();\n idx = 0, len = indirectObjects.length;\n _a.label = 1;\n case 1:\n if (!(idx < len)) return [3 /*break*/, 6];\n indirectObject = indirectObjects[idx];\n ref = indirectObject[0], object = indirectObject[1];\n shouldNotCompress = ref === this.context.trailerInfo.Encrypt ||\n object instanceof PDFStream ||\n object instanceof PDFInvalidObject ||\n ref.generationNumber !== 0;\n if (!shouldNotCompress) return [3 /*break*/, 4];\n uncompressedObjects.push(indirectObject);\n xrefStream.addUncompressedEntry(ref, size);\n size += this.computeIndirectObjectSize(indirectObject);\n if (!this.shouldWaitForTick(1)) return [3 /*break*/, 3];\n return [4 /*yield*/, waitForTick()];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3: return [3 /*break*/, 5];\n case 4:\n chunk = last(compressedObjects);\n objectStreamRef = last(objectStreamRefs);\n if (!chunk || chunk.length % this.objectsPerStream === 0) {\n chunk = [];\n compressedObjects.push(chunk);\n objectStreamRef = PDFRef.of(objectNumber++);\n objectStreamRefs.push(objectStreamRef);\n }\n xrefStream.addCompressedEntry(ref, objectStreamRef, chunk.length);\n chunk.push(indirectObject);\n _a.label = 5;\n case 5:\n idx++;\n return [3 /*break*/, 1];\n case 6:\n idx = 0, len = compressedObjects.length;\n _a.label = 7;\n case 7:\n if (!(idx < len)) return [3 /*break*/, 10];\n chunk = compressedObjects[idx];\n ref = objectStreamRefs[idx];\n objectStream = PDFObjectStream.withContextAndObjects(this.context, chunk, this.encodeStreams);\n xrefStream.addUncompressedEntry(ref, size);\n size += this.computeIndirectObjectSize([ref, objectStream]);\n uncompressedObjects.push([ref, objectStream]);\n if (!this.shouldWaitForTick(chunk.length)) return [3 /*break*/, 9];\n return [4 /*yield*/, waitForTick()];\n case 8:\n _a.sent();\n _a.label = 9;\n case 9:\n idx++;\n return [3 /*break*/, 7];\n case 10:\n xrefStreamRef = PDFRef.of(objectNumber++);\n xrefStream.dict.set(PDFName.of('Size'), PDFNumber.of(objectNumber));\n xrefStream.addUncompressedEntry(xrefStreamRef, size);\n xrefOffset = size;\n size += this.computeIndirectObjectSize([xrefStreamRef, xrefStream]);\n uncompressedObjects.push([xrefStreamRef, xrefStream]);\n trailer = PDFTrailer.forLastCrossRefSectionOffset(xrefOffset);\n size += trailer.sizeInBytes();\n return [2 /*return*/, { size: size, header: header, indirectObjects: uncompressedObjects, trailer: trailer }];\n }\n });\n });\n };\n PDFStreamWriter.forContext = function (context, objectsPerTick, encodeStreams, objectsPerStream) {\n if (encodeStreams === void 0) { encodeStreams = true; }\n if (objectsPerStream === void 0) { objectsPerStream = 50; }\n return new PDFStreamWriter(context, objectsPerTick, encodeStreams, objectsPerStream);\n };\n return PDFStreamWriter;\n}(PDFWriter));\nexport default PDFStreamWriter;\n//# sourceMappingURL=PDFStreamWriter.js.map","import { Encodings, Font, FontNames, } from '@pdf-lib/standard-fonts';\nimport PDFHexString from \"../objects/PDFHexString\";\nimport { toCodePoint, toHexString } from \"../../utils\";\n/**\n * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as\n * this class borrows from:\n * https://github.com/foliojs/pdfkit/blob/f91bdd61c164a72ea06be1a43dc0a412afc3925f/lib/font/afm.coffee\n */\nvar StandardFontEmbedder = /** @class */ (function () {\n function StandardFontEmbedder(fontName, customName) {\n // prettier-ignore\n this.encoding = (fontName === FontNames.ZapfDingbats ? Encodings.ZapfDingbats\n : fontName === FontNames.Symbol ? Encodings.Symbol\n : Encodings.WinAnsi);\n this.font = Font.load(fontName);\n this.fontName = this.font.FontName;\n this.customName = customName;\n }\n /**\n * Encode the JavaScript string into this font. (JavaScript encodes strings in\n * Unicode, but standard fonts use either WinAnsi, ZapfDingbats, or Symbol\n * encodings)\n */\n StandardFontEmbedder.prototype.encodeText = function (text) {\n var glyphs = this.encodeTextAsGlyphs(text);\n var hexCodes = new Array(glyphs.length);\n for (var idx = 0, len = glyphs.length; idx < len; idx++) {\n hexCodes[idx] = toHexString(glyphs[idx].code);\n }\n return PDFHexString.of(hexCodes.join(''));\n };\n StandardFontEmbedder.prototype.widthOfTextAtSize = function (text, size) {\n var glyphs = this.encodeTextAsGlyphs(text);\n var totalWidth = 0;\n for (var idx = 0, len = glyphs.length; idx < len; idx++) {\n var left = glyphs[idx].name;\n var right = (glyphs[idx + 1] || {}).name;\n var kernAmount = this.font.getXAxisKerningForPair(left, right) || 0;\n totalWidth += this.widthOfGlyph(left) + kernAmount;\n }\n var scale = size / 1000;\n return totalWidth * scale;\n };\n StandardFontEmbedder.prototype.heightOfFontAtSize = function (size, options) {\n if (options === void 0) { options = {}; }\n var _a = options.descender, descender = _a === void 0 ? true : _a;\n var _b = this.font, Ascender = _b.Ascender, Descender = _b.Descender, FontBBox = _b.FontBBox;\n var yTop = Ascender || FontBBox[3];\n var yBottom = Descender || FontBBox[1];\n var height = yTop - yBottom;\n if (!descender)\n height += Descender || 0;\n return (height / 1000) * size;\n };\n StandardFontEmbedder.prototype.sizeOfFontAtHeight = function (height) {\n var _a = this.font, Ascender = _a.Ascender, Descender = _a.Descender, FontBBox = _a.FontBBox;\n var yTop = Ascender || FontBBox[3];\n var yBottom = Descender || FontBBox[1];\n return (1000 * height) / (yTop - yBottom);\n };\n StandardFontEmbedder.prototype.embedIntoContext = function (context, ref) {\n var fontDict = context.obj({\n Type: 'Font',\n Subtype: 'Type1',\n BaseFont: this.customName || this.fontName,\n Encoding: this.encoding === Encodings.WinAnsi ? 'WinAnsiEncoding' : undefined,\n });\n if (ref) {\n context.assign(ref, fontDict);\n return ref;\n }\n else {\n return context.register(fontDict);\n }\n };\n StandardFontEmbedder.prototype.widthOfGlyph = function (glyphName) {\n // Default to 250 if font doesn't specify a width\n return this.font.getWidthOfGlyph(glyphName) || 250;\n };\n StandardFontEmbedder.prototype.encodeTextAsGlyphs = function (text) {\n var codePoints = Array.from(text);\n var glyphs = new Array(codePoints.length);\n for (var idx = 0, len = codePoints.length; idx < len; idx++) {\n var codePoint = toCodePoint(codePoints[idx]);\n glyphs[idx] = this.encoding.encodeUnicodeCodePoint(codePoint);\n }\n return glyphs;\n };\n StandardFontEmbedder.for = function (fontName, customName) {\n return new StandardFontEmbedder(fontName, customName);\n };\n return StandardFontEmbedder;\n}());\nexport default StandardFontEmbedder;\n//# sourceMappingURL=StandardFontEmbedder.js.map","import { toHexString, toHexStringOfMinLength } from \"../../utils\";\nimport { hasSurrogates, highSurrogate, isWithinBMP, lowSurrogate, } from \"../../utils/unicode\";\n/** `glyphs` should be an array of unique glyphs */\nexport var createCmap = function (glyphs, glyphId) {\n var bfChars = new Array(glyphs.length);\n for (var idx = 0, len = glyphs.length; idx < len; idx++) {\n var glyph = glyphs[idx];\n var id = cmapHexFormat(cmapHexString(glyphId(glyph)));\n var unicode = cmapHexFormat.apply(void 0, glyph.codePoints.map(cmapCodePointFormat));\n bfChars[idx] = [id, unicode];\n }\n return fillCmapTemplate(bfChars);\n};\n/* =============================== Templates ================================ */\nvar 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) {\n var glyphId = _a[0], codePoint = _a[1];\n return glyphId + \" \" + codePoint;\n}).join('\\n') + \"\\nendbfchar\\nendcmap\\nCMapName currentdict /CMap defineresource pop\\nend\\nend\"; };\n/* =============================== Utilities ================================ */\nvar cmapHexFormat = function () {\n var values = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n values[_i] = arguments[_i];\n }\n return \"<\" + values.join('') + \">\";\n};\nvar cmapHexString = function (value) { return toHexStringOfMinLength(value, 4); };\nvar cmapCodePointFormat = function (codePoint) {\n if (isWithinBMP(codePoint))\n return cmapHexString(codePoint);\n if (hasSurrogates(codePoint)) {\n var hs = highSurrogate(codePoint);\n var ls = lowSurrogate(codePoint);\n return \"\" + cmapHexString(hs) + cmapHexString(ls);\n }\n var hex = toHexString(codePoint);\n var msg = \"0x\" + hex + \" is not a valid UTF-8 or UTF-16 codepoint.\";\n throw new Error(msg);\n};\n//# sourceMappingURL=CMap.js.map","// prettier-ignore\nvar makeFontFlags = function (options) {\n var flags = 0;\n var flipBit = function (bit) { flags |= (1 << (bit - 1)); };\n if (options.fixedPitch)\n flipBit(1);\n if (options.serif)\n flipBit(2);\n if (options.symbolic)\n flipBit(3);\n if (options.script)\n flipBit(4);\n if (options.nonsymbolic)\n flipBit(6);\n if (options.italic)\n flipBit(7);\n if (options.allCap)\n flipBit(17);\n if (options.smallCap)\n flipBit(18);\n if (options.forceBold)\n flipBit(19);\n return flags;\n};\n// From: https://github.com/foliojs/pdfkit/blob/83f5f7243172a017adcf6a7faa5547c55982c57b/lib/font/embedded.js#L123-L129\nexport var deriveFontFlags = function (font) {\n var familyClass = font['OS/2'] ? font['OS/2'].sFamilyClass : 0;\n var flags = makeFontFlags({\n fixedPitch: font.post.isFixedPitch,\n serif: 1 <= familyClass && familyClass <= 7,\n symbolic: true,\n script: familyClass === 10,\n italic: font.head.macStyle.italic,\n });\n return flags;\n};\n//# sourceMappingURL=FontFlags.js.map","import { __awaiter, __generator } from \"tslib\";\nimport { createCmap } from \"./CMap\";\nimport { deriveFontFlags } from \"./FontFlags\";\nimport PDFHexString from \"../objects/PDFHexString\";\nimport PDFString from \"../objects/PDFString\";\nimport { byAscendingId, Cache, sortedUniq, toHexStringOfMinLength, } from \"../../utils\";\n/**\n * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as\n * this class borrows from:\n * https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/jpeg.coffee\n */\nvar CustomFontEmbedder = /** @class */ (function () {\n function CustomFontEmbedder(font, fontData, customName, fontFeatures) {\n var _this = this;\n this.allGlyphsInFontSortedById = function () {\n var glyphs = new Array(_this.font.characterSet.length);\n for (var idx = 0, len = glyphs.length; idx < len; idx++) {\n var codePoint = _this.font.characterSet[idx];\n glyphs[idx] = _this.font.glyphForCodePoint(codePoint);\n }\n return sortedUniq(glyphs.sort(byAscendingId), function (g) { return g.id; });\n };\n this.font = font;\n this.scale = 1000 / this.font.unitsPerEm;\n this.fontData = fontData;\n this.fontName = this.font.postscriptName || 'Font';\n this.customName = customName;\n this.fontFeatures = fontFeatures;\n this.baseFontName = '';\n this.glyphCache = Cache.populatedBy(this.allGlyphsInFontSortedById);\n }\n CustomFontEmbedder.for = function (fontkit, fontData, customName, fontFeatures) {\n return __awaiter(this, void 0, void 0, function () {\n var font;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, fontkit.create(fontData)];\n case 1:\n font = _a.sent();\n return [2 /*return*/, new CustomFontEmbedder(font, fontData, customName, fontFeatures)];\n }\n });\n });\n };\n /**\n * Encode the JavaScript string into this font. (JavaScript encodes strings in\n * Unicode, but embedded fonts use their own custom encodings)\n */\n CustomFontEmbedder.prototype.encodeText = function (text) {\n var glyphs = this.font.layout(text, this.fontFeatures).glyphs;\n var hexCodes = new Array(glyphs.length);\n for (var idx = 0, len = glyphs.length; idx < len; idx++) {\n hexCodes[idx] = toHexStringOfMinLength(glyphs[idx].id, 4);\n }\n return PDFHexString.of(hexCodes.join(''));\n };\n // The advanceWidth takes into account kerning automatically, so we don't\n // have to do that manually like we do for the standard fonts.\n CustomFontEmbedder.prototype.widthOfTextAtSize = function (text, size) {\n var glyphs = this.font.layout(text, this.fontFeatures).glyphs;\n var totalWidth = 0;\n for (var idx = 0, len = glyphs.length; idx < len; idx++) {\n totalWidth += glyphs[idx].advanceWidth * this.scale;\n }\n var scale = size / 1000;\n return totalWidth * scale;\n };\n CustomFontEmbedder.prototype.heightOfFontAtSize = function (size, options) {\n if (options === void 0) { options = {}; }\n var _a = options.descender, descender = _a === void 0 ? true : _a;\n var _b = this.font, ascent = _b.ascent, descent = _b.descent, bbox = _b.bbox;\n var yTop = (ascent || bbox.maxY) * this.scale;\n var yBottom = (descent || bbox.minY) * this.scale;\n var height = yTop - yBottom;\n if (!descender)\n height -= Math.abs(descent) || 0;\n return (height / 1000) * size;\n };\n CustomFontEmbedder.prototype.sizeOfFontAtHeight = function (height) {\n var _a = this.font, ascent = _a.ascent, descent = _a.descent, bbox = _a.bbox;\n var yTop = (ascent || bbox.maxY) * this.scale;\n var yBottom = (descent || bbox.minY) * this.scale;\n return (1000 * height) / (yTop - yBottom);\n };\n CustomFontEmbedder.prototype.embedIntoContext = function (context, ref) {\n this.baseFontName =\n this.customName || context.addRandomSuffix(this.fontName);\n return this.embedFontDict(context, ref);\n };\n CustomFontEmbedder.prototype.embedFontDict = function (context, ref) {\n return __awaiter(this, void 0, void 0, function () {\n var cidFontDictRef, unicodeCMapRef, fontDict;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.embedCIDFontDict(context)];\n case 1:\n cidFontDictRef = _a.sent();\n unicodeCMapRef = this.embedUnicodeCmap(context);\n fontDict = context.obj({\n Type: 'Font',\n Subtype: 'Type0',\n BaseFont: this.baseFontName,\n Encoding: 'Identity-H',\n DescendantFonts: [cidFontDictRef],\n ToUnicode: unicodeCMapRef,\n });\n if (ref) {\n context.assign(ref, fontDict);\n return [2 /*return*/, ref];\n }\n else {\n return [2 /*return*/, context.register(fontDict)];\n }\n return [2 /*return*/];\n }\n });\n });\n };\n CustomFontEmbedder.prototype.isCFF = function () {\n return this.font.cff;\n };\n CustomFontEmbedder.prototype.embedCIDFontDict = function (context) {\n return __awaiter(this, void 0, void 0, function () {\n var fontDescriptorRef, cidFontDict;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.embedFontDescriptor(context)];\n case 1:\n fontDescriptorRef = _a.sent();\n cidFontDict = context.obj({\n Type: 'Font',\n Subtype: this.isCFF() ? 'CIDFontType0' : 'CIDFontType2',\n CIDToGIDMap: 'Identity',\n BaseFont: this.baseFontName,\n CIDSystemInfo: {\n Registry: PDFString.of('Adobe'),\n Ordering: PDFString.of('Identity'),\n Supplement: 0,\n },\n FontDescriptor: fontDescriptorRef,\n W: this.computeWidths(),\n });\n return [2 /*return*/, context.register(cidFontDict)];\n }\n });\n });\n };\n CustomFontEmbedder.prototype.embedFontDescriptor = function (context) {\n return __awaiter(this, void 0, void 0, function () {\n var fontStreamRef, scale, _a, italicAngle, ascent, descent, capHeight, xHeight, _b, minX, minY, maxX, maxY, fontDescriptor;\n var _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0: return [4 /*yield*/, this.embedFontStream(context)];\n case 1:\n fontStreamRef = _d.sent();\n scale = this.scale;\n _a = this.font, italicAngle = _a.italicAngle, ascent = _a.ascent, descent = _a.descent, capHeight = _a.capHeight, xHeight = _a.xHeight;\n _b = this.font.bbox, minX = _b.minX, minY = _b.minY, maxX = _b.maxX, maxY = _b.maxY;\n fontDescriptor = context.obj((_c = {\n Type: 'FontDescriptor',\n FontName: this.baseFontName,\n Flags: deriveFontFlags(this.font),\n FontBBox: [minX * scale, minY * scale, maxX * scale, maxY * scale],\n ItalicAngle: italicAngle,\n Ascent: ascent * scale,\n Descent: descent * scale,\n CapHeight: (capHeight || ascent) * scale,\n XHeight: (xHeight || 0) * scale,\n // Not sure how to compute/find this, nor is anybody else really:\n // https://stackoverflow.com/questions/35485179/stemv-value-of-the-truetype-font\n StemV: 0\n },\n _c[this.isCFF() ? 'FontFile3' : 'FontFile2'] = fontStreamRef,\n _c));\n return [2 /*return*/, context.register(fontDescriptor)];\n }\n });\n });\n };\n CustomFontEmbedder.prototype.serializeFont = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, this.fontData];\n });\n });\n };\n CustomFontEmbedder.prototype.embedFontStream = function (context) {\n return __awaiter(this, void 0, void 0, function () {\n var fontStream, _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _b = (_a = context).flateStream;\n return [4 /*yield*/, this.serializeFont()];\n case 1:\n fontStream = _b.apply(_a, [_c.sent(), {\n Subtype: this.isCFF() ? 'CIDFontType0C' : undefined,\n }]);\n return [2 /*return*/, context.register(fontStream)];\n }\n });\n });\n };\n CustomFontEmbedder.prototype.embedUnicodeCmap = function (context) {\n var cmap = createCmap(this.glyphCache.access(), this.glyphId.bind(this));\n var cmapStream = context.flateStream(cmap);\n return context.register(cmapStream);\n };\n CustomFontEmbedder.prototype.glyphId = function (glyph) {\n return glyph ? glyph.id : -1;\n };\n CustomFontEmbedder.prototype.computeWidths = function () {\n var glyphs = this.glyphCache.access();\n var widths = [];\n var currSection = [];\n for (var idx = 0, len = glyphs.length; idx < len; idx++) {\n var currGlyph = glyphs[idx];\n var prevGlyph = glyphs[idx - 1];\n var currGlyphId = this.glyphId(currGlyph);\n var prevGlyphId = this.glyphId(prevGlyph);\n if (idx === 0) {\n widths.push(currGlyphId);\n }\n else if (currGlyphId - prevGlyphId !== 1) {\n widths.push(currSection);\n widths.push(currGlyphId);\n currSection = [];\n }\n currSection.push(currGlyph.advanceWidth * this.scale);\n }\n widths.push(currSection);\n return widths;\n };\n return CustomFontEmbedder;\n}());\nexport default CustomFontEmbedder;\n//# sourceMappingURL=CustomFontEmbedder.js.map","import { __awaiter, __extends, __generator } from \"tslib\";\nimport CustomFontEmbedder from \"./CustomFontEmbedder\";\nimport PDFHexString from \"../objects/PDFHexString\";\nimport { Cache, mergeUint8Arrays, toHexStringOfMinLength } from \"../../utils\";\n/**\n * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as\n * this class borrows from:\n * https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/jpeg.coffee\n */\nvar CustomFontSubsetEmbedder = /** @class */ (function (_super) {\n __extends(CustomFontSubsetEmbedder, _super);\n function CustomFontSubsetEmbedder(font, fontData, customFontName, fontFeatures) {\n var _this = _super.call(this, font, fontData, customFontName, fontFeatures) || this;\n _this.subset = _this.font.createSubset();\n _this.glyphs = [];\n _this.glyphCache = Cache.populatedBy(function () { return _this.glyphs; });\n _this.glyphIdMap = new Map();\n return _this;\n }\n CustomFontSubsetEmbedder.for = function (fontkit, fontData, customFontName, fontFeatures) {\n return __awaiter(this, void 0, void 0, function () {\n var font;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, fontkit.create(fontData)];\n case 1:\n font = _a.sent();\n return [2 /*return*/, new CustomFontSubsetEmbedder(font, fontData, customFontName, fontFeatures)];\n }\n });\n });\n };\n CustomFontSubsetEmbedder.prototype.encodeText = function (text) {\n var glyphs = this.font.layout(text, this.fontFeatures).glyphs;\n var hexCodes = new Array(glyphs.length);\n for (var idx = 0, len = glyphs.length; idx < len; idx++) {\n var glyph = glyphs[idx];\n var subsetGlyphId = this.subset.includeGlyph(glyph);\n this.glyphs[subsetGlyphId - 1] = glyph;\n this.glyphIdMap.set(glyph.id, subsetGlyphId);\n hexCodes[idx] = toHexStringOfMinLength(subsetGlyphId, 4);\n }\n this.glyphCache.invalidate();\n return PDFHexString.of(hexCodes.join(''));\n };\n CustomFontSubsetEmbedder.prototype.isCFF = function () {\n return this.subset.cff;\n };\n CustomFontSubsetEmbedder.prototype.glyphId = function (glyph) {\n return glyph ? this.glyphIdMap.get(glyph.id) : -1;\n };\n CustomFontSubsetEmbedder.prototype.serializeFont = function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n var parts = [];\n _this.subset\n .encodeStream()\n .on('data', function (bytes) { return parts.push(bytes); })\n .on('end', function () { return resolve(mergeUint8Arrays(parts)); })\n .on('error', function (err) { return reject(err); });\n });\n };\n return CustomFontSubsetEmbedder;\n}(CustomFontEmbedder));\nexport default CustomFontSubsetEmbedder;\n//# sourceMappingURL=CustomFontSubsetEmbedder.js.map","import { __awaiter, __generator } from \"tslib\";\nimport { PNG } from \"../../utils/png\";\n/**\n * A note of thanks to the developers of https://github.com/foliojs/pdfkit, as\n * this class borrows from:\n * https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/png.coffee\n */\nvar PngEmbedder = /** @class */ (function () {\n function PngEmbedder(png) {\n this.image = png;\n this.bitsPerComponent = png.bitsPerComponent;\n this.width = png.width;\n this.height = png.height;\n this.colorSpace = 'DeviceRGB';\n }\n PngEmbedder.for = function (imageData) {\n return __awaiter(this, void 0, void 0, function () {\n var png;\n return __generator(this, function (_a) {\n png = PNG.load(imageData);\n return [2 /*return*/, new PngEmbedder(png)];\n });\n });\n };\n PngEmbedder.prototype.embedIntoContext = function (context, ref) {\n return __awaiter(this, void 0, void 0, function () {\n var SMask, xObject;\n return __generator(this, function (_a) {\n SMask = this.embedAlphaChannel(context);\n xObject = context.flateStream(this.image.rgbChannel, {\n Type: 'XObject',\n Subtype: 'Image',\n BitsPerComponent: this.image.bitsPerComponent,\n Width: this.image.width,\n Height: this.image.height,\n ColorSpace: this.colorSpace,\n SMask: SMask,\n });\n if (ref) {\n context.assign(ref, xObject);\n return [2 /*return*/, ref];\n }\n else {\n return [2 /*return*/, context.register(xObject)];\n }\n return [2 /*return*/];\n });\n });\n };\n PngEmbedder.prototype.embedAlphaChannel = function (context) {\n if (!this.image.alphaChannel)\n return undefined;\n var xObject = context.flateStream(this.image.alphaChannel, {\n Type: 'XObject',\n Subtype: 'Image',\n Height: this.image.height,\n Width: this.image.width,\n BitsPerComponent: this.image.bitsPerComponent,\n ColorSpace: 'DeviceGray',\n Decode: [0, 1],\n });\n return context.register(xObject);\n };\n return PngEmbedder;\n}());\nexport default PngEmbedder;\n//# sourceMappingURL=PngEmbedder.js.map","/*\n * Copyright 2012 Mozilla Foundation\n *\n * The Stream class contained in this file is a TypeScript port of the\n * JavaScript Stream class in Mozilla's pdf.js project, made available\n * under the Apache 2.0 open source license.\n */\nvar Stream = /** @class */ (function () {\n function Stream(buffer, start, length) {\n this.bytes = buffer;\n this.start = start || 0;\n this.pos = this.start;\n this.end = !!start && !!length ? start + length : this.bytes.length;\n }\n Object.defineProperty(Stream.prototype, \"length\", {\n get: function () {\n return this.end - this.start;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Stream.prototype, \"isEmpty\", {\n get: function () {\n return this.length === 0;\n },\n enumerable: false,\n configurable: true\n });\n Stream.prototype.getByte = function () {\n if (this.pos >= this.end) {\n return -1;\n }\n return this.bytes[this.pos++];\n };\n Stream.prototype.getUint16 = function () {\n var b0 = this.getByte();\n var b1 = this.getByte();\n if (b0 === -1 || b1 === -1) {\n return -1;\n }\n return (b0 << 8) + b1;\n };\n Stream.prototype.getInt32 = function () {\n var b0 = this.getByte();\n var b1 = this.getByte();\n var b2 = this.getByte();\n var b3 = this.getByte();\n return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;\n };\n // Returns subarray of original buffer, should only be read.\n Stream.prototype.getBytes = function (length, forceClamped) {\n if (forceClamped === void 0) { forceClamped = false; }\n var bytes = this.bytes;\n var pos = this.pos;\n var strEnd = this.end;\n if (!length) {\n var subarray = bytes.subarray(pos, strEnd);\n // `this.bytes` is always a `Uint8Array` here.\n return forceClamped ? new Uint8ClampedArray(subarray) : subarray;\n }\n else {\n var end = pos + length;\n if (end > strEnd) {\n end = strEnd;\n }\n this.pos = end;\n var subarray = bytes.subarray(pos, end);\n // `this.bytes` is always a `Uint8Array` here.\n return forceClamped ? new Uint8ClampedArray(subarray) : subarray;\n }\n };\n Stream.prototype.peekByte = function () {\n var peekedByte = this.getByte();\n this.pos--;\n return peekedByte;\n };\n Stream.prototype.peekBytes = function (length, forceClamped) {\n if (forceClamped === void 0) { forceClamped = false; }\n var bytes = this.getBytes(length, forceClamped);\n this.pos -= bytes.length;\n return bytes;\n };\n Stream.prototype.skip = function (n) {\n if (!n) {\n n = 1;\n }\n this.pos += n;\n };\n Stream.prototype.reset = function () {\n this.pos = this.start;\n };\n Stream.prototype.moveStart = function () {\n this.start = this.pos;\n };\n Stream.prototype.makeSubStream = function (start, length) {\n return new Stream(this.bytes, start, length);\n };\n Stream.prototype.decode = function () {\n return this.bytes;\n };\n return Stream;\n}());\nexport default Stream;\n//# sourceMappingURL=Stream.js.map","import { MethodNotImplementedError } from \"../errors\";\nimport Stream from \"./Stream\";\n/*\n * Copyright 2012 Mozilla Foundation\n *\n * The DecodeStream class contained in this file is a TypeScript port of the\n * JavaScript DecodeStream class in Mozilla's pdf.js project, made available\n * under the Apache 2.0 open source license.\n */\n// Lots of DecodeStreams are created whose buffers are never used. For these\n// we share a single empty buffer. This is (a) space-efficient and (b) avoids\n// having special cases that would be required if we used |null| for an empty\n// buffer.\nvar emptyBuffer = new Uint8Array(0);\n/**\n * Super class for the decoding streams\n */\nvar DecodeStream = /** @class */ (function () {\n function DecodeStream(maybeMinBufferLength) {\n this.pos = 0;\n this.bufferLength = 0;\n this.eof = false;\n this.buffer = emptyBuffer;\n this.minBufferLength = 512;\n if (maybeMinBufferLength) {\n // Compute the first power of two that is as big as maybeMinBufferLength.\n while (this.minBufferLength < maybeMinBufferLength) {\n this.minBufferLength *= 2;\n }\n }\n }\n Object.defineProperty(DecodeStream.prototype, \"isEmpty\", {\n get: function () {\n while (!this.eof && this.bufferLength === 0) {\n this.readBlock();\n }\n return this.bufferLength === 0;\n },\n enumerable: false,\n configurable: true\n });\n DecodeStream.prototype.getByte = function () {\n var pos = this.pos;\n while (this.bufferLength <= pos) {\n if (this.eof) {\n return -1;\n }\n this.readBlock();\n }\n return this.buffer[this.pos++];\n };\n DecodeStream.prototype.getUint16 = function () {\n var b0 = this.getByte();\n var b1 = this.getByte();\n if (b0 === -1 || b1 === -1) {\n return -1;\n }\n return (b0 << 8) + b1;\n };\n DecodeStream.prototype.getInt32 = function () {\n var b0 = this.getByte();\n var b1 = this.getByte();\n var b2 = this.getByte();\n var b3 = this.getByte();\n return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;\n };\n DecodeStream.prototype.getBytes = function (length, forceClamped) {\n if (forceClamped === void 0) { forceClamped = false; }\n var end;\n var pos = this.pos;\n if (length) {\n this.ensureBuffer(pos + length);\n end = pos + length;\n while (!this.eof && this.bufferLength < end) {\n this.readBlock();\n }\n var bufEnd = this.bufferLength;\n if (end > bufEnd) {\n end = bufEnd;\n }\n }\n else {\n while (!this.eof) {\n this.readBlock();\n }\n end = this.bufferLength;\n }\n this.pos = end;\n var subarray = this.buffer.subarray(pos, end);\n // `this.buffer` is either a `Uint8Array` or `Uint8ClampedArray` here.\n return forceClamped && !(subarray instanceof Uint8ClampedArray)\n ? new Uint8ClampedArray(subarray)\n : subarray;\n };\n DecodeStream.prototype.peekByte = function () {\n var peekedByte = this.getByte();\n this.pos--;\n return peekedByte;\n };\n DecodeStream.prototype.peekBytes = function (length, forceClamped) {\n if (forceClamped === void 0) { forceClamped = false; }\n var bytes = this.getBytes(length, forceClamped);\n this.pos -= bytes.length;\n return bytes;\n };\n DecodeStream.prototype.skip = function (n) {\n if (!n) {\n n = 1;\n }\n this.pos += n;\n };\n DecodeStream.prototype.reset = function () {\n this.pos = 0;\n };\n DecodeStream.prototype.makeSubStream = function (start, length /* dict */) {\n var end = start + length;\n while (this.bufferLength <= end && !this.eof) {\n this.readBlock();\n }\n return new Stream(this.buffer, start, length /* dict */);\n };\n DecodeStream.prototype.decode = function () {\n while (!this.eof)\n this.readBlock();\n return this.buffer.subarray(0, this.bufferLength);\n };\n DecodeStream.prototype.readBlock = function () {\n throw new MethodNotImplementedError(this.constructor.name, 'readBlock');\n };\n DecodeStream.prototype.ensureBuffer = function (requested) {\n var buffer = this.buffer;\n if (requested <= buffer.byteLength) {\n return buffer;\n }\n var size = this.minBufferLength;\n while (size < requested) {\n size *= 2;\n }\n var buffer2 = new Uint8Array(size);\n buffer2.set(buffer);\n return (this.buffer = buffer2);\n };\n return DecodeStream;\n}());\nexport default DecodeStream;\n//# sourceMappingURL=DecodeStream.js.map","/*\n * Copyright 2012 Mozilla Foundation\n *\n * The Ascii85Stream class contained in this file is a TypeScript port of the\n * JavaScript Ascii85Stream class in Mozilla's pdf.js project, made available\n * under the Apache 2.0 open source license.\n */\nimport { __extends } from \"tslib\";\nimport DecodeStream from \"./DecodeStream\";\nvar isSpace = function (ch) {\n return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;\n};\nvar Ascii85Stream = /** @class */ (function (_super) {\n __extends(Ascii85Stream, _super);\n function Ascii85Stream(stream, maybeLength) {\n var _this = _super.call(this, maybeLength) || this;\n _this.stream = stream;\n _this.input = new Uint8Array(5);\n // Most streams increase in size when decoded, but Ascii85 streams\n // typically shrink by ~20%.\n if (maybeLength) {\n maybeLength = 0.8 * maybeLength;\n }\n return _this;\n }\n Ascii85Stream.prototype.readBlock = function () {\n var TILDA_CHAR = 0x7e; // '~'\n var Z_LOWER_CHAR = 0x7a; // 'z'\n var EOF = -1;\n var stream = this.stream;\n var c = stream.getByte();\n while (isSpace(c)) {\n c = stream.getByte();\n }\n if (c === EOF || c === TILDA_CHAR) {\n this.eof = true;\n return;\n }\n var bufferLength = this.bufferLength;\n var buffer;\n var i;\n // special code for z\n if (c === Z_LOWER_CHAR) {\n buffer = this.ensureBuffer(bufferLength + 4);\n for (i = 0; i < 4; ++i) {\n buffer[bufferLength + i] = 0;\n }\n this.bufferLength += 4;\n }\n else {\n var input = this.input;\n input[0] = c;\n for (i = 1; i < 5; ++i) {\n c = stream.getByte();\n while (isSpace(c)) {\n c = stream.getByte();\n }\n input[i] = c;\n if (c === EOF || c === TILDA_CHAR) {\n break;\n }\n }\n buffer = this.ensureBuffer(bufferLength + i - 1);\n this.bufferLength += i - 1;\n // partial ending;\n if (i < 5) {\n for (; i < 5; ++i) {\n input[i] = 0x21 + 84;\n }\n this.eof = true;\n }\n var t = 0;\n for (i = 0; i < 5; ++i) {\n t = t * 85 + (input[i] - 0x21);\n }\n for (i = 3; i >= 0; --i) {\n buffer[bufferLength + i] = t & 0xff;\n t >>= 8;\n }\n }\n };\n return Ascii85Stream;\n}(DecodeStream));\nexport default Ascii85Stream;\n//# sourceMappingURL=Ascii85Stream.js.map","/*\n * Copyright 2012 Mozilla Foundation\n *\n * The AsciiHexStream class contained in this file is a TypeScript port of the\n * JavaScript AsciiHexStream class in Mozilla's pdf.js project, made available\n * under the Apache 2.0 open source license.\n */\nimport { __extends } from \"tslib\";\nimport DecodeStream from \"./DecodeStream\";\nvar AsciiHexStream = /** @class */ (function (_super) {\n __extends(AsciiHexStream, _super);\n function AsciiHexStream(stream, maybeLength) {\n var _this = _super.call(this, maybeLength) || this;\n _this.stream = stream;\n _this.firstDigit = -1;\n // Most streams increase in size when decoded, but AsciiHex streams shrink\n // by 50%.\n if (maybeLength) {\n maybeLength = 0.5 * maybeLength;\n }\n return _this;\n }\n AsciiHexStream.prototype.readBlock = function () {\n var UPSTREAM_BLOCK_SIZE = 8000;\n var bytes = this.stream.getBytes(UPSTREAM_BLOCK_SIZE);\n if (!bytes.length) {\n this.eof = true;\n return;\n }\n var maxDecodeLength = (bytes.length + 1) >> 1;\n var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);\n var bufferLength = this.bufferLength;\n var firstDigit = this.firstDigit;\n for (var i = 0, ii = bytes.length; i < ii; i++) {\n var ch = bytes[i];\n var digit = void 0;\n if (ch >= 0x30 && ch <= 0x39) {\n // '0'-'9'\n digit = ch & 0x0f;\n }\n else if ((ch >= 0x41 && ch <= 0x46) || (ch >= 0x61 && ch <= 0x66)) {\n // 'A'-'Z', 'a'-'z'\n digit = (ch & 0x0f) + 9;\n }\n else if (ch === 0x3e) {\n // '>'\n this.eof = true;\n break;\n }\n else {\n // probably whitespace\n continue; // ignoring\n }\n if (firstDigit < 0) {\n firstDigit = digit;\n }\n else {\n buffer[bufferLength++] = (firstDigit << 4) | digit;\n firstDigit = -1;\n }\n }\n if (firstDigit >= 0 && this.eof) {\n // incomplete byte\n buffer[bufferLength++] = firstDigit << 4;\n firstDigit = -1;\n }\n this.firstDigit = firstDigit;\n this.bufferLength = bufferLength;\n };\n return AsciiHexStream;\n}(DecodeStream));\nexport default AsciiHexStream;\n//# sourceMappingURL=AsciiHexStream.js.map","/*\n * Copyright 1996-2003 Glyph & Cog, LLC\n *\n * The flate stream implementation contained in this file is a JavaScript port\n * of XPDF's implementation, made available under the Apache 2.0 open source\n * license.\n */\nimport { __extends } from \"tslib\";\n/*\n * Copyright 2012 Mozilla Foundation\n *\n * The FlateStream class contained in this file is a TypeScript port of the\n * JavaScript FlateStream class in Mozilla's pdf.js project, made available\n * under the Apache 2.0 open source license.\n */\n/* tslint:disable no-conditional-assignment */\nimport DecodeStream from \"./DecodeStream\";\n// prettier-ignore\nvar codeLenCodeMap = new Int32Array([\n 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15\n]);\n// prettier-ignore\nvar lengthDecode = new Int32Array([\n 0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a,\n 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f,\n 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073,\n 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102\n]);\n// prettier-ignore\nvar distDecode = new Int32Array([\n 0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d,\n 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1,\n 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01,\n 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001\n]);\n// prettier-ignore\nvar fixedLitCodeTab = [new Int32Array([\n 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0,\n 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0,\n 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0,\n 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0,\n 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8,\n 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8,\n 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8,\n 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8,\n 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4,\n 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4,\n 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4,\n 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4,\n 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc,\n 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec,\n 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc,\n 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc,\n 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2,\n 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2,\n 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2,\n 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2,\n 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca,\n 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea,\n 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da,\n 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa,\n 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6,\n 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6,\n 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6,\n 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6,\n 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce,\n 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee,\n 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de,\n 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe,\n 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1,\n 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1,\n 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1,\n 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1,\n 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9,\n 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9,\n 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9,\n 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9,\n 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5,\n 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5,\n 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5,\n 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5,\n 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd,\n 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed,\n 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd,\n 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd,\n 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3,\n 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3,\n 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3,\n 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3,\n 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb,\n 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb,\n 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db,\n 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb,\n 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7,\n 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7,\n 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7,\n 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7,\n 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf,\n 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef,\n 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df,\n 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff\n ]), 9];\n// prettier-ignore\nvar fixedDistCodeTab = [new Int32Array([\n 0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c,\n 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000,\n 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d,\n 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000\n ]), 5];\nvar FlateStream = /** @class */ (function (_super) {\n __extends(FlateStream, _super);\n function FlateStream(stream, maybeLength) {\n var _this = _super.call(this, maybeLength) || this;\n _this.stream = stream;\n var cmf = stream.getByte();\n var flg = stream.getByte();\n if (cmf === -1 || flg === -1) {\n throw new Error(\"Invalid header in flate stream: \" + cmf + \", \" + flg);\n }\n if ((cmf & 0x0f) !== 0x08) {\n throw new Error(\"Unknown compression method in flate stream: \" + cmf + \", \" + flg);\n }\n if (((cmf << 8) + flg) % 31 !== 0) {\n throw new Error(\"Bad FCHECK in flate stream: \" + cmf + \", \" + flg);\n }\n if (flg & 0x20) {\n throw new Error(\"FDICT bit set in flate stream: \" + cmf + \", \" + flg);\n }\n _this.codeSize = 0;\n _this.codeBuf = 0;\n return _this;\n }\n FlateStream.prototype.readBlock = function () {\n var buffer;\n var len;\n var str = this.stream;\n // read block header\n var hdr = this.getBits(3);\n if (hdr & 1) {\n this.eof = true;\n }\n hdr >>= 1;\n if (hdr === 0) {\n // uncompressed block\n var b = void 0;\n if ((b = str.getByte()) === -1) {\n throw new Error('Bad block header in flate stream');\n }\n var blockLen = b;\n if ((b = str.getByte()) === -1) {\n throw new Error('Bad block header in flate stream');\n }\n blockLen |= b << 8;\n if ((b = str.getByte()) === -1) {\n throw new Error('Bad block header in flate stream');\n }\n var check = b;\n if ((b = str.getByte()) === -1) {\n throw new Error('Bad block header in flate stream');\n }\n check |= b << 8;\n if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {\n // Ignoring error for bad \"empty\" block (see issue 1277)\n throw new Error('Bad uncompressed block length in flate stream');\n }\n this.codeBuf = 0;\n this.codeSize = 0;\n var bufferLength = this.bufferLength;\n buffer = this.ensureBuffer(bufferLength + blockLen);\n var end = bufferLength + blockLen;\n this.bufferLength = end;\n if (blockLen === 0) {\n if (str.peekByte() === -1) {\n this.eof = true;\n }\n }\n else {\n for (var n = bufferLength; n < end; ++n) {\n if ((b = str.getByte()) === -1) {\n this.eof = true;\n break;\n }\n buffer[n] = b;\n }\n }\n return;\n }\n var litCodeTable;\n var distCodeTable;\n if (hdr === 1) {\n // compressed block, fixed codes\n litCodeTable = fixedLitCodeTab;\n distCodeTable = fixedDistCodeTab;\n }\n else if (hdr === 2) {\n // compressed block, dynamic codes\n var numLitCodes = this.getBits(5) + 257;\n var numDistCodes = this.getBits(5) + 1;\n var numCodeLenCodes = this.getBits(4) + 4;\n // build the code lengths code table\n var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);\n var i = void 0;\n for (i = 0; i < numCodeLenCodes; ++i) {\n codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);\n }\n var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);\n // build the literal and distance code tables\n len = 0;\n i = 0;\n var codes = numLitCodes + numDistCodes;\n var codeLengths = new Uint8Array(codes);\n var bitsLength = void 0;\n var bitsOffset = void 0;\n var what = void 0;\n while (i < codes) {\n var code = this.getCode(codeLenCodeTab);\n if (code === 16) {\n bitsLength = 2;\n bitsOffset = 3;\n what = len;\n }\n else if (code === 17) {\n bitsLength = 3;\n bitsOffset = 3;\n what = len = 0;\n }\n else if (code === 18) {\n bitsLength = 7;\n bitsOffset = 11;\n what = len = 0;\n }\n else {\n codeLengths[i++] = len = code;\n continue;\n }\n var repeatLength = this.getBits(bitsLength) + bitsOffset;\n while (repeatLength-- > 0) {\n codeLengths[i++] = what;\n }\n }\n litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));\n distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));\n }\n else {\n throw new Error('Unknown block type in flate stream');\n }\n buffer = this.buffer;\n var limit = buffer ? buffer.length : 0;\n var pos = this.bufferLength;\n while (true) {\n var code1 = this.getCode(litCodeTable);\n if (code1 < 256) {\n if (pos + 1 >= limit) {\n buffer = this.ensureBuffer(pos + 1);\n limit = buffer.length;\n }\n buffer[pos++] = code1;\n continue;\n }\n if (code1 === 256) {\n this.bufferLength = pos;\n return;\n }\n code1 -= 257;\n code1 = lengthDecode[code1];\n var code2 = code1 >> 16;\n if (code2 > 0) {\n code2 = this.getBits(code2);\n }\n len = (code1 & 0xffff) + code2;\n code1 = this.getCode(distCodeTable);\n code1 = distDecode[code1];\n code2 = code1 >> 16;\n if (code2 > 0) {\n code2 = this.getBits(code2);\n }\n var dist = (code1 & 0xffff) + code2;\n if (pos + len >= limit) {\n buffer = this.ensureBuffer(pos + len);\n limit = buffer.length;\n }\n for (var k = 0; k < len; ++k, ++pos) {\n buffer[pos] = buffer[pos - dist];\n }\n }\n };\n FlateStream.prototype.getBits = function (bits) {\n var str = this.stream;\n var codeSize = this.codeSize;\n var codeBuf = this.codeBuf;\n var b;\n while (codeSize < bits) {\n if ((b = str.getByte()) === -1) {\n throw new Error('Bad encoding in flate stream');\n }\n codeBuf |= b << codeSize;\n codeSize += 8;\n }\n b = codeBuf & ((1 << bits) - 1);\n this.codeBuf = codeBuf >> bits;\n this.codeSize = codeSize -= bits;\n return b;\n };\n FlateStream.prototype.getCode = function (table) {\n var str = this.stream;\n var codes = table[0];\n var maxLen = table[1];\n var codeSize = this.codeSize;\n var codeBuf = this.codeBuf;\n var b;\n while (codeSize < maxLen) {\n if ((b = str.getByte()) === -1) {\n // premature end of stream. code might however still be valid.\n // codeSize < codeLen check below guards against incomplete codeVal.\n break;\n }\n codeBuf |= b << codeSize;\n codeSize += 8;\n }\n var code = codes[codeBuf & ((1 << maxLen) - 1)];\n if (typeof codes === 'number') {\n console.log('FLATE:', code);\n }\n var codeLen = code >> 16;\n var codeVal = code & 0xffff;\n if (codeLen < 1 || codeSize < codeLen) {\n throw new Error('Bad encoding in flate stream');\n }\n this.codeBuf = codeBuf >> codeLen;\n this.codeSize = codeSize - codeLen;\n return codeVal;\n };\n FlateStream.prototype.generateHuffmanTable = function (lengths) {\n var n = lengths.length;\n // find max code length\n var maxLen = 0;\n var i;\n for (i = 0; i < n; ++i) {\n if (lengths[i] > maxLen) {\n maxLen = lengths[i];\n }\n }\n // build the table\n var size = 1 << maxLen;\n var codes = new Int32Array(size);\n for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {\n for (var val = 0; val < n; ++val) {\n if (lengths[val] === len) {\n // bit-reverse the code\n var code2 = 0;\n var t = code;\n for (i = 0; i < len; ++i) {\n code2 = (code2 << 1) | (t & 1);\n t >>= 1;\n }\n // fill the table entries\n for (i = code2; i < size; i += skip) {\n codes[i] = (len << 16) | val;\n }\n ++code;\n }\n }\n }\n return [codes, maxLen];\n };\n return FlateStream;\n}(DecodeStream));\nexport default FlateStream;\n//# sourceMappingURL=FlateStream.js.map","/*\n * Copyright 2012 Mozilla Foundation\n *\n * The LZWStream class contained in this file is a TypeScript port of the\n * JavaScript LZWStream class in Mozilla's pdf.js project, made available\n * under the Apache 2.0 open source license.\n */\nimport { __extends } from \"tslib\";\nimport DecodeStream from \"./DecodeStream\";\nvar LZWStream = /** @class */ (function (_super) {\n __extends(LZWStream, _super);\n function LZWStream(stream, maybeLength, earlyChange) {\n var _this = _super.call(this, maybeLength) || this;\n _this.stream = stream;\n _this.cachedData = 0;\n _this.bitsCached = 0;\n var maxLzwDictionarySize = 4096;\n var lzwState = {\n earlyChange: earlyChange,\n codeLength: 9,\n nextCode: 258,\n dictionaryValues: new Uint8Array(maxLzwDictionarySize),\n dictionaryLengths: new Uint16Array(maxLzwDictionarySize),\n dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),\n currentSequence: new Uint8Array(maxLzwDictionarySize),\n currentSequenceLength: 0,\n };\n for (var i = 0; i < 256; ++i) {\n lzwState.dictionaryValues[i] = i;\n lzwState.dictionaryLengths[i] = 1;\n }\n _this.lzwState = lzwState;\n return _this;\n }\n LZWStream.prototype.readBlock = function () {\n var blockSize = 512;\n var estimatedDecodedSize = blockSize * 2;\n var decodedSizeDelta = blockSize;\n var i;\n var j;\n var q;\n var lzwState = this.lzwState;\n if (!lzwState) {\n return; // eof was found\n }\n var earlyChange = lzwState.earlyChange;\n var nextCode = lzwState.nextCode;\n var dictionaryValues = lzwState.dictionaryValues;\n var dictionaryLengths = lzwState.dictionaryLengths;\n var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;\n var codeLength = lzwState.codeLength;\n var prevCode = lzwState.prevCode;\n var currentSequence = lzwState.currentSequence;\n var currentSequenceLength = lzwState.currentSequenceLength;\n var decodedLength = 0;\n var currentBufferLength = this.bufferLength;\n var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);\n for (i = 0; i < blockSize; i++) {\n var code = this.readBits(codeLength);\n var hasPrev = currentSequenceLength > 0;\n if (!code || code < 256) {\n currentSequence[0] = code;\n currentSequenceLength = 1;\n }\n else if (code >= 258) {\n if (code < nextCode) {\n currentSequenceLength = dictionaryLengths[code];\n for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {\n currentSequence[j] = dictionaryValues[q];\n q = dictionaryPrevCodes[q];\n }\n }\n else {\n currentSequence[currentSequenceLength++] = currentSequence[0];\n }\n }\n else if (code === 256) {\n codeLength = 9;\n nextCode = 258;\n currentSequenceLength = 0;\n continue;\n }\n else {\n this.eof = true;\n delete this.lzwState;\n break;\n }\n if (hasPrev) {\n dictionaryPrevCodes[nextCode] = prevCode;\n dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;\n dictionaryValues[nextCode] = currentSequence[0];\n nextCode++;\n codeLength =\n (nextCode + earlyChange) & (nextCode + earlyChange - 1)\n ? codeLength\n : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;\n }\n prevCode = code;\n decodedLength += currentSequenceLength;\n if (estimatedDecodedSize < decodedLength) {\n do {\n estimatedDecodedSize += decodedSizeDelta;\n } while (estimatedDecodedSize < decodedLength);\n buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);\n }\n for (j = 0; j < currentSequenceLength; j++) {\n buffer[currentBufferLength++] = currentSequence[j];\n }\n }\n lzwState.nextCode = nextCode;\n lzwState.codeLength = codeLength;\n lzwState.prevCode = prevCode;\n lzwState.currentSequenceLength = currentSequenceLength;\n this.bufferLength = currentBufferLength;\n };\n LZWStream.prototype.readBits = function (n) {\n var bitsCached = this.bitsCached;\n var cachedData = this.cachedData;\n while (bitsCached < n) {\n var c = this.stream.getByte();\n if (c === -1) {\n this.eof = true;\n return null;\n }\n cachedData = (cachedData << 8) | c;\n bitsCached += 8;\n }\n this.bitsCached = bitsCached -= n;\n this.cachedData = cachedData;\n return (cachedData >>> bitsCached) & ((1 << n) - 1);\n };\n return LZWStream;\n}(DecodeStream));\nexport default LZWStream;\n//# sourceMappingURL=LZWStream.js.map","/*\n * Copyright 2012 Mozilla Foundation\n *\n * The RunLengthStream class contained in this file is a TypeScript port of the\n * JavaScript RunLengthStream class in Mozilla's pdf.js project, made available\n * under the Apache 2.0 open source license.\n */\nimport { __extends } from \"tslib\";\nimport DecodeStream from \"./DecodeStream\";\nvar RunLengthStream = /** @class */ (function (_super) {\n __extends(RunLengthStream, _super);\n function RunLengthStream(stream, maybeLength) {\n var _this = _super.call(this, maybeLength) || this;\n _this.stream = stream;\n return _this;\n }\n RunLengthStream.prototype.readBlock = function () {\n // The repeatHeader has following format. The first byte defines type of run\n // and amount of bytes to repeat/copy: n = 0 through 127 - copy next n bytes\n // (in addition to the second byte from the header), n = 129 through 255 -\n // duplicate the second byte from the header (257 - n) times, n = 128 - end.\n var repeatHeader = this.stream.getBytes(2);\n if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {\n this.eof = true;\n return;\n }\n var buffer;\n var bufferLength = this.bufferLength;\n var n = repeatHeader[0];\n if (n < 128) {\n // copy n bytes\n buffer = this.ensureBuffer(bufferLength + n + 1);\n buffer[bufferLength++] = repeatHeader[1];\n if (n > 0) {\n var source = this.stream.getBytes(n);\n buffer.set(source, bufferLength);\n bufferLength += n;\n }\n }\n else {\n n = 257 - n;\n var b = repeatHeader[1];\n buffer = this.ensureBuffer(bufferLength + n + 1);\n for (var i = 0; i < n; i++) {\n buffer[bufferLength++] = b;\n }\n }\n this.bufferLength = bufferLength;\n };\n return RunLengthStream;\n}(DecodeStream));\nexport default RunLengthStream;\n//# sourceMappingURL=RunLengthStream.js.map","import { UnexpectedObjectTypeError, UnsupportedEncodingError, } from \"../errors\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFDict from \"../objects/PDFDict\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport Ascii85Stream from \"./Ascii85Stream\";\nimport AsciiHexStream from \"./AsciiHexStream\";\nimport FlateStream from \"./FlateStream\";\nimport LZWStream from \"./LZWStream\";\nimport RunLengthStream from \"./RunLengthStream\";\nimport Stream from \"./Stream\";\nvar decodeStream = function (stream, encoding, params) {\n if (encoding === PDFName.of('FlateDecode')) {\n return new FlateStream(stream);\n }\n if (encoding === PDFName.of('LZWDecode')) {\n var earlyChange = 1;\n if (params instanceof PDFDict) {\n var EarlyChange = params.lookup(PDFName.of('EarlyChange'));\n if (EarlyChange instanceof PDFNumber) {\n earlyChange = EarlyChange.asNumber();\n }\n }\n return new LZWStream(stream, undefined, earlyChange);\n }\n if (encoding === PDFName.of('ASCII85Decode')) {\n return new Ascii85Stream(stream);\n }\n if (encoding === PDFName.of('ASCIIHexDecode')) {\n return new AsciiHexStream(stream);\n }\n if (encoding === PDFName.of('RunLengthDecode')) {\n return new RunLengthStream(stream);\n }\n throw new UnsupportedEncodingError(encoding.asString());\n};\nexport var decodePDFRawStream = function (_a) {\n var dict = _a.dict, contents = _a.contents;\n var stream = new Stream(contents);\n var Filter = dict.lookup(PDFName.of('Filter'));\n var DecodeParms = dict.lookup(PDFName.of('DecodeParms'));\n if (Filter instanceof PDFName) {\n stream = decodeStream(stream, Filter, DecodeParms);\n }\n else if (Filter instanceof PDFArray) {\n for (var idx = 0, len = Filter.size(); idx < len; idx++) {\n stream = decodeStream(stream, Filter.lookup(idx, PDFName), DecodeParms && DecodeParms.lookupMaybe(idx, PDFDict));\n }\n }\n else if (!!Filter) {\n throw new UnexpectedObjectTypeError([PDFName, PDFArray], Filter);\n }\n return stream;\n};\n//# sourceMappingURL=decode.js.map","import { __awaiter, __generator } from \"tslib\";\nimport { MissingPageContentsEmbeddingError, UnrecognizedStreamTypeError, } from \"../errors\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFRawStream from \"../objects/PDFRawStream\";\nimport PDFStream from \"../objects/PDFStream\";\nimport { decodePDFRawStream } from \"../streams/decode\";\nimport PDFContentStream from \"../structures/PDFContentStream\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { mergeIntoTypedArray } from \"../../utils\";\nvar fullPageBoundingBox = function (page) {\n var mediaBox = page.MediaBox();\n var width = mediaBox.lookup(2, PDFNumber).asNumber() -\n mediaBox.lookup(0, PDFNumber).asNumber();\n var height = mediaBox.lookup(3, PDFNumber).asNumber() -\n mediaBox.lookup(1, PDFNumber).asNumber();\n return { left: 0, bottom: 0, right: width, top: height };\n};\n// Returns the identity matrix, modified to position the content of the given\n// bounding box at (0, 0).\nvar boundingBoxAdjustedMatrix = function (bb) { return [1, 0, 0, 1, -bb.left, -bb.bottom]; };\nvar PDFPageEmbedder = /** @class */ (function () {\n function PDFPageEmbedder(page, boundingBox, transformationMatrix) {\n this.page = page;\n var bb = boundingBox !== null && boundingBox !== void 0 ? boundingBox : fullPageBoundingBox(page);\n this.width = bb.right - bb.left;\n this.height = bb.top - bb.bottom;\n this.boundingBox = bb;\n this.transformationMatrix = transformationMatrix !== null && transformationMatrix !== void 0 ? transformationMatrix : boundingBoxAdjustedMatrix(bb);\n }\n PDFPageEmbedder.for = function (page, boundingBox, transformationMatrix) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, new PDFPageEmbedder(page, boundingBox, transformationMatrix)];\n });\n });\n };\n PDFPageEmbedder.prototype.embedIntoContext = function (context, ref) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, Contents, Resources, decodedContents, _b, left, bottom, right, top, xObject;\n return __generator(this, function (_c) {\n _a = this.page.normalizedEntries(), Contents = _a.Contents, Resources = _a.Resources;\n if (!Contents)\n throw new MissingPageContentsEmbeddingError();\n decodedContents = this.decodeContents(Contents);\n _b = this.boundingBox, left = _b.left, bottom = _b.bottom, right = _b.right, top = _b.top;\n xObject = context.flateStream(decodedContents, {\n Type: 'XObject',\n Subtype: 'Form',\n FormType: 1,\n BBox: [left, bottom, right, top],\n Matrix: this.transformationMatrix,\n Resources: Resources,\n });\n if (ref) {\n context.assign(ref, xObject);\n return [2 /*return*/, ref];\n }\n else {\n return [2 /*return*/, context.register(xObject)];\n }\n return [2 /*return*/];\n });\n });\n };\n // `contents` is an array of streams which are merged to include them in the XObject.\n // This methods extracts each stream and joins them with a newline character.\n PDFPageEmbedder.prototype.decodeContents = function (contents) {\n var newline = Uint8Array.of(CharCodes.Newline);\n var decodedContents = [];\n for (var idx = 0, len = contents.size(); idx < len; idx++) {\n var stream = contents.lookup(idx, PDFStream);\n var content = void 0;\n if (stream instanceof PDFRawStream) {\n content = decodePDFRawStream(stream).decode();\n }\n else if (stream instanceof PDFContentStream) {\n content = stream.getUnencodedContents();\n }\n else {\n throw new UnrecognizedStreamTypeError(stream);\n }\n decodedContents.push(content, newline);\n }\n return mergeIntoTypedArray.apply(void 0, decodedContents);\n };\n return PDFPageEmbedder;\n}());\nexport default PDFPageEmbedder;\n//# sourceMappingURL=PDFPageEmbedder.js.map","import PDFDict from \"../objects/PDFDict\";\nimport PDFString from \"../objects/PDFString\";\nimport PDFHexString from \"../objects/PDFHexString\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFRef from \"../objects/PDFRef\";\nimport { findLastMatch } from \"../../utils\";\nimport { MissingDAEntryError, MissingTfOperatorError } from \"../errors\";\n// Examples:\n// `/Helv 12 Tf` -> ['Helv', '12']\n// `/HeBo 8.00 Tf` -> ['HeBo', '8.00']\n// `/HeBo Tf` -> ['HeBo', undefined]\nvar tfRegex = /\\/([^\\0\\t\\n\\f\\r\\ ]+)[\\0\\t\\n\\f\\r\\ ]*(\\d*\\.\\d+|\\d+)?[\\0\\t\\n\\f\\r\\ ]+Tf/;\nvar PDFAcroField = /** @class */ (function () {\n function PDFAcroField(dict, ref) {\n this.dict = dict;\n this.ref = ref;\n }\n PDFAcroField.prototype.T = function () {\n return this.dict.lookupMaybe(PDFName.of('T'), PDFString, PDFHexString);\n };\n PDFAcroField.prototype.Ff = function () {\n var numberOrRef = this.getInheritableAttribute(PDFName.of('Ff'));\n return this.dict.context.lookupMaybe(numberOrRef, PDFNumber);\n };\n PDFAcroField.prototype.V = function () {\n var valueOrRef = this.getInheritableAttribute(PDFName.of('V'));\n return this.dict.context.lookup(valueOrRef);\n };\n PDFAcroField.prototype.Kids = function () {\n return this.dict.lookupMaybe(PDFName.of('Kids'), PDFArray);\n };\n // Parent(): PDFDict | undefined {\n // return this.dict.lookupMaybe(PDFName.of('Parent'), PDFDict);\n // }\n PDFAcroField.prototype.DA = function () {\n var da = this.dict.lookup(PDFName.of('DA'));\n if (da instanceof PDFString || da instanceof PDFHexString)\n return da;\n return undefined;\n };\n PDFAcroField.prototype.setKids = function (kids) {\n this.dict.set(PDFName.of('Kids'), this.dict.context.obj(kids));\n };\n PDFAcroField.prototype.getParent = function () {\n // const parent = this.Parent();\n // if (!parent) return undefined;\n // return new PDFAcroField(parent);\n var parentRef = this.dict.get(PDFName.of('Parent'));\n if (parentRef instanceof PDFRef) {\n var parent_1 = this.dict.lookup(PDFName.of('Parent'), PDFDict);\n return new PDFAcroField(parent_1, parentRef);\n }\n return undefined;\n };\n PDFAcroField.prototype.setParent = function (parent) {\n if (!parent)\n this.dict.delete(PDFName.of('Parent'));\n else\n this.dict.set(PDFName.of('Parent'), parent);\n };\n PDFAcroField.prototype.getFullyQualifiedName = function () {\n var parent = this.getParent();\n if (!parent)\n return this.getPartialName();\n return parent.getFullyQualifiedName() + \".\" + this.getPartialName();\n };\n PDFAcroField.prototype.getPartialName = function () {\n var _a;\n return (_a = this.T()) === null || _a === void 0 ? void 0 : _a.decodeText();\n };\n PDFAcroField.prototype.setPartialName = function (partialName) {\n if (!partialName)\n this.dict.delete(PDFName.of('T'));\n else\n this.dict.set(PDFName.of('T'), PDFHexString.fromText(partialName));\n };\n PDFAcroField.prototype.setDefaultAppearance = function (appearance) {\n this.dict.set(PDFName.of('DA'), PDFString.of(appearance));\n };\n PDFAcroField.prototype.getDefaultAppearance = function () {\n var DA = this.DA();\n if (DA instanceof PDFHexString) {\n return DA.decodeText();\n }\n return DA === null || DA === void 0 ? void 0 : DA.asString();\n };\n PDFAcroField.prototype.setFontSize = function (fontSize) {\n var _a;\n var name = (_a = this.getFullyQualifiedName()) !== null && _a !== void 0 ? _a : '';\n var da = this.getDefaultAppearance();\n if (!da)\n throw new MissingDAEntryError(name);\n var daMatch = findLastMatch(da, tfRegex);\n if (!daMatch.match)\n throw new MissingTfOperatorError(name);\n var daStart = da.slice(0, daMatch.pos - daMatch.match[0].length);\n var daEnd = daMatch.pos <= da.length ? da.slice(daMatch.pos) : '';\n var fontName = daMatch.match[1];\n var modifiedDa = daStart + \" /\" + fontName + \" \" + fontSize + \" Tf \" + daEnd;\n this.setDefaultAppearance(modifiedDa);\n };\n PDFAcroField.prototype.getFlags = function () {\n var _a, _b;\n return (_b = (_a = this.Ff()) === null || _a === void 0 ? void 0 : _a.asNumber()) !== null && _b !== void 0 ? _b : 0;\n };\n PDFAcroField.prototype.setFlags = function (flags) {\n this.dict.set(PDFName.of('Ff'), PDFNumber.of(flags));\n };\n PDFAcroField.prototype.hasFlag = function (flag) {\n var flags = this.getFlags();\n return (flags & flag) !== 0;\n };\n PDFAcroField.prototype.setFlag = function (flag) {\n var flags = this.getFlags();\n this.setFlags(flags | flag);\n };\n PDFAcroField.prototype.clearFlag = function (flag) {\n var flags = this.getFlags();\n this.setFlags(flags & ~flag);\n };\n PDFAcroField.prototype.setFlagTo = function (flag, enable) {\n if (enable)\n this.setFlag(flag);\n else\n this.clearFlag(flag);\n };\n PDFAcroField.prototype.getInheritableAttribute = function (name) {\n var attribute;\n this.ascend(function (node) {\n if (!attribute)\n attribute = node.dict.get(name);\n });\n return attribute;\n };\n PDFAcroField.prototype.ascend = function (visitor) {\n visitor(this);\n var parent = this.getParent();\n if (parent)\n parent.ascend(visitor);\n };\n return PDFAcroField;\n}());\nexport default PDFAcroField;\n//# sourceMappingURL=PDFAcroField.js.map","import PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\n// TODO: Also handle the `/S` and `/D` entries\nvar BorderStyle = /** @class */ (function () {\n function BorderStyle(dict) {\n this.dict = dict;\n }\n BorderStyle.prototype.W = function () {\n var W = this.dict.lookup(PDFName.of('W'));\n if (W instanceof PDFNumber)\n return W;\n return undefined;\n };\n BorderStyle.prototype.getWidth = function () {\n var _a, _b;\n return (_b = (_a = this.W()) === null || _a === void 0 ? void 0 : _a.asNumber()) !== null && _b !== void 0 ? _b : 1;\n };\n BorderStyle.prototype.setWidth = function (width) {\n var W = this.dict.context.obj(width);\n this.dict.set(PDFName.of('W'), W);\n };\n BorderStyle.fromDict = function (dict) { return new BorderStyle(dict); };\n return BorderStyle;\n}());\nexport default BorderStyle;\n//# sourceMappingURL=BorderStyle.js.map","import PDFDict from \"../objects/PDFDict\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFStream from \"../objects/PDFStream\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFRef from \"../objects/PDFRef\";\nimport PDFNumber from \"../objects/PDFNumber\";\nvar PDFAnnotation = /** @class */ (function () {\n function PDFAnnotation(dict) {\n this.dict = dict;\n }\n // This is technically required by the PDF spec\n PDFAnnotation.prototype.Rect = function () {\n return this.dict.lookup(PDFName.of('Rect'), PDFArray);\n };\n PDFAnnotation.prototype.AP = function () {\n return this.dict.lookupMaybe(PDFName.of('AP'), PDFDict);\n };\n PDFAnnotation.prototype.F = function () {\n var numberOrRef = this.dict.lookup(PDFName.of('F'));\n return this.dict.context.lookupMaybe(numberOrRef, PDFNumber);\n };\n PDFAnnotation.prototype.getRectangle = function () {\n var _a;\n var Rect = this.Rect();\n return (_a = Rect === null || Rect === void 0 ? void 0 : Rect.asRectangle()) !== null && _a !== void 0 ? _a : { x: 0, y: 0, width: 0, height: 0 };\n };\n PDFAnnotation.prototype.setRectangle = function (rect) {\n var x = rect.x, y = rect.y, width = rect.width, height = rect.height;\n var Rect = this.dict.context.obj([x, y, x + width, y + height]);\n this.dict.set(PDFName.of('Rect'), Rect);\n };\n PDFAnnotation.prototype.getAppearanceState = function () {\n var AS = this.dict.lookup(PDFName.of('AS'));\n if (AS instanceof PDFName)\n return AS;\n return undefined;\n };\n PDFAnnotation.prototype.setAppearanceState = function (state) {\n this.dict.set(PDFName.of('AS'), state);\n };\n PDFAnnotation.prototype.setAppearances = function (appearances) {\n this.dict.set(PDFName.of('AP'), appearances);\n };\n PDFAnnotation.prototype.ensureAP = function () {\n var AP = this.AP();\n if (!AP) {\n AP = this.dict.context.obj({});\n this.dict.set(PDFName.of('AP'), AP);\n }\n return AP;\n };\n PDFAnnotation.prototype.getNormalAppearance = function () {\n var AP = this.ensureAP();\n var N = AP.get(PDFName.of('N'));\n if (N instanceof PDFRef || N instanceof PDFDict)\n return N;\n throw new Error(\"Unexpected N type: \" + (N === null || N === void 0 ? void 0 : N.constructor.name));\n };\n /** @param appearance A PDFDict or PDFStream (direct or ref) */\n PDFAnnotation.prototype.setNormalAppearance = function (appearance) {\n var AP = this.ensureAP();\n AP.set(PDFName.of('N'), appearance);\n };\n /** @param appearance A PDFDict or PDFStream (direct or ref) */\n PDFAnnotation.prototype.setRolloverAppearance = function (appearance) {\n var AP = this.ensureAP();\n AP.set(PDFName.of('R'), appearance);\n };\n /** @param appearance A PDFDict or PDFStream (direct or ref) */\n PDFAnnotation.prototype.setDownAppearance = function (appearance) {\n var AP = this.ensureAP();\n AP.set(PDFName.of('D'), appearance);\n };\n PDFAnnotation.prototype.removeRolloverAppearance = function () {\n var AP = this.AP();\n AP === null || AP === void 0 ? void 0 : AP.delete(PDFName.of('R'));\n };\n PDFAnnotation.prototype.removeDownAppearance = function () {\n var AP = this.AP();\n AP === null || AP === void 0 ? void 0 : AP.delete(PDFName.of('D'));\n };\n PDFAnnotation.prototype.getAppearances = function () {\n var AP = this.AP();\n if (!AP)\n return undefined;\n var N = AP.lookup(PDFName.of('N'), PDFDict, PDFStream);\n var R = AP.lookupMaybe(PDFName.of('R'), PDFDict, PDFStream);\n var D = AP.lookupMaybe(PDFName.of('D'), PDFDict, PDFStream);\n return { normal: N, rollover: R, down: D };\n };\n PDFAnnotation.prototype.getFlags = function () {\n var _a, _b;\n return (_b = (_a = this.F()) === null || _a === void 0 ? void 0 : _a.asNumber()) !== null && _b !== void 0 ? _b : 0;\n };\n PDFAnnotation.prototype.setFlags = function (flags) {\n this.dict.set(PDFName.of('F'), PDFNumber.of(flags));\n };\n PDFAnnotation.prototype.hasFlag = function (flag) {\n var flags = this.getFlags();\n return (flags & flag) !== 0;\n };\n PDFAnnotation.prototype.setFlag = function (flag) {\n var flags = this.getFlags();\n this.setFlags(flags | flag);\n };\n PDFAnnotation.prototype.clearFlag = function (flag) {\n var flags = this.getFlags();\n this.setFlags(flags & ~flag);\n };\n PDFAnnotation.prototype.setFlagTo = function (flag, enable) {\n if (enable)\n this.setFlag(flag);\n else\n this.clearFlag(flag);\n };\n PDFAnnotation.fromDict = function (dict) { return new PDFAnnotation(dict); };\n return PDFAnnotation;\n}());\nexport default PDFAnnotation;\n//# sourceMappingURL=PDFAnnotation.js.map","import PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFHexString from \"../objects/PDFHexString\";\nimport PDFString from \"../objects/PDFString\";\nvar AppearanceCharacteristics = /** @class */ (function () {\n function AppearanceCharacteristics(dict) {\n this.dict = dict;\n }\n AppearanceCharacteristics.prototype.R = function () {\n var R = this.dict.lookup(PDFName.of('R'));\n if (R instanceof PDFNumber)\n return R;\n return undefined;\n };\n AppearanceCharacteristics.prototype.BC = function () {\n var BC = this.dict.lookup(PDFName.of('BC'));\n if (BC instanceof PDFArray)\n return BC;\n return undefined;\n };\n AppearanceCharacteristics.prototype.BG = function () {\n var BG = this.dict.lookup(PDFName.of('BG'));\n if (BG instanceof PDFArray)\n return BG;\n return undefined;\n };\n AppearanceCharacteristics.prototype.CA = function () {\n var CA = this.dict.lookup(PDFName.of('CA'));\n if (CA instanceof PDFHexString || CA instanceof PDFString)\n return CA;\n return undefined;\n };\n AppearanceCharacteristics.prototype.RC = function () {\n var RC = this.dict.lookup(PDFName.of('RC'));\n if (RC instanceof PDFHexString || RC instanceof PDFString)\n return RC;\n return undefined;\n };\n AppearanceCharacteristics.prototype.AC = function () {\n var AC = this.dict.lookup(PDFName.of('AC'));\n if (AC instanceof PDFHexString || AC instanceof PDFString)\n return AC;\n return undefined;\n };\n AppearanceCharacteristics.prototype.getRotation = function () {\n var _a;\n return (_a = this.R()) === null || _a === void 0 ? void 0 : _a.asNumber();\n };\n AppearanceCharacteristics.prototype.getBorderColor = function () {\n var BC = this.BC();\n if (!BC)\n return undefined;\n var components = [];\n for (var idx = 0, len = BC === null || BC === void 0 ? void 0 : BC.size(); idx < len; idx++) {\n var component = BC.get(idx);\n if (component instanceof PDFNumber)\n components.push(component.asNumber());\n }\n return components;\n };\n AppearanceCharacteristics.prototype.getBackgroundColor = function () {\n var BG = this.BG();\n if (!BG)\n return undefined;\n var components = [];\n for (var idx = 0, len = BG === null || BG === void 0 ? void 0 : BG.size(); idx < len; idx++) {\n var component = BG.get(idx);\n if (component instanceof PDFNumber)\n components.push(component.asNumber());\n }\n return components;\n };\n AppearanceCharacteristics.prototype.getCaptions = function () {\n var CA = this.CA();\n var RC = this.RC();\n var AC = this.AC();\n return {\n normal: CA === null || CA === void 0 ? void 0 : CA.decodeText(),\n rollover: RC === null || RC === void 0 ? void 0 : RC.decodeText(),\n down: AC === null || AC === void 0 ? void 0 : AC.decodeText(),\n };\n };\n AppearanceCharacteristics.prototype.setRotation = function (rotation) {\n var R = this.dict.context.obj(rotation);\n this.dict.set(PDFName.of('R'), R);\n };\n AppearanceCharacteristics.prototype.setBorderColor = function (color) {\n var BC = this.dict.context.obj(color);\n this.dict.set(PDFName.of('BC'), BC);\n };\n AppearanceCharacteristics.prototype.setBackgroundColor = function (color) {\n var BG = this.dict.context.obj(color);\n this.dict.set(PDFName.of('BG'), BG);\n };\n AppearanceCharacteristics.prototype.setCaptions = function (captions) {\n var CA = PDFHexString.fromText(captions.normal);\n this.dict.set(PDFName.of('CA'), CA);\n if (captions.rollover) {\n var RC = PDFHexString.fromText(captions.rollover);\n this.dict.set(PDFName.of('RC'), RC);\n }\n else {\n this.dict.delete(PDFName.of('RC'));\n }\n if (captions.down) {\n var AC = PDFHexString.fromText(captions.down);\n this.dict.set(PDFName.of('AC'), AC);\n }\n else {\n this.dict.delete(PDFName.of('AC'));\n }\n };\n AppearanceCharacteristics.fromDict = function (dict) {\n return new AppearanceCharacteristics(dict);\n };\n return AppearanceCharacteristics;\n}());\nexport default AppearanceCharacteristics;\n//# sourceMappingURL=AppearanceCharacteristics.js.map","import { __extends } from \"tslib\";\nimport PDFDict from \"../objects/PDFDict\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFRef from \"../objects/PDFRef\";\nimport PDFString from \"../objects/PDFString\";\nimport PDFHexString from \"../objects/PDFHexString\";\nimport BorderStyle from \"./BorderStyle\";\nimport PDFAnnotation from \"./PDFAnnotation\";\nimport AppearanceCharacteristics from \"./AppearanceCharacteristics\";\nvar PDFWidgetAnnotation = /** @class */ (function (_super) {\n __extends(PDFWidgetAnnotation, _super);\n function PDFWidgetAnnotation() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFWidgetAnnotation.prototype.MK = function () {\n var MK = this.dict.lookup(PDFName.of('MK'));\n if (MK instanceof PDFDict)\n return MK;\n return undefined;\n };\n PDFWidgetAnnotation.prototype.BS = function () {\n var BS = this.dict.lookup(PDFName.of('BS'));\n if (BS instanceof PDFDict)\n return BS;\n return undefined;\n };\n PDFWidgetAnnotation.prototype.DA = function () {\n var da = this.dict.lookup(PDFName.of('DA'));\n if (da instanceof PDFString || da instanceof PDFHexString)\n return da;\n return undefined;\n };\n PDFWidgetAnnotation.prototype.P = function () {\n var P = this.dict.get(PDFName.of('P'));\n if (P instanceof PDFRef)\n return P;\n return undefined;\n };\n PDFWidgetAnnotation.prototype.setP = function (page) {\n this.dict.set(PDFName.of('P'), page);\n };\n PDFWidgetAnnotation.prototype.setDefaultAppearance = function (appearance) {\n this.dict.set(PDFName.of('DA'), PDFString.of(appearance));\n };\n PDFWidgetAnnotation.prototype.getDefaultAppearance = function () {\n var DA = this.DA();\n if (DA instanceof PDFHexString) {\n return DA.decodeText();\n }\n return DA === null || DA === void 0 ? void 0 : DA.asString();\n };\n PDFWidgetAnnotation.prototype.getAppearanceCharacteristics = function () {\n var MK = this.MK();\n if (MK)\n return AppearanceCharacteristics.fromDict(MK);\n return undefined;\n };\n PDFWidgetAnnotation.prototype.getOrCreateAppearanceCharacteristics = function () {\n var MK = this.MK();\n if (MK)\n return AppearanceCharacteristics.fromDict(MK);\n var ac = AppearanceCharacteristics.fromDict(this.dict.context.obj({}));\n this.dict.set(PDFName.of('MK'), ac.dict);\n return ac;\n };\n PDFWidgetAnnotation.prototype.getBorderStyle = function () {\n var BS = this.BS();\n if (BS)\n return BorderStyle.fromDict(BS);\n return undefined;\n };\n PDFWidgetAnnotation.prototype.getOrCreateBorderStyle = function () {\n var BS = this.BS();\n if (BS)\n return BorderStyle.fromDict(BS);\n var bs = BorderStyle.fromDict(this.dict.context.obj({}));\n this.dict.set(PDFName.of('BS'), bs.dict);\n return bs;\n };\n PDFWidgetAnnotation.prototype.getOnValue = function () {\n var _a;\n var normal = (_a = this.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal;\n if (normal instanceof PDFDict) {\n var keys = normal.keys();\n for (var idx = 0, len = keys.length; idx < len; idx++) {\n var key = keys[idx];\n if (key !== PDFName.of('Off'))\n return key;\n }\n }\n return undefined;\n };\n PDFWidgetAnnotation.fromDict = function (dict) {\n return new PDFWidgetAnnotation(dict);\n };\n PDFWidgetAnnotation.create = function (context, parent) {\n var dict = context.obj({\n Type: 'Annot',\n Subtype: 'Widget',\n Rect: [0, 0, 0, 0],\n Parent: parent,\n });\n return new PDFWidgetAnnotation(dict);\n };\n return PDFWidgetAnnotation;\n}(PDFAnnotation));\nexport default PDFWidgetAnnotation;\n//# sourceMappingURL=PDFWidgetAnnotation.js.map","import { __extends } from \"tslib\";\nimport PDFDict from \"../objects/PDFDict\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFAcroField from \"./PDFAcroField\";\nimport PDFWidgetAnnotation from \"../annotation/PDFWidgetAnnotation\";\nimport { IndexOutOfBoundsError } from \"../errors\";\nvar PDFAcroTerminal = /** @class */ (function (_super) {\n __extends(PDFAcroTerminal, _super);\n function PDFAcroTerminal() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroTerminal.prototype.FT = function () {\n var nameOrRef = this.getInheritableAttribute(PDFName.of('FT'));\n return this.dict.context.lookup(nameOrRef, PDFName);\n };\n PDFAcroTerminal.prototype.getWidgets = function () {\n var kidDicts = this.Kids();\n // This field is itself a widget\n if (!kidDicts)\n return [PDFWidgetAnnotation.fromDict(this.dict)];\n // This field's kids are its widgets\n var widgets = new Array(kidDicts.size());\n for (var idx = 0, len = kidDicts.size(); idx < len; idx++) {\n var dict = kidDicts.lookup(idx, PDFDict);\n widgets[idx] = PDFWidgetAnnotation.fromDict(dict);\n }\n return widgets;\n };\n PDFAcroTerminal.prototype.addWidget = function (ref) {\n var Kids = this.normalizedEntries().Kids;\n Kids.push(ref);\n };\n PDFAcroTerminal.prototype.removeWidget = function (idx) {\n var kidDicts = this.Kids();\n if (!kidDicts) {\n // This field is itself a widget\n if (idx !== 0)\n throw new IndexOutOfBoundsError(idx, 0, 0);\n this.setKids([]);\n }\n else {\n // This field's kids are its widgets\n if (idx < 0 || idx > kidDicts.size()) {\n throw new IndexOutOfBoundsError(idx, 0, kidDicts.size());\n }\n kidDicts.remove(idx);\n }\n };\n PDFAcroTerminal.prototype.normalizedEntries = function () {\n var Kids = this.Kids();\n // If this field is itself a widget (because it was only rendered once in\n // the document, so the field and widget properties were merged) then we\n // add itself to the `Kids` array. The alternative would be to try\n // splitting apart the widget properties and creating a separate object\n // for them.\n if (!Kids) {\n Kids = this.dict.context.obj([this.ref]);\n this.dict.set(PDFName.of('Kids'), Kids);\n }\n return { Kids: Kids };\n };\n PDFAcroTerminal.fromDict = function (dict, ref) {\n return new PDFAcroTerminal(dict, ref);\n };\n return PDFAcroTerminal;\n}(PDFAcroField));\nexport default PDFAcroTerminal;\n//# sourceMappingURL=PDFAcroTerminal.js.map","import { __extends } from \"tslib\";\nimport PDFString from \"../objects/PDFString\";\nimport PDFHexString from \"../objects/PDFHexString\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFAcroTerminal from \"./PDFAcroTerminal\";\nimport { IndexOutOfBoundsError } from \"../errors\";\nvar PDFAcroButton = /** @class */ (function (_super) {\n __extends(PDFAcroButton, _super);\n function PDFAcroButton() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroButton.prototype.Opt = function () {\n return this.dict.lookupMaybe(PDFName.of('Opt'), PDFString, PDFHexString, PDFArray);\n };\n PDFAcroButton.prototype.setOpt = function (opt) {\n this.dict.set(PDFName.of('Opt'), this.dict.context.obj(opt));\n };\n PDFAcroButton.prototype.getExportValues = function () {\n var opt = this.Opt();\n if (!opt)\n return undefined;\n if (opt instanceof PDFString || opt instanceof PDFHexString) {\n return [opt];\n }\n var values = [];\n for (var idx = 0, len = opt.size(); idx < len; idx++) {\n var value = opt.lookup(idx);\n if (value instanceof PDFString || value instanceof PDFHexString) {\n values.push(value);\n }\n }\n return values;\n };\n PDFAcroButton.prototype.removeExportValue = function (idx) {\n var opt = this.Opt();\n if (!opt)\n return;\n if (opt instanceof PDFString || opt instanceof PDFHexString) {\n if (idx !== 0)\n throw new IndexOutOfBoundsError(idx, 0, 0);\n this.setOpt([]);\n }\n else {\n if (idx < 0 || idx > opt.size()) {\n throw new IndexOutOfBoundsError(idx, 0, opt.size());\n }\n opt.remove(idx);\n }\n };\n // Enforce use use of /Opt even if it isn't strictly necessary\n PDFAcroButton.prototype.normalizeExportValues = function () {\n var _a, _b, _c, _d;\n var exportValues = (_a = this.getExportValues()) !== null && _a !== void 0 ? _a : [];\n var Opt = [];\n var widgets = this.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var exportVal = (_b = exportValues[idx]) !== null && _b !== void 0 ? _b : PDFHexString.fromText((_d = (_c = widget.getOnValue()) === null || _c === void 0 ? void 0 : _c.decodeText()) !== null && _d !== void 0 ? _d : '');\n Opt.push(exportVal);\n }\n this.setOpt(Opt);\n };\n /**\n * Reuses existing opt if one exists with the same value (assuming\n * `useExistingIdx` is `true`). Returns index of existing (or new) opt.\n */\n PDFAcroButton.prototype.addOpt = function (opt, useExistingOptIdx) {\n var _a;\n this.normalizeExportValues();\n var optText = opt.decodeText();\n var existingIdx;\n if (useExistingOptIdx) {\n var exportValues = (_a = this.getExportValues()) !== null && _a !== void 0 ? _a : [];\n for (var idx = 0, len = exportValues.length; idx < len; idx++) {\n var exportVal = exportValues[idx];\n if (exportVal.decodeText() === optText)\n existingIdx = idx;\n }\n }\n var Opt = this.Opt();\n Opt.push(opt);\n return existingIdx !== null && existingIdx !== void 0 ? existingIdx : Opt.size() - 1;\n };\n PDFAcroButton.prototype.addWidgetWithOpt = function (widget, opt, useExistingOptIdx) {\n var optIdx = this.addOpt(opt, useExistingOptIdx);\n var apStateValue = PDFName.of(String(optIdx));\n this.addWidget(widget);\n return apStateValue;\n };\n return PDFAcroButton;\n}(PDFAcroTerminal));\nexport default PDFAcroButton;\n//# sourceMappingURL=PDFAcroButton.js.map","import { __extends } from \"tslib\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFAcroButton from \"./PDFAcroButton\";\nimport { InvalidAcroFieldValueError } from \"../errors\";\nvar PDFAcroCheckBox = /** @class */ (function (_super) {\n __extends(PDFAcroCheckBox, _super);\n function PDFAcroCheckBox() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroCheckBox.prototype.setValue = function (value) {\n var _a;\n var onValue = (_a = this.getOnValue()) !== null && _a !== void 0 ? _a : PDFName.of('Yes');\n if (value !== onValue && value !== PDFName.of('Off')) {\n throw new InvalidAcroFieldValueError();\n }\n this.dict.set(PDFName.of('V'), value);\n var widgets = this.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var state = widget.getOnValue() === value ? value : PDFName.of('Off');\n widget.setAppearanceState(state);\n }\n };\n PDFAcroCheckBox.prototype.getValue = function () {\n var v = this.V();\n if (v instanceof PDFName)\n return v;\n return PDFName.of('Off');\n };\n PDFAcroCheckBox.prototype.getOnValue = function () {\n var widget = this.getWidgets()[0];\n return widget === null || widget === void 0 ? void 0 : widget.getOnValue();\n };\n PDFAcroCheckBox.fromDict = function (dict, ref) {\n return new PDFAcroCheckBox(dict, ref);\n };\n PDFAcroCheckBox.create = function (context) {\n var dict = context.obj({\n FT: 'Btn',\n Kids: [],\n });\n var ref = context.register(dict);\n return new PDFAcroCheckBox(dict, ref);\n };\n return PDFAcroCheckBox;\n}(PDFAcroButton));\nexport default PDFAcroCheckBox;\n//# sourceMappingURL=PDFAcroCheckBox.js.map","import { __extends } from \"tslib\";\nimport PDFAcroTerminal from \"./PDFAcroTerminal\";\nimport PDFHexString from \"../objects/PDFHexString\";\nimport PDFString from \"../objects/PDFString\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFName from \"../objects/PDFName\";\nimport { AcroChoiceFlags } from \"./flags\";\nimport { InvalidAcroFieldValueError, MultiSelectValueError, } from \"../errors\";\nvar PDFAcroChoice = /** @class */ (function (_super) {\n __extends(PDFAcroChoice, _super);\n function PDFAcroChoice() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroChoice.prototype.setValues = function (values) {\n if (this.hasFlag(AcroChoiceFlags.Combo) &&\n !this.hasFlag(AcroChoiceFlags.Edit) &&\n !this.valuesAreValid(values)) {\n throw new InvalidAcroFieldValueError();\n }\n if (values.length === 0) {\n this.dict.delete(PDFName.of('V'));\n }\n if (values.length === 1) {\n this.dict.set(PDFName.of('V'), values[0]);\n }\n if (values.length > 1) {\n if (!this.hasFlag(AcroChoiceFlags.MultiSelect)) {\n throw new MultiSelectValueError();\n }\n this.dict.set(PDFName.of('V'), this.dict.context.obj(values));\n }\n this.updateSelectedIndices(values);\n };\n PDFAcroChoice.prototype.valuesAreValid = function (values) {\n var options = this.getOptions();\n var _loop_1 = function (idx, len) {\n var val = values[idx].decodeText();\n if (!options.find(function (o) { return val === (o.display || o.value).decodeText(); })) {\n return { value: false };\n }\n };\n for (var idx = 0, len = values.length; idx < len; idx++) {\n var state_1 = _loop_1(idx, len);\n if (typeof state_1 === \"object\")\n return state_1.value;\n }\n return true;\n };\n PDFAcroChoice.prototype.updateSelectedIndices = function (values) {\n if (values.length > 1) {\n var indices = new Array(values.length);\n var options = this.getOptions();\n var _loop_2 = function (idx, len) {\n var val = values[idx].decodeText();\n indices[idx] = options.findIndex(function (o) { return val === (o.display || o.value).decodeText(); });\n };\n for (var idx = 0, len = values.length; idx < len; idx++) {\n _loop_2(idx, len);\n }\n this.dict.set(PDFName.of('I'), this.dict.context.obj(indices.sort()));\n }\n else {\n this.dict.delete(PDFName.of('I'));\n }\n };\n PDFAcroChoice.prototype.getValues = function () {\n var v = this.V();\n if (v instanceof PDFString || v instanceof PDFHexString)\n return [v];\n if (v instanceof PDFArray) {\n var values = [];\n for (var idx = 0, len = v.size(); idx < len; idx++) {\n var value = v.lookup(idx);\n if (value instanceof PDFString || value instanceof PDFHexString) {\n values.push(value);\n }\n }\n return values;\n }\n return [];\n };\n PDFAcroChoice.prototype.Opt = function () {\n return this.dict.lookupMaybe(PDFName.of('Opt'), PDFString, PDFHexString, PDFArray);\n };\n PDFAcroChoice.prototype.setOptions = function (options) {\n var newOpt = new Array(options.length);\n for (var idx = 0, len = options.length; idx < len; idx++) {\n var _a = options[idx], value = _a.value, display = _a.display;\n newOpt[idx] = this.dict.context.obj([value, display || value]);\n }\n this.dict.set(PDFName.of('Opt'), this.dict.context.obj(newOpt));\n };\n PDFAcroChoice.prototype.getOptions = function () {\n var Opt = this.Opt();\n // Not supposed to happen - Opt _should_ always be `PDFArray | undefined`\n if (Opt instanceof PDFString || Opt instanceof PDFHexString) {\n return [{ value: Opt, display: Opt }];\n }\n if (Opt instanceof PDFArray) {\n var res = [];\n for (var idx = 0, len = Opt.size(); idx < len; idx++) {\n var item = Opt.lookup(idx);\n // If `item` is a string, use that as both the export and text value\n if (item instanceof PDFString || item instanceof PDFHexString) {\n res.push({ value: item, display: item });\n }\n // If `item` is an array of one, treat it the same as just a string,\n // if it's an array of two then `item[0]` is the export value and\n // `item[1]` is the text value\n if (item instanceof PDFArray) {\n if (item.size() > 0) {\n var first = item.lookup(0, PDFString, PDFHexString);\n var second = item.lookupMaybe(1, PDFString, PDFHexString);\n res.push({ value: first, display: second || first });\n }\n }\n }\n return res;\n }\n return [];\n };\n return PDFAcroChoice;\n}(PDFAcroTerminal));\nexport default PDFAcroChoice;\n//# sourceMappingURL=PDFAcroChoice.js.map","import { __extends } from \"tslib\";\nimport PDFAcroChoice from \"./PDFAcroChoice\";\nimport { AcroChoiceFlags } from \"./flags\";\nvar PDFAcroComboBox = /** @class */ (function (_super) {\n __extends(PDFAcroComboBox, _super);\n function PDFAcroComboBox() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroComboBox.fromDict = function (dict, ref) {\n return new PDFAcroComboBox(dict, ref);\n };\n PDFAcroComboBox.create = function (context) {\n var dict = context.obj({\n FT: 'Ch',\n Ff: AcroChoiceFlags.Combo,\n Kids: [],\n });\n var ref = context.register(dict);\n return new PDFAcroComboBox(dict, ref);\n };\n return PDFAcroComboBox;\n}(PDFAcroChoice));\nexport default PDFAcroComboBox;\n//# sourceMappingURL=PDFAcroComboBox.js.map","import { __extends } from \"tslib\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFAcroField from \"./PDFAcroField\";\nvar PDFAcroNonTerminal = /** @class */ (function (_super) {\n __extends(PDFAcroNonTerminal, _super);\n function PDFAcroNonTerminal() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroNonTerminal.prototype.addField = function (field) {\n var Kids = this.normalizedEntries().Kids;\n Kids === null || Kids === void 0 ? void 0 : Kids.push(field);\n };\n PDFAcroNonTerminal.prototype.normalizedEntries = function () {\n var Kids = this.Kids();\n if (!Kids) {\n Kids = this.dict.context.obj([]);\n this.dict.set(PDFName.of('Kids'), Kids);\n }\n return { Kids: Kids };\n };\n PDFAcroNonTerminal.fromDict = function (dict, ref) {\n return new PDFAcroNonTerminal(dict, ref);\n };\n PDFAcroNonTerminal.create = function (context) {\n var dict = context.obj({});\n var ref = context.register(dict);\n return new PDFAcroNonTerminal(dict, ref);\n };\n return PDFAcroNonTerminal;\n}(PDFAcroField));\nexport default PDFAcroNonTerminal;\n//# sourceMappingURL=PDFAcroNonTerminal.js.map","import { __extends } from \"tslib\";\nimport PDFAcroTerminal from \"./PDFAcroTerminal\";\nvar PDFAcroSignature = /** @class */ (function (_super) {\n __extends(PDFAcroSignature, _super);\n function PDFAcroSignature() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroSignature.fromDict = function (dict, ref) {\n return new PDFAcroSignature(dict, ref);\n };\n return PDFAcroSignature;\n}(PDFAcroTerminal));\nexport default PDFAcroSignature;\n//# sourceMappingURL=PDFAcroSignature.js.map","import { __extends } from \"tslib\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFString from \"../objects/PDFString\";\nimport PDFHexString from \"../objects/PDFHexString\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFAcroTerminal from \"./PDFAcroTerminal\";\nvar PDFAcroText = /** @class */ (function (_super) {\n __extends(PDFAcroText, _super);\n function PDFAcroText() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroText.prototype.MaxLen = function () {\n var maxLen = this.dict.lookup(PDFName.of('MaxLen'));\n if (maxLen instanceof PDFNumber)\n return maxLen;\n return undefined;\n };\n PDFAcroText.prototype.Q = function () {\n var q = this.dict.lookup(PDFName.of('Q'));\n if (q instanceof PDFNumber)\n return q;\n return undefined;\n };\n PDFAcroText.prototype.setMaxLength = function (maxLength) {\n this.dict.set(PDFName.of('MaxLen'), PDFNumber.of(maxLength));\n };\n PDFAcroText.prototype.removeMaxLength = function () {\n this.dict.delete(PDFName.of('MaxLen'));\n };\n PDFAcroText.prototype.getMaxLength = function () {\n var _a;\n return (_a = this.MaxLen()) === null || _a === void 0 ? void 0 : _a.asNumber();\n };\n PDFAcroText.prototype.setQuadding = function (quadding) {\n this.dict.set(PDFName.of('Q'), PDFNumber.of(quadding));\n };\n PDFAcroText.prototype.getQuadding = function () {\n var _a;\n return (_a = this.Q()) === null || _a === void 0 ? void 0 : _a.asNumber();\n };\n PDFAcroText.prototype.setValue = function (value) {\n this.dict.set(PDFName.of('V'), value);\n // const widgets = this.getWidgets();\n // for (let idx = 0, len = widgets.length; idx < len; idx++) {\n // const widget = widgets[idx];\n // const state = widget.getOnValue() === value ? value : PDFName.of('Off');\n // widget.setAppearanceState(state);\n // }\n };\n PDFAcroText.prototype.removeValue = function () {\n this.dict.delete(PDFName.of('V'));\n };\n PDFAcroText.prototype.getValue = function () {\n var v = this.V();\n if (v instanceof PDFString || v instanceof PDFHexString)\n return v;\n return undefined;\n };\n PDFAcroText.fromDict = function (dict, ref) { return new PDFAcroText(dict, ref); };\n PDFAcroText.create = function (context) {\n var dict = context.obj({\n FT: 'Tx',\n Kids: [],\n });\n var ref = context.register(dict);\n return new PDFAcroText(dict, ref);\n };\n return PDFAcroText;\n}(PDFAcroTerminal));\nexport default PDFAcroText;\n//# sourceMappingURL=PDFAcroText.js.map","import { __extends } from \"tslib\";\nimport PDFAcroButton from \"./PDFAcroButton\";\nimport { AcroButtonFlags } from \"./flags\";\nvar PDFAcroPushButton = /** @class */ (function (_super) {\n __extends(PDFAcroPushButton, _super);\n function PDFAcroPushButton() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroPushButton.fromDict = function (dict, ref) {\n return new PDFAcroPushButton(dict, ref);\n };\n PDFAcroPushButton.create = function (context) {\n var dict = context.obj({\n FT: 'Btn',\n Ff: AcroButtonFlags.PushButton,\n Kids: [],\n });\n var ref = context.register(dict);\n return new PDFAcroPushButton(dict, ref);\n };\n return PDFAcroPushButton;\n}(PDFAcroButton));\nexport default PDFAcroPushButton;\n//# sourceMappingURL=PDFAcroPushButton.js.map","import { __extends } from \"tslib\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFAcroButton from \"./PDFAcroButton\";\nimport { AcroButtonFlags } from \"./flags\";\nimport { InvalidAcroFieldValueError } from \"../errors\";\nvar PDFAcroRadioButton = /** @class */ (function (_super) {\n __extends(PDFAcroRadioButton, _super);\n function PDFAcroRadioButton() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroRadioButton.prototype.setValue = function (value) {\n var onValues = this.getOnValues();\n if (!onValues.includes(value) && value !== PDFName.of('Off')) {\n throw new InvalidAcroFieldValueError();\n }\n this.dict.set(PDFName.of('V'), value);\n var widgets = this.getWidgets();\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var widget = widgets[idx];\n var state = widget.getOnValue() === value ? value : PDFName.of('Off');\n widget.setAppearanceState(state);\n }\n };\n PDFAcroRadioButton.prototype.getValue = function () {\n var v = this.V();\n if (v instanceof PDFName)\n return v;\n return PDFName.of('Off');\n };\n PDFAcroRadioButton.prototype.getOnValues = function () {\n var widgets = this.getWidgets();\n var onValues = [];\n for (var idx = 0, len = widgets.length; idx < len; idx++) {\n var onValue = widgets[idx].getOnValue();\n if (onValue)\n onValues.push(onValue);\n }\n return onValues;\n };\n PDFAcroRadioButton.fromDict = function (dict, ref) {\n return new PDFAcroRadioButton(dict, ref);\n };\n PDFAcroRadioButton.create = function (context) {\n var dict = context.obj({\n FT: 'Btn',\n Ff: AcroButtonFlags.Radio,\n Kids: [],\n });\n var ref = context.register(dict);\n return new PDFAcroRadioButton(dict, ref);\n };\n return PDFAcroRadioButton;\n}(PDFAcroButton));\nexport default PDFAcroRadioButton;\n//# sourceMappingURL=PDFAcroRadioButton.js.map","import { __extends } from \"tslib\";\nimport PDFAcroChoice from \"./PDFAcroChoice\";\nvar PDFAcroListBox = /** @class */ (function (_super) {\n __extends(PDFAcroListBox, _super);\n function PDFAcroListBox() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFAcroListBox.fromDict = function (dict, ref) {\n return new PDFAcroListBox(dict, ref);\n };\n PDFAcroListBox.create = function (context) {\n var dict = context.obj({\n FT: 'Ch',\n Kids: [],\n });\n var ref = context.register(dict);\n return new PDFAcroListBox(dict, ref);\n };\n return PDFAcroListBox;\n}(PDFAcroChoice));\nexport default PDFAcroListBox;\n//# sourceMappingURL=PDFAcroListBox.js.map","import PDFNumber from \"../objects/PDFNumber\";\nimport PDFDict from \"../objects/PDFDict\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFRef from \"../objects/PDFRef\";\nimport PDFAcroTerminal from \"./PDFAcroTerminal\";\nimport PDFAcroNonTerminal from \"./PDFAcroNonTerminal\";\nimport PDFAcroSignature from \"./PDFAcroSignature\";\nimport PDFAcroText from \"./PDFAcroText\";\nimport PDFAcroPushButton from \"./PDFAcroPushButton\";\nimport PDFAcroRadioButton from \"./PDFAcroRadioButton\";\nimport PDFAcroCheckBox from \"./PDFAcroCheckBox\";\nimport PDFAcroComboBox from \"./PDFAcroComboBox\";\nimport PDFAcroListBox from \"./PDFAcroListBox\";\nimport { AcroButtonFlags, AcroChoiceFlags } from \"./flags\";\nexport var createPDFAcroFields = function (kidDicts) {\n if (!kidDicts)\n return [];\n var kids = [];\n for (var idx = 0, len = kidDicts.size(); idx < len; idx++) {\n var ref = kidDicts.get(idx);\n var dict = kidDicts.lookup(idx);\n // if (dict instanceof PDFDict) kids.push(PDFAcroField.fromDict(dict));\n if (ref instanceof PDFRef && dict instanceof PDFDict) {\n kids.push([createPDFAcroField(dict, ref), ref]);\n }\n }\n return kids;\n};\nexport var createPDFAcroField = function (dict, ref) {\n var isNonTerminal = isNonTerminalAcroField(dict);\n if (isNonTerminal)\n return PDFAcroNonTerminal.fromDict(dict, ref);\n return createPDFAcroTerminal(dict, ref);\n};\n// TODO: Maybe just check if the dict is *not* a widget? That might be better.\n// According to the PDF spec:\n//\n// > A field's children in the hierarchy may also include widget annotations\n// > that define its appearance on the page. A field that has children that\n// > are fields is called a non-terminal field. A field that does not have\n// > children that are fields is called a terminal field.\n//\n// The spec is not entirely clear about how to determine whether a given\n// dictionary represents an acrofield or a widget annotation. So we will assume\n// that a dictionary is an acrofield if it is a member of the `/Kids` array\n// and it contains a `/T` entry (widgets do not have `/T` entries). This isn't\n// a bullet proof solution, because the `/T` entry is technically defined as\n// optional for acrofields by the PDF spec. But in practice all acrofields seem\n// to have a `/T` entry defined.\nvar isNonTerminalAcroField = function (dict) {\n var kids = dict.lookup(PDFName.of('Kids'));\n if (kids instanceof PDFArray) {\n for (var idx = 0, len = kids.size(); idx < len; idx++) {\n var kid = kids.lookup(idx);\n var kidIsField = kid instanceof PDFDict && kid.has(PDFName.of('T'));\n if (kidIsField)\n return true;\n }\n }\n return false;\n};\nvar createPDFAcroTerminal = function (dict, ref) {\n var ftNameOrRef = getInheritableAttribute(dict, PDFName.of('FT'));\n var type = dict.context.lookup(ftNameOrRef, PDFName);\n if (type === PDFName.of('Btn'))\n return createPDFAcroButton(dict, ref);\n if (type === PDFName.of('Ch'))\n return createPDFAcroChoice(dict, ref);\n if (type === PDFName.of('Tx'))\n return PDFAcroText.fromDict(dict, ref);\n if (type === PDFName.of('Sig'))\n return PDFAcroSignature.fromDict(dict, ref);\n // We should never reach this line. But there are a lot of weird PDFs out\n // there. So, just to be safe, we'll try to handle things gracefully instead\n // of throwing an error.\n return PDFAcroTerminal.fromDict(dict, ref);\n};\nvar createPDFAcroButton = function (dict, ref) {\n var _a;\n var ffNumberOrRef = getInheritableAttribute(dict, PDFName.of('Ff'));\n var ffNumber = dict.context.lookupMaybe(ffNumberOrRef, PDFNumber);\n var flags = (_a = ffNumber === null || ffNumber === void 0 ? void 0 : ffNumber.asNumber()) !== null && _a !== void 0 ? _a : 0;\n if (flagIsSet(flags, AcroButtonFlags.PushButton)) {\n return PDFAcroPushButton.fromDict(dict, ref);\n }\n else if (flagIsSet(flags, AcroButtonFlags.Radio)) {\n return PDFAcroRadioButton.fromDict(dict, ref);\n }\n else {\n return PDFAcroCheckBox.fromDict(dict, ref);\n }\n};\nvar createPDFAcroChoice = function (dict, ref) {\n var _a;\n var ffNumberOrRef = getInheritableAttribute(dict, PDFName.of('Ff'));\n var ffNumber = dict.context.lookupMaybe(ffNumberOrRef, PDFNumber);\n var flags = (_a = ffNumber === null || ffNumber === void 0 ? void 0 : ffNumber.asNumber()) !== null && _a !== void 0 ? _a : 0;\n if (flagIsSet(flags, AcroChoiceFlags.Combo)) {\n return PDFAcroComboBox.fromDict(dict, ref);\n }\n else {\n return PDFAcroListBox.fromDict(dict, ref);\n }\n};\nvar flagIsSet = function (flags, flag) {\n return (flags & flag) !== 0;\n};\nvar getInheritableAttribute = function (startNode, name) {\n var attribute;\n ascend(startNode, function (node) {\n if (!attribute)\n attribute = node.get(name);\n });\n return attribute;\n};\nvar ascend = function (startNode, visitor) {\n visitor(startNode);\n var Parent = startNode.lookupMaybe(PDFName.of('Parent'), PDFDict);\n if (Parent)\n ascend(Parent, visitor);\n};\n//# sourceMappingURL=utils.js.map","import PDFDict from \"../objects/PDFDict\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFAcroNonTerminal from \"./PDFAcroNonTerminal\";\nimport { createPDFAcroField, createPDFAcroFields, } from \"./utils\";\nvar PDFAcroForm = /** @class */ (function () {\n function PDFAcroForm(dict) {\n this.dict = dict;\n }\n PDFAcroForm.prototype.Fields = function () {\n var fields = this.dict.lookup(PDFName.of('Fields'));\n if (fields instanceof PDFArray)\n return fields;\n return undefined;\n };\n PDFAcroForm.prototype.getFields = function () {\n var Fields = this.normalizedEntries().Fields;\n var fields = new Array(Fields.size());\n for (var idx = 0, len = Fields.size(); idx < len; idx++) {\n var ref = Fields.get(idx);\n var dict = Fields.lookup(idx, PDFDict);\n fields[idx] = [createPDFAcroField(dict, ref), ref];\n }\n return fields;\n };\n PDFAcroForm.prototype.getAllFields = function () {\n var allFields = [];\n var pushFields = function (fields) {\n if (!fields)\n return;\n for (var idx = 0, len = fields.length; idx < len; idx++) {\n var field = fields[idx];\n allFields.push(field);\n var fieldModel = field[0];\n if (fieldModel instanceof PDFAcroNonTerminal) {\n pushFields(createPDFAcroFields(fieldModel.Kids()));\n }\n }\n };\n pushFields(this.getFields());\n return allFields;\n };\n PDFAcroForm.prototype.addField = function (field) {\n var Fields = this.normalizedEntries().Fields;\n Fields === null || Fields === void 0 ? void 0 : Fields.push(field);\n };\n PDFAcroForm.prototype.removeField = function (field) {\n var parent = field.getParent();\n var fields = parent === undefined ? this.normalizedEntries().Fields : parent.Kids();\n var index = fields === null || fields === void 0 ? void 0 : fields.indexOf(field.ref);\n if (fields === undefined || index === undefined) {\n throw new Error(\"Tried to remove inexistent field \" + field.getFullyQualifiedName());\n }\n fields.remove(index);\n if (parent !== undefined && fields.size() === 0) {\n this.removeField(parent);\n }\n };\n PDFAcroForm.prototype.normalizedEntries = function () {\n var Fields = this.Fields();\n if (!Fields) {\n Fields = this.dict.context.obj([]);\n this.dict.set(PDFName.of('Fields'), Fields);\n }\n return { Fields: Fields };\n };\n PDFAcroForm.fromDict = function (dict) { return new PDFAcroForm(dict); };\n PDFAcroForm.create = function (context) {\n var dict = context.obj({ Fields: [] });\n return new PDFAcroForm(dict);\n };\n return PDFAcroForm;\n}());\nexport default PDFAcroForm;\n//# sourceMappingURL=PDFAcroForm.js.map","import { __extends } from \"tslib\";\nimport PDFDict from \"../objects/PDFDict\";\nimport PDFName from \"../objects/PDFName\";\nimport { PDFAcroForm } from \"../acroform\";\nimport ViewerPreferences from '../interactive/ViewerPreferences';\nvar PDFCatalog = /** @class */ (function (_super) {\n __extends(PDFCatalog, _super);\n function PDFCatalog() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFCatalog.prototype.Pages = function () {\n return this.lookup(PDFName.of('Pages'), PDFDict);\n };\n PDFCatalog.prototype.AcroForm = function () {\n return this.lookupMaybe(PDFName.of('AcroForm'), PDFDict);\n };\n PDFCatalog.prototype.getAcroForm = function () {\n var dict = this.AcroForm();\n if (!dict)\n return undefined;\n return PDFAcroForm.fromDict(dict);\n };\n PDFCatalog.prototype.getOrCreateAcroForm = function () {\n var acroForm = this.getAcroForm();\n if (!acroForm) {\n acroForm = PDFAcroForm.create(this.context);\n var acroFormRef = this.context.register(acroForm.dict);\n this.set(PDFName.of('AcroForm'), acroFormRef);\n }\n return acroForm;\n };\n PDFCatalog.prototype.ViewerPreferences = function () {\n return this.lookupMaybe(PDFName.of('ViewerPreferences'), PDFDict);\n };\n PDFCatalog.prototype.getViewerPreferences = function () {\n var dict = this.ViewerPreferences();\n if (!dict)\n return undefined;\n return ViewerPreferences.fromDict(dict);\n };\n PDFCatalog.prototype.getOrCreateViewerPreferences = function () {\n var viewerPrefs = this.getViewerPreferences();\n if (!viewerPrefs) {\n viewerPrefs = ViewerPreferences.create(this.context);\n var viewerPrefsRef = this.context.register(viewerPrefs.dict);\n this.set(PDFName.of('ViewerPreferences'), viewerPrefsRef);\n }\n return viewerPrefs;\n };\n /**\n * Inserts the given ref as a leaf node of this catalog's page tree at the\n * specified index (zero-based). Also increments the `Count` of each node in\n * the page tree hierarchy to accomodate the new page.\n *\n * Returns the ref of the PDFPageTree node into which `leafRef` was inserted.\n */\n PDFCatalog.prototype.insertLeafNode = function (leafRef, index) {\n var pagesRef = this.get(PDFName.of('Pages'));\n var maybeParentRef = this.Pages().insertLeafNode(leafRef, index);\n return maybeParentRef || pagesRef;\n };\n PDFCatalog.prototype.removeLeafNode = function (index) {\n this.Pages().removeLeafNode(index);\n };\n PDFCatalog.withContextAndPages = function (context, pages) {\n var dict = new Map();\n dict.set(PDFName.of('Type'), PDFName.of('Catalog'));\n dict.set(PDFName.of('Pages'), pages);\n return new PDFCatalog(dict, context);\n };\n PDFCatalog.fromMapWithContext = function (map, context) {\n return new PDFCatalog(map, context);\n };\n return PDFCatalog;\n}(PDFDict));\nexport default PDFCatalog;\n//# sourceMappingURL=PDFCatalog.js.map","import { __extends } from \"tslib\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFDict from \"../objects/PDFDict\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFPageLeaf from \"./PDFPageLeaf\";\nimport { InvalidTargetIndexError, CorruptPageTreeError } from \"../errors\";\nvar PDFPageTree = /** @class */ (function (_super) {\n __extends(PDFPageTree, _super);\n function PDFPageTree() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PDFPageTree.prototype.Parent = function () {\n return this.lookup(PDFName.of('Parent'));\n };\n PDFPageTree.prototype.Kids = function () {\n return this.lookup(PDFName.of('Kids'), PDFArray);\n };\n PDFPageTree.prototype.Count = function () {\n return this.lookup(PDFName.of('Count'), PDFNumber);\n };\n PDFPageTree.prototype.pushTreeNode = function (treeRef) {\n var Kids = this.Kids();\n Kids.push(treeRef);\n };\n PDFPageTree.prototype.pushLeafNode = function (leafRef) {\n var Kids = this.Kids();\n this.insertLeafKid(Kids.size(), leafRef);\n };\n /**\n * Inserts the given ref as a leaf node of this page tree at the specified\n * index (zero-based). Also increments the `Count` of each page tree in the\n * hierarchy to accomodate the new page.\n *\n * Returns the ref of the PDFPageTree node into which `leafRef` was inserted,\n * or `undefined` if it was inserted into the root node (the PDFPageTree upon\n * which the method was first called).\n */\n PDFPageTree.prototype.insertLeafNode = function (leafRef, targetIndex) {\n var Kids = this.Kids();\n var Count = this.Count().asNumber();\n if (targetIndex > Count) {\n throw new InvalidTargetIndexError(targetIndex, Count);\n }\n var leafsRemainingUntilTarget = targetIndex;\n for (var idx = 0, len = Kids.size(); idx < len; idx++) {\n if (leafsRemainingUntilTarget === 0) {\n // Insert page and return\n this.insertLeafKid(idx, leafRef);\n return undefined;\n }\n var kidRef = Kids.get(idx);\n var kid = this.context.lookup(kidRef);\n if (kid instanceof PDFPageTree) {\n if (kid.Count().asNumber() > leafsRemainingUntilTarget) {\n // Dig in\n return (kid.insertLeafNode(leafRef, leafsRemainingUntilTarget) || kidRef);\n }\n else {\n // Move on\n leafsRemainingUntilTarget -= kid.Count().asNumber();\n }\n }\n if (kid instanceof PDFPageLeaf) {\n // Move on\n leafsRemainingUntilTarget -= 1;\n }\n }\n if (leafsRemainingUntilTarget === 0) {\n // Insert page at the end and return\n this.insertLeafKid(Kids.size(), leafRef);\n return undefined;\n }\n // Should never get here if `targetIndex` is valid\n throw new CorruptPageTreeError(targetIndex, 'insertLeafNode');\n };\n /**\n * Removes the leaf node at the specified index (zero-based) from this page\n * tree. Also decrements the `Count` of each page tree in the hierarchy to\n * account for the removed page.\n *\n * If `prune` is true, then intermediate tree nodes will be removed from the\n * tree if they contain 0 children after the leaf node is removed.\n */\n PDFPageTree.prototype.removeLeafNode = function (targetIndex, prune) {\n if (prune === void 0) { prune = true; }\n var Kids = this.Kids();\n var Count = this.Count().asNumber();\n if (targetIndex >= Count) {\n throw new InvalidTargetIndexError(targetIndex, Count);\n }\n var leafsRemainingUntilTarget = targetIndex;\n for (var idx = 0, len = Kids.size(); idx < len; idx++) {\n var kidRef = Kids.get(idx);\n var kid = this.context.lookup(kidRef);\n if (kid instanceof PDFPageTree) {\n if (kid.Count().asNumber() > leafsRemainingUntilTarget) {\n // Dig in\n kid.removeLeafNode(leafsRemainingUntilTarget, prune);\n if (prune && kid.Kids().size() === 0)\n Kids.remove(idx);\n return;\n }\n else {\n // Move on\n leafsRemainingUntilTarget -= kid.Count().asNumber();\n }\n }\n if (kid instanceof PDFPageLeaf) {\n if (leafsRemainingUntilTarget === 0) {\n // Remove page and return\n this.removeKid(idx);\n return;\n }\n else {\n // Move on\n leafsRemainingUntilTarget -= 1;\n }\n }\n }\n // Should never get here if `targetIndex` is valid\n throw new CorruptPageTreeError(targetIndex, 'removeLeafNode');\n };\n PDFPageTree.prototype.ascend = function (visitor) {\n visitor(this);\n var Parent = this.Parent();\n if (Parent)\n Parent.ascend(visitor);\n };\n /** Performs a Post-Order traversal of this page tree */\n PDFPageTree.prototype.traverse = function (visitor) {\n var Kids = this.Kids();\n for (var idx = 0, len = Kids.size(); idx < len; idx++) {\n var kidRef = Kids.get(idx);\n var kid = this.context.lookup(kidRef);\n if (kid instanceof PDFPageTree)\n kid.traverse(visitor);\n visitor(kid, kidRef);\n }\n };\n PDFPageTree.prototype.insertLeafKid = function (kidIdx, leafRef) {\n var Kids = this.Kids();\n this.ascend(function (node) {\n var newCount = node.Count().asNumber() + 1;\n node.set(PDFName.of('Count'), PDFNumber.of(newCount));\n });\n Kids.insert(kidIdx, leafRef);\n };\n PDFPageTree.prototype.removeKid = function (kidIdx) {\n var Kids = this.Kids();\n var kid = Kids.lookup(kidIdx);\n if (kid instanceof PDFPageLeaf) {\n this.ascend(function (node) {\n var newCount = node.Count().asNumber() - 1;\n node.set(PDFName.of('Count'), PDFNumber.of(newCount));\n });\n }\n Kids.remove(kidIdx);\n };\n PDFPageTree.withContext = function (context, parent) {\n var dict = new Map();\n dict.set(PDFName.of('Type'), PDFName.of('Pages'));\n dict.set(PDFName.of('Kids'), context.obj([]));\n dict.set(PDFName.of('Count'), context.obj(0));\n if (parent)\n dict.set(PDFName.of('Parent'), parent);\n return new PDFPageTree(dict, context);\n };\n PDFPageTree.fromMapWithContext = function (map, context) {\n return new PDFPageTree(map, context);\n };\n return PDFPageTree;\n}(PDFDict));\nexport default PDFPageTree;\n//# sourceMappingURL=PDFPageTree.js.map","import CharCodes from \"./CharCodes\";\nexport var IsDigit = new Uint8Array(256);\nIsDigit[CharCodes.Zero] = 1;\nIsDigit[CharCodes.One] = 1;\nIsDigit[CharCodes.Two] = 1;\nIsDigit[CharCodes.Three] = 1;\nIsDigit[CharCodes.Four] = 1;\nIsDigit[CharCodes.Five] = 1;\nIsDigit[CharCodes.Six] = 1;\nIsDigit[CharCodes.Seven] = 1;\nIsDigit[CharCodes.Eight] = 1;\nIsDigit[CharCodes.Nine] = 1;\nexport var IsNumericPrefix = new Uint8Array(256);\nIsNumericPrefix[CharCodes.Period] = 1;\nIsNumericPrefix[CharCodes.Plus] = 1;\nIsNumericPrefix[CharCodes.Minus] = 1;\nexport var IsNumeric = new Uint8Array(256);\nfor (var idx = 0, len = 256; idx < len; idx++) {\n IsNumeric[idx] = IsDigit[idx] || IsNumericPrefix[idx] ? 1 : 0;\n}\n//# sourceMappingURL=Numeric.js.map","import { NumberParsingError } from \"../errors\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { IsDigit, IsNumeric } from \"../syntax/Numeric\";\nimport { IsWhitespace } from \"../syntax/Whitespace\";\nimport { charFromCode } from \"../../utils\";\nvar Newline = CharCodes.Newline, CarriageReturn = CharCodes.CarriageReturn;\n// TODO: Throw error if eof is reached before finishing object parse...\nvar BaseParser = /** @class */ (function () {\n function BaseParser(bytes, capNumbers) {\n if (capNumbers === void 0) { capNumbers = false; }\n this.bytes = bytes;\n this.capNumbers = capNumbers;\n }\n BaseParser.prototype.parseRawInt = function () {\n var value = '';\n while (!this.bytes.done()) {\n var byte = this.bytes.peek();\n if (!IsDigit[byte])\n break;\n value += charFromCode(this.bytes.next());\n }\n var numberValue = Number(value);\n if (!value || !isFinite(numberValue)) {\n throw new NumberParsingError(this.bytes.position(), value);\n }\n return numberValue;\n };\n // TODO: Maybe handle exponential format?\n // TODO: Compare performance of string concatenation to charFromCode(...bytes)\n BaseParser.prototype.parseRawNumber = function () {\n var value = '';\n // Parse integer-part, the leading (+ | - | . | 0-9)\n while (!this.bytes.done()) {\n var byte = this.bytes.peek();\n if (!IsNumeric[byte])\n break;\n value += charFromCode(this.bytes.next());\n if (byte === CharCodes.Period)\n break;\n }\n // Parse decimal-part, the trailing (0-9)\n while (!this.bytes.done()) {\n var byte = this.bytes.peek();\n if (!IsDigit[byte])\n break;\n value += charFromCode(this.bytes.next());\n }\n var numberValue = Number(value);\n if (!value || !isFinite(numberValue)) {\n throw new NumberParsingError(this.bytes.position(), value);\n }\n if (numberValue > Number.MAX_SAFE_INTEGER) {\n if (this.capNumbers) {\n var msg = \"Parsed number that is too large for some PDF readers: \" + value + \", using Number.MAX_SAFE_INTEGER instead.\";\n console.warn(msg);\n return Number.MAX_SAFE_INTEGER;\n }\n else {\n var msg = \"Parsed number that is too large for some PDF readers: \" + value + \", not capping.\";\n console.warn(msg);\n }\n }\n return numberValue;\n };\n BaseParser.prototype.skipWhitespace = function () {\n while (!this.bytes.done() && IsWhitespace[this.bytes.peek()]) {\n this.bytes.next();\n }\n };\n BaseParser.prototype.skipLine = function () {\n while (!this.bytes.done()) {\n var byte = this.bytes.peek();\n if (byte === Newline || byte === CarriageReturn)\n return;\n this.bytes.next();\n }\n };\n BaseParser.prototype.skipComment = function () {\n if (this.bytes.peek() !== CharCodes.Percent)\n return false;\n while (!this.bytes.done()) {\n var byte = this.bytes.peek();\n if (byte === Newline || byte === CarriageReturn)\n return true;\n this.bytes.next();\n }\n return true;\n };\n BaseParser.prototype.skipWhitespaceAndComments = function () {\n this.skipWhitespace();\n while (this.skipComment())\n this.skipWhitespace();\n };\n BaseParser.prototype.matchKeyword = function (keyword) {\n var initialOffset = this.bytes.offset();\n for (var idx = 0, len = keyword.length; idx < len; idx++) {\n if (this.bytes.done() || this.bytes.next() !== keyword[idx]) {\n this.bytes.moveTo(initialOffset);\n return false;\n }\n }\n return true;\n };\n return BaseParser;\n}());\nexport default BaseParser;\n//# sourceMappingURL=BaseParser.js.map","import { NextByteAssertionError } from \"../errors\";\nimport { decodePDFRawStream } from \"../streams/decode\";\nimport CharCodes from \"../syntax/CharCodes\";\n// TODO: See how line/col tracking affects performance\nvar ByteStream = /** @class */ (function () {\n function ByteStream(bytes) {\n this.idx = 0;\n this.line = 0;\n this.column = 0;\n this.bytes = bytes;\n this.length = this.bytes.length;\n }\n ByteStream.prototype.moveTo = function (offset) {\n this.idx = offset;\n };\n ByteStream.prototype.next = function () {\n var byte = this.bytes[this.idx++];\n if (byte === CharCodes.Newline) {\n this.line += 1;\n this.column = 0;\n }\n else {\n this.column += 1;\n }\n return byte;\n };\n ByteStream.prototype.assertNext = function (expected) {\n if (this.peek() !== expected) {\n throw new NextByteAssertionError(this.position(), expected, this.peek());\n }\n return this.next();\n };\n ByteStream.prototype.peek = function () {\n return this.bytes[this.idx];\n };\n ByteStream.prototype.peekAhead = function (steps) {\n return this.bytes[this.idx + steps];\n };\n ByteStream.prototype.peekAt = function (offset) {\n return this.bytes[offset];\n };\n ByteStream.prototype.done = function () {\n return this.idx >= this.length;\n };\n ByteStream.prototype.offset = function () {\n return this.idx;\n };\n ByteStream.prototype.slice = function (start, end) {\n return this.bytes.slice(start, end);\n };\n ByteStream.prototype.position = function () {\n return { line: this.line, column: this.column, offset: this.idx };\n };\n ByteStream.of = function (bytes) { return new ByteStream(bytes); };\n ByteStream.fromPDFRawStream = function (rawStream) {\n return ByteStream.of(decodePDFRawStream(rawStream).decode());\n };\n return ByteStream;\n}());\nexport default ByteStream;\n//# sourceMappingURL=ByteStream.js.map","import { __spreadArrays } from \"tslib\";\nimport CharCodes from \"./CharCodes\";\nvar Space = CharCodes.Space, CarriageReturn = CharCodes.CarriageReturn, Newline = CharCodes.Newline;\nvar stream = [\n CharCodes.s,\n CharCodes.t,\n CharCodes.r,\n CharCodes.e,\n CharCodes.a,\n CharCodes.m,\n];\nvar endstream = [\n CharCodes.e,\n CharCodes.n,\n CharCodes.d,\n CharCodes.s,\n CharCodes.t,\n CharCodes.r,\n CharCodes.e,\n CharCodes.a,\n CharCodes.m,\n];\nexport var Keywords = {\n header: [\n CharCodes.Percent,\n CharCodes.P,\n CharCodes.D,\n CharCodes.F,\n CharCodes.Dash,\n ],\n eof: [\n CharCodes.Percent,\n CharCodes.Percent,\n CharCodes.E,\n CharCodes.O,\n CharCodes.F,\n ],\n obj: [CharCodes.o, CharCodes.b, CharCodes.j],\n endobj: [\n CharCodes.e,\n CharCodes.n,\n CharCodes.d,\n CharCodes.o,\n CharCodes.b,\n CharCodes.j,\n ],\n xref: [CharCodes.x, CharCodes.r, CharCodes.e, CharCodes.f],\n trailer: [\n CharCodes.t,\n CharCodes.r,\n CharCodes.a,\n CharCodes.i,\n CharCodes.l,\n CharCodes.e,\n CharCodes.r,\n ],\n startxref: [\n CharCodes.s,\n CharCodes.t,\n CharCodes.a,\n CharCodes.r,\n CharCodes.t,\n CharCodes.x,\n CharCodes.r,\n CharCodes.e,\n CharCodes.f,\n ],\n true: [CharCodes.t, CharCodes.r, CharCodes.u, CharCodes.e],\n false: [CharCodes.f, CharCodes.a, CharCodes.l, CharCodes.s, CharCodes.e],\n null: [CharCodes.n, CharCodes.u, CharCodes.l, CharCodes.l],\n stream: stream,\n streamEOF1: __spreadArrays(stream, [Space, CarriageReturn, Newline]),\n streamEOF2: __spreadArrays(stream, [CarriageReturn, Newline]),\n streamEOF3: __spreadArrays(stream, [CarriageReturn]),\n streamEOF4: __spreadArrays(stream, [Newline]),\n endstream: endstream,\n EOF1endstream: __spreadArrays([CarriageReturn, Newline], endstream),\n EOF2endstream: __spreadArrays([CarriageReturn], endstream),\n EOF3endstream: __spreadArrays([Newline], endstream),\n};\n//# sourceMappingURL=Keywords.js.map","import { __extends } from \"tslib\";\nimport { PDFObjectParsingError, PDFStreamParsingError, UnbalancedParenthesisError, } from \"../errors\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFBool from \"../objects/PDFBool\";\nimport PDFDict from \"../objects/PDFDict\";\nimport PDFHexString from \"../objects/PDFHexString\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFNull from \"../objects/PDFNull\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFRawStream from \"../objects/PDFRawStream\";\nimport PDFRef from \"../objects/PDFRef\";\nimport PDFString from \"../objects/PDFString\";\nimport BaseParser from \"./BaseParser\";\nimport ByteStream from \"./ByteStream\";\nimport PDFCatalog from \"../structures/PDFCatalog\";\nimport PDFPageLeaf from \"../structures/PDFPageLeaf\";\nimport PDFPageTree from \"../structures/PDFPageTree\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { IsDelimiter } from \"../syntax/Delimiters\";\nimport { Keywords } from \"../syntax/Keywords\";\nimport { IsDigit, IsNumeric } from \"../syntax/Numeric\";\nimport { IsWhitespace } from \"../syntax/Whitespace\";\nimport { charFromCode } from \"../../utils\";\n// TODO: Throw error if eof is reached before finishing object parse...\nvar PDFObjectParser = /** @class */ (function (_super) {\n __extends(PDFObjectParser, _super);\n function PDFObjectParser(byteStream, context, capNumbers) {\n if (capNumbers === void 0) { capNumbers = false; }\n var _this = _super.call(this, byteStream, capNumbers) || this;\n _this.context = context;\n return _this;\n }\n // TODO: Is it possible to reduce duplicate parsing for ref lookaheads?\n PDFObjectParser.prototype.parseObject = function () {\n this.skipWhitespaceAndComments();\n if (this.matchKeyword(Keywords.true))\n return PDFBool.True;\n if (this.matchKeyword(Keywords.false))\n return PDFBool.False;\n if (this.matchKeyword(Keywords.null))\n return PDFNull;\n var byte = this.bytes.peek();\n if (byte === CharCodes.LessThan &&\n this.bytes.peekAhead(1) === CharCodes.LessThan) {\n return this.parseDictOrStream();\n }\n if (byte === CharCodes.LessThan)\n return this.parseHexString();\n if (byte === CharCodes.LeftParen)\n return this.parseString();\n if (byte === CharCodes.ForwardSlash)\n return this.parseName();\n if (byte === CharCodes.LeftSquareBracket)\n return this.parseArray();\n if (IsNumeric[byte])\n return this.parseNumberOrRef();\n throw new PDFObjectParsingError(this.bytes.position(), byte);\n };\n PDFObjectParser.prototype.parseNumberOrRef = function () {\n var firstNum = this.parseRawNumber();\n this.skipWhitespaceAndComments();\n var lookaheadStart = this.bytes.offset();\n if (IsDigit[this.bytes.peek()]) {\n var secondNum = this.parseRawNumber();\n this.skipWhitespaceAndComments();\n if (this.bytes.peek() === CharCodes.R) {\n this.bytes.assertNext(CharCodes.R);\n return PDFRef.of(firstNum, secondNum);\n }\n }\n this.bytes.moveTo(lookaheadStart);\n return PDFNumber.of(firstNum);\n };\n // TODO: Maybe update PDFHexString.of() logic to remove whitespace and validate input?\n PDFObjectParser.prototype.parseHexString = function () {\n var value = '';\n this.bytes.assertNext(CharCodes.LessThan);\n while (!this.bytes.done() && this.bytes.peek() !== CharCodes.GreaterThan) {\n value += charFromCode(this.bytes.next());\n }\n this.bytes.assertNext(CharCodes.GreaterThan);\n return PDFHexString.of(value);\n };\n PDFObjectParser.prototype.parseString = function () {\n var nestingLvl = 0;\n var isEscaped = false;\n var value = '';\n while (!this.bytes.done()) {\n var byte = this.bytes.next();\n value += charFromCode(byte);\n // Check for unescaped parenthesis\n if (!isEscaped) {\n if (byte === CharCodes.LeftParen)\n nestingLvl += 1;\n if (byte === CharCodes.RightParen)\n nestingLvl -= 1;\n }\n // Track whether current character is being escaped or not\n if (byte === CharCodes.BackSlash) {\n isEscaped = !isEscaped;\n }\n else if (isEscaped) {\n isEscaped = false;\n }\n // Once (if) the unescaped parenthesis balance out, return their contents\n if (nestingLvl === 0) {\n // Remove the outer parens so they aren't part of the contents\n return PDFString.of(value.substring(1, value.length - 1));\n }\n }\n throw new UnbalancedParenthesisError(this.bytes.position());\n };\n // TODO: Compare performance of string concatenation to charFromCode(...bytes)\n // TODO: Maybe preallocate small Uint8Array if can use charFromCode?\n PDFObjectParser.prototype.parseName = function () {\n this.bytes.assertNext(CharCodes.ForwardSlash);\n var name = '';\n while (!this.bytes.done()) {\n var byte = this.bytes.peek();\n if (IsWhitespace[byte] || IsDelimiter[byte])\n break;\n name += charFromCode(byte);\n this.bytes.next();\n }\n return PDFName.of(name);\n };\n PDFObjectParser.prototype.parseArray = function () {\n this.bytes.assertNext(CharCodes.LeftSquareBracket);\n this.skipWhitespaceAndComments();\n var pdfArray = PDFArray.withContext(this.context);\n while (this.bytes.peek() !== CharCodes.RightSquareBracket) {\n var element = this.parseObject();\n pdfArray.push(element);\n this.skipWhitespaceAndComments();\n }\n this.bytes.assertNext(CharCodes.RightSquareBracket);\n return pdfArray;\n };\n PDFObjectParser.prototype.parseDict = function () {\n this.bytes.assertNext(CharCodes.LessThan);\n this.bytes.assertNext(CharCodes.LessThan);\n this.skipWhitespaceAndComments();\n var dict = new Map();\n while (!this.bytes.done() &&\n this.bytes.peek() !== CharCodes.GreaterThan &&\n this.bytes.peekAhead(1) !== CharCodes.GreaterThan) {\n var key = this.parseName();\n var value = this.parseObject();\n dict.set(key, value);\n this.skipWhitespaceAndComments();\n }\n this.skipWhitespaceAndComments();\n this.bytes.assertNext(CharCodes.GreaterThan);\n this.bytes.assertNext(CharCodes.GreaterThan);\n var Type = dict.get(PDFName.of('Type'));\n if (Type === PDFName.of('Catalog')) {\n return PDFCatalog.fromMapWithContext(dict, this.context);\n }\n else if (Type === PDFName.of('Pages')) {\n return PDFPageTree.fromMapWithContext(dict, this.context);\n }\n else if (Type === PDFName.of('Page')) {\n return PDFPageLeaf.fromMapWithContext(dict, this.context);\n }\n else {\n return PDFDict.fromMapWithContext(dict, this.context);\n }\n };\n PDFObjectParser.prototype.parseDictOrStream = function () {\n var startPos = this.bytes.position();\n var dict = this.parseDict();\n this.skipWhitespaceAndComments();\n if (!this.matchKeyword(Keywords.streamEOF1) &&\n !this.matchKeyword(Keywords.streamEOF2) &&\n !this.matchKeyword(Keywords.streamEOF3) &&\n !this.matchKeyword(Keywords.streamEOF4) &&\n !this.matchKeyword(Keywords.stream)) {\n return dict;\n }\n var start = this.bytes.offset();\n var end;\n var Length = dict.get(PDFName.of('Length'));\n if (Length instanceof PDFNumber) {\n end = start + Length.asNumber();\n this.bytes.moveTo(end);\n this.skipWhitespaceAndComments();\n if (!this.matchKeyword(Keywords.endstream)) {\n this.bytes.moveTo(start);\n end = this.findEndOfStreamFallback(startPos);\n }\n }\n else {\n end = this.findEndOfStreamFallback(startPos);\n }\n var contents = this.bytes.slice(start, end);\n return PDFRawStream.of(dict, contents);\n };\n PDFObjectParser.prototype.findEndOfStreamFallback = function (startPos) {\n // Move to end of stream, while handling nested streams\n var nestingLvl = 1;\n var end = this.bytes.offset();\n while (!this.bytes.done()) {\n end = this.bytes.offset();\n if (this.matchKeyword(Keywords.stream)) {\n nestingLvl += 1;\n }\n else if (this.matchKeyword(Keywords.EOF1endstream) ||\n this.matchKeyword(Keywords.EOF2endstream) ||\n this.matchKeyword(Keywords.EOF3endstream) ||\n this.matchKeyword(Keywords.endstream)) {\n nestingLvl -= 1;\n }\n else {\n this.bytes.next();\n }\n if (nestingLvl === 0)\n break;\n }\n if (nestingLvl !== 0)\n throw new PDFStreamParsingError(startPos);\n return end;\n };\n PDFObjectParser.forBytes = function (bytes, context, capNumbers) { return new PDFObjectParser(ByteStream.of(bytes), context, capNumbers); };\n PDFObjectParser.forByteStream = function (byteStream, context, capNumbers) {\n if (capNumbers === void 0) { capNumbers = false; }\n return new PDFObjectParser(byteStream, context, capNumbers);\n };\n return PDFObjectParser;\n}(BaseParser));\nexport default PDFObjectParser;\n//# sourceMappingURL=PDFObjectParser.js.map","import { __awaiter, __extends, __generator } from \"tslib\";\nimport { ReparseError } from \"../errors\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFRef from \"../objects/PDFRef\";\nimport ByteStream from \"./ByteStream\";\nimport PDFObjectParser from \"./PDFObjectParser\";\nimport { waitForTick } from \"../../utils\";\nvar PDFObjectStreamParser = /** @class */ (function (_super) {\n __extends(PDFObjectStreamParser, _super);\n function PDFObjectStreamParser(rawStream, shouldWaitForTick) {\n var _this = _super.call(this, ByteStream.fromPDFRawStream(rawStream), rawStream.dict.context) || this;\n var dict = rawStream.dict;\n _this.alreadyParsed = false;\n _this.shouldWaitForTick = shouldWaitForTick || (function () { return false; });\n _this.firstOffset = dict.lookup(PDFName.of('First'), PDFNumber).asNumber();\n _this.objectCount = dict.lookup(PDFName.of('N'), PDFNumber).asNumber();\n return _this;\n }\n PDFObjectStreamParser.prototype.parseIntoContext = function () {\n return __awaiter(this, void 0, void 0, function () {\n var offsetsAndObjectNumbers, idx, len, _a, objectNumber, offset, object, ref;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (this.alreadyParsed) {\n throw new ReparseError('PDFObjectStreamParser', 'parseIntoContext');\n }\n this.alreadyParsed = true;\n offsetsAndObjectNumbers = this.parseOffsetsAndObjectNumbers();\n idx = 0, len = offsetsAndObjectNumbers.length;\n _b.label = 1;\n case 1:\n if (!(idx < len)) return [3 /*break*/, 4];\n _a = offsetsAndObjectNumbers[idx], objectNumber = _a.objectNumber, offset = _a.offset;\n this.bytes.moveTo(this.firstOffset + offset);\n object = this.parseObject();\n ref = PDFRef.of(objectNumber, 0);\n this.context.assign(ref, object);\n if (!this.shouldWaitForTick()) return [3 /*break*/, 3];\n return [4 /*yield*/, waitForTick()];\n case 2:\n _b.sent();\n _b.label = 3;\n case 3:\n idx++;\n return [3 /*break*/, 1];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n PDFObjectStreamParser.prototype.parseOffsetsAndObjectNumbers = function () {\n var offsetsAndObjectNumbers = [];\n for (var idx = 0, len = this.objectCount; idx < len; idx++) {\n this.skipWhitespaceAndComments();\n var objectNumber = this.parseRawInt();\n this.skipWhitespaceAndComments();\n var offset = this.parseRawInt();\n offsetsAndObjectNumbers.push({ objectNumber: objectNumber, offset: offset });\n }\n return offsetsAndObjectNumbers;\n };\n PDFObjectStreamParser.forStream = function (rawStream, shouldWaitForTick) { return new PDFObjectStreamParser(rawStream, shouldWaitForTick); };\n return PDFObjectStreamParser;\n}(PDFObjectParser));\nexport default PDFObjectStreamParser;\n//# sourceMappingURL=PDFObjectStreamParser.js.map","import { ReparseError } from \"../errors\";\nimport PDFArray from \"../objects/PDFArray\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFNumber from \"../objects/PDFNumber\";\nimport PDFRef from \"../objects/PDFRef\";\nimport ByteStream from \"./ByteStream\";\nvar PDFXRefStreamParser = /** @class */ (function () {\n function PDFXRefStreamParser(rawStream) {\n this.alreadyParsed = false;\n this.dict = rawStream.dict;\n this.bytes = ByteStream.fromPDFRawStream(rawStream);\n this.context = this.dict.context;\n var Size = this.dict.lookup(PDFName.of('Size'), PDFNumber);\n var Index = this.dict.lookup(PDFName.of('Index'));\n if (Index instanceof PDFArray) {\n this.subsections = [];\n for (var idx = 0, len = Index.size(); idx < len; idx += 2) {\n var firstObjectNumber = Index.lookup(idx + 0, PDFNumber).asNumber();\n var length_1 = Index.lookup(idx + 1, PDFNumber).asNumber();\n this.subsections.push({ firstObjectNumber: firstObjectNumber, length: length_1 });\n }\n }\n else {\n this.subsections = [{ firstObjectNumber: 0, length: Size.asNumber() }];\n }\n var W = this.dict.lookup(PDFName.of('W'), PDFArray);\n this.byteWidths = [-1, -1, -1];\n for (var idx = 0, len = W.size(); idx < len; idx++) {\n this.byteWidths[idx] = W.lookup(idx, PDFNumber).asNumber();\n }\n }\n PDFXRefStreamParser.prototype.parseIntoContext = function () {\n if (this.alreadyParsed) {\n throw new ReparseError('PDFXRefStreamParser', 'parseIntoContext');\n }\n this.alreadyParsed = true;\n this.context.trailerInfo = {\n Root: this.dict.get(PDFName.of('Root')),\n Encrypt: this.dict.get(PDFName.of('Encrypt')),\n Info: this.dict.get(PDFName.of('Info')),\n ID: this.dict.get(PDFName.of('ID')),\n };\n var entries = this.parseEntries();\n // for (let idx = 0, len = entries.length; idx < len; idx++) {\n // const entry = entries[idx];\n // if (entry.deleted) this.context.delete(entry.ref);\n // }\n return entries;\n };\n PDFXRefStreamParser.prototype.parseEntries = function () {\n var entries = [];\n var _a = this.byteWidths, typeFieldWidth = _a[0], offsetFieldWidth = _a[1], genFieldWidth = _a[2];\n for (var subsectionIdx = 0, subsectionLen = this.subsections.length; subsectionIdx < subsectionLen; subsectionIdx++) {\n var _b = this.subsections[subsectionIdx], firstObjectNumber = _b.firstObjectNumber, length_2 = _b.length;\n for (var objIdx = 0; objIdx < length_2; objIdx++) {\n var type = 0;\n for (var idx = 0, len = typeFieldWidth; idx < len; idx++) {\n type = (type << 8) | this.bytes.next();\n }\n var offset = 0;\n for (var idx = 0, len = offsetFieldWidth; idx < len; idx++) {\n offset = (offset << 8) | this.bytes.next();\n }\n var generationNumber = 0;\n for (var idx = 0, len = genFieldWidth; idx < len; idx++) {\n generationNumber = (generationNumber << 8) | this.bytes.next();\n }\n // When the `type` field is absent, it defaults to 1\n if (typeFieldWidth === 0)\n type = 1;\n var objectNumber = firstObjectNumber + objIdx;\n var entry = {\n ref: PDFRef.of(objectNumber, generationNumber),\n offset: offset,\n deleted: type === 0,\n inObjectStream: type === 2,\n };\n entries.push(entry);\n }\n }\n return entries;\n };\n PDFXRefStreamParser.forStream = function (rawStream) {\n return new PDFXRefStreamParser(rawStream);\n };\n return PDFXRefStreamParser;\n}());\nexport default PDFXRefStreamParser;\n//# sourceMappingURL=PDFXRefStreamParser.js.map","import { __awaiter, __extends, __generator } from \"tslib\";\nimport PDFCrossRefSection from \"../document/PDFCrossRefSection\";\nimport PDFHeader from \"../document/PDFHeader\";\nimport PDFTrailer from \"../document/PDFTrailer\";\nimport { MissingKeywordError, MissingPDFHeaderError, PDFInvalidObjectParsingError, ReparseError, StalledParserError, } from \"../errors\";\nimport PDFDict from \"../objects/PDFDict\";\nimport PDFInvalidObject from \"../objects/PDFInvalidObject\";\nimport PDFName from \"../objects/PDFName\";\nimport PDFRawStream from \"../objects/PDFRawStream\";\nimport PDFRef from \"../objects/PDFRef\";\nimport ByteStream from \"./ByteStream\";\nimport PDFObjectParser from \"./PDFObjectParser\";\nimport PDFObjectStreamParser from \"./PDFObjectStreamParser\";\nimport PDFXRefStreamParser from \"./PDFXRefStreamParser\";\nimport PDFContext from \"../PDFContext\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { Keywords } from \"../syntax/Keywords\";\nimport { IsDigit } from \"../syntax/Numeric\";\nimport { waitForTick } from \"../../utils\";\nvar PDFParser = /** @class */ (function (_super) {\n __extends(PDFParser, _super);\n function PDFParser(pdfBytes, objectsPerTick, throwOnInvalidObject, capNumbers) {\n if (objectsPerTick === void 0) { objectsPerTick = Infinity; }\n if (throwOnInvalidObject === void 0) { throwOnInvalidObject = false; }\n if (capNumbers === void 0) { capNumbers = false; }\n var _this = _super.call(this, ByteStream.of(pdfBytes), PDFContext.create(), capNumbers) || this;\n _this.alreadyParsed = false;\n _this.parsedObjects = 0;\n _this.shouldWaitForTick = function () {\n _this.parsedObjects += 1;\n return _this.parsedObjects % _this.objectsPerTick === 0;\n };\n _this.objectsPerTick = objectsPerTick;\n _this.throwOnInvalidObject = throwOnInvalidObject;\n return _this;\n }\n PDFParser.prototype.parseDocument = function () {\n return __awaiter(this, void 0, void 0, function () {\n var prevOffset, offset;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.alreadyParsed) {\n throw new ReparseError('PDFParser', 'parseDocument');\n }\n this.alreadyParsed = true;\n this.context.header = this.parseHeader();\n _a.label = 1;\n case 1:\n if (!!this.bytes.done()) return [3 /*break*/, 3];\n return [4 /*yield*/, this.parseDocumentSection()];\n case 2:\n _a.sent();\n offset = this.bytes.offset();\n if (offset === prevOffset) {\n throw new StalledParserError(this.bytes.position());\n }\n prevOffset = offset;\n return [3 /*break*/, 1];\n case 3:\n this.maybeRecoverRoot();\n if (this.context.lookup(PDFRef.of(0))) {\n console.warn('Removing parsed object: 0 0 R');\n this.context.delete(PDFRef.of(0));\n }\n return [2 /*return*/, this.context];\n }\n });\n });\n };\n PDFParser.prototype.maybeRecoverRoot = function () {\n var isValidCatalog = function (obj) {\n return obj instanceof PDFDict &&\n obj.lookup(PDFName.of('Type')) === PDFName.of('Catalog');\n };\n var catalog = this.context.lookup(this.context.trailerInfo.Root);\n if (!isValidCatalog(catalog)) {\n var indirectObjects = this.context.enumerateIndirectObjects();\n for (var idx = 0, len = indirectObjects.length; idx < len; idx++) {\n var _a = indirectObjects[idx], ref = _a[0], object = _a[1];\n if (isValidCatalog(object)) {\n this.context.trailerInfo.Root = ref;\n }\n }\n }\n };\n PDFParser.prototype.parseHeader = function () {\n while (!this.bytes.done()) {\n if (this.matchKeyword(Keywords.header)) {\n var major = this.parseRawInt();\n this.bytes.assertNext(CharCodes.Period);\n var minor = this.parseRawInt();\n var header = PDFHeader.forVersion(major, minor);\n this.skipBinaryHeaderComment();\n return header;\n }\n this.bytes.next();\n }\n throw new MissingPDFHeaderError(this.bytes.position());\n };\n PDFParser.prototype.parseIndirectObjectHeader = function () {\n this.skipWhitespaceAndComments();\n var objectNumber = this.parseRawInt();\n this.skipWhitespaceAndComments();\n var generationNumber = this.parseRawInt();\n this.skipWhitespaceAndComments();\n if (!this.matchKeyword(Keywords.obj)) {\n throw new MissingKeywordError(this.bytes.position(), Keywords.obj);\n }\n return PDFRef.of(objectNumber, generationNumber);\n };\n PDFParser.prototype.matchIndirectObjectHeader = function () {\n var initialOffset = this.bytes.offset();\n try {\n this.parseIndirectObjectHeader();\n return true;\n }\n catch (e) {\n this.bytes.moveTo(initialOffset);\n return false;\n }\n };\n PDFParser.prototype.parseIndirectObject = function () {\n return __awaiter(this, void 0, void 0, function () {\n var ref, object;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n ref = this.parseIndirectObjectHeader();\n this.skipWhitespaceAndComments();\n object = this.parseObject();\n this.skipWhitespaceAndComments();\n // if (!this.matchKeyword(Keywords.endobj)) {\n // throw new MissingKeywordError(this.bytes.position(), Keywords.endobj);\n // }\n // TODO: Log a warning if this fails...\n this.matchKeyword(Keywords.endobj);\n if (!(object instanceof PDFRawStream &&\n object.dict.lookup(PDFName.of('Type')) === PDFName.of('ObjStm'))) return [3 /*break*/, 2];\n return [4 /*yield*/, PDFObjectStreamParser.forStream(object, this.shouldWaitForTick).parseIntoContext()];\n case 1:\n _a.sent();\n return [3 /*break*/, 3];\n case 2:\n if (object instanceof PDFRawStream &&\n object.dict.lookup(PDFName.of('Type')) === PDFName.of('XRef')) {\n PDFXRefStreamParser.forStream(object).parseIntoContext();\n }\n else {\n this.context.assign(ref, object);\n }\n _a.label = 3;\n case 3: return [2 /*return*/, ref];\n }\n });\n });\n };\n // TODO: Improve and clean this up\n PDFParser.prototype.tryToParseInvalidIndirectObject = function () {\n var startPos = this.bytes.position();\n var msg = \"Trying to parse invalid object: \" + JSON.stringify(startPos) + \")\";\n if (this.throwOnInvalidObject)\n throw new Error(msg);\n console.warn(msg);\n var ref = this.parseIndirectObjectHeader();\n console.warn(\"Invalid object ref: \" + ref);\n this.skipWhitespaceAndComments();\n var start = this.bytes.offset();\n var failed = true;\n while (!this.bytes.done()) {\n if (this.matchKeyword(Keywords.endobj)) {\n failed = false;\n }\n if (!failed)\n break;\n this.bytes.next();\n }\n if (failed)\n throw new PDFInvalidObjectParsingError(startPos);\n var end = this.bytes.offset() - Keywords.endobj.length;\n var object = PDFInvalidObject.of(this.bytes.slice(start, end));\n this.context.assign(ref, object);\n return ref;\n };\n PDFParser.prototype.parseIndirectObjects = function () {\n return __awaiter(this, void 0, void 0, function () {\n var initialOffset, e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this.skipWhitespaceAndComments();\n _a.label = 1;\n case 1:\n if (!(!this.bytes.done() && IsDigit[this.bytes.peek()])) return [3 /*break*/, 8];\n initialOffset = this.bytes.offset();\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, this.parseIndirectObject()];\n case 3:\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n e_1 = _a.sent();\n // TODO: Add tracing/logging mechanism to track when this happens!\n this.bytes.moveTo(initialOffset);\n this.tryToParseInvalidIndirectObject();\n return [3 /*break*/, 5];\n case 5:\n this.skipWhitespaceAndComments();\n // TODO: Can this be done only when needed, to avoid harming performance?\n this.skipJibberish();\n if (!this.shouldWaitForTick()) return [3 /*break*/, 7];\n return [4 /*yield*/, waitForTick()];\n case 6:\n _a.sent();\n _a.label = 7;\n case 7: return [3 /*break*/, 1];\n case 8: return [2 /*return*/];\n }\n });\n });\n };\n PDFParser.prototype.maybeParseCrossRefSection = function () {\n this.skipWhitespaceAndComments();\n if (!this.matchKeyword(Keywords.xref))\n return;\n this.skipWhitespaceAndComments();\n var objectNumber = -1;\n var xref = PDFCrossRefSection.createEmpty();\n while (!this.bytes.done() && IsDigit[this.bytes.peek()]) {\n var firstInt = this.parseRawInt();\n this.skipWhitespaceAndComments();\n var secondInt = this.parseRawInt();\n this.skipWhitespaceAndComments();\n var byte = this.bytes.peek();\n if (byte === CharCodes.n || byte === CharCodes.f) {\n var ref = PDFRef.of(objectNumber, secondInt);\n if (this.bytes.next() === CharCodes.n) {\n xref.addEntry(ref, firstInt);\n }\n else {\n // this.context.delete(ref);\n xref.addDeletedEntry(ref, firstInt);\n }\n objectNumber += 1;\n }\n else {\n objectNumber = firstInt;\n }\n this.skipWhitespaceAndComments();\n }\n return xref;\n };\n PDFParser.prototype.maybeParseTrailerDict = function () {\n this.skipWhitespaceAndComments();\n if (!this.matchKeyword(Keywords.trailer))\n return;\n this.skipWhitespaceAndComments();\n var dict = this.parseDict();\n var context = this.context;\n context.trailerInfo = {\n Root: dict.get(PDFName.of('Root')) || context.trailerInfo.Root,\n Encrypt: dict.get(PDFName.of('Encrypt')) || context.trailerInfo.Encrypt,\n Info: dict.get(PDFName.of('Info')) || context.trailerInfo.Info,\n ID: dict.get(PDFName.of('ID')) || context.trailerInfo.ID,\n };\n };\n PDFParser.prototype.maybeParseTrailer = function () {\n this.skipWhitespaceAndComments();\n if (!this.matchKeyword(Keywords.startxref))\n return;\n this.skipWhitespaceAndComments();\n var offset = this.parseRawInt();\n this.skipWhitespace();\n this.matchKeyword(Keywords.eof);\n this.skipWhitespaceAndComments();\n this.matchKeyword(Keywords.eof);\n this.skipWhitespaceAndComments();\n return PDFTrailer.forLastCrossRefSectionOffset(offset);\n };\n PDFParser.prototype.parseDocumentSection = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.parseIndirectObjects()];\n case 1:\n _a.sent();\n this.maybeParseCrossRefSection();\n this.maybeParseTrailerDict();\n this.maybeParseTrailer();\n // TODO: Can this be done only when needed, to avoid harming performance?\n this.skipJibberish();\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * This operation is not necessary for valid PDF files. But some invalid PDFs\n * contain jibberish in between indirect objects. This method is designed to\n * skip past that jibberish, should it exist, until it reaches the next\n * indirect object header, an xref table section, or the file trailer.\n */\n PDFParser.prototype.skipJibberish = function () {\n this.skipWhitespaceAndComments();\n while (!this.bytes.done()) {\n var initialOffset = this.bytes.offset();\n var byte = this.bytes.peek();\n var isAlphaNumeric = byte >= CharCodes.Space && byte <= CharCodes.Tilde;\n if (isAlphaNumeric) {\n if (this.matchKeyword(Keywords.xref) ||\n this.matchKeyword(Keywords.trailer) ||\n this.matchKeyword(Keywords.startxref) ||\n this.matchIndirectObjectHeader()) {\n this.bytes.moveTo(initialOffset);\n break;\n }\n }\n this.bytes.next();\n }\n };\n /**\n * Skips the binary comment following a PDF header. The specification\n * defines this binary comment (section 7.5.2 File Header) as a sequence of 4\n * or more bytes that are 128 or greater, and which are preceded by a \"%\".\n *\n * This would imply that to strip out this binary comment, we could check for\n * a sequence of bytes starting with \"%\", and remove all subsequent bytes that\n * are 128 or greater. This works for many documents that properly comply with\n * the spec. But in the wild, there are PDFs that omit the leading \"%\", and\n * include bytes that are less than 128 (e.g. 0 or 1). So in order to parse\n * these headers correctly, we just throw out all bytes leading up to the\n * first indirect object header.\n */\n PDFParser.prototype.skipBinaryHeaderComment = function () {\n this.skipWhitespaceAndComments();\n try {\n var initialOffset = this.bytes.offset();\n this.parseIndirectObjectHeader();\n this.bytes.moveTo(initialOffset);\n }\n catch (e) {\n this.bytes.next();\n this.skipWhitespaceAndComments();\n }\n };\n PDFParser.forBytesWithOptions = function (pdfBytes, objectsPerTick, throwOnInvalidObject, capNumbers) {\n return new PDFParser(pdfBytes, objectsPerTick, throwOnInvalidObject, capNumbers);\n };\n return PDFParser;\n}(PDFObjectParser));\nexport default PDFParser;\n//# sourceMappingURL=PDFParser.js.map","import { __extends } from \"tslib\";\nimport PDFObject from \"./PDFObject\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { copyStringIntoBuffer, toHexStringOfMinLength, utf16Decode, utf16Encode, pdfDocEncodingDecode, parseDate, hasUtf16BOM, } from \"../../utils\";\nimport { InvalidPDFDateStringError } from \"../errors\";\nvar PDFHexString = /** @class */ (function (_super) {\n __extends(PDFHexString, _super);\n function PDFHexString(value) {\n var _this = _super.call(this) || this;\n _this.value = value;\n return _this;\n }\n PDFHexString.prototype.asBytes = function () {\n // Append a zero if the number of digits is odd. See PDF spec 7.3.4.3\n var hex = this.value + (this.value.length % 2 === 1 ? '0' : '');\n var hexLength = hex.length;\n var bytes = new Uint8Array(hex.length / 2);\n var hexOffset = 0;\n var bytesOffset = 0;\n // Interpret each pair of hex digits as a single byte\n while (hexOffset < hexLength) {\n var byte = parseInt(hex.substring(hexOffset, hexOffset + 2), 16);\n bytes[bytesOffset] = byte;\n hexOffset += 2;\n bytesOffset += 1;\n }\n return bytes;\n };\n PDFHexString.prototype.decodeText = function () {\n var bytes = this.asBytes();\n if (hasUtf16BOM(bytes))\n return utf16Decode(bytes);\n return pdfDocEncodingDecode(bytes);\n };\n PDFHexString.prototype.decodeDate = function () {\n var text = this.decodeText();\n var date = parseDate(text);\n if (!date)\n throw new InvalidPDFDateStringError(text);\n return date;\n };\n PDFHexString.prototype.asString = function () {\n return this.value;\n };\n PDFHexString.prototype.clone = function () {\n return PDFHexString.of(this.value);\n };\n PDFHexString.prototype.toString = function () {\n return \"<\" + this.value + \">\";\n };\n PDFHexString.prototype.sizeInBytes = function () {\n return this.value.length + 2;\n };\n PDFHexString.prototype.copyBytesInto = function (buffer, offset) {\n buffer[offset++] = CharCodes.LessThan;\n offset += copyStringIntoBuffer(this.value, buffer, offset);\n buffer[offset++] = CharCodes.GreaterThan;\n return this.value.length + 2;\n };\n PDFHexString.of = function (value) { return new PDFHexString(value); };\n PDFHexString.fromText = function (value) {\n var encoded = utf16Encode(value);\n var hex = '';\n for (var idx = 0, len = encoded.length; idx < len; idx++) {\n hex += toHexStringOfMinLength(encoded[idx], 4);\n }\n return new PDFHexString(hex);\n };\n return PDFHexString;\n}(PDFObject));\nexport default PDFHexString;\n//# sourceMappingURL=PDFHexString.js.map","import { MethodNotImplementedError } from \"../errors\";\nvar PDFObject = /** @class */ (function () {\n function PDFObject() {\n }\n PDFObject.prototype.clone = function (_context) {\n throw new MethodNotImplementedError(this.constructor.name, 'clone');\n };\n PDFObject.prototype.toString = function () {\n throw new MethodNotImplementedError(this.constructor.name, 'toString');\n };\n PDFObject.prototype.sizeInBytes = function () {\n throw new MethodNotImplementedError(this.constructor.name, 'sizeInBytes');\n };\n PDFObject.prototype.copyBytesInto = function (_buffer, _offset) {\n throw new MethodNotImplementedError(this.constructor.name, 'copyBytesInto');\n };\n return PDFObject;\n}());\nexport default PDFObject;\n//# sourceMappingURL=PDFObject.js.map","import { __extends } from \"tslib\";\nimport PDFObject from \"./PDFObject\";\nimport CharCodes from \"../syntax/CharCodes\";\nimport { copyStringIntoBuffer, padStart, utf16Decode, pdfDocEncodingDecode, toCharCode, parseDate, hasUtf16BOM, } from \"../../utils\";\nimport { InvalidPDFDateStringError } from \"../errors\";\nvar PDFString = /** @class */ (function (_super) {\n __extends(PDFString, _super);\n function PDFString(value) {\n var _this = _super.call(this) || this;\n _this.value = value;\n return _this;\n }\n PDFString.prototype.asBytes = function () {\n var bytes = [];\n var octal = '';\n var escaped = false;\n var pushByte = function (byte) {\n if (byte !== undefined)\n bytes.push(byte);\n escaped = false;\n };\n for (var idx = 0, len = this.value.length; idx < len; idx++) {\n var char = this.value[idx];\n var byte = toCharCode(char);\n var nextChar = this.value[idx + 1];\n if (!escaped) {\n if (byte === CharCodes.BackSlash)\n escaped = true;\n else\n pushByte(byte);\n }\n else {\n if (byte === CharCodes.Newline)\n pushByte();\n else if (byte === CharCodes.CarriageReturn)\n pushByte();\n else if (byte === CharCodes.n)\n pushByte(CharCodes.Newline);\n else if (byte === CharCodes.r)\n pushByte(CharCodes.CarriageReturn);\n else if (byte === CharCodes.t)\n pushByte(CharCodes.Tab);\n else if (byte === CharCodes.b)\n pushByte(CharCodes.Backspace);\n else if (byte === CharCodes.f)\n pushByte(CharCodes.FormFeed);\n else if (byte === CharCodes.LeftParen)\n pushByte(CharCodes.LeftParen);\n else if (byte === CharCodes.RightParen)\n pushByte(CharCodes.RightParen);\n else if (byte === CharCodes.Backspace)\n pushByte(CharCodes.BackSlash);\n else if (byte >= CharCodes.Zero && byte <= CharCodes.Seven) {\n octal += char;\n if (octal.length === 3 || !(nextChar >= '0' && nextChar <= '7')) {\n pushByte(parseInt(octal, 8));\n octal = '';\n }\n }\n else {\n pushByte(byte);\n }\n }\n }\n return new Uint8Array(bytes);\n };\n PDFString.prototype.decodeText = function () {\n var bytes = this.asBytes();\n if (hasUtf16BOM(bytes))\n return utf16Decode(bytes);\n return pdfDocEncodingDecode(bytes);\n };\n PDFString.prototype.decodeDate = function () {\n var text = this.decodeText();\n var date = parseDate(text);\n if (!date)\n throw new InvalidPDFDateStringError(text);\n return date;\n };\n PDFString.prototype.asString = function () {\n return this.value;\n };\n PDFString.prototype.clone = function () {\n return PDFString.of(this.value);\n };\n PDFString.prototype.toString = function () {\n return \"(\" + this.value + \")\";\n };\n PDFString.prototype.sizeInBytes = function () {\n return this.value.length + 2;\n };\n PDFString.prototype.copyBytesInto = function (buffer, offset) {\n buffer[offset++] = CharCodes.LeftParen;\n offset += copyStringIntoBuffer(this.value, buffer, offset);\n buffer[offset++] = CharCodes.RightParen;\n return this.value.length + 2;\n };\n // The PDF spec allows newlines and parens to appear directly within a literal\n // string. These character _may_ be escaped. But they do not _have_ to be. So\n // for simplicity, we will not bother escaping them.\n PDFString.of = function (value) { return new PDFString(value); };\n PDFString.fromDate = function (date) {\n var year = padStart(String(date.getUTCFullYear()), 4, '0');\n var month = padStart(String(date.getUTCMonth() + 1), 2, '0');\n var day = padStart(String(date.getUTCDate()), 2, '0');\n var hours = padStart(String(date.getUTCHours()), 2, '0');\n var mins = padStart(String(date.getUTCMinutes()), 2, '0');\n var secs = padStart(String(date.getUTCSeconds()), 2, '0');\n return new PDFString(\"D:\" + year + month + day + hours + mins + secs + \"Z\");\n };\n return PDFString;\n}(PDFObject));\nexport default PDFString;\n//# sourceMappingURL=PDFString.js.map","var CharCodes;\n(function (CharCodes) {\n CharCodes[CharCodes[\"Null\"] = 0] = \"Null\";\n CharCodes[CharCodes[\"Backspace\"] = 8] = \"Backspace\";\n CharCodes[CharCodes[\"Tab\"] = 9] = \"Tab\";\n CharCodes[CharCodes[\"Newline\"] = 10] = \"Newline\";\n CharCodes[CharCodes[\"FormFeed\"] = 12] = \"FormFeed\";\n CharCodes[CharCodes[\"CarriageReturn\"] = 13] = \"CarriageReturn\";\n CharCodes[CharCodes[\"Space\"] = 32] = \"Space\";\n CharCodes[CharCodes[\"ExclamationPoint\"] = 33] = \"ExclamationPoint\";\n CharCodes[CharCodes[\"Hash\"] = 35] = \"Hash\";\n CharCodes[CharCodes[\"Percent\"] = 37] = \"Percent\";\n CharCodes[CharCodes[\"LeftParen\"] = 40] = \"LeftParen\";\n CharCodes[CharCodes[\"RightParen\"] = 41] = \"RightParen\";\n CharCodes[CharCodes[\"Plus\"] = 43] = \"Plus\";\n CharCodes[CharCodes[\"Minus\"] = 45] = \"Minus\";\n CharCodes[CharCodes[\"Dash\"] = 45] = \"Dash\";\n CharCodes[CharCodes[\"Period\"] = 46] = \"Period\";\n CharCodes[CharCodes[\"ForwardSlash\"] = 47] = \"ForwardSlash\";\n CharCodes[CharCodes[\"Zero\"] = 48] = \"Zero\";\n CharCodes[CharCodes[\"One\"] = 49] = \"One\";\n CharCodes[CharCodes[\"Two\"] = 50] = \"Two\";\n CharCodes[CharCodes[\"Three\"] = 51] = \"Three\";\n CharCodes[CharCodes[\"Four\"] = 52] = \"Four\";\n CharCodes[CharCodes[\"Five\"] = 53] = \"Five\";\n CharCodes[CharCodes[\"Six\"] = 54] = \"Six\";\n CharCodes[CharCodes[\"Seven\"] = 55] = \"Seven\";\n CharCodes[CharCodes[\"Eight\"] = 56] = \"Eight\";\n CharCodes[CharCodes[\"Nine\"] = 57] = \"Nine\";\n CharCodes[CharCodes[\"LessThan\"] = 60] = \"LessThan\";\n CharCodes[CharCodes[\"GreaterThan\"] = 62] = \"GreaterThan\";\n CharCodes[CharCodes[\"A\"] = 65] = \"A\";\n CharCodes[CharCodes[\"D\"] = 68] = \"D\";\n CharCodes[CharCodes[\"E\"] = 69] = \"E\";\n CharCodes[CharCodes[\"F\"] = 70] = \"F\";\n CharCodes[CharCodes[\"O\"] = 79] = \"O\";\n CharCodes[CharCodes[\"P\"] = 80] = \"P\";\n CharCodes[CharCodes[\"R\"] = 82] = \"R\";\n CharCodes[CharCodes[\"LeftSquareBracket\"] = 91] = \"LeftSquareBracket\";\n CharCodes[CharCodes[\"BackSlash\"] = 92] = \"BackSlash\";\n CharCodes[CharCodes[\"RightSquareBracket\"] = 93] = \"RightSquareBracket\";\n CharCodes[CharCodes[\"a\"] = 97] = \"a\";\n CharCodes[CharCodes[\"b\"] = 98] = \"b\";\n CharCodes[CharCodes[\"d\"] = 100] = \"d\";\n CharCodes[CharCodes[\"e\"] = 101] = \"e\";\n CharCodes[CharCodes[\"f\"] = 102] = \"f\";\n CharCodes[CharCodes[\"i\"] = 105] = \"i\";\n CharCodes[CharCodes[\"j\"] = 106] = \"j\";\n CharCodes[CharCodes[\"l\"] = 108] = \"l\";\n CharCodes[CharCodes[\"m\"] = 109] = \"m\";\n CharCodes[CharCodes[\"n\"] = 110] = \"n\";\n CharCodes[CharCodes[\"o\"] = 111] = \"o\";\n CharCodes[CharCodes[\"r\"] = 114] = \"r\";\n CharCodes[CharCodes[\"s\"] = 115] = \"s\";\n CharCodes[CharCodes[\"t\"] = 116] = \"t\";\n CharCodes[CharCodes[\"u\"] = 117] = \"u\";\n CharCodes[CharCodes[\"x\"] = 120] = \"x\";\n CharCodes[CharCodes[\"LeftCurly\"] = 123] = \"LeftCurly\";\n CharCodes[CharCodes[\"RightCurly\"] = 125] = \"RightCurly\";\n CharCodes[CharCodes[\"Tilde\"] = 126] = \"Tilde\";\n})(CharCodes || (CharCodes = {}));\nexport default CharCodes;\n//# sourceMappingURL=CharCodes.js.map","/*\n * The `chars`, `lookup`, `encode`, and `decode` members of this file are\n * licensed under the following:\n *\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n *\n */\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n// Use a lookup table to find the index.\nvar lookup = new Uint8Array(256);\nfor (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n}\nexport var encodeToBase64 = function (bytes) {\n var base64 = '';\n var len = bytes.length;\n for (var i = 0; i < len; i += 3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + '=';\n }\n else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + '==';\n }\n return base64;\n};\nexport var decodeFromBase64 = function (base64) {\n var bufferLength = base64.length * 0.75;\n var len = base64.length;\n var i;\n var p = 0;\n var encoded1;\n var encoded2;\n var encoded3;\n var encoded4;\n if (base64[base64.length - 1] === '=') {\n bufferLength--;\n if (base64[base64.length - 2] === '=') {\n bufferLength--;\n }\n }\n var bytes = new Uint8Array(bufferLength);\n for (i = 0; i < len; i += 4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i + 1)];\n encoded3 = lookup[base64.charCodeAt(i + 2)];\n encoded4 = lookup[base64.charCodeAt(i + 3)];\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n return bytes;\n};\n// This regex is designed to be as flexible as possible. It will parse certain\n// invalid data URIs.\nvar DATA_URI_PREFIX_REGEX = /^(data)?:?([\\w\\/\\+]+)?;?(charset=[\\w-]+|base64)?.*,/i;\n/**\n * If the `dataUri` input is a data URI, then the data URI prefix must not be\n * longer than 100 characters, or this function will fail to decode it.\n *\n * @param dataUri a base64 data URI or plain base64 string\n * @returns a Uint8Array containing the decoded input\n */\nexport var decodeFromBase64DataUri = function (dataUri) {\n var trimmedUri = dataUri.trim();\n var prefix = trimmedUri.substring(0, 100);\n var res = prefix.match(DATA_URI_PREFIX_REGEX);\n // Assume it's not a data URI - just a plain base64 string\n if (!res)\n return decodeFromBase64(trimmedUri);\n // Remove the data URI prefix and parse the remainder as a base64 string\n var fullMatch = res[0];\n var data = trimmedUri.substring(fullMatch.length);\n return decodeFromBase64(data);\n};\n//# sourceMappingURL=base64.js.map","import { toCharCode } from \"./strings\";\n// Mapping from PDFDocEncoding to Unicode code point\nvar pdfDocEncodingToUnicode = new Uint16Array(256);\n// Initialize the code points which are the same\nfor (var idx = 0; idx < 256; idx++) {\n pdfDocEncodingToUnicode[idx] = idx;\n}\n// Set differences (see \"Table D.2 – PDFDocEncoding Character Set\" of the PDF spec)\npdfDocEncodingToUnicode[0x16] = toCharCode('\\u0017'); // SYNCRONOUS IDLE\npdfDocEncodingToUnicode[0x18] = toCharCode('\\u02D8'); // BREVE\npdfDocEncodingToUnicode[0x19] = toCharCode('\\u02C7'); // CARON\npdfDocEncodingToUnicode[0x1a] = toCharCode('\\u02C6'); // MODIFIER LETTER CIRCUMFLEX ACCENT\npdfDocEncodingToUnicode[0x1b] = toCharCode('\\u02D9'); // DOT ABOVE\npdfDocEncodingToUnicode[0x1c] = toCharCode('\\u02DD'); // DOUBLE ACUTE ACCENT\npdfDocEncodingToUnicode[0x1d] = toCharCode('\\u02DB'); // OGONEK\npdfDocEncodingToUnicode[0x1e] = toCharCode('\\u02DA'); // RING ABOVE\npdfDocEncodingToUnicode[0x1f] = toCharCode('\\u02DC'); // SMALL TILDE\npdfDocEncodingToUnicode[0x7f] = toCharCode('\\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark)\npdfDocEncodingToUnicode[0x80] = toCharCode('\\u2022'); // BULLET\npdfDocEncodingToUnicode[0x81] = toCharCode('\\u2020'); // DAGGER\npdfDocEncodingToUnicode[0x82] = toCharCode('\\u2021'); // DOUBLE DAGGER\npdfDocEncodingToUnicode[0x83] = toCharCode('\\u2026'); // HORIZONTAL ELLIPSIS\npdfDocEncodingToUnicode[0x84] = toCharCode('\\u2014'); // EM DASH\npdfDocEncodingToUnicode[0x85] = toCharCode('\\u2013'); // EN DASH\npdfDocEncodingToUnicode[0x86] = toCharCode('\\u0192'); // LATIN SMALL LETTER SCRIPT F\npdfDocEncodingToUnicode[0x87] = toCharCode('\\u2044'); // FRACTION SLASH (solidus)\npdfDocEncodingToUnicode[0x88] = toCharCode('\\u2039'); // SINGLE LEFT-POINTING ANGLE QUOTATION MARK\npdfDocEncodingToUnicode[0x89] = toCharCode('\\u203A'); // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK\npdfDocEncodingToUnicode[0x8a] = toCharCode('\\u2212'); // MINUS SIGN\npdfDocEncodingToUnicode[0x8b] = toCharCode('\\u2030'); // PER MILLE SIGN\npdfDocEncodingToUnicode[0x8c] = toCharCode('\\u201E'); // DOUBLE LOW-9 QUOTATION MARK (quotedblbase)\npdfDocEncodingToUnicode[0x8d] = toCharCode('\\u201C'); // LEFT DOUBLE QUOTATION MARK (quotedblleft)\npdfDocEncodingToUnicode[0x8e] = toCharCode('\\u201D'); // RIGHT DOUBLE QUOTATION MARK (quotedblright)\npdfDocEncodingToUnicode[0x8f] = toCharCode('\\u2018'); // LEFT SINGLE QUOTATION MARK (quoteleft)\npdfDocEncodingToUnicode[0x90] = toCharCode('\\u2019'); // RIGHT SINGLE QUOTATION MARK (quoteright)\npdfDocEncodingToUnicode[0x91] = toCharCode('\\u201A'); // SINGLE LOW-9 QUOTATION MARK (quotesinglbase)\npdfDocEncodingToUnicode[0x92] = toCharCode('\\u2122'); // TRADE MARK SIGN\npdfDocEncodingToUnicode[0x93] = toCharCode('\\uFB01'); // LATIN SMALL LIGATURE FI\npdfDocEncodingToUnicode[0x94] = toCharCode('\\uFB02'); // LATIN SMALL LIGATURE FL\npdfDocEncodingToUnicode[0x95] = toCharCode('\\u0141'); // LATIN CAPITAL LETTER L WITH STROKE\npdfDocEncodingToUnicode[0x96] = toCharCode('\\u0152'); // LATIN CAPITAL LIGATURE OE\npdfDocEncodingToUnicode[0x97] = toCharCode('\\u0160'); // LATIN CAPITAL LETTER S WITH CARON\npdfDocEncodingToUnicode[0x98] = toCharCode('\\u0178'); // LATIN CAPITAL LETTER Y WITH DIAERESIS\npdfDocEncodingToUnicode[0x99] = toCharCode('\\u017D'); // LATIN CAPITAL LETTER Z WITH CARON\npdfDocEncodingToUnicode[0x9a] = toCharCode('\\u0131'); // LATIN SMALL LETTER DOTLESS I\npdfDocEncodingToUnicode[0x9b] = toCharCode('\\u0142'); // LATIN SMALL LETTER L WITH STROKE\npdfDocEncodingToUnicode[0x9c] = toCharCode('\\u0153'); // LATIN SMALL LIGATURE OE\npdfDocEncodingToUnicode[0x9d] = toCharCode('\\u0161'); // LATIN SMALL LETTER S WITH CARON\npdfDocEncodingToUnicode[0x9e] = toCharCode('\\u017E'); // LATIN SMALL LETTER Z WITH CARON\npdfDocEncodingToUnicode[0x9f] = toCharCode('\\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark)\npdfDocEncodingToUnicode[0xa0] = toCharCode('\\u20AC'); // EURO SIGN\npdfDocEncodingToUnicode[0xad] = toCharCode('\\uFFFD'); // REPLACEMENT CHARACTER (box with questionmark)\n/**\n * Decode a byte array into a string using PDFDocEncoding.\n *\n * @param bytes a byte array (decimal representation) containing a string\n * encoded with PDFDocEncoding.\n */\nexport var pdfDocEncodingDecode = function (bytes) {\n var codePoints = new Array(bytes.length);\n for (var idx = 0, len = bytes.length; idx < len; idx++) {\n codePoints[idx] = pdfDocEncodingToUnicode[bytes[idx]];\n }\n return String.fromCodePoint.apply(String, codePoints);\n};\n//# sourceMappingURL=pdfDocEncoding.js.map","import { decodeFromBase64DataUri } from \"./base64\";\nimport { charFromCode } from \"./strings\";\nexport var last = function (array) { return array[array.length - 1]; };\n// export const dropLast = (array: T[]): T[] =>\n// array.slice(0, array.length - 1);\nexport var typedArrayFor = function (value) {\n if (value instanceof Uint8Array)\n return value;\n var length = value.length;\n var typedArray = new Uint8Array(length);\n for (var idx = 0; idx < length; idx++) {\n typedArray[idx] = value.charCodeAt(idx);\n }\n return typedArray;\n};\nexport var mergeIntoTypedArray = function () {\n var arrays = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n arrays[_i] = arguments[_i];\n }\n var arrayCount = arrays.length;\n var typedArrays = [];\n for (var idx = 0; idx < arrayCount; idx++) {\n var element = arrays[idx];\n typedArrays[idx] =\n element instanceof Uint8Array ? element : typedArrayFor(element);\n }\n var totalSize = 0;\n for (var idx = 0; idx < arrayCount; idx++) {\n totalSize += arrays[idx].length;\n }\n var merged = new Uint8Array(totalSize);\n var offset = 0;\n for (var arrIdx = 0; arrIdx < arrayCount; arrIdx++) {\n var arr = typedArrays[arrIdx];\n for (var byteIdx = 0, arrLen = arr.length; byteIdx < arrLen; byteIdx++) {\n merged[offset++] = arr[byteIdx];\n }\n }\n return merged;\n};\nexport var mergeUint8Arrays = function (arrays) {\n var totalSize = 0;\n for (var idx = 0, len = arrays.length; idx < len; idx++) {\n totalSize += arrays[idx].length;\n }\n var mergedBuffer = new Uint8Array(totalSize);\n var offset = 0;\n for (var idx = 0, len = arrays.length; idx < len; idx++) {\n var array = arrays[idx];\n mergedBuffer.set(array, offset);\n offset += array.length;\n }\n return mergedBuffer;\n};\nexport var arrayAsString = function (array) {\n var str = '';\n for (var idx = 0, len = array.length; idx < len; idx++) {\n str += charFromCode(array[idx]);\n }\n return str;\n};\nexport var byAscendingId = function (a, b) { return a.id - b.id; };\nexport var sortedUniq = function (array, indexer) {\n var uniq = [];\n for (var idx = 0, len = array.length; idx < len; idx++) {\n var curr = array[idx];\n var prev = array[idx - 1];\n if (idx === 0 || indexer(curr) !== indexer(prev)) {\n uniq.push(curr);\n }\n }\n return uniq;\n};\n// Arrays and TypedArrays in JS both have .reverse() methods, which would seem\n// to negate the need for this function. However, not all runtimes support this\n// method (e.g. React Native). This function compensates for that fact.\nexport var reverseArray = function (array) {\n var arrayLen = array.length;\n for (var idx = 0, len = Math.floor(arrayLen / 2); idx < len; idx++) {\n var leftIdx = idx;\n var rightIdx = arrayLen - idx - 1;\n var temp = array[idx];\n array[leftIdx] = array[rightIdx];\n array[rightIdx] = temp;\n }\n return array;\n};\nexport var sum = function (array) {\n var total = 0;\n for (var idx = 0, len = array.length; idx < len; idx++) {\n total += array[idx];\n }\n return total;\n};\nexport var range = function (start, end) {\n var arr = new Array(end - start);\n for (var idx = 0, len = arr.length; idx < len; idx++) {\n arr[idx] = start + idx;\n }\n return arr;\n};\nexport var pluckIndices = function (arr, indices) {\n var plucked = new Array(indices.length);\n for (var idx = 0, len = indices.length; idx < len; idx++) {\n plucked[idx] = arr[indices[idx]];\n }\n return plucked;\n};\nexport var canBeConvertedToUint8Array = function (input) {\n return input instanceof Uint8Array ||\n input instanceof ArrayBuffer ||\n typeof input === 'string';\n};\nexport var toUint8Array = function (input) {\n if (typeof input === 'string') {\n return decodeFromBase64DataUri(input);\n }\n else if (input instanceof ArrayBuffer) {\n return new Uint8Array(input);\n }\n else if (input instanceof Uint8Array) {\n return input;\n }\n else {\n throw new TypeError('`input` must be one of `string | ArrayBuffer | Uint8Array`');\n }\n};\n//# sourceMappingURL=arrays.js.map","/**\n * Returns a Promise that resolves after at least one tick of the\n * Macro Task Queue occurs.\n */\nexport var waitForTick = function () {\n return new Promise(function (resolve) {\n setTimeout(function () { return resolve(); }, 0);\n });\n};\n//# sourceMappingURL=async.js.map","// tslint:disable radix\n/**\n * Converts a number to its string representation in decimal. This function\n * differs from simply converting a number to a string with `.toString()`\n * because this function's output string will **not** contain exponential\n * notation.\n *\n * Credit: https://stackoverflow.com/a/46545519\n */\nexport var numberToString = function (num) {\n var numStr = String(num);\n if (Math.abs(num) < 1.0) {\n var e = parseInt(num.toString().split('e-')[1]);\n if (e) {\n var negative = num < 0;\n if (negative)\n num *= -1;\n num *= Math.pow(10, e - 1);\n numStr = '0.' + new Array(e).join('0') + num.toString().substring(2);\n if (negative)\n numStr = '-' + numStr;\n }\n }\n else {\n var e = parseInt(num.toString().split('+')[1]);\n if (e > 20) {\n e -= 20;\n num /= Math.pow(10, e);\n numStr = num.toString() + new Array(e + 1).join('0');\n }\n }\n return numStr;\n};\nexport var sizeInBytes = function (n) { return Math.ceil(n.toString(2).length / 8); };\n/**\n * Converts a number into its constituent bytes and returns them as\n * a number[].\n *\n * Returns most significant byte as first element in array. It may be necessary\n * to call .reverse() to get the bits in the desired order.\n *\n * Example:\n * bytesFor(0x02A41E) => [ 0b10, 0b10100100, 0b11110 ]\n *\n * Credit for algorithm: https://stackoverflow.com/a/1936865\n */\nexport var bytesFor = function (n) {\n var bytes = new Uint8Array(sizeInBytes(n));\n for (var i = 1; i <= bytes.length; i++) {\n bytes[i - 1] = n >> ((bytes.length - i) * 8);\n }\n return bytes;\n};\n//# sourceMappingURL=numbers.js.map","export var error = function (msg) {\n throw new Error(msg);\n};\n//# sourceMappingURL=errors.js.map","import { FontNames } from '@pdf-lib/standard-fonts';\nexport var values = function (obj) { return Object.keys(obj).map(function (k) { return obj[k]; }); };\nexport var StandardFontValues = values(FontNames);\nexport var isStandardFont = function (input) {\n return StandardFontValues.includes(input);\n};\nexport var rectanglesAreEqual = function (a, b) { return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; };\n//# sourceMappingURL=objects.js.map","/* tslint:disable:ban-types */\nimport { values as objectValues } from \"./objects\";\nexport var backtick = function (val) { return \"`\" + val + \"`\"; };\nexport var singleQuote = function (val) { return \"'\" + val + \"'\"; };\n// prettier-ignore\nvar formatValue = function (value) {\n var type = typeof value;\n if (type === 'string')\n return singleQuote(value);\n else if (type === 'undefined')\n return backtick(value);\n else\n return value;\n};\nexport var createValueErrorMsg = function (value, valueName, values) {\n var allowedValues = new Array(values.length);\n for (var idx = 0, len = values.length; idx < len; idx++) {\n var v = values[idx];\n allowedValues[idx] = formatValue(v);\n }\n var joinedValues = allowedValues.join(' or ');\n // prettier-ignore\n return backtick(valueName) + \" must be one of \" + joinedValues + \", but was actually \" + formatValue(value);\n};\nexport var assertIsOneOf = function (value, valueName, allowedValues) {\n if (!Array.isArray(allowedValues)) {\n allowedValues = objectValues(allowedValues);\n }\n for (var idx = 0, len = allowedValues.length; idx < len; idx++) {\n if (value === allowedValues[idx])\n return;\n }\n throw new TypeError(createValueErrorMsg(value, valueName, allowedValues));\n};\nexport var assertIsOneOfOrUndefined = function (value, valueName, allowedValues) {\n if (!Array.isArray(allowedValues)) {\n allowedValues = objectValues(allowedValues);\n }\n assertIsOneOf(value, valueName, allowedValues.concat(undefined));\n};\nexport var assertIsSubset = function (values, valueName, allowedValues) {\n if (!Array.isArray(allowedValues)) {\n allowedValues = objectValues(allowedValues);\n }\n for (var idx = 0, len = values.length; idx < len; idx++) {\n assertIsOneOf(values[idx], valueName, allowedValues);\n }\n};\nexport var getType = function (val) {\n if (val === null)\n return 'null';\n if (val === undefined)\n return 'undefined';\n if (typeof val === 'string')\n return 'string';\n if (isNaN(val))\n return 'NaN';\n if (typeof val === 'number')\n return 'number';\n if (typeof val === 'boolean')\n return 'boolean';\n if (typeof val === 'symbol')\n return 'symbol';\n if (typeof val === 'bigint')\n return 'bigint';\n if (val.constructor && val.constructor.name)\n return val.constructor.name;\n if (val.name)\n return val.name;\n if (val.constructor)\n return String(val.constructor);\n return String(val);\n};\nexport var isType = function (value, type) {\n if (type === 'null')\n return value === null;\n if (type === 'undefined')\n return value === undefined;\n if (type === 'string')\n return typeof value === 'string';\n if (type === 'number')\n return typeof value === 'number' && !isNaN(value);\n if (type === 'boolean')\n return typeof value === 'boolean';\n if (type === 'symbol')\n return typeof value === 'symbol';\n if (type === 'bigint')\n return typeof value === 'bigint';\n if (type === Date)\n return value instanceof Date;\n if (type === Array)\n return value instanceof Array;\n if (type === Uint8Array)\n return value instanceof Uint8Array;\n if (type === ArrayBuffer)\n return value instanceof ArrayBuffer;\n if (type === Function)\n return value instanceof Function;\n return value instanceof type[0];\n};\nexport var createTypeErrorMsg = function (value, valueName, types) {\n var allowedTypes = new Array(types.length);\n for (var idx = 0, len = types.length; idx < len; idx++) {\n var type = types[idx];\n if (type === 'null')\n allowedTypes[idx] = backtick('null');\n if (type === 'undefined')\n allowedTypes[idx] = backtick('undefined');\n if (type === 'string')\n allowedTypes[idx] = backtick('string');\n else if (type === 'number')\n allowedTypes[idx] = backtick('number');\n else if (type === 'boolean')\n allowedTypes[idx] = backtick('boolean');\n else if (type === 'symbol')\n allowedTypes[idx] = backtick('symbol');\n else if (type === 'bigint')\n allowedTypes[idx] = backtick('bigint');\n else if (type === Array)\n allowedTypes[idx] = backtick('Array');\n else if (type === Uint8Array)\n allowedTypes[idx] = backtick('Uint8Array');\n else if (type === ArrayBuffer)\n allowedTypes[idx] = backtick('ArrayBuffer');\n else\n allowedTypes[idx] = backtick(type[1]);\n }\n var joinedTypes = allowedTypes.join(' or ');\n // prettier-ignore\n return backtick(valueName) + \" must be of type \" + joinedTypes + \", but was actually of type \" + backtick(getType(value));\n};\nexport var assertIs = function (value, valueName, types) {\n for (var idx = 0, len = types.length; idx < len; idx++) {\n if (isType(value, types[idx]))\n return;\n }\n throw new TypeError(createTypeErrorMsg(value, valueName, types));\n};\nexport var assertOrUndefined = function (value, valueName, types) {\n assertIs(value, valueName, types.concat('undefined'));\n};\nexport var assertEachIs = function (values, valueName, types) {\n for (var idx = 0, len = values.length; idx < len; idx++) {\n assertIs(values[idx], valueName, types);\n }\n};\nexport var assertRange = function (value, valueName, min, max) {\n assertIs(value, valueName, ['number']);\n assertIs(min, 'min', ['number']);\n assertIs(max, 'max', ['number']);\n max = Math.max(min, max);\n if (value < min || value > max) {\n // prettier-ignore\n throw new Error(backtick(valueName) + \" must be at least \" + min + \" and at most \" + max + \", but was actually \" + value);\n }\n};\nexport var assertRangeOrUndefined = function (value, valueName, min, max) {\n assertIs(value, valueName, ['number', 'undefined']);\n if (typeof value === 'number')\n assertRange(value, valueName, min, max);\n};\nexport var assertMultiple = function (value, valueName, multiplier) {\n assertIs(value, valueName, ['number']);\n if (value % multiplier !== 0) {\n // prettier-ignore\n throw new Error(backtick(valueName) + \" must be a multiple of \" + multiplier + \", but was actually \" + value);\n }\n};\nexport var assertInteger = function (value, valueName) {\n if (!Number.isInteger(value)) {\n throw new Error(backtick(valueName) + \" must be an integer, but was actually \" + value);\n }\n};\nexport var assertPositive = function (value, valueName) {\n if (![1, 0].includes(Math.sign(value))) {\n // prettier-ignore\n throw new Error(backtick(valueName) + \" must be a positive number or 0, but was actually \" + value);\n }\n};\n//# sourceMappingURL=validators.js.map","var Cache = /** @class */ (function () {\n function Cache(populate) {\n this.populate = populate;\n this.value = undefined;\n }\n Cache.prototype.getValue = function () {\n return this.value;\n };\n Cache.prototype.access = function () {\n if (!this.value)\n this.value = this.populate();\n return this.value;\n };\n Cache.prototype.invalidate = function () {\n this.value = undefined;\n };\n Cache.populatedBy = function (populate) { return new Cache(populate); };\n return Cache;\n}());\nexport default Cache;\n//# sourceMappingURL=Cache.js.map","export var toCharCode = function (character) { return character.charCodeAt(0); };\nexport var toCodePoint = function (character) { return character.codePointAt(0); };\nexport var toHexStringOfMinLength = function (num, minLength) {\n return padStart(num.toString(16), minLength, '0').toUpperCase();\n};\nexport var toHexString = function (num) { return toHexStringOfMinLength(num, 2); };\nexport var charFromCode = function (code) { return String.fromCharCode(code); };\nexport var charFromHexCode = function (hex) { return charFromCode(parseInt(hex, 16)); };\nexport var padStart = function (value, length, padChar) {\n var padding = '';\n for (var idx = 0, len = length - value.length; idx < len; idx++) {\n padding += padChar;\n }\n return padding + value;\n};\nexport var copyStringIntoBuffer = function (str, buffer, offset) {\n var length = str.length;\n for (var idx = 0; idx < length; idx++) {\n buffer[offset++] = str.charCodeAt(idx);\n }\n return length;\n};\nexport var addRandomSuffix = function (prefix, suffixLength) {\n if (suffixLength === void 0) { suffixLength = 4; }\n return prefix + \"-\" + Math.floor(Math.random() * Math.pow(10, suffixLength));\n};\nexport var escapeRegExp = function (str) {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n};\nexport var cleanText = function (text) {\n return text.replace(/\\t|\\u0085|\\u2028|\\u2029/g, ' ').replace(/[\\b\\v]/g, '');\n};\nexport var escapedNewlineChars = ['\\\\n', '\\\\f', '\\\\r', '\\\\u000B'];\nexport var newlineChars = ['\\n', '\\f', '\\r', '\\u000B'];\nexport var isNewlineChar = function (text) { return /^[\\n\\f\\r\\u000B]$/.test(text); };\nexport var lineSplit = function (text) { return text.split(/[\\n\\f\\r\\u000B]/); };\nexport var mergeLines = function (text) {\n return text.replace(/[\\n\\f\\r\\u000B]/g, ' ');\n};\n// JavaScript's String.charAt() method doesn work on strings containing UTF-16\n// characters (with high and low surrogate pairs), such as 💩 (poo emoji). This\n// `charAtIndex()` function does.\n//\n// Credit: https://github.com/mathiasbynens/String.prototype.at/blob/master/at.js#L14-L48\nexport var charAtIndex = function (text, index) {\n // Get the first code unit and code unit value\n var cuFirst = text.charCodeAt(index);\n var cuSecond;\n var nextIndex = index + 1;\n var length = 1;\n if (\n // Check if it's the start of a surrogate pair.\n cuFirst >= 0xd800 &&\n cuFirst <= 0xdbff && // high surrogate\n text.length > nextIndex // there is a next code unit\n ) {\n cuSecond = text.charCodeAt(nextIndex);\n if (cuSecond >= 0xdc00 && cuSecond <= 0xdfff)\n length = 2; // low surrogate\n }\n return [text.slice(index, index + length), length];\n};\nexport var charSplit = function (text) {\n var chars = [];\n for (var idx = 0, len = text.length; idx < len;) {\n var _a = charAtIndex(text, idx), c = _a[0], cLen = _a[1];\n chars.push(c);\n idx += cLen;\n }\n return chars;\n};\nvar buildWordBreakRegex = function (wordBreaks) {\n var newlineCharUnion = escapedNewlineChars.join('|');\n var escapedRules = ['$'];\n for (var idx = 0, len = wordBreaks.length; idx < len; idx++) {\n var wordBreak = wordBreaks[idx];\n if (isNewlineChar(wordBreak)) {\n throw new TypeError(\"`wordBreak` must not include \" + newlineCharUnion);\n }\n escapedRules.push(wordBreak === '' ? '.' : escapeRegExp(wordBreak));\n }\n var breakRules = escapedRules.join('|');\n return new RegExp(\"(\" + newlineCharUnion + \")|((.*?)(\" + breakRules + \"))\", 'gm');\n};\nexport var breakTextIntoLines = function (text, wordBreaks, maxWidth, computeWidthOfText) {\n var regex = buildWordBreakRegex(wordBreaks);\n var words = cleanText(text).match(regex);\n var currLine = '';\n var currWidth = 0;\n var lines = [];\n var pushCurrLine = function () {\n if (currLine !== '')\n lines.push(currLine);\n currLine = '';\n currWidth = 0;\n };\n for (var idx = 0, len = words.length; idx < len; idx++) {\n var word = words[idx];\n if (isNewlineChar(word)) {\n pushCurrLine();\n }\n else {\n var width = computeWidthOfText(word);\n if (currWidth + width > maxWidth)\n pushCurrLine();\n currLine += word;\n currWidth += width;\n }\n }\n pushCurrLine();\n return lines;\n};\n// See section \"7.9.4 Dates\" of the PDF specification\nvar dateRegex = /^D:(\\d\\d\\d\\d)(\\d\\d)?(\\d\\d)?(\\d\\d)?(\\d\\d)?(\\d\\d)?([+\\-Z])?(\\d\\d)?'?(\\d\\d)?'?$/;\nexport var parseDate = function (dateStr) {\n var match = dateStr.match(dateRegex);\n if (!match)\n return undefined;\n 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;\n // http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15\n var tzOffset = offsetSign === 'Z' ? 'Z' : \"\" + offsetSign + offsetHours + \":\" + offsetMins;\n var date = new Date(year + \"-\" + month + \"-\" + day + \"T\" + hours + \":\" + mins + \":\" + secs + tzOffset);\n return date;\n};\nexport var findLastMatch = function (value, regex) {\n var _a;\n var position = 0;\n var lastMatch;\n while (position < value.length) {\n var match = value.substring(position).match(regex);\n if (!match)\n return { match: lastMatch, pos: position };\n lastMatch = match;\n position += ((_a = match.index) !== null && _a !== void 0 ? _a : 0) + match[0].length;\n }\n return { match: lastMatch, pos: position };\n};\n//# sourceMappingURL=strings.js.map","import { toHexString } from \"./strings\";\n/**\n * Encodes a string to UTF-8.\n *\n * @param input The string to be encoded.\n * @param byteOrderMark Whether or not a byte order marker (BOM) should be added\n * to the start of the encoding. (default `true`)\n * @returns A Uint8Array containing the UTF-8 encoding of the input string.\n *\n * -----------------------------------------------------------------------------\n *\n * JavaScript strings are composed of Unicode code points. Code points are\n * integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string,\n * it must be encoded as a sequence of words. A word is typically 8, 16, or 32\n * bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16,\n * and UTF-32. These encoding forms are described in the Unicode standard [1].\n * This function implements the UTF-8 encoding form.\n *\n * -----------------------------------------------------------------------------\n *\n * In UTF-8, each code point is mapped to a sequence of 1, 2, 3, or 4 bytes.\n * Note that the logic which defines this mapping is slightly convoluted, and\n * not as straightforward as the mapping logic for UTF-16 or UTF-32. The UTF-8\n * mapping logic is as follows [2]:\n *\n * • If a code point is in the range U+0000..U+007F, then view it as a 7-bit\n * integer: 0bxxxxxxx. Map the code point to 1 byte with the first high order\n * bit set to 0:\n *\n * b1=0b0xxxxxxx\n *\n * • If a code point is in the range U+0080..U+07FF, then view it as an 11-bit\n * integer: 0byyyyyxxxxxx. Map the code point to 2 bytes with the first 5 bits\n * of the code point stored in the first byte, and the last 6 bits stored in\n * the second byte:\n *\n * b1=0b110yyyyy b2=0b10xxxxxx\n *\n * • If a code point is in the range U+0800..U+FFFF, then view it as a 16-bit\n * integer, 0bzzzzyyyyyyxxxxxx. Map the code point to 3 bytes with the first\n * 4 bits stored in the first byte, the next 6 bits stored in the second byte,\n * and the last 6 bits in the third byte:\n *\n * b1=0b1110zzzz b2=0b10yyyyyy b3=0b10xxxxxx\n *\n * • If a code point is in the range U+10000...U+10FFFF, then view it as a\n * 21-bit integer, 0bvvvzzzzzzyyyyyyxxxxxx. Map the code point to 4 bytes with\n * the first 3 bits stored in the first byte, the next 6 bits stored in the\n * second byte, the next 6 bits stored in the third byte, and the last 6 bits\n * stored in the fourth byte:\n *\n * b1=0b11110xxx b2=0b10zzzzzz b3=0b10yyyyyy b4=0b10xxxxxx\n *\n * -----------------------------------------------------------------------------\n *\n * It is important to note, when iterating through the code points of a string\n * in JavaScript, that if a character is encoded as a surrogate pair it will\n * increase the string's length by 2 instead of 1 [4]. For example:\n *\n * ```\n * > 'a'.length\n * 1\n * > '💩'.length\n * 2\n * > '語'.length\n * 1\n * > 'a💩語'.length\n * 4\n * ```\n *\n * The results of the above example are explained by the fact that the\n * characters 'a' and '語' are not represented by surrogate pairs, but '💩' is.\n *\n * Because of this idiosyncrasy in JavaScript's string implementation and APIs,\n * we must \"jump\" an extra index after encoding a character as a surrogate\n * pair. In practice, this means we must increment the index of our for loop by\n * 2 if we encode a surrogate pair, and 1 in all other cases.\n *\n * -----------------------------------------------------------------------------\n *\n * References:\n * - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf\n * 3.9 Unicode Encoding Forms - UTF-8\n * - [2] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding.html\n * - [3] http://www.herongyang.com/Unicode/UTF-8-UTF-8-Encoding-Algorithm.html\n * - [4] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description\n *\n */\nexport var utf8Encode = function (input, byteOrderMark) {\n if (byteOrderMark === void 0) { byteOrderMark = true; }\n var encoded = [];\n if (byteOrderMark)\n encoded.push(0xef, 0xbb, 0xbf);\n for (var idx = 0, len = input.length; idx < len;) {\n var codePoint = input.codePointAt(idx);\n // One byte encoding\n if (codePoint < 0x80) {\n var byte1 = codePoint & 0x7f;\n encoded.push(byte1);\n idx += 1;\n }\n // Two byte encoding\n else if (codePoint < 0x0800) {\n var byte1 = ((codePoint >> 6) & 0x1f) | 0xc0;\n var byte2 = (codePoint & 0x3f) | 0x80;\n encoded.push(byte1, byte2);\n idx += 1;\n }\n // Three byte encoding\n else if (codePoint < 0x010000) {\n var byte1 = ((codePoint >> 12) & 0x0f) | 0xe0;\n var byte2 = ((codePoint >> 6) & 0x3f) | 0x80;\n var byte3 = (codePoint & 0x3f) | 0x80;\n encoded.push(byte1, byte2, byte3);\n idx += 1;\n }\n // Four byte encoding (surrogate pair)\n else if (codePoint < 0x110000) {\n var byte1 = ((codePoint >> 18) & 0x07) | 0xf0;\n var byte2 = ((codePoint >> 12) & 0x3f) | 0x80;\n var byte3 = ((codePoint >> 6) & 0x3f) | 0x80;\n var byte4 = ((codePoint >> 0) & 0x3f) | 0x80;\n encoded.push(byte1, byte2, byte3, byte4);\n idx += 2;\n }\n // Should never reach this case\n else\n throw new Error(\"Invalid code point: 0x\" + toHexString(codePoint));\n }\n return new Uint8Array(encoded);\n};\n/**\n * Encodes a string to UTF-16.\n *\n * @param input The string to be encoded.\n * @param byteOrderMark Whether or not a byte order marker (BOM) should be added\n * to the start of the encoding. (default `true`)\n * @returns A Uint16Array containing the UTF-16 encoding of the input string.\n *\n * -----------------------------------------------------------------------------\n *\n * JavaScript strings are composed of Unicode code points. Code points are\n * integers in the range 0 to 1,114,111 (0x10FFFF). When serializing a string,\n * it must be encoded as a sequence of words. A word is typically 8, 16, or 32\n * bytes in size. As such, Unicode defines three encoding forms: UTF-8, UTF-16,\n * and UTF-32. These encoding forms are described in the Unicode standard [1].\n * This function implements the UTF-16 encoding form.\n *\n * -----------------------------------------------------------------------------\n *\n * In UTF-16, each code point is mapped to one or two 16-bit integers. The\n * UTF-16 mapping logic is as follows [2]:\n *\n * • If a code point is in the range U+0000..U+FFFF, then map the code point to\n * a 16-bit integer with the most significant byte first.\n *\n * • If a code point is in the range U+10000..U+10000, then map the code point\n * to two 16-bit integers. The first integer should contain the high surrogate\n * and the second integer should contain the low surrogate. Both surrogates\n * should be written with the most significant byte first.\n *\n * -----------------------------------------------------------------------------\n *\n * It is important to note, when iterating through the code points of a string\n * in JavaScript, that if a character is encoded as a surrogate pair it will\n * increase the string's length by 2 instead of 1 [4]. For example:\n *\n * ```\n * > 'a'.length\n * 1\n * > '💩'.length\n * 2\n * > '語'.length\n * 1\n * > 'a💩語'.length\n * 4\n * ```\n *\n * The results of the above example are explained by the fact that the\n * characters 'a' and '語' are not represented by surrogate pairs, but '💩' is.\n *\n * Because of this idiosyncrasy in JavaScript's string implementation and APIs,\n * we must \"jump\" an extra index after encoding a character as a surrogate\n * pair. In practice, this means we must increment the index of our for loop by\n * 2 if we encode a surrogate pair, and 1 in all other cases.\n *\n * -----------------------------------------------------------------------------\n *\n * References:\n * - [1] https://www.unicode.org/versions/Unicode12.0.0/UnicodeStandard-12.0.pdf\n * 3.9 Unicode Encoding Forms - UTF-8\n * - [2] http://www.herongyang.com/Unicode/UTF-16-UTF-16-Encoding.html\n * - [3] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description\n *\n */\nexport var utf16Encode = function (input, byteOrderMark) {\n if (byteOrderMark === void 0) { byteOrderMark = true; }\n var encoded = [];\n if (byteOrderMark)\n encoded.push(0xfeff);\n for (var idx = 0, len = input.length; idx < len;) {\n var codePoint = input.codePointAt(idx);\n // Two byte encoding\n if (codePoint < 0x010000) {\n encoded.push(codePoint);\n idx += 1;\n }\n // Four byte encoding (surrogate pair)\n else if (codePoint < 0x110000) {\n encoded.push(highSurrogate(codePoint), lowSurrogate(codePoint));\n idx += 2;\n }\n // Should never reach this case\n else\n throw new Error(\"Invalid code point: 0x\" + toHexString(codePoint));\n }\n return new Uint16Array(encoded);\n};\n/**\n * Returns `true` if the `codePoint` is within the\n * Basic Multilingual Plane (BMP). Code points inside the BMP are not encoded\n * with surrogate pairs.\n * @param codePoint The code point to be evaluated.\n *\n * Reference: https://en.wikipedia.org/wiki/UTF-16#Description\n */\nexport var isWithinBMP = function (codePoint) {\n return codePoint >= 0 && codePoint <= 0xffff;\n};\n/**\n * Returns `true` if the given `codePoint` is valid and must be represented\n * with a surrogate pair when encoded.\n * @param codePoint The code point to be evaluated.\n *\n * Reference: https://en.wikipedia.org/wiki/UTF-16#Description\n */\nexport var hasSurrogates = function (codePoint) {\n return codePoint >= 0x010000 && codePoint <= 0x10ffff;\n};\n// From Unicode 3.0 spec, section 3.7:\n// http://unicode.org/versions/Unicode3.0.0/ch03.pdf\nexport var highSurrogate = function (codePoint) {\n return Math.floor((codePoint - 0x10000) / 0x400) + 0xd800;\n};\n// From Unicode 3.0 spec, section 3.7:\n// http://unicode.org/versions/Unicode3.0.0/ch03.pdf\nexport var lowSurrogate = function (codePoint) {\n return ((codePoint - 0x10000) % 0x400) + 0xdc00;\n};\nvar ByteOrder;\n(function (ByteOrder) {\n ByteOrder[\"BigEndian\"] = \"BigEndian\";\n ByteOrder[\"LittleEndian\"] = \"LittleEndian\";\n})(ByteOrder || (ByteOrder = {}));\nvar REPLACEMENT = '�'.codePointAt(0);\n/**\n * Decodes a Uint8Array of data to a string using UTF-16.\n *\n * Note that this function attempts to recover from erronous input by\n * inserting the replacement character (�) to mark invalid code points\n * and surrogate pairs.\n *\n * @param input A Uint8Array containing UTF-16 encoded data\n * @param byteOrderMark Whether or not a byte order marker (BOM) should be read\n * at the start of the encoding. (default `true`)\n * @returns The decoded string.\n */\nexport var utf16Decode = function (input, byteOrderMark) {\n if (byteOrderMark === void 0) { byteOrderMark = true; }\n // Need at least 2 bytes of data in UTF-16 encodings\n if (input.length <= 1)\n return String.fromCodePoint(REPLACEMENT);\n var byteOrder = byteOrderMark ? readBOM(input) : ByteOrder.BigEndian;\n // Skip byte order mark if needed\n var idx = byteOrderMark ? 2 : 0;\n var codePoints = [];\n while (input.length - idx >= 2) {\n var first = decodeValues(input[idx++], input[idx++], byteOrder);\n if (isHighSurrogate(first)) {\n if (input.length - idx < 2) {\n // Need at least 2 bytes left for the low surrogate that is required\n codePoints.push(REPLACEMENT);\n }\n else {\n var second = decodeValues(input[idx++], input[idx++], byteOrder);\n if (isLowSurrogate(second)) {\n codePoints.push(first, second);\n }\n else {\n // Low surrogates should always follow high surrogates\n codePoints.push(REPLACEMENT);\n }\n }\n }\n else if (isLowSurrogate(first)) {\n // High surrogates should always come first since `decodeValues()`\n // accounts for the byte ordering\n idx += 2;\n codePoints.push(REPLACEMENT);\n }\n else {\n codePoints.push(first);\n }\n }\n // There shouldn't be extra byte(s) left over\n if (idx < input.length)\n codePoints.push(REPLACEMENT);\n return String.fromCodePoint.apply(String, codePoints);\n};\n/**\n * Returns `true` if the given `codePoint` is a high surrogate.\n * @param codePoint The code point to be evaluated.\n *\n * Reference: https://en.wikipedia.org/wiki/UTF-16#Description\n */\nvar isHighSurrogate = function (codePoint) {\n return codePoint >= 0xd800 && codePoint <= 0xdbff;\n};\n/**\n * Returns `true` if the given `codePoint` is a low surrogate.\n * @param codePoint The code point to be evaluated.\n *\n * Reference: https://en.wikipedia.org/wiki/UTF-16#Description\n */\nvar isLowSurrogate = function (codePoint) {\n return codePoint >= 0xdc00 && codePoint <= 0xdfff;\n};\n/**\n * Decodes the given utf-16 values first and second using the specified\n * byte order.\n * @param first The first byte of the encoding.\n * @param second The second byte of the encoding.\n * @param byteOrder The byte order of the encoding.\n * Reference: https://en.wikipedia.org/wiki/UTF-16#Examples\n */\nvar decodeValues = function (first, second, byteOrder) {\n // Append the binary representation of the preceding byte by shifting the\n // first one 8 to the left and than applying a bitwise or-operator to append\n // the second one.\n if (byteOrder === ByteOrder.LittleEndian)\n return (second << 8) | first;\n if (byteOrder === ByteOrder.BigEndian)\n return (first << 8) | second;\n throw new Error(\"Invalid byteOrder: \" + byteOrder);\n};\n/**\n * Returns whether the given array contains a byte order mark for the\n * UTF-16BE or UTF-16LE encoding. If it has neither, BigEndian is assumed.\n *\n * Reference: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-16\n *\n * @param bytes The byte array to be evaluated.\n */\n// prettier-ignore\nvar readBOM = function (bytes) { return (hasUtf16BigEndianBOM(bytes) ? ByteOrder.BigEndian\n : hasUtf16LittleEndianBOM(bytes) ? ByteOrder.LittleEndian\n : ByteOrder.BigEndian); };\nvar hasUtf16BigEndianBOM = function (bytes) {\n return bytes[0] === 0xfe && bytes[1] === 0xff;\n};\nvar hasUtf16LittleEndianBOM = function (bytes) {\n return bytes[0] === 0xff && bytes[1] === 0xfe;\n};\nexport var hasUtf16BOM = function (bytes) {\n return hasUtf16BigEndianBOM(bytes) || hasUtf16LittleEndianBOM(bytes);\n};\n//# sourceMappingURL=unicode.js.map","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n"],"names":["RotationTypes","LineCapStyle","LineJoinStyle","TextRenderingMode","ColorTypes","TextAlignment","ImageAlignment","StandardFonts","ParseSpeeds","BlendMode","asPDFName","name","of","asPDFNumber","num","asNumber","radians","radianAngle","type","Radians","angle","degrees","degreeAngle","Degrees","degreesToRadians","degree","Math","PI","radiansToDegrees","radian","toRadians","rotation","JSON","stringify","toDegrees","reduceRotation","quadrants","adjustDimsForRotation","dims","width","height","rotateRectangle","rectangle","borderWidth","x","y","w","h","r","b","clip","ClipNonZero","clipEvenOdd","ClipEvenOdd","cos","sin","tan","concatTransformationMatrix","a","c","d","e","f","ConcatTransformationMatrix","translate","xPos","yPos","scale","rotateRadians","rotateDegrees","skewRadians","xSkewAngle","ySkewAngle","skewDegrees","setDashPattern","dashArray","dashPhase","SetLineDashPattern","map","join","restoreDashPattern","setLineCap","style","SetLineCapStyle","setLineJoin","SetLineJoinStyle","setGraphicsState","state","SetGraphicsStateParams","pushGraphicsState","PushGraphicsState","popGraphicsState","PopGraphicsState","setLineWidth","SetLineWidth","appendBezierCurve","x1","y1","x2","y2","x3","y3","AppendBezierCurve","appendQuadraticCurve","CurveToReplicateInitialPoint","closePath","ClosePath","moveTo","MoveTo","lineTo","LineTo","AppendRectangle","square","size","stroke","StrokePath","fill","FillNonZero","fillAndStroke","FillNonZeroAndStroke","endPath","EndPath","nextLine","NextLine","moveText","MoveText","showText","text","ShowText","beginText","BeginText","endText","EndText","setFontAndSize","SetFontAndSize","setCharacterSpacing","spacing","SetCharacterSpacing","setWordSpacing","SetWordSpacing","setCharacterSqueeze","squeeze","SetTextHorizontalScaling","setLineHeight","lineHeight","SetTextLineHeight","setTextRise","rise","SetTextRise","setTextRenderingMode","mode","SetTextRenderingMode","setTextMatrix","SetTextMatrix","rotateAndSkewTextRadiansAndTranslate","rotationAngle","rotateAndSkewTextDegreesAndTranslate","drawObject","DrawObject","setFillingGrayscaleColor","gray","NonStrokingColorGray","setStrokingGrayscaleColor","StrokingColorGray","setFillingRgbColor","red","green","blue","NonStrokingColorRgb","setStrokingRgbColor","StrokingColorRgb","setFillingCmykColor","cyan","magenta","yellow","key","NonStrokingColorCmyk","setStrokingCmykColor","StrokingColorCmyk","beginMarkedContent","tag","BeginMarkedContent","endMarkedContent","EndMarkedContent","grayscale","Grayscale","rgb","RGB","cmyk","CMYK","setFillingColor","color","setStrokingColor","componentsToColor","comps","length","undefined","colorToComponents","cx","cy","px","py","sx","sy","parameters","Map","parse","path","cmd","ret","args","curArg","foundDecimal","params","_i","path_1","has","get","includes","apply","commands","cmds","i","runners","Array","isArray","concat","push","M","m","C","S","s","Q","q","T","t","A","solveArc","L","l","H","V","v","Z","z","coords","rx","ry","rot","large","sweep","segs","arcToSegments","segs_1","bez","segmentToBezier","rotateX","ox","oy","th","sinTh","cosTh","abs","pl","sqrt","a00","a01","a10","a11","x0","y0","sfactorSq","sfactor","xc","yc","th0","atan2","thArc","th1","segments","ceil","result","th2","th3","cx1","cy1","thHalf","drawText","line","options","graphicsState","font","rotate","xSkew","ySkew","filter","Boolean","drawLinesOfText","lines","operators","idx","len","drawImage","drawPage","xScale","yScale","drawLine","_a","_b","thickness","start","lineCap","end","drawRectangle","borderColor","borderLineCap","borderDashArray","borderDashPhase","KAPPA","drawEllipsePath","config","xe","ye","xm","ym","drawEllipseCurves","centerX","centerY","drawEllipse","_c","drawSvgPath","drawCheckMark","p1x","p1y","p2x","p2y","p3x","p3y","rotateInPlace","drawCheckBox","outline","filled","checkMarkSize","min","checkMark","markColor","drawRadioButton","outlineScale","dot","dotColor","drawButton","background","drawTextLines","textLines","textColor","fontSize","encoded","drawTextField","padding","clipX","clipY","clipWidth","clipHeight","clippingArea","markedContent","drawOptionList","highlights","selectedLines","selectedColor","EncryptedPDFError","_super","call","Error","FontkitNotRegisteredError","ForeignPageError","RemovePageFromEmptyDocumentError","NoSuchFieldError","UnexpectedFieldTypeError","expected","actual","expectedType","actualType","constructor","MissingOnValueCheckError","onValue","FieldAlreadyExistsError","InvalidFieldNamePartError","namePart","FieldExistsAsNonTerminalError","RichTextFieldReadError","fieldName","CombedTextLayoutError","lineLength","cellCount","ExceededMaxLengthError","textLength","maxLength","InvalidMaxLengthError","computeFontSize","bounds","multiline","linesUsed","lineIdx","lineLen","words","split","spaceInLineRemaining","word","isLastWord","widthOfWord","widthOfTextAtSize","heightAtSize","totalHeight","computeCombedFontSize","cellWidth","cellHeight","chars","descender","lastIndexOfWhitespace","test","splitOutLines","input","maxWidth","lastWhitespaceIdx","substring","encodeText","remainder","layoutMultilineText","alignment","minX","minY","maxX","maxY","prevRemainder","Left","Center","Right","trim","layoutCombedText","cells","cellOffset","charOffset","char","charLength","cellCenter","layoutSinglelineText","normalizeAppearance","appearance","normal","tfRegex","getDefaultFontSize","field","da","getDefaultAppearance","defaultFontSize","Number","daMatch","match","isFinite","colorRegex","getDefaultColor","c1","c2","c3","c4","colorSpace","updateDefaultAppearance","toString","setDefaultAppearance","defaultCheckBoxAppearanceProvider","checkBox","widget","widgetColor","fieldColor","acroField","getRectangle","ap","getAppearanceCharacteristics","bs","getBorderStyle","getWidth","getRotation","_d","black","getBorderColor","normalBackgroundColor","getBackgroundColor","downBackgroundColor","on","off","down","defaultRadioGroupAppearanceProvider","radioGroup","defaultButtonAppearanceProvider","button","_e","widgetFontSize","fieldFontSize","captions","getCaptions","normalText","downText","_f","normalLayout","downLayout","defaultTextFieldAppearanceProvider","textField","getText","isCombed","isMultiline","layout","getAlignment","getMaxLength","defaultDropdownAppearanceProvider","dropdown","getSelected","defaultOptionListAppearanceProvider","optionList","getOptions","selected","isSorted","sort","PDFEmbeddedPage","ref","doc","embedder","alreadyEmbedded","prototype","factor","embed","label","embedIntoContext","context","sent","PDFFont","modified","fontName","heightOfFontAtSize","sizeAtHeight","sizeOfFontAtHeight","getCharacterSet","encoding","supportedCodePoints","characterSet","PDFImage","scaleToFit","embedTask","assertFieldAppearanceOptions","Object","backgroundColor","PDFField","getName","getFullyQualifiedName","isReadOnly","hasFlag","ReadOnly","enableReadOnly","setFlagTo","disableReadOnly","isRequired","Required","enableRequired","disableRequired","isExported","NoExport","enableExporting","disableExporting","needsAppearancesUpdate","defaultUpdateAppearances","_font","markAsDirty","getForm","markFieldAsDirty","markAsClean","markFieldAsClean","isDirty","fieldIsDirty","createWidget","degreesAngle","caption","hidden","pageRef","page","create","rect","setRectangle","setP","ac","getOrCreateAppearanceCharacteristics","setBackgroundColor","setRotation","setCaptions","setBorderColor","getOrCreateBorderStyle","setWidth","Print","Hidden","Invisible","newDa","updateWidgetAppearanceWithFont","rollover","updateWidgetAppearances","createAppearanceStream","updateOnOffWidgetAppearance","createAppearanceDict","setNormalAppearance","setRolloverAppearance","removeRolloverAppearance","setDownAppearance","removeDownAppearance","dict","Resources","Font","stream","formXObject","BBox","obj","Matrix","register","createImageAppearanceStream","image","adj","imageDims","imageName","addRandomSuffix","XObject","onStreamRef","offStreamRef","appearanceDict","set","PDFCheckBox","acroCheckBox","_this","check","getOnValue","setValue","uncheck","isChecked","getValue","addToPage","widgetRef","addWidget","setAppearanceState","updateWidgetAppearance","node","addAnnot","widgets","getWidgets","getAppearanceState","getAppearances","updateAppearances","provider","Function","appearances","apProvider","PDFDropdown","acroComboBox","rawOptions","display","value","decodeText","values","getValues","setOptions","optionObjects","fromText","addOptions","optionsArr","existingOptions","newOptions","select","merge","validOptions","find","option","enableEditing","enableMultiselect","existingValues","setValues","clear","setFontSize","isEditable","Edit","disableEditing","Sort","enableSorting","disableSorting","isMultiselect","MultiSelect","disableMultiselect","isSpellChecked","DoNotSpellCheck","enableSpellChecking","disableSpellChecking","isSelectOnClick","CommitOnSelChange","enableSelectOnClick","disableSelectOnClick","_g","getDefaultFont","PDFOptionList","acroListBox","PDFRadioGroup","acroRadioButton","exportValues","getExportValues","exportOptions","onValues","getOnValues","onOptions","isOffToggleable","NoToggleToOff","enableOffToggling","disableOffToggling","isMutuallyExclusive","RadiosInUnison","enableMutualExclusion","disableMutualExclusion","addOptionToPage","_h","_j","apStateValue","addWidgetWithOpt","PDFSignature","acroSignature","PDFTextField","acroText","isRichFormatted","setText","disableRichFormatting","removeValue","quadding","getQuadding","setAlignment","setQuadding","setMaxLength","MAX_SAFE_INTEGER","removeMaxLength","setImage","fieldAlignment","streamRef","Multiline","enableMultiline","disableMultiline","isPassword","Password","enablePassword","disablePassword","isFileSelector","FileSelect","enableFileSelection","disableFileSelection","isScrollable","DoNotScroll","enableScrolling","disableScrolling","Comb","enableCombing","console","warn","disableCombing","RichText","enableRichFormatting","PDFForm","acroForm","embedDefaultFont","embedStandardFont","Helvetica","dirtyFields","Set","defaultFontCache","populatedBy","hasXFA","deleteXFA","delete","getFields","allFields","getAllFields","fields","convertToPDFField","getFieldMaybe","getField","getButton","getCheckBox","getDropdown","getOptionList","getRadioGroup","getSignature","getTextField","createButton","nameParts","splitFieldName","parent","findOrCreateNonTerminals","nonTerminal","setPartialName","terminal","addFieldToParent","createCheckBox","createDropdown","comboBox","createOptionList","listBox","createRadioGroup","radioButton","createTextField","flatten","updateFieldAppearances","lenFields","j","lenWidgets","findWidgetPage","findWidgetAppearanceRef","xObjectKey","newXObject","pushOperators","removeField","pages","add","removeAnnot","forEach","fieldKids","normalizedEntries","Kids","kidsCount","childIndex","child","fieldRef","access","P","getPages","getObjectRef","findPageForAnnotationRef","refOrDict","getNormalAppearance","partialNames","parent_1","parentRef","res","findNonTerminal","setParent","nodeRef","addField","partialName","getPartialName","fullyQualifiedName","parts","slice","entries","Fields","PageSizes","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","A10","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","B10","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","C10","RA0","RA1","RA2","RA3","RA4","SRA0","SRA1","SRA2","SRA3","SRA4","Executive","Folio","Legal","Letter","Tabloid","Infinity","PDFEmbeddedFile","Names","EmbeddedFiles","EFNames","catalog","lookup","fileName","AF","PDFJavaScript","Javascript","JSNames","scriptName","JavaScriptEmbedder","script","for","jsActionDict","Type","JS","PDFHexString","assign","PDFDocument","ignoreEncryption","updateMetadata","defaultWordBreaks","computePages","Pages","traverse","pageMap","getOrCreateForm","getOrCreateAcroForm","trailerInfo","Root","isEncrypted","Encrypt","pageCache","formCache","fonts","images","embeddedPages","embeddedFiles","javaScripts","updateInfoDict","load","pdf","parseSpeed","throwOnInvalidObject","capNumbers","bytes","Slow","Uint8Array","ArrayBuffer","forBytesWithOptions","parseDocument","pageTree","pageTreeRef","withContext","withContextAndPages","registerFontkit","fontkit","form","getTitle","title","getInfoDict","Title","assertIsLiteralOrHexString","getAuthor","author","Author","getSubject","subject","Subject","getKeywords","keywords","Keywords","getCreator","creator","Creator","getProducer","producer","Producer","getCreationDate","creationDate","CreationDate","decodeDate","getModificationDate","modificationDate","ModDate","setTitle","showInWindowTitleBar","prefs","getOrCreateViewerPreferences","setDisplayDocTitle","setAuthor","setSubject","setKeywords","setCreator","setProducer","setLanguage","language","setCreationDate","Date","fromDate","setModificationDate","getPageCount","pageCount","getPage","index","getPageIndices","removePage","removeLeafNode","addPage","insertPage","setSize","insertLeafNode","invalidate","copyPages","srcDoc","indices","copier","srcPages","copiedPages","srcPage","copiedPage","flush","copy","pdfCopy","contentPages","addJavaScript","nextRef","javaScript","attach","attachment","embeddedFile","mimeType","description","afRelationship","FileEmbedder","embedFont","subset","customName","features","pdfFont","assertFontkit","embedJpg","jpg","pdfImage","embedPng","png","embedPdf","embedPages","embedPage","boundingBox","transformationMatrix","boundingBoxes","transformationMatrices","currPage","nextPage","maybeCopyPage","box","matrix","p","embedAll","save","useObjectStreams","addDefaultPage","objectsPerTick","Writer","forContext","serializeToBuffer","saveAsBase64","dataUri","otherOptions","base64","annotations","Annots","indexOf","embeddables","pdfLib","now","info","existingInfo","Info","newInfo","pdfObject","PDFPage","leafNode","fontColor","Rotate","mediaBox","getMediaBox","setMediaBox","cropBox","getCropBox","bleedBox","getBleedBox","trimBox","getTrimBox","artBox","getArtBox","hasCropBox","CropBox","hasBleedBox","BleedBox","hasTrimBox","TrimBox","hasArtBox","ArtBox","setCropBox","setBleedBox","setTrimBox","setArtBox","getSize","setHeight","MediaBox","getHeight","asRectangle","translateContent","normalize","getContentStream","createContentStream","startRef","endRef","wrapContentStreams","scaleContent","scaleAnnotations","annots","annot","scaleAnnot","resetPosition","setFont","fontKey","newFontDictionary","setFontColor","getPosition","getX","getY","moveDown","yDecrease","moveUp","yIncrease","moveLeft","xDecrease","moveRight","xIncrease","operator","arguments","contentStream","opacity","wordBreaks","blendMode","setOrEmbedFont","oldFont","newFont","newFontKey","encodedLines","graphicsStateKey","maybeEmbedGraphicsState","resetFont","embeddedPage","borderOpacity","_k","_l","_m","_o","drawSquare","drawCircle","oldFontKey","getFont","useExisting","contentStreamRef","addContentStream","ca","CA","BM","newExtGState","selectors","list","scalePDFNumbers","inkLists","arr","dummyRef","pageLeaf","withContextAndParent","PDFButton","acroPushButton","AFRelationship","fileData","embeddedFileStream","embeddedFileStreamRef","fileSpecDict","flateStream","Subtype","Params","Size","F","UF","EF","Desc","MethodNotImplementedError","className","methodName","PrivateConstructorError","UnexpectedObjectTypeError","msg","expectedTypes","UnsupportedEncodingError","ReparseError","MissingCatalogError","MissingPageContentsEmbeddingError","UnrecognizedStreamTypeError","streamType","contructor","PageEmbeddingMismatchedContextError","PDFArrayIsNotRectangleError","InvalidPDFDateStringError","InvalidTargetIndexError","targetIndex","Count","CorruptPageTreeError","operation","IndexOutOfBoundsError","max","InvalidAcroFieldValueError","MultiSelectValueError","MissingDAEntryError","MissingTfOperatorError","NumberParsingError","pos","column","offset","PDFParsingError","details","NextByteAssertionError","expectedByte","actualByte","PDFObjectParsingError","byte","PDFInvalidObjectParsingError","PDFStreamParsingError","UnbalancedParenthesisError","StalledParserError","MissingPDFHeaderError","MissingKeywordError","keyword","PDFOperatorNames","EntryType","ColorSpace","PngType","NonFullScreenPageMode","ReadingDirection","PrintScaling","Duplex","AcroFieldFlags","AcroButtonFlags","AcroTextFlags","AcroChoiceFlags","AnnotationFlags","PDFHeader","major","minor","String","bc","sizeInBytes","copyBytesInto","buffer","initialOffset","CharCodes","Percent","D","Dash","Period","Newline","forVersion","PDFNumber","numberValue","stringValue","clone","PDFObject","PDFArray","array","object","insert","splice","remove","lookupMaybe","types","lowerLeftX","lowerLeftY","upperRightX","upperRightY","asArray","arrayString","LeftSquareBracket","Space","RightSquareBracket","el","ENFORCER","PDFBool","enforcer","asBoolean","u","True","False","IsDelimiter","LeftParen","RightParen","LessThan","GreaterThan","LeftCurly","RightCurly","ForwardSlash","IsWhitespace","Null","Tab","FormFeed","CarriageReturn","IsIrregular","Hash","pool","PDFName","encodedName","character","code","isRegularChar","ExclamationPoint","charCode","Tilde","asBytes","hex","escaped","pushByte","nextChar","Zero","Nine","parseInt","fromCharCode","from","asString","decodedValue","replace","_","instance","Length","FlateDecode","ExtGState","Contents","Parent","Page","PDFNull","asNull","n","PDFDict","keys","preservePDFNull","asMap","uniqueKey","existingKeys","dictString","fromMapWithContext","PDFStream","_context","getContentsString","getContents","getContentsSize","updateDict","contentsSize","streamString","contents","PDFRawStream","asUint8Array","PDFRef","objectNumber","generationNumber","PDFOperator","arg","PDFFlateStream","encode","computeContents","unencodedContents","getUnencodedContents","contentsCache","PDFContentStream","getUnencodedContentsSize","SimpleRNG","seed","nextInt","floor","withSeed","byAscendingObjectNumber","PDFContext","largestObjectNumber","header","indirectObjects","rng","enumerateIndirectObjects","literal","Filter","getPushGraphicsStateContentStream","pushGraphicsStateContentStreamRef","op","getPopGraphicsStateContentStream","popGraphicsStateContentStreamRef","prefix","suffixLength","pow","PDFPageLeaf","autoNormalizeCTM","normalized","dictOrRef","getInheritableAttribute","arrayOrRef","numberOrRef","attribute","ascend","startStream","endStream","annotRef","setFontDictionary","fontDictRef","newFontDictionaryKey","setXObject","xObjectRef","newXObjectKey","setExtGState","extGStateRef","newExtGStateKey","visitor","contentsRef","InheritableEntries","PDFObjectCopier","src","dest","traversedObjects","copyPDFPage","copyPDFDict","copyPDFArray","copyPDFStream","copyPDFIndirectObject","originalPage","clonedPage","originalDict","clonedDict","originalArray","clonedArray","originalStream","clonedStream","newRef","dereferencedValue","cloned","PDFCrossRefSection","firstEntry","subsections","chunkIdx","chunkLength","addEntry","append","deleted","addDeletedEntry","nextFreeObjectNumber","section","rangeIdx","rangeLen","range","entryIdx","entryLen","entry","subsection","subsectionLength","copySubsectionsIntoBuffer","firstObjectNumber","rangeLength","copyEntriesIntoBuffer","entryOffset","entryGen","currEntry","chunk","prevEntry","createEmpty","PDFTrailer","lastXRefOffset","E","O","forLastCrossRefSectionOffset","PDFTrailerDict","PDFObjectStream","objects","offsets","computeObjectOffsets","offsetsString","computeOffsetsString","getObjectsCount","withContextAndObjects","PDFWriter","parsedObjects","shouldWaitForTick","xref","trailerDict","trailer","computeBufferSize","o","computeIndirectObjectSize","refSize","createTrailerDict","ID","indirectObject","xrefOffset","PDFInvalidObject","data","PDFCrossRefStream","computeIndex","computeEntryTuples","entryTuples","Deleted","Uncompressed","Compressed","objectStreamRef","computeMaxEntryByteWidths","entryTuplesCache","widths","first","second","third","firstSize","secondSize","thirdSize","maxByteWidthsCache","indexCache","addUncompressedEntry","addCompressedEntry","byteWidths","entriesLen","firstBytes","secondBytes","thirdBytes","entryWidth","PDFStreamWriter","encodeStreams","objectsPerStream","xrefStream","uncompressedObjects","compressedObjects","objectStreamRefs","objectStream","xrefStreamRef","StandardFontEmbedder","ZapfDingbats","Symbol","WinAnsi","FontName","glyphs","encodeTextAsGlyphs","hexCodes","totalWidth","left","right","kernAmount","getXAxisKerningForPair","widthOfGlyph","Ascender","Descender","FontBBox","yTop","fontDict","BaseFont","Encoding","glyphName","getWidthOfGlyph","codePoints","codePoint","encodeUnicodeCodePoint","createCmap","glyphId","bfChars","glyph","id","cmapHexFormat","cmapHexString","unicode","cmapCodePointFormat","fillCmapTemplate","hs","ls","makeFontFlags","flags","flipBit","bit","fixedPitch","serif","symbolic","nonsymbolic","italic","allCap","smallCap","forceBold","deriveFontFlags","familyClass","sFamilyClass","post","isFixedPitch","head","macStyle","CustomFontEmbedder","fontData","fontFeatures","allGlyphsInFontSortedById","glyphForCodePoint","g","unitsPerEm","postscriptName","baseFontName","glyphCache","advanceWidth","ascent","descent","bbox","embedFontDict","cidFontDictRef","unicodeCMapRef","embedCIDFontDict","embedUnicodeCmap","DescendantFonts","ToUnicode","isCFF","cff","fontDescriptorRef","cidFontDict","embedFontDescriptor","CIDToGIDMap","CIDSystemInfo","Registry","PDFString","Ordering","Supplement","FontDescriptor","W","computeWidths","fontStreamRef","italicAngle","capHeight","xHeight","fontDescriptor","embedFontStream","Flags","ItalicAngle","Ascent","Descent","CapHeight","XHeight","StemV","serializeFont","fontStream","cmap","bind","cmapStream","currSection","currGlyph","prevGlyph","currGlyphId","prevGlyphId","CustomFontSubsetEmbedder","customFontName","createSubset","glyphIdMap","subsetGlyphId","includeGlyph","Promise","resolve","reject","encodeStream","err","MARKERS","ChannelToColorSpace","DeviceGray","DeviceRGB","DeviceCMYK","JpegEmbedder","imageData","bitsPerComponent","dataView","marker","channelName","soi","DataView","getUint16","byteLength","getUint8","xObject","BitsPerComponent","Width","Height","Decode","getImageType","ctype","Greyscale","Truecolour","IndexedColour","GreyscaleWithAlpha","TruecolourWithAlpha","splitAlphaChannel","rgbaChannel","pixelCount","rgbChannel","alphaChannel","rgbaOffset","rgbOffset","alphaOffset","PNG","pngData","upng","UPNG","decode","frames","toRGBA8","some","PngEmbedder","SMask","embedAlphaChannel","Stream","defineProperty","enumerable","configurable","getByte","b0","b1","getInt32","b2","getBytes","forceClamped","strEnd","subarray","Uint8ClampedArray","peekByte","peekedByte","peekBytes","skip","reset","moveStart","makeSubStream","emptyBuffer","DecodeStream","maybeMinBufferLength","bufferLength","eof","minBufferLength","readBlock","ensureBuffer","bufEnd","requested","buffer2","isSpace","ch","Ascii85Stream","maybeLength","AsciiHexStream","firstDigit","maxDecodeLength","ii","digit","codeLenCodeMap","Int32Array","lengthDecode","distDecode","fixedLitCodeTab","fixedDistCodeTab","FlateStream","cmf","flg","codeSize","codeBuf","litCodeTable","distCodeTable","str","hdr","getBits","blockLen","numLitCodes","numDistCodes","numCodeLenCodes","codeLenCodeLengths","codeLenCodeTab","generateHuffmanTable","codes","codeLengths","bitsLength","bitsOffset","what","getCode","repeatLength","limit","code1","code2","dist","k","bits","table","maxLen","log","codeLen","lengths","val","LZWStream","earlyChange","cachedData","bitsCached","lzwState","codeLength","nextCode","dictionaryValues","dictionaryLengths","Uint16Array","dictionaryPrevCodes","currentSequence","currentSequenceLength","estimatedDecodedSize","blockSize","prevCode","decodedLength","currentBufferLength","readBits","hasPrev","RunLengthStream","repeatHeader","source","decodeStream","EarlyChange","decodePDFRawStream","DecodeParms","fullPageBoundingBox","bottom","top","PDFPageEmbedder","bb","decodedContents","decodeContents","FormType","newline","content","asEnum","rawValue","enumType","ViewerPreferences","lookupBool","returnObj","lookupName","HideToolbar","HideMenubar","HideWindowUI","FitWindow","CenterWindow","DisplayDocTitle","Direction","PickTrayByPDFSize","PrintPageRange","NumCopies","getHideToolbar","getHideMenubar","getHideWindowUI","getFitWindow","getCenterWindow","getDisplayDocTitle","getNonFullScreenPageMode","UseNone","getReadingDirection","L2R","getPrintScaling","AppDefault","getDuplex","getPickTrayByPDFSize","getPrintPageRange","pageRanges","getNumCopies","setHideToolbar","hideToolbar","setHideMenubar","hideMenubar","setHideWindowUI","hideWindowUI","setFitWindow","fitWindow","setCenterWindow","centerWindow","displayTitle","setNonFullScreenPageMode","nonFullScreenPageMode","setReadingDirection","readingDirection","direction","setPrintScaling","printScaling","scaling","setDuplex","duplex","dup","setPickTrayByPDFSize","pickTrayByPDFSize","setPrintPageRange","printPageRange","flatRange","setNumCopies","numCopies","MAX_VALUE","fromDict","PDFAcroField","Ff","valueOrRef","DA","setKids","kids","getParent","daStart","daEnd","getFlags","setFlags","flag","setFlag","clearFlag","enable","BorderStyle","PDFAnnotation","Rect","AP","AS","setAppearances","ensureAP","N","AppearanceCharacteristics","R","BC","BG","RC","AC","components","component","PDFWidgetAnnotation","MK","BS","PDFAcroTerminal","FT","nameOrRef","kidDicts","removeWidget","PDFAcroButton","Opt","setOpt","opt","removeExportValue","normalizeExportValues","exportVal","addOpt","useExistingOptIdx","existingIdx","optText","optIdx","PDFAcroCheckBox","bitIndex","PDFAcroChoice","Combo","valuesAreValid","updateSelectedIndices","state_1","_loop_1","_loop_2","findIndex","newOpt","item","PDFAcroComboBox","PDFAcroNonTerminal","PDFAcroSignature","PDFAcroText","MaxLen","PDFAcroPushButton","PushButton","PDFAcroRadioButton","Radio","PDFAcroListBox","createPDFAcroFields","createPDFAcroField","createPDFAcroTerminal","isNonTerminalAcroField","kid","ftNameOrRef","createPDFAcroButton","createPDFAcroChoice","ffNumberOrRef","ffNumber","flagIsSet","startNode","PDFAcroForm","pushFields","fieldModel","PDFCatalog","AcroForm","getAcroForm","acroFormRef","getViewerPreferences","viewerPrefs","viewerPrefsRef","leafRef","pagesRef","maybeParentRef","PDFPageTree","pushTreeNode","treeRef","pushLeafNode","insertLeafKid","leafsRemainingUntilTarget","kidRef","prune","removeKid","kidIdx","newCount","IsDigit","One","Two","Three","Four","Five","Six","Seven","Eight","IsNumericPrefix","Plus","Minus","IsNumeric","BaseParser","parseRawInt","done","peek","next","position","parseRawNumber","skipWhitespace","skipLine","skipComment","skipWhitespaceAndComments","matchKeyword","ByteStream","assertNext","peekAhead","steps","peekAt","fromPDFRawStream","rawStream","endstream","endobj","startxref","true","false","null","streamEOF1","streamEOF2","streamEOF3","streamEOF4","EOF1endstream","EOF2endstream","EOF3endstream","PDFObjectParser","byteStream","parseObject","parseDictOrStream","parseHexString","parseString","parseName","parseArray","parseNumberOrRef","firstNum","lookaheadStart","secondNum","nestingLvl","isEscaped","BackSlash","pdfArray","element","parseDict","startPos","findEndOfStreamFallback","forBytes","forByteStream","PDFObjectStreamParser","alreadyParsed","firstOffset","objectCount","parseIntoContext","offsetsAndObjectNumbers","parseOffsetsAndObjectNumbers","forStream","PDFXRefStreamParser","Index","length_1","parseEntries","typeFieldWidth","offsetFieldWidth","genFieldWidth","subsectionIdx","subsectionLen","length_2","objIdx","inObjectStream","PDFParser","pdfBytes","prevOffset","parseHeader","parseDocumentSection","maybeRecoverRoot","isValidCatalog","skipBinaryHeaderComment","parseIndirectObjectHeader","matchIndirectObjectHeader","parseIndirectObject","tryToParseInvalidIndirectObject","failed","parseIndirectObjects","trys","skipJibberish","maybeParseCrossRefSection","firstInt","secondInt","maybeParseTrailerDict","maybeParseTrailer","isAlphaNumeric","hexLength","hexOffset","bytesOffset","date","_buffer","_offset","octal","Backspace","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","charCodeAt","encodeToBase64","decodeFromBase64","encoded1","encoded2","encoded3","encoded4","DATA_URI_PREFIX_REGEX","decodeFromBase64DataUri","trimmedUri","fullMatch","last","typedArrayFor","typedArray","mergeIntoTypedArray","arrays","arrayCount","typedArrays","totalSize","merged","arrIdx","byteIdx","arrLen","mergeUint8Arrays","mergedBuffer","arrayAsString","byAscendingId","sortedUniq","indexer","uniq","curr","prev","reverseArray","arrayLen","leftIdx","rightIdx","temp","sum","total","pluckIndices","plucked","canBeConvertedToUint8Array","toUint8Array","waitForTick","setTimeout","numberToString","numStr","negative","bytesFor","error","StandardFontValues","isStandardFont","rectanglesAreEqual","backtick","singleQuote","formatValue","createValueErrorMsg","valueName","allowedValues","joinedValues","assertIsOneOf","assertIsOneOfOrUndefined","assertIsSubset","getType","isNaN","isType","createTypeErrorMsg","allowedTypes","joinedTypes","assertIs","assertOrUndefined","assertEachIs","assertRange","assertRangeOrUndefined","assertMultiple","multiplier","assertInteger","isInteger","assertPositive","sign","pdfDocEncodingToUnicode","pdfDocEncodingDecode","fromCodePoint","Cache","populate","toCharCode","toCodePoint","codePointAt","toHexStringOfMinLength","minLength","padStart","toUpperCase","toHexString","charFromCode","charFromHexCode","padChar","copyStringIntoBuffer","random","escapeRegExp","cleanText","escapedNewlineChars","newlineChars","isNewlineChar","lineSplit","mergeLines","charAtIndex","cuSecond","cuFirst","nextIndex","charSplit","cLen","buildWordBreakRegex","newlineCharUnion","escapedRules","wordBreak","breakTextIntoLines","computeWidthOfText","regex","currLine","currWidth","pushCurrLine","dateRegex","parseDate","dateStr","year","offsetSign","findLastMatch","lastMatch","ByteOrder","utf8Encode","byteOrderMark","byte1","byte2","byte3","byte4","utf16Encode","highSurrogate","lowSurrogate","isWithinBMP","hasSurrogates","utf16Decode","byteOrder","readBOM","BigEndian","decodeValues","isHighSurrogate","isLowSurrogate","LittleEndian","hasUtf16BigEndianBOM","hasUtf16LittleEndianBOM","hasUtf16BOM","extendStatics","setPrototypeOf","__proto__","hasOwnProperty","__extends","__","__assign","__rest","getOwnPropertySymbols","propertyIsEnumerable","__awaiter","thisArg","_arguments","generator","fulfilled","step","rejected","adopt","then","__generator","body","ops","verb","iterator","pop","__spreadArrays","il","jl"],"sourceRoot":""}