@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
12 lines • 1.36 MB
JavaScript
/*!
* filename: ej2-pdf.umd.min.js
* version : 34.2.4
* Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-compression"),require("@syncfusion/ej2-file-utils")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-compression","@syncfusion/ej2-file-utils"],e):e((t=t||self).ej={},t.ej2Base,t.ej2Compression,t.ej2FileUtils)}(this,function(M,L,O,N){"use strict";(t=M.PdfAnnotationFlag||(M.PdfAnnotationFlag={}))[t.default=0]="default",t[t.invisible=1]="invisible",t[t.hidden=2]="hidden",t[t.print=4]="print",t[t.noZoom=8]="noZoom",t[t.noRotate=16]="noRotate",t[t.noView=32]="noView",t[t.readOnly=64]="readOnly",t[t.locked=128]="locked",t[t.toggleNoView=256]="toggleNoView",(t=M.PdfLineEndingStyle||(M.PdfLineEndingStyle={}))[t.none=0]="none",t[t.openArrow=1]="openArrow",t[t.closedArrow=2]="closedArrow",t[t.rOpenArrow=3]="rOpenArrow",t[t.rClosedArrow=4]="rClosedArrow",t[t.butt=5]="butt",t[t.diamond=6]="diamond",t[t.circle=7]="circle",t[t.square=8]="square",t[t.slash=9]="slash",(t=M.PdfLineIntent||(M.PdfLineIntent={}))[t.lineArrow=0]="lineArrow",t[t.lineDimension=1]="lineDimension",(t=M.PathPointType||(M.PathPointType={}))[t.start=0]="start",t[t.line=1]="line",t[t.bezier=3]="bezier",t[t.pathTypeMask=7]="pathTypeMask",t[t.dashMode=16]="dashMode",t[t.pathMarker=32]="pathMarker",t[t.closePath=128]="closePath",(t=M.PdfLineCaptionType||(M.PdfLineCaptionType={}))[t.inline=0]="inline",t[t.top=1]="top",(t=M.PdfBorderStyle||(M.PdfBorderStyle={}))[t.solid=0]="solid",t[t.dashed=1]="dashed",t[t.beveled=2]="beveled",t[t.inset=3]="inset",t[t.underline=4]="underline",t[t.dot=5]="dot",(t=M.PdfBorderEffectStyle||(M.PdfBorderEffectStyle={}))[t.solid=0]="solid",t[t.cloudy=1]="cloudy",(t=M.PdfRotationAngle||(M.PdfRotationAngle={}))[t.angle0=0]="angle0",t[t.angle90=1]="angle90",t[t.angle180=2]="angle180",t[t.angle270=3]="angle270",(t=M.PdfCrossReferenceType||(M.PdfCrossReferenceType={}))[t.table=0]="table",t[t.stream=1]="stream",(t=M.PdfHighlightMode||(M.PdfHighlightMode={}))[t.noHighlighting=0]="noHighlighting",t[t.invert=1]="invert",t[t.outline=2]="outline",t[t.push=3]="push",(t=M.PdfTextAlignment||(M.PdfTextAlignment={}))[t.left=0]="left",t[t.center=1]="center",t[t.right=2]="right",t[t.justify=3]="justify",(t=M.PdfFormFieldVisibility||(M.PdfFormFieldVisibility={}))[t.visible=0]="visible",t[t.hidden=1]="hidden",t[t.visibleNotPrintable=2]="visibleNotPrintable",t[t.hiddenPrintable=3]="hiddenPrintable",(t=M.PdfMeasurementUnit||(M.PdfMeasurementUnit={}))[t.inch=0]="inch",t[t.pica=1]="pica",t[t.point=3]="point",t[t.centimeter=4]="centimeter",t[t.millimeter=6]="millimeter",(t=M.PdfCircleMeasurementType||(M.PdfCircleMeasurementType={}))[t.diameter=0]="diameter",t[t.radius=1]="radius",(t=M.PdfRubberStampAnnotationIcon||(M.PdfRubberStampAnnotationIcon={}))[t.approved=0]="approved",t[t.asIs=1]="asIs",t[t.confidential=2]="confidential",t[t.departmental=3]="departmental",t[t.draft=4]="draft",t[t.experimental=5]="experimental",t[t.expired=6]="expired",t[t.final=7]="final",t[t.forComment=8]="forComment",t[t.forPublicRelease=9]="forPublicRelease",t[t.notApproved=10]="notApproved",t[t.notForPublicRelease=11]="notForPublicRelease",t[t.sold=12]="sold",t[t.topSecret=13]="topSecret",t[t.completed=14]="completed",t[t.void=15]="void",t[t.informationOnly=16]="informationOnly",t[t.preliminaryResults=17]="preliminaryResults",(t=M.PdfCheckBoxStyle||(M.PdfCheckBoxStyle={}))[t.check=0]="check",t[t.circle=1]="circle",t[t.cross=2]="cross",t[t.diamond=3]="diamond",t[t.square=4]="square",t[t.star=5]="star",(t=M.PdfTextMarkupAnnotationType||(M.PdfTextMarkupAnnotationType={}))[t.highlight=0]="highlight",t[t.underline=1]="underline",t[t.squiggly=2]="squiggly",t[t.strikeOut=3]="strikeOut",(t=M.PdfPopupIcon||(M.PdfPopupIcon={}))[t.note=0]="note",t[t.comment=1]="comment",t[t.help=2]="help",t[t.insert=3]="insert",t[t.key=4]="key",t[t.newParagraph=5]="newParagraph",t[t.paragraph=6]="paragraph",(t=M.PdfAnnotationState||(M.PdfAnnotationState={}))[t.none=0]="none",t[t.accepted=1]="accepted",t[t.rejected=2]="rejected",t[t.cancel=3]="cancel",t[t.completed=4]="completed",t[t.marked=5]="marked",t[t.unmarked=6]="unmarked",t[t.unknown=7]="unknown",(t=M.PdfAnnotationStateModel||(M.PdfAnnotationStateModel={}))[t.none=0]="none",t[t.marked=1]="marked",t[t.review=2]="review",(t=M.PdfAttachmentIcon||(M.PdfAttachmentIcon={}))[t.pushPin=0]="pushPin",t[t.tag=1]="tag",t[t.graph=2]="graph",t[t.paperClip=3]="paperClip",(t=M.PdfAnnotationIntent||(M.PdfAnnotationIntent={}))[t.none=0]="none",t[t.freeTextCallout=1]="freeTextCallout",t[t.freeTextTypeWriter=2]="freeTextTypeWriter",(t=M.PdfDestinationMode||(M.PdfDestinationMode={}))[t.location=0]="location",t[t.fitToPage=1]="fitToPage",t[t.fitR=2]="fitR",t[t.fitH=3]="fitH",(t=M.DataFormat||(M.DataFormat={}))[t.fdf=0]="fdf",t[t.xfdf=1]="xfdf",t[t.json=2]="json",t[t.xml=3]="xml",(t=M.PdfFormFieldsTabOrder||(M.PdfFormFieldsTabOrder={}))[t.none=0]="none",t[t.row=1]="row",t[t.column=2]="column",t[t.structure=3]="structure",t[t.manual=4]="manual",t[t.widget=5]="widget",(t=M.PdfPermissionFlag||(M.PdfPermissionFlag={}))[t.default=0]="default",t[t.print=4]="print",t[t.editContent=8]="editContent",t[t.copyContent=16]="copyContent",t[t.editAnnotations=32]="editAnnotations",t[t.fillFields=256]="fillFields",t[t.accessibilityCopyContent=512]="accessibilityCopyContent",t[t.assembleDocument=1024]="assembleDocument",t[t.fullQualityPrint=2048]="fullQualityPrint",(t=M.PdfPageOrientation||(M.PdfPageOrientation={}))[t.portrait=0]="portrait",t[t.landscape=1]="landscape",(t=M.PdfTextDirection||(M.PdfTextDirection={}))[t.none=0]="none",t[t.leftToRight=1]="leftToRight",t[t.rightToLeft=2]="rightToLeft",(t=M.PdfSubSuperScript||(M.PdfSubSuperScript={}))[t.none=0]="none",t[t.superScript=1]="superScript",t[t.subScript=2]="subScript",(t=M.PdfBlendMode||(M.PdfBlendMode={}))[t.normal=0]="normal",t[t.multiply=1]="multiply",t[t.screen=2]="screen",t[t.overlay=3]="overlay",t[t.darken=4]="darken",t[t.lighten=5]="lighten",t[t.colorDodge=6]="colorDodge",t[t.colorBurn=7]="colorBurn",t[t.hardLight=8]="hardLight",t[t.softLight=9]="softLight",t[t.difference=10]="difference",t[t.exclusion=11]="exclusion",t[t.hue=12]="hue",t[t.saturation=13]="saturation",t[t.color=14]="color",t[t.luminosity=15]="luminosity",(t=M.PdfFillMode||(M.PdfFillMode={}))[t.winding=0]="winding",t[t.alternate=1]="alternate",(t=M.PdfDashStyle||(M.PdfDashStyle={}))[t.solid=0]="solid",t[t.dash=1]="dash",t[t.dot=2]="dot",t[t.dashDot=3]="dashDot",t[t.dashDotDot=4]="dashDotDot",t[t.custom=5]="custom",(t=M.PdfLineCap||(M.PdfLineCap={}))[t.flat=0]="flat",t[t.round=1]="round",t[t.square=2]="square",(t=M.PdfLineJoin||(M.PdfLineJoin={}))[t.miter=0]="miter",t[t.round=1]="round",t[t.bevel=2]="bevel",(t=M.PdfTextStyle||(M.PdfTextStyle={}))[t.regular=0]="regular",t[t.italic=1]="italic",t[t.bold=2]="bold",(t=M.PdfNumberStyle||(M.PdfNumberStyle={}))[t.none=0]="none",t[t.numeric=1]="numeric",t[t.lowerLatin=2]="lowerLatin",t[t.lowerRoman=3]="lowerRoman",t[t.upperLatin=4]="upperLatin",t[t.upperRoman=5]="upperRoman",(t=M.PdfUnorderedListStyle||(M.PdfUnorderedListStyle={}))[t.none=0]="none",t[t.disk=1]="disk",t[t.square=2]="square",t[t.asterisk=3]="asterisk",t[t.circle=4]="circle",(t=M.PdfLayoutType||(M.PdfLayoutType={}))[t.paginate=0]="paginate",t[t.onePage=1]="onePage",(t=M.PdfLayoutBreakType||(M.PdfLayoutBreakType={}))[t.fitPage=0]="fitPage",t[t.fitElement=1]="fitElement",(t=M.PdfListMarkerAlignment||(M.PdfListMarkerAlignment={}))[t.left=0]="left",t[t.right=1]="right",(t=M.PdfPrintState||(M.PdfPrintState={}))[t.alwaysPrint=0]="alwaysPrint",t[t.neverPrint=1]="neverPrint",t[t.printWhenVisible=2]="printWhenVisible",(t=M.DigestAlgorithm||(M.DigestAlgorithm={}))[t.sha1=0]="sha1",t[t.sha256=1]="sha256",t[t.sha384=2]="sha384",t[t.sha512=3]="sha512",t[t.ripemd160=4]="ripemd160",(t=M.CryptographicStandard||(M.CryptographicStandard={}))[t.cms=0]="cms",t[t.cades=1]="cades",(t=M.PdfCertificationFlags||(M.PdfCertificationFlags={}))[t.forbidChanges=1]="forbidChanges",t[t.allowFormFill=2]="allowFormFill",t[t.allowComments=3]="allowComments",(t=M._PdfX509RevocationMode||(M._PdfX509RevocationMode={}))[t.noCheck=0]="noCheck",t[t.online=1]="online",t[t.offline=2]="offline",(t=M._RevocationType||(M._RevocationType={}))[t.ocsp=0]="ocsp",t[t.crl=1]="crl",t[t.ocspAndCrl=2]="ocspAndCrl",t[t.ocspOrCrl=3]="ocspOrCrl",(t=M._PdfAnnotationType||(M._PdfAnnotationType={}))[t.highlight=0]="highlight",t[t.underline=1]="underline",t[t.strikeOut=2]="strikeOut",t[t.squiggly=3]="squiggly",t[t.redactionAnnotation=4]="redactionAnnotation",t[t.textAnnotation=5]="textAnnotation",t[t.linkAnnotation=6]="linkAnnotation",t[t.documentLinkAnnotation=7]="documentLinkAnnotation",t[t.uriAnnotation=8]="uriAnnotation",t[t.fileLinkAnnotation=9]="fileLinkAnnotation",t[t.freeTextAnnotation=10]="freeTextAnnotation",t[t.lineAnnotation=11]="lineAnnotation",t[t.circleAnnotation=12]="circleAnnotation",t[t.ellipseAnnotation=13]="ellipseAnnotation",t[t.squareAnnotation=14]="squareAnnotation",t[t.rectangleAnnotation=15]="rectangleAnnotation",t[t.polygonAnnotation=16]="polygonAnnotation",t[t.polyLineAnnotation=17]="polyLineAnnotation",t[t.textMarkupAnnotation=18]="textMarkupAnnotation",t[t.caretAnnotation=19]="caretAnnotation",t[t.rubberStampAnnotation=20]="rubberStampAnnotation",t[t.popupAnnotation=21]="popupAnnotation",t[t.fileAttachmentAnnotation=22]="fileAttachmentAnnotation",t[t.soundAnnotation=23]="soundAnnotation",t[t.movieAnnotation=24]="movieAnnotation",t[t.screenAnnotation=25]="screenAnnotation",t[t.widgetAnnotation=26]="widgetAnnotation",t[t.printerMarkAnnotation=27]="printerMarkAnnotation",t[t.trapNetworkAnnotation=28]="trapNetworkAnnotation",t[t.watermarkAnnotation=29]="watermarkAnnotation",t[t.textWebLinkAnnotation=30]="textWebLinkAnnotation",t[t.inkAnnotation=31]="inkAnnotation",t[t.richMediaAnnotation=32]="richMediaAnnotation",t[t.angleMeasurementAnnotation=33]="angleMeasurementAnnotation",t[t.null=34]="null",(t=M._PdfGraphicsUnit||(M._PdfGraphicsUnit={}))[t.centimeter=0]="centimeter",t[t.pica=1]="pica",t[t.pixel=2]="pixel",t[t.point=3]="point",t[t.inch=4]="inch",t[t.document=5]="document",t[t.millimeter=6]="millimeter",(t=M._FieldFlag||(M._FieldFlag={}))[t.default=0]="default",t[t.readOnly=1]="readOnly",t[t.required=2]="required",t[t.noExport=4]="noExport",t[t.multiLine=4096]="multiLine",t[t.password=8192]="password",t[t.fileSelect=1048576]="fileSelect",t[t.doNotSpellCheck=4194304]="doNotSpellCheck",t[t.doNotScroll=8388608]="doNotScroll",t[t.comb=16777216]="comb",t[t.richText=33554432]="richText",t[t.noToggleToOff=16384]="noToggleToOff",t[t.radio=32768]="radio",t[t.pushButton=65536]="pushButton",t[t.radiosInUnison=33554432]="radiosInUnison",t[t.combo=131072]="combo",t[t.edit=262144]="edit",t[t.sort=524288]="sort",t[t.multiSelect=2097152]="multiSelect",t[t.commitOnSelectChange=67108864]="commitOnSelectChange",(t=M._SignatureFlag||(M._SignatureFlag={}))[t.none=0]="none",t[t.signatureExists=1]="signatureExists",t[t.appendOnly=2]="appendOnly",(t=M._PdfCheckFieldState||(M._PdfCheckFieldState={}))[t.unchecked=0]="unchecked",t[t.checked=1]="checked",t[t.pressedUnchecked=2]="pressedUnchecked",t[t.pressedChecked=3]="pressedChecked",(t=M._PdfWordWrapType||(M._PdfWordWrapType={}))[t.none=0]="none",t[t.word=1]="word",t[t.wordOnly=2]="wordOnly",t[t.character=3]="character",(t=M._FontDescriptorFlag||(M._FontDescriptorFlag={}))[t.fixedPitch=1]="fixedPitch",t[t.serif=2]="serif",t[t.symbolic=4]="symbolic",t[t.script=8]="script",t[t.nonSymbolic=32]="nonSymbolic",t[t.italic=64]="italic",t[t.forceBold=262144]="forceBold",(t=M._TrueTypeCmapFormat||(M._TrueTypeCmapFormat={}))[t.apple=0]="apple",t[t.microsoft=4]="microsoft",t[t.trimmed=6]="trimmed",(t=M._TrueTypeCmapEncoding||(M._TrueTypeCmapEncoding={}))[t.unknown=0]="unknown",t[t.symbol=1]="symbol",t[t.unicode=2]="unicode",t[t.macintosh=3]="macintosh",(t=M._TrueTypePlatformID||(M._TrueTypePlatformID={}))[t.appleUnicode=0]="appleUnicode",t[t.macintosh=1]="macintosh",t[t.iSO=2]="iSO",t[t.microsoft=3]="microsoft",(t=M._TrueTypeMicrosoftEncodingID||(M._TrueTypeMicrosoftEncodingID={}))[t[void 0]=0]="undefined",t[t.unicode=1]="unicode",(t=M._TrueTypeMacintoshEncodingID||(M._TrueTypeMacintoshEncodingID={}))[t.roman=0]="roman",t[t.japanese=1]="japanese",t[t.chinese=2]="chinese",(t=M._TrueTypeCompositeGlyphFlag||(M._TrueTypeCompositeGlyphFlag={}))[t.Arg1And2AreWords=1]="Arg1And2AreWords",t[t.ArgsAreXyValues=2]="ArgsAreXyValues",t[t.RoundXyToGrid=4]="RoundXyToGrid",t[t.WeHaveScale=8]="WeHaveScale",t[t.Reserved=16]="Reserved",t[t.MoreComponents=32]="MoreComponents",t[t.WeHaveAnXyScale=64]="WeHaveAnXyScale",t[t.WeHaveTwoByTwo=128]="WeHaveTwoByTwo",t[t.WeHaveInstructions=256]="WeHaveInstructions",t[t.UseMyMetrics=512]="UseMyMetrics",(t=M._ImageFormat||(M._ImageFormat={}))[t.unknown=0]="unknown",t[t.bmp=1]="bmp",t[t.emf=2]="emf",t[t.gif=3]="gif",t[t.jpeg=4]="jpeg",t[t.png=5]="png",t[t.wmf=6]="wmf",t[t.icon=7]="icon",(t=M._TokenType||(M._TokenType={}))[t.none=0]="none",t[t.comment=1]="comment",t[t.number=2]="number",t[t.real=3]="real",t[t.string=4]="string",t[t.hexString=5]="hexString",t[t.unicodeString=6]="unicodeString",t[t.unicodeHexString=7]="unicodeHexString",t[t.name=8]="name",t[t.operator=9]="operator",t[t.beginArray=10]="beginArray",t[t.endArray=11]="endArray",t[t.eof=12]="eof",(t=M._PdfColorSpace||(M._PdfColorSpace={}))[t.rgb=0]="rgb",t[t.cmyk=1]="cmyk",t[t.grayScale=2]="grayScale",t[t.indexed=3]="indexed",(t=M.PdfXmpSchemaType||(M.PdfXmpSchemaType={})).basic="Basic",t.dublinCore="DublinCore",t.pdf="PDF",t.pagedText="PagedText",t.basicJobTicket="BasicJobTicket",t.rightsManagement="RightsManagement",t.custom="Custom",(t=M.PdfTemplateLayerMode||(M.PdfTemplateLayerMode={}))[t.background=0]="background",t[t.foreground=1]="foreground",(t=M.PdfTemplateHorizontalAlignment||(M.PdfTemplateHorizontalAlignment={}))[t.none=0]="none",t[t.left=1]="left",t[t.center=2]="center",t[t.right=3]="right",(t=M.PdfTemplateVerticalAlignment||(M.PdfTemplateVerticalAlignment={}))[t.none=0]="none",t[t.top=1]="top",t[t.middle=2]="middle",t[t.bottom=3]="bottom",(t=M._PdfAlignmentStyle||(M._PdfAlignmentStyle={}))[t.topLeft=0]="topLeft",t[t.topCenter=1]="topCenter",t[t.topRight=2]="topRight",t[t.middleLeft=3]="middleLeft",t[t.middleCenter=4]="middleCenter",t[t.middleRight=5]="middleRight",t[t.bottomLeft=6]="bottomLeft",t[t.bottomCenter=7]="bottomCenter",t[t.bottomRight=8]="bottomRight",(t=M._PdfDocumentTemplateKey||(M._PdfDocumentTemplateKey={}))[t.top=0]="top",t[t.bottom=1]="bottom",t[t.left=2]="left",t[t.right=3]="right",t[t.evenTop=4]="evenTop",t[t.evenBottom=5]="evenBottom",t[t.evenLeft=6]="evenLeft",t[t.evenRight=7]="evenRight",t[t.oddTop=8]="oddTop",t[t.oddBottom=9]="oddBottom",t[t.oddLeft=10]="oddLeft",t[t.oddRight=11]="oddRight",(t=M._TemplateSide||(M._TemplateSide={}))[t.top=0]="top",t[t.bottom=1]="bottom",t[t.left=2]="left",t[t.right=3]="right",(t=M._TagClassType||(M._TagClassType={}))[t.universal=0]="universal",t[t.application=1]="application",t[t.context=2]="context",t[t.abstractSyntaxPrivate=3]="abstractSyntaxPrivate",t[t.nullValue=5]="nullValue",(t=M._ConstructionType||(M._ConstructionType={}))[t.primitive=0]="primitive",t[t.constructed=1]="constructed",(t=M._RealValueType||(M._RealValueType={}))[t.plusInfinity=64]="plusInfinity",t[t.minusInfinity=65]="minusInfinity",t[t.notANumber=66]="notANumber",t[t.minusZero=67]="minusZero",(t=M._RealEncodingBase||(M._RealEncodingBase={}))[t.base2=0]="base2",t[t.base8=16]="base8",t[t.base16=32]="base16",(t=M._RealEncodingScale||(M._RealEncodingScale={}))[t.scale0=0]="scale0",t[t.scale1=4]="scale1",t[t.scale2=8]="scale2",t[t.scale3=12]="scale3",(t=M._UniversalType||(M._UniversalType={}))[t.endOfContent=0]="endOfContent",t[t.abstractSyntaxBoolean=1]="abstractSyntaxBoolean",t[t.integer=2]="integer",t[t.bitString=3]="bitString",t[t.octetString=4]="octetString",t[t.nullValue=5]="nullValue",t[t.objectIdentifier=6]="objectIdentifier",t[t.objectDescriptor=7]="objectDescriptor",t[t.external=8]="external",t[t.realNumber=9]="realNumber",t[t.enumerated=10]="enumerated",t[t.embeddedDataValue=11]="embeddedDataValue",t[t.utf8String=12]="utf8String",t[t.relativeObjectIdentifier=13]="relativeObjectIdentifier",t[t.reservedBit14=14]="reservedBit14",t[t.time=14]="time",t[t.reservedBit15=15]="reservedBit15",t[t.sequence=16]="sequence",t[t.abstractSyntaxSet=17]="abstractSyntaxSet",t[t.numericString=18]="numericString",t[t.printableString=19]="printableString",t[t.teleprinterTextExchange=20]="teleprinterTextExchange",t[t.videoTextInformationSystem=21]="videoTextInformationSystem",t[t.internationalAlphabetString=22]="internationalAlphabetString",t[t.universalTime=23]="universalTime",t[t.generalizedTime=24]="generalizedTime",t[t.graphicString=25]="graphicString",t[t.visibleString=26]="visibleString",t[t.generalString=27]="generalString",t[t.universalString=28]="universalString",t[t.characterString=29]="characterString",t[t.bmpString=30]="bmpString",t[t.date=31]="date",t[t.timeOfDay=32]="timeOfDay",t[t.dateTime=33]="dateTime",t[t.duration=34]="duration",t[t.objectIdResourceIdentifier=35]="objectIdResourceIdentifier",t[t.relativeResourceIdentifier=36]="relativeResourceIdentifier",Object.defineProperty(V.prototype,"buffer",{get:function(){return this._flush(),this._buffer},enumerable:!0,configurable:!0}),V.prototype._writeStartDocument=function(t){if("Initial"!==this._currentState||void 0===this._buffer)throw new Error("InvalidOperationException: Wrong Token");this._currentState="StartDocument",this._rawText('<?xml version="1.0" encoding="utf-8'),null!=t&&(this._rawText('" standalone="'),this._rawText(t?"yes":"no")),this._rawText('"?>')},V.prototype._writeStartElement=function(t,e,i){if(void 0===this._buffer)throw new Error("InvalidOperationException: Wrong Token");if(null==t||0===t.length)throw new Error("ArgumentException: localName cannot be undefined, null or empty");if(this._checkName(t),"Initial"===this._currentState&&this._writeStartDocument(),"StartElement"===this._currentState&&this._startElementContent(),this._currentState="StartElement",null==e)null==(e=null!=i?this._lookupPrefix(i):e)&&(e="");else if(0<e.length&&(null==(i=null==i?this._lookupNamespace(e):i)||void 0!==i&&0===i.length))throw new Error("ArgumentException: Cannot use a prefix with an empty namespace");null==i&&(i=this._lookupNamespace(e)),this._writeStartElementInternal(e,t,i)},V.prototype._writeEndElement=function(){"StartElement"===this._currentState?(this._startElementContent(),this._currentState="ElementContent"):"ElementContent"===this._currentState&&(this._currentState="ElementContent"),this._currentState="EndElement";var t=this._elementStack.length-1;this._writeEndElementInternal(this._elementStack[t]._prefix,this._elementStack[t]._localName),this._namespaceStack.splice(this._elementStack[t]._previousTop+1),this._elementStack.splice(t)},V.prototype._writeElementString=function(t,e,i,n){this._writeStartElement(t,i,n),null!=e&&0!==e.length&&this._writeString(e),this._writeEndElement()},V.prototype._writeAttributeString=function(t,e,i,n){this._writeStartAttribute(t,e,i,n),this._writeStringInternal(e,!0),this._writeEndAttribute()},V.prototype._writeString=function(t){this._writeInternal(t,!1)},V.prototype._writeRaw=function(t){this._writeInternal(t,!0)},V.prototype._writeInternal=function(t,e){if(null!=t){if("StartElement"!==this._currentState&&"ElementContent"!==this._currentState)throw new Error("InvalidOperationException: Wrong Token");"StartElement"===this._currentState&&this._startElementContent(),this._currentState="ElementContent",e?this._rawText(t):this._writeStringInternal(t,!1)}},V.prototype._save=function(){for(;0<this._elementStack.length-1;)this._writeEndElement();return""!==this._bufferText&&this._flush(),this._buffer},V.prototype._destroy=function(){this._buffer=void 0;for(var t=0;t<this._namespaceStack.length;t++)this._namespaceStack[t]._destroy();this._namespaceStack=[];for(t=0;t<this._elementStack.length;t++)this._elementStack[t]._destroy();this._elementStack=[],this._bufferText="",this._position=0},V.prototype._flush=function(){if(this._buffer&&this._bufferText&&""!==this._bufferText){if(0<this._buffer.length){for(var t=new Array(this._bufferText.length),e=0;e<this._bufferText.length;e++)t[e]=255&this._bufferText.charCodeAt(e);var i=new Uint8Array(this._buffer.length+t.length);i.set(this._buffer),i.set(t,this._buffer.length),this._buffer=i}else this._buffer=v(this._bufferText);this._bufferText=""}},V.prototype._writeStartAttribute=function(t,e,i,n){if(null==t||0===t.length){if("xmlns"!==i)throw new Error("ArgumentException: localName cannot be undefined, null or empty");t="xmlns",i=""}if("StartElement"!==this._currentState)throw new Error("InvalidOperationException: Wrong Token");this._checkName(t),this._writeStartAttributePrefixAndNameSpace(t,e,i,n)},V.prototype._writeStartAttributePrefixAndNameSpace=function(t,e,i,n){null==i&&null==(i=null==n||"xmlns"===t&&"http://www.w3.org/2000/xmlns/"===n?i:this._lookupPrefix(n))&&(i=""),null==n&&null==(n=null!=i&&0<i.length?this._lookupNamespace(i):n)&&(n=""),this._writeStartAttributeSpecialAttribute(i,t,n,e)},V.prototype._writeStartAttributeSpecialAttribute=function(t,e,i,n){if(0===t.length){if("x"===e[0]&&"xmlns"===e)return this._skipPushAndWrite(t,e,i),void this._pushNamespaceExplicit("",n);0<i.length&&(t=this._lookupPrefix(i))}else{if("x"===t[0]){if("xmlns"===t)return this._skipPushAndWrite(t,e,i),void this._pushNamespaceExplicit(e,n);if("xml"===t&&("space"===e||"lang"===e))return void this._skipPushAndWrite(t,e,i)}0===i.length&&(t="")}null!=t&&0!==t.length&&this._pushNamespaceImplicit(t,i),this._skipPushAndWrite(t,e,i)},V.prototype._writeEndAttribute=function(){this._currentState="StartElement",this._bufferText+='"'},V.prototype._writeStartElementInternal=function(t,e,i){this._bufferText+="<",0<t.length&&(this._rawText(t),this._bufferText+=":"),this._rawText(e);var n=this._elementStack.length;this._elementStack.push(new H),this._elementStack[n]._set(t,e,i,this._namespaceStack.length-1),this._pushNamespaceImplicit(t,i);for(var r=0;r<this._attributeStack.length;r++)this._attributeStack[r]._destroy();this._attributeStack=[]},V.prototype._writeEndElementInternal=function(t,e){this._position!==this._bufferText.length+1?(this._bufferText+="</",null!=t&&0!==t.length&&(this._rawText(t),this._bufferText+=":"),this._rawText(e),this._bufferText+=">"):(this._bufferText=this._bufferText.substring(0,this._bufferText.length-1),this._bufferText+=" />")},V.prototype._writeStartAttributeInternal=function(t,e){this._bufferText+=" ",null!=t&&0<t.length&&(this._rawText(t),this._bufferText+=":"),this._rawText(e),this._bufferText+='="'},V.prototype._writeNamespaceDeclaration=function(t,e){this._skipNamespace||(this._writeStartNamespaceDeclaration(t),this._writeStringInternal(e,!0),this._bufferText+='"')},V.prototype._writeStartNamespaceDeclaration=function(t){null==t||0===t.length?this._rawText(' xmlns="'):(this._rawText(" xmlns:"),this._rawText(t),this._bufferText+="=",this._bufferText+='"')},V.prototype._writeStringInternal=function(t,e){t=(t=(t=(t=(t=null==t?"":t).replace(/\&/g,"&")).replace(/\</g,"<")).replace(/\>/g,">")).replace(/\u0000/g,""),e&&(t=t.replace(/\"/g,""")),this._bufferText+=t,e||(this._position=0)},V.prototype._startElementContent=function(){for(var t=this._elementStack[this._elementStack.length-1]._previousTop,e=this._namespaceStack.length-1;t<e;e--)"NeedToWrite"===this._namespaceStack[e]._kind&&this._writeNamespaceDeclaration(this._namespaceStack[e]._prefix,this._namespaceStack[e]._namespaceUri);this._bufferText+=">",this._position=this._bufferText.length+1},V.prototype._rawText=function(t){this._bufferText+=t},V.prototype._addNamespace=function(t,e,i){var n=this._namespaceStack.length;this._namespaceStack.push(new z),this._namespaceStack[n]._set(t,e,i)},V.prototype._lookupPrefix=function(t){for(var e=this._namespaceStack.length-1;0<=e;e--)if(this._namespaceStack[e]._namespaceUri===t)return this._namespaceStack[e]._prefix},V.prototype._lookupNamespace=function(t){for(var e=this._namespaceStack.length-1;0<=e;e--)if(this._namespaceStack[e]._prefix===t)return this._namespaceStack[e]._namespaceUri},V.prototype._lookupNamespaceIndex=function(t){for(var e=this._namespaceStack.length-1;0<=e;e--)if(this._namespaceStack[e]._prefix===t)return e;return-1},V.prototype._pushNamespaceImplicit=function(t,e){var i,n=this._lookupNamespaceIndex(t),r=!0;if(-1!==n)if(n>this._elementStack[this._elementStack.length-1]._previousTop){if(this._namespaceStack[n]._namespaceUri!==e)throw new Error("XmlException namespace Uri needs to be the same as the one that is already declared");r=!1}else if("Special"===this._namespaceStack[n]._kind){if("xml"!==t)throw new Error('InvalidArgumentException: Prefix "xmlns" is reserved for use by XML.');if(e!==this._namespaceStack[n]._namespaceUri)throw new Error("InvalidArgumentException: Xml String");i="Implied"}else i=this._namespaceStack[n]._namespaceUri===e?"Implied":"NeedToWrite";else{if("http://www.w3.org/XML/1998/namespace"===e&&"xml"!==t||"http://www.w3.org/2000/xmlns/"===e&&"xmlns"!==t)throw new Error("InvalidArgumentException");i="NeedToWrite"}r&&this._addNamespace(t,e,i)},V.prototype._pushNamespaceExplicit=function(t,e){var i=this._lookupNamespaceIndex(t);-1!==i&&i>this._elementStack[this._elementStack.length-1]._previousTop?this._namespaceStack[i]._kind="Written":this._addNamespace(t,e,"Written")},V.prototype._addAttribute=function(t,e,i){var n=this._attributeStack.length;this._attributeStack.push(new q),this._attributeStack[n]._set(t,e,i);for(var r=0;r<n;r++)if(this._attributeStack[r]._isDuplicate(t,e,i))throw new Error("XmlException: duplicate attribute name")},V.prototype._skipPushAndWrite=function(t,e,i){this._addAttribute(t,e,i),this._writeStartAttributeInternal(t,e)},V.prototype._checkName=function(t){if(/[ !@#$%^&*()+\=\[\]{};':"\\|,<>\/?]/.test(t))throw new Error("InvalidArgumentException: invalid name character")};var j=V;function V(t){void 0===t&&(t=!1),this._position=0,this._bufferText="",this._buffer=new Uint8Array(0),this._namespaceStack=[],this._elementStack=[],t?(this._currentState="StartDocument",this._skipNamespace=!0):(this._currentState="Initial",this._namespaceStack.push(new z),this._elementStack.push(new H),this._namespaceStack[0]._set("xmlns","http://www.w3.org/2000/xmlns/","Special"),this._namespaceStack.push(new z),this._namespaceStack[1]._set("xml","http://www.w3.org/XML/1998/namespace","Special"),this._namespaceStack.push(new z),this._namespaceStack[2]._set("","","Implied"),this._elementStack[0]._set("","","",this._namespaceStack.length-1)),this._attributeStack=[]}U.prototype._set=function(t,e,i){this._prefix=t,this._namespaceUri=e,this._kind=i},U.prototype._destroy=function(){this._prefix=void 0,this._namespaceUri=void 0,this._kind=void 0};var z=U;function U(){}W.prototype._set=function(t,e,i,n){this._previousTop=n,this._prefix=t,this._namespaceUri=i,this._localName=e},W.prototype._destroy=function(){this._previousTop=void 0,this._prefix=void 0,this._localName=void 0,this._namespaceUri=void 0};var H=W;function W(){}G.prototype._set=function(t,e,i){this._prefix=t,this._namespaceUri=i,this._localName=e},G.prototype._isDuplicate=function(t,e,i){return this._localName===e&&(this._prefix===t||this._namespaceUri===i)},G.prototype._destroy=function(){this._prefix=void 0,this._namespaceUri=void 0,this._localName=void 0};var q=G;function G(){}K=function(t,e){return(K=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var K,t=function(t,e){function i(){this.constructor=t}K(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},X=(J.prototype._exportFormFieldsData=function(t){var e,i="";if(null!=t&&t.export){var n=Ds(t._dictionary,"FT",!1,!0,"Parent");if(n&&null!==n.name&&void 0!==n.name){var r,s,a,o,h,c,_=this._getEncodedFontDictionary(t._dictionary),d=t.name,l=(null!=_&&(d="string"==typeof(r=this._getEncodedValue(d,_))?r:d),void 0),u=void 0;switch(n.name){case"Tx":null!=(i=Ds(t._dictionary,"V",!1,!0,"Parent"))?(e=this._getEncodedValue(i,_),this._table.set(d,i="string"==typeof e?e:i)):this._exportEmptyFields&&this._table.set(d,i="");break;case"Ch":if(null!=(l=Ds(t._dictionary,"V",!0,!0,"Parent"))&&(u=this._getExportValue(l)),null!=(u=!l&&t._dictionary.has("I")&&(t instanceof ai||t instanceof ni)?t._obtainSelectedValue():u)){if("string"==typeof u&&""!==u)e=this._getEncodedValue(u,_),this._table.set(d,i="string"==typeof e?e:u);else if(u instanceof Array&&0<u.length){for(var p=[],f=0;f<u.length;f++)e=this._getEncodedValue(u[f],_),p.push("string"==typeof e?e:u[f]);return this._table.set(d,p),p}}else this._exportEmptyFields&&this._table.set(d,i="");break;case"Btn":null!=(l=Ds(t._dictionary,"V",!1,!0,"Parent"))?null!=(s=this._getExportValue(l,t))&&""!==s?(c=void 0,t instanceof Qe&&(c=t),(!t._dictionary.has("Opt")||null!=c&&-1===c.selectedIndex||t._dictionary.has("Opt")&&(a=t._dictionary.getArray("Opt"),null!=(o=Number(s))&&!Number.isNaN(o)||(o=0),null!=a)&&(h=void 0,null!=(s=null!=(h=c?a[c.selectedIndex]:a[o])?h:s))&&""!==s)&&(i=s="string"==typeof(e=this._getEncodedValue(s,_))?e:s,this._table.set(d,i))):(t instanceof Qe||t instanceof Xe)&&(i=this._exportEmptyFields?s:"Off",this._table.set(d,i)):t instanceof Qe?(i=(i=t._getAppearanceStateValue())||(this._exportEmptyFields?"":"Off"),this._table.set(d,i)):(c=void 0,(c=(t.itemAt(t._defaultIndex)||t)._dictionary)&&c.has("AS")?(i=c.get("AS").name,this._table.set(d,i)):this._exportEmptyFields&&this._table.set(d,i=""))}}}return i},J.prototype._exportFormFieldData=function(t){var e,i=Ds(t._dictionary,"FT",!1,!0,"Parent");if(i&&null!==i.name&&void 0!==i.name){var n,r,s,a,o,h,c=this._getEncodedFontDictionary(t._dictionary),_=t.name,d=(null!=c&&(_="string"==typeof(e=this._getEncodedValue(_,c))?e:_),void 0),l=void 0;switch(i.name){case"Tx":d=Ds(t._dictionary,"V",!1,!0,"Parent"),this._asPerSpecification?t._dictionary.has("RV")?null!=(d=Ds(t._dictionary,"RV",!1,!0,"Parent"))&&(d+=this._key,this._formKey=this._key,this._table.set(_,d)):null!=d&&(h=d="string"==typeof(n=this._getEncodedValue(d,c))?n:d,t instanceof Ue&&t.multiLine&&(d=h=(h=h.replace("\n","")).replace("\r","\r\n")),this._table.set(_,d)):null!=d?(n=this._getEncodedValue(d,c),this._table.set(_,d="string"==typeof n?n:d)):this._exportEmptyFields&&this._table.set(_,"");break;case"Ch":if(l=Ds(t._dictionary,"V",!0,!0,"Parent"),this._asPerSpecification){if(t instanceof ti)if(Array.isArray(l))this._table.set(_,l);else if("string"==typeof l)n=this._getEncodedValue(l,c),this._table.set(_,l="string"==typeof n?n:l);else if(null==l&&t._dictionary.has("I"))if(null!=(f=t._obtainSelectedValue()))if("string"==typeof f&&""!==f)f="string"==typeof(n=this._getEncodedValue(f,c))?n:f,this._table.set(_,d);else if(f instanceof Array&&0<f.length){for(var u=[],p=0;p<f.length;p++)n=this._getEncodedValue(f[p],c),u.push("string"==typeof n?n:f[p]);this._table.set(_,u)}}else{var f=void 0;if(null!=l&&(f=this._getExportValue(l)),null!=(f=!l&&t._dictionary.has("I")&&(t instanceof ai||t instanceof ni)?t._obtainSelectedValue():f))if("string"==typeof f&&""!==f)n=this._getEncodedValue(f,c),this._table.set(_,f="string"==typeof n?n:f);else if(f instanceof Array&&0<f.length){for(u=[],p=0;p<f.length;p++)n=this._getEncodedValue(f[p],c),u.push("string"==typeof n?n:f[p]);this._table.set(_,u)}else this._exportEmptyFields&&this._table.set(_,"");else this._exportEmptyFields&&this._table.set(_,"")}break;case"Btn":null!=(l=Ds(t._dictionary,"V",!1,!0,"Parent"))?null!=(o=this._getExportValue(l,t))&&""!==o?(this._asPerSpecification&&"XML"!==this._format&&(o=Cs(o)),h=void 0,t instanceof Qe&&(h=t),(!t._dictionary.has("Opt")||null!=h&&-1===h.selectedIndex||t._dictionary.has("Opt")&&(r=t._dictionary.getArray("Opt"),null!=(s=Number(o))&&!Number.isNaN(s)||(s=0),null!=r)&&(a=void 0,null!=(o=null!=(a=h?r[h.selectedIndex]:r[s])?a:o))&&""!==o)&&(n=this._getEncodedValue(o,c),this._table.set(_,o="string"==typeof n?n:o))):(t instanceof Qe||t instanceof Xe)&&(this._exportEmptyFields?this._table.set(_,o):this._table.set(_,"Off")):t instanceof Qe?(o=(o=t._getAppearanceStateValue())||(this._exportEmptyFields?"":"Off"),this._table.set(_,o)):(h=void 0,(h=(t.itemAt(t._defaultIndex)||t)._dictionary)&&h.has("AS")?this._table.set(_,h.get("AS").name):this._exportEmptyFields&&this._table.set(_,""))}}},J.prototype._getAnnotationType=function(t){var e="";return e=t&&t.has("Subtype")&&(t=t.get("Subtype"))?t.name:e},J.prototype._getValue=function(t,e){void 0===e&&(e=!1);var i="";if(null!=t)if(t instanceof R)i=t.name;else if("boolean"==typeof t)i=t?e?"true":"yes":e?"false":"no";else if("string"==typeof t)i=this._getValidString(t);else if(Array.isArray(t)){var n=t;0<n.length&&(i=this._getValue(n[0],e));for(var r=1;r<n.length;r++)i+=","+this._getValue(n[r],e)}else"number"==typeof t?i=t.toString():t instanceof m&&(i=this._getValue(this._crossReference._fetch(t),e));return i},J.prototype._getColor=function(t){var e,i,n="";return t&&Array.isArray(t)&&3<=t.length&&(e=Math.round(255*t[0]).toString(16).toUpperCase(),i=Math.round(255*t[1]).toString(16).toUpperCase(),t=Math.round(255*t[2]).toString(16).toUpperCase(),n="#"+(1===e.length?"0"+e:e)+(1===i.length?"0"+i:i)+(1===t.length?"0"+t:t)),n},J.prototype._getValidString=function(t){return t=-1!==(t=-1!==t.indexOf("\n")?t.replace(/\n/g,"\\n"):t).indexOf("\r")?t.replace(/\r/g,"\\r"):t},J.prototype._getEncodedFontDictionary=function(t){var e,i,n;return t.has("Kids")&&!t.has("AP")&&(n=t.getArray("Kids")),e=(t.has("AP")||null!=n&&Array.isArray(n))&&(i=void 0,null!=n&&0<n.length?null!=(n=n[0])&&n.has("AP")&&(i=n.get("AP")):i=t.get("AP"),null!=i)&&i.has("N")&&null!=(n=i.get("N"))&&n instanceof y&&n.dictionary.has("Resources")&&null!=(t=n.dictionary.get("Resources"))&&t.has("Font")?t.get("Font"):e},J.prototype._getEncodedValue=function(t,e){var n,r=this,s=t;if(null!==this._encodeDictionary&&void 0!==this._encodeDictionary)return n=new Z(this._encodeDictionary),this._replaceNotUsedCharacters(s,n);var i=this._document.form._dictionary;if(null!=i&&i.has("DR")){i=i.get("DR");if(null!=i&&i.has("Encoding")){i=i.get("Encoding");if(null!=i&&i.has("PDFDocEncoding")){i=i.get("PDFDocEncoding");if(null!=i&&i.has("Differences")){var a=new D(this._crossReference),i=(a.set("Differences",i.get("Differences")),this._crossReference._getNextReference()),a=(this._crossReference._cacheMap.set(i,a),new D(this._crossReference));if(a.set("Subtype",R.get("Type1")),a.set("Encoding",i),null!=(n=new Z(a))&&null!==n.differencesDictionary&&void 0!==n.differencesDictionary&&0<n.differencesDictionary.size)return this._encodeDictionary=a,this._replaceNotUsedCharacters(s,n)}}}}if(null!=t&&null!=e&&0<e.size){var o,h=!1;if(e.forEach(function(t,e){var i;h||null==e||(i=void 0,e instanceof D?i=e:e instanceof m&&null!=(e=r._crossReference._fetch(e))&&e instanceof D&&(i=e),i&&(n=new Z(i),o=r._replaceNotUsedCharacters(s,n),h=!0))}),!h)return o}return s},J.prototype._replaceNotUsedCharacters=function(t,e){for(var i="",n=e.differencesDictionary,r=0;r<t.length;r++){var s,a=t[r],o=t.charCodeAt(r);!n.has(a)||1<(s=n.get(a)).length&&"Type3"!==e._fontType||127<o&&o<=255&&"Type1"===e._fontType&&"WinAnsiEncoding"!==e._baseFontEncoding&&"Encoding"===e._fontEncoding&&"ZapfDingbats"===e._fontName?i+=a:i+=s}return i},J.prototype._getExportValue=function(t,e){var i,n;if(null!=t)if(null!=e)t instanceof R?i=t.name:"string"==typeof t&&(i=t),null!=i&&""!==i&&e instanceof Qe&&-1!==e.selectedIndex&&null!=(e=e.itemAt(e.selectedIndex))&&e.value===i&&(i=e.value);else if(t instanceof R)i=t.name;else if("string"==typeof t)i=t;else if(Array.isArray(t))return n=[],t.forEach(function(t){t instanceof R?n.push(t.name):"string"==typeof t&&n.push(t)}),n;return i},J.prototype._addReferenceToGroup=function(t,e){var i=e.get("NM");i&&""!==i?(this._groupReferences.set(i,t),e.has("IRT")&&this._groupHolders.push(e)):!i&&e.has("IRT")&&(i=e.get("IRT"))&&""!==i&&this._groupReferences.has(i)&&e.update("IRT",this._groupReferences.get(i))},J.prototype._handlePopup=function(t,e,i,n){var r;i&&i.has("Popup")&&(r=i.getRaw("Popup"),i=i.get("Popup"))&&i instanceof D&&(r&&i&&i.update("Parent",e),r=t._parseAnnotation(i),e=t._annotations.length,n.set("Annots",t._annotations),n._updated=!0,t._parsedAnnotations.set(e,r))},J.prototype._importField=function(){var n=this,r=this._document.form,s=r.count;s&&this._fields.forEach(function(t,e){0<n._richTextValues.size&&n._richTextValues.has(e)&&(i=n._richTextValues.get(e));var i,e=r._getFieldIndex(e);-1!==e&&e<s&&(e=r.fieldAt(e))&&null!=e&&(i&&""!==i&&e._dictionary.update("RV",i),n._importFieldData(e,t))})},J.prototype._importFieldData=function(t,e){if(null!=e&&0<e.length&&null!=t&&!t.readOnly){var i=e[0];if(t instanceof Ue)null!=i&&(t instanceof Ue&&t.multiLine&&(i=(i=i.replace("\r\n","\r")).replace("\n","\r")),t.text=i);else if(t instanceof ai||t instanceof ni){var n=1<e.length?e:this._xmlImport?-1!==i.indexOf(",")?i.split(","):[i]:[-1!==i.indexOf(",")?i.split(",")[0]:i],r=[],s=t._options;s&&0<s.length&&s.forEach(function(t){-1===n.indexOf(t[0])&&-1===n.indexOf(t[1])||r.push(s.indexOf(t))}),0<r.length&&(t.selectedIndex=r,t instanceof ni)&&this._asPerSpecification&&t._dictionary.has("AP")&&(delete t._dictionary._map.AP,t._dictionary._updated=!0)}else if(t instanceof Xe){e=i.toLowerCase();this._containsExportValue(i,t)||"on"===e||"yes"===e?t.checked=!0:t.checked=!1}else if(t instanceof Qe){for(var a=-1,o=0;o<t._kidsCount;o++){var h=t.itemAt(o);if(h&&h.value&&h.value===i){a=o;break}}-1!==a&&t.selectedIndex!==a&&(t.selectedIndex=a)}}},J.prototype._containsExportValue=function(e,t){var i,n=!1;if(0<t._kidsCount)for(var r=0;r<t._kidsCount;r++){var s=t.itemAt(r);if(s&&this._checkSelected(s._dictionary,e))return t._defaultIndex=r,!0}else!(n=this._checkSelected(t._dictionary,e))&&this._asPerSpecification&&t._dictionary.has("AS")&&(!(i=t._dictionary.get("AS"))||"Off"!==i.name&&"No"!==i.name?n=!0:t._dictionary.has("Opt")&&(i=t._dictionary.getArray("Opt"))&&0<i.length&&i.forEach(function(t){t===e&&(n=!0)}));return n},J.prototype._checkSelected=function(t,e){if(t&&t.has("AP")){t=t.get("AP");if(t&&t instanceof D&&t.has("N")){t=t.get("N");if(t&&t instanceof D&&t.has(e)&&"off"!==e.toLocaleLowerCase()&&"no"!==e.toLocaleLowerCase())return!0}}return!1},J.prototype._dispose=function(){this.exportAppearance=void 0,this._asPerSpecification=void 0,this._skipBorderStyle=void 0,this._fileName=void 0,this._document=void 0,this._crossReference=void 0,this._isAnnotationExport=void 0,this._isAnnotationImport=void 0,this._key=void 0,this._formKey=void 0,this._exportEmptyFields=void 0,this._groupReferences=void 0,this._groupHolders=void 0,this._encodeDictionary=void 0,this._annotationTypes=void 0,this._annotationAttributes=void 0,this._xmlDocument=void 0,this._parser=void 0,this._table=void 0,this._fields=void 0,this._richTextValues=void 0,this._jsonData=void 0},J);function J(){this._asPerSpecification=!1,this._fileName="",this._formKey="",this._exportEmptyFields=!1,this._groupReferences=new Map,this._groupHolders=[],this._richTextPrefix='<?xml version="1.0"?>',this._table=new Map,this._fields=new Map,this._richTextValues=new Map,this._jsonData=[],this._openingBrace=123,this._openingBracket=91,this._closingBrace=125,this._closingBracket=93,this._colon=58,this._doubleQuotes=34,this._comma=44,this._space=32,this.fdfString="",this._xmlImport=!1}t(e,Y=X),e.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._save()},e.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._key=ia(),this._save()},e.prototype._save=function(){var t=new j;if(t._writeStartDocument(),t._writeStartElement("xfdf"),t._writeAttributeString(null,"http://ns.adobe.com/xfdf/","xmlns",null),t._writeAttributeString("space","preserve","xml",null),this._isAnnotationExport){if(t._writeStartElement("annots"),this._document)for(var e=0;e<this._document.pageCount;e++)for(var i=this._document.getPage(e).annotations,n=0;n<i.count;n++){var r=i.at(n);r instanceof Qi&&r._dictionary.has("Parent")||r&&(!this._annotationTypes||0===this._annotationTypes.length||this._annotationTypes&&0<this._annotationTypes.length&&this._checkAnnotationType(r))&&this._exportAnnotationData(r,t,e)}t._writeEndElement()}else{var s=this._document.form;if(null!=s){this._exportEmptyFields=s.exportEmptyFields;for(var a=this._document.form.count,e=0;e<a;e++){var o=this._document.form.fieldAt(e);null!=o&&o.export&&this._exportFormFieldData(o)}this._writeFormFieldData(t,this._asPerSpecification)}}this._asPerSpecification||(t._writeStartElement("f"),t._writeAttributeString("href",this._fileName));s=t._save();return t._destroy(),s},e.prototype._writeFormFieldData=function(i,t){var n,e,r=this;(t=void 0===t?!1:t)?(i._writeStartElement("f"),i._writeAttributeString("href",this._fileName),i._writeEndElement(),(t=this._getElements(this._table))&&0<t.size&&(i._writeStartElement("fields"),n=!1,t.forEach(function(t,e){i._writeStartElement("field"),i._writeAttributeString("name",e.toString()),Array.isArray(t)&&t.forEach(function(t){i._writeStartElement("value"),i._writeString(t.toString()),i._writeEndElement(),n=!0}),t instanceof Map?r._writeFieldName(t,i):!n&&!t.toString().endsWith(r._formKey)||!n&&""===r._formKey?(i._writeStartElement("value"),i._writeString(t.toString()),i._writeEndElement()):""!==r._formKey&&t.toString().endsWith(r._formKey)&&(i._writeStartElement("value-richtext"),t=(e=(e=t.toString()).startsWith('<?xml version="1.0"?>')?e.substring(21):e).length-r._formKey.length,e=e.substring(0,t)+e.substring(t+r._formKey.length),i._writeRaw(e),i._writeEndElement()),i._writeEndElement(),n=!1}),i._writeEndElement()),i._writeStartElement("ids"),t=!1,this._crossReference._root.has("ID")&&(e=this._crossReference._root.getArray("ID"))&&1<=e.length&&(i._writeAttributeString("original",e[0]),i._writeAttributeString("modified",e[1]),t=!0),t||(i._writeAttributeString("original",""),i._writeAttributeString("modified",""))):(i._writeStartElement("fields"),this._table.forEach(function(t,e){i._writeStartElement("field"),i._writeAttributeString("name",e.toString()),Array.isArray(t)?t.forEach(function(t){i._writeStartElement("value"),i._writeString(t.toString()),i._writeEndElement()}):(i._writeStartElement("value"),i._writeString(t.toString()),i._writeEndElement()),i._writeEndElement()})),i._writeEndElement()},e.prototype._writeFieldName=function(t,n){var r=this;t.forEach(function(t,e){var i;t instanceof Map?(n._writeStartElement("field"),n._writeAttributeString("name",e.toString()),r._writeFieldName(t,n)):(n._writeStartElement("field"),n._writeAttributeString("name",e.toString()),Array.isArray(t)?t.forEach(function(t){n._writeStartElement("value"),n._writeString(t.toString()),n._writeEndElement()}):(t.toString().endsWith(r._formKey)&&""!==r._formKey?(n._writeStartElement("value-richtext"),i=(e=(e=t.toString()).startsWith('<?xml version="1.0"?>')?e.substring(21):e).length-r._formKey.length,e=e.substring(0,i)+e.substring(i+r._formKey.length),n._writeRaw(e)):(n._writeStartElement("value"),n._writeString(t.toString())),n._writeEndElement())),n._writeEndElement()})},e.prototype._getElements=function(t){var s=this,e=new Map;return t.forEach(function(i,t){var n,r=e;-1!==t.toString().indexOf(".")?(n=t.toString().split(".")).forEach(function(t,e){r.has(t)?(s._getElements(r.get(t)),r=r.get(t)):e===n.length-1?r.set(t,i):(e=new Map,r.set(t,e),r=e)}):r.set(t,i)}),e},e.prototype._checkAnnotationType=function(t){return void 0!==t._type&&-1!==this._annotationTypes.indexOf(t._type)},e.prototype._exportAnnotationData=function(t,e,i){t._dictionary&&!(t instanceof tn||t instanceof _n||t instanceof on||t instanceof gn)&&this._writeAnnotationData(e,i,t)},e.prototype._writeAnnotationData=function(t,e,i){var n,r=!1,i=i instanceof bi?(n=i)._dictionary:i,s=this._getAnnotationType(i);if(this._skipBorderStyle=!1,s&&""!==s){this._annotationAttributes=[],t._writeStartElement(s.toLowerCase()),t._writeAttributeString("page",e.toString()),this._annotationAttributes.push("page");var a=void 0;switch(s){case"Line":a=n.linePoints,t._writeAttributeString("start",a[0].x.toString()+","+a[0].y.toString()),t._writeAttributeString("end",a[1].x.toString()+","+a[1].y.toString());break;case"Stamp":case"Square":r=!0}i&&i.has("BE")&&i.has("BS")&&(s=i.get("BE"))&&s.has("S")&&(this._skipBorderStyle=!0),this._writeDictionary(i,e,t,r),t._writeEndElement(),this._annotationAttributes=[]}},e.prototype._writeDictionary=function(n,r,s,a){var t,e,i,o,h=this,c=!1;if(n.has("Type")&&(e=n.get("Type"),c=e&&"Border"===e.name&&this._skipBorderStyle),n.forEach(function(t,e){if((a||"AP"!==t)&&"P"!==t&&"Parent"!==t&&"Measure"!==t&&"Popup"!==t&&-1===t.indexOf(":")){var i=void 0;if((i=e instanceof m?n.get(t):e)&&i instanceof D)switch(t){case"BS":case"BE":h._writeDictionary(i,r,s,!1);break;case"IRT":i.has("NM")&&s._writeAttributeString("inreplyto",h._getValue(i.get("NM")));break;default:h._writeDictionary(i,r,s,!1)}else c&&"S"===t||h._writeAttribute(s,t,i)}}),(this.exportAppearance||a)&&n.has("AP")&&(e=this._getAppearanceString(n.get("AP")))&&0<e.length&&(s._writeStartElement("appearance"),s._writeRaw(Is(e)),s._writeEndElement()),n.has("Measure")&&this._exportMeasureDictionary(n.get("Measure"),s),n.has("Sound")?(e=n.get("Sound"))&&e.dictionary&&((i=e.dictionary).has("B")&&s._writeAttributeString("bits",this._getValue(i.get("B"))),i.has("C")&&s._writeAttributeString("channels",this._getValue(i.get("C"))),i.has("E")&&s._writeAttributeString("encoding",this._getValue(i.get("E"))),i.has("R")&&s._writeAttributeString("rate",this._getValue(i.get("R"))),i.has("Length"))&&0<i.get("Length")&&(o=As(e.getBytes()))&&""!==o&&(s._writeStartElement("data"),s._writeAttributeString("MODE","raw"),s._writeAttributeString("encoding","hex"),i.has("Length")&&s._writeAttributeString("length",this._getValue(i.get("Length"))),i.has("Filter")&&s._writeAttributeString("filter",this._getValue(i.get("Filter"))),s._writeRaw(o),s._writeEndElement()):n.has("FS")&&(s._writeStartElement("data"),(e=n.get("FS"))&&(e.has("F")&&s._writeAttributeString("file",this._getValue(e.get("F"))),e.has("EF"))&&(i=e.get("EF"))&&i.has("F")&&(e=i.get("F"))&&e.dictionary&&((i=e.dictionary).has("Params")&&(t=i.get("Params"))&&(t.has("CreationDate")&&(l=this._getValue(t.get("CreationDate")),s._writeAttributeString("creation",l)),t.has("ModificationDate")&&(l=this._getValue(t.get("ModificationDate")),s._writeAttributeString("modification",l)),t.has("Size")&&s._writeAttributeString("size",this._getValue(t.get("Size"))),t.has("CheckSum"))&&(t=As(v(l=this._getValue(t.get("CheckSum")))),s._writeAttributeString("checksum",t)),o=As(e.getBytes()))&&""!==o&&(s._writeStartElement("data"),s._writeAttributeString("MODE","raw"),s._writeAttributeString("encoding","hex"),i.has("Length")&&s._writeAttributeString("length",this._getValue(i.get("Length"))),i.has("Filter")&&s._writeAttributeString("filter",this._getValue(i.get("Filter"))),s._writeRaw(o),s._writeEndElement()),s._writeEndElement()),n.has("Vertices")){s._writeStartElement("vertices");var _=n.getArray("Vertices");if(_&&0<_.length){var d=_.length;if(d%2==0){for(var l="",u=0;u<d-1;u++)l+=this._getValue(_[u])+(u%2!=0?";":",");(l+=this._getValue(_[d-1]))&&""!==l&&s._writeRaw(l)}}s._writeEndElement()}if(n.has("Popup")&&(t=n.get("Popup"))&&this._writeAnnotationData(s,r,t),n.has("DA")&&(e=n.get("DA"))&&this._writeRawData(s,"defaultappearance",e),n.has("DS")&&(i=n.get("DS"))&&this._writeRawData(s,"defaultstyle",i),n.has("InkList")){var p=n.getArray("InkList");if(p&&0<p.length){s._writeStartElement("inklist");for(var f=0;f<p.length;f++)s._writeElementString("gesture",this._getValue(p[f]));s._writeEndElement()}}n.has("RC")&&(l=n.get("RC"))&&""!==l&&(0<(o=l.indexOf("<body"))&&(l=l.substring(o)),this._writeRawData(s,"contents-richtext",l)),n.has("Contents")&&(l=n.get("Contents"))&&0<l.length&&(s._writeStartElement("contents"),s._writeString(l),s._writeEndElement())},e.prototype._getAppearanceString=function(t){var e=new j(!0),t=(e._writeStartElement("DICT"),e._writeAttributeString("KEY","AP"),this._writeAppearanceDictionary(e,t),e._writeEndElement(),e.buffer);return e._destroy(),t},e.prototype._writeAppearanceDictionary=function(i,n){var r=this;n&&0<n.size&&n.forEach(function(t,e){r._writeObject(i,e instanceof m?n.get(t):e,n,t)})},e.prototype._writeObject=function(t,e,i,n,r){var s,a;null!=e&&(e instanceof R?(this._writePrefix(t,"NAME",n),t._writeAttributeString("VAL",e.name),t._writeEndElement()):Array.isArray(e)?(this._writePrefix(t,"ARRAY",n),n&&"ColorSpace"===n&&(this._isColoSpace=!0),i.has(n)?this._writeArray(t,i.getArray(n),i):this._writeArray(t,e,i),this._isColoSpace=!1,t._writeEndElement()):"string"==typeof e?(this._writePrefix(t,"STRING",n),this._isColoSpace?(s=v(e),t._writeAttributeString("VAL",As(s))):t._writeAttributeString("VAL",e),t._writeEndElement()):"number"==typeof e?(Number.isInteger(e)?(this._writePrefix(t,"INT",n),t._writeAttributeString("VAL",e.toString())):(this._writePrefix(t,"FIXED",n),t._writeAttributeString("VAL",e.toFixed(6))),t._writeEndElement()):"boolean"==typeof e?(this._writePrefix(t,"BOOL",n),t._writeAttributeString("VAL",e?"true":"false"),t._writeEndElement()):e instanceof D?(this._writePrefix(t,"DICT",n),this._writeAppearanceDictionary(t,e),t._writeEndElement()):e instanceof y&&e.dictionary?(s=e.dictionary,this._writePrefix(t,"STREAM",n),t._writeAttributeString("DEFINE",""),s.has("Subtype")&&("Image"===this._getValue(s.get("Subtype"))||"Form"===this._getValue(s.get("Subtype")))||!s.has("Type")&&!s.has("Subtype")&&"ToUnicode"!==n?(a=void 0,a=!r||s.has("Filter")&&"DCTDecode"===s.get("Filter").name||s.has("Subtype")&&"Form"===s.get("Subtype").name?e.getString(!0):po(e,!0),!s.has("Length")&&a&&""!==a&&s.update("Length",e.length),this._writeAppearanceDictionary(t,s),t._writeStartElement("DATA"),t._writeAttributeString("MODE","RAW"),t._writeAttributeString("ENCODING","HEX")):(a=e.getString(),!s.has("Length")&&a&&""!==a&&s.update("Length",e.length),a=(a=a.replace(/</g,"<")).replace(/>/g,">"),this._writeAppearanceDictionary(t,s),t._writeStartElement("DATA"),t._writeAttributeString("MODE","FILTERED"),t._writeAttributeString("ENCODING","ASCII")),a&&""!==a&&t._writeRaw(a),t._writeEndElement(),t._writeEndElement()):e instanceof m&&this._crossReference&&this._writeObject(t,this._crossReference._fetch(e),i,n,e._isNew))},e.prototype._writePrefix=function(t,e,i){t._writeStartElement(e),i&&t._writeAttributeString("KEY",i)},e.prototype._writeArray=function(i,t,n){var r=this;t.forEach(function(t){var e;r._isColoSpace&&"string"==typeof t?(e=As(v(t)),i._writeStartElement("DATA"),i._writeAttributeString("MODE","RAW"),i._writeAttributeString("ENCODING","HEX"),i._writeRaw(e),i._writeEndElement()):r._writeObject(i,t,n)})},e.prototype._getFormatedString=function(t,e){return t=(e=void 0===e?!1:e)?(t=(t=t.replace("&","&")).replace("<","<")).replace(">",">"):(t=(t=t.replace("&","&")).replace("<","<")).replace(">",">")},e.prototype._writeAttribute=function(t,e,i){var n;if(this._annotationAttributes&&-1===this._annotationAttributes.indexOf(e))switch(e){case"C":this._writeColor(t,i,"color","c");break;case"OC":this._writeColor(t,i,"oc");break;case"AFC":this._writeColor(t,i,"afc");break;case"IC":this._writeColor(t,i,"interior-color");break;case"M":this._writeAttributeString(t,"date",i);break;case"NM":this._writeAttributeString(t,"name",i);break;case"Name":this._writeAttributeString(t,"icon",i);break;case"Subj":this._writeAttributeString(t,"subject",i);break;case"T":this._writeAttributeString(t,"title",i);break;case"Rotate":this._writeAttributeString(t,"rotation",i);break;case"W":this._writeAttributeString(t,"width",i);break;case"LE":i&&Array.isArray(i)?2===i.length&&(t._writeAttributeString("head",this._getValue(i[0])),t._writeAttributeString("tail",this._getValue(i[1]))):i instanceof R&&this._writeAttributeString(t,"head",i);break;case"S":if(-1===this._annotationAttributes.indexOf("style")){switch(this._getValue(i)){case"D":t._writeAttributeString("style","dash");break;case"C":t._writeAttributeString("style","cloudy");break;case"S":t._writeAttributeString("style","solid");break;case"B":t._writeAttributeString("style","bevelled");break;case"I":t._writeAttributeString("style","inset");break;case"U":t._writeAttributeString("style","underline")}this._annotationAttributes.push("style")}break;case"D":this._writeAttributeString(t,"dashes",i);break;case"I":this._writeAttributeString(t,"intensity",i);break;case"RD":this._writeAttributeString(t,"fringe",i);break;case"IT":this._writeAttributeString(t,"IT",i);break;case"RT":this._writeAttributeString(t,"replyType",i,!0);break;case"LL":this._writeAttributeString(t,"leaderLength",i);break;case"LLE":this._writeAttributeString(t,"leaderExtend",i);break;case"Cap":this._writeAttributeString(t,"caption",i);break;case"Q":this._writeAttributeString(t,"justification",i);break;case"CP":this._writeAttributeString(t,"caption-style",i);break;case"CL":this._writeAttributeString(t,"callout",i);break;case"QuadPoints":this._writeAttributeString(t,"coords",i);break;case"CA":this._writeAttributeString(t,"opacity",i);break;case"F":"number"==typeof i&&-1===this._annotationAttributes.indexOf("flags")&&(n=us(i),t._writeAttributeString("flags",n),this._annotationAttributes.push("flags"));break;case"InkList":case"Type":case"Subtype":case"P":case"Parent":case"L":case"Contents":case"RC":case"DA":case"DS":case"FS":case"MeasurementTypes":case"Vertices":case"GroupNesting":case"ITEx":break;case"TextMarkupContent":n=v(i),this._writeAttributeString(t,e.toLowerCase(),As(n));break;case"AllowedInteractions":case"AnnotationSelectorSettings":this._writeAttributeString(t,e,i);break;default:this._writeAttributeString(t,e.toLowerCase(),i)}},e.prototype._writeAttributeString=function(t,e,i,n){void 0===n&&(n=!1),-1===this._annotationAttributes.indexOf(e)&&(i=this._getValue(i),t._writeAttributeString(e,n?i.toLowerCase():i),this._annotationAttributes.push(e))},e.prototype._writeRawData=function(t,e,i){i&&""!==i&&(t._writeStartElement(e),t._writeRaw(i),t._writeEndElement())},e.prototype._writeColor=function(t,e,i,n){var r=this._getColor(e);"number"==typeof e&&n&&(e=this._getValue(e))&&""!==e&&-1===this._annotationAttributes.indexOf(n)&&(t._writeAttributeString(n,e),this._annotationAttributes.push(n)),r&&""!==r&&-1===this._annotationAttributes.indexOf(i)&&(t._writeAttributeString(i,r),this._annotationAttributes.push(i))},e.prototype._exportMeasureDictionary=function(t,e){var i;e._writeStartElement("measure"),t&&(t.has("R")&&e._writeAttributeString("rateValue",this._getValue(t.get("R"))),t.has("A")&&(i=t.getArray("A"),e._writeStartElement("area"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()),t.has("D")&&(i=t.getArray("D"),e._writeStartElement("distance"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()),t.has("X"))&&(i=t.getArray("X"),e._writeStartElement("xformat"),this._exportMeasureFormatDetails(i[0],e),e._writeEndElement()),e._writeEndElement()},e.prototype._exportMeasureFormatDetails=function(t,e){t.has("C")&&e._writeAttributeString("c",this._getValue(t.get("C"))),t.has("F")&&e._writeAttributeString("f",this._getValue(t.get("F"))),t.has("D")&&e._writeAttributeString("d",this._getValue(t.get("D"))),t.has("RD")&&e._writeAttributeString("rd",this._getValue(t.get("RD"))),t.has("U")&&e._writeAttributeString("u",this._getValue(t.get("U"))),t.has("RT")&&e._writeAttributeString("rt",this._getValue(t.get("RT"))),t.has("SS")&&e._writeAttributeString("ss",this._getValue(t.get("SS"))),t.has("FD")&&e._writeAttributeString("fd",this._getValue(t.get("FD")))},e.prototype._importAnnotations=function(t,e){this._document=t,this._crossReference=t._crossReference;t=vs(e,!(this._isAnnotationExport=!1));this._xmlDocument=(new DOMParser).parseFromString(t,"text/xml"),this._isAnnotationImport=!0,this._readXmlData(this._xmlDocument.documentElement)},e.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._xmlDocument=(new DOMParser).parseFromString(vs(e,!0),"text/xml"),this._readXmlData(this._xmlDocument.documentElement)},e.prototype._readXmlData=function(t){var i=this;if(t&&1===t.nodeType)if(this._checkXfdf(t),this._isAnnotationImport){var e=t.getElementsByTagName("annots");if(e&&0<e.length)for(var n=0;n<e.length;n++){var r=e.item(n);if(r&&"annots"===r.localName&&r.hasChildNodes())for(var s=r.childNodes,a=0;a<s.length;a++){var o=s.item(a);o&&1===o.nodeType&&o&&1===o.nodeType&&this._parseAnnotationData(o)}}0<this._groupHolders.length&&this._groupHolders.forEach(function(t){var e=t.get("IRT");e&&""!==e&&(i._groupReferences.has(e)?t.update("IRT",i._groupReferences.get(e)):delete t._map.IRT)}),this._groupHolders=[],this._groupReferences=new Map}else this._parseFormData(t);this._dispose()},e.prototype._checkXfdf=function(t){if("xfdf"!==t.nodeName)throw new Error("Invalid XFDF file.")},e.prototype._parseFormData=function(t){var e,i=t.getElementsByTagName("f"),n=(i&&0<i.length&&(e=i.item(0))&&"f"===e.localName&&e.hasAttribute("href")&&(e=e.getAttribute("href"))&&""!==e&&(this._fileName=e),(i=t.getElementsByTagName("ids"))&&0<i.length&&(this._asPerSpecification=!0),t.childNodes);if(n&&0<n.length)for(var r=0;r<n.length;r++){var s=n.item(r);if(s&&1===s.nodeType)if(s&&"fields"===s.localName&&s.hasChildNodes()){for(var a=s.childNodes,o=[],h=0;h<a.length;h++){var c=a.item(h);c&&1===c.nodeType&&c&&"field"===c.localName&&o.push(c)}this._importFormNodes(o)}}this._importField()},e.prototype._importFormNodes=function(t){var d=this;t.forEach(function(t){if(t&&"field"===t.localName){for(var e=[],i=0;i<t.children.length;i++){var n=t.children[i];"field"===n.localName&&e.push(n)}if(0<e.length)d._importFormNodes(e);else{var r=d._getFieldName(t),s=d._fields.get(r)||[],a=t.getElementsByTagName("value");if(a&&0<a.length){for(i=0;i<a.length;i++)s.push(a[i].textContent||"");d._fields.set(r,s)}else if((a=t.getElementsByTagName("value-richtext"))&&0<a.length){var o=a.item(0),h=o.textContent||"";if(0<o.childNodes.length){var c=o.childNodes[0];if(c&&c.hasChildNodes()){for(var h="",_=0;_<c.childNodes.length;_++)h+=(c.childNodes[_].textContent||"")+"\r";h=h.length?h.substring(0,h.length-1):o.textContent||""}}s.push(h),d._fields.set(r,s),d._richTextValues.has(r)||d._richTextValues.set(r,o.innerHTML)}}}})},e.prototype._getFieldName=function(t){for(var e="",i=t;i&&"fields"!==i.localName;)0<e.length&&(e="."+e),e=i.hasAttribute("name")&&""!==i.getAttribute("name")?i.getAttribute("name")+e:i.localName+e,i=i.parentElement;return e},e.prototype._parseAnnotationData=function(t){var e,i,n,r,s;t&&(s=-1,t.hasAttributes)&&t.hasAttribute("page")&&0<=(s=Number(t.getAttribute("page")))&&s<this._document.pageCount&&(s=this._document.getPage(s),t=this._getAnnotationDictionary(s,t))&&0<t.size&&(e=s._pageDictionary)&&(i=(s=s.annotations)._parseAnnotation(t))&&(i._isImported=!0,n=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(n,t),(t.has("NM")||t.has("IRT"))&&this._addReferenceToGroup(n,t),i._ref=n,r=s._annotations.length,s._annotations.push(n),t.has("Popup")&&s._annotations.push(t.getRaw("Popup")),s._comments&&0<s._comments.length&&(s._comments=[]),e.set("Annots",s._annotations),e._updated=!0,s._parsedAnnotations.set(r,i),this._handlePopup(s,n,t,e))},e.prototype._getAnnotationDictionary=function(t,e){var i,n=new D(this._crossReference),r=(n.update("Type",R.get("Annot")),!0);switch(e.localName.toLowerCase()){case"line":n.update("Subtype",R.get("Line")),e.hasAttribute("start")&&e.hasAttribute("end")&&4===(i=e.getAttribute("start").split(",").map(function(t){return Number.parseFloat(t)}).concat(e.getAttribute("end").split(",").map(function(t){return Number.parseFloat(t)}))).length&&n.update("L",i),this._addLineEndStyle(n,e);break;case"circle":n.update("Subtype",R.get("Circle"));break;case"square":n.update("Subtype",R.get("Square"));break;case"polyline":n.update("Subtype",R.get("PolyLine")),this._addLineEndStyle(n,e);break;case"polygon":n.update("Subtype",R.get("Polygon")),this._addLineEndStyle(n,e);break;case"ink":n.update("Subtype",R.get("Ink"));break;case"popup":n.update("Subtype",R.get("Popup"));break;case"text":n.update("Subtype",R.get("Text"));break;case"freetext":n.update("Subtype",R.get("FreeText")),this._addLineEndStyle(n,e);break;case"stamp":n.update("Subtype",R.get("Stamp"));break;case"highlight":n.update("Subtype",R.get("Highlight"));break;case"squiggly":n.update("Subtype",R.get("Squiggly"));break;case"underline":n.update("Subtype",R.get("Underline"));break;case"strikeout":n.update("Subtype",R.get("StrikeOut"));break;case"fileattachment":n.update("Subtype",R.get("FileAttachment"));break;case"sound":n.update("Subtype",R.get("Sound"));break;case"caret":n.update("Subtype",R.get("Caret"));break;case"redact":n.update("Subtype",R.get("Redact"));break;case"link":n.update("Subtype",R.get("Link"));break;default:r=!1}return r&&this._addAnnotationData(n,e,t),n},e.prototype._addAnnotationData=function(t,e,i){this._addBorderStyle(t,e),this._applyAttributeValues(t,e.attributes),this._parseInnerElements(t,e,i),this._addMeasureDictionary(t,e)},e.prototype._addBorderStyle=function(t,e){var i=new D(this._crossReference),n=new D(this._crossReference),r=(e.hasAttribute("width")&&n.update("W",Number.parseFloat(e.getAttribute("width"))),!0);if(e.hasAttribute("style")){var s="";switch(e.getAttribute("style")){case"dash":s="D";break;case"solid":s="S";break;case"bevelled":s="B";break;case"inset":s="I";break;case"underline":s="U";break;case"cloudy":r=!(s="C")}""!==s&&((r?n:i).update("S",R.get(s)),!r&&e.hasAttribute("intensity")?i.update("I",Number.parseFloat(e.getAttribute("intensity"))):e.hasAttribute("dashes")&&(e=e.getAttribute("dashes").split(",").map(function(t){return Number.parseFloat(t)}),n.update("D",e)))}0<i.size&&t.update("BE",i),0<n.size&&(n.update("Type","Border"),t.update("BS",n))},e.prototype._applyAttributeValues=function(a,t){var o=this;Array.from(t).forEach(function(t){var e,i,n,r,s=t.value;switch(t.name.toLowerCase()){case"page":case"start":case"end":case"width":case"head":case"tail":case"style":case"intensity":case"itex":break;case"state":o._addString(a,"State",s);break;case"statemodel":o._addString(a,"StateModel",s);break;case"replytype":"group"===s&&a.update("RT",R.get("Group"));break;case"inreplyto":o._addString(a,"IRT",s);break;case"rect":(n=o._obtainPoints(s))&&4===n.length&&a.update("Rect",n);break;case"color":(r=Ns(s))&&a.update("C",[r.r/255,r.g/255,r.b/255]);break;case"oc":s&&"Redact"===a.get("Subtype").name&&(r=Ns(s))&&a.update("OC",[r.r/255,r.g/255,r.b/255]);break;case"afc":s&&"Redact"===a.get("Subtype").name&&(r=Ns(s))&&a.update("AFC",[r.r/255,r.g/255,r.b/255]);break;case"interior-color":(r=Ns(s))&&a.update("IC",[r.r/255,r.g/255,r.b/255]);break;case"date":o._addString(a,"M",s);break;case"creationdate":o._addString(a,"CreationDate",s);break;case"name":o._addString(a,"NM",s);break;case"uri":s&&((n=new D(o._crossReference)).update("Type",new R("Action")),n.update("S",new R("URI")),n.update("URI",s),r=o._crossReference._getNextReference(),o._crossReference._cacheMap.set(r,n),a.update("A",r));break;case"icon":s&&""!==s&&a.update("Name",R.get(s));break;case"subject":o._addString(a,"Subj",o._getFormatedString(s,!0));break;case"title":o._addString(a,"T",o._getFormatedString(s,!0));break;case"rotation":o._addInt(a,"Rotate",s);break;case"justification":o._addInt(a,"Q",s);break;case"fringe":o._addFloatPoints(a,o._obtainPoints(s),"RD");break;case"it":s&&""!==s&&a.update("IT",R.get(s));break;case"leaderlength":o._addFloat(a,"LL",s);break;case"leaderextend":void 0!==(n=Number.parseFloat(s))&&a.update("LLE",n);break;case"caption":s&&""!==s&&a.update("Cap","yes"===s.toLowerCase());break;case"caption-style":s&&""!==s&&a.update("CP",R.get(s));break;case"callout":o._addFloatPoints(a,o._obtainPoints(s),"CL");break;case"coords":o._addFloatPoints(a,o._obtainPoints(s),"QuadPoints");break;case"border":o._addFloatPoints(a,o._obtainPoints(s),"Border");break;case"opacity":o._addFloat(a,"CA",s);break;case"flags":s&&""!==s&&(i=M.PdfAnnotationFlag.default,s.split(",").forEach(function(t,e){t=ps(t);0===e?i=t:i|=t}),a.update("F",i));break;case"open":s&&""!==s&&a.update("Open","true"===s||"yes"===s);break;case"calibrate":o._addString(a,"Calibrate",s);break;case"customdata":o._addString(a,"CustomData",s);break;case"overlaytext":a.update("OverlayText",s);break;case"repeat":a.update("Repeat","true"===s||"yes"===s);break;default:o._document._allowImportCustomData&&(r=void 0,r="string"!=typeof s||-1===s.indexOf(":")||s.startsWith("{")||s.endsWith("}")?"string"==typeof s?s:JSON.stringify(s):(n=s.split(":"),Array.isArray(n)&&2===n.length?JSON.stringify(((e={})[n[0]]=n[1],e)):s),o._addString(a,t.name,r))}})},e.prototype._obtainPoints=function(t){return t.split(",").map(function(t){return Number.parseFloat(t)})},e.prototype._parseInnerElements=function(h,c,_){var t,d=this;c.hasChildNodes&&(t=c.childNodes,Array.from(t).forEach(function(t){if(1===t.nodeType){var e,i,n,r,s=t,a=t.textContent,o=s.innerHTML;switch(t.nodeName.toLowerCase()){case"popup":s&&s.hasAttributes&&0<(r=d._getAnnotationDictionary(_,s)).size&&(i=d._crossReference._getNextReference(),d._crossReference._cacheMap.set(i,r),h.update("Popup",i),r.has("NM"))&&d._addReferenceToGroup(i,r);break;case"contents":a&&""!==a&&h.update("Contents",d._getFormatedString(a,!0));break;case"contents-richtext":o&&""!==o&&h.update("RC",d._richTextPrefix+o);break;case"defaultstyle":d._addString(h,"DS",a);break;case"defaultappearance":d._addString(h,"DA",a);break;case"vertices":a&&""!==a&&(e=[],a.split(",").forEach(function(t){-1!==t.indexOf(";")?t.split(";").forEach(function(t){e.push(t)}):e.push(t)}),0<e.length)&&(i=e.map(function(t){return Number.parseFloat(t)}),h.update("Vertices",i));break;case"appearance":d._addAppearanceData(t,h);break;case"inklist":t.hasChildNodes&&(n=[],r=t.childNodes,Array.from(r).forEach(function(t){var e;t&&1===t.nodeType&&"gesture"===(t=t).nodeName.toLowerCase()&&t.textContent&&""!==t.textContent&&(e=[],t.textContent.split(",").forEach(function(t){-1!==t.indexOf(";")?t.split(";").forEach(function(t){e.push(t)}):e.push(t)}),0<e.length)&&(t=e.map(function(t){return Number.parseFloat(t)}),n.push(t))}),h.update("InkList",n));break;case"data":d._addStreamData(t,h,c)}}}))},e.prototype._addStreamData=function(t,e,i){var n;t&&t.textContent&&""!==t.textContent&&(t=Ts(t.textContent,!0))&&0<t.length&&e.has("Subtype")&&((n=e.get("Subtype"))&&"FileAttachment"===n.name?this._addFileAttachment(e,i,t):n&&"Sound"===n.name&&this._addSound(e,i,t))},e.prototype._addSound=function(t,e,i){var i=new Sh(i),n=(i.dictionary._crossReference=this._crossReference,i.dictionary.update("Type",R.get("Sound")),e.hasAttribute("bits")&&this._addInt(i.dictionary,"B",e.getAttribute("bits")),e.hasAttribute("rate")&&this._addInt(i.dictionary,"R",e.getAttribute("rate")),e.hasAttribute("channels")&&this._addInt(i.dictionary,"C",e.getAttribute("channels")),e.hasAttribute("encoding")&&(n=e.getAttribute("encoding"))&&""!==n&&i.dictionary.update("E",R.get(n)),e.hasAttribute("filter")&&i.dictionary.update("Filter",R.get("FlateDecode")),this._crossReference._getNextReference());this._crossReference._cacheMap.set(n,i),t.update("Sound",n)},e.prototype._addFileAttachment=function(t,e,i){var n=new D(this._crossReference),r=(n.update("Type",R.get("Filespec")),e.hasAttribute("file")&&(r=e.getAttribute("file"),this._addString(n,"F",r),this._addString(n,"UF",r)),new Sh(i)),i=(r.dictionary._crossReference=this._crossReference,new D(this._crossReference)),s=(e.hasAttribute("size")&&void 0!==(s=Number(e.getAttribute("size")))&&(i.update("Size",s),r.dictionary.update("DL",s)),e.hasAttribute("modification")&&this._addString(i,"ModDate",e.getAttribute("modification")),e.hasAttribute("creation")&&this._addString(i,"CreationDate",e.getAttribute("creation")),r.dictionary.update("Params",i),e.hasAttribute("mimetype")&&this._addString(r.dictionary,"Subtype",e.getAttribute("mimetype")),r.dictionary.update("Filter",R.get("FlateDecode")),new D(this._crossReference)),i=this._crossReference._getNextReference(),e=(this._crossReference._cacheMap.set(i,r),s.update("F",i),n.update("EF",s),this._crossReference._getNextReference());this._crossReference._cacheMap.set(e,n),t.update("FS",e)},e.prototype._addAppearanceData=function(t,e){var i,n,r,s=this,t=t.textContent;t&&""!==t&&(t=(new DOMParser).parseFromString(atob(t),"text/xml"))&&t.hasChildNodes&&(t=t.childNodes)&&1===t.length&&(i=t[0])&&1===i.nodeType&&"DICT"===(i=i).nodeName.toUpperCase()&&i.hasAttribute("KEY")&&(n=i.getAttribute("KEY"))&&"AP"===n&&i.hasChildNodes&&(r=new D(this._crossReference),t=i.childNodes,Array.from(t).forEach(function(t){s._getAppearance(r,t)}),0<r.size)&&e.update("AP",r)},e.prototype._getAppearance=function(t,e){var i=t instanceof D?t:t.dictionary;if(e&&1===e.nodeType){var n=e;if(n&&n.localName){var r,s;switch(n.localName){case"STREAM":(s=this._getStream(n))&&(r=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(r,s),this._addKey(r,i,n));break;case"DICT":(s=this._getDictionary(n))&&(r=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(r,s),this._addKey(r,i,n));break;case"ARRAY":this._addKey(this._getArray(n),i,n);break;case"FIXED":this._addKey(this._getFixed(n),i,n);break;case"INT":this._addKey(this._getInt(n),i,n);break;case"STRING":this._addKey(this._getString(n),i,n);break;case"NAME":this._addKey(this._getName(n),i,n);break;case"BOOL":this._addKey(this._getBoolean(n),i,n);break;case"DATA":(s=this._getData(n))&&0<s.length&&t instanceof Sh&&(t._bytes=s,r=!1,(r=i&&i.has("Subtype")?(s=i.get("Subtype"))&&"Image"===s.name:r)?t._isCompress=!0:(t.dictionary.has("Length")&&delete t.dictionary._map.Length,t.dictionary.has("Filter")&&delete t.dictionary._map.Filter))}}}},e.prototype._getStream=function(t){var e=this,i=new Sh([]);return i.dictionary._crossReference=this._crossReference,t.hasChildNodes&&(t=t.childNodes,Array.from(t).forEach(function(t){1===t.nodeType&&e._getAppearance(i,t)})),i},e.prototype._getDictionary=function(t){var e=this,i=new D(this._crossReference);return t.hasChildNodes&&(t=t.childNodes,Array.from(t).forEach(function(t){1===t.nodeType&&e._getAppearance(i,t)})),i},e.prototype._getArray=function(t){var e=this,i=[];return t.hasChildNodes&&(t=t.childNodes,Array.from(t).forEach(function(t){1===t.nodeType&&e._addArrayElements(i,t)})),i},e.prototype._getData=function(t){var e,i,n=[];return t&&t.textContent&&""!==t.textContent&&t.hasAttribute("MODE")&&t.hasAttribute("ENCODING")&&(e=t.getAttribute("MODE"),i=t.getAttribute("ENCODING"),e)&&i&&(t=this._getFormatedString(t.textContent,!0),"FILTERED"===e&&"ASCII"===i?n=v(t,!0):"RAW"===e&&"HEX"===i&&(n=Ts(t,!0))),n},e.prototype._addArrayElements=function(t,e){if(e&&1===e.nodeType){var i,n,r=e,s=void 0;switch(r.localName){case"DATA":n=this._getData(r),(n=vs(new Uint8Array(n),!0))&&0<n.length&&t.push(n);break;case"STREAM":(s=this._getStream(r))&&(i=this._crossReference._getNextReference(),s.reference=i,this._crossReference._cacheMap.set(i,s),t.push(i));break;case"DICT":(n=this._getDictionary(r))&&(i=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(i,n),t.push(i));break;case"ARRAY":(n=this._getArray(r))&&t.push(n);break;case"FIXED":void 0===(i=this._getFixed(r))||isNaN(i)||t.push(i);break;case"INT":void 0===(n=this._getInt(r))||isNaN(n)||t.push(n);break;case"NAME":(i=this._getName(r))&&t.push(i);break;case"BOOL":null!=(n=this._getBoolean(r))&&t.push(n)}}},e.prototype._getFixed=function(t){var e;return e=t&&t.hasAttribute("VAL")?Number.parseFloat(t.getAttribute("VAL")):e},e.prototype._getInt=function(t){var e;return e=t&&t.hasAttribute("VAL")?Number(t.getAttribute("VAL")):e},e.prototype._getString=function(t){var e;return e=t&&t.hasAttribute("VAL")?t.getAttribute("VAL"):e},e.prototype._getName=function(t){var e;return e=t&&t.hasAttribute("VAL")?R.get(t.getAttribute("VAL")):e},e.prototype._getBoolean=function(t){var e;return e=t&&t.hasAttribute("VAL")?"true"===t.getAttribute("VAL"):e},e.prototype._addMeasureDictionary=function(t,e){var i,n,r,s;if(e.hasChildNodes)for(var a=e.childNodes,o=0;o<a.length;o++){var h=a[o];if(h&&"measure"===h.localName){i=h;break}}var c,e=new D(this._crossReference),_=new D(this._crossReference),d=new D(this._crossReference),l=new D(this._crossReference),u=[],p=[],f=[];i&&(e.update("Type",R.get("Measure")),i.hasAttribute("rateValue")&&(c=i.getAttribute("rateValue"))&&""!==c&&e.update("R",c),i.hasChildNodes)&&(a=i.childNodes,Array.from(a).forEach(function(t){if(t&&1===t.nodeType){var e=t;switch(e.nodeName.toLowerCase()){case"distance":r=e;break;case"area":n=e;break;case"xformat":s=e}}})),s&&(this._addElements(s,l),f.push(l)),r&&(this._addElements(r,_),u.push(_)),n&&(this._addElements(n,d),p.push(d)),e.set("A",p),e.set("D",u),e.set("X",f),0<e.size&&e.has("Type")&&(c=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(c,e),t.update("Measure",c))},e.prototype._addElements=function(t,e){t.hasAttribute("d")&&this._addFloat(e,"D",t.getAttribute("d")),t.hasAttribute("c")&&this._addFloat(e,"C",t.getAttribute("c")),t.hasAttribute("rt")&&e.update("RT",t.getAttribute("rt")),t.hasAttribute("rd")&&e.update("RD",t.getAttribute("rt")),t.hasAttribute("ss")&&e.update("SS",t.getAttribute("ss")),t.hasAttribute("u")&&e.update("U",t.getAttribute("u")),t.hasAttribute("f")&&e.update("F",R.get(t.getAttribute("f"))),t.hasAttribute("fd")&&e.update("FD","yes"===t.getAttribute("fd"))},e.prototype._addString=function(t,e,i){i&&""!==i&&t.update(e,i)},e.prototype._addInt=function(t,e,i){i=Number(i);void 0!==i&&t.update(e,i)},e.prototype._addFloat=function(t,e,i){i=Number.parseFloat(i);void 0!==i&&t.update(e,i)},e.prototype._addFloatPoints=function(t,e,i){e&&0<e.length&&t.update(i,e)},e.prototype._addKey=function(t,e,i){null!=t&&i.hasAttribute("KEY")&&e.update(i.getAttribute("KEY"),t)},e.prototype._addLineEndStyle=function(t,e){var i="",n=(e.hasAttribute("head")&&(i=e.getAttribute("head")),"");e.hasAttribute("tail")&&(n=e.getAttribute("tail")),i&&""!==i?n&&""!==n?((e=[]).push(R.get(i)),e.push(R.get(n)),t.update("LE",e)):t.update("LE",R.get(i)):n&&""!==n&&t.update("LE",R.get(n))};var Y,Q=e;function e(t){var e=Y.call(this)||this;return e._isColoSpace=!1,null!=t&&(e._fileName=t),e}Object.defineProperty($.prototype,"differencesDictionary",{get:function(){return this._differencesDictionary||(this._differencesDictionary=this._getDifferencesDictionary()),this._differencesDictionary},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"baseFontEncoding",{get:function(){return this._baseFontEncoding},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"fontEncoding",{get:function(){return this._fontEncoding||(this._fontEncoding=this._getFontEncoding()),this._fontEncoding},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"fontName",{get:function(){return this._fontName||(this._fontName=this._getFontName()),this._fontName},enumerable:!0,configurable:!0}),$.prototype._getFontEncoding=function(){var t,e,i="";return null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Encoding")&&((t=this._dictionary.get("Encoding"))instanceof R?i=t.name:t instanceof D&&(t.has("BaseEncoding")&&(e=t.get("BaseEncoding"))&&e instanceof R&&(this._baseFontEncoding=e.name),t.has("Type"))&&null!=(e=t.get("Type"))&&(i=e.name)),i="identity#2dh"!==i.toString()&&"CMap"!==i?i:"Identity-H"},$.prototype._getDifferencesDictionary=function(){var t,i,n=this,r=new Map;return null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Encoding")&&null!=(t=this._dictionary.get("Encoding"))&&t instanceof D&&t.has("Differences")&&(t=t.getArray("Differences"),i=0,null!=t)&&t.forEach(function(t){var e="";"number"==typeof t?(e=t.toString(),i=Number(e)):t instanceof R&&(e=t.name,"Type1"===n._fontType&&".notdef"===e?(e=" ",r.set(i.toString(),Da(e))):(e=Ia(e=Da(e)),r.has(i.toString())||r.set(i.toString(),Da(e)),i++))}),r},$.prototype._getFontName=function(){var t,e,i,n="";return n=null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("BaseFont")&&(-1!==(i=(t=this._dictionary.get("BaseFont")).name).indexOf("#20")&&-1===i.indexOf("+")&&(e=i.lastIndexOf("#20"),i=i.substring(0,e),i+="+"),-1!==(n=-1!==t.name.indexOf("+")?t.name.split("+")[1]:t.name).indexOf("-")?n=n.split("-")[0]:-1!==n.indexOf(",")&&(n=n.split(",")[0]),-1!==(n=-1!==(n=-1!==n.indexOf("MT")?n.replace("MT",""):n).indexOf("#20")?n.replace("#20"," "):n).indexOf("#"))?this._decodeHexFontName(n):n},$.prototype._decodeHexFontName=function(t){for(var e=t,i=0;i<t.length;i++)if("#"===t[i]){var n=t[i+1]+t[i+2],r=Number.parseInt(n,16);if(0!==r&&(e=e.replace("#"+n,String.fromCharCode(r)),i+=2),-1===e.indexOf("#"))break}return e};var Z=$;function $(t){this._baseFontEncoding="",this._dictionary=t,this._fontType=this._dictionary.get("Subtype").name}tt=function(t,e){return(tt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}tt(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(i,et=X),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._exportAnnotationData(t,t.pageCount),this._save()},i.prototype._exportFormFields=function(t){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;t=this._document.form;if(null!=t){this._exportEmptyFields=t.exportEmptyFields;for(var e=this._document.form.count,i=0;i<e;i++){var n=this._document.form.fieldAt(i);this._exportFormFieldsData(n)}this._writeFormFieldData()}return this._save()},i.prototype._save=function(){var t=new Uint8Array(this._jsonData);return this._jsonData=[],t},i.prototype._writeFormFieldData=function(){var r=this,s=(this._jsonData.push(this._openingBrace),0);this._table.forEach(function(t,e){if(e=r._getValidString(e),r._jsonData.push(r._doubleQuotes),r._jsonData=v(e,!0,!1,r._jsonData),"string"==typeof t||Array.isArray(t)&&1===t.length)t=r._getValidString("string"==typeof t?t:t[0]),r._jsonData.push(r._doubleQuotes,r._colon,r._doubleQuotes),r._jsonData=v(t,!0,!1,r._jsonData),r._jsonData.push(r._doubleQuotes);else{r._jsonData.push(r._doubleQuotes,r._colon,r._openingBracket);for(var i=0;i<t.length;i++){r._jsonData.push(r._doubleQuotes);var n=t[i];r._jsonData=v(n,!0,!1,r._jsonData),r._jsonData.push(r._doubleQuotes),i<t.length-1&&r._jsonData.push(r._comma)}r._jsonData.push(r._closingBracket)}s<r._table.size-1&&r._jsonData.push(r._comma),s++}),this._jsonData.push(this._closingBrace)},i.prototype._exportAnnotationData=function(t,e){var i=this,n=!1;this._jsonData.push(this._openingBrace,this._doubleQuotes,112,100,102,65,110,110,111,116,97,116,105,111,110,this._doubleQuotes,this._colon,this._openingBrace);for(var r=0;r<e;r++){for(var s=t.getPage(r),a=(s&&0<s.annotations.count&&(this._jsonData.push(0!==r&&n?this._comma:this._space,this._doubleQuotes),v(r.toString(),!0,!1,[]).forEach(function(t){i._jsonData.push(t)}),this._jsonData.push(this._doubleQuotes,this._colon,this._openingBrace,this._doubleQuotes,115,104,97,112,101,65,110,110,111,116,97,116,105,111,110,this._doubleQuotes,this._colon,this._openingBracket),n=!0),0),o=0;o<s.annotations.count;o++){var h=s.annotations.at(o);h&&(0!==a&&this._jsonData.push(this._comma),a++,this._exportAnnotation(h,r),this._jsonData=v(this._convertToJson(this._table),!0,!1,this._jsonData),this._table.clear())}s&&0<s.annotations.count&&this._jsonData.push(this._closingBracket,this._closingBrace)}this._jsonData.push(this._closingBrace,this._closingBrace)},i.prototype._exportAnnotation=function(t,e){var i=!1,n=t._dictionary,r=this._getAnnotationType(t._dictionary);if(this._skipBorderStyle=!1,r&&""!==r){this._table.set("type",r),this._table.set("page",e.toString());var s=void 0;switch(r){case"Line":s=t.linePoints,this._table.set("start",s[0].x.toString()+","+s[0].y.toString()),this._table.set("end",s[1].x.toString()+","+s[1].y.toString());break;case"Stamp":case"Square":i=!0}n&&n.has("BE")&&n.has("BS")&&(r=n.get("BE"))&&r.has("S")&&(this._skipBorderStyle=!0),this._writeDictionary(n,e,i)}},i.prototype._writeDictionary=function(n,r,s){var t,e,i,a,o,h=this,c=!1;n&&n.has("Type")&&(t=n.get("Type"),c=t&&"Border"===t.name&&this._skipBorderStyle),n.forEach(function(t,e){if((s||"AP"!==t)&&"P"!==t&&"Parent"!==t&&"Measure"!==t){var i=void 0;if((i=e instanceof m?n.get(t):e)&&i instanceof D)switch(t){case"BS":case"BE":h._writeDictionary(i,r,!1);break;case"IRT":i.has("NM")&&h._table.set("inreplyto",h._getValue(i.get("NM"),!0));break;default:h._writeDictionary(i,r,!1)}else c&&"S"===t||h._writeAttribute(t,i,n)}}),n.has("Measure")&&this._exportMeasureDictionary(n.get("Measure")),(this.exportAppearance||s)&&n.has("AP")&&(t=this._getAppearanceString(n.get("AP")))&&0<t.length&&this._table.set("appearance",Is(t)),n.has("Sound")?(t=n.get("Sound"))&&t.dictionary&&((e=t.dictionary).has("B")&&this._table.set("bits",this._getValue(e.get("B"),!0)),e.has("C")&&this._table.set("channels",this._getValue(e.get("C"),!0)),e.has("E")&&this._table.set("encoding",this._getValue(e.get("E"),!0)),e.has("R")&&this._table.set("rate",this._getValue(e.get("R"),!0)),e.has("Length"))&&0<e.get("Length")&&(o=As(t.getBytes()))&&""!==o&&(this._table.set("MODE","raw"),this._table.set("encoding","hex"),e.has("Length")&&this._table.set("length",this._getValue(e.get("Length"),!0)),e.has("Filter")&&this._table.set("filter",this._getValue(e.get("Filter"),!0)),this._table.set("data",o)):n.has("FS")&&(t=n.get("FS"))&&(t.has("F")&&this._table.set("file",this._getValue(t.get("F"),!0)),t.has("EF"))&&(e=t.get("EF"))&&e.has("F")&&(t=e.get("F"))&&t.dictionary&&((e=t.dictionary).has("Params")&&(a=e.get("Params"))&&(a.has("CreationDate")&&(i=this._getValue(a.get("CreationDate"),!0),this._table.set("creation",i)),a.has("ModificationDate")&&(i=this._getValue(a.get("ModificationDate"),!0),this._table.set("modification",i)),a.has("Size")&&this._table.set("size",this._getValue(a.get("Size"),!0)),a.has("CheckSum"))&&(a=As(v(i=this._getValue(a.get("CheckSum"),!0))),this._table.set("checksum",a)),o=As(t.getBytes()))&&""!==o&&(this._table.set("MODE","raw"),this._table.set("encoding","hex"),e.has("Length")&&this._table.set("length",this._getValue(e.get("Length"),!0)),e.has("Filter")&&this._table.set("filter",this._getValue(e.get("Filter"),!0)),this._table.set("data",o))},i.prototype._writeColor=function(t,e,i){var n=this._getColor(t);"number"==typeof t&&i&&(t=this._getValue(t,!0))&&""!==t&&this._table.set(i,t),n&&""!==n&&this._table.set(e,n)},i.prototype._writeAttributeString=function(t,e,i){void 0===i&&(i=!1);e=this._getValue(e,!0);this._table.set(t,i?e.toLowerCase():e)},i.prototype._writeAttribute=function(t,e,i){var n,r,s,a;switch(t){case"C":this._writeColor(e,"color","c");break;case"IC":this._writeColor(e,"interior-color");break;case"OC":this._writeColor(e,"oc");break;case"AFC":this._writeColor(e,"afc");break;case"DA":(a=i.get("DA"))&&this._table.set("defaultappearance",a);break;case"M":this._writeAttributeString("date",e);break;case"NM":this._table.set("name",e);break;case"Name":this._writeAttributeString("icon",e);break;case"Subj":this._writeAttributeString("subject",e);break;case"T":this._table.has("title")||this._writeAttributeString("title",e);break;case"Rect":(a=this._getValue(e,!0))&&(r=a.split(","),(s=new Map).set("x",r[0]),s.set("y",r[1]),s.set("width",r[2]),s.set("height",r[3]),this._table.set(t.toLowerCase(),this._convertToJson(s)));break;case"CreationDate":this._writeAttributeString("creationdate",e);break;case"Rotate":this._writeAttributeString("rotation",e);break;case"W":this._writeAttributeString("width",e);break;case"LE":e&&Array.isArray(e)?2===e.length&&(this._table.set("head",this._getValue(e[0],!0)),this._table.set("tail",this._getValue(e[1],!0))):e instanceof R&&this._writeAttributeString("head",e);break;case"S":switch(this._getValue(e,!0)){case"D":this._table.set("style","dash");break;case"C":this._table.set("style","cloudy");break;case"S":this._table.set("style","solid");break;case"B":this._table.set("style","bevelled");break;case"I":this._table.set("style","inset");break;case"U":this._table.set("style","underline")}break;case"D":this._writeAttributeString("dashes",e);break;case"I":this._writeAttributeString("intensity",e);break;case"RD":this._writeAttributeString("fringe",e);break;case"IT":this._writeAttributeString("IT",e);break;case"RT":this._writeAttributeString("replyType",e,!0);break;case"LL":this._writeAttributeString("leaderLength",e);break;case"LLE":this._writeAttributeString("leaderExtend",e);break;case"Cap":this._writeAttributeString("caption",e);break;case"CP":this._writeAttributeString("caption-style",e);break;case"CL":this._writeAttributeString("callout",e);break;case"QuadPoints":this._writeAttributeString("coords",e);break;case"CA":this._writeAttributeString("opacity",e);break;case"F":"number"==typeof e&&(r=us(e),this._table.set("flags",r));break;case"Contents":(a=i.get("Contents"))&&0<a.length&&this._table.set("contents",this._getValidString(a));break;case"InkList":this._writeInkList(i);break;case"Vertices":this._writeVertices(i);break;case"DS":k(a=i.get("DS"))&&(n=new Map,a.split(";").forEach(function(t){t=t.split(":");t&&0<t.length&&t[0]&&1<t[0].length&&t[0].startsWith(" ")&&(t[0]=t[0].substring(1)),n.set(t[0],t[1])}),this._table.set("defaultStyle",this._convertToJson(n)));break;case"AllowedInteractions":e&&(s=As(v(e,!1,!0)),(r=new Map).set("encoding","hex"),r.set("bytes",s),this._table.set(t,this._convertToJson(r)));break;case"RC":"string"==typeof(a=i.get("RC"))&&a.includes("<body")&&(0<(s=a.indexOf("<body"))&&(a=a.substring(s)),this._writeAttributeString("contents-richtext",a));break;case"Type":case"Subtype":case"P":case"Parent":case"L":case"FS":case"MeasurementTypes":case"GroupNesting":case"ITEx":break;case"TextMarkupContent":r=v(e),this._writeAttributeString(t,As(r));break;case"Border":case"A":case"R":case"X":case"ca":this._writeAttributeString(t.toLowerCase(),e);break;default:"string"==typeof e&&e.startsWith("{")&&e.endsWith("}")?this._table.set(t,e):this._writeAttributeString(t,e)}},i.prototype._writeVertices=function(t){var e=t.getArray("Vertices");if(k(e)&&0<e.length){var i=e.length;if(i%2==0){for(var n="",r=0;r<i-1;r++)n+=this._getValue(e[r],!0)+(r%2!=0?";":",");(n+=this._getValue(e[i-1],!0))&&""!==n&&this._table.set("vertices",n)}}},i.prototype._writeInkList=function(t){var e=t.getArray("InkList");if(e&&0<e.length){for(var t=new Map,i="[",n=0;n<e.length;n++)i+="["+this._getValue(e[n],!0)+"]",n<e.length-1&&(i+=",");t.set("gesture",i+="]"),this._table.set("inklist",this._convertToJson(t))}},i.prototype._exportMeasureDictionary=function(t){var e;t&&(t.has("Type")&&this._table.set("type1","Measure"),t.has("R")&&this._table.set("ratevalue",this._getValue(t.get("R"),!0)),t.has("SubType")&&this._table.set("SubType",this._getValue(t.get("SubType"),!0)),t.has("TargetUnitConversion")&&this._table.set("TargetUnitConversion",this._getValue(t.get("TargetUnitConversion"),!0)),t.has("A")&&(e=t.getArray("A"))&&0<e.length&&e[0]&&this._exportMeasureFormatDetails("area",e[0]),t.has("D")&&(e=t.getArray("D"))&&0<e.length&&e[0]&&this._exportMeasureFormatDetails("distance",e[0]),t.has("X")&&(e=t.getArray("X"))&&0<e.length&&e[0]&&this._exportMeasureFormatDetails("xformat",e[0]),t.has("T")&&(e=t.getArray("T"))&&0<e.length&&e[0]&&this._exportMeasureFormatDetails("tformat",e[0]),t.has("V"))&&(e=t.getArray("V"))&&0<e.length&&e[0]&&this._exportMeasureFormatDetails("vformat",e[0])},i.prototype._exportMeasureFormatDetails=function(t,e){var i=new Map;e&&(e.has("C")&&i.set("c",this._getValue(e.get("C"),!0)),e.has("F")&&i.set("f",this._getValue(e.get("F"),!0)),e.has("D")&&i.set("d",this._getValue(e.get("D"),!0)),e.has("RD")&&i.set("rd",this._getValue(e.get("RD"),!0)),e.has("U")&&i.set("u",this._getValue(e.get("U"),!0)),e.has("RT")&&i.set("rt",this._getValue(e.get("RT"),!0)),e.has("SS")&&i.set("ss",this._getValue(e.get("SS"),!0)),e.has("FD"))&&i.set("fd",this._getValue(e.get("FD"),!0)),this._table.set(t,this._convertToJson(i))},i.prototype._getAppearanceString=function(t){var e=new Map,i=new Map;return this._writeAppearanceDictionary(i,t),e.set("ap",this._convertToJson(i)),v(this._convertToJson(e))},i.prototype._writeAppearanceDictionary=function(i,n){var r=this;n&&0<n.size&&n.forEach(function(t,e){("OC"===t&&e instanceof Array||"P"!==t&&"Parent"!==t&&"Dest"!==t&&"OC"!==t&&("AP"!==t||!r._isGroupingSupport))&&r._writeObject(i,e instanceof m?n.get(t):e,n,t)})},i.prototype._writeObject=function(t,e,i,n,r,s,a){var o,h,c,_,d,l,u,p,f;void 0===s&&(s=!1),void 0===a&&(a=!1),e instanceof R?(e.name=this._getValidString(e.name),this._writeTable("name",e.name,t,n,r)):Array.isArray(e)?(h=[],"ColorSpace"===n||s?this._writeArray(h,e,i,!0):this._writeArray(h,e,i),this._isColorSpace=!1,this._writeTable("array",this._convertToJsonArray(h),t,n,r)):"string"==typeof e?(h=!1,-1!==e.indexOf("\t")&&(h=!0),"AllowedInteractions"===n||this._isColorSpace||(e=this._getValidString(e)),this._isColorSpace||"AllowedInteractions"===n||mo(e)||h?(h=As(u=v(e,!1,!0)),(o=new Map).set("encoding","hex"),o.set("bytes",h),this._writeTable("string",this._convertToJson(o),t,n,r)):this._writeTable("string",e,t,n,r)):"number"==typeof e?this._writeTable(Number.isInteger(e)?"int":"fixed",e.toString(),t,n,r):"boolean"==typeof e?this._writeTable("boolean",e?"true":"false",t,n,r):e instanceof D?(h=new Map,this._writeAppearanceDictionary(h,e),this._writeTable("dict",this._convertToJson(h),t,n,r)):e instanceof y&&e.dictionary?(o=new Map,h=new Map,d=void 0,f=!1,(c=(_=e).dictionary).has("Subtype")&&"Image"===c.get("Subtype").name&&(f=!0),a&&f?d=e.dictionary.has("Filter")&&"DCTDecode"===e.dictionary.get("Filter").name?e.getString(!0):po(e,!0):f&&_.stream?_.stream instanceof g?d="boolean"==typeof _._initialized&&_._cipher?(l=_.stream.end-_.stream.start,_.getBytes(l),u=_.buffer.subarray(0,_.bufferLength),_.getString(!0,u)):(p=_.stream,_.getString(!0,p.getByteRange(p.start,p.end))):_.stream.stream?(a=_.stream).stream instanceof g&&"boolean"==typeof a._initialized&&a._cipher?(l=a.stream.end-a.stream.start,a.getBytes(l),u=a.buffer.subarray(0,a.bufferLength),d=a.getString(!0,u)):a.stream instanceof g&&(p=a.stream,d=a.getString(!0,p.getByteRange(p.start,p.end))):d=e.getString(!0):d=e.getString(!0),!c.has("Length")&&d&&""!==d&&c.update("Length",e.length),f=void this._writeAppearanceDictionary(h,c),c.has("Subtype")&&(f=this._getValue(c.get("Subtype"))),!c.has("Type")&&!c.has("Subtype")||c.has("Subtype")&&("Image"===f||"Form"===f||"CIDFontType0C"===f||"OpenType"===f)?(o.set("mode","raw"),o.set("encoding","hex")):(o.set("mode","filtered"),o.set("encoding","ascii")),d&&""!==d&&o.set("bytes",d),h.set("data",this._convertToJson(o)),this._writeTable("stream",this._convertToJson(h),t,n,r)):e instanceof m&&this._crossReference?this._writeObject(t,this._crossReference._fetch(e),i,n,r,s,e._isNew):null==e&&this._writeTable("null","null",t,n,r)},i.prototype._writeTable=function(t,e,i,n,r){var s=new Map;s.set(t,e),n?i.set(n,this._convertToJson(s)):r&&r.push(s)},i.prototype._writeArray=function(e,t,i,n){var r=this;void 0===n&&(n=!1),t.forEach(function(t){n&&"string"==typeof t&&(r._isColorSpace=!0),r._writeObject(null,t,i,null,e,n)})},i.prototype._convertToJson=function(r){var s=this,a=0,o="{";return r.forEach(function(t,e){var i=t.startsWith("{")&&t.endsWith("}"),n=t.startsWith("[")&&t.endsWith("]")&&s._isValidJsonArray(t);o+=i||n?'"'+e+'":'+t:'"'+e+'":"'+t+'"',a<r.size-1&&(o+=","),a++}),o+"}"},i.prototype._isValidJsonArray=function(t){try{return JSON.parse('{"test":'+t+"}"),!0}catch(t){return!1}},i.prototype._convertToJsonArray=function(t){for(var e="[",i=0;i<t.length;i++)e+=this._convertToJson(t[i]),i<t.length-1&&(e+=",");return e+"]"},i.prototype._parseJson=function(t,e){this._document=t,this._crossReference=t._crossReference;var i=vs(e,!0);if(i.startsWith("{")&&!i.endsWith("}"))for(;0<i.length&&!i.endsWith("}");)i=i.substring(0,i.length-1);return JSON.parse(i)},i.prototype._importFormData=function(t,e){var i=this,n=this._parseJson(t,e);if(n){var r=Object.keys(n);if(r&&0<r.length){for(var s=this,a=0;a<r.length;a++)!function(t){var e=r[t],t=n[e];Array.isArray(t)?s._fields.has("key")?t.forEach(function(t){i._fields.get(e).push(t)}):s._fields.set(e,t):s._fields.has("key")?s._fields.get(e).push(t):s._fields.set(e,[t])}(a);this._importField()}}},i.prototype._importAnnotations=function(n,t){var r,s,h=this,t=(this._isImport=!0,this._parseJson(n,t));t&&-1!==Object.keys(t).indexOf("pdfAnnotation")&&(r=t.pdfAnnotation,s=n.pageCount,(t=Object.keys(r))&&0<t.length&&t.forEach(function(t){var o,e,i=Number(t);void 0!==i&&i<s&&(o=n.getPage(i),i=r[t])&&(t=Object.keys(i))&&0<t.length&&-1!==t.indexOf("shapeAnnotation")&&(e=i.shapeAnnotation)&&(Array.isArray(e)?e:Object.keys(e).map(function(t){return e[t]})).forEach(function(t){var e=Object.keys(t);if(e&&0<e.length&&-1!==e.indexOf("type")){var i,n,r,s=new D(h._crossReference),a=(s.update("Type",R.get("Annot")),!0);switch(t.type.toLowerCase()){case"line":s.update("Subtype",R.get("Line"));break;case"circle":s.update("Subtype",R.get("Circle"));break;case"square":s.update("Subtype",R.get("Square"));break;case"polyline":s.update("Subtype",R.get("PolyLine"));break;case"polygon":s.update("Subtype",R.get("Polygon"));break;case"ink":s.update("Subtype",R.get("Ink"));break;case"popup":s.update("Subtype",R.get("Popup"));break;case"text":s.update("Subtype",R.get("Text"));break;case"freetext":s.update("Subtype",R.get("FreeText"));break;case"stamp":s.update("Subtype",R.get("Stamp"));break;case"highlight":s.update("Subtype",R.get("Highlight"));break;case"squiggly":s.update("Subtype",R.get("Squiggly"));break;case"underline":s.update("Subtype",R.get("Underline"));break;case"strikeout":s.update("Subtype",R.get("StrikeOut"));break;case"fileattachment":s.update("Subtype",R.get("FileAttachment"));break;case"sound":s.update("Subtype",R.get("Sound"));break;case"redact":s.update("Subtype",R.get("Redact"));break;case"caret":s.update("Subtype",R.get("Caret"));break;case"link":s.update("Subtype",R.get("Link"));break;default:a=!1}a&&(h._addAnnotationData(s,t,e),t=o._pageDictionary)&&(i=(e=o.annotations)._parseAnnotation(s))&&(i._isImported=!0,n=h._crossReference._getNextReference(),h._crossReference._cacheMap.set(n,s),(s.has("NM")||s.has("IRT"))&&h._addReferenceToGroup(n,s),i._ref=n,r=e._annotations.length,e._annotations.push(n),e._comments&&0<e._comments.length&&(e._comments=[]),t.set("Annots",e._annotations),t._updated=!0,e._parsedAnnotations.set(r,i),h._handlePopup(e,n,s,t))}})}),0<this._groupHolders.length&&this._groupHolders.forEach(function(t){var e=t.get("IRT");e&&""!==e&&(h._groupReferences.has(e)?t.update("IRT",h._groupReferences.get(e)):delete t._map.IRT)}),this._groupHolders=[],this._groupReferences=new Map)},i.prototype._addAnnotationData=function(c,_,t){var d,l,u,p,e,f=this,g=new D(this._crossReference),y=new D(this._crossReference),m=new Map,b=[],w="";t.forEach(function(t){var e,i,n,r,s,a,o,h=_[t];switch(t.toLowerCase()){case"start":case"end":f._addLinePoints(h,b),4===b.length&&(c.update("L",b),b=[]);break;case"itex":break;case"state":f._addString(c,"State",h);break;case"statemodel":f._addString(c,"StateModel",h);break;case"replytype":"group"===h.toLowerCase()&&c.update("RT",R.get("Group"));break;case"inreplyto":f._addString(c,"IRT",h);break;case"dashes":case"width":case"intensity":case"style":f._addBorderStyle(t,h,g,y);break;case"rect":(u=h)&&((o=[]).push(Number.parseFloat(u.x)),o.push(Number.parseFloat(u.y)),o.push(Number.parseFloat(u.width)),o.push(Number.parseFloat(u.height)),o)&&4===o.length&&c.update("Rect",o);break;case"color":(h=Ns(h))&&3===h.length?c.update("C",[h[0]/255,h[1]/255,h[2]/255]):h&&3===Object.keys(h).length&&c.update("C",[h.r/255,h.g/255,h.b/255]);break;case"oc":h&&"Redact"===c.get("Subtype").name&&((h=Ns(h))&&3===h.length?c.update("OC",[h[0]/255,h[1]/255,h[2]/255]):h&&3===Object.keys(h).length&&c.update("OC",[h.r/255,h.g/255,h.b/255]));break;case"afc":(h=Ns(h))&&3===h.length?c.update("AFC",[h[0]/255,h[1]/255,h[2]/255]):h&&3===Object.keys(h).length&&c.update("AFC",[h.r/255,h.g/255,h.b/255]);break;case"interior-color":(h=Ns(h))&&3===h.length?c.update("IC",[h[0]/255,h[1]/255,h[2]/255]):h&&3===Object.keys(h).length&&c.update("IC",[h.r/255,h.g/255,h.b/255]);break;case"date":f._addString(c,"M",h);break;case"creationdate":f._addString(c,"CreationDate",h);break;case"name":f._addString(c,"NM",h);break;case"uri":(u=new D(f._crossReference)).update("Type",new R("Action")),u.update("S",new R("URI")),u.update("URI",h),p=f._crossReference._getNextReference(),f._crossReference._cacheMap.set(p,u),c.update("A",p);break;case"icon":h&&c.update("Name",R.get(h));break;case"subject":f._addString(c,"Subj",h);break;case"title":f._addString(c,"T",h);break;case"rotation":c.update("Rotate",Number.parseFloat(h));break;case"fringe":f._addFloatPoints(c,"RD",f._parseFloatPoints(h));break;case"it":h&&c.update("IT",R.get(h));break;case"leaderlength":c.update("LL",Number.parseFloat(h));break;case"leaderextend":c.update("LLE",Number.parseFloat(h));break;case"caption":f._addBoolean(c,"Cap",h.toLowerCase());break;case"caption-style":h&&c.update("CP",R.get(h));break;case"callout":f._addFloatPoints(c,"CL",f._parseFloatPoints(h));break;case"coords":f._addFloatPoints(c,"QuadPoints",f._parseFloatPoints(h));break;case"border":f._addFloatPoints(c,"Border",f._parseFloatPoints(h));break;case"opacity":c.update("CA",Number.parseFloat(h));break;case"defaultstyle":h&&(i=Object.keys(h))&&0<i.length&&(n="",r=0,i.forEach(function(t){var e=h[t];n+=t+":"+e,r<i.length-1&&(n+=";"),r++}),f._addString(c,"DS",n));break;case"defaultappearance":f._addString(c,"DA",h);break;case"contents-richtext":"string"==typeof h&&f._addString(c,"RC",h);break;case"flags":h&&"string"==typeof h&&(s=M.PdfAnnotationFlag.default,h.split(",").forEach(function(t,e){t=ps(t);0===e?s=t:s|=t}),c.update("F",s));break;case"open":f._addBoolean(c,"Open",h.toLowerCase());break;case"repeat":f._addBoolean(c,"Repeat",h.toLowerCase());break;case"overlaytext":f._addString(c,"OverlayText",h);break;case"contents":"string"==typeof h&&(h=-1!==h.indexOf("\\r")?h.replace("\\r","\r"):h)&&f._addString(c,"Contents",h);break;case"q":c.update("Q",Number(h));break;case"inklist":h&&(o=Object.keys(h))&&0<o.length&&-1!==o.indexOf("gesture")&&(o=h.gesture)&&0<o.length&&c.update("InkList",o);break;case"head":d=h;break;case"tail":l=h;break;case"creation":case"modification":case"file":case"bits":case"channels":case"encoding":case"rate":case"length":case"filter":case"mode":case"size":m.set(t,h);break;case"data":w=h;break;case"vertices":h&&"string"==typeof h&&(o=h.split(/[,;]/))&&0<o.length&&0<(o=o.map(function(t){return Number(t)})).length&&o.length%2==0&&c.update("Vertices",o);break;case"appearance":f._addAppearanceData(c,h);break;case"allowedinteractions":h&&("string"==typeof h?f._addString(c,"AllowedInteractions",h):(o=Object.keys(h))&&0<o.length&&(-1!==o.indexOf("encoding")&&-1!==o.indexOf("bytes")?(a=h.bytes,"hex"===h.encoding&&(h=vs(Ts(a,!1),!0),f._addString(c,"AllowedInteractions",h))):-1!==o.indexOf("unicodeData")&&(a=JSON.stringify(h.unicodeData),h=vs(Ts(a=a.substring(1,a.length-1),!1),!0),f._addString(c,"AllowedInteractions",h))));break;default:f._document._allowImportCustomData&&"type"!==t&&"page"!==t&&(o=void 0,o="string"!=typeof h||-1===h.indexOf(":")||h.startsWith("{")||h.endsWith("}")?"string"==typeof h?h:JSON.stringify(h):(a=h.split(":"),Array.isArray(a)&&2===a.length?JSON.stringify(((e={})[a[0]]=a[1],e)):h),f._addString(c,t,o))}}),this._addMeasureDictionary(c,_,t),d?l?c.update("LE",[R.get(d),R.get(l)]):c.update("LE",d):l&&c.update("LE",l),0<y.size&&(y.update("Type",R.get("Border")),e=this._crossReference._getNextReference(),y.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,y),c.update("BS",e)),0<g.size&&(e=this._crossReference._getNextReference(),y.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,g),c.update("BE",e)),this._addStreamData(c,m,w)},i.prototype._addLinePoints=function(t,e){t&&-1!==t.indexOf(",")&&t.split(",").forEach(function(t){e.push(Number.parseFloat(t))})},i.prototype._addString=function(t,e,i){i&&t.update(e,i)},i.prototype._addBoolean=function(t,e,i){i&&t.update(e,"yes"===i||"true"===i)},i.prototype._addBorderStyle=function(t,e,i,n){var r="",s=!0;switch(e){case"dash":r="D";break;case"solid":r="S";break;case"bevelled":r="B";break;case"inset":r="I";break;case"underline":r="U";break;case"cloudy":s=!(r="C")}switch(t.toLowerCase()){case"width":n.update("W",Number.parseFloat(e));break;case"intensity":i.update("I",Number.parseFloat(e));break;case"dashes":e&&-1!==e.indexOf(",")&&n.update("D",this._parseFloatPoints(e))}r&&(s?n:i).update("S",R.get(r))},i.prototype._parseFloatPoints=function(t){return t.split(",").map(function(t){return Number.parseFloat(t)})},i.prototype._addFloatPoints=function(t,e,i){i&&0<i.length&&t.update(e,i)},i.prototype._addMeasureDictionary=function(t,e,i){var n=new D(this._crossReference),r=[],s=[],a=[],o=[],h=[];n.set("A",r),n.set("D",s),n.set("X",a),n.set("T",o),n.set("V",h),-1!==i.indexOf("ratevalue")&&this._addString(n,"R",e.ratevalue),-1!==i.indexOf("subtype")&&this._addString(n,"Subtype",e.subtype),-1!==i.indexOf("targetunitconversion")&&this._addString(n,"TargetUnitConversion",e.targetunitconversion),-1!==i.indexOf("area")&&r.push(this._readDictionaryElements(e.area)),-1!==i.indexOf("distance")&&s.push(this._readDictionaryElements(e.distance)),-1!==i.indexOf("xformat")&&a.push(this._readDictionaryElements(e.xformat)),-1!==i.indexOf("tformat")&&o.push(this._readDictionaryElements(e.tformat)),-1!==i.indexOf("vformat")&&h.push(this._readDictionaryElements(e.vformat)),-1!==i.indexOf("type1")&&(n.set("Type",R.get("Measure")),r=this._crossReference._getNextReference(),n.objId=r.objectNumber+" "+r.generationNumber,this._crossReference._cacheMap.set(r,n),t.update("Measure",r))},i.prototype._readDictionaryElements=function(i){var t=Object.keys(i),n=new D(this._crossReference);return t&&0<t.length&&t.forEach(function(t){var e=i[t];if(t&&e)switch(t){case"d":n.set("D",Number.parseFloat(e));break;case"c":n.set("C",Number.parseFloat(e));break;case"rt":n.set("RT",e);break;case"rd":n.set("RD",e);break;case"ss":n.set("SS",e);break;case"u":n.set("U",e);break;case"f":n.set("F",R.get(e));break;case"fd":n.set("FD",e);break;case"type":n.set("Type",R.get(e))}}),n},i.prototype._addStreamData=function(t,e,i){var n,r,s,a,o=this,h=t.get("Subtype").name,i=Ts(i,!0);"Sound"===h?((n=new Sh(i)).dictionary._crossReference=this._crossReference,n.dictionary.update("Type",R.get("Sound")),e.forEach(function(t,e){if(e&&t)switch(e){case"bits":case"rate":case"channels":n.dictionary.set(e,Number(t));break;case"encoding":n.dictionary.set("E",R.get(t));break;case"filter":n.dictionary.set("Filter",R.get("FlateDecode"))}}),n.reference=this._crossReference._getNextReference(),n.dictionary.objId=n.reference.objectNumber+" "+n.reference.generationNumber,this._crossReference._cacheMap.set(n.reference,n),t.update("Sound",n.reference)):"FileAttachment"===h&&((r=new D(this._crossReference)).update("Type",R.get("Filespec")),(s=new Sh(i)).dictionary._crossReference=this._crossReference,a=new D(this._crossReference),e.forEach(function(t,e){if(e&&t){var i;switch(e){case"file":o._addString(r,"F",t),o._addString(r,"UF",t);break;case"size":void 0!==(i=Number(t))&&(a.update("Size",i),s.dictionary.update("DL",i));break;case"creation":o._addString(a,"CreationDate",t);break;case"modification":o._addString(a,"ModificationDate",t)}}}),s.dictionary.update("Params",a),s.dictionary.update("Filter",R.get("FlateDecode")),s.reference=this._crossReference._getNextReference(),s.dictionary.objId=s.reference.objectNumber+" "+s.reference.generationNumber,this._crossReference._cacheMap.set(s.reference,s),(h=new D(this._crossReference)).update("F",s.reference),r.update("EF",h),i=this._crossReference._getNextReference(),r.objId=i.objectNumber+" "+i.generationNumber,this._crossReference._cacheMap.set(i,r),t.update("FS",i))},i.prototype._addAppearanceData=function(t,e){if(e){var i=vs(Rs(e,!1));if(i.startsWith("{")&&!i.endsWith("}"))for(;0<i.length&&!i.endsWith("}");)i=i.substring(0,i.length-1);var n,e=JSON.parse(i);e&&(n=Object.keys(e))&&0<n.length&&-1!==n.indexOf("ap")&&t.update("AP",this._parseDictionary(e.ap))}},i.prototype._parseAppearance=function(t){var e,i,n=this,r=Object.keys(t);return-1!==r.indexOf("name")?e=R.get(t.name):-1!==r.indexOf("int")?e=Number(t.int):-1!==r.indexOf("fixed")?e=Number.parseFloat(t.fixed):-1!==r.indexOf("string")?"string"==typeof t.string?e=t.string:(i=t.string.bytes,"hex"===t.string.encoding&&(e=vs(Ts(i,!1),!1))):-1!==r.indexOf("boolean")?e="true"===t.boolean:-1!==r.indexOf("array")?(i=t.array,e=[],i.forEach(function(t){e.push(n._parseAppearance(t))})):-1!==r.indexOf("dict")?0<(i=this._parseDictionary(t.dict)).size?(e=this._crossReference._getNextReference(),i.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,i)):e=new D(this._crossReference):-1!==r.indexOf("stream")?(i=this._parseStream(t.stream),e=this._crossReference._getNextReference(),i.reference=e,i.dictionary.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,i)):e=-1!==r.indexOf("unicodeData")?vs(Ts(t.unicodeData,!1),!0):null,e},i.prototype._parseDictionary=function(i){var t,n=this,r=new D(this._crossReference);return i&&(t=Object.keys(i))&&0<t.length&&t.forEach(function(t){var e=i[t];"data"!==t&&(t=Ss(t),e=n._parseAppearance(e),r.update(t,e))}),r},i.prototype._parseStream=function(t){var e,i,n=Object.keys(t);return t&&n.indexOf("data")&&(n=void 0,(i=t.data)&&(e=Object.keys(i))&&-1!==e.indexOf("bytes")&&(e=i.bytes)&&(n=Ts(e,!0)),i=new Sh(n=n||[]),this._crossReference?this._parseStreamElements(i,t):i._pendingResources=JSON.stringify(t),e=i),e},i.prototype._parseStreamElements=function(t,e){var i,n;(e=void 0===e&&t._pendingResources?JSON.parse(t._pendingResources):e)&&(n=!1,(n=(e=this._parseDictionary(e))&&e.has("Subtype")?(i=e.get("Subtype"))&&"Image"===i.name:n)||this._isImport&&t._isCompress?(t._isCompress=!1,n||delete e._map.Filter):(e.has("Length")&&delete e._map.Length,e.has("Filter")&&delete e._map.Filter),t.dictionary=e)},i.prototype._getValidString=function(t){return t=null!==t?(t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"\\\\")).replace(/"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t")).replace(/\u0008/g,"\\b")).replace(/\f/g,"\\f")).replace(/[\u0000-\u0007\u000B\u000E-\u001F\u007F]/g,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)}):t};var tt,et,it=i;function i(t){var e=et.call(this)||this;return e._isImport=!1,e._isColorSpace=!1,e._isDuplicate=!1,e._isGroupingSupport=!1,null!=t&&(e._fileName=t),e}Object.defineProperty(nt.prototype,"graphics",{get:function(){return this._isReadOnly?null:(void 0===this._g&&(this._g=new kr(this._size,this._content,this._crossReference,this),this._writeTransformation&&this._g._initializeCoordinates(),this._g._isTemplateGraphics=!0),this._g)},enumerable:!0,configurable:!0}),Object.defineProperty(nt.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(nt.prototype,"_originalSize",{get:function(){return this._templateOriginalSize},enumerable:!0,configurable:!0}),nt.prototype._initialize=function(){this._content.dictionary.set("Type",R.get("XObject")),this._content.dictionary.set("Subtype",R.get("Form"))},nt.prototype._exportStream=function(t,e,i){var n=new it,e=(n._crossReference=e,n._isAnnotationExport=!0,new Map);n._writeObject(e,t.get(i),t,"normal"),this._appearance=n._convertToJson(e),n._dispose()},nt.prototype._importStream=function(t,e){var i=new it,n=(t&&(i._crossReference=this._crossReference),JSON.parse(this._appearance));n&&(n=n[e?"resources":"normal"])&&(e?(e=i._parseDictionary(n.dict),t&&this._content.dictionary.update("Resources",e)):(this._content=i._parseStream(n.stream),t&&(this._content.dictionary._crossReference=this._crossReference,this._content.dictionary._updated=!0))),i._dispose()},nt.prototype._updatePendingResource=function(t){var e;this._content._pendingResources&&""!==this._content._pendingResources&&((e=new it)._crossReference=t,e._parseStreamElements(this._content),this._content._pendingResources="",e._dispose())};var P=nt;function nt(t,e){var i;this._isExported=!1,this._isResourceExport=!1,this._isSignature=!1,this._isNew=!1,e&&(this._crossReference=e),null==t?this._isReadOnly=!0:t instanceof y?(this._content=t,this._content.dictionary.has("Type")&&this._content.dictionary.has("Subtype")||this._initialize(),(i=this._content.dictionary.getArray("BBox"))&&3<i.length&&(e=Os(i),this._size={width:e.width,height:e.height},this._templateOriginalSize=this._size),this._isReadOnly=!0):Array.isArray(t)?(this._size={width:t[2],height:t[3]},this._content=new Sh([]),this._content.dictionary._crossReference=this._crossReference,this._initialize(),this._content.dictionary.set("BBox",[t[0],t[1],t[0]+t[2],t[1]+t[3]])):null!==t.width&&null!==t.height&&void 0!==t.width&&void 0!==t.height&&(i=void 0,i=null!==t.x&&void 0!==t.x&&null!==t.y&&void 0!==t.y?{x:t.x,y:t.y,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height},this._size={width:i.width,height:i.height},this._content=new Sh([]),this._crossReference?this._content.dictionary._crossReference=this._crossReference:this._isNew=!0,this._initialize(),this._content.dictionary.set("BBox",[i.x,i.y,i.x+i.width,i.y+i.height])),this._writeTransformation=!0}Object.defineProperty(rt.prototype,"paragraphIndent",{get:function(){return this._internalParagraphIndent},set:function(t){this._internalParagraphIndent=t,this.firstLineIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(rt.prototype,"subSuperScript",{get:function(){return void 0===this._pdfSubSuperScript||null===this._pdfSubSuperScript?M.PdfSubSuperScript.none:this._pdfSubSuperScript},set:function(t){this._pdfSubSuperScript=t},enumerable:!0,configurable:!0}),Object.defineProperty(rt.prototype,"_wordWrap",{get:function(){return this._wordWrapType},set:function(t){this._wordWrapType=t},enumerable:!0,configurable:!0});var I=rt;function rt(t,e){this.horizontalScalingFactor=100,this.rightToLeft=!1,this._wordWrapType=M._PdfWordWrapType.word,this._isList=!1,this.lineLimit=!0,void 0!==t&&(this.alignment=t),this.lineAlignment=void 0!==e?e:M.PdfVerticalAlignment.top,this.characterSpacing=0,this.wordSpacing=0,this.lineSpacing=0,this.clipPath=!1,this.firstLineIndent=0,this._internalParagraphIndent=0,this.measureTrailingSpaces=!1,this.noClip=!1}(t=M.PdfVerticalAlignment||(M.PdfVerticalAlignment={}))[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom";function st(){}at=function(t,e){return(at=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var at,ot,t=function(t,e){function i(){this.constructor=t}at(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},ht=function(){},ct=(t(_t,ot=st),_t.prototype._itemAt=function(t){if(t<0||t>=this.widths.length)throw new Error("The character is not supported by the font.");return this.widths[t]},_t.prototype._toArray=function(){return this.widths},_t);function _t(t){var e=ot.call(this)||this;return e.widths=t,e}t(ut,dt=st),ut.prototype._itemAt=function(e){var i=this._defaultWidth;return this.widths.forEach(function(t){e>=t._from&&e<=t._to&&(i=t._itemAt(e))}),i},ut.prototype._toArray=function(){var e=[];return this.widths.forEach(function(t){t._appendToArray(e)}),e},ut.prototype._add=function(t){this.widths.push(t)};var dt,lt=ut;function ut(t){var e=dt.call(this)||this;return e._defaultWidth=t,e.widths=[],e}function pt(){}t(yt,ft=pt),Object.defineProperty(yt.prototype,"_from",{get:function(){return this._widthFrom},enumerable:!0,configurable:!0}),Object.defineProperty(yt.prototype,"_to",{get:function(){return this._widthTo},enumerable:!0,configurable:!0}),yt.prototype._itemAt=function(t){if(t<this._from||t>this._to)throw new Error("Index is out of range.");return this._width},yt.prototype._appendToArray=function(t){t.push(this._from,this._to,this._width)};var ft,gt=yt;function yt(t,e,i){var n=ft.call(this)||this;return n._widthFrom=t,n._widthTo=e,n._width=i,n}t(wt,mt=pt),Object.defineProperty(wt.prototype,"_from",{get:function(){return this._widthFrom},enumerable:!0,configurable:!0}),Object.defineProperty(wt.prototype,"_to",{get:function(){return this._widthFrom+this._widths.length-1},enumerable:!0,configurable:!0}),wt.prototype._itemAt=function(t){if(t<this._widthFrom||t>this._to)throw new Error("Index is out of range.");return this._widths[t]},wt.prototype._appendToArray=function(e){e.push(this._from),e.forEach(function(t){e.push(t)})};var mt,bt=wt;function wt(t,e){var i=mt.call(this)||this;return i._widthFrom=t,i._widths=e,i}St.prototype._layout=function(t,e,i,n){this._initialize(t,e,i,n);t=this._doLayout();return this._clear(),t},St.prototype._initialize=function(t,e,i,n){this._font=e,this._format=i,this._size=n,this._rectangle=[0,0,n[0],n[1]],this._reader=new Tt(t),this._pageHeight=0},St.prototype._clear=function(){this._font=null,this._format=null,this._reader._close(),this._reader=null},St.prototype._doLayout=function(){for(var t=new Pt,e=(new Pt,[]),i=this._reader._peekLine(),n=this._getLineIndent(!0);null!==i;){if(null!=(r=this._layoutLine(i,n))){var r=this._copyToResult(t,r,e,0),s=r.success,r=r.flag;if(!s){this._reader._read(r);break}}this._reader._readLine(),i=this._reader._peekLine(),n=this._getLineIndent(!1)}return this._finalizeResult(t,e),t},St.prototype._getLineIndent=function(t){var e=0;return this._format&&(e=t?this._format.firstLineIndent:this._format.paragraphIndent,e=0<this._size[0]?Math.min(this._size[0],e):e),e},St.prototype._getLineHeight=function(){var t=this._font._getHeight();return t=this._format&&0!==this._format.lineSpacing?this._format.lineSpacing+this._font._getHeight():t},St.prototype._getLineWidth=function(t){return this._font.getLineWidth(t,this._format)},St.prototype._layoutLine=function(t,e){var i=new Pt,n=(i._lineHeight=this._getLineHeight(),[]),r=this._size[0],s=this._getLineWidth(t)+e,a=M._LineType.firstParagraphLine,o=!0;if(r<=0||Math.round(s)<=Math.round(r))this._addToLineResult(i,n,t,s,M._LineType.newLineBreak|a);else{var h="",c="",s=e,_=e,d=new Tt(t),l=d._peekWord();for(l.length!==d._length&&" "===l&&(c+=l,h+=l,d._position+=1,l=d._peekWord());null!==l;){c+=l;var u,p=this._getLineWidth(c.toString())+_;if(" "===c.toString()&&(c="",p=0),r<p){if(this._getWrapType()===M._PdfWordWrapType.none)break;if(c.length===l.length){if(this._getWrapType()===M._PdfWordWrapType.wordOnly){i._remainder=t.substring(d._position);break}if(1===c.length){h+=l;break}o=!1,c="",l=d._peek().toString()}else this._getLineWidth(l.toString())>r?void 0!==this._format&&null!==this._format&&(this._format._wordWrap=M._PdfWordWrapType.character):void 0!==this._format&&null!==this._format&&(this._format._wordWrap=M._PdfWordWrapType.word),this._getWrapType()===M._PdfWordWrapType.character&&o?(o=!1,c="",c+=h.toString(),l=d._peek().toString()):(" "!==(u=h.toString())&&this._addToLineResult(i,n,u,s,M._LineType.layoutBreak|a),h=c="",p=_=s=0,a=M._LineType.none,l=o?l:d._peekWord(),o=!0)}else h+=l,s=p,l=o?(d._readWord(),d._peekWord()):(d._read(),d._peek().toString())}0<h.length&&this._addToLineResult(i,n,h.toString(),s,M._LineType.newLineBreak|M._LineType.lastParagraphLine),d._close()}i._layoutLines=[];for(var f=0;f<n.length;f++)i._layoutLines.push(n[f]);return n=[],i},St.prototype._addToLineResult=function(t,e,i,n,r){var s=new At,i=(s._text=i,s._width=n,s._lineType=r,e.push(s),t._actualSize);i.height=i.height+this._getLineHeight(),i.width=Math.max(i.width,n),t._size=i},St.prototype._copyToResult=function(t,e,i,n){var r=!0,s=this._format&&!this._format.lineLimit,a=t._actualSize.height,o=this._size[1];if(0<this._pageHeight&&o+this._rectangle[1]>this._pageHeight&&(o=this._rectangle[1]-this._pageHeight,o=Math.max(o,-o)),n=0,null!==e._lines)for(var h=0,c=e._lines.length;h<c;h++){var _=a+e._lineHeight;if(!(Math.floor(_)<=o||o<=0||s)){r=!1;break}var d=e._lines[h],l=(n+=d._text.length,d=this._trimLine(d,0===i.length),i.push(d),t._actualSize);if(l.width=Math.max(l.width,d._width),t._size=l,o<=_&&0<o&&this._format&&!this._format.noClip&&!this._format.lineLimit){a+=e._lineHeight-(_-o),r=!1;break}a=_}return a!==t._size.height&&(t._size={width:t._actualSize.width,height:a}),{success:r,flag:n}},St.prototype._finalizeResult=function(t,e){t._layoutLines=[];for(var i=0;i<e.length;i++)t._layoutLines.push(e[i]);t._lineHeight=this._getLineHeight(),this._reader._end||(t._remainder=this._reader._readToEnd())},St.prototype._trimLine=function(t,e){var i=t._text.trim(),n=t._width;return i.length!==t._text.length&&(n=this._getLineWidth(i),0<(t._lineType&M._LineType.firstParagraphLine))&&(n+=this._getLineIndent(e)),t._text=i,t._width=n,t},St.prototype._getWrapType=function(){return null!==this._format&&void 0!==this._format?this._format._wordWrap:M._PdfWordWrapType.word};var vt=St;function St(){}Object.defineProperty(xt.prototype,"_actualSize",{get:function(){return void 0===this._size&&(this._size={width:0,height:0}),this._size},enumerable:!0,configurable:!0}),Object.defineProperty(xt.prototype,"_lines",{get:function(){return this._layoutLines},enumerable:!0,configurable:!0}),Object.defineProperty(xt.prototype,"_empty",{get:function(){return null===this._layoutLines||0===this._layoutLines.length},enumerable:!0,configurable:!0}),Object.defineProperty(xt.prototype,"_lineCount",{get:function(){return this._empty?0:this._layoutLines.length},enumerable:!0,configurable:!0});var Pt=xt;function xt(){}var At=function(){},Tt=((t=M._LineType||(M._LineType={}))[t.none=0]="none",t[t.newLineBreak=1]="newLineBreak",t[t.layoutBreak=2]="layoutBreak",t[t.firstParagraphLine=4]="firstParagraphLine",t[t.lastParagraphLine=8]="lastParagraphLine",Object.defineProperty(Ct.prototype,"_length",{get:function(){return this._text.length},enumerable:!0,configurable:!0}),Object.defineProperty(Ct.prototype,"_end",{get:function(){return this._position===this._text.length},enumerable:!0,configurable:!0}),Ct.prototype._readLine=function(){for(var t,e=this._position;e<this._length;){var i,n=this._text[e];switch(n){case"\r":case"\n":return i=this._text.substring(this._position,e),this._position=e+1,"\r"===n&&this._position<this._length&&"\n"===this._text[this._position]&&this._position++,i}e++}return e>this._position?(t=this._text.substring(this._position,e),this._position=e,t):null},Ct.prototype._peekLine=function(){var t=this._position,e=this._readLine();return this._position=t,e},Ct.prototype._readWord=function(){for(var t,e=this._position;e<this._length;){var i=this._text[e],n=void 0;switch(i){case"\r":case"\n":return n=this._text.substring(this._position,e-this._position),this._position=e+1,"\r"===i&&this._position<this._length&&"\n"===this._text[this._position]&&this._position++,n;case" ":case"\t":return e===this._position&&e++,n=this._text.substring(this._position,e),this._position=e,n}e++}return e>this._position?(t=this._text.substring(this._position,e),this._position=e,t):null},Ct.prototype._peekWord=function(){var t=this._position,e=this._readWord();return this._position=t,e},Ct.prototype._read=function(t){var e;if(void 0===t)return e="0",this._end||(e=this._text[this._position],this._position++),e;for(var i=0,n="";!this._end&&i<t;)n+=this._read(),i++;return n},Ct.prototype._peek=function(){return this._end?"0":this._text[this._position]},Ct.prototype._close=function(){this._text=null},Ct.prototype._readToEnd=function(){var t=0===this._position?this._text:this._text.substring(this._position);return this._position=this._length,t},Ct._spaces=[Ct._whiteSpace=" ",Ct._tab="\t"],Ct);function Ct(t){if(this._position=0,null==t)throw new Error("ArgumentNullException:text");this._text=t}Object.defineProperty(Rt.prototype,"_empty",{get:function(){return this._offset===this._length&&this._length===this._checksum&&0===this._checksum},enumerable:!0,configurable:!0});var kt=Rt;function Rt(){}var Ft=function(){},It=function(){},Dt=function(){},Bt=function(){},Lt=function(){},Ot=function(){},Mt=function(){},Et=function(){},Nt=function(){},jt=function(){},Vt=(Object.defineProperty(n.prototype,"macintosh",{get:function(){return null!==this._macintoshDictionary&&void 0!==this._macintoshDictionary||(this._macintoshDictionary=new _h),this._macintoshDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"_microsoft",{get:function(){return null!==this._microsoftDictionary&&void 0!==this._microsoftDictionary||(this._microsoftDictionary=new _h),this._microsoftDictionary},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"_macintoshGlyphs",{get:function(){return null!==this._internalMacintoshGlyphs&&void 0!==this._internalMacintoshGlyphs||(this._internalMacintoshGlyphs=new _h),this._internalMacintoshGlyphs},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"_microsoftGlyphs",{get:function(){return null!==this._internalMicrosoftGlyphs&&void 0!==this._internalMicrosoftGlyphs||(this._internalMicrosoftGlyphs=new _h),this._internalMicrosoftGlyphs},enumerable:!0,configurable:!0}),n.prototype._initialize=function(){void 0!==this._metrics&&null!==this._metrics||(this._metrics=new Ut),this._readFontDictionary();var t=this._readNameTable(),e=this._readHeadTable();this._initializeFontName(t),this._metrics._macStyle=e._macStyle},n.prototype._readFontDictionary=function(){this._offset=0,this._check();var t=this._readInt16(this._offset);this._readInt16(this._offset),this._readInt16(this._offset),this._readInt16(this._offset),void 0!==this._tableDirectory&&null!==this._tableDirectory||(this._tableDirectory=new _h);for(var e=0;e<t;++e){var i=new kt,n=this._readString(this._int32Size);i._checksum=this._readInt32(this._offset),i._offset=this._readInt32(this._offset),i._length=this._readInt32(this._offset),this._tableDirectory.setValue(n,i)}this._lowestPosition=this._offset,this._isFont||this._fixOffsets()},n.prototype._fixOffsets=function(){for(var i=this,t=Number.MAX_VALUE,e=this._tableDirectory.keys(),n=0;n<e.length;n++){var r=this._tableDirectory.getValue(e[n])._offset;if(r<t&&(t=r)<=this._lowestPosition)break}var s,a=t-this._lowestPosition;0!=a&&(s=new _h,e.forEach(function(t){var e=i._tableDirectory.getValue(t);e._offset-=a,s.setValue(t,e)}),this._tableDirectory=s)},n.prototype._check=function(){var t=this._readInt32(this._offset);if(this._isMacTtf=1953658213===t,65536!==t&&1953658213!==t&&1330926671!==t){if(this._isFont=!0,this._offset=0,"ttcf"!==this._readString(4))throw new Error("Can not read TTF font data");if(this._offset+=4,this._readInt32(this._offset)<0)throw new Error("Can not read TTF font data");this._offset=this._readInt32(this._offset),t=this._readInt32(this._offset)}return 1330926671===t&&(this._isOpenType=!0),t},n.prototype._readNameTable=function(){for(var t=this._getTable("name"),e=(void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset),new Dt),i=(e._formatSelector=this._readUInt16(this._offset),e._recordsCount=this._readUInt16(this._offset),e._offset=this._readUInt16(this._offset),e._nameRecords=[],this._offset),n=0;n<e._recordsCount;n++){this._offset=i;var r=new zt,s=(r._platformID=this._readUInt16(this._offset),r._encodingID=this._readUInt16(this._offset),r._languageID=this._readUInt16(this._offset),r._nameID=this._readUInt16(this._offset),r._length=this._readUInt16(this._offset),r._offset=this._readUInt16(this._offset),this._offset=t._offset+e._offset+r._offset,0===r._platformID||3===r._platformID);r._name=this._readString(r._length,s),e._nameRecords[n]=r,i+=12}return e},n.prototype._readHeadTable=function(){var t=this._getTable("head"),t=(void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset),new Ot);return t._version=this._readFixed(this._offset),t._fontRevision=this._readFixed(this._offset),t._checkSumAdjustment=this._readUInt32(this._offset),t._magicNumber=this._readUInt32(this._offset),t._flags=this._readUInt16(this._offset),t._unitsPerEm=this._readUInt16(this._offset),t._created=this._readInt64(this._offset),t._modified=this._readInt64(this._offset),t._xMin=this._readInt16(this._offset),t._yMin=this._readInt16(this._offset),t._xMax=this._readInt16(this._offset),t._yMax=this._readInt16(this._offset),t._macStyle=this._readUInt16(this._offset),t._lowestReadableSize=this._readUInt16(this._offset),t._fontDirectionHint=this._readInt16(this._offset),t._indexToLocalFormat=this._readInt16(this._offset),t._glyphDataFormat=this._readInt16(this._offset),t},n.prototype._readHorizontalHeaderTable=function(){var t=this._getTable("hhea"),t=(void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset),new Lt);return t._version=this._readFixed(this._offset),t._ascender=this._readInt16(this._offset),t._descender=this._readInt16(this._offset),t._lineGap=this._readInt16(this._offset),t._advanceWidthMax=this._readUInt16(this._offset),t._minLeftSideBearing=this._readInt16(this._offset),t._minRightSideBearing=this._readInt16(this._offset),t._xMaxExtent=this._readInt16(this._offset),t._caretSlopeRise=this._readInt16(this._offset),t._caretSlopeRun=this._readInt16(this._offset),this._offset+=10,t._metricDataFormat=this._readInt16(this._offset),t._numberOfHMetrics=this._readUInt16(this._offset),t},n.prototype._readOS2Table=function(){var t=this._getTable("OS/2"),t=(void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset),new Ft);return t._version=this._readUInt16(this._offset),t._xAvgCharWidth=this._readInt16(this._offset),t._usWeightClass=this._readUInt16(this._offset),t._usWidthClass=this._readUInt16(this._offset),t._fsType=this._readInt16(this._offset),t._ySubscriptXSize=this._readInt16(this._offset),t._ySubscriptYSize=this._readInt16(this._offset),t._ySubscriptXOffset=this._readInt16(this._offset),t._ySubscriptYOffset=this._readInt16(this._offset),t._ySuperscriptXSize=this._readInt16(this._offset),t._ySuperscriptYSize=this._readInt16(this._offset),t._ySuperscriptXOffset=this._readInt16(this._offset),t._ySuperscriptYOffset=this._readInt16(this._offset),t._yStrikeoutSize=this._readInt16(this._offset),t._yStrikeoutPosition=this._readInt16(this._offset),t._sFamilyClass=this._readInt16(this._offset),t._panose=this._readBytes(10),t._ulUnicodeRange1=this._readUInt32(this._offset),t._ulUnicodeRange2=this._readUInt32(this._offset),t._ulUnicodeRange3=this._readUInt32(this._offset),t._ulUnicodeRange4=this._readUInt32(this._offset),t._vendorIdentifier=this._readBytes(4),t._fsSelection=this._readUInt16(this._offset),t._usFirstCharIndex=this._readUInt16(this._offset),t._usLastCharIndex=this._readUInt16(this._offset),t._sTypoAscender=this._readInt16(this._offset),t._sTypoDescender=this._readInt16(this._offset),t._sTypoLineGap=this._readInt16(this._offset),t._usWinAscent=this._readUInt16(this._offset),t._usWinDescent=this._readUInt16(this._offset),t._ulCodePageRange1=this._readUInt32(this._offset),t._ulCodePageRange2=this._readUInt32(this._offset),1<t._version?(t._sxHeight=this._readInt16(this._offset),t._sCapHeight=this._readInt16(this._offset),t._usDefaultChar=this._readUInt16(this._offset),t._usBreakChar=this._readUInt16(this._offset),t._usMaxContext=this._readUInt16(this._offset)):(t._sxHeight=0,t._sCapHeight=0,t._usDefaultChar=0,t._usBreakChar=0,t._usMaxContext=0),t},n.prototype._readPostTable=function(){var t=this._getTable("post"),t=(void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset),new It);return t._formatType=this._readFixed(this._offset),t._italicAngle=this._readFixed(this._offset),t._underlinePosition=this._readInt16(this._offset),t._underlineThickness=this._readInt16(this._offset),t._isFixedPitch=this._readUInt32(this._offset),t._minType42=this._readUInt32(this._offset),t._maxType42=this._readUInt32(this._offset),t._minType1=this._readUInt32(this._offset),t._maxType1=this._readUInt32(this._offset),t},n.prototype._readWidthTable=function(t,e){for(var i=this._getTable("hmtx"),n=(void 0!==i._offset&&null!==i._offset&&(this._offset=i._offset),[]),r=0;r<t;r++){var s=new Wt,s=(s._advanceWidth=this._readUInt16(this._offset),s._lsb=this._readInt16(this._offset),1e3*s._advanceWidth/e);n.push(Math.floor(s))}return n},n.prototype._readCmapTable=function(){for(var t=this._getTable("cmap"),e=(void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset),new Mt),i=(e._version=this._readUInt16(this._offset),e._tablesCount=this._readUInt16(this._offset),this._offset),n=[],r=0;r<e._tablesCount;r++){this._offset=i;var s=new Et;s._platformID=this._readUInt16(this._offset),s._encodingID=this._readUInt16(this._offset),s._offset=this._readUInt32(this._offset),i=this._offset,this._readCmapSubTable(s),n[r]=s}return n},n.prototype._readCmapSubTable=function(t){var e=this._getTable("cmap"),e=(this._offset=e._offset+t._offset,this._readUInt16(this._offset)),i=this._getCmapEncoding(t._platformID,t._encodingID);if(i!==M._TrueTypeCmapEncoding.unknown)switch(e){case M._TrueTypeCmapFormat.apple:this._readAppleCmapTable(t,i);break;case M._TrueTypeCmapFormat.microsoft:this._readMicrosoftCmapTable(t,i);break;case M._TrueTypeCmapFormat.trimmed:this._readTrimmedCmapTable(t,i)}},n.prototype._readAppleCmapTable=function(t,e){var i=this._getTable("cmap"),i=(this._offset=i._offset+t._offset,new Nt);i._format=this._readUInt16(this._offset),i._length=this._readUInt16(this._offset),i._version=this._readUInt16(this._offset),null!==this._maxMacIndex&&void 0!==this._maxMacIndex||(this._maxMacIndex=0);for(var n=0;n<256;++n){var r=new qt;r._index=this._readByte(this._offset),r._width=this._getWidth(r._index),r._charCode=n,this.macintosh.setValue(n,r),this._addGlyph(r,e),this._maxMacIndex=Math.max(n,this._maxMacIndex)}},n.prototype._readMicrosoftCmapTable=function(t,e){for(var i=this._getTable("cmap"),n=(this._offset=i._offset+t._offset,e===M._TrueTypeCmapEncoding.unicode?this._microsoft:this.macintosh),r=new Bt,s=(r._format=this._readUInt16(this._offset),r._length=this._readUInt16(this._offset),r._version=this._readUInt16(this._offset),r._segCountX2=this._readUInt16(this._offset),r._searchRange=this._readUInt16(this._offset),r._entrySelector=this._readUInt16(this._offset),r._rangeShift=this._readUInt16(this._offset),r._segCountX2/2),i=(r._endCount=this._readUShortArray(s),r._reservedPad=this._readUInt16(this._offset),r._startCount=this._readUShortArray(s),r._idDelta=this._readUShortArray(s),r._idRangeOffset=this._readUShortArray(s),r._length/2-8-4*s),a=(r._glyphID=this._readUShortArray(i),0),o=0;o<s;o++)for(var h=r._startCount[o];h<=r._endCount[o]&&65535!==h;h++){if(0===r._idRangeOffset[o])a=h+r._idDelta[o]&65535;else{if((c=o+r._idRangeOffset[o]/2-s+h-r._startCount[o])>=r._glyphID.length)continue;a=r._glyphID[c]+r._idDelta[o]&65535}var c=new qt,_=(c._index=a,c._width=this._getWidth(c._index),e===M._TrueTypeCmapEncoding.symbol&&61440==(65280&h)?255&h:h);c._charCode=_,n.setValue(_,c),this._addGlyph(c,e)}},n.prototype._readTrimmedCmapTable=function(t,e){var i=this._getTable("cmap"),n=(this._offset=i._offset+t._offset,new jt);n._format=this._readUInt16(this._offset),n._length=this._readUInt16(this._offset),n._version=this._readUInt16(this._offset),n._firstCode=this._readUInt16(this._offset),n._entryCount=this._readUInt16(this._offset);for(var r=0;r<n._entryCount;++r){var s=new qt;s._index=this._readUInt16(this._offset),s._width=this._getWidth(s._index),s._charCode=r+n._firstCode,this.macintosh.setValue(r,s),this._addGlyph(s,e),this._maxMacIndex=Math.max(r,this._maxMacIndex)}},n.prototype._readCompactFontFormatTable=function(){var t=this._getTable("CFF ");return void 0!==t._offset&&null!==t._offset&&(this._offset=t._offset),this._readBytes(t._length)},n.prototype._initializeFontName=function(t){for(var e=0;e<t._recordsCount;e++){var i=t._nameRecords[e];if(1===i._nameID?this._metrics._fontFamily=i._name:6===i._nameID&&(this._metrics._postScriptName=i._name),null!==this._metrics._fontFamily&&void 0!==this._metrics._fontFamily&&null!==this._metrics._postScriptName&&void 0!==this._metrics._postScriptName)break}},n.prototype._getTable=function(t){var e,i=new kt;return i=null!=(e=this._tableDirectory.containsKey(t)?this._tableDirectory.getValue(t):e)?e:i},n.prototype._getWidth=function(t){return t=t<this._width.length?t:this._width.length-1,this._width[t]},n.prototype._getCmapEncoding=function(t,e){var i=M._TrueTypeCmapEncoding.unknown;return t===M._TrueTypePlatformID.microsoft&&e===M._TrueTypeMicrosoftEncodingID.undefined?i=M._TrueTypeCmapEncoding.symbol:t===M._TrueTypePlatformID.microsoft&&e===M._TrueTypeMicrosoftEncodingID.unicode?i=M._TrueTypeCmapEncoding.unicode:t===M._TrueTypePlatformID.macintosh&&e===M._TrueTypeMacintoshEncodingID.roman&&(i=M._TrueTypeCmapEncoding.macintosh),i},n.prototype._addGlyph=function(t,e){var i=null;switch(e){case M._TrueTypeCmapEncoding.unicode:i=this._microsoftGlyphs;break;case M._TrueTypeCmapEncoding.macintosh:case M._TrueTypeCmapEncoding.symbol:i=this._macintoshGlyphs}t&&void 0!==t._index&&i.setValue(t._index,t)},n.prototype._initializeMetrics=function(t,e,i,n,r,s){var a=this,t=(this._initializeFontName(t),s.some(function(t){return a._getCmapEncoding(t._platformID,t._encodingID)===M._TrueTypeCmapEncoding.symbol})),s=(this._metrics._isSymbol=t,this._metrics._macStyle=e._macStyle,this._metrics._isFixedPitch=0!==r._isFixedPitch,this._metrics._italicAngle=r._italicAngle,1e3/e._unitsPerEm),t=(this._metrics._winAscent=n._sTypoAscender*s,this._metrics._macAscent=i._ascender*s,this._metrics._capHeight=0!==n._sCapHeight?n._sCapHeight:.7*e._unitsPerEm*s,this._metrics._winDescent=n._sTypoDescender*s,this._metrics._macDescent=i._descender*s,this._metrics._leading=(n._sTypoAscender-n._sTypoDescender+n._sTypoLineGap)*s,this._metrics._lineGap=Math.ceil(i._lineGap*s),e._xMin*s),r=Math.ceil(this._metrics._macAscent+this._metrics._lineGap),i=e._xMax*s,s=this._metrics._macDescent;this._metrics._fontBox=[t,r,i,s],this._metrics._stemV=80,this._metrics._widthTable=this._updateWidth(),this._metrics._contains=this._tableDirectory.containsKey("CFF "),this._metrics._subScriptSizeFactor=e._unitsPerEm/n._ySubscriptYSize,this._metrics._superscriptSizeFactor=e._unitsPerEm/n._ySuperscriptYSize},n.prototype._updateWidth=function(){var t=[];if(this._metrics._isSymbol)for(var e=0;e<256;e++){var i=this._getGlyph(String.fromCharCode(e));t[e]=i._empty?0:i._width}else for(var n=[],r=String.fromCharCode(32),e=0;e<256;e++){n[0]=e;var s=this._getString(n,0,n.length),s=0<s.length?s[0]:"?";(i=this._getGlyph(s))._empty?(i=this._getGlyph(r),t[e]=i._empty?0:i._width):t[e]=i._width}return t},n.prototype._getDefaultGlyph=function(){return this._getGlyph(Tt._whiteSpace)},n.prototype._getString=function(t,e,i){for(var n="",r=0;r<i;r++)n+=String.fromCharCode(t[r+e]);return n},n.prototype._setOffset=function(t){this._offset=t},n.prototype._readFontProgram=function(t){var e=this._getGlyphChars(t),i=this._readLocaTable(this._bIsLocaShort),t=(e&&e._size()<t._size()&&(this._missedGlyphs=t._size()-e._size()),this._updateGlyphChars(e,i),this._generateGlyphTable(e,i,null,null)),e=t.glyphTableSize,i=t.newLocaTable,t=t.newGlyphTable,i=this._updateLocaTable(i,this._bIsLocaShort),n=i.newLocaSize,i=i.newLocaUpdated;return this._getFontProgram(i,t,e,n)},n.prototype._generateGlyphTable=function(t,e,i,n){i=[];var r=t.keys(),s=(r.sort(function(t,e){return t-e}),0),a=(r.forEach(function(t){0<e._offsets.length&&(s+=e._offsets[t+1]-e._offsets[t])}),this._align(s));n=[];for(var o=0;o<a;o++)n.push(0);for(var h,c,_=0,d=0,l=this._getTable("glyf"),o=0;o<e._offsets.length;o++)i.push(_),d<r.length&&r[d]===o&&(++d,i[o]=_,h=e._offsets[o],0<(c=e._offsets[o+1]-h))&&(this._offset=l._offset+h,n=this._read(n,_,c).buffer,_+=c);return{glyphTableSize:s,newLocaTable:i,newGlyphTable:n}},n.prototype._readLocaTable=function(t){var e=this._getTable("loca"),i=(this._offset=e._offset,new Kt),n=[];if(t)for(var r=e._length/2,n=[],s=0;s<r;s++)n[s]=2*this._readUInt16(this._offset);else{r=e._length/4;n=[];for(s=0;s<r;s++)n[s]=this._readUInt32(this._offset)}return i._offsets=n,i},n.prototype._updateGlyphChars=function(e,i){var n=this,r=(e.containsKey(0)||e.setValue(0,0),new _h),t=e.keys();t.forEach(function(t){r.setValue(t,e.getValue(t))}),t.forEach(function(t){n._processCompositeGlyph(e,t,i)})},n.prototype._processCompositeGlyph=function(t,e,i){if(e<i._offsets.length-1){var n=i._offsets[e];if(n!==i._offsets[e+1]){i=this._getTable("glyf"),e=(this._offset=i._offset+n,new Xt);if(e.numberOfContours=this._readInt16(this._offset),e.xMin=this._readInt16(this._offset),e.yMin=this._readInt16(this._offset),e.xMax=this._readInt16(this._offset),e.yMax=this._readInt16(this._offset),e.numberOfContours<0)for(var r=0;;){var s=this._readUInt16(this._offset),a=this._readUInt16(this._offset);if(t.containsKey(a)||t.setValue(a,0),0==(s&M._TrueTypeCompositeGlyphFlag.MoreComponents))break;r=0!=(s&M._TrueTypeCompositeGlyphFlag.Arg1And2AreWords)?4:2,0!=(s&M._TrueTypeCompositeGlyphFlag.WeHaveScale)?r+=2:0!=(s&M._TrueTypeCompositeGlyphFlag.WeHaveAnXyScale)?r+=4:0!=(s&M._TrueTypeCompositeGlyphFlag.WeHaveTwoByTwo)&&(r+=8),this._offset+=r}}}},n.prototype._updateLocaTable=function(t,e){var i=e?2*t.length:4*t.length,n=this._align(i),r=new Jt(n);return t.forEach(function(t){e?r._writeShort(t/=2):r._writeInt(t)}),{newLocaUpdated:r._data,newLocaSize:i}},n.prototype._align=function(t){return t+3&-4},n.prototype._getFontProgram=function(t,e,i,n){var r=this._getFontProgramLength(t,e,0),s=r.fontProgramLength,r=r.table,s=new Jt(s),a=(s._writeInt(65536),s._writeShort(r),this._entrySelectors[r]);return s._writeShort(16*(1<<(31&a))),s._writeShort(a),s._writeShort(16*(r-(1<<(31&a)))),this._writeCheckSums(s,r,t,e,i,n),this._writeGlyphs(s,t,e),s._data},n.prototype._getFontProgramLength=function(t,e,i){var n=this,r=0;return null!=t&&0<t.length&&null!=e&&0<e.length&&(i=2,this._tableNames.forEach(function(t){"glyf"===t||"loca"===t||(t=n._getTable(t))._empty||(++i,r+=n._align(t._length))}),r=(r+=t.length)+e.length,r+=16*i+12),{fontProgramLength:r,table:i}},n.prototype._getGlyphChars=function(t){var i=this,n=new _h;return null!=t&&t.keys().forEach(function(t){var e=i._getGlyph(t);e._empty||n.setValue(e._index,t.charCodeAt(0))}),n},n.prototype._writeCheckSums=function(n,t,r,s,a,o){var e,h,c,_=this;null!=n&&null!=r&&0<r.length&&null!=s&&0<s.length&&(e=this._tableNames,h=16*t+12,c=0,e.forEach(function(t){var e,i=_._getTable(t);i._empty||(n._writeString(t),c="glyf"===t?(e=_._calculateCheckSum(s),n._writeInt(e),a):"loca"===t?(e=_._calculateCheckSum(r),n._writeInt(e),o):(n._writeInt(i._checksum),i._length),n._writeUInt(h),n._writeUInt(c),h+=_._align(c))}))},n.prototype._calculateCheckSum=function(t){var e=0,i=0,n=0,r=0,s=0,a=0;if(null!=t&&0<t.length){for(var o=0;o<(t.length+1)/4;o++)s+=255&t[e++],r+=255&t[e++],n+=255&t[e++],i+=255&t[e++];a=i,a=(a+=n<<8)+(r<<16)+(s<<24)}return a},n.prototype._writeGlyphs=function(s,a,o){var h=this;null!=s&&null!=a&&0<a.length&&null!=o&&0<o.length&&this._tableNames.forEach(function(t){var e=h._getTable(t);if(!e._empty)if("glyf"===t)s._writeBytes(o);else if("loca"===t)s._writeBytes(a);else{for(var i=h._align(e._length),n=[],r=0;r<i;r++)n.push(0);h._offset=e._offset;t=h._read(n,0,e._length);s._writeBytes(t.buffer)}})},n.prototype._read=function(t,e,i){var n=0;if(null!=t&&0<t.length){var r;do{for(var s=0;s<i-n&&this._offset+s<this._fontData.length;s++)t[e+s]=this._fontData[this._offset+s]}while(this._offset+=r=i-n,(n+=r)<i)}return{buffer:t,written:n}},n.prototype._createInternals=function(){this._metrics=new Ut;var t=this._readNameTable(),e=this._readHeadTable(),i=(this._bIsLocaShort=0===e._indexToLocalFormat,this._readHorizontalHeaderTable()),n=this._readOS2Table(),r=this._readPostTable(),s=(this._width=this._readWidthTable(i._numberOfHMetrics,e._unitsPerEm),this._readCmapTable());this._initializeMetrics(t,e,i,n,r,s)},n.prototype._getGlyph=function(t){var e,i;return"number"==typeof t?(e=null,this._metrics._isSymbol||null===this._microsoftGlyphs?this._metrics._isSymbol&&null!==this._macintoshGlyphs&&this._macintoshGlyphs.containsKey(t)&&(e=this._macintoshGlyphs.getValue(t)):this._microsoftGlyphs.containsKey(t)&&(e=this._microsoftGlyphs.getValue(t)),null!==e?e:this._getDefaultGlyph()):(e=null,i=t.charCodeAt(0),this._metrics._isSymbol||null===this._microsoft?(this._metrics._isSymbol&&null!==this.macintosh||this._isMacFont)&&(0!==this._maxMacIndex?i%=this._maxMacIndex+1:i=61440==(65280&i)?255&i:i,this.macintosh.containsKey(i))&&(e=this.macintosh.getValue(i),this._isFontPresent=!0):this._microsoft.containsKey(i)?(e=this._microsoft.getValue(i),i!==Tt._whiteSpace.charCodeAt(0)&&(this._isFontPresent=!0)):i!==Tt._whiteSpace.charCodeAt(0)&&(this._isFontPresent=!1),null!==(e=t===Tt._whiteSpace&&null===e?new qt:e)?e:this._getDefaultGlyph())},n.prototype._readString=function(t,e){if(null==e)return this._readString(t,!1);var i="";if(e)for(var n=0;n<t;n++)n%2!=0&&(i+=String.fromCharCode(this._fontData[this._offset])),this._offset+=1;else for(n=0;n<t;n++)i+=String.fromCharCode(this._fontData[this._offset]),this._offset+=1;return i},n.prototype._readFixed=function(t){return this._readInt16(t)+this._readInt16(t+2)/16384},n.prototype._readInt32=function(t){var e=this._fontData[t+3],i=this._fontData[t+2],n=this._fontData[t+1],t=this._fontData[t];return this._offset+=4,e+(i<<8)+(n<<16)+(t<<24)},n.prototype._readUInt32=function(t){var e=this._fontData[t+3],i=this._fontData[t+2],n=this._fontData[t+1],t=this._fontData[t];return this._offset+=4,e|i<<8|n<<16|t<<24},n.prototype._readInt16=function(t){t=32768&(t=(this._fontData[t]<<8)+this._fontData[t+1])?t-65536:t;return this._offset+=2,t},n.prototype._readInt64=function(t){var e=this._readInt32(t+4),t=4294967296*this._readInt32(t)+e;return e<0&&(t+=4294967296),t},n.prototype._readUInt16=function(t){t=this._fontData[t]<<8|this._fontData[t+1];return this._offset+=2,t},n.prototype._readUShortArray=function(t){for(var e=[],i=0;i<t;i++)e[i]=this._readUInt16(this._offset);return e},n.prototype._readBytes=function(t){for(var e=[],i=0;i<t;i++)e.push(this._fontData[this._offset]),this._offset+=1;return e},n.prototype._readByte=function(t){t=this._fontData[t];return this._offset+=1,t},n.prototype._getCharacterWidth=function(t){t=this._getGlyph(t);return(t=t._empty?this._getDefaultGlyph():t)._empty?0:t._width},n.prototype._convertString=function(t){var e="";if(null!=t&&0<t.length)for(var i=0;i<t.length;i++){var n=t[i],n=this._getGlyph(n);n._empty||(e+=String.fromCharCode(n._index))}return e},n);function n(t){this._int32Size=4,this._isFont=!1,this._isMacTtf=!1,this._isMacFont=!1,this._missedGlyphs=0,this._tableNames=["cvt ","fpgm","glyf","head","hhea","hmtx","loca","maxp","prep"],this._entrySelectors=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4],this._isOpenType=!1,this._fontData=t,this._initialize()}var zt=function(){},Ut=(Object.defineProperty(Ht.prototype,"_isItalic",{get:function(){return 0!=(2&this._macStyle)},enumerable:!0,configurable:!0}),Object.defineProperty(Ht.prototype,"_isBold",{get:function(){return 0!=(1&this._macStyle)},enumerable:!0,configurable:!0}),Ht);function Ht(){}var Wt=function(){},qt=(Object.defineProperty(Gt.prototype,"_empty",{get:function(){return this._index===this._width&&this._width===this._charCode&&0===this._charCode},enumerable:!0,configurable:!0}),Gt);function Gt(){}var Kt=function(){},Xt=function(){},Jt=(Object.defineProperty(Yt.prototype,"_data",{get:function(){if(this._buffer.length<this._bufferLength)for(var t=this._bufferLength-this._buffer.length,e=0;e<t;e++)this._buffer.push(0);return this._buffer},enumerable:!0,configurable:!0}),Object.defineProperty(Yt.prototype,"_position",{get:function(){return void 0!==this._internalPosition&&null!==this._internalPosition||(this._internalPosition=0),this._internalPosition},enumerable:!0,configurable:!0}),Yt.prototype._writeShort=function(t){this._flush([(65280&t)>>8,255&t])},Yt.prototype._writeInt=function(t){this._flush([(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t])},Yt.prototype._writeUInt=function(t){this._flush([(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t])},Yt.prototype._writeString=function(t){if(null!=t){for(var e=[],i=0;i<t.length;i++)e.push(t.charCodeAt(i));this._flush(e)}},Yt.prototype._writeBytes=function(t){this._flush(t)},Yt.prototype._flush=function(t){if(null!=t){for(var e=this._position,i=0;i<t.length;i++)this._buffer[e]=t[i],e++;this._internalPosition+=t.length}},Yt);function Yt(t){this.int32Size=4,this.int16Size=2,this.int64Size=8,this._bufferLength=t,this._buffer=[]}Zt.prototype._beginSave=function(){this._descendantFontBeginSave(),this._cmapBeginSave(),this._fontDictionaryBeginSave(),this._fontProgramBeginSave(),this._fontDescriptor&&(this._fontDescriptor.update(this._ttfMetrics._contains?"FontFile3":"FontFile2",this._fontProgram),this._fontDescriptor._updated=!0,this._fontDescriptor._isFont=!0)},Zt.prototype._descendantFontBeginSave=function(){var t;null!==this._usedChars&&void 0!==this._usedChars&&0<this._usedChars._size()&&null!==(t=this._getDescendantWidth())&&this._descendantFont.set("W",t)},Zt.prototype._fontDictionaryBeginSave=function(){null!==this._usedChars&&void 0!==this._usedChars&&0<this._usedChars._size()&&this._fontDictionary&&!this._fontDictionary.has("ToUnicode")&&this._fontDictionary.update("ToUnicode",this._cmap)},Zt.prototype._createInternals=function(){this._fontDictionary=new D,this._descendantFont=new D,this._metrics=new ht,this._ttfReader._createInternals(),this._usedChars=null;var t=[];this._fontProgram=new g(t,new D),this._cmap=new g(t,new D),this._ttfMetrics=this._ttfReader._metrics,this._initializeMetrics(),this._subsetName=this._getFontName(),this._createDescendantFont(),this._createFontDictionary()},Zt.prototype._getInternals=function(){return this._fontDictionary},Zt.prototype._initializeMetrics=function(){var t=this._ttfReader._metrics;this._metrics._name=t._fontFamily,this._metrics._postScriptName=t._postScriptName,this._metrics._widthTable=new ct(t._widthTable),this._metrics._subScriptSizeFactor=t._subScriptSizeFactor,this._metrics._superscriptSizeFactor=t._superscriptSizeFactor,this._metrics._isBold=t._isBold},Zt.prototype._getFontName=function(){for(var t="",e=0;e<6;e++){var i=Math.floor(26*Math.random())+0;t+=this._nameString[i]}return(t=t+"+"+this._ttfReader._metrics._postScriptName).toString()},Zt.prototype._createDescendantFont=function(){this._descendantFont=new D,this._descendantFont._updated=!0,this._descendantFont.set("Type",new R("Font")),this._descendantFont.set("Subtype",new R("CIDFontType2")),this._descendantFont.set("BaseFont",new R(this._subsetName)),this._descendantFont.set("CIDToGIDMap",new R("Identity")),this._descendantFont.set("DW",1e3),this._fontDescriptor=this._createFontDescriptor(),this._descendantFont.set("FontDescriptor",this._fontDescriptor);var t=this._createSystemInfo();this._descendantFont.set("CIDSystemInfo",t),this._descendantFont._isFont=!0},Zt.prototype._createFontDescriptor=function(){var t=new D,e=this._ttfReader._metrics;return t.set("Type",new R("FontDescriptor")),t.set("FontName",new R(this._subsetName)),t.set("Flags",this._getDescriptorFlags()),t.set("FontBBox",this._getBoundBox()),t.set("MissingWidth",e._widthTable[32]),t.set("StemV",e._stemV),t.set("ItalicAngle",e._italicAngle),t.set("CapHeight",e._capHeight),t.set("Ascent",e._winAscent),t.set("Descent",e._winDescent),t.set("Leading",e._leading),t.set("AvgWidth",e._widthTable[32]),t.set("MaxWidth",e._widthTable[32]),t.set("XHeight",0),t.set("StemH",0),t._updated=!0,t},Zt.prototype._generateFontProgram=function(){var t=[];this._usedChars=null===this._usedChars||void 0===this._usedChars?new _h:this._usedChars,this._ttfReader._setOffset(0),this._ttfReader._isOpenType&&this._ttfMetrics._contains?(t=this._ttfReader._readCompactFontFormatTable(),this._fontProgram.dictionary.update("Subtype",R.get("CIDFontType0C"))):t=this._ttfReader._readFontProgram(this._usedChars),this._fontProgram._clearStream(),this._fontProgram._writeBytes(t)},Zt.prototype._getBoundBox=function(){var t=this._ttfReader._metrics._fontBox,e=Math.abs(t[2]-t[0]),i=Math.abs(t[1]-t[3]);return[t[0],t[3],e,i]},Zt.prototype._cmapBeginSave=function(){this._generateCmap()},Zt.prototype._fontProgramBeginSave=function(){this._generateFontProgram()},Zt.prototype._toHexString=function(t,e){t=t.toString(16);return e&&(t=t.toUpperCase()),"<0000".substring(0,5-t.length)+t+">"},Zt.prototype._generateCmap=function(){var i,n,t,e,r,s,a=this;null!==this._usedChars&&void 0!==this._usedChars&&0<this._usedChars._size()&&0<(i=this._ttfReader._getGlyphChars(this._usedChars))._size()&&(e=(n=i.keys().sort())[0],t=n[n.length-1],e=this._toHexString(e,!1)+this._toHexString(t,!1)+"\r\n",r=(r=(r="")+this._cmapPrefix+e)+this._cmapEndCodeSpaceRange,s=0,n.forEach(function(t,e){0===s&&(0!==e&&(r+=a._cmapEndRange),s=Math.min(100,n.length-e),r=(r=r+s+" ")+a._cmapBeginRange),--s,r=(r+=a._toHexString(t,!0)+a._toHexString(t,!0))+(a._toHexString(i.getValue(t),!0)+"\n")}),r+=this._cmapSuffix,this._cmap._clearStream(),this._cmap._write(r))},Zt.prototype._createFontDictionary=function(){this._fontDictionary._updated=!0,this._fontDictionary.set("Type",R.get("Font")),this._fontDictionary.set("Subtype",R.get("Type0")),this._fontDictionary.set("BaseFont",new R(this._subsetName)),this._fontDictionary.set("Encoding",R.get("Identity-H")),this._fontDictionary.set("DescendantFonts",this._descendantFont),this._fontDictionary._isFont=!0,this._fontDictionary._currentObj=this},Zt.prototype._createSystemInfo=function(){var t=new D;return t._updated=!0,t.set("Registry","Adobe"),t.set("Ordering","Identity"),t.set("Supplement",0),t},Zt.prototype._getDescriptorFlags=function(){var t=0,e=this._ttfReader._metrics;return e._isFixedPitch&&(t|=M._FontDescriptorFlag.fixedPitch),e._isSymbol?t|=M._FontDescriptorFlag.symbolic:t|=M._FontDescriptorFlag.nonSymbolic,e._isItalic&&(t|=M._FontDescriptorFlag.italic),e._isBold&&(t|=M._FontDescriptorFlag.forceBold),t},Zt.prototype._getCharacterWidth=function(t){return this._ttfReader._getCharacterWidth(t)},Zt.prototype._setSymbols=function(t){var e=this;null!=t&&(null!==this._usedChars&&void 0!==this._usedChars||(this._usedChars=new _h),t.split("").forEach(function(t){e._usedChars.setValue(t,String.fromCharCode(0))}))},Zt.prototype._getDescendantWidth=function(){var i,n,r,s,a,e=this,o=new Array;return null!==this._usedChars&&void 0!==this._usedChars&&0<this._usedChars._size()&&(i=[],this._usedChars.keys().forEach(function(t){t=e._ttfReader._getGlyph(t);i.push(t)}),i.sort(function(t,e){return t._index-e._index}),r=n=0,s=!1,a=new Array,i.forEach(function(t,e){s||(s=!0,n=t._index,r=t._index-1),(r+1!==t._index||e+1===i.length)&&1<i.length&&(o.push(Number(n)),0!==e&&o.push(a),n=t._index,a=new Array),a.push(Number(t._width)),e+1===i.length&&(o.push(Number(n)),o.push(a)),r=t._index})),o};var Qt=Zt;function Zt(t,e){if(this._nameString="ABCDEFGHIJKLMNOPQRSTUVWXYZ",this._isEmbedFont=!1,this._cmapPrefix="/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\r\n/CIDSystemInfo << /Registry (Adobe)/Ordering (UCS)/Supplement 0>> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 beginCodeSpacerange\r\n",this._cmapEndCodeSpaceRange="endCodeSpacerange\r\n",this._cmapBeginRange="beginbfrange\r\n",this._cmapEndRange="endbfrange\r\n",this._cmapSuffix="endbfrange\nendcmap\nCMapName currentdict /CMap defineresource pop\nend end\r\n",null==t)throw new Error("ArgumentNullException:base64String");null!=e&&(this._fontSize=e),this._fontData="string"==typeof t?Rs(t):t,this._ttfReader=new Vt(this._fontData),this._ttfMetrics=this._ttfReader._metrics}te.prototype._getCharacterShape=function(t,e){if(t>=this._hamza&&t<=this._bwhb){if(this._arabicMapTable.get(t))return this._arabicMapTable.get(t)[e+1]}else if(t>=this._lwawm&&t<=this._lwa);return t},te.prototype._shape=function(t){for(var e="",i="",n=0;n<t.length;n++){var r=t[n];""<=r&&r<="ۿ"?i+=r:(0<i.length&&(e+=this._doShape(i.toString(),0),i=""),e+=r)}return 0<i.length&&(e+=this._doShape(i.toString(),0)),e.toString()},te.prototype._doShape=function(t,e){for(var i="",n=0,r=0,s=new ee,a=new ee;r<t.length;){var o,h=t[r++];0===this._ligature(h,a)&&(n=1===(o=this._getShapeCount(h))?0:2,2<s._shapes&&(n+=1),n%=a._shapes,a._shapeValue=this._getCharacterShape(a._shapeValue,n),i=this._append(i,s,e),s=a,(a=new ee)._shapeValue=h,a._shapes=o,a._shapeLigature++)}return n=2<s._shapes?1:0,n%=a._shapes,a._shapeValue=this._getCharacterShape(a._shapeValue,n),i=this._append(i,s,e),(i=this._append(i,a,e)).toString()},te.prototype._append=function(t,e,i){return""!==e._shapeValue&&(t+=e._shapeValue,--e._shapeLigature,""!==e._shapeType&&(0==(i&this._vowel)&&(t+=e._shapeType),--e._shapeLigature),""!==e._shapeVowel)&&(0==(i&this._vowel)&&(t+=e._shapeVowel),--e._shapeLigature),t},te.prototype._ligature=function(t,e){if(""===e._shapeValue)return 0;var i=0;if(t>=this._fathatan&&t<=this._hamzaBelow||t===this._superalef){if(i=1,""!==e._shapeVowel&&t!==this._shadda&&(i=2),t===this._shadda){if(""!==e._shapeType)return 0;e._shapeType=this._shadda}else t===this._hamzaBelow?e._shapeValue===this._alef?(e._shapeValue=this._alefHamzaBelow,i=2):e._shapeValue===this._lwa?(e._shapeValue=this._lwawhb,i=2):e._shapeType=this._hamzaBelow:t===this._hamzaAbove?e._shapeValue===this._alef?(e._shapeValue=this._alefHamza,i=2):e._shapeValue===this._lwa?(e._shapeValue=this._lwawh,i=2):e._shapeValue===this._waw?(e._shapeValue=this._wawHamza,i=2):e._shapeValue===this._yeh||e._shapeValue===this._alefsura||e._shapeValue===this._farsiYeh?(e._shapeValue=this._yehHamza,i=2):e._shapeType=this._hamzaAbove:t===this._madda?e._shapeValue===this._alef&&(e._shapeValue=this._alefMadda,i=2):e._shapeVowel=t;1===i&&e._shapeLigature++}else{if(""!==e._shapeVowel)return 0;e._shapeValue===this._lam&&(t===this._alef?(e._shapeValue=this._lwa,e._shapes=2,i=3):t===this._alefHamza?(e._shapeValue=this._lwawh,e._shapes=2,i=3):t===this._alefHamzaBelow?(e._shapeValue=this._lwawhb,e._shapes=2,i=3):t===this._alefMadda&&(e._shapeValue=this._lwawm,e._shapes=2,i=3))}return i},te.prototype._getShapeCount=function(t){if(t>=this._hamza&&t<=this._bwhb&&!(t>=this._fathatan&&t<=this._hamzaBelow||t===this._superalef)){if(this._arabicMapTable.get(t))return this._arabicMapTable.get(t).length-1}else if(t===this._zeroWidthJoiner)return 4;return 1};var $t=te;function te(){var e=this;this._arabicCharTable=[["ء","ﺀ"],["آ","ﺁ","ﺂ"],["أ","ﺃ","ﺄ"],["ؤ","ﺅ","ﺆ"],["إ","ﺇ","ﺈ"],["ئ","ﺉ","ﺊ","ﺋ","ﺌ"],["ا","ﺍ","ﺎ"],["ب","ﺏ","ﺐ","ﺑ","ﺒ"],["ة","ﺓ","ﺔ"],["ت","ﺕ","ﺖ","ﺗ","ﺘ"],["ث","ﺙ","ﺚ","ﺛ","ﺜ"],["ج","ﺝ","ﺞ","ﺟ","ﺠ"],["ح","ﺡ","ﺢ","ﺣ","ﺤ"],["خ","ﺥ","ﺦ","ﺧ","ﺨ"],["د","ﺩ","ﺪ"],["ذ","ﺫ","ﺬ"],["ر","ﺭ","ﺮ"],["ز","ﺯ","ﺰ"],["س","ﺱ","ﺲ","ﺳ","ﺴ"],["ش","ﺵ","ﺶ","ﺷ","ﺸ"],["ص","ﺹ","ﺺ","ﺻ","ﺼ"],["ض","ﺽ","ﺾ","ﺿ","ﻀ"],["ط","ﻁ","ﻂ","ﻃ","ﻄ"],["ظ","ﻅ","ﻆ","ﻇ","ﻈ"],["ع","ﻉ","ﻊ","ﻋ","ﻌ"],["غ","ﻍ","ﻎ","ﻏ","ﻐ"],["ـ","ـ","ـ","ـ","ـ"],["ف","ﻑ","ﻒ","ﻓ","ﻔ"],["ق","ﻕ","ﻖ","ﻗ","ﻘ"],["ك","ﻙ","ﻚ","ﻛ","ﻜ"],["ل","ﻝ","ﻞ","ﻟ","ﻠ"],["م","ﻡ","ﻢ","ﻣ","ﻤ"],["ن","ﻥ","ﻦ","ﻧ","ﻨ"],["ه","ﻩ","ﻪ","ﻫ","ﻬ"],["و","ﻭ","ﻮ"],["ى","ﻯ","ﻰ","ﯨ","ﯩ"],["ي","ﻱ","ﻲ","ﻳ","ﻴ"],["ٱ","ﭐ","ﭑ"],["ٹ","ﭦ","ﭧ","ﭨ","ﭩ"],["ٺ","ﭞ","ﭟ","ﭠ","ﭡ"],["ٻ","ﭒ","ﭓ","ﭔ","ﭕ"],["پ","ﭖ","ﭗ","ﭘ","ﭙ"],["ٿ","ﭢ","ﭣ","ﭤ","ﭥ"],["ڀ","ﭚ","ﭛ","ﭜ","ﭝ"],["ڃ","ﭶ","ﭷ","ﭸ","ﭹ"],["ڄ","ﭲ","ﭳ","ﭴ","ﭵ"],["چ","ﭺ","ﭻ","ﭼ","ﭽ"],["ڇ","ﭾ","ﭿ","ﮀ","ﮁ"],["ڈ","ﮈ","ﮉ"],["ڌ","ﮄ","ﮅ"],["ڍ","ﮂ","ﮃ"],["ڎ","ﮆ","ﮇ"],["ڑ","ﮌ","ﮍ"],["ژ","ﮊ","ﮋ"],["ڤ","ﭪ","ﭫ","ﭬ","ﭭ"],["ڦ","ﭮ","ﭯ","ﭰ","ﭱ"],["ک","ﮎ","ﮏ","ﮐ","ﮑ"],["ڭ","ﯓ","ﯔ","ﯕ","ﯖ"],["گ","ﮒ","ﮓ","ﮔ","ﮕ"],["ڱ","ﮚ","ﮛ","ﮜ","ﮝ"],["ڳ","ﮖ","ﮗ","ﮘ","ﮙ"],["ں","ﮞ","ﮟ"],["ڻ","ﮠ","ﮡ","ﮢ","ﮣ"],["ھ","ﮪ","ﮫ","ﮬ","ﮭ"],["ۀ","ﮤ","ﮥ"],["ہ","ﮦ","ﮧ","ﮨ","ﮩ"],["ۅ","ﯠ","ﯡ"],["ۆ","ﯙ","ﯚ"],["ۇ","ﯗ","ﯘ"],["ۈ","ﯛ","ﯜ"],["ۉ","ﯢ","ﯣ"],["ۋ","ﯞ","ﯟ"],["ی","ﯼ","ﯽ","ﯾ","ﯿ"],["ې","ﯤ","ﯥ","ﯦ","ﯧ"],["ے","ﮮ","ﮯ"],["ۓ","ﮰ","ﮱ"]],this._alef="ا",this._alefHamza="أ",this._alefHamzaBelow="إ",this._alefMadda="آ",this._lam="ل",this._hamza="ء",this._zeroWidthJoiner="",this._hamzaAbove="ٔ",this._hamzaBelow="ٕ",this._wawHamza="ؤ",this._yehHamza="ئ",this._waw="و",this._alefsura="ى",this._yeh="ي",this._farsiYeh="ی",this._shadda="ّ",this._madda="ٓ",this._lwa="ﻻ",this._lwawh="ﻷ",this._lwawhb="ﻹ",this._lwawm="ﻵ",this._bwhb="ۓ",this._fathatan="ً",this._superalef="ٰ",this._vowel=1,this._arabicMapTable=new Map,this._arabicCharTable.forEach(function(t){e._arabicMapTable.set(t[0],t)})}var ee=function(){this._shapeValue="",this._shapeType="",this._shapeVowel="",this._shapeLigature=0,this._shapes=1},ie=(ne.prototype._doMirrorShaping=function(t){for(var e,i=[],n=0;n<t.length;n++)1==(1&this._indexLevels[n])&&this._mirroringShape.containsKey(t[n].charCodeAt(0))?(e=t[n].charCodeAt(0),i[n]=String.fromCharCode(this._mirroringShape.getValue(e))):i[n]=t[n].toString();return i.join("")},ne.prototype._getLogicalToVisualString=function(t,e){var i=new re,n=(this._indexLevels=i._getVisualOrder(t,e),this._setDefaultIndexLevel(),this._doOrder(0,this._indexLevels.length-1),this._doMirrorShaping(t));return this._indexes.map(function(t){return n[t]}).join("").toString()},ne.prototype._setDefaultIndexLevel=function(){for(var t=0;t<this._indexLevels.length;t++)this._indexes[t]=t},ne.prototype._doOrder=function(t,e){for(var i=this._indexLevels[t],n=i,r=i,s=i,a=t+1;a<=e;++a){var o=this._indexLevels[a];i<o?i=o:o<n&&(n=o),r&=o,s|=o}if(0!=(1&s))if(1==(1&r))this._reArrange(t,e+1);else for(n|=1;n<=i;){for(var h=t;;){for(;h<=e&&!(this._indexLevels[h]>=i);)h+=1;if(e<h)break;for(var c=h+1;c<=e&&!(this._indexLevels[c]<i);)c+=1;this._reArrange(h,c),h=c+1}--i}},ne.prototype._reArrange=function(t,e){var i=(t+e)/2;for(--e;t<i;++t,--e){var n=this._indexes[t];this._indexes[t]=this._indexes[e],this._indexes[e]=n}},ne.prototype._update=function(){this._mirroringShape.setValue(40,41),this._mirroringShape.setValue(41,40),this._mirroringShape.setValue(60,62),this._mirroringShape.setValue(62,60),this._mirroringShape.setValue(91,93),this._mirroringShape.setValue(93,91),this._mirroringShape.setValue(123,125),this._mirroringShape.setValue(125,123),this._mirroringShape.setValue(171,187),this._mirroringShape.setValue(187,171),this._mirroringShape.setValue(8249,8250),this._mirroringShape.setValue(8250,8249),this._mirroringShape.setValue(8261,8262),this._mirroringShape.setValue(8262,8261),this._mirroringShape.setValue(8317,8318),this._mirroringShape.setValue(8318,8317),this._mirroringShape.setValue(8333,8334),this._mirroringShape.setValue(8334,8333),this._mirroringShape.setValue(8712,8715),this._mirroringShape.setValue(8713,8716),this._mirroringShape.setValue(8714,8717),this._mirroringShape.setValue(8715,8712),this._mirroringShape.setValue(8716,8713),this._mirroringShape.setValue(8717,8714),this._mirroringShape.setValue(8725,10741),this._mirroringShape.setValue(8764,8765),this._mirroringShape.setValue(8765,8764),this._mirroringShape.setValue(8771,8909),this._mirroringShape.setValue(8786,8787),this._mirroringShape.setValue(8787,8786),this._mirroringShape.setValue(8788,8789),this._mirroringShape.setValue(8789,8788),this._mirroringShape.setValue(8804,8805),this._mirroringShape.setValue(8805,8804),this._mirroringShape.setValue(8806,8807),this._mirroringShape.setValue(8807,8806),this._mirroringShape.setValue(8808,8809),this._mirroringShape.setValue(8809,8808),this._mirroringShape.setValue(8810,8811),this._mirroringShape.setValue(8811,8810),this._mirroringShape.setValue(8814,8815),this._mirroringShape.setValue(8815,8814),this._mirroringShape.setValue(8816,8817),this._mirroringShape.setValue(8817,8816),this._mirroringShape.setValue(8818,8819),this._mirroringShape.setValue(8819,8818),this._mirroringShape.setValue(8820,8821),this._mirroringShape.setValue(8821,8820),this._mirroringShape.setValue(8822,8823),this._mirroringShape.setValue(8823,8822),this._mirroringShape.setValue(8824,8825),this._mirroringShape.setValue(8825,8824),this._mirroringShape.setValue(8826,8827),this._mirroringShape.setValue(8827,8826),this._mirroringShape.setValue(8828,8829),this._mirroringShape.setValue(8829,8828),this._mirroringShape.setValue(8830,8831),this._mirroringShape.setValue(8831,8830),this._mirroringShape.setValue(8832,8833),this._mirroringShape.setValue(8833,8832),this._mirroringShape.setValue(8834,8835),this._mirroringShape.setValue(8835,8834),this._mirroringShape.setValue(8836,8837),this._mirroringShape.setValue(8837,8836),this._mirroringShape.setValue(8838,8839),this._mirroringShape.setValue(8839,8838),this._mirroringShape.setValue(8840,8841),this._mirroringShape.setValue(8841,8840),this._mirroringShape.setValue(8842,8843),this._mirroringShape.setValue(8843,8842),this._mirroringShape.setValue(8847,8848),this._mirroringShape.setValue(8848,8847),this._mirroringShape.setValue(8849,8850),this._mirroringShape.setValue(8850,8849),this._mirroringShape.setValue(8856,10680),this._mirroringShape.setValue(8866,8867),this._mirroringShape.setValue(8867,8866),this._mirroringShape.setValue(8870,10974),this._mirroringShape.setValue(8872,10980),this._mirroringShape.setValue(8873,10979),this._mirroringShape.setValue(8875,10981),this._mirroringShape.setValue(8880,8881),this._mirroringShape.setValue(8881,8880),this._mirroringShape.setValue(8882,8883),this._mirroringShape.setValue(8883,8882),this._mirroringShape.setValue(8884,8885),this._mirroringShape.setValue(8885,8884),this._mirroringShape.setValue(8886,8887),this._mirroringShape.setValue(8887,8886),this._mirroringShape.setValue(8905,8906),this._mirroringShape.setValue(8906,8905),this._mirroringShape.setValue(8907,8908),this._mirroringShape.setValue(8908,8907),this._mirroringShape.setValue(8909,8771),this._mirroringShape.setValue(8912,8913),this._mirroringShape.setValue(8913,8912),this._mirroringShape.setValue(8918,8919),this._mirroringShape.setValue(8919,8918),this._mirroringShape.setValue(8920,8921),this._mirroringShape.setValue(8921,8920),this._mirroringShape.setValue(8922,8923),this._mirroringShape.setValue(8923,8922),this._mirroringShape.setValue(8924,8925),this._mirroringShape.setValue(8925,8924),this._mirroringShape.setValue(8926,8927),this._mirroringShape.setValue(8927,8926),this._mirroringShape.setValue(8928,8929),this._mirroringShape.setValue(8929,8928),this._mirroringShape.setValue(8930,8931),this._mirroringShape.setValue(8931,8930),this._mirroringShape.setValue(8932,8933),this._mirroringShape.setValue(8933,8932),this._mirroringShape.setValue(8934,8935),this._mirroringShape.setValue(8935,8934),this._mirroringShape.setValue(8936,8937),this._mirroringShape.setValue(8937,8936),this._mirroringShape.setValue(8938,8939),this._mirroringShape.setValue(8939,8938),this._mirroringShape.setValue(8940,8941),this._mirroringShape.setValue(8941,8940),this._mirroringShape.setValue(8944,8945),this._mirroringShape.setValue(8945,8944),this._mirroringShape.setValue(8946,8954),this._mirroringShape.setValue(8947,8955),this._mirroringShape.setValue(8948,8956),this._mirroringShape.setValue(8950,8957),this._mirroringShape.setValue(8951,8958),this._mirroringShape.setValue(8954,8946),this._mirroringShape.setValue(8955,8947),this._mirroringShape.setValue(8956,8948),this._mirroringShape.setValue(8957,8950),this._mirroringShape.setValue(8958,8951),this._mirroringShape.setValue(8968,8969),this._mirroringShape.setValue(8969,8968),this._mirroringShape.setValue(8970,8971),this._mirroringShape.setValue(8971,8970),this._mirroringShape.setValue(9001,9002),this._mirroringShape.setValue(9002,9001),this._mirroringShape.setValue(10088,10089),this._mirroringShape.setValue(10089,10088),this._mirroringShape.setValue(10090,10091),this._mirroringShape.setValue(10091,10090),this._mirroringShape.setValue(10092,10093),this._mirroringShape.setValue(10093,10092),this._mirroringShape.setValue(10094,10095),this._mirroringShape.setValue(10095,10094),this._mirroringShape.setValue(10096,10097),this._mirroringShape.setValue(10097,10096),this._mirroringShape.setValue(10098,10099),this._mirroringShape.setValue(10099,10098),this._mirroringShape.setValue(10100,10101),this._mirroringShape.setValue(10101,10100),this._mirroringShape.setValue(10197,10198),this._mirroringShape.setValue(10198,10197),this._mirroringShape.setValue(10205,10206),this._mirroringShape.setValue(10206,10205),this._mirroringShape.setValue(10210,10211),this._mirroringShape.setValue(10211,10210),this._mirroringShape.setValue(10212,10213),this._mirroringShape.setValue(10213,10212),this._mirroringShape.setValue(10214,10215),this._mirroringShape.setValue(10215,10214),this._mirroringShape.setValue(10216,10217),this._mirroringShape.setValue(10217,10216),this._mirroringShape.setValue(10218,10219),this._mirroringShape.setValue(10219,10218),this._mirroringShape.setValue(10627,10628),this._mirroringShape.setValue(10628,10627),this._mirroringShape.setValue(10629,10630),this._mirroringShape.setValue(10630,10629),this._mirroringShape.setValue(10631,10632),this._mirroringShape.setValue(10632,10631),this._mirroringShape.setValue(10633,10634),this._mirroringShape.setValue(10634,10633),this._mirroringShape.setValue(10635,10636),this._mirroringShape.setValue(10636,10635),this._mirroringShape.setValue(10637,10640),this._mirroringShape.setValue(10638,10639),this._mirroringShape.setValue(10639,10638),this._mirroringShape.setValue(10640,10637),this._mirroringShape.setValue(10641,10642),this._mirroringShape.setValue(10642,10641),this._mirroringShape.setValue(10643,10644),this._mirroringShape.setValue(10644,10643),this._mirroringShape.setValue(10645,10646),this._mirroringShape.setValue(10646,10645),this._mirroringShape.setValue(10647,10648),this._mirroringShape.setValue(10648,10647),this._mirroringShape.setValue(10680,8856),this._mirroringShape.setValue(10688,10689),this._mirroringShape.setValue(10689,10688),this._mirroringShape.setValue(10692,10693),this._mirroringShape.setValue(10693,10692),this._mirroringShape.setValue(10703,10704),this._mirroringShape.setValue(10704,10703),this._mirroringShape.setValue(10705,10706),this._mirroringShape.setValue(10706,10705),this._mirroringShape.setValue(10708,10709),this._mirroringShape.setValue(10709,10708),this._mirroringShape.setValue(10712,10713),this._mirroringShape.setValue(10713,10712),this._mirroringShape.setValue(10714,10715),this._mirroringShape.setValue(10715,10714),this._mirroringShape.setValue(10741,8725),this._mirroringShape.setValue(10744,10745),this._mirroringShape.setValue(10745,10744),this._mirroringShape.setValue(10748,10749),this._mirroringShape.setValue(10749,10748),this._mirroringShape.setValue(10795,10796),this._mirroringShape.setValue(10796,10795),this._mirroringShape.setValue(10797,10796),this._mirroringShape.setValue(10798,10797),this._mirroringShape.setValue(10804,10805),this._mirroringShape.setValue(10805,10804),this._mirroringShape.setValue(10812,10813),this._mirroringShape.setValue(10813,10812),this._mirroringShape.setValue(10852,10853),this._mirroringShape.setValue(10853,10852),this._mirroringShape.setValue(10873,10874),this._mirroringShape.setValue(10874,10873),this._mirroringShape.setValue(10877,10878),this._mirroringShape.setValue(10878,10877),this._mirroringShape.setValue(10879,10880),this._mirroringShape.setValue(10880,10879),this._mirroringShape.setValue(10881,10882),this._mirroringShape.setValue(10882,10881),this._mirroringShape.setValue(10883,10884),this._mirroringShape.setValue(10884,10883),this._mirroringShape.setValue(10891,10892),this._mirroringShape.setValue(10892,10891),this._mirroringShape.setValue(10897,10898),this._mirroringShape.setValue(10898,10897),this._mirroringShape.setValue(10899,10900),this._mirroringShape.setValue(10900,10899),this._mirroringShape.setValue(10901,10902),this._mirroringShape.setValue(10902,10901),this._mirroringShape.setValue(10903,10904),this._mirroringShape.setValue(10904,10903),this._mirroringShape.setValue(10905,10906),this._mirroringShape.setValue(10906,10905),this._mirroringShape.setValue(10907,10908),this._mirroringShape.setValue(10908,10907),this._mirroringShape.setValue(10913,10914),this._mirroringShape.setValue(10914,10913),this._mirroringShape.setValue(10918,10919),this._mirroringShape.setValue(10919,10918),this._mirroringShape.setValue(10920,10921),this._mirroringShape.setValue(10921,10920),this._mirroringShape.setValue(10922,10923),this._mirroringShape.setValue(10923,10922),this._mirroringShape.setValue(10924,10925),this._mirroringShape.setValue(10925,10924),this._mirroringShape.setValue(10927,10928),this._mirroringShape.setValue(10928,10927),this._mirroringShape.setValue(10931,10932),this._mirroringShape.setValue(10932,10931),this._mirroringShape.setValue(10939,10940),this._mirroringShape.setValue(10940,10939),this._mirroringShape.setValue(10941,10942),this._mirroringShape.setValue(10942,10941),this._mirroringShape.setValue(10943,10944),this._mirroringShape.setValue(10944,10943),this._mirroringShape.setValue(10945,10946),this._mirroringShape.setValue(10946,10945),this._mirroringShape.setValue(10947,10948),this._mirroringShape.setValue(10948,10947),this._mirroringShape.setValue(10949,10950),this._mirroringShape.setValue(10950,10949),this._mirroringShape.setValue(10957,10958),this._mirroringShape.setValue(10958,10957),this._mirroringShape.setValue(10959,10960),this._mirroringShape.setValue(10960,10959),this._mirroringShape.setValue(10961,10962),this._mirroringShape.setValue(10962,10961),this._mirroringShape.setValue(10963,10964),this._mirroringShape.setValue(10964,10963),this._mirroringShape.setValue(10965,10966),this._mirroringShape.setValue(10966,10965),this._mirroringShape.setValue(10974,8870),this._mirroringShape.setValue(10979,8873),this._mirroringShape.setValue(10980,8872),this._mirroringShape.setValue(10981,8875),this._mirroringShape.setValue(10988,10989),this._mirroringShape.setValue(10989,10988),this._mirroringShape.setValue(10999,11e3),this._mirroringShape.setValue(11e3,10999),this._mirroringShape.setValue(11001,11002),this._mirroringShape.setValue(11002,11001),this._mirroringShape.setValue(12296,12297),this._mirroringShape.setValue(12297,12296),this._mirroringShape.setValue(12298,12299),this._mirroringShape.setValue(12299,12298),this._mirroringShape.setValue(12300,12301),this._mirroringShape.setValue(12301,12300),this._mirroringShape.setValue(12302,12303),this._mirroringShape.setValue(12303,12302),this._mirroringShape.setValue(12304,12305),this._mirroringShape.setValue(12305,12304),this._mirroringShape.setValue(12308,12309),this._mirroringShape.setValue(12309,12308),this._mirroringShape.setValue(12310,12311),this._mirroringShape.setValue(12311,12310),this._mirroringShape.setValue(12312,12313),this._mirroringShape.setValue(12313,12312),this._mirroringShape.setValue(12314,12315),this._mirroringShape.setValue(12315,12314),this._mirroringShape.setValue(65288,65289),this._mirroringShape.setValue(65289,65288),this._mirroringShape.setValue(65308,65310),this._mirroringShape.setValue(65310,65308),this._mirroringShape.setValue(65339,65341),this._mirroringShape.setValue(65341,65339),this._mirroringShape.setValue(65371,65373),this._mirroringShape.setValue(65373,65371),this._mirroringShape.setValue(65375,65376),this._mirroringShape.setValue(65376,65375),this._mirroringShape.setValue(65378,65379),this._mirroringShape.setValue(65379,65378)},ne);function ne(){this._indexes=[],this._indexLevels=[],this._mirroringShape=new _h,this._update()}se.prototype._getVisualOrder=function(t,e){return this._type=this._getCharacterCode(t),this._textOrder=e?this.lre:this.L,this._doVisualOrder(),this._levels.slice()},se.prototype._getCharacterCode=function(t){for(var e=[],i=0;i<t.length;i++){var n=t[i].charCodeAt(0);e[i]=this._rtlCharacterTypes[n]}return e},se.prototype._setDefaultLevels=function(){for(var t=0;t<this._length;t++)this._levels[t]=this._textOrder},se.prototype._setLevels=function(){this._setDefaultLevels();for(var t=0;t<this._length;++t){var e=this._levels[t];this._levels[t]=e}},se.prototype._updateLevels=function(t,e,i){if(0==(1&e))for(var n=t;n<i;++n)this._result[n]===this.R?this._levels[n]+=1:this._result[n]!==this.L&&(this._levels[n]+=2);else for(n=t;n<i;++n)this._result[n]!==this.R&&(this._levels[n]+=1)},se.prototype._doVisualOrder=function(){this._length=this._type.length,this._result=this._type,this._levels=[],this._setLevels(),this._length=this._getEmbeddedCharactersLength();for(var t=this._textOrder,e=0;e<this._length;){for(var i=this._levels[e],n=0==(1&Math.max(t,i))?this.L:this.R,r=e+1;r<this._length&&this._levels[r]===i;)++r;var s=r<this._length?this._levels[r]:this._textOrder,s=0==(1&Math.max(s,i))?this.L:this.R;this._check(e,r,i,n,s),this._updateLevels(e,i,r),t=i,e=r}this._checkEmbeddedCharacters(this._length)},se.prototype._getEmbeddedCharactersLength=function(){for(var t=0,e=0;e<this._length;++e)this._type[e]!==this.lre&&this._type[e]!==this.rle&&this._type[e]!==this.lro&&this._type[e]!==this.rlo&&this._type[e]!==this.pdf&&this._type[e]!==this.BN&&(this._result[t]=this._result[e],this._levels[t]=this._levels[e],t++);return t},se.prototype._checkEmbeddedCharacters=function(t){for(var e=this._type.length-1;0<=e;--e)this._type[e]===this.lre||this._type[e]===this.rle||this._type[e]===this.lro||this._type[e]===this.rlo||this._type[e]===this.pdf||this._type[e]===this.BN?(this._result[e]=this._type[e],this._levels[e]=-1):(this._result[e]=this._result[--t],this._levels[e]=this._levels[t]);for(e=0;e<this._type.length;e++)-1===this._levels[e]&&(this._levels[e]=this._levels[e-1])},se.prototype._check=function(t,e,i,n,r){for(var s=n,a=t;a<e;++a)this._result[a]===this.nsm?this._result[a]=s:s=this._result[a];this._checkEuropeanDigits(t,e,i,n,r)},se.prototype._checkEuropeanDigits=function(t,e,i,n,r){for(var s=t;s<e;++s)if(this._result[s]===this.EN)for(var a=s-1;t<=a;--a)if(this._result[a]===this.L||this._result[a]===this.R||this._result[a]===this.AL){this._result[a]===this.AL&&(this._result[s]=this.AN);break}this._checkArabicCharacters(t,e,i,n,r)},se.prototype._checkArabicCharacters=function(t,e,i,n,r){for(var s=t;s<e;++s)this._result[s]===this.AL&&(this._result[s]=this.R);this._checkEuropeanNumberSeparator(t,e,i,n,r)},se.prototype._checkEuropeanNumberSeparator=function(t,e,i,n,r){for(var s,a,o=t+1;o<e-1;++o)this._result[o]!==this.ES&&this._result[o]!==this.CS||(s=this._result[o-1],a=this._result[o+1],s===this.EN&&a===this.EN?this._result[o]=this.EN:this._result[o]===this.CS&&s===this.AN&&a===this.AN&&(this._result[o]=this.AN));this._checkEuropeanNumberTerminator(t,e,i,n,r)},se.prototype._checkEuropeanNumberTerminator=function(t,e,i,n,r){for(var s,a,o=t;o<e;++o)this._result[o]===this.ET&&(s=o,(a=[]).push(this.ET),a=this._getLength(s,e,a),(s===t?n:this._result[s-1])!==this.EN&&(a===e||this._result[a]),o=a);this._checkOtherNeutrals(t,e,i,n,r)},se.prototype._checkOtherNeutrals=function(t,e,i,n,r){for(var s=t;s<e;++s)this._result[s]!==this.ES&&this._result[s]!==this.ET&&this._result[s]!==this.CS||(this._result[s]=this.ON);this._checkOtherCharacters(t,e,i,n,r)},se.prototype._checkOtherCharacters=function(t,e,i,n,r){for(var s=t;s<e;++s)if(this._result[s]===this.EN){for(var a=n,o=s-1;t<=o;--o)if(this._result[o]===this.L||this._result[o]===this.R){a=this._result[o];break}a===this.L&&(this._result[s]=this.L)}this._checkCharacters(t,e,i,n,r)},se.prototype._getLength=function(t,e,i){for(--t;++t<e;){for(var n=this._result[t],r=0;r<i.length;++r)n===i[r]&&(t=this._getLength(++t,e,i));return t}return e},se.prototype._checkCharacters=function(t,e,i,n,r){for(var s=t;s<e;++s)if(this._result[s]===this.WS||this._result[s]===this.ON||this._result[s]===this.B||this._result[s]===this.S){var a=s,o=[this.B,this.S,this.WS,this.ON],h=this._getLength(a,e,o),o=0,c=0,_=0;a===t?o=n:(o=this._result[a-1])!==this.AN&&o!==this.EN||(o=this.R),h===e?c=r:(c=this._result[h])===this.AN&&(c=this.R);for(var _=o===c?o:0==(1&i)?this.L:this.R,d=a;d<h;++d)this._result[d]=_;s=h}};var re=se;function se(){this._type=[],this._textOrder=-1,this._rtlCharacterTypes=new Array(65536),this.L=0,this.lre=1,this.lro=2,this.R=3,this.AL=4,this.rle=5,this.rlo=6,this.pdf=7,this.EN=8,this.ES=9,this.ET=10,this.AN=11,this.CS=12,this.nsm=13,this.BN=14,this.B=15,this.S=16,this.WS=17,this.ON=18,this._charTypes=[this.L,this.EN,this.BN,this.ES,this.ES,this.S,this.ET,this.ET,this.B,this.AN,this.AN,this.S,this.CS,this.CS,this.WS,this.nsm,this.nsm,this.B,this.BN,27,this.BN,28,30,this.B,31,31,this.S,32,32,this.WS,33,34,this.ON,35,37,this.ET,38,42,this.ON,43,43,this.ET,44,44,this.CS,45,45,this.ET,46,46,this.CS,47,47,this.CS,48,57,this.EN,58,58,this.CS,59,64,this.ON,65,90,this.L,91,96,this.ON,97,122,this.L,123,126,this.ON,127,132,this.BN,133,133,this.B,134,159,this.BN,160,160,this.CS,161,161,this.ON,162,165,this.ET,166,169,this.ON,170,170,this.L,171,175,this.ON,176,177,this.ET,178,179,this.EN,180,180,this.ON,181,181,this.L,182,184,this.ON,185,185,this.EN,186,186,this.L,187,191,this.ON,192,214,this.L,215,215,this.ON,216,246,this.L,247,247,this.ON,248,696,this.L,697,698,this.ON,699,705,this.L,706,719,this.ON,720,721,this.L,722,735,this.ON,736,740,this.L,741,749,this.ON,750,750,this.L,751,767,this.ON,768,855,this.nsm,856,860,this.L,861,879,this.nsm,880,883,this.L,884,885,this.ON,886,893,this.L,894,894,this.ON,895,899,this.L,900,901,this.ON,902,902,this.L,903,903,this.ON,904,1013,this.L,1014,1014,this.ON,1015,1154,this.L,1155,1158,this.nsm,1159,1159,this.L,1160,1161,this.nsm,1162,1417,this.L,1418,1418,this.ON,1419,1424,this.L,1425,1441,this.nsm,1442,1442,this.L,1443,1465,this.nsm,1466,1466,this.L,1467,1469,this.nsm,1470,1470,this.R,1471,1471,this.nsm,1472,1472,this.R,1473,1474,this.nsm,1475,1475,this.R,1476,1476,this.nsm,1477,1487,this.L,1488,1514,this.R,1515,1519,this.L,1520,1524,this.R,1525,1535,this.L,1536,1539,this.AL,1540,1547,this.L,1548,1548,this.CS,1549,1549,this.AL,1550,1551,this.ON,1552,1557,this.nsm,1558,1562,this.L,1563,1563,this.AL,1564,1566,this.L,1567,1567,this.AL,1568,1568,this.L,1569,1594,this.AL,1595,1599,this.L,1600,1610,this.AL,1611,1624,this.nsm,1625,1631,this.L,1632,1641,this.AN,1642,1642,this.ET,1643,1644,this.AN,1645,1647,this.AL,1648,1648,this.nsm,1649,1749,this.AL,1750,1756,this.nsm,1757,1757,this.AL,1758,1764,this.nsm,1765,1766,this.AL,1767,1768,this.nsm,1769,1769,this.ON,1770,1773,this.nsm,1774,1775,this.AL,1776,1785,this.EN,1786,1805,this.AL,1806,1806,this.L,1807,1807,this.BN,1808,1808,this.AL,1809,1809,this.nsm,1810,1839,this.AL,1840,1866,this.nsm,1867,1868,this.L,1869,1871,this.AL,1872,1919,this.L,1920,1957,this.AL,1958,1968,this.nsm,1969,1969,this.AL,1970,2304,this.L,2305,2306,this.nsm,2307,2363,this.L,2364,2364,this.nsm,2365,2368,this.L,2369,2376,this.nsm,2377,2380,this.L,2381,2381,this.nsm,2382,2384,this.L,2385,2388,this.nsm,2389,2401,this.L,2402,2403,this.nsm,2404,2432,this.L,2433,2433,this.nsm,2434,2491,this.L,2492,2492,this.nsm,2493,2496,this.L,2497,2500,this.nsm,2501,2508,this.L,2509,2509,this.nsm,2510,2529,this.L,2530,2531,this.nsm,2532,2545,this.L,2546,2547,this.ET,2548,2560,this.L,2561,2562,this.nsm,2563,2619,this.L,2620,2620,this.nsm,2621,2624,this.L,2625,2626,this.nsm,2627,2630,this.L,2631,2632,this.nsm,2633,2634,this.L,2635,2637,this.nsm,2638,2671,this.L,2672,2673,this.nsm,2674,2688,this.L,2689,2690,this.nsm,2691,2747,this.L,2748,2748,this.nsm,2749,2752,this.L,2753,2757,this.nsm,2758,2758,this.L,2759,2760,this.nsm,2761,2764,this.L,2765,2765,this.nsm,2766,2785,this.L,2786,2787,this.nsm,2788,2800,this.L,2801,2801,this.ET,2802,2816,this.L,2817,2817,this.nsm,2818,2875,this.L,2876,2876,this.nsm,2877,2878,this.L,2879,2879,this.nsm,2880,2880,this.L,2881,2883,this.nsm,2884,2892,this.L,2893,2893,this.nsm,2894,2901,this.L,2902,2902,this.nsm,2903,2945,this.L,2946,2946,this.nsm,2947,3007,this.L,3008,3008,this.nsm,3009,3020,this.L,3021,3021,this.nsm,3022,3058,this.L,3059,3064,this.ON,3065,3065,this.ET,3066,3066,this.ON,3067,3133,this.L,3134,3136,this.nsm,3137,3141,this.L,3142,3144,this.nsm,3145,3145,this.L,3146,3149,this.nsm,3150,3156,this.L,3157,3158,this.nsm,3159,3259,this.L,3260,3260,this.nsm,3261,3275,this.L,3276,3277,this.nsm,3278,3392,this.L,3393,3395,this.nsm,3396,3404,this.L,3405,3405,this.nsm,3406,3529,this.L,3530,3530,this.nsm,3531,3537,this.L,3538,3540,this.nsm,3541,3541,this.L,3542,3542,this.nsm,3543,3632,this.L,3633,3633,this.nsm,3634,3635,this.L,3636,3642,this.nsm,3643,3646,this.L,3647,3647,this.ET,3648,3654,this.L,3655,3662,this.nsm,3663,3760,this.L,3761,3761,this.nsm,3762,3763,this.L,3764,3769,this.nsm,3770,3770,this.L,3771,3772,this.nsm,3773,3783,this.L,3784,3789,this.nsm,3790,3863,this.L,3864,3865,this.nsm,3866,3892,this.L,3893,3893,this.nsm,3894,3894,this.L,3895,3895,this.nsm,3896,3896,this.L,3897,3897,this.nsm,3898,3901,this.ON,3902,3952,this.L,3953,3966,this.nsm,3967,3967,this.L,3968,3972,this.nsm,3973,3973,this.L,3974,3975,this.nsm,3976,3983,this.L,3984,3991,this.nsm,3992,3992,this.L,3993,4028,this.nsm,4029,4037,this.L,4038,4038,this.nsm,4039,4140,this.L,4141,4144,this.nsm,4145,4145,this.L,4146,4146,this.nsm,4147,4149,this.L,4150,4151,this.nsm,4152,4152,this.L,4153,4153,this.nsm,4154,4183,this.L,4184,4185,this.nsm,4186,5759,this.L,5760,5760,this.WS,5761,5786,this.L,5787,5788,this.ON,5789,5905,this.L,5906,5908,this.nsm,5909,5937,this.L,5938,5940,this.nsm,5941,5969,this.L,5970,5971,this.nsm,5972,6001,this.L,6002,6003,this.nsm,6004,6070,this.L,6071,6077,this.nsm,6078,6085,this.L,6086,6086,this.nsm,6087,6088,this.L,6089,6099,this.nsm,6100,6106,this.L,6107,6107,this.ET,6108,6108,this.L,6109,6109,this.nsm,6110,6127,this.L,6128,6137,this.ON,6138,6143,this.L,6144,6154,this.ON,6155,6157,this.nsm,6158,6158,this.WS,6159,6312,this.L,6313,6313,this.nsm,6314,6431,this.L,6432,6434,this.nsm,6435,6438,this.L,6439,6443,this.nsm,6444,6449,this.L,6450,6450,this.nsm,6451,6456,this.L,6457,6459,this.nsm,6460,6463,this.L,6464,6464,this.ON,6465,6467,this.L,6468,6469,this.ON,6470,6623,this.L,6624,6655,this.ON,6656,8124,this.L,8125,8125,this.ON,8126,8126,this.L,8127,8129,this.ON,8130,8140,this.L,8141,8143,this.ON,8144,8156,this.L,8157,8159,this.ON,8160,8172,this.L,8173,8175,this.ON,8176,8188,this.L,8189,8190,this.ON,8191,8191,this.L,8192,8202,this.WS,8203,8205,this.BN,8206,8206,this.L,8207,8207,this.R,8208,8231,this.ON,8232,8232,this.WS,8233,8233,this.B,8234,8234,this.lre,8235,8235,this.rle,8236,8236,this.pdf,8237,8237,this.lro,8238,8238,this.rlo,8239,8239,this.WS,8240,8244,this.ET,8245,8276,this.ON,8277,8278,this.L,8279,8279,this.ON,8280,8286,this.L,8287,8287,this.WS,8288,8291,this.BN,8292,8297,this.L,8298,8303,this.BN,8304,8304,this.EN,8305,8307,this.L,8308,8313,this.EN,8314,8315,this.ET,8316,8318,this.ON,8319,8319,this.L,8320,8329,this.EN,8330,8331,this.ET,8332,8334,this.ON,8335,8351,this.L,8352,8369,this.ET,8370,8399,this.L,8400,8426,this.nsm,8427,8447,this.L,8448,8449,this.ON,8450,8450,this.L,8451,8454,this.ON,8455,8455,this.L,8456,8457,this.ON,8458,8467,this.L,8468,8468,this.ON,8469,8469,this.L,8470,8472,this.ON,8473,8477,this.L,8478,8483,this.ON,8484,8484,this.L,8485,8485,this.ON,8486,8486,this.L,8487,8487,this.ON,8488,8488,this.L,8489,8489,this.ON,8490,8493,this.L,8494,8494,this.ET,8495,8497,this.L,8498,8498,this.ON,8499,8505,this.L,8506,8507,this.ON,8508,8511,this.L,8512,8516,this.ON,8517,8521,this.L,8522,8523,this.ON,8524,8530,this.L,8531,8543,this.ON,8544,8591,this.L,8592,8721,this.ON,8722,8723,this.ET,8724,9013,this.ON,9014,9082,this.L,9083,9108,this.ON,9109,9109,this.L,9110,9168,this.ON,9169,9215,this.L,9216,9254,this.ON,9255,9279,this.L,9280,9290,this.ON,9291,9311,this.L,9312,9371,this.EN,9372,9449,this.L,9450,9450,this.EN,9451,9751,this.ON,9752,9752,this.L,9753,9853,this.ON,9854,9855,this.L,9856,9873,this.ON,9874,9887,this.L,9888,9889,this.ON,9890,9984,this.L,9985,9988,this.ON,9989,9989,this.L,9990,9993,this.ON,9994,9995,this.L,9996,10023,this.ON,10024,10024,this.L,10025,10059,this.ON,10060,10060,this.L,10061,10061,this.ON,10062,10062,this.L,10063,10066,this.ON,10067,10069,this.L,10070,10070,this.ON,10071,10071,this.L,10072,10078,this.ON,10079,10080,this.L,10081,10132,this.ON,10133,10135,this.L,10136,10159,this.ON,10160,10160,this.L,10161,10174,this.ON,10175,10191,this.L,10192,10219,this.ON,10220,10223,this.L,10224,11021,this.ON,11022,11903,this.L,11904,11929,this.ON,11930,11930,this.L,11931,12019,this.ON,12020,12031,this.L,12032,12245,this.ON,12246,12271,this.L,12272,12283,this.ON,12284,12287,this.L,12288,12288,this.WS,12289,12292,this.ON,12293,12295,this.L,12296,12320,this.ON,12321,12329,this.L,12330,12335,this.nsm,12336,12336,this.ON,12337,12341,this.L,12342,12343,this.ON,12344,12348,this.L,12349,12351,this.ON,12352,12440,this.L,12441,12442,this.nsm,12443,12444,this.ON,12445,12447,this.L,12448,12448,this.ON,12449,12538,this.L,12539,12539,this.ON,12540,12828,this.L,12829,12830,this.ON,12831,12879,this.L,12880,12895,this.ON,12896,12923,this.L,12924,12925,this.ON,12926,12976,this.L,12977,12991,this.ON,12992,13003,this.L,13004,13007,this.ON,13008,13174,this.L,13175,13178,this.ON,13179,13277,this.L,13278,13279,this.ON,13280,13310,this.L,13311,13311,this.ON,13312,19903,this.L,19904,19967,this.ON,19968,42127,this.L,42128,42182,this.ON,42183,64284,this.L,64285,64285,this.R,64286,64286,this.nsm,64287,64296,this.R,64297,64297,this.ET,64298,64310,this.R,64311,64311,this.L,64312,64316,this.R,64317,64317,this.L,64318,64318,this.R,64319,64319,this.L,64320,64321,this.R,64322,64322,this.L,64323,64324,this.R,64325,64325,this.L,64326,64335,this.R,64336,64433,this.AL,64434,64466,this.L,64467,64829,this.AL,64830,64831,this.ON,64832,64847,this.L,64848,64911,this.AL,64912,64913,this.L,64914,64967,this.AL,64968,65007,this.L,65008,65020,this.AL,65021,65021,this.ON,65022,65023,this.L,65024,65039,this.nsm,65040,65055,this.L,65056,65059,this.nsm,65060,65071,this.L,65072,65103,this.ON,65104,65104,this.CS,65105,65105,this.ON,65106,65106,this.CS,65107,65107,this.L,65108,65108,this.ON,65109,65109,this.CS,65110,65118,this.ON,65119,65119,this.ET,65120,65121,this.ON,65122,65123,this.ET,65124,65126,this.ON,65127,65127,this.L,65128,65128,this.ON,65129,65130,this.ET,65131,65131,this.ON,65132,65135,this.L,65136,65140,this.AL,65141,65141,this.L,65142,65276,this.AL,65277,65278,this.L,65279,65279,this.BN,65280,65280,this.L,65281,65282,this.ON,65283,65285,this.ET,65286,65290,this.ON,65291,65291,this.ET,65292,65292,this.CS,65293,65293,this.ET,65294,65294,this.CS,65295,65295,this.ES,65296,65305,this.EN,65306,65306,this.CS,65307,65312,this.ON,65313,65338,this.L,65339,65344,this.ON,65345,65370,this.L,65371,65381,this.ON,65382,65503,this.L,65504,65505,this.ET,65506,65508,this.ON,65509,65510,this.ET,65511,65511,this.L,65512,65518,this.ON,65519,65528,this.L,65529,65531,this.BN,65532,65533,this.ON,65534,65535,this.L];for(var t=0;t<this._charTypes.length;++t)for(var e=this._charTypes[t],i=this._charTypes[++t],n=this._charTypes[++t];e<=i;)this._rtlCharacterTypes[e++]=n}oe.prototype._layout=function(t,e,i,n,r){var s=[];return null!=e&&null!=t&&(e._isUnicode?s=this._customLayout(t,i,r,e,n):(s=[])[0]=t),s},oe.prototype._splitLayout=function(t,e,i,n,r){var s=[];return null!=e&&null!=t&&(s=this._customSplitLayout(t,e,i,n,r)),s},oe.prototype._getGlyphIndex=function(t,e,i){if(i=[],null!=e&&null!=t){if(0===t.length)return{_result:!1,_glyphIndex:i};for(var n=(new $t)._shape(t),r=e._fontInternal._ttfReader,s=(i=[n.length],0),a=0,o=n.length;a<o;a++){var h=n[a],h=r._getGlyph(h);null!=h&&(i[s++]=h._index)}}t=new xe;return t._result=!0,t._glyphIndex=i,t},oe.prototype._customLayout=function(t,e,i,n,r){var s,a,o=this;return null==r?(s=null)!=t&&null!=i&&i.textDirection!==M.PdfTextDirection.none?(new ie)._getLogicalToVisualString(t,e):s:(a="",s=[],null!=t&&null!=n&&(null!=i&&i.textDirection!==M.PdfTextDirection.none&&(t=(new $t)._shape(t),a=this._customLayout(t,e,i)),r?s=a.split("").map(function(t){return o._addCharacter(n,t)}):(s=[])[0]=this._addCharacter(n,a)),s)},oe.prototype._addCharacter=function(t,e){var i;return null!=t&&null!=e&&(i=t._fontInternal._ttfReader,t._setSymbols(e),e=vs(xs(e=i._convertString(e)))),e},oe.prototype._customSplitLayout=function(t,e,i,n,r){var s=[];return s=null!=t?this._customLayout(t,i,r).split(""):s};var ae=oe;function oe(){this._openBracket="(",this._closeBracket=")"}he=function(t,e){return(he=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var he,t=function(t,e){function i(){this.constructor=t}he(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},ce=(Object.defineProperty(_e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"isUnderline",{get:function(){return 0<(this.style&M.PdfFontStyle.underline)},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"isStrikeout",{get:function(){return 0<(this.style&M.PdfFontStyle.strikeout)},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"_metrics",{get:function(){return this._fontMetrics},set:function(t){this._fontMetrics=t},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"isBold",{get:function(){return 0<(this.style&M.PdfFontStyle.bold)},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"isItalic",{get:function(){return 0<(this.style&M.PdfFontStyle.italic)},enumerable:!0,configurable:!0}),Object.defineProperty(_e.prototype,"height",{get:function(){return this._getHeight()},enumerable:!0,configurable:!0}),_e.prototype._setInternals=function(t){if(!t)throw new Error("ArgumentNullException:internals");this._pdfFontInternals=t},_e.prototype._getCharacterCount=function(t,e){if("string"==typeof e){for(var i=0,n=0,n=t.indexOf(e,n);-1!==n;)i++,n=t.indexOf(e,++n);return i}for(var r=0,s=0;s<t.length;s++)-1!==e.indexOf(t[s])&&r++;return r},_e.prototype._getSize=function(t){var e=this._size;if(null!=t)switch(t.subSuperScript){case M.PdfSubSuperScript.subScript:e/=this._metrics._subScriptSizeFactor;break;case M.PdfSubSuperScript.superScript:e/=this._metrics._superscriptSizeFactor}return e},_e.prototype._getHeight=function(t){var e=[];return e.push.apply(e,["cambria","candara","constantia","corbel","cariadings"]),this._getDescent(t)<0?this._getAscent(t)-this._getDescent(t)+this._getLineGap(t):this._getAscent(t)+this._getDescent(t)+this._getLineGap(t)},_e.prototype._getAscent=function(t){return.001*this._ascent*this._getSize(t)},_e.prototype._getDescent=function(t){return.001*this._descent*this._getSize(t)},_e.prototype._getLineGap=function(t){return.001*this._lineGap*this._getSize(t)},_e.prototype.measureString=function(t,e,i,n,r){var s;return"string"==typeof t&&void 0===e?this.measureString(t,null):"string"==typeof t&&(e instanceof I||null===e)&&void 0===i&&void 0===n?this.measureString(t,e,0,0):"string"==typeof t&&(e instanceof I||null===e)&&"number"==typeof i&&"number"==typeof n?this.measureString(t,0,e,i,n):"string"==typeof t&&"number"==typeof e&&(i instanceof I||null===i)&&"number"==typeof n&&"number"==typeof r?this.measureString(t,{width:e,height:0},s=i,n,r):(s=i,i=(new vt)._layout(t,this,s,[e.width,e.height]),n=t.length,r=i._empty?0:i._lines.length,i._actualSize)},_e.prototype._applyFormatSettings=function(t,e,i){var n=i;return null!=e&&0<i&&(0!==e.characterSpacing&&(n+=(t.length-1)*e.characterSpacing),0!==e.wordSpacing)&&(n+=this._getCharacterCount(t,[" ","\t"])*e.wordSpacing),n},_e);function _e(t,e){this._lineGap=0,"number"==typeof t&&void 0===e?this._size=t:(this._size=t,this._style=e)}t(le,de=ce),Object.defineProperty(le.prototype,"fontFamily",{get:function(){return this._fontFamily},enumerable:!0,configurable:!0}),le.prototype.getLineWidth=function(t,e){var i=this,n=0;return t.split("").forEach(function(t){n+=i._getCharacterWidthInternal(t)}),n*=.001*this._size,n=this._applyFormatSettings(t,e,n)},le.prototype.getFont=function(t,e){return this._document?this._document.embedFont(this._fontFamily,t,e):new le(this._fontFamily,t,e)},le.prototype._checkStyle=function(){this._fontFamily!==M.PdfFontFamily.symbol&&this._fontFamily!==M.PdfFontFamily.zapfDingbats||(this._style&=~(M.PdfFontStyle.bold|M.PdfFontStyle.italic))},le.prototype._initializeInternals=function(t){null!=t?(this._metrics=t.metrices,this._handleMetrics(),this._dictionary=t.dictionary):(this._metrics=be._getMetrics(this._fontFamily,this._style),this._handleMetrics(),this._dictionary=this._createInternals())},le.prototype._handleMetrics=function(){switch(this._fontFamily){case 0:this._handleHelveticaMetrics();break;case 1:this._handleCourierMetrics();break;case 2:this._handleTimesMetrics();break;case 3:this._handleSymbolMetrics();break;case 4:this._handleZapfDingbatsMetrics()}},le.prototype._handleHelveticaMetrics=function(){0<(this._style&M.PdfFontStyle.bold)&&0<(this._style&M.PdfFontStyle.italic)?(this._ascent=be._helveticaBoldItalicAscent,this._descent=be._helveticaBoldItalicDescent):0<(this._style&M.PdfFontStyle.bold)?(this._ascent=be._helveticaBoldAscent,this._descent=be._helveticaBoldDescent):0<(this._style&M.PdfFontStyle.italic)?(this._ascent=be._helveticaItalicAscent,this._descent=be._helveticaItalicDescent):(this._ascent=be._helveticaAscent,this._descent=be._helveticaDescent),this._height=this._ascent-this._descent},le.prototype._handleCourierMetrics=function(){0<(this._style&M.PdfFontStyle.bold)&&0<(this._style&M.PdfFontStyle.italic)?(this._ascent=be._courierBoldItalicAscent,this._descent=be._courierBoldItalicDescent):0<(this._style&M.PdfFontStyle.bold)?(this._ascent=be._courierBoldAscent,this._descent=be._courierBoldDescent):0<(this._style&M.PdfFontStyle.italic)?(this._ascent=be._courierItalicAscent,this._descent=be._courierItalicDescent):(this._ascent=be._courierAscent,this._descent=be._courierDescent),this._height=this._ascent-this._descent},le.prototype._handleTimesMetrics=function(){0<(this._style&M.PdfFontStyle.bold)&&0<(this._style&M.PdfFontStyle.italic)?(this._ascent=be._timesBoldItalicAscent,this._descent=be._timesBoldItalicDescent):0<(this._style&M.PdfFontStyle.bold)?(this._ascent=be._timesBoldAscent,this._descent=be._timesBoldDescent):0<(this._style&M.PdfFontStyle.italic)?(this._ascent=be._timesItalicAscent,this._descent=be._timesItalicDescent):(this._ascent=be._timesAscent,this._descent=be._timesDescent),this._height=this._ascent-this._descent},le.prototype._handleSymbolMetrics=function(){this._ascent=be._symbolAscent,this._descent=be._symbolDescent,this._height=this._ascent-this._descent},le.prototype._handleZapfDingbatsMetrics=function(){this._ascent=be._zapfDingbatsAscent,this._descent=be._zapfDingbatsDescent,this._height=this._ascent-this._descent},le.prototype._createInternals=function(){var t=new D;return t._updated=!0,t.set("Type",R.get("Font")),t.set("Subtype",R.get("Type1")),t.set("BaseFont",new R(this._metrics._postScriptName)),this._fontFamily!==M.PdfFontFamily.symbol&&this._fontFamily!==M.PdfFontFamily.zapfDingbats&&t.set("Encoding",new R("WinAnsiEncoding")),t},le.prototype._getCharacterWidthInternal=function(t){t=t.charCodeAt(0);return"Helvetica"!==this._metrics._name&&"Courier"!==this._metrics._name&&"TimesRoman"!==this._metrics._name&&"Symbol"!==this._metrics._name&&"ZapfDingbats"!==this._metrics._name||(t-=32),this._metrics._widthTable._itemAt(t=0<=t&&128!==t?t:0)};var de,E=le;function le(t,e,i,n){e=de.call(this,e,void 0===i?M.PdfFontStyle.regular:i)||this;return e._fontFamily=t,e._checkStyle(),e._initializeInternals(n),e}t(fe,ue=ce),Object.defineProperty(fe.prototype,"fontFamily",{get:function(){return this._fontFamily},enumerable:!0,configurable:!0}),fe.prototype.getLineWidth=function(t,e){for(var i=0,n=0;n<t.length;n++)i+=this._getCharacterWidthInternal(t.charCodeAt(n));return i*=.001*this._size,i=this._applyFormatSettings(t,e,i)},fe.prototype.getFont=function(t,e){return this._document?this._document.embedFont(this._fontFamily,t,e,!0):new fe(this._fontFamily,t,e)},fe.prototype._initializeInternals=function(t){t?(this._metrics=t.metrices,this._handleMetric(),this._dictionary=t.dictionary,this._dictionary.get("DescendantFonts")[0].set("FontDescriptor",Se._getFontDescriptor(this._fontFamily,this._style,this._metrics,this._ascent,this._descent))):(this._metrics=we._getMetrics(this._fontFamily,this._style),this._handleMetric(),this._dictionary=this._createInternals())},fe.prototype._handleMetric=function(){switch(this._fontFamily){case 0:this._ascent=857,this._descent=-125,this._height=this._ascent-this._descent;break;case 1:this._ascent=857,this._descent=-143,this._height=this._ascent-this._descent;break;default:this._ascent=880,this._descent=-120,this._height=this._ascent-this._descent}},fe.prototype._createInternals=function(){var t=new D;return t._updated=!0,t.set("Type",R.get("Font")),t.set("Subtype",R.get("Type0")),t.set("BaseFont",new R(this._metrics._postScriptName)),t.set("Encoding",this._getEncoding(this._fontFamily)),t.set("DescendantFonts",this._getDescendantFont()),t},fe.prototype._getEncoding=function(t){var e="Unknown";switch(t){case M.PdfCjkFontFamily.hanyangSystemsGothicMedium:case M.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:e="UniKS-UCS2-H";break;case M.PdfCjkFontFamily.heiseiKakuGothicW5:case M.PdfCjkFontFamily.heiseiMinchoW3:e="UniJIS-UCS2-H";break;case M.PdfCjkFontFamily.monotypeHeiMedium:case M.PdfCjkFontFamily.monotypeSungLight:e="UniCNS-UCS2-H";break;case M.PdfCjkFontFamily.sinoTypeSongLight:e="UniGB-UCS2-H"}return new R(e)},fe.prototype._getDescendantFont=function(){var t=new D;return t._updated=!0,t.set("Type",R.get("Font")),t.set("Subtype",R.get("CIDFontType2")),t.set("BaseFont",new R(this._metrics._postScriptName)),t.set("DW",this._metrics._widthTable._defaultWidth),t.set("W",this._metrics._widthTable._toArray()),t.set("FontDescriptor",Se._getFontDescriptor(this._fontFamily,this._style,this._metrics,this._ascent,this._descent)),t.set("CIDSystemInfo",this._getSystemInformation()),[t]},fe.prototype._getSystemInformation=function(){var t=new D;switch(t._updated=!0,t.set("Registry","Adobe"),this._fontFamily){case M.PdfCjkFontFamily.hanyangSystemsGothicMedium:case M.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:t.set("Ordering","Korea1"),t.set("Supplement",1);break;case M.PdfCjkFontFamily.heiseiKakuGothicW5:case M.PdfCjkFontFamily.heiseiMinchoW3:t.set("Ordering","Japan1"),t.set("Supplement",2);break;case M.PdfCjkFontFamily.monotypeHeiMedium:case M.PdfCjkFontFamily.monotypeSungLight:t.set("Ordering","CNS1"),t.set("Supplement","0");break;case M.PdfCjkFontFamily.sinoTypeSongLight:t.set("Ordering","GB1"),t.set("Supplement",2)}return t},fe.prototype._getCharacterWidthInternal=function(t){return this._metrics._widthTable._itemAt(t=0<=t?t:0)};var ue,pe=fe;function fe(t,e,i,n){i=ue.call(this,e,void 0===i?M.PdfFontStyle.regular:i)||this;return i._fontFamily=t,i._size=e,null!=n?i._initializeInternals(n):i._initializeInternals(),i}t(me,ge=ce),Object.defineProperty(me.prototype,"isUnicode",{get:function(){return this._isUnicode},enumerable:!0,configurable:!0}),Object.defineProperty(me.prototype,"isEmbed",{get:function(){return this._isEmbedFont},enumerable:!0,configurable:!0}),me.prototype.getLineWidth=function(t,e){var i=0;if(null!=e&&e.textDirection!==M.PdfTextDirection.none)i=this._getUnicodeLineWidth(t,i);else for(var n=0,r=t.length;n<r;n++)i+=this._getCharacterWidthInternal(t[n]);return isNaN(i)&&(i=0),i*=.001*this._size,i=this._applyFormatSettings(t,e,i)},me.prototype.getFont=function(t,e){var i,n;return this._document?(n=i=!1,e&&(e&M.PdfFontStyle.underline&&(i=!0),e&M.PdfFontStyle.strikeout)&&(n=!0),this._document.embedFont(this._fontInternal._fontData,t,{shouldStrikeout:i,shouldUnderline:n})):new me(this._fontInternal._fontData,t,e)},me.prototype._createFontInternal=function(t,e,i){this.style=e,null!=i?(this._fontInternal=i.fontInternal,this._fontInternal._fontSize=this._size,this._metrics=i.metrices,this._handleMetrics(),this._setInternals(i.dictionary)):(this._fontInternal=new Qt(t,this._size),this._initializeInternals())},me.prototype._initializeInternals=function(){var t;this._fontInternal instanceof Qt&&(this._fontInternal._isEmbed=this._isEmbedFont),this._fontInternal._createInternals(),this._handleMetrics(),t=this._fontInternal._getInternals(),this._metrics=this._fontInternal._metrics,this._metrics._isUnicodeFont=!0,this._setInternals(t)},me.prototype._handleMetrics=function(){var t=this._fontInternal._ttfMetrics;this._ascent=t._macAscent,this._descent=t._macDescent,this._height=t._macAscent-t._macDescent+t._lineGap,this._lineGap=t._lineGap},me.prototype._getUnicodeLineWidth=function(t,e){e=0;var i,n=[],t=(new ae)._getGlyphIndex(t,this,n),r=t._result,n=t._glyphIndex;return r&&null!==n&&(i=this._fontInternal._ttfReader,n.forEach(function(t){null!=t&&null!=(t=i._getGlyph(t))&&(e+=t._width)})),e},me.prototype._getCharacterWidth=function(t,e){t=this._fontInternal._getCharacterWidth(t);return t*=.001*this._getSize(e)},me.prototype._setSymbols=function(t){var e=this._fontInternal;null!=e&&e._setSymbols(t)},me.prototype._getCharacterWidthInternal=function(t){t=t.charCodeAt(0);return this._metrics._widthTable._itemAt(0<=t&&128!==t?t:0)};var ge,ye=me;function me(t,e,i,n){e=ge.call(this,e,void 0===i?M.PdfFontStyle.regular:i)||this;return e._isEmbedFont=!1,e._isUnicode=!0,void 0!==i?e._createFontInternal(t,i,n):e._createFontInternal(t,M.PdfFontStyle.regular,n),e}r._getMetrics=function(t,e){var i=null;switch(t){case M.PdfFontFamily.helvetica:(i=this._getHelveticaMetrics(e))._name="Helvetica";break;case M.PdfFontFamily.courier:(i=this._getCourierMetrics(e))._name="Courier";break;case M.PdfFontFamily.timesRoman:(i=this._getTimesMetrics(e))._name="TimesRoman";break;case M.PdfFontFamily.symbol:(i=this._getSymbolMetrics())._name="Symbol";break;case M.PdfFontFamily.zapfDingbats:(i=this._getZapfDingbatsMetrics())._name="ZapfDingbats";break;default:(i=this._getHelveticaMetrics(e))._name="Helvetica"}return i._subScriptSizeFactor=r._subSuperScriptFactor,i._superscriptSizeFactor=r._subSuperScriptFactor,i},r._getHelveticaMetrics=function(t){var e=new ht;return 0<(t&M.PdfFontStyle.bold)&&0<(t&M.PdfFontStyle.italic)?(e._postScriptName=this._helveticaBoldItalicName,e._widthTable=new ct(this._arialBoldWidth)):0<(t&M.PdfFontStyle.bold)?(e._postScriptName=this._helveticaBoldName,e._widthTable=new ct(this._arialBoldWidth)):(0<(t&M.PdfFontStyle.italic)?e._postScriptName=this._helveticaItalicName:e._postScriptName=this._helveticaName,e._widthTable=new ct(this._arialWidth)),e},r._getCourierMetrics=function(t){var e=new ht;return 0<(t&M.PdfFontStyle.bold)&&0<(t&M.PdfFontStyle.italic)?e._postScriptName=this._courierBoldItalicName:0<(t&M.PdfFontStyle.bold)?e._postScriptName=this._courierBoldName:0<(t&M.PdfFontStyle.italic)?e._postScriptName=this._courierItalicName:e._postScriptName=this._courierName,e._widthTable=new ct(this._fixedWidth),e},r._getTimesMetrics=function(t){var e=new ht;return 0<(t&M.PdfFontStyle.bold)&&0<(t&M.PdfFontStyle.italic)?(e._postScriptName=this._timesBoldItalicName,e._widthTable=new ct(this._timesRomanBoldItalicWidths)):0<(t&M.PdfFontStyle.bold)?(e._postScriptName=this._timesBoldName,e._widthTable=new ct(this._timesRomanBoldWidth)):0<(t&M.PdfFontStyle.italic)?(e._postScriptName=this._timesItalicName,e._widthTable=new ct(this._timesRomanItalicWidth)):(e._postScriptName=this._timesName,e._widthTable=new ct(this._timesRomanWidth)),e},r._getSymbolMetrics=function(){var t=new ht;return t._postScriptName=this._symbolName,t._widthTable=new ct(this._symbolWidth),t},r._getZapfDingbatsMetrics=function(){var t=new ht;return t._postScriptName=this._zapfDingbatsName,t._widthTable=new ct(this._zapfDingbatsWidth),t},r._subSuperScriptFactor=1.52,r._helveticaAscent=931,r._helveticaDescent=-225,r._helveticaName="Helvetica",r._helveticaBoldAscent=962,r._helveticaBoldDescent=-228,r._helveticaBoldName="Helvetica-Bold",r._helveticaItalicAscent=931,r._helveticaItalicDescent=-225,r._helveticaItalicName="Helvetica-Oblique",r._helveticaBoldItalicAscent=962,r._helveticaBoldItalicDescent=-228,r._helveticaBoldItalicName="Helvetica-BoldOblique",r._courierAscent=805,r._courierDescent=-250,r._courierName="Courier",r._courierBoldAscent=801,r._courierBoldDescent=-250,r._courierBoldName="Courier-Bold",r._courierItalicAscent=805,r._courierItalicDescent=-250,r._courierItalicName="Courier-Oblique",r._courierBoldItalicAscent=801,r._courierBoldItalicDescent=-250,r._courierBoldItalicName="Courier-BoldOblique",r._timesAscent=898,r._timesDescent=-218,r._timesName="Times-Roman",r._timesBoldAscent=935,r._timesBoldDescent=-218,r._timesBoldName="Times-Bold",r._timesItalicAscent=883,r._timesItalicDescent=-217,r._timesItalicName="Times-Italic",r._timesBoldItalicAscent=921,r._timesBoldItalicDescent=-218,r._timesBoldItalicName="Times-BoldItalic",r._symbolAscent=1010,r._symbolDescent=-293,r._symbolName="Symbol",r._zapfDingbatsAscent=820,r._zapfDingbatsDescent=-143,r._zapfDingbatsName="ZapfDingbats",r._arialWidth=[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584,0,556,0,222,556,333,1e3,556,556,333,1e3,667,333,1e3,0,611,0,0,222,222,333,333,350,556,1e3,333,1e3,500,333,944,0,500,667,0,333,556,556,556,556,260,556,333,737,370,556,584,0,737,333,400,584,333,333,333,556,537,278,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,584,611,556,556,556,556,500,556,500],r._arialBoldWidth=[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,975,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584,0,556,0,278,556,500,1e3,556,556,333,1e3,667,333,1e3,0,611,0,0,278,278,500,500,350,556,1e3,333,1e3,556,333,944,0,500,667,0,333,556,556,556,556,280,556,333,737,370,556,584,0,737,333,400,584,333,333,333,611,556,278,333,333,365,556,834,834,834,611,722,722,722,722,722,722,1e3,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,556,556,556,556,556,278,278,278,278,611,611,611,611,611,611,611,584,611,611,611,611,611,556,611,556],r._fixedWidth=[600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600],r._timesRomanWidth=[250,333,408,500,500,833,778,180,333,333,500,564,250,333,250,278,500,500,500,500,500,500,500,500,500,500,278,278,564,564,564,444,921,722,667,667,722,611,556,722,722,333,389,722,611,889,722,722,556,722,667,556,611,722,722,944,722,722,611,333,278,333,469,500,333,444,500,444,500,444,333,500,500,278,278,500,278,778,500,500,500,500,333,389,278,500,500,722,500,500,444,480,200,480,541,0,500,0,333,500,444,1e3,500,500,333,1e3,556,333,889,0,611,0,0,333,333,444,444,350,500,1e3,333,980,389,333,722,0,444,722,0,333,500,500,500,500,200,500,333,760,276,500,564,0,760,333,400,564,300,300,333,500,453,250,333,300,310,500,750,750,750,444,722,722,722,722,722,722,889,667,611,611,611,611,333,333,333,333,722,722,722,722,722,722,722,564,722,722,722,722,722,722,556,500,444,444,444,444,444,444,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,564,500,500,500,500,500,500,500,500],r._timesRomanBoldWidth=[250,333,555,500,500,1e3,833,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,930,722,667,722,722,667,611,778,778,389,500,778,667,944,722,778,611,778,722,556,667,722,722,1e3,722,722,667,333,278,333,581,500,333,500,556,444,556,444,333,500,556,278,333,556,278,833,556,500,556,556,444,389,333,556,500,722,500,500,444,394,220,394,520,0,500,0,333,500,500,1e3,500,500,333,1e3,556,333,1e3,0,667,0,0,333,333,500,500,350,500,1e3,333,1e3,389,333,722,0,444,722,0,333,500,500,500,500,220,500,333,747,300,500,570,0,747,333,400,570,300,300,333,556,540,250,333,300,330,500,750,750,750,500,722,722,722,722,722,722,1e3,722,667,667,667,667,389,389,389,389,722,722,778,778,778,778,778,570,778,722,722,722,722,722,611,556,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,500,556,500],r._timesRomanItalicWidth=[250,333,420,500,500,833,778,214,333,333,500,675,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,675,675,675,500,920,611,611,667,722,611,611,722,722,333,444,667,556,833,667,722,611,722,611,500,556,722,611,833,611,556,556,389,278,389,422,500,333,500,500,444,500,444,278,500,500,278,278,444,278,722,500,500,500,500,389,389,278,500,444,667,444,444,389,400,275,400,541,0,500,0,333,500,556,889,500,500,333,1e3,500,333,944,0,556,0,0,333,333,556,556,350,500,889,333,980,389,333,667,0,389,556,0,389,500,500,500,500,275,500,333,760,276,500,675,0,760,333,400,675,300,300,333,500,523,250,333,300,310,500,750,750,750,500,611,611,611,611,611,611,889,667,611,611,611,611,333,333,333,333,722,667,722,722,722,722,722,675,722,722,722,722,722,556,611,500,500,500,500,500,500,500,667,444,444,444,444,444,278,278,278,278,500,500,500,500,500,500,500,675,500,500,500,500,500,444,500,444],r._timesRomanBoldItalicWidths=[250,389,555,500,500,833,778,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,832,667,667,667,722,667,667,722,778,389,500,667,611,889,722,722,611,722,667,556,611,722,667,889,667,611,611,333,278,333,570,500,333,500,500,444,500,444,333,500,556,278,278,500,278,778,556,500,500,500,389,389,278,556,444,667,500,444,389,348,220,348,570,0,500,0,333,500,500,1e3,500,500,333,1e3,556,333,944,0,611,0,0,333,333,500,500,350,500,1e3,333,1e3,389,333,722,0,389,611,0,389,500,500,500,500,220,500,333,747,266,500,606,0,747,333,400,570,300,300,333,576,500,250,333,300,300,500,750,750,750,500,667,667,667,667,667,667,944,667,667,667,667,667,389,389,389,389,722,722,722,722,722,722,722,570,722,722,722,722,722,611,611,500,500,500,500,500,500,500,722,444,444,444,444,444,278,278,278,278,500,556,500,500,500,500,500,570,500,556,556,556,556,444,500,444],r._symbolWidth=[250,333,713,500,549,833,778,439,333,333,500,549,250,549,250,278,500,500,500,500,500,500,500,500,500,500,278,278,549,549,549,444,549,722,667,722,612,611,763,603,722,333,631,722,686,889,722,722,768,741,556,592,611,690,439,768,645,795,611,333,863,333,658,500,500,631,549,549,494,439,521,411,603,329,603,549,549,576,521,549,549,521,549,603,439,576,713,686,493,686,494,480,200,480,549,750,620,247,549,167,713,500,753,753,753,753,1042,987,603,987,603,400,549,411,549,549,713,494,460,549,549,549,549,1e3,603,1e3,658,823,686,795,987,768,768,823,768,768,713,713,713,713,713,713,713,768,713,790,790,890,823,549,250,713,603,603,1042,987,603,987,603,494,329,790,790,786,713,384,384,384,384,384,384,494,494,494,494,329,274,686,686,686,384,384,384,384,384,384,494,494,494,-1],r._zapfDingbatsWidth=[278,974,961,974,980,719,789,790,791,690,960,939,549,855,911,933,911,945,974,755,846,762,761,571,677,763,760,759,754,494,552,537,577,692,786,788,788,790,793,794,816,823,789,841,823,833,816,831,923,744,723,749,790,792,695,776,768,792,759,707,708,682,701,826,815,789,789,707,687,696,689,786,787,713,791,785,791,873,761,762,762,759,759,892,892,788,784,438,138,277,415,392,392,668,668,390,390,317,317,276,276,509,509,410,410,234,234,334,334,732,544,544,910,667,760,760,776,595,694,626,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,894,838,1016,458,748,924,748,918,927,928,928,834,873,828,924,924,917,930,931,463,883,836,836,867,867,696,696,874,874,760,946,771,865,771,888,967,888,831,873,927,970,918];var be=r;function r(){}ve._getHanyangSystemsGothicMedium=function(t){var e=new ht,i=new lt(1e3);return i._add(new gt(1,127,500)),i._add(new gt(8094,8190,500)),e._widthTable=i,0!=(t&M.PdfFontStyle.bold)&&0!=(t&M.PdfFontStyle.italic)?e._postScriptName="HYGoThic-Medium,BoldItalic":0!=(t&M.PdfFontStyle.bold)?e._postScriptName="HYGoThic-Medium,Bold":0!=(t&M.PdfFontStyle.italic)?e._postScriptName="HYGoThic-Medium,Italic":e._postScriptName="HYGoThic-Medium",e},ve._getHanyangSystemsShinMyeongJoMedium=function(t){var e=new ht,i=new lt(1e3);return i._add(new gt(1,95,500)),i._add(new gt(8094,8190,500)),e._widthTable=i,0!=(t&M.PdfFontStyle.bold)&&0!=(t&M.PdfFontStyle.italic)?e._postScriptName="HYSMyeongJo-Medium,BoldItalic":0!=(t&M.PdfFontStyle.bold)?e._postScriptName="HYSMyeongJo-Medium,Bold":0!=(t&M.PdfFontStyle.italic)?e._postScriptName="HYSMyeongJo-Medium,Italic":e._postScriptName="HYSMyeongJo-Medium",e},ve._getHeiseiKakuGothicW5=function(t){var e=new ht,i=new lt(1e3);return i._add(new gt(1,95,500)),i._add(new gt(231,632,500)),e._widthTable=i,0!=(t&M.PdfFontStyle.bold)&&0!=(t&M.PdfFontStyle.italic)?e._postScriptName="HeiseiKakuGo-W5,BoldItalic":0!=(t&M.PdfFontStyle.bold)?e._postScriptName="HeiseiKakuGo-W5,Bold":0!=(t&M.PdfFontStyle.italic)?e._postScriptName="HeiseiKakuGo-W5,Italic":e._postScriptName="HeiseiKakuGo-W5",e},ve._getHeiseiMinchoW3=function(t){var e=new ht,i=new lt(1e3);return i._add(new gt(1,95,500)),i._add(new gt(231,632,500)),e._widthTable=i,0!=(t&M.PdfFontStyle.bold)&&0!=(t&M.PdfFontStyle.italic)?e._postScriptName="HeiseiMin-W3,BoldItalic":0!=(t&M.PdfFontStyle.bold)?e._postScriptName="HeiseiMin-W3,Bold":0!=(t&M.PdfFontStyle.italic)?e._postScriptName="HeiseiMin-W3,Italic":e._postScriptName="HeiseiMin-W3",e},ve._getMonotypeHeiMedium=function(t){var e=new ht,i=new lt(1e3);return i._add(new gt(1,95,500)),i._add(new gt(13648,13742,500)),e._widthTable=i,0!=(t&M.PdfFontStyle.bold)&&0!=(t&M.PdfFontStyle.italic)?e._postScriptName="MHei-Medium,BoldItalic":0!=(t&M.PdfFontStyle.bold)?e._postScriptName="MHei-Medium,Bold":0!=(t&M.PdfFontStyle.italic)?e._postScriptName="MHei-Medium,Italic":e._postScriptName="MHei-Medium",e},ve._getMonotypeSungLight=function(t){var e=new ht,i=new lt(1e3);return i._add(new gt(1,95,500)),i._add(new gt(13648,13742,500)),e._widthTable=i,0!=(t&M.PdfFontStyle.bold)&&0!=(t&M.PdfFontStyle.italic)?e._postScriptName="MSung-Light,BoldItalic":0!=(t&M.PdfFontStyle.bold)?e._postScriptName="MSung-Light,Bold":0!=(t&M.PdfFontStyle.italic)?e._postScriptName="MSung-Light,Italic":e._postScriptName="MSung-Light",e},ve._getSinoTypeSongLight=function(t){var e=new ht,i=new lt(1e3);return i._add(new gt(1,95,500)),i._add(new gt(814,939,500)),i._add(new bt(7712,[500])),i._add(new bt(7716,[500])),0!=(t&M.PdfFontStyle.bold)&&0!=(t&M.PdfFontStyle.italic)?e._postScriptName="STSong-Light,BoldItalic":0!=(t&M.PdfFontStyle.bold)?e._postScriptName="STSong-Light,Bold":0!=(t&M.PdfFontStyle.italic)?e._postScriptName="STSong-Light,Italic":e._postScriptName="STSong-Light",e._widthTable=i,e},ve._getMetrics=function(t,e){var i;switch(t){case M.PdfCjkFontFamily.hanyangSystemsGothicMedium:(i=this._getHanyangSystemsGothicMedium(e))._name="HanyangSystemsGothicMedium";break;case M.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:(i=this._getHanyangSystemsShinMyeongJoMedium(e))._name="HanyangSystemsShinMyeongJoMedium";break;case M.PdfCjkFontFamily.heiseiKakuGothicW5:(i=this._getHeiseiKakuGothicW5(e))._name="HeiseiKakuGothicW5";break;case M.PdfCjkFontFamily.heiseiMinchoW3:(i=this._getHeiseiMinchoW3(e))._name="HeiseiMinchoW3";break;case M.PdfCjkFontFamily.monotypeHeiMedium:(i=this._getMonotypeHeiMedium(e))._name="MonotypeHeiMedium";break;case M.PdfCjkFontFamily.monotypeSungLight:(i=this._getMonotypeSungLight(e))._name="MonotypeSungLight";break;case M.PdfCjkFontFamily.sinoTypeSongLight:(i=this._getSinoTypeSongLight(e))._name="SinoTypeSongLight"}return i._subScriptSizeFactor=this._subSuperScriptFactor,i._superscriptSizeFactor=this._subSuperScriptFactor,i},ve._subSuperScriptFactor=1.52;var we=ve;function ve(){}Pe._fillMonotypeSungLight=function(t,e,i,n,r){this._fillFontBox(t,{x:-160,y:-249,width:1175,height:1137}),this._fillKnownInformation(t,e,i,n,r),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},Pe._fillHeiseiKakuGothicW5=function(t,e,i,n,r,s){(e&(M.PdfFontStyle.italic|M.PdfFontStyle.bold))!==M.PdfFontStyle.italic?this._fillFontBox(t,{x:-92,y:-250,width:1102,height:1172}):this._fillFontBox(t,{x:-92,y:-250,width:1102,height:1932}),this._fillKnownInformation(t,i,n,r,s),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",689),t.set("MaxWidth",1e3),t.set("CapHeight",718),t.set("XHeight",500),t.set("Leading",250)},Pe._fillHanyangSystemsShinMyeongJoMedium=function(t,e,i,n,r){this._fillFontBox(t,{x:0,y:-148,width:1001,height:1028}),this._fillKnownInformation(t,e,i,n,r),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},Pe._fillHeiseiMinchoW3=function(t,e,i,n,r){this._fillFontBox(t,{x:-123,y:-257,width:1124,height:1167}),this._fillKnownInformation(t,e,i,n,r),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",702),t.set("MaxWidth",1e3),t.set("CapHeight",718),t.set("XHeight",500),t.set("Leading",250)},Pe._fillSinoTypeSongLight=function(t,e,i,n,r){this._fillFontBox(t,{x:-25,y:-254,width:1025,height:1134}),this._fillKnownInformation(t,e,i,n,r),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},Pe._fillMonotypeHeiMedium=function(t,e,i,n,r){this._fillFontBox(t,{x:-45,y:-250,width:1060,height:1137}),this._fillKnownInformation(t,e,i,n,r),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},Pe._fillHanyangSystemsGothicMedium=function(t,e,i,n,r){this._fillFontBox(t,{x:-6,y:-145,width:1009,height:1025}),this._fillKnownInformation(t,e,i,n,r),t.set("Flags",4),t.set("StemV",93),t.set("StemH",93),t.set("AvgWidth",1e3),t.set("MaxWidth",1e3),t.set("CapHeight",880),t.set("XHeight",616),t.set("Leading",250)},Pe._fillFontBox=function(t,e){t.set("FontBBox",Ms(e))},Pe._fillKnownInformation=function(t,e,i,n,r){switch(t.set("FontName",R.get(i._postScriptName)),t.set("Type",R.get("FontDescriptor")),t.set("ItalicAngle",0),t.set("MissingWidth",i._widthTable._defaultWidth),t.set("Ascent",n),t.set("Descent",r),e){case M.PdfCjkFontFamily.monotypeHeiMedium:case M.PdfCjkFontFamily.hanyangSystemsGothicMedium:case M.PdfCjkFontFamily.heiseiKakuGothicW5:t.set("Flags",4);break;case M.PdfCjkFontFamily.sinoTypeSongLight:case M.PdfCjkFontFamily.monotypeSungLight:case M.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:case M.PdfCjkFontFamily.heiseiMinchoW3:t.set("Flags",6)}},Pe._getFontDescriptor=function(t,e,i,n,r){var s=new D;switch(s._updated=!0,t){case M.PdfCjkFontFamily.hanyangSystemsGothicMedium:this._fillHanyangSystemsGothicMedium(s,t,i,n,r);break;case M.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:this._fillHanyangSystemsShinMyeongJoMedium(s,t,i,n,r);break;case M.PdfCjkFontFamily.heiseiKakuGothicW5:this._fillHeiseiKakuGothicW5(s,e,t,i,n,r);break;case M.PdfCjkFontFamily.heiseiMinchoW3:this._fillHeiseiMinchoW3(s,t,i,n,r);break;case M.PdfCjkFontFamily.monotypeHeiMedium:this._fillMonotypeHeiMedium(s,t,i,n,r);break;case M.PdfCjkFontFamily.monotypeSungLight:this._fillMonotypeSungLight(s,t,i,n,r);break;case M.PdfCjkFontFamily.sinoTypeSongLight:this._fillSinoTypeSongLight(s,t,i,n,r)}return s};var Se=Pe;function Pe(){}(t=M.PdfFontStyle||(M.PdfFontStyle={}))[t.regular=0]="regular",t[t.bold=1]="bold",t[t.italic=2]="italic",t[t.underline=4]="underline",t[t.strikeout=8]="strikeout",(t=M.PdfFontFamily||(M.PdfFontFamily={}))[t.helvetica=0]="helvetica",t[t.courier=1]="courier",t[t.timesRoman=2]="timesRoman",t[t.symbol=3]="symbol",t[t.zapfDingbats=4]="zapfDingbats",(t=M.PdfCjkFontFamily||(M.PdfCjkFontFamily={}))[t.heiseiKakuGothicW5=0]="heiseiKakuGothicW5",t[t.heiseiMinchoW3=1]="heiseiMinchoW3",t[t.hanyangSystemsGothicMedium=2]="hanyangSystemsGothicMedium",t[t.hanyangSystemsShinMyeongJoMedium=3]="hanyangSystemsShinMyeongJoMedium",t[t.monotypeHeiMedium=4]="monotypeHeiMedium",t[t.monotypeSungLight=5]="monotypeSungLight",t[t.sinoTypeSongLight=6]="sinoTypeSongLight";var xe=function(){this._result=!1,this._glyphIndex=[]},Ae=(Object.defineProperty(Te.prototype,"normal",{get:function(){return!this._templateNormal&&this._dictionary&&this._dictionary.has("AP")&&(this._templateNormal=this._dictionary.get("N")),this._templateNormal},set:function(t){t&&(this._templateNormal=t,this._isNormalKey)&&this._dictionary.set("N",this._templateNormal)},enumerable:!0,configurable:!0}),Te.prototype._initialize=function(){this.normal=new P(this._bounds,this._crossReference)},Te);function Te(t,e){this._isNormalKey=!0,this._dictionary=new D,k(t)?this._bounds=t:this._bounds={x:0,y:0,width:0,height:0},e instanceof bi?(this._annotations=e,this._crossReference=e._crossReference):this._isNormalKey=!1,this._initialize()}Object.defineProperty(Ce.prototype,"lastPoint",{get:function(){var t={x:0,y:0},e=this._points.length;return 0<this._points.length&&(t.x=this._points[e-1].x,t.y=this._points[e-1].y),t},enumerable:!0,configurable:!0}),Object.defineProperty(Ce.prototype,"pathPoints",{get:function(){return this._points},enumerable:!0,configurable:!0}),Object.defineProperty(Ce.prototype,"pathTypes",{get:function(){return this._pathTypes},enumerable:!0,configurable:!0}),Object.defineProperty(Ce.prototype,"fillMode",{get:function(){return this._fillMode},set:function(t){this._fillMode=t},enumerable:!0,configurable:!0}),Ce.prototype.addPath=function(t,e){t instanceof Ce?this._addPath(t._points,t._pathTypes):Array.isArray(t)&&Array.isArray(e)&&this._addPath(t,e)},Ce.prototype._addPath=function(t,e){if(!t||0===t.length)throw new Error("Path points cannot be null or undefined.");if(!e||0===e.length)throw new Error("Path types cannot be null or undefined.");if(t.length!==e.length)throw new Error("The argument arrays should be of equal length.");for(var i=0;i<t.length;i++){if(i>=t.length||i<0)throw new Error("Index"+i+"is out of bounds.");var n=t[i];Array.isArray(n)?this._points.push({x:n[0],y:n[1]}):this._points.push(n),this._pathTypes.push(e[i])}},Ce.prototype.addLine=function(t,e){this._addPoints([t.x,t.y,e.x,e.y],M.PathPointType.line)},Ce.prototype._addLines=function(t){var e=t[0];if(1===t.length)this._addPoint(e,M.PathPointType.line);else for(var i=1;i<t.length;i++){var n=t[i];this.addLine(e,n),e=n}},Ce.prototype._addPoints=function(t,e,i,n){for(var r=void 0!==i?i:0,s=void 0!==n?n:t.length,a=r;a<s;a+=2){var o={x:t[a],y:t[a+1]};a===r?0===this._points.length||this._isStart?(this._addPoint(o,M.PathPointType.start),this._isStart=!1):(this._isRoundedRectangle&&(o.x!==this.lastPoint.x||o.y!==this.lastPoint.y)||o.x!==this.lastPoint.x&&o.y!==this.lastPoint.y)&&this._addPoint(o,M.PathPointType.line):this._addPoint(o,e)}},Ce.prototype._addPoint=function(t,e){this._points.push(t),this._pathTypes.push(e)},Ce.prototype.addArc=function(t,e,i){for(var n=oa(t.x,t.y,t.x+t.width,t.y+t.height,e,i),r=0;r<n.length;++r){var s=[n[r],n[++r],n[++r],n[++r],n[++r],n[++r],n[++r],n[++r]];this._addPoints(s,M.PathPointType.bezier)}},Ce.prototype.addRectangle=function(t){this.startFigure(),this._addPoints([t.x,t.y,t.x+t.width,t.y,t.x+t.width,t.y+t.height,t.x,t.y+t.height],M.PathPointType.line),this.closeFigure()},Ce.prototype.addPolygon=function(t){for(var e=[],i=0;i<t.length;i++){var n=t[i];e.push(n.x,n.y)}this.startFigure(),this._addPoints(e,M.PathPointType.line),this.closeFigure()},Ce.prototype.addEllipse=function(t){this.startFigure(),this.addArc(t,0,360),this.closeFigure()},Ce.prototype.addBezier=function(t,e,i,n){t=[t.x,t.y,e.x,e.y,i.x,i.y,n.x,n.y];this._addPoints(t,M.PathPointType.bezier)},Ce.prototype._addBezierPoints=function(t){if(t.length<4)throw Error("Incorrect size of array points");var e=0,i=t[e];for(e++;e+3<=t.length;){var n=t[e],r=t[++e],s=t[++e];e++,this.addBezier({x:i[0],y:i[1]},{x:n[0],y:n[1]},{x:r[0],y:r[1]},{x:s[0],y:s[1]}),i=s}},Ce.prototype.addPie=function(t,e,i){this.startFigure(),this.addArc(t,e,i),this._addPoint({x:t.x+t.width/2,y:t.y+t.height/2},M.PathPointType.line),this.closeFigure()},Ce.prototype.startFigure=function(){this._isStart=!0},Ce.prototype.closeFigure=function(t){var e;void 0!==t?(e=this._pathTypes[t],e|=M.PathPointType.closePath,this._pathTypes[t]=e):(0<this._points.length&&this.closeFigure(this._points.length-1),this.startFigure())},Ce.prototype.closeAllFigures=function(){for(var t=0;t<this._points.length;++t){var e=this._pathTypes[t],i=!1;0!==t&&e===M.PathPointType.start?(this.closeFigure(t-1),i=!0):t===this._pathTypes.length-1&&!i&&this._isXps&&this._points[0].x===this._points[t].x&&this._points[0].y===this._points[t].y&&this.closeFigure(t)}},Ce.prototype._getBounds=function(){var t=[0,0,0,0];if(0<this._points.length){for(var e=this._points[0].x,i=this._points[0].x,n=this._points[0].y,r=this._points[0].y,s=1;s<this._points.length;s++)var a=this._points[s],e=Math.min(a.x,e),i=Math.max(a.x,i),n=Math.min(a.y,n),r=Math.max(a.y,r);t=[e,n,i-e,r-n]}return t};var C=Ce;function Ce(t,e){if(this._points=[],this._pathTypes=[],this._isRoundedRectangle=!1,this._fillMode=M.PdfFillMode.winding,this._isStart=!0,this._isXps=!1,this._brush=void 0,this._pen=void 0,t&&e){if(!Array.isArray(t)||!Array.isArray(e))throw new Error("Invalid constructor arguments.");this._points=t,this._pathTypes=e}else this._points=[],this._pathTypes=[]}ke=function(t,e){return(ke=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var ke,t=function(t,e){function i(){this.constructor=t}ke(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},Re=(Fe.prototype._initialize=function(){this._dictionary=new D,this._dictionary.update("Type",new R("Action"))},Object.defineProperty(Fe.prototype,"next",{get:function(){return this._next},set:function(t){this._next=t;var e=this._page._crossReference._getNextReference();this._page._crossReference._cacheMap.set(e,t._dictionary),t._dictionary.objId=e.toString(),this._dictionary.update("Next",e)},enumerable:!0,configurable:!0}),Fe);function Fe(){}t(Be,Ie=Re),Object.defineProperty(Be.prototype,"script",{get:function(){return this._script},set:function(t){this._script=t},enumerable:!0,configurable:!0});var Ie,De=Be;function Be(t){var e=Ie.call(this)||this;return e._initialize(),e._script=t,e._dictionary.update("S",new R("JavaScript")),e}t(Me,Le=Re),Object.defineProperty(Me.prototype,"destination",{get:function(){return this._destination},set:function(t){this._destination=t},enumerable:!0,configurable:!0});var Le,Oe=Me;function Me(t){var e=Le.call(this)||this;return e._initialize(),t instanceof vr?(e._destination=t,e._page=t.page):(e._page=t,e._destination=new vr(t,{x:0,y:0})),e._dictionary.update("S",new R("GoTo")),e}Object.defineProperty(Ne.prototype,"mouseEnter",{get:function(){return this._mouseEnter||(this._mouseEnter=this._getPdfAction("E")),this._mouseEnter},set:function(t){t&&(this._mouseEnter=t,this._updateAction(this._mouseEnter,"E"))},enumerable:!0,configurable:!0}),Object.defineProperty(Ne.prototype,"mouseLeave",{get:function(){return this._mouseLeave||(this._mouseLeave=this._getPdfAction("X")),this._mouseLeave},set:function(t){t&&(this._mouseLeave=t,this._updateAction(this._mouseLeave,"X"))},enumerable:!0,configurable:!0}),Object.defineProperty(Ne.prototype,"mouseUp",{get:function(){return this._mouseUp||(this._mouseUp=this._getPdfAction("U")),this._mouseUp},set:function(t){t&&(this._mouseUp=t,this._updateAction(this._mouseUp,"U"))},enumerable:!0,configurable:!0}),Object.defineProperty(Ne.prototype,"mouseDown",{get:function(){return this._mouseDown||(this._mouseDown=this._getPdfAction("D")),this._mouseDown},set:function(t){t&&(this._mouseDown=t,this._updateAction(this._mouseDown,"D"))},enumerable:!0,configurable:!0}),Object.defineProperty(Ne.prototype,"gotFocus",{get:function(){return this._gotFocus||(this._gotFocus=this._getPdfAction("Fo")),this._gotFocus},set:function(t){t&&(this._gotFocus=t,this._updateAction(this._gotFocus,"Fo"))},enumerable:!0,configurable:!0}),Object.defineProperty(Ne.prototype,"lostFocus",{get:function(){return this._lostFocus||(this._lostFocus=this._getPdfAction("Bl")),this._lostFocus},set:function(t){t&&(this._lostFocus=t,this._updateAction(this._lostFocus,"Bl"))},enumerable:!0,configurable:!0}),Object.defineProperty(Ne.prototype,"keyPressed",{get:function(){return this._keyPressed||(this._keyPressed=this._getFieldAction("K")),this._keyPressed},set:function(t){t&&(this._keyPressed=t,this._updateFieldAction(this._keyPressed,"K"))},enumerable:!0,configurable:!0}),Object.defineProperty(Ne.prototype,"format",{get:function(){return this._format||(this._format=this._getFieldAction("F")),this._format},set:function(t){t&&(this._format=t,this._updateFieldAction(this._format,"F"))},enumerable:!0,configurable:!0}),Object.defineProperty(Ne.prototype,"validate",{get:function(){return this._validate||(this._validate=this._getFieldAction("V")),this._validate},set:function(t){t&&(this._validate=t,this._updateFieldAction(this._validate,"V"))},enumerable:!0,configurable:!0}),Ne.prototype._updateAction=function(t,e){var i,n,r,s;0<this._field._kidsCount&&(s=this._field.itemAt(0))&&s._dictionary&&t instanceof Oe&&(i=new D,n=t._page,(r=t.destination)._destinationMode===M.PdfDestinationMode.location?t._dictionary.update("D",[n._ref,new R("XYZ"),r.location.x,n.size.height,r.zoom]):r._destinationMode===M.PdfDestinationMode.fitR?t._dictionary.update("D",[n._ref,new R("FitR"),0,0,0,0]):r._destinationMode===M.PdfDestinationMode.fitH?t._dictionary.update("D",[n._ref,new R("FitH"),n.size.height]):r._destinationMode===M.PdfDestinationMode.fitToPage&&t._dictionary.update("D",[n._ref,new R("Fit")]),i.set(e,t._dictionary),i._updated=!0,s._dictionary.update("AA",i))},Ne.prototype._getPdfAction=function(t){var e,i,n=this._field.itemAt(0);return n&&n._dictionary&&n._dictionary.has("AA")&&(e=n._dictionary.get("AA"))&&e.has(t)&&(e=e.get(t))&&e.has("S")&&(t=e.get("S"))&&"GoTo"===t.name&&e.has("D")&&(e._crossReference||(e._crossReference=n._crossReference),t=new Pr(e,"D"),i=new Oe(t._obtainDestination())),i},Ne.prototype._updateFieldAction=function(t,e){var i,n,r;this._field&&this._field._dictionary&&t&&e&&((n=(i=this._field._dictionary).get("AA"))&&n instanceof D||(n=new D,i.update("AA",n)),r=t._dictionary,(t=t._script)&&""!==t&&r.update("JS",t),n.set(e,r),r._updated=!0,n._updated=!0,i._updated=!0,i.update("AA",n))},Ne.prototype._getFieldAction=function(t){var e,i;return this._field&&this._field._dictionary&&t&&(e=this._field._dictionary).has("AA")&&(e=e.get("AA"))&&e instanceof D&&e.has(t)&&(e=e.get(t))&&e instanceof D&&e.has("S")&&(t=e.get("S"))&&"JavaScript"===t.name&&e.has("JS")&&(t=e.get("JS"),(i=new De(""))._dictionary=e,i._script=t),i};var Ee=Ne;function Ne(t){this._field=t}je=function(t,e){return(je=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var je,t=function(t,e){function i(){this.constructor=t}je(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},Ve=(Object.defineProperty(s.prototype,"itemsCount",{get:function(){return this._kids?this._kids.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"form",{get:function(){return this._form},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"name",{get:function(){var t;return void 0===this._name&&(t=Ds(this._dictionary,"T",!1,!1,"Parent"))&&0<t.length&&(1===t.length?this._name=t[0]:this._name=t.slice().reverse().join(".")),this._name},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"actualName",{get:function(){var t;return void 0===this._actualName&&this._dictionary&&this._dictionary.has("T")&&(t=this._dictionary.get("T"))&&"string"==typeof t&&(this._actualName=t),this._actualName},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"mappingName",{get:function(){var t;return void 0===this._mappingName&&this._dictionary.has("TM")&&(t=this._dictionary.get("TM"))&&"string"==typeof t&&(this._mappingName=t),this._mappingName},set:function(t){void 0!==this.mappingName&&this._mappingName===t||(this._mappingName=t,this._dictionary.update("TM",t))},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"toolTip",{get:function(){var t;return void 0===this._alternateName&&this._dictionary&&this._dictionary.has("TU")&&(t=this._dictionary.get("TU"))&&"string"==typeof t&&(this._alternateName=t),this._alternateName},set:function(t){void 0!==this.toolTip&&this._alternateName===t||(this._alternateName=t,this._dictionary.update("TU",t))},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"visibility",{get:function(){if(this._isLoaded){var t=M.PdfFormFieldVisibility.visible,e=this.itemAt(this._defaultIndex),i=M.PdfAnnotationFlag.default;if(e&&e._hasFlags)i=e.flags;else{if(!this._dictionary.has("F"))return M.PdfFormFieldVisibility.visibleNotPrintable;i=this._dictionary.get("F")}e=3;switch((i&M.PdfAnnotationFlag.hidden)===M.PdfAnnotationFlag.hidden&&(e=0),(i&M.PdfAnnotationFlag.noView)===M.PdfAnnotationFlag.noView&&(e=1),(i&M.PdfAnnotationFlag.print)!==M.PdfAnnotationFlag.print&&(e&=2),e){case 0:t=M.PdfFormFieldVisibility.hidden;break;case 1:t=M.PdfFormFieldVisibility.hiddenPrintable;break;case 2:t=M.PdfFormFieldVisibility.visibleNotPrintable;break;case 3:t=M.PdfFormFieldVisibility.visible}}else void 0===this._visibility&&(this._visibility=M.PdfFormFieldVisibility.visible),t=this._visibility;return t},set:function(t){var e=this.itemAt(this._defaultIndex);if(this._isLoaded)!e||e._hasFlags&&this.visibility===t?this._dictionary.has("F")&&this.visibility===t||(Oa(this._dictionary,t),this._dictionary._updated=!0):(Oa(e._dictionary,t),this._dictionary._updated=!0);else if(this.visibility!==t)switch(this._visibility=t){case M.PdfFormFieldVisibility.hidden:e.flags=M.PdfAnnotationFlag.hidden;break;case M.PdfFormFieldVisibility.hiddenPrintable:e.flags=M.PdfAnnotationFlag.noView|M.PdfAnnotationFlag.print;break;case M.PdfFormFieldVisibility.visible:e.flags=M.PdfAnnotationFlag.print;break;case M.PdfFormFieldVisibility.visibleNotPrintable:e.flags=M.PdfAnnotationFlag.default}},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"bounds",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&(e._page=this.page),e&&e.bounds?t=e.bounds:this._dictionary&&this._dictionary.has("Rect")&&(t=Ls(this._dictionary,this.page)),t=null==t?{x:0,y:0,width:0,height:0}:t},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");var e=this.itemAt(this._defaultIndex);this._isLoaded&&(void 0===e||this._dictionary.has("Rect"))?this._dictionary.update("Rect",Es([t.x,t.y,t.width,t.height],this.page)):(e._page=this.page,e.bounds=t)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"rotate",{get:function(){var t,e=this.itemAt(this._defaultIndex);if(e&&void 0!==e.rotate)t=e.rotate;else if(this._mkDictionary&&this._mkDictionary.has("R"))t=this._mkDictionary.get("R");else if(this._dictionary.has("R"))t=this._dictionary.get("R");else for(var i=0;i<this._kidsCount&&void 0===t;i++)i!==this._defaultIndex&&(e=this.itemAt(i))&&void 0!==e.rotate&&(t=e.rotate);return t=void 0===t?0:t},set:function(t){var e=this.itemAt(this._defaultIndex);e?e.rotate=t:this._dictionary.has("R")&&this._dictionary.get("R")===t||this._dictionary.update("R",t)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"color",{get:function(){var t={r:0,g:0,b:0},e=this.itemAt(this._defaultIndex);return e&&e.color?t=e.color:this._defaultAppearance&&(t=this._da.color),t},set:function(t){var e=this.itemAt(this._defaultIndex);e&&e.color&&k(t)?e.color=t:(e=!1,this._defaultAppearance||(this._da=new di(""),e=!0),!e&&this._da.color===t||(this._da.color=t,this._dictionary.update("DA",this._da.toString())))},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"backColor",{get:function(){return this._parseBackColor(!1)},set:function(t){this._updateBackColor(t)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"borderColor",{get:function(){return this._parseBorderColor(!0)},set:function(t){this._updateBorderColor(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"readOnly",{get:function(){return 0!=(this._fieldFlags&M._FieldFlag.readOnly)},set:function(t){t?this._fieldFlags|=M._FieldFlag.readOnly:(this._fieldFlags===M._FieldFlag.readOnly&&(this._fieldFlags|=M._FieldFlag.default),this._fieldFlags&=~M._FieldFlag.readOnly)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"required",{get:function(){return 0!=(this._fieldFlags&M._FieldFlag.required)},set:function(t){t?this._fieldFlags|=M._FieldFlag.required:this._fieldFlags&=~M._FieldFlag.required},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"visible",{get:function(){var t,e;return this._isLoaded?(t=this.itemAt(this._defaultIndex),e=M.PdfAnnotationFlag.default,t&&t._hasFlags?e=t.flags:this._dictionary.has("F")&&(e=this._dictionary.get("F")),e!==M.PdfAnnotationFlag.hidden):this._visible},set:function(t){this._isLoaded||this._visible===t||t||(this._visible=t,this.itemAt(this._defaultIndex).flags=M.PdfAnnotationFlag.hidden)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"border",{get:function(){var t,e=this.itemAt(this._defaultIndex);if(e&&e._dictionary.has("BS"))t=e.border;else if(t=new tr({style:M.PdfBorderStyle.solid}),this instanceof qe||(t._width=0),t._dictionary=this._dictionary,null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("BS")){e=this._dictionary.get("BS");if(e){if(e.has("W")&&(t._width=e.get("W")),e.has("S")){var i=e.get("S");if(i)switch(i.name){case"D":t._style=M.PdfBorderStyle.dashed;break;case"B":t._style=M.PdfBorderStyle.beveled;break;case"I":t._style=M.PdfBorderStyle.inset;break;case"U":t._style=M.PdfBorderStyle.underline;break;default:t._style=M.PdfBorderStyle.solid}}e.has("D")&&(t._dash=e.getArray("D"))}}return t},set:function(t){var e=this.itemAt(this._defaultIndex);e?(e.border.width=t.width,e.border.style=t.style,this._updateBorder(e._dictionary,t)):this._updateBorder(this._dictionary,t)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"rotationAngle",{get:function(){var t=this.itemAt(this._defaultIndex),e=t?t._dictionary.get("MK"):this._mkDictionary;if(e&&e.has("R")){e=e.get("R");if(void 0!==e)switch(e){case 90:return M.PdfRotationAngle.angle90;case 180:return M.PdfRotationAngle.angle180;case 270:return M.PdfRotationAngle.angle270;default:return M.PdfRotationAngle.angle0}}return t?t.rotationAngle:M.PdfRotationAngle.angle0},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"export",{get:function(){return!(0!=(this._fieldFlags&M._FieldFlag.noExport))},set:function(t){t?this._fieldFlags&=~M._FieldFlag.noExport:this._fieldFlags|=M._FieldFlag.noExport},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"tabIndex",{get:function(){if(this._isLoaded){var t=void 0;if(this.page._pageDictionary.has("Annots")&&(t=this.page._pageDictionary.get("Annots")),this._kids&&0<this._kids.length)for(var e=0,i=this._kids;e<i.length;e++){var n,r=i[e];if(r)if(this.page._pageDictionary.has("Annots"))if(t)if(-1!==(n=t.indexOf(r)))return n}else if(this._dictionary&&this._dictionary.has("Subtype")&&"Widget"===this._dictionary.get("Subtype").name)if(this._ref)if(t)if(-1!==(n=t.indexOf(this._ref)))return n;return-1}return this._tabIndex},set:function(t){var e,i;this._tabIndex=t,this._isLoaded&&(t=this.page)&&(t.tabOrder===M.PdfFormFieldsTabOrder.manual||this.form&&this.form._tabOrder===M.PdfFormFieldsTabOrder.manual)&&t._pageDictionary.has("Annots")&&(i=t._pageDictionary.get("Annots"),e=new cr(i,this._crossReference,t),t._annotations=e,(e=i.indexOf(this._ref))<0&&(e=this._annotationIndex),i=t.annotations._reArrange(this._ref,this._tabIndex,e),t._pageDictionary.update("Annots",i),t._pageDictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){if(!this._page){var t,e=this.itemAt(this._defaultIndex),i=(void 0!==e?e:this)._dictionary,n=(this._crossReference&&(t=this._crossReference._document),void 0);if(i&&i.has("P")){var r=i.getRaw("P");if(r&&t)for(var s=0;s<t.pageCount;s++){var a=t.getPage(s);if(a&&a._ref===r){n=a;break}}}if(!n&&t){i=(void 0!==e?e:this)._ref;if(!(n=!n&&i?ha(t,i):n)&&this._kids&&0<this._kids.length)for(s=0;s<this._kids.length&&!(n=ha(t,this._kids[s]));s++);}this._page=n}return this._page},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_grayBrush",{get:function(){return this._gray||(this._gray=new A({r:128,g:128,b:128})),this._gray},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_silverBrush",{get:function(){return this._silver||(this._silver=new A({r:198,g:198,b:198})),this._silver},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_whiteBrush",{get:function(){return this._white||(this._white=new A({r:255,g:255,b:255})),this._white},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_blackBrush",{get:function(){return this._black||(this._black=new A({r:0,g:0,b:0})),this._black},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_kidsCount",{get:function(){return this._kids?this._kids.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_hasBackColor",{get:function(){var t,e;return this._isLoaded?((t=this._mkDictionary)||(e=this.itemAt(this._defaultIndex))&&e._dictionary.has("MK")&&(t=e._dictionary.get("MK")),t&&t.has("BG")):!this._isTransparentBackColor},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_hasBorderColor",{get:function(){var t,e;return this._isLoaded?((t=this._mkDictionary)||(e=this.itemAt(this._defaultIndex))&&e._dictionary.has("MK")&&(t=e._dictionary.get("MK")),t&&t.has("BC")):!this._isTransparentBorderColor},enumerable:!0,configurable:!0}),s.prototype._parseBackColor=function(t){var e;return e=(!t||this._isLoaded&&this._hasBackColor||!this._isLoaded&&!this._isTransparentBackColor)&&((t=this.itemAt(this._defaultIndex))&&t.backColor?e=t.backColor:this._mkDictionary&&(t=this._mkDictionary)&&t.has("BG")&&(t=t.getArray("BG"))&&(e=qs(t)),null==e)?{r:255,g:255,b:255}:e},s.prototype._parseBorderColor=function(t){var e;return e=(!t||this._isLoaded&&this._hasBorderColor||!this._isLoaded&&!this._isTransparentBorderColor)&&((t=this.itemAt(this._defaultIndex))&&t.borderColor?e=t.borderColor:this._mkDictionary&&(t=this._mkDictionary).has("BC")&&(t=t.getArray("BC"))&&(e=qs(t)),null==e)?{r:0,g:0,b:0}:e},s.prototype._updateBackColor=function(t,e){var i;(e=void 0===e?!1:e)&&k(t)&&t.isTransparent?(this._isTransparentBackColor=!0,this._dictionary&&this._dictionary.has("BG")&&delete this._dictionary._map.BG,(i=this._mkDictionary)&&i.has("BG")&&(delete i._map.BG,this._dictionary._updated=!0),(e=this.itemAt(this._defaultIndex))&&(e.backColor=t)):(this._isTransparentBackColor=!1,(e=this.itemAt(this._defaultIndex))&&e.backColor!==t?e.backColor=t:void 0===(i=this._mkDictionary)?((e=new D(this._crossReference)).update("BG",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._dictionary.update("MK",e)):i.has("BG")&&qs(i.getArray("BG"))===t||(i.update("BG",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._dictionary._updated=!0))},s.prototype._updateBorderColor=function(t,e){var i;(e=void 0===e?!1:e)&&t.isTransparent?(this._isTransparentBorderColor=!0,this._dictionary.has("BC")&&delete this._dictionary._map.BC,(i=this._mkDictionary)&&i.has("BC")&&(delete i._map.BC,this._dictionary.has("BS")&&(e=this._dictionary.get("BS"))&&e.has("W")&&delete e._map.W,this._dictionary._updated=!0),(e=this.itemAt(this._defaultIndex))&&(e.borderColor=t)):(this._isTransparentBorderColor=!1,(e=this.itemAt(this._defaultIndex))&&e.borderColor!==t?e.borderColor=t:void 0===(i=this._mkDictionary)?((e=new D(this._crossReference)).update("BC",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._dictionary.update("MK",e)):i.has("BC")&&qs(i.getArray("BC"))===t||(i.update("BC",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._dictionary._updated=!0))},s.prototype.itemAt=function(t){var e,i,n;return 0<=t&&t<this._kidsCount&&(this._parsedItems.has(t)?e=this._parsedItems.get(t):(i=void 0,(i=(n=this._kids[t])&&n instanceof m?this._crossReference._fetch(n):i)&&((e=jn._load(i,this._crossReference))._ref=n,this._parsedItems.set(t,e)))),e},s.prototype.setAppearance=function(t){this._setAppearance=t},s.prototype.getValue=function(t){var e;if(!this._dictionary||!this._dictionary.has(t))throw new Error("PdfException: "+t+" is not found");var i=this._dictionary.get(t);if(null!=i&&i instanceof R)e=i.name;else{if("string"!=typeof i)throw new Error("PdfException: "+t+" is not found");e=i}return e},s.prototype.setValue=function(t,e){t&&""!==t&&e&&""!==e&&this._dictionary.update(t,e)},s.prototype.removeItemAt=function(i){var t,e,n;null!==this._dictionary&&void 0!==this._dictionary&&this._dictionary.has("Kids")&&0<this.itemsCount&&(t=this.itemAt(i))&&t._ref&&((e=t._getPage())&&e._removeAnnotation(t._ref),this._kids.splice(i,1),this._dictionary.set("Kids",this._kids),this._dictionary._updated=!0,this._parsedItems.delete(i),0<this._parsedItems.size)&&(n=new Map,this._parsedItems.forEach(function(t,e){i<e?n.set(e-1,t):n.set(e,t)}),this._parsedItems=n)},s.prototype.removeItem=function(t){t&&t._ref&&-1!==(t=this._kids.indexOf(t._ref))&&this.removeItemAt(t)},Object.defineProperty(s.prototype,"_fieldFlags",{get:function(){return void 0===this._flags&&(this._flags=Ds(this._dictionary,"Ff",!1,!0,"Parent"),void 0===this._flags)&&(this._flags=M._FieldFlag.default),this._flags},set:function(t){this._fieldFlags!==t&&(this._flags=t,this._dictionary.update("Ff",t))},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_defaultAppearance",{get:function(){var t;return void 0===this._da&&(t=Ds(this._dictionary,"DA",!1,!0,"Parent"))&&""!==t&&(this._da=new di(t)),this._da},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"_mkDictionary",{get:function(){var t;return t=this._dictionary&&this._dictionary.has("MK")?this._dictionary.get("MK"):t},enumerable:!0,configurable:!0}),s.prototype._updateBorder=function(t,e){var i,n=!1;t&&t.has("BS")?i=t.get("BS"):(i=new D(this._crossReference),t.update("BS",i),n=!0),void 0!==e.width?(i.update("W",e.width),t._updated=!0):n&&i.update("W",0),void 0!==e.style?(i.update("S",Gs(e.style)),t._updated=!0):n&&i.update("S",Gs(M.PdfBorderStyle.solid)),void 0!==e.dash&&(i.update("D",e.dash),t._updated=!0)},s.prototype._checkFieldFlag=function(t){var e;return void 0!==(e=t&&t instanceof D?t.get("F"):e)&&6===e},s.prototype._initializeFont=function(t){var e,i,n,r,s=this,a=(this._font=t,this._crossReference._document),o=!1,h=((e=a?a.form._dictionary.has("DR")?a.form._dictionary.get("DR"):new D(this._crossReference):e)&&e.has("Font")&&((h=e.getRaw("Font"))&&h instanceof m?(o=!0,i=this._crossReference._fetch(h)):h instanceof D&&(i=h)),i||(i=new D(this._crossReference),e.update("Font",i)),!1),c=(this._font&&null!==this._font._key&&void 0!==this._font._key&&this._font._reference?(n=R.get(this._font._key),r=this._font._reference,h=!0):(n=R.get(ia()),r=this._crossReference._getNextReference(),this._font&&(this._font._key=n.name,this._font._reference=r)),r&&!h&&(t instanceof ye?this._font._pdfFontInternals&&(this._crossReference._cacheMap.set(r,this._font._pdfFontInternals),this._font._reference=r):this._font._dictionary&&(this._crossReference._cacheMap.set(r,this._font._dictionary),i.update(n.name,r),e._updated=!0,a.form._dictionary.update("DR",e),a.form._dictionary._updated=!0)),i.update(n.name,r),e._updated=!0,a.form._dictionary.update("DR",e),a.form._dictionary._updated=!0,this._fontName=n.name,new di);c.fontName=this._fontName,c.fontSize=this._font._size,c.color=this.color||{r:0,g:0,b:0},this._dictionary.has("Kids")?this._dictionary.getArray("Kids").forEach(function(t,e){e=s.itemAt(e);t.update("DA",c.toString()),e&&(e._da=c)}):this._dictionary.has("Subtype")&&"Widget"===this._dictionary.get("Subtype").name&&this._dictionary.update("DA",c.toString()),o&&(e._updated=!0)},s.prototype._drawRectangularControl=function(t,e){switch(t.drawRectangle(e.bounds,e.backBrush),this._drawBorder(t,e.bounds,e.borderPen,e.borderStyle,e.borderWidth),e.borderStyle){case M.PdfBorderStyle.inset:this._drawLeftTopShadow(t,e.bounds,e.borderWidth,this._grayBrush),this._drawRightBottomShadow(t,e.bounds,e.borderWidth,this._silverBrush);break;case M.PdfBorderStyle.beveled:this._drawLeftTopShadow(t,e.bounds,e.borderWidth,this._whiteBrush),this._drawRightBottomShadow(t,e.bounds,e.borderWidth,e.shadowBrush)}},s.prototype._drawBorder=function(t,e,i,n,r){i&&0<r&&(n===M.PdfBorderStyle.underline?t.drawLine(i,{x:e.x,y:e.x+e.height-r/2},{x:e.x+e.width,y:e.y+e.height-r/2}):(n={x:e.x+r/2,y:e.y+r/2,width:e.width-r,height:e.height-r},t.drawRectangle(n,i)))},s.prototype._drawLeftTopShadow=function(t,e,i,n){var r=new C,s=[];s.push({x:e.x+i,y:e.y+i}),s.push({x:e.x+i,y:e.y+e.height-i}),s.push({x:e.x+2*i,y:e.y+e.height-2*i}),s.push({x:e.x+2*i,y:e.y+2*i}),s.push({x:e.x+e.width-2*i,y:e.y+2*i}),s.push({x:e.x+e.width-i,y:e.y+i}),r.addPolygon(s),t.drawPath(r,n)},s.prototype._drawRightBottomShadow=function(t,e,i,n){var r=new C,s=[];s.push({x:e.x+i,y:e.y+e.height-i}),s.push({x:e.x+2*i,y:e.y+e.height-2*i}),s.push({x:e.x+e.width-2*i,y:e.y+e.height-2*i}),s.push({x:e.x+e.width-2*i,y:e.y+2*i}),s.push({x:e.x+e.width-i,y:e.y+i}),s.push({x:e.x+e.width-i,y:e.y+e.height-i}),r.addPolygon(s),t.drawPath(r,n)},s.prototype._drawRadioButton=function(t,e,i,n){if("l"===i){var r,s=e.bounds,a=s.width;switch(this._enableGrouping&&(a=Math.min(s.width,s.height)),n){case M._PdfCheckFieldState.checked:case M._PdfCheckFieldState.unchecked:t.drawEllipse({x:s.x,y:s.y,width:a,height:s.height},e.backBrush);break;case M._PdfCheckFieldState.pressedChecked:case M._PdfCheckFieldState.pressedUnchecked:e.borderStyle===M.PdfBorderStyle.beveled||e.borderStyle===M.PdfBorderStyle.underline?t.drawEllipse(s,e.backBrush):t.drawEllipse({x:s.x,y:s.y,width:a,height:s.height},e.shadowBrush)}this._drawRoundBorder(t,s,e.borderPen,e.borderWidth),this._drawRoundShadow(t,e,n),n!==M._PdfCheckFieldState.checked&&n!==M._PdfCheckFieldState.pressedChecked||(r=[s.x+e.borderWidth/2,s.y+e.borderWidth/2,a-e.borderWidth,s.height-e.borderWidth],t.drawEllipse({x:r[0]+r[2]/4,y:r[1]+r[2]/4,width:r[2]-r[2]/2,height:r[3]-r[2]/2},e.foreBrush))}else this._drawCheckBox(t,e,i,n)},s.prototype._drawRoundBorder=function(t,e,i,n){0===e.x&&0===e.y&&0===e.width&&0===e.height||t.drawEllipse({x:e.x+n/2,y:e.y+n/2,width:(this._enableGrouping?Math.min(e.width,e.height):e.width)-n,height:e.height-n},i)},s.prototype._drawRoundShadow=function(t,e,i){var n=e.borderWidth,r=-1.5*n,s=e.bounds.x+r,a=e.bounds.y+r,o=e.bounds.width+2*r,r=e.bounds.height+2*r,h=e.shadowBrush;if(h){var c=h._color,_=void 0,d=void 0;switch(e.borderStyle){case M.PdfBorderStyle.beveled:switch(i){case M._PdfCheckFieldState.pressedChecked:case M._PdfCheckFieldState.pressedUnchecked:_=new x(c,n),d=new x({r:255,g:255,b:255},n);break;case M._PdfCheckFieldState.checked:case M._PdfCheckFieldState.unchecked:_=new x({r:255,g:255,b:255},n),d=new x(c,n)}break;case M.PdfBorderStyle.inset:switch(i){case M._PdfCheckFieldState.pressedChecked:case M._PdfCheckFieldState.pressedUnchecked:_=new x({r:0,g:0,b:0},n),d=new x({r:0,g:0,b:0},n);break;case M._PdfCheckFieldState.checked:case M._PdfCheckFieldState.unchecked:_=new x({r:128,g:128,b:128},n),d=new x({r:192,g:192,b:192},n)}}_&&d&&(t.drawArc({x:s,y:a,width:o,height:r},135,180,_),t.drawArc({x:s,y:a,width:o,height:r},-45,180,d))}},s.prototype._drawCheckBox=function(t,e,i,n,r){switch(n){case M._PdfCheckFieldState.unchecked:case M._PdfCheckFieldState.checked:(e.borderPen||e.backBrush)&&t.drawRectangle(e.bounds,e.backBrush);break;case M._PdfCheckFieldState.pressedChecked:case M._PdfCheckFieldState.pressedUnchecked:e.borderStyle===M.PdfBorderStyle.beveled||e.backBrush||e.borderStyle===M.PdfBorderStyle.underline?(e.borderPen||e.backBrush)&&t.drawRectangle(e.bounds,e.backBrush):(e.borderPen||e.shadowBrush)&&t.drawRectangle(e.bounds,e.shadowBrush)}var s=e.bounds;if(this._drawBorder(t,e.bounds,e.borderPen,e.borderStyle,e.borderWidth),n===M._PdfCheckFieldState.pressedChecked||n===M._PdfCheckFieldState.pressedUnchecked)switch(e.borderStyle){case M.PdfBorderStyle.inset:this._drawLeftTopShadow(t,e.bounds,e.borderWidth,this._blackBrush),this._drawRightBottomShadow(t,e.bounds,e.borderWidth,this._whiteBrush);break;case M.PdfBorderStyle.beveled:this._drawLeftTopShadow(t,e.bounds,e.borderWidth,e.shadowBrush),this._drawRightBottomShadow(t,e.bounds,e.borderWidth,this._whiteBrush)}else switch(e.borderStyle){case M.PdfBorderStyle.inset:this._drawLeftTopShadow(t,e.bounds,e.borderWidth,this._grayBrush),this._drawRightBottomShadow(t,e.bounds,e.borderWidth,this._silverBrush);break;case M.PdfBorderStyle.beveled:this._drawLeftTopShadow(t,e.bounds,e.borderWidth,this._whiteBrush),this._drawRightBottomShadow(t,e.bounds,e.borderWidth,e.shadowBrush)}var a,o,h,c,_=0,d=0;switch(n){case M._PdfCheckFieldState.pressedChecked:case M._PdfCheckFieldState.checked:r?r=new E(M.PdfFontFamily.zapfDingbats,r._size):(a=e.borderStyle===M.PdfBorderStyle.beveled||e.borderStyle===M.PdfBorderStyle.inset,o=e.borderWidth,a&&(o*=2),a=Math.max(a?2*e.borderWidth:e.borderWidth,1),o=Math.min(o,a),d=e.bounds.width>e.bounds.height?e.bounds.height:e.bounds.width,r=new E(M.PdfFontFamily.zapfDingbats,d-2*o),e.bounds.width>e.bounds.height&&(_=(e.bounds.height-r._getHeight())/2)),0===d&&(d=e.bounds.height),(e.pageRotationAngle!==M.PdfRotationAngle.angle0||0<e.rotationAngle)&&(a=t.save(),o=t._size,e.pageRotationAngle!==M.PdfRotationAngle.angle0&&(e.pageRotationAngle===M.PdfRotationAngle.angle90?(t.translateTransform({x:o.height,y:0}),t.rotateTransform(90),c=o.height-(s.x+s.width),s={x:s.y,y:c,width:s.height,height:s.width}):e.pageRotationAngle===M.PdfRotationAngle.angle180?(t.translateTransform({x:o.width,y:o.height}),t.rotateTransform(-180),s={x:o.width-(s.x+s.width),y:c=o.height-(s.y+s.height),width:s.width,height:s.height}):e.pageRotationAngle===M.PdfRotationAngle.angle270&&(t.translateTransform({x:0,y:o.width}),t.rotateTransform(270),s={x:o.width-(s.y+s.height),y:c=s.x,width:s.height,height:s.width})),0<e.rotationAngle?(90===e.rotationAngle?e.pageRotationAngle===M.PdfRotationAngle.angle90?(t.translateTransform({x:0,y:o.height}),t.rotateTransform(-90),s={x:o.height-(s.y+s.height),y:c=s.x,width:s.height,height:s.width}):s.width>s.height?(t.translateTransform({x:0,y:o.height}),t.rotateTransform(-90),s=e.bounds):(h=s.x,s.x=-(s.y+s.height),s.y=h,h=s.height,s.height=s.width>r._getHeight()?s.width:r._getHeight(),s.width=h,t.rotateTransform(-90)):270===e.rotationAngle?(t.translateTransform({x:o.width,y:0}),t.rotateTransform(-270),s={x:s.y,y:c=o.width-(s.x+s.width),width:s.height,height:s.width}):180===e.rotationAngle&&(t.translateTransform({x:o.width,y:o.height}),t.rotateTransform(-180),s={x:o.width-(s.x+s.width),y:c=o.height-(s.y+s.height),width:s.width,height:s.height}),t.drawString(i,r,{x:s.x,y:s.y-_,width:s.width,height:s.height},null,e.foreBrush,new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle)),t.restore(a)):t.drawString(i,r,{x:s.x,y:s.y-_,width:s.width,height:s.height},null,e.foreBrush,new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle)))}},s.prototype._addToKid=function(t){var e;this._dictionary&&this._dictionary.has("Kids")?this._kids=this._dictionary.get("Kids"):(this._kids=[],this._dictionary.update("Kids",this._kids),this._parsedItems=new Map),-1===this._kids.indexOf(t._ref)&&(e=this._kidsCount,t._index=e,this._kids.push(t._ref),this._parsedItems.set(e,t))},s.prototype._drawTemplate=function(t,e,i){var n;t&&e&&((n=e.graphics).save(),e.rotation===M.PdfRotationAngle.angle90?(n.translateTransform({x:n._size.height,y:0}),n.rotateTransform(90)):e.rotation===M.PdfRotationAngle.angle180?(n.translateTransform({x:n._size.width,y:n._size.height}),n.rotateTransform(-180)):e.rotation===M.PdfRotationAngle.angle270&&(n.translateTransform({x:0,y:n._size.width}),n.rotateTransform(270)),n._sw._setTextRenderingMode(M._TextRenderingMode.fill),n.drawTemplate(t,i),n.restore())},s.prototype._addToOptions=function(t,e){e instanceof ai&&e._listValues.push(t._text),e._options.push([t._value,t._text]),e._dictionary.set("Opt",e._options),e._dictionary._updated=!0,!t._isFont&&t._pdfFont&&this._initializeFont(t._pdfFont)},s.prototype._addAppearance=function(t,e,i){var n=new D,t=(t&&t.has("AP")?(n=t.get("AP"),T(t.get("AP"),this._crossReference,i)):(n=new D(this._crossReference),t.update("AP",n)),this._crossReference._getNextReference());this._crossReference._cacheMap.set(t,e._content),n.update(i,t)},s.prototype._rotateTextBox=function(t,e,i){var n={x:0,y:0,width:0,height:0};return i===M.PdfRotationAngle.angle180?n={x:e.width-(t.x+t.width),y:e.height-(t.y+t.height),width:t.width,height:t.height}:i===M.PdfRotationAngle.angle270?n={x:t.y,y:e.width-(t.x+t.width),width:t.height,height:t.width}:i===M.PdfRotationAngle.angle90&&(n={x:e.height-(t.y+t.height),y:t.x,width:t.height,height:t.width}),n},s.prototype._checkIndex=function(t,e){if(t<0||0!==t&&e<=t)throw Error("Index out of range.")},s.prototype._getAppearanceStateValue=function(){var t;if(this._dictionary&&this._dictionary.has("Kids"))for(var e=0;e<this._kidsCount;e++){var i,n=this.itemAt(e);if(n&&n._dictionary&&n._dictionary.has("AS"))if((i=n._dictionary.get("AS"))&&"Off"!==i.name){t=i.name;break}}else this._dictionary&&this._dictionary.has("AS")&&(i=this._dictionary.get("AS"))&&"Off"!==i.name&&(t=i.name);return t},s.prototype._getTextAlignment=function(){var t;return null!==this._textAlignment&&void 0!==this._textAlignment||(this._isLoaded?(t=this.itemAt(this._defaultIndex))&&t._dictionary&&t._dictionary.has("Q")?this._textAlignment=t._dictionary.get("Q"):this._dictionary.has("Q")?this._textAlignment=this._dictionary.get("Q"):this._textAlignment=M.PdfTextAlignment.left:this._textAlignment=M.PdfTextAlignment.left),this._textAlignment},s.prototype._setTextAlignment=function(t){var e=this.itemAt(this._defaultIndex);this._isLoaded&&!this.readOnly&&(e&&e._dictionary?e:this)._dictionary.update("Q",t),this._isLoaded||this._textAlignment===t||(e&&e._dictionary?e._dictionary.update("Q",t):this._dictionary&&this._dictionary.update("Q",t)),this._textAlignment=t,this._stringFormat=new I(t,M.PdfVerticalAlignment.middle)},s.prototype._parseItems=function(){for(var t=[],e=0;e<this.itemsCount;e++)t.push(this.itemAt(e));return t},s);function s(){this._enableGrouping=!1,this._isDuplicatePage=!1,this._visible=!0,this._isTransparentBackColor=!1,this._isTransparentBorderColor=!1,this._defaultFont=new E(M.PdfFontFamily.helvetica,8),this._appearanceFont=new E(M.PdfFontFamily.helvetica,10,M.PdfFontStyle.regular),this._defaultItemFont=new E(M.PdfFontFamily.timesRoman,12),this._flatten=!1,this._circleCaptionFont=new E(M.PdfFontFamily.helvetica,8,M.PdfFontStyle.regular),this._isUpdating=!1,this._isImport=!1,this._exportValue="Yes"}t(He,ze=Ve),He._load=function(t,e,i,n){var r=new He;return r._isLoaded=!0,r._form=t,r._dictionary=e,r._crossReference=i,r._ref=n,r._dictionary.has("Kids")&&(r._kids=r._dictionary.get("Kids")),r._defaultIndex=0,r._parsedItems=new Map,r},Object.defineProperty(He.prototype,"actions",{get:function(){return this._actions||(this._actions=new Ee(this)),this._actions},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"text",{get:function(){var t,e;return void 0===this._text&&(this._isLoaded?((t=Ds(this._dictionary,"V",!1,!0,"Parent"))||(e=this.itemAt(this._defaultIndex))&&(t=e._dictionary.get("V")))&&(this._text=fs(t)):this._text=""),this._text},set:function(t){var e;this._isLoaded?this.readOnly||(this._dictionary.has("V")&&this._dictionary.get("V")===t||this._dictionary.update("V",t),!(e=this.itemAt(this._defaultIndex))||e._dictionary.has("V")&&e._dictionary.get("V")===t||e._dictionary.update("V",t),this._text=t,this._isTextChanged=!0):this._text!==t&&(this._dictionary.update("V",t),this._text=t)},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"defaultValue",{get:function(){var t;return void 0===this._defaultValue&&(t=Ds(this._dictionary,"DV",!1,!0,"Parent"))&&(this._defaultValue=t),this._defaultValue},set:function(t){t!==this.defaultValue&&(this._dictionary.update("DV",t),this._defaultValue=t)},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"multiLine",{get:function(){return 0!=(this._fieldFlags&M._FieldFlag.multiLine)},set:function(t){t?this._fieldFlags|=M._FieldFlag.multiLine:this._fieldFlags&=~M._FieldFlag.multiLine,this._stringFormat&&(this._stringFormat.lineAlignment=t?M.PdfVerticalAlignment.top:M.PdfVerticalAlignment.middle)},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"password",{get:function(){return 0!=(this._fieldFlags&M._FieldFlag.password)},set:function(t){t?this._fieldFlags|=M._FieldFlag.password:this._fieldFlags&=~M._FieldFlag.password},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"scrollable",{get:function(){return!(0!=(this._fieldFlags&M._FieldFlag.doNotScroll))},set:function(t){t?this._fieldFlags&=~M._FieldFlag.doNotScroll:this._fieldFlags|=M._FieldFlag.doNotScroll},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"spellCheck",{get:function(){return!(0!=(this._fieldFlags&M._FieldFlag.doNotSpellCheck))},set:function(t){t?this._fieldFlags&=~M._FieldFlag.doNotSpellCheck:this._fieldFlags|=M._FieldFlag.doNotSpellCheck},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"insertSpaces",{get:function(){var t=this._fieldFlags;return 0!=(M._FieldFlag.comb&t)&&0==(t&M._FieldFlag.multiLine)&&0==(t&M._FieldFlag.password)&&0==(t&M._FieldFlag.fileSelect)},set:function(t){t?this._fieldFlags|=M._FieldFlag.comb:this._fieldFlags&=~M._FieldFlag.comb},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"highlightMode",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&void 0!==e.highlightMode?t=e.highlightMode:this._dictionary&&this._dictionary.has("H")&&(t=Ys(this._dictionary.get("H").name)),void 0!==t?t:M.PdfHighlightMode.noHighlighting},set:function(t){var e=this.itemAt(this._defaultIndex);!e||void 0!==e.highlightMode&&e.highlightMode===t?this._dictionary.has("H")&&Ys(this._dictionary.get("H"))===t||this._dictionary.update("H",Qs(t)):e.highlightMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"maxLength",{get:function(){var t;return void 0===this._maxLength&&(t=Ds(this._dictionary,"MaxLen",!1,!0,"Parent"),this._maxLength=void 0!==t&&Number.isInteger(t)?t:0),this._maxLength},set:function(t){this.maxLength!==t&&(this._dictionary.update("MaxLen",t),this._maxLength=t)},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"isAutoResizeText",{get:function(){return this._autoResizeText},set:function(t){this._autoResizeText=t;var e=this.itemAt(this._defaultIndex);e&&(e._isAutoResize=t)},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"font",{get:function(){var t;return this._font||(t=this.itemAt(this._defaultIndex),this._font=qa(this._form,t,this)),this._font},set:function(t){t&&t instanceof ce&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(He.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),He.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._text="",this._defaultValue="",this._defaultIndex=0,this._spellCheck=!1,this._insertSpaces=!1,this._multiline=!1,this._password=!1,this._scrollable=!1,this._dictionary=new D(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",R.get("Tx")),this._dictionary.update("T",e),this._fieldFlags|=M._FieldFlag.doNotSpellCheck,this._createItem(i),this._initializeFont(this._defaultFont)},He.prototype._createItem=function(t){var e=new jn;e._create(this._page,t,this),e.textAlignment=M.PdfTextAlignment.left,this._stringFormat=new I(e.textAlignment,M.PdfVerticalAlignment.middle),e._dictionary.update("MK",new D(this._crossReference)),e._mkDictionary.update("BC",[0,0,0]),e._mkDictionary.update("BG",[1,1,1]),e._mkDictionary.update("CA",this.actualName),this._addToKid(e)},He.prototype._doPostProcess=function(t){if((t=void 0===t?!1:t)||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._isLoaded)if(0<e)for(var i=0;i<e;i++)(n=this.itemAt(i))&&this._postProcess(t,n);else(t||this._form._setAppearance||this._setAppearance)&&!this._checkFieldFlag(this._dictionary)&&this._postProcess(t);else if(t||this._form._setAppearance||this._setAppearance)for(var n,r,s,i=0;i<e;i++)(n=this.itemAt(i))&&!this._checkFieldFlag(n._dictionary)&&(r=this._createAppearance(t,n),t?(s={x:n.bounds.x,y:n.bounds.y,width:r._size.width,height:r._size.height},this._drawTemplate(r,n._page,s)):this._addAppearance(n._dictionary,r,"N"),n._dictionary._updated=!t);t&&(this._dictionary._updated=!1)}},He.prototype._postProcess=function(t,e){var i,n,r=e||this;null!=e&&e._setAppearance&&e._enableGrouping||this._form._setAppearance||this._setAppearance||t&&!r._dictionary.has("AP")?i=this._createAppearance(t,r):r._dictionary.has("AP")&&(e=void 0,n=r._dictionary.get("AP"))&&n.has("N")&&(e=n.get("N"),(n=n.getRaw("N"))&&(e.reference=n),e)&&(i=new P(e,this._crossReference)),i&&(t?((n=r instanceof jn?r._getPage():r.page)&&((e=n.graphics).save(),n.rotation===M.PdfRotationAngle.angle90?(e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(90)):n.rotation===M.PdfRotationAngle.angle180?(e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(-180)):n.rotation===M.PdfRotationAngle.angle270&&(e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(270)),t={x:r.bounds.x,y:r.bounds.y,width:i._size.width,height:i._size.height},e.drawTemplate(i,t),e.restore()),r._dictionary._updated=!1):this._addAppearance(r._dictionary,i,"N"))},He.prototype._createAppearance=function(t,e){var i,n,r=e.bounds,s=270===e.rotate&&this.page.rotation===M.PdfRotationAngle.angle270,a=s?r.height:r.width,r=s?r.width:r.height,o=new P([0,0,a,r],this._crossReference),s=(ua(o,s?e.rotate:null),o._writeTransformation=!1,o.graphics),h=new or,a=(h.bounds={x:0,y:0,width:a,height:r},e.backColor),r=(a&&!a.isTransparent&&(h.backBrush=new A(a)),h.foreBrush=new A(e.color),e.border),c=(e.borderColor&&(0===r.width&&(e.borderColor={r:255,g:255,b:255}),h.borderPen=new x(e.borderColor,r.width),Po(r,h)),h.borderWidth=r.width,h.borderStyle=r.style,a&&(r=[a.r-64,a.g-64,a.b-64],h.shadowBrush=new A({r:0<=r[0]?r[0]:0,g:0<=r[1]?r[1]:0,b:0<=r[2]?r[2]:0})),h.rotationAngle=e.rotate,h.insertSpaces=this.insertSpaces,this.text),a=!1,r=this.actions;if(null==(c=r&&(r=r.format)&&(r=r.script,r=this._tryParseAcrobatFormFormat(r))?this._normalizeDateValue(this.text,r):c)&&(c=""),this.password){for(var _="",d=0;d<c.length;d++)_+="*";c=_}return this.maxLength&&c.length>this.maxLength&&(c=c.substring(0,this.maxLength)),h.required=this.required,this.required||(s._sw._beginMarkupSequence("Tx"),s._initializeCoordinates()),(a=null!=e&&e instanceof jn&&e._enableGrouping?!0:a)&&null!==e.font&&void 0!==e.font?i=e.font:void 0!==this._font&&null!==this._font||(this._font=this.font||this._defaultFont),a&&null!==e.textAlignment&&void 0!==e.textAlignment?n=new I(e.textAlignment,M.PdfVerticalAlignment.middle):void 0!==this._stringFormat&&null!==this._stringFormat||(void 0===this.textAlignment||null===this.textAlignment?this._stringFormat=new I(this.textAlignment,M.PdfVerticalAlignment.middle):this._stringFormat=new I(M.PdfTextAlignment.left,M.PdfVerticalAlignment.middle)),fo(c)&&(this._stringFormat.textDirection=M.PdfTextDirection.rightToLeft),this._isLoaded&&!this.multiLine&&(this._stringFormat?this._stringFormat.lineLimit=!1:n&&(n.lineLimit=!1)),a?this._drawTextBox(s,h,c,i,n,this.multiLine,this.scrollable,this.maxLength):this._drawTextBox(s,h,c,this._font,this._stringFormat,this.multiLine,this.scrollable,this.maxLength),this.required||s._sw._endMarkupSequence(),o},He.prototype._normalizeDateValue=function(t,e){var i=this._parseUnknownDate(t);return i?this._formatDateUsingAcrobatFormat(i,e):t},He.prototype._parseUnknownDate=function(t){var e,i,n,r,s,a,o,h,c,_;return t&&(t=t.trim().replace(/[.-]/g,"/"),s=new Date(t),!1===isNaN(s.getTime())?e=s:(s=void 0,(h=(t=t.trim().split(/\s+/))[0])&&(s=h.match(/^(\d{1,4})\/(\d{1,2})\/(\d{1,4})$/)),h=t[1],s&&(a=(t=function(t){return isNaN(Number(t))?0:Number(t)})(s[1]),o=t(s[2]),r=n=i=void 0,31<(s=t(s[3])))&&(i=s,12<a&&(r=a,n=o-1),o=a=s=0,h&&2<=(h=h.split(":")).length&&h.length<=3&&(c=t(h[0]),_=t(h[1]),t=h[2]?t(h[2]):0,0<=c)&&c<=99&&0<=_&&_<=59&&0<=t&&t<=59&&(s=c,a=_,o=t),e=new Date(i,n,r,s,a,o)))),e},He.prototype._formatDateUsingAcrobatFormat=function(t,e){function i(t){return("0"+t).slice(-2)}var n=t.getHours(),r=n%12||12,s=new Map([["yyyy",t.getFullYear().toString()],["yy",t.getFullYear().toString().slice(-2)],["mmmm",["January","February","March","April","May","June","July","August","September","October","November","December"][t.getMonth()]],["mmm",["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()]],["mm",i(t.getMonth()+1)],["m",(t.getMonth()+1).toString()],["dd",i(t.getDate())],["d",t.getDate().toString()],["HH",i(n)],["H",n.toString()],["hh",i(r)],["h",r.toString()],["MM",i(t.getMinutes())],["M",t.getMinutes().toString()],["ss",i(t.getSeconds())],["s",t.getSeconds().toString()],["tt",n<12?"AM":"PM"]]);return e.replace(/yyyy|mmmm|mmm|mm|dd|HH|hh|MM|ss|yy|H|h|m|d|M|s|tt/g,function(t){return s.get(t)})},He.prototype._tryParseAcrobatFormFormat=function(t){var e;return e="string"==typeof t&&(t=t.replace(/\s+/g," ").trim().match(/[a-zA-Z0-9_]*_FormatEx\s*\(\s*(['"])(.*?)\1\s*\)/i),Array.isArray(t))&&2<t.length&&"string"==typeof t[2]?t[2]:e},He.prototype._drawTextBox=function(t,e,i,n,r,s,a,o){if(void 0!==o)if(e.insertSpaces){var h;if(void 0!==o&&0<o&&this.borderColor){h=e.bounds.width/o,t.drawRectangle(e.bounds,e.borderPen,e.backBrush);for(var c=i,_=0;_<o;_++){i=r.alignment===M.PdfTextAlignment.right?o-c.length<=_?c[_-(o-c.length)]:"":r.alignment===M.PdfTextAlignment.center&&c.length<o?(d=Math.floor(o/2-Math.ceil(c.length/2)))<=_&&_<d+c.length?c[_-d]:"":c.length>_?c[_]:"",e.bounds.width=h;var d=new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle);this._drawTextBox(t,e,i,n,d,s,a),e.bounds.x=e.bounds.x+h,e.borderWidth&&t.drawLine(e.borderPen,{x:e.bounds.x,y:e.bounds.y},{x:e.bounds.x,y:e.bounds.y+e.bounds.height})}}else this._drawTextBox(t,e,i,n,r,s,a)}else this._drawTextBox(t,e,i,n,r,s,a);else{t._isTemplateGraphics&&e.required&&(t.save(),t._initializeCoordinates()),e.insertSpaces||this._drawRectangularControl(t,e),t._isTemplateGraphics&&e.required&&(t.restore(),t.save(),t._sw._beginMarkupSequence("Tx"),t._initializeCoordinates());var l,u,p=e.bounds,f=this.rotate;null!=f&&90===f&&(p.y=p.width/2),e.borderStyle===M.PdfBorderStyle.beveled||e.borderStyle===M.PdfBorderStyle.inset?(p.x=p.x+4*e.borderWidth,p.width=p.width-8*e.borderWidth):(p.x=p.x+2*e.borderWidth,p.width=p.width-4*e.borderWidth),s&&(f=(null==r||0===r.lineSpacing?n._getHeight():r.lineSpacing)-n._getAscent(r),i.indexOf("\n"),0===p.x&&1===p.y&&(p.y=-(p.y-f)),e.isAutoFontSize)&&0!==e.borderWidth&&(p.y=p.y+2.5*e.borderWidth),t._page&&void 0!==t._page.rotation&&t._page.rotation!==M.PdfRotationAngle.angle0||0<e.rotationAngle?(f=t.save(),void 0!==e.pageRotationAngle&&e.pageRotationAngle!==M.PdfRotationAngle.angle0&&(e.pageRotationAngle===M.PdfRotationAngle.angle90?(t.translateTransform({x:t._size.height,y:0}),t.rotateTransform(90),u=t._size.height-(p.x+p.width),p={x:p.y,y:u,width:p.height,height:p.width}):e.pageRotationAngle===M.PdfRotationAngle.angle180?(t.translateTransform({x:t._size.width,y:t._size.height}),t.rotateTransform(-180),p={x:t._size.width-(p.x+p.width),y:u=t._size.height-(p.y+p.height),width:p.width,height:p.height}):e.pageRotationAngle===M.PdfRotationAngle.angle270&&(t.translateTransform({x:0,y:t._size.width}),t.rotateTransform(270),p={x:t._size.width-(p.y+p.height),y:u=p.x,width:p.height,height:p.width})),e.rotationAngle&&(90===e.rotationAngle?e.pageRotationAngle===M.PdfRotationAngle.angle90?(t.translateTransform({x:0,y:t._size.height}),t.rotateTransform(-90),p={x:t._size.height-(p.y+p.height),y:u=p.x,width:p.height,height:p.width},e.stringFormat=new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle)):p.width>p.height?(t.translateTransform({x:0,y:t._size.height}),t.rotateTransform(-90),(p=e.bounds).y=p.width/2-8*e.borderWidth):(l=p.x,p.x=-(p.y+p.height),p.y=l,l=p.height,p.height=p.width>n._getHeight()?p.width:n._getHeight(),p.width=l,t.rotateTransform(-90)):270===e.rotationAngle?p={x:p.x,y:p.y,width:p.width-4*e.borderWidth,height:p.height}:180===e.rotationAngle&&(t.translateTransform({x:t._size.width,y:t._size.height}),t.rotateTransform(-180),p={x:t._size.width-(p.x+p.width),y:u=t._size.height-(p.y+p.height),width:p.width,height:p.height})),t.drawString(i,n,p,null,e.foreBrush,r),t.restore(f)):t.drawString(i,n,p,null,e.foreBrush,r),t._isTemplateGraphics&&e.required&&(t._sw._endMarkupSequence(),t.restore())}};var ze,Ue=He;function He(t,e,i,n){var r=ze.call(this)||this;return r._autoResizeText=!1,r._isTextChanged=!1,t&&e&&i&&r._initialize(t,e,i),n&&("text"in n&&k(n.text)&&(r.text=n.text),"toolTip"in n&&k(n.toolTip)&&(r.toolTip=n.toolTip),"color"in n&&k(n.color)&&(r.color=n.color),"border"in n&&k(n.border)&&(r.border=n.border),"backColor"in n&&k(n.backColor)&&(r.backColor=n.backColor),"borderColor"in n&&k(n.borderColor)&&(r.borderColor=n.borderColor),"font"in n)&&k(n.font)&&(r.font=n.font),r}t(Ge,We=Ve),Object.defineProperty(Ge.prototype,"actions",{get:function(){return this._actions||(this._actions=new Ee(this)),this._actions},enumerable:!0,configurable:!0}),Object.defineProperty(Ge.prototype,"text",{get:function(){var t;return this._isLoaded&&(void 0===this._text&&((t=this.itemAt(this._defaultIndex))&&t._mkDictionary&&t._mkDictionary.has("CA")?this._text=t._mkDictionary.get("CA"):this._mkDictionary&&this._mkDictionary.has("CA")&&(this._text=this._mkDictionary.get("CA"))),void 0===this._text)&&(t=Ds(this._dictionary,"V",!1,!0,"Parent"))&&(this._text=t),void 0===this._text&&(this._text=""),this._text},set:function(t){var e;this._isLoaded&&!this.readOnly&&((e=this.itemAt(this._defaultIndex))&&e._dictionary?this._assignText(e._dictionary,t):this._assignText(this._dictionary,t),this._text=t),this._isLoaded||this._text===t||(e=this.itemAt(this._defaultIndex),this._assignText(e._dictionary,t),this._text=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Ge.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(Ge.prototype,"highlightMode",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&void 0!==e.highlightMode?t=e.highlightMode:this._dictionary&&this._dictionary.has("H")&&(t=Ys(this._dictionary.get("H").name)),void 0!==t?t:M.PdfHighlightMode.invert},set:function(t){var e=this.itemAt(this._defaultIndex);!e||void 0!==e.highlightMode&&e.highlightMode===t?this._dictionary.has("H")&&Ys(this._dictionary.get("H"))===t||this._dictionary.update("H",Qs(t)):e.highlightMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ge.prototype,"font",{get:function(){var t;return this._font||(t=this.itemAt(this._defaultIndex),this._font=qa(this._form,t,this)),this._font},set:function(t){t&&t instanceof ce&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(Ge.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),Ge.prototype._assignText=function(t,e){var i;t&&t.has("MK")?i=t.get("MK"):(i=new D(this._crossReference),t.set("MK",i)),i.update("CA",e),t._updated=!0},Ge._load=function(t,e,i,n){var r=new Ge;return r._isLoaded=!0,r._form=t,r._dictionary=e,r._crossReference=i,r._ref=n,r._dictionary.has("Kids")&&(r._kids=r._dictionary.get("Kids")),r._defaultIndex=0,r._parsedItems=new Map,r},Ge.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._defaultIndex=0,this._dictionary=new D(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",R.get("Btn")),this._dictionary.update("T",e),this._fieldFlags|=M._FieldFlag.pushButton,this._initializeFont(this._defaultFont),this._createItem(i)},Ge.prototype._createItem=function(t){var e=new jn;e._create(this._page,t,this),e.textAlignment=M.PdfTextAlignment.center,this._stringFormat=new I(e.textAlignment,M.PdfVerticalAlignment.middle),e._dictionary.update("MK",new D(this._crossReference)),e._mkDictionary.update("BC",[0,0,0]),e._mkDictionary.update("BG",[.827451,.827451,.827451]),e._mkDictionary.update("CA",void 0!==this._name&&null!==this._name?this._name:this._actualName),this._addToKid(e)},Ge.prototype._doPostProcess=function(t){if((t=void 0===t?!1:t)||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._isLoaded)if(0<e)for(var i=0;i<e;i++)(n=this.itemAt(i))&&this._postProcess(t,n);else(t||this._form._setAppearance||this._setAppearance)&&!this._checkFieldFlag(this._dictionary)&&this._postProcess(t);else if(t||this._form._setAppearance||this._setAppearance)for(var n,r,s,i=0;i<e;i++)(n=this.itemAt(i))&&!this._checkFieldFlag(n._dictionary)&&(r=this._createAppearance(n),t?(s={x:n.bounds.x,y:n.bounds.y,width:r._size.width,height:r._size.height},this._drawTemplate(r,n._getPage(),s)):(this._addAppearance(n._dictionary,r,"N"),(s=this._createAppearance(n,!0))&&this._addAppearance(n._dictionary,s,"D")),n._dictionary._updated=!t);t&&(this._dictionary._updated=!1)}},Ge.prototype._postProcess=function(t,e){var i,n,r,s=e||this;null!=e&&e._setAppearance&&e._enableGrouping||this._form._setAppearance||this._setAppearance||t&&!s._dictionary.has("AP")?i=this._createAppearance(s):s._dictionary.has("AP")&&(e=void 0,n=s._dictionary.get("AP"))&&n.has("N")&&(e=n.get("N"),(n=n.getRaw("N"))&&(e.reference=n),e&&e instanceof D&&s._dictionary.has("AS")&&(n=s._dictionary.get("AS"))&&n instanceof R&&e.has(n.name)&&(r=e.getRaw(n.name),n=e.get(n.name),r)&&n&&n instanceof y&&((e=n).reference=r),e)&&(i=new P(e,this._crossReference)),i&&(t?((n=s instanceof jn?s._getPage():s.page)&&((r=n.graphics).save(),n.rotation===M.PdfRotationAngle.angle90?(r.translateTransform({x:r._size.width,y:r._size.height}),r.rotateTransform(90)):n.rotation===M.PdfRotationAngle.angle180?(r.translateTransform({x:r._size.width,y:r._size.height}),r.rotateTransform(-180)):n.rotation===M.PdfRotationAngle.angle270&&(r.translateTransform({x:r._size.width,y:r._size.height}),r.rotateTransform(270)),e={x:s.bounds.x,y:s.bounds.y,width:i._size.width,height:i._size.height},r.drawTemplate(i,e),r.restore()),s._dictionary._updated=!1):this._addAppearance(s._dictionary,i,"N"))},Ge.prototype._createAppearance=function(t,e){void 0===e&&(e=!1);var i,n,r,s=t.bounds,a=new P([0,0,s.width,s.height],this._crossReference),o=new or,s=!(o.bounds={x:0,y:0,width:s.width,height:s.height}),h=!1,c=t.backColor,_=(c&&!c.isTransparent&&(o.backBrush=new A(c)),o.foreBrush=new A(t.color),t.border);if(t.borderColor&&(o.borderPen=new x(t.borderColor,_.width),Po(_,o)),o.borderWidth=_.width,o.borderStyle=_.style,c&&(c=[c.r-64,c.g-64,c.b-64],o.shadowBrush=new A({r:(c=[0<=c[0]?c[0]:0,0<=c[1]?c[1]:0,0<=c[2]?c[2]:0])[0],g:c[1],b:c[2]})),o.rotationAngle=t.rotate,(s=null!=t&&t instanceof jn&&t._enableGrouping?!0:s)?(i=t._mkDictionary&&t._mkDictionary&&t._mkDictionary.has("CA")?t._mkDictionary.get("CA"):"",void 0!==t.font&&null!==t.font.size&&0!==t.font.size&&(n=t.font),r=new I(t.textAlignment,M.PdfVerticalAlignment.middle)):void 0!==this._font&&null!==this._font||(this._font=this._defaultFont),this._isLoaded&&t instanceof jn&&null!=t&&t._defaultAppearance){var d,l,c=t._defaultAppearance.fontName,u=(null==c&&(c="Helvetica"),t._defaultAppearance.fontSize),p=(null==u?u=this._defaultFont.size:0===u&&(h=!0),void 0),f=(this._stringFormat=new I,this._stringFormat.lineAlignment=M.PdfVerticalAlignment.middle,this._stringFormat.alignment=M.PdfTextAlignment.center,(p=null!=(l=null!=u&&c?Ya(c,u,M.PdfFontStyle.regular,t):l)?l:this._defaultFont).measureString(this.text,this._stringFormat));if(h&&p&&p instanceof E&&this._isLoaded&&!t._dictionary.has("AP")){for(var g=t.bounds.width-8*_.width,y=t.bounds.height-8*_.width;f.width<g||f.height<y;)if((f=(p=new E((d=p).fontFamily,p._size+1)).measureString(this.text,this._stringFormat)).width>g||f.height>y){p=d;break}this._font=p}}return s?e?this._drawPressedButton(a.graphics,o,i,n,r):this._drawButton(a.graphics,o,i,n,r):e?this._drawPressedButton(a.graphics,o,this.text,this._font,this._stringFormat):this._drawButton(a.graphics,o,this.text,this._font,this._stringFormat),a},Ge.prototype._drawButton=function(t,e,i,n,r){this._drawRectangularControl(t,e);var s,a,o,h=e.bounds;t._page&&void 0!==t._page.rotation&&t._page.rotation!==M.PdfRotationAngle.angle0||0<e.rotationAngle?(s=t.save(),void 0!==e.pageRotationAngle&&e.pageRotationAngle!==M.PdfRotationAngle.angle0&&(e.pageRotationAngle===M.PdfRotationAngle.angle90?(t.translateTransform({x:t._size.height,y:0}),t.rotateTransform(90),o=t._size.height-(h.x+h.width),h={x:h.y,y:o,width:h.height,height:h.width}):e.pageRotationAngle===M.PdfRotationAngle.angle180?(t.translateTransform({x:t._size.width,y:t._size.height}),t.rotateTransform(-180),h={x:t._size.width-(h.x+h.width),y:o=t._size.height-(h.y+h.height),width:h.width,height:h.height}):e.pageRotationAngle===M.PdfRotationAngle.angle270&&(t.translateTransform({x:0,y:t._size.width}),t.rotateTransform(270),h={x:t._size.width-(h.y+h.height),y:o=h.x,width:h.height,height:h.width})),e.rotationAngle&&(90===e.rotationAngle?e.pageRotationAngle===M.PdfRotationAngle.angle90?(t.translateTransform({x:0,y:t._size.height}),t.rotateTransform(-90),h={x:t._size.height-(h.y+h.height),y:o=h.x,width:h.height,height:h.width}):h.width>h.height?(t.translateTransform({x:0,y:t._size.height}),t.rotateTransform(-90),h={x:t._size.height-(h.y+h.height),y:o=h.x,width:h.height,height:h.width},r._wordWrapType=M._PdfWordWrapType.none):(a=h.x,h.x=-(h.y+h.height),h.y=a,a=h.height,h.height=h.width>n._getHeight()?h.width:n._getHeight(),h.width=a,t.rotateTransform(-90)):270===e.rotationAngle?(t.translateTransform({x:t._size.width,y:0}),t.rotateTransform(-270),h={x:h.y,y:o=t._size.width-(h.x+h.width),width:h.height,height:h.width},r._wordWrapType=M._PdfWordWrapType.none):180===e.rotationAngle&&(t.translateTransform({x:t._size.width,y:t._size.height}),t.rotateTransform(-180),h={x:t._size.width-(h.x+h.width),y:o=t._size.height-(h.y+h.height),width:h.width,height:h.height})),t.drawString(i,n,h,null,e.foreBrush,r),t.restore(s)):t.drawString(i,n,h,null,e.foreBrush,r)},Ge.prototype._drawPressedButton=function(t,e,i,n,r){e.borderStyle===M.PdfBorderStyle.inset?t.drawRectangle(e.bounds,e.shadowBrush):t.drawRectangle(e.bounds,e.backBrush),this._drawBorder(t,e.bounds,e.borderPen,e.borderStyle,e.borderWidth);var s={x:e.borderWidth,y:e.borderWidth,width:e.bounds.width-e.borderWidth,height:e.bounds.height-e.borderWidth};switch(t.drawString(i,n,s,null,e.foreBrush,r),e.borderStyle){case M.PdfBorderStyle.inset:this._drawLeftTopShadow(t,e.bounds,e.borderWidth,this._grayBrush),this._drawRightBottomShadow(t,e.bounds,e.borderWidth,this._silverBrush);break;case M.PdfBorderStyle.beveled:this._drawLeftTopShadow(t,e.bounds,e.borderWidth,e.shadowBrush),this._drawRightBottomShadow(t,e.bounds,e.borderWidth,this._whiteBrush);break;default:this._drawLeftTopShadow(t,e.bounds,e.borderWidth,e.shadowBrush)}};var We,qe=Ge;function Ge(t,e,i,n){var r=We.call(this)||this;return t&&e&&i&&r._initialize(t,e,i),n&&("text"in n&&k(n.text)&&(r.text=n.text),"toolTip"in n&&k(n.toolTip)&&(r.toolTip=n.toolTip),"color"in n&&k(n.color)&&(r.color=n.color),"border"in n&&k(n.border)&&(r.border=n.border),"backColor"in n&&k(n.backColor)&&(r.backColor=n.backColor),"borderColor"in n&&k(n.borderColor)&&(r.borderColor=n.borderColor),"highlightMode"in n)&&k(n.highlightMode)&&(r.highlightMode=n.highlightMode),r}t(Je,Ke=Ve),Je._load=function(t,e,i,n){var r=new Je;return r._isLoaded=!0,r._form=t,r._dictionary=e,r._crossReference=i,r._ref=n,r._defaultIndex=0,r._parsedItems=new Map,r._dictionary.has("Kids")?r._kids=r._dictionary.get("Kids"):((t=Un._load(e,i,r))._isLoaded=!0,t._ref=n,r._parsedItems.set(0,t)),r},Je.prototype.itemAt=function(t){if(t<0||0!==t&&t>=this._kidsCount)throw Error("Index out of range.");var e,i,n;return this._parsedItems.has(t)?e=this._parsedItems.get(t):(i=void 0,0<=t&&this._kids&&0<this._kids.length&&t<this._kids.length&&(i=(n=this._kids[t])&&n instanceof m?this._crossReference._fetch(n):i)&&((e=Un._load(i,this._crossReference,this))._isLoaded=!0,e._ref=n,this._parsedItems.set(t,e))),e},Object.defineProperty(Je.prototype,"font",{get:function(){var t;return this._font||(t=this.itemAt(this._defaultIndex),this._font=qa(this._form,t,this)),this._font},set:function(t){t&&t instanceof ce&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(Je.prototype,"checked",{get:function(){return 0<this._kidsCount?this.itemAt(this._defaultIndex).checked:ca(this._dictionary)},set:function(t){if(this.checked!==t){var e;if(this._crossReference&&this._crossReference._document&&this._crossReference._document._isFormImport&&0<this._kidsCount)if((i=this.itemAt(this._defaultIndex)).checked!==t)return void(i.checked=t);if(0<this._kidsCount)for(var i,n=0;n<this._kidsCount;n++)(i=this.itemAt(n)).checked!==t&&(i.checked=t);t?this._isLoaded?(e=_a((0<this._kidsCount?this.itemAt(this._defaultIndex):this)._dictionary),this._dictionary.update("V",R.get(e)),this._dictionary.update("AS",R.get(e))):(this._dictionary.update("V",R.get(this.exportValue)),this._dictionary.update("AS",R.get(this.exportValue))):(this._dictionary.has("V")&&delete this._dictionary._map.V,this._dictionary.has("AS")&&delete this._dictionary._map.AS),this._dictionary._updated=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(Je.prototype,"exportValue",{get:function(){return(!this._isLoaded||"string"!=typeof this._exportValue||"Yes"===this._exportValue)&&this._isLoaded?_a(this._dictionary):this._exportValue},set:function(t){this.itemAt(this._defaultIndex)&&(this.itemAt(this._defaultIndex).exportValue=t),this._dictionary.has("V")||""===t||(this._exportValue=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Je.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(Je.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(Je.prototype,"borderColor",{get:function(){return this._parseBorderColor(!0)},set:function(t){this._updateBorderColor(t,!0),this._isLoaded&&(this._setAppearance=!0)},enumerable:!0,configurable:!0}),Je.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._defaultIndex=0,this._dictionary=new D(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",R.get("Btn")),this._dictionary.update("T",e),this._createItem(i)},Je.prototype._createItem=function(t){var e=new Un;e._create(this._page,t,this),e.textAlignment=M.PdfTextAlignment.center,this._stringFormat=new I(e.textAlignment,M.PdfVerticalAlignment.middle),e._dictionary.update("MK",new D(this._crossReference)),e._mkDictionary.update("BC",[0,0,0]),e._mkDictionary.update("BG",[1,1,1]),e.style=M.PdfCheckBoxStyle.check,e._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg"),this._addToKid(e)},Je.prototype._doPostProcess=function(t){void 0===t&&(t=!1);var e=this._kidsCount;if(this._isLoaded){if(t||this._setAppearance||this._dictionary._updated||this._isImport)if(0<e)for(o=0;o<e;o++)(n=this.itemAt(o))&&(this._checkFieldFlag(n._dictionary)||(t?(s=void 0,r=n.checked?M._PdfCheckFieldState.checked:M._PdfCheckFieldState.unchecked,s=this._setAppearance||this._form._setAppearance||!n._dictionary.has("AP")?this._createAppearance(n,r):da(r,n),this._drawTemplate(s,n._getPage(),n.bounds)):!this._setAppearance&&!this._form._setAppearance&&n._isLoaded||(n._postProcess(n.checked?n.exportValue:"Off"),this._drawAppearance(n,n.exportValue))),n._dictionary._updated=!t);else{var i=this.checked?M._PdfCheckFieldState.checked:M._PdfCheckFieldState.unchecked;this._drawTemplate(da(i,this),this.page,this.bounds)}}else for(var n,r,s,a,o=0;o<e;o++)(n=this.itemAt(o))&&(r=n.checked?M._PdfCheckFieldState.checked:M._PdfCheckFieldState.unchecked,n._postProcess(n.checked?n.exportValue:"Off"),t?(s=this._createAppearance(n,r),this._drawTemplate(s,n._getPage(),n.bounds)):(a=void 0,a=""===n.exportValue?"Yes":n.exportValue,this._drawAppearance(n,a)),n._dictionary._updated=!t);this._dictionary._updated=!t},Je.prototype._createAppearance=function(t,e){var i=t.bounds,n=new or,i=(n.bounds={x:0,y:0,width:i.width,height:i.height},t.backColor),r=(i&&!i.isTransparent&&(n.backBrush=new A(i)),n.foreBrush=new A(t.color),t.border),i=(t.borderColor&&(n.borderPen=new x(t.borderColor,r.width)),n.borderWidth=r.width,n.borderStyle=r.style,i&&(r=[i.r-64,i.g-64,i.b-64],n.shadowBrush=new A({r:0<=r[0]?r[0]:0,g:0<=r[1]?r[1]:0,b:0<=r[2]?r[2]:0})),n.rotationAngle=t.rotate,new P(n.bounds,this._crossReference)),r=i.graphics;return t._styleText?this._drawCheckBox(r,n,t._styleText,e):this._drawCheckBox(r,n,ga(t._style),e),i},Je.prototype._drawAppearance=function(t,e){var i=new D,n=(t._dictionary.has("AP")?((i=t._dictionary.get("AP"))&&(i.has("N")&&Ea(i.get("N"),this._crossReference,"Yes","Off"),i.has("D"))&&Ea(i.get("D"),this._crossReference,"Yes","Off"),T(i,this._crossReference,"N"),T(i,this._crossReference,"D")):(n=this._crossReference._getNextReference(),i=new D(this._crossReference),this._crossReference._cacheMap.set(n,i),t._dictionary.update("AP",n)),this._createAppearance(t,M._PdfCheckFieldState.checked)),r=this._crossReference._getNextReference(),n=(this._crossReference._cacheMap.set(r,n._content),this._createAppearance(t,M._PdfCheckFieldState.unchecked)),s=this._crossReference._getNextReference(),n=(this._crossReference._cacheMap.set(s,n._content),new D(this._crossReference)),r=(null!=e?n.update(e,r):n.update("Yes",r),n.update("Off",s),this._crossReference._getNextReference()),s=(this._crossReference._cacheMap.set(r,n),i.update("N",r),this._createAppearance(t,M._PdfCheckFieldState.pressedChecked)),n=this._crossReference._getNextReference(),r=(this._crossReference._cacheMap.set(n,s._content),this._createAppearance(t,M._PdfCheckFieldState.pressedUnchecked)),s=this._crossReference._getNextReference(),r=(this._crossReference._cacheMap.set(s,r._content),new D(this._crossReference)),e=(null!=e?r.update(e,n):r.update("Yes",n),r.update("Off",s),this._crossReference._getNextReference());this._crossReference._cacheMap.set(e,r),i.update("D",e),t._dictionary._updated=!0};var Ke,Xe=Je;function Je(t,e,i,n){var r=Ke.call(this)||this;return i&&t&&e&&r._initialize(i,t,e),n&&("toolTip"in n&&k(n.toolTip)&&(r.toolTip=n.toolTip),"color"in n&&k(n.color)&&(r.color=n.color),"border"in n&&k(n.border)&&(r.border=n.border),"backColor"in n&&k(n.backColor)&&(r.backColor=n.backColor),"borderColor"in n&&k(n.borderColor)&&(r.borderColor=n.borderColor),"checked"in n)&&k(n.checked)&&(r.checked=n.checked),r}t(Ze,Ye=Ve),Ze._load=function(t,e,i,n){var r=new Ze;return r._isLoaded=!0,r._form=t,r._dictionary=e,r._crossReference=i,r._ref=n,r._dictionary.has("Kids")&&(r._kids=r._dictionary.get("Kids")),r._defaultIndex=0,r._parsedItems=new Map,0<r._kidsCount&&r._retrieveOptionValue(),r},Object.defineProperty(Ze.prototype,"checked",{get:function(){var t=!1;return t=0<this._kidsCount?this.itemAt(this._defaultIndex).checked:t},enumerable:!0,configurable:!0}),Object.defineProperty(Ze.prototype,"selectedIndex",{get:function(){return this._isLoaded&&-1===this._selectedIndex&&(this._selectedIndex=this._obtainSelectedIndex()),this._selectedIndex},set:function(t){if(this.selectedIndex!==t){var e,i=this.itemAt(t),n=(this._hasDuplicates=this._hasDuplicateItems(),!1),r=!1;this._isLoaded?(n=this.allowUnisonSelection,0<=this.selectedIndex&&(e=this.itemAt(this.selectedIndex))&&e._dictionary&&e._dictionary.has("AS")&&e._dictionary.get("AS").name===e.value&&(r=!0)):n=!(!this.allowUnisonSelection||!this._isUserRequired);for(var s=0;s<this._kidsCount;s++){var a=this.itemAt(s);n&&!this._isLoaded||n&&r&&this._isLoaded?a.value===i.value?(a._dictionary.update("AS",R.get(a.value)),this._dictionary.update("V",R.get(a.value)),this._dictionary.update("DV",R.get(a.value))):a._dictionary.update("AS",R.get("Off")):s===t?this._hasDuplicates?(a._dictionary.update("AS",R.get(s.toString())),this._dictionary.update("V",R.get(s.toString())),this._dictionary.update("DV",R.get(s.toString()))):(a._dictionary.update("AS",R.get(a.value)),this._dictionary.update("V",R.get(a.value)),this._dictionary.update("DV",R.get(a.value))):a._dictionary.update("AS",R.get("Off"))}this._selectedIndex=t}},enumerable:!0,configurable:!0}),Ze.prototype._hasDuplicateItems=function(){if(2<this._kidsCount||2<this.itemsCount){for(var t=new Set,e=new Set,i=0;i<this._kidsCount;i++){var n=this.itemAt(i);t.has(n.value)?e.has(n.value)||e.add(n.value):t.add(n.value)}return 0<e.size}return!1},Object.defineProperty(Ze.prototype,"allowUnisonSelection",{get:function(){return 0!=(this._fieldFlags&M._FieldFlag.radiosInUnison)&&(this._allowUnisonSelection=!0),this._allowUnisonSelection},set:function(t){t&&(this._fieldFlags|=M._FieldFlag.radiosInUnison),this._isUserRequired=t,this._allowUnisonSelection=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ze.prototype,"borderColor",{get:function(){return this._parseBorderColor(!this._isLoaded)},set:function(t){this._updateBorderColor(t,!0)},enumerable:!0,configurable:!0}),Ze.prototype.itemAt=function(t){if(t<0||0!==t&&t>=this._kidsCount)throw Error("Index out of range.");var e,i,n;return this._parsedItems.has(t)?e=this._parsedItems.get(t):(i=void 0,0<=t&&this._kids&&0<this._kids.length&&t<this._kids.length&&(i=(n=this._kids[t])&&n instanceof m?this._crossReference._fetch(n):i)&&((e=qn._load(i,this._crossReference,this))._ref=n,e._index=t,this._parsedItems.set(t,e))),e},Ze.prototype.add=function(t,e){return t instanceof qn?(t._field=this,t._dictionary.update("Parent",this._ref),t._setField(this),this._kidsCount):new qn(t,e,this)},Ze.prototype.removeItemAt=function(i){var n,t,e=this.itemAt(i);e&&e._ref&&((t=e._getPage())&&t._removeAnnotation(e._ref),this._kids.splice(i,1),this._dictionary.set("Kids",this._kids),this._dictionary._updated=!0,this._parsedItems.delete(i),0<this._parsedItems.size&&(n=new Map,this._parsedItems.forEach(function(t,e){i<e?n.set(e-1,t):n.set(e,t)}),this._parsedItems=n),this._dictionary.has("Opt"))&&(t=this._dictionary.getArray("Opt"))&&0<t.length&&(t.splice(i,1),this._dictionary.set("Opt",t))},Ze.prototype.removeItem=function(t){t&&t._ref&&-1!==(t=this._kids.indexOf(t._ref))&&this.removeItemAt(t)},Ze.prototype._initialize=function(t,e){this._defaultIndex=0,this._crossReference=t._crossReference,this._page=t,this._name=e,this._dictionary=new D(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",R.get("Btn")),this._dictionary.update("T",e),this._parsedItems=new Map,this._fieldFlags|=M._FieldFlag.radio},Ze.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt");if(t&&0<t.length)for(var e=this._kidsCount,i=t.length<=e?t.length:e,n=0;n<i;n++)t[n]&&(this.itemAt(n)._optionValue=t[n])}},Ze.prototype._obtainSelectedIndex=function(){for(var t=-1,e=0;e<this._kidsCount;++e){var i=this.itemAt(e);if(i){var n=Ds(i._dictionary,"V",!1,!0,"Parent");if(n&&i._dictionary.has("AS")){var r=i._dictionary.get("AS");if(r&&"off"!==r.name.toLowerCase())if(n instanceof R&&"off"!==n.name.toLowerCase()){if(r.name===n.name||i._optionValue===n.name){t=e;break}}else if("string"==typeof n&&"off"!==n.toLowerCase()&&(r.name===n||i._optionValue===n)){t=e;break}}}}return t},Ze.prototype._doPostProcess=function(t){void 0===t&&(t=!1),this._hasDuplicates=this._hasDuplicateItems();var e=this._kidsCount;if(this._isLoaded)if(0<e)for(var i=0;i<e;i++)(s=this.itemAt(i))&&!this._checkFieldFlag(s._dictionary)&&(t?(r=void 0,a=this.selectedIndex===i?M._PdfCheckFieldState.checked:M._PdfCheckFieldState.unchecked,r=this._setAppearance||this._form._setAppearance||!s._dictionary.has("AP")?this._createAppearance(s,a):da(a,s),this._drawTemplate(r,s._getPage(),s.bounds)):!this._setAppearance&&!this._form._setAppearance&&s._isLoaded||(s._postProcess(this.allowUnisonSelection?0<=this.selectedIndex&&s.value===this.itemAt(this.selectedIndex).value?s.value:"Off":this._hasDuplicates?this.selectedIndex===i?i.toString():"Off":this.selectedIndex===i?s.value:"Off"),this._drawAppearance(s)),s._dictionary._updated=!t);else{var n=-1!==this.selectedIndex?M._PdfCheckFieldState.checked:M._PdfCheckFieldState.unchecked;this._drawTemplate(da(n,this),this.page,this.bounds)}else for(i=0;i<e;i++){var r,s=this.itemAt(i),a=this.selectedIndex===i?M._PdfCheckFieldState.checked:M._PdfCheckFieldState.unchecked;this._isDuplicatePage||s._dictionary.update("AS",R.get(this.selectedIndex===i?s.value:"Off")),t?(r=this._createAppearance(s,a),this._drawTemplate(r,s._getPage(),s.bounds)):this._isDuplicatePage||(s._postProcess(this.allowUnisonSelection&&this._isUserRequired?0<=this.selectedIndex&&s.value===this.itemAt(this.selectedIndex).value?s.value:"Off":this._hasDuplicates?this.selectedIndex===i?i.toString():"Off":this.selectedIndex===i?s.value:"Off"),this._drawAppearance(s)),s._dictionary._updated=!t}this._dictionary._updated=!t},Ze.prototype._createAppearance=function(t,e){var i=t.bounds,n=new or,i=(n.bounds={x:0,y:0,width:i.width,height:i.height},t.backColor),r=(i&&(n.backBrush=new A(i)),n.foreBrush=new A(t.color),t.border),r=(t.borderColor&&(n.borderPen=new x(t.borderColor,r.width)),n.borderWidth=r.width,n.borderStyle=r.style,i&&(r=[i.r-64,i.g-64,i.b-64],n.shadowBrush=new A({r:(i=[0<=r[0]?r[0]:0,0<=r[1]?r[1]:0,0<=r[2]?r[2]:0])[0],g:i[1],b:i[2]})),n.rotationAngle=t.rotate,new P(n.bounds,this._crossReference)),i=r.graphics;return t._styleText?this._drawRadioButton(i,n,t._styleText,e):this._drawRadioButton(i,n,ga(t.style),e),r},Ze.prototype._drawAppearance=function(t){var e=new D,i=(t._dictionary.has("AP")?((e=t._dictionary.get("AP"))&&(e.has("N")&&Ea(e.get("N"),this._crossReference,t.value,"Off"),e.has("D"))&&Ea(e.get("D"),this._crossReference,t.value,"Off"),T(e,this._crossReference,"N"),T(e,this._crossReference,"D")):(i=this._crossReference._getNextReference(),e=new D(this._crossReference),this._crossReference._cacheMap.set(i,e),t._dictionary.update("AP",i)),this._createAppearance(t,M._PdfCheckFieldState.checked)),n=this._crossReference._getNextReference(),i=(this._crossReference._cacheMap.set(n,i._content),this._createAppearance(t,M._PdfCheckFieldState.unchecked)),r=this._crossReference._getNextReference(),i=(this._crossReference._cacheMap.set(r,i._content),new D(this._crossReference)),s=t._field,s=this._isLoaded?!s.allowUnisonSelection&&this._hasDuplicates?t._index.toString():t.value:!(this.allowUnisonSelection&&this._isUserRequired&&s.allowUnisonSelection)&&this._hasDuplicates?t._index.toString():t.value,n=(!s&&t._enableGrouping&&(s="check"+t._index),i.update(s,n),i.update("Off",r),this._crossReference._getNextReference()),r=(this._crossReference._cacheMap.set(n,i),e.update("N",n),this._createAppearance(t,M._PdfCheckFieldState.pressedChecked)),i=this._crossReference._getNextReference(),n=(this._crossReference._cacheMap.set(i,r._content),this._createAppearance(t,M._PdfCheckFieldState.pressedUnchecked)),r=this._crossReference._getNextReference(),n=(this._crossReference._cacheMap.set(r,n._content),new D(this._crossReference)),s=(n.update(s,i),n.update("Off",r),this._crossReference._getNextReference());this._crossReference._cacheMap.set(s,n),e.update("D",s),t._dictionary._updated=!0};var Ye,Qe=Ze;function Ze(t,e,i){var n=Ye.call(this)||this;return n._selectedIndex=-1,n._allowUnisonSelection=!1,n._hasDuplicates=!1,t&&e&&n._initialize(t,e),i&&("items"in i&&k(i.items)&&i.items.forEach(function(t){n.add(new qn(t.name,t.bounds,n))}),"toolTip"in i&&k(i.toolTip)&&(n.toolTip=i.toolTip),"color"in i&&k(i.color)&&(n.color=i.color),"border"in i&&k(i.border)&&(n.border=i.border),"backColor"in i&&k(i.backColor)&&(n.backColor=i.backColor),"borderColor"in i&&k(i.borderColor)&&(n.borderColor=i.borderColor),"allowUnisonSelection"in i&&k(i.allowUnisonSelection)&&(n.allowUnisonSelection=i.allowUnisonSelection),"selectedIndex"in i)&&k(i.selectedIndex)&&(n.selectedIndex=i.selectedIndex),n}t(ei,$e=Ve),Object.defineProperty(ei.prototype,"itemsCount",{get:function(){return this._options.length},enumerable:!0,configurable:!0}),Object.defineProperty(ei.prototype,"bounds",{get:function(){var t,e=this.itemAt(this._defaultIndex);return e&&(e._page=this.page),e&&e.bounds?t=e.bounds:this._dictionary.has("Rect")&&(t=Ls(this._dictionary,this.page)),t||this._bounds||t},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");var e=this.itemAt(this._defaultIndex);this._isLoaded?void 0===e||this._dictionary.has("Rect")?this._dictionary.update("Rect",Es([t.x,t.y,t.width,t.height],this.page)):(e._page=this.page,e.bounds=t):e?(e._page=this.page,e.bounds=t):this._bounds=t},enumerable:!0,configurable:!0}),Object.defineProperty(ei.prototype,"selectedIndex",{get:function(){var t=this._dictionary.get("I");return void 0===t?[]:1===t.length?t[0]:t},set:function(t){var e,i=this,n=this._options.length;"number"==typeof t?(this._checkIndex(t,n),this._dictionary.update("I",[t]),this._dictionary.update("V",[this._options[t][0]])):(e=[],t.forEach(function(t){i._checkIndex(t,n),e.push(i._options[t][0])}),this._dictionary.update("I",t),this._dictionary.update("V",e))},enumerable:!0,configurable:!0}),Object.defineProperty(ei.prototype,"selectedValue",{get:function(){var t,e=this,i=[];return this._dictionary&&this._dictionary.has("V")&&void 0!==(t=this._dictionary.getArray("V"))&&(Array.isArray(t)?i.push.apply(i,t):"string"==typeof t&&i.push(t)),0===i.length&&this._dictionary&&this._dictionary.has("I")&&(t=this._dictionary.get("I"))&&0<t.length&&i.push.apply(i,t.map(function(t){return e._options[t][0]})),1===i.length?i[0]:i},set:function(t){var e,i,n,r=this;"string"==typeof t?-1!==(e=this._tryGetIndex(t))&&(this._dictionary.update("I",[e]),this._dictionary.update("V",[t])):(i=[],n=[],t.forEach(function(t){var e=r._tryGetIndex(t);-1!==e&&(n.push(e),i.push(t))}),0<i.length&&(this._dictionary.update("I",n),this._dictionary.update("V",i)))},enumerable:!0,configurable:!0}),Object.defineProperty(ei.prototype,"multiSelect",{get:function(){return this._isLoaded?0!=(this._fieldFlags&M._FieldFlag.multiSelect):this._multiSelect},set:function(t){this.multiSelect!==t&&((this._multiSelect=t)?this._fieldFlags|=M._FieldFlag.multiSelect:this._fieldFlags&=~M._FieldFlag.multiSelect)},enumerable:!0,configurable:!0}),Object.defineProperty(ei.prototype,"editable",{get:function(){return this._isLoaded?0!=(this._fieldFlags&M._FieldFlag.edit):this._editable},set:function(t){this._editable!==t&&((this._editable=t)?this._fieldFlags|=M._FieldFlag.edit:this._fieldFlags&=~M._FieldFlag.edit)},enumerable:!0,configurable:!0}),Object.defineProperty(ei.prototype,"font",{get:function(){var t;return this._font||(t=this.itemAt(this._defaultIndex),this._font=qa(this._form,t,this)),this._font},set:function(t){t&&t instanceof ce&&(this._font=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(ei.prototype,"textAlignment",{get:function(){return this._getTextAlignment()},set:function(t){this._textAlignment!==t&&this._setTextAlignment(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ei.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(ei.prototype,"_options",{get:function(){return this._optionArray||(this._dictionary&&this._dictionary.has("Opt")?this._optionArray=this._dictionary.getArray("Opt"):(this._optionArray=[],this._dictionary.update("Opt",this._optionArray))),this._optionArray},enumerable:!0,configurable:!0}),ei.prototype.itemAt=function(t){var e,i,n;return t<this._kidsCount?this._parsedItems.has(t)?e=this._parsedItems.get(t):(i=void 0,(i=(n=this._kids[t])&&n instanceof m?this._crossReference._fetch(n):i)&&((e=Xn._load(i,this._crossReference,this))._index=t,e._ref=n,this._options&&0<this._options.length&&t<this._options.length?e._text=this._options[t][1]:e._text="",this._parsedItems.set(t,e))):this._parsedItems.has(t)?e=this._parsedItems.get(t):0<this._kidsCount&&this._kids&&0<this._kids.length&&(n=i=void 0,i=(n=1===this._kidsCount?this._kids[0]:this._kids[t])&&n instanceof m?this._crossReference._fetch(n):i)&&((e=Xn._load(i,this._crossReference,this))._index=t,e._ref=n,this._options&&0<this._options.length&&t<this._options.length?e._text=this._options[t][1]:e._text="",this._parsedItems.set(t,e)),e},ei.prototype.addItem=function(t){return this._addToOptions(t,this),this._listValues.length-1},ei.prototype.removeItemAt=function(i){var n,t=this.itemAt(i);t&&t._ref&&(this._parsedItems.delete(i),0<this._parsedItems.size&&(n=new Map,this._parsedItems.forEach(function(t,e){i<e?n.set(e-1,t):n.set(e,t)}),this._parsedItems=n),this._dictionary)&&this._dictionary.has("Opt")&&(t=this._options)&&0<t.length&&(t.splice(i,1),this._dictionary.set("Opt",t),this._optionArray=t,this._dictionary._updated=!0)},ei.prototype.removeItem=function(t){if(t&&t.text){for(var e=void 0,i=0;i<this.itemsCount;i++){var n=this.itemAt(i);if(n&&t===n&&n.text===t.text){e=i;break}}-1!==e&&this.removeItemAt(e)}},ei.prototype._initialize=function(t,e,i){this._defaultIndex=0,this._crossReference=t._crossReference,this._page=t,this._name=e,this._dictionary=new D(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",R.get("Ch")),this._dictionary.update("T",e),this._parsedItems=new Map,this._listValues=[],this._kids=[],this.bounds=i,this._addEmptyWidget()},ei.prototype._obtainFont=function(t){var i,e,n,r,s,a,o="",h=1;if(t&&(t._dictionary.has("DS")||t._dictionary.has("DA"))){switch(t._dictionary.has("DS")?t._dictionary.get("DS").split(";").forEach(function(t){var e=t.split(":");if(-1!==t.indexOf("font-family"))o=e[1];else if(-1!==t.indexOf("font-size"))e[1].endsWith("pt")&&(h=Number.parseFloat(e[1].replace("pt","")));else if(-1===t.indexOf("font-style")&&-1!==t.indexOf("font")){for(e[1].split(" ").forEach(function(t){""===t||t.endsWith("pt")||(o+=t+" "),t.endsWith("pt")&&(h=Number.parseFloat(t.replace("pt","")))});" "!==o&&o.endsWith(" ");)o=o.substring(0,o.length-2);-1!==o.indexOf(",")&&(o=o.split(",")[0])}}):(t=t._dictionary.get("DA"))&&""!==t&&-1!==t.indexOf("Tf")&&((i=t.split(" ")).forEach(function(t,e){if(-1!==t.indexOf("Tf")){for(o=i[e-2];""!==o&&1<o.length&&"/"===o[0];)o=o.substring(1);h=Number.parseFloat(i[e-1])}}),(t=0)===h)&&null!==(e=new E(M.PdfFontFamily.helvetica,t))&&(t=this._getFontHeight(e._fontFamily),!Number.isNaN(t)&&0!==t||(t=12),e._size=t,h=t),o=(o=o.trim())&&So(o)){case"Helv":this._font=new E(M.PdfFontFamily.helvetica,h,M.PdfFontStyle.regular);break;case"Courier":case"Cour":this._font=new E(M.PdfFontFamily.courier,h,M.PdfFontStyle.regular);break;case"Symb":this._font=new E(M.PdfFontFamily.symbol,h,M.PdfFontStyle.regular);break;case"TiRo":this._font=new E(M.PdfFontFamily.timesRoman,h,M.PdfFontStyle.regular);break;case"ZaDb":this._font=new E(M.PdfFontFamily.zapfDingbats,h,M.PdfFontStyle.regular);break;default:this._font=new E(M.PdfFontFamily.helvetica,h,M.PdfFontStyle.regular)}this._font&&this._font._dictionary&&this._font._dictionary.has("BaseFont")&&(e=this._font._dictionary.get("BaseFont").name)&&e!==o&&this.form._dictionary.has("DR")&&(t=this.form._dictionary.get("DR").get("Font"))&&t.has(o)&&(t=(e=t.get(o)).get("Subtype").name,e)&&o&&e.has("BaseFont")&&(n=e.get("BaseFont"),a=M.PdfFontStyle.regular,n)&&null!==n.name&&void 0!==n.name&&(a=Ja(n.name),t&&"TrueType"===t?(r=bo(this.form,e))&&0<r.length&&(s=Is(r))&&0<s.length&&(this._font=new ye(s,h,a)):t&&"Type0"===t&&(r=eo(e))&&0<r.length&&(s=Is(r))&&0<s.length&&(this._font=new ye(s,h,a)))}return this._font},ei.prototype._obtainSelectedValue=function(){var t,e,i=this,n=[];return this._dictionary.has("V")?(e=this._dictionary.get("V"),t=this._dictionary.getArray("V"),null!=e&&("string"==typeof e?n.push(e):Array.isArray(e)&&n.push.apply(n,t))):null!=(e=this._dictionary.get("I"))&&0<e.length&&-1<e[0]&&this._options&&0<this._options.length&&n.push.apply(n,e.map(function(t){return i._options[t][0]})),n},ei.prototype._doPostProcess=function(t){if((t=void 0===t?!1:t)||this._setAppearance||this._form._setAppearance){var e=this._kidsCount;if(this._kids&&0<this._kids.length)if(1<e)for(var i=0;i<e;i++)(r=this.itemAt(i))&&!this._checkFieldFlag(r._dictionary)&&(s=this._createAppearance(r),t?(n=r._getPage())&&this._drawTemplate(s,n,r.bounds):this._addAppearance(r._dictionary,s,"N"),r._dictionary._updated=!t);else{var n,r=this.itemAt(0),s=this._createAppearance();t?(n=this.page)&&this._drawTemplate(s,n,this.bounds):this._addAppearance(r._dictionary,s,"N"),r._dictionary._updated=!t}else this._dictionary&&(s=this._createAppearance(),t?(n=this.page)&&this._drawTemplate(s,n,this.bounds):this._addAppearance(this._dictionary,s,"N"));this._dictionary._updated=!t}},ei.prototype._tryGetIndex=function(t){var e=-1;if(this._options&&0<this._options.length)for(var i=0;i<this._options.length;i++)if(t===this._options[i][0]){e=i;break}return e},ei.prototype._addEmptyWidget=function(){var t=new jn;t._create(this._page,this.bounds,this),this._addToKid(t),t._dictionary.update("MK",new D(this._crossReference)),t._mkDictionary.update("BC",[0,0,0]),t._mkDictionary.update("BG",[1,1,1]),t._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg")},ei.prototype._getStringFormat=function(){var t=this.itemAt(this._defaultIndex),e=new I;return e.lineAlignment=0<(this._fieldFlags&M._FieldFlag.multiLine)?M.PdfVerticalAlignment.top:M.PdfVerticalAlignment.middle,t&&t._dictionary.has("Q")&&null!=(t=t._dictionary.get("Q"))&&(e.alignment=t),e};var $e,ti=ei;function ei(){return null!==$e&&$e.apply(this,arguments)||this}t(ri,ii=ti),Object.defineProperty(ri.prototype,"_isAutoFontSize",{get:function(){var i,n,t,r=this,s=!1;return this._isLoaded&&this._form&&(t=this._form._dictionary)&&t.has("DA")&&(n=t.get("DA"))&&0===(i=new di(n)).fontSize&&(this._kids&&0<this._kids.length?(t=!1,(t=this._dictionary.has("DA")&&(n=this._dictionary.get("DA"))&&(i=new di(n))&&0<i.fontSize?!0:t)||this._kids.forEach(function(t){var e;!(e=t&&t instanceof m?r._crossReference._fetch(t):e)||e.has("DA")&&(t=0)!==(t=(n=e.get("DA"))&&(i=new di(n))?i.fontSize:t)||(s=!0)})):this._dictionary.has("DA")&&(t=0)!==(t=(n=this._dictionary.get("DA"))&&(i=new di(n))?i.fontSize:t)||(s=!0)),s},enumerable:!0,configurable:!0}),ri._load=function(t,e,i,n){var r=new ri,t=(r._isLoaded=!0,r._form=t,r._dictionary=e,r._crossReference=i,r._ref=n,r._dictionary.has("Kids")&&(r._kids=r._dictionary.get("Kids")),r._dictionary.getArray("Opt"));return null!=t&&(r._listValues=new Array(t.length)),r._defaultIndex=0,r._parsedItems=new Map,0<r._kidsCount&&r._retrieveOptionValue(),r},ri.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt");if(t&&0<t.length)for(var e=this._kidsCount,i=t.length<=e?t.length:e,n=0;n<i;n++){var r=t[n][1];r&&(this.itemAt(n)._text=r||"")}}},ri.prototype._createAppearance=function(t){var e,i,n,r=new or,s=(i=(e=t?(e=t.bounds,s=t._getPage(),t._isLoaded&&s&&void 0!==s.rotation&&s.rotation!==M.PdfRotationAngle.angle0?r.bounds=this._rotateTextBox(e,s.size,s.rotation):r.bounds={x:0,y:0,width:e.width,height:e.height},(s=t.backColor)&&!s.isTransparent&&(r.backBrush=new A(s)),r.foreBrush=new A(t.color||this.color),i=t.border,t.borderColor&&(r.borderPen=new x(t.borderColor,i.width),Po(i,r)),r.borderStyle=i.style,r.borderWidth=i.width,s&&(n={r:0<=(a=[s.r-64,s.g-64,s.b-64])[0]?a[0]:0,g:0<=a[1]?a[1]:0,b:0<=a[2]?a[2]:0},r.shadowBrush=new A(n)),void 0!==t.textAlignment?t.textAlignment:M.PdfTextAlignment.left):((e=this.bounds)&&(this._isLoaded&&this.page&&void 0!==this.page.rotation&&this.page.rotation!==M.PdfRotationAngle.angle0?r.bounds=this._rotateTextBox(e,this.page.size,this.page.rotation):r.bounds={x:0,y:0,width:e.width,height:e.height}),(s=this.backColor)&&!s.isTransparent&&(r.backBrush=new A(s)),r.foreBrush=new A(this.color),i=this.border,this.borderColor&&(r.borderPen=new x(this.borderColor,i.width),Po(i,r)),r.borderStyle=i.style,r.borderWidth=i.width,s&&(n={r:0<=(a=[s.r-64,s.g-64,s.b-64])[0]?a[0]:0,g:0<=a[1]?a[1]:0,b:0<=a[2]?a[2]:0},r.shadowBrush=new A(n)),r.rotationAngle=this.rotationAngle,null!==this.rotate&&void 0!==this.rotate&&(r.rotationAngle=this.rotate),void 0!==this.textAlignment?this.textAlignment:M.PdfTextAlignment.left),this.multiSelect?M.PdfVerticalAlignment.top:M.PdfVerticalAlignment.middle),r.stringFormat=new I(e,i),r.required=this.required,null!==r.bounds&&void 0!==r.bounds||(r.bounds={x:0,y:0,width:0,height:0}),new P(r.bounds,this._crossReference)),a=s.graphics;return a._sw._clear(),this.required||(a._sw._beginMarkupSequence("Tx"),a._initializeCoordinates()),this._isLoaded?(n=void 0,(n=null==(n=t?this._obtainFont(t):n)?this.font:n)&&0!==n.size||(n=this._appearanceFont),this._drawComboBox(a,r,n,r.stringFormat)):(this._font||(this._font=new E(M.PdfFontFamily.timesRoman,this._getFontHeight(M.PdfFontFamily.helvetica))),this._drawComboBox(a,r,this._font,r.stringFormat)),this.required||a._sw._endMarkupSequence(),s},ri.prototype._drawComboBox=function(t,e,i,n){t._isTemplateGraphics&&e.required&&(t.save(),t._initializeCoordinates()),this._drawRectangularControl(t,e),t._isTemplateGraphics&&e.required&&(t.restore(),t.save(),t._sw._beginMarkupSequence("Tx"),t._initializeCoordinates());var r,s,a,o,h,c,_=this._options,d=this._dictionary.get("I"),l=-1;0<=(l=d&&0<d.length?d[0]:l)&&l<_.length&&(d=_[l],_=[0,0],r=2*(l=e.borderWidth),(s=e.borderStyle===M.PdfBorderStyle.inset||e.borderStyle===M.PdfBorderStyle.beveled)?(_[0]=2*r,_[1]=2*l):(_[0]=2+r,_[1]=+l),a=e.foreBrush,h=(o=e.bounds).width-r,(c=o).height-=s?r:l,t.setClip(c,M.PdfFillMode.winding),l=void(0===e.rotationAngle&&(s&&(h-=r),a=new A(this.color||{r:0,g:0,b:0}))),l=d&&Array.isArray(d)?d[1]||d[0]:d)&&(d={x:_[0],y:_[1],width:h-_[0],height:o.height},0<e.rotationAngle?(_=t.save(),90===e.rotationAngle?(t.translateTransform({x:0,y:t._size.height}),t.rotateTransform(-90),c={x:t._size.height-(c.y+c.height),y:c.x,width:c.height+c.width,height:c.width}):270===e.rotationAngle?(t.translateTransform({x:t._size.width,y:0}),t.rotateTransform(-270),c={x:c.y,y:t._size.width-(c.x+c.width),width:c.height+c.width,height:c.width}):180===e.rotationAngle&&(t.translateTransform({x:t._size.width,y:t._size.height}),t.rotateTransform(-180),c={x:t._size.width-(c.x+c.width),y:t._size.height-(c.y+c.height),width:c.width,height:c.height}),s&&(h-=r),a=new A({r:0,g:0,b:0}),t.drawString(l,i,d,null,a,n),t.restore(_)):t.drawString(l,i,d,null,a,n)),t._isTemplateGraphics&&e.required&&(t._sw._endMarkupSequence(),t.restore())},ri.prototype._getFontHeight=function(t){var e,i=this._dictionary.get("I"),n=this.border.width;if(this._isLoaded){var r=new E(t,12),s=new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle),a=this._dictionary.getArray("Opt"),o=this.bounds,h=[];if(i&&0<i.length)i.forEach(function(t){h.push(r.measureString(a[t][1],{width:0,height:0},s,0,0).width)});else if(0<a.length)for(var c=r.measureString(a[0][1],{width:0,height:0},s,0,0).width,_=1;_<a.length;++_){var d=r.measureString(a[_][1],{width:0,height:0},s,0,0).width,c=Math.max(c,d);h.push(c)}e=0<h.length?12*(o.width-4*n)/h.sort()[h.length-1]:12}else{if(e=0,!(i&&0<i.length))return e;r=new E(t,12),s=new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle),a=this._dictionary.getArray("Opt");var l=this.selectedValue,d=r.measureString(null!==l&&"string"==typeof l?l:a[i[0]][1],{width:0,height:0},s,0,0).width;o=this.bounds,e=d?12*(o.width-4*n)/d:12}var u=0;if(i&&0<i.length){if(12!==e){r=new E(t,e);var p=null!==(l=this.selectedValue)&&"string"==typeof l?l:a[i[0]][1],l=r.measureString(p);if(l.width>o.width||l.height>o.height)for(var d=o.width-4*n,f=o.height-4*n,_=1;_<=o.height;_++){var g=(r=new E(t,_)).measureString(p);if(g.width>o.width||g.height>f){u=_;do{var y=(r=new E(t,u-=.001)).getLineWidth(p,s);if(u<.248){r._size=.248;break}if(g=r.measureString(p,{width:0,height:0},s,0,0),y<d&&g.height<f){r._size=u;break}}while(.248<u);e=u;break}}}}else 12<e&&(e=12);return e};var ii,ni=ri;function ri(t,e,i,n){var r=ii.call(this)||this;return t&&e&&i&&(r._initialize(t,e,i),r._fieldFlags|=M._FieldFlag.combo),n&&("items"in n&&k(n.items)&&n.items.forEach(function(t){r.addItem(new Xn(t.text,t.value))}),"toolTip"in n&&k(n.toolTip)&&(r.toolTip=n.toolTip),"color"in n&&k(n.color)&&(r.color=n.color),"border"in n&&k(n.border)&&(r.border=n.border),"backColor"in n&&k(n.backColor)&&(r.backColor=n.backColor),"borderColor"in n&&k(n.borderColor)&&(r.borderColor=n.borderColor),"font"in n&&k(n.font)&&(r.font=n.font),"selectedIndex"in n)&&k(n.selectedIndex)&&(r.selectedIndex=n.selectedIndex),r}t(oi,si=ti),oi._load=function(t,e,i,n){var r=new oi;return r._isLoaded=!0,r._form=t,r._dictionary=e,r._crossReference=i,r._ref=n,r._dictionary.has("Kids")&&(r._kids=r._dictionary.get("Kids")),r._defaultIndex=0,r._parsedItems=new Map,0<r._kidsCount&&r._retrieveOptionValue(),r},oi.prototype._retrieveOptionValue=function(){if(this._dictionary.has("Opt")){var t=this._dictionary.getArray("Opt"),e=this._kidsCount,i=t.length<=e?t.length:e;if(this._listValues=new Array(i),t&&0<t.length){var n=this._dictionary.get("I");Array.isArray(n)&&0<n.length&&(n=n[0],this._selectedIndex=n);for(var r=0;r<i;r++){var s,a=this.itemAt(r);a&&(k(n)&&null!==this._listValues&&void 0!==this._listValues?(s=t[r],Array.isArray(s)?this._listValues[r]=s[1]:this._listValues[r]=s,r===n?(a._text=this._listValues[r],this._selectedIndex=r):a._text=this._listValues[r]):a._text="")}}}},oi.prototype._createAppearance=function(t){var e,i,n,r=new or,s=(i=(e=t?(e=t.bounds,s=t._getPage(),t._isLoaded&&s&&void 0!==s.rotation&&s.rotation!==M.PdfRotationAngle.angle0?r.bounds=this._rotateTextBox(e,s.size,s.rotation):r.bounds={x:0,y:0,width:e.width,height:e.height},(s=t.backColor)&&!s.isTransparent&&(r.backBrush=new A(s)),r.foreBrush=new A(t.color||this.color),i=t.border,t.borderColor&&(r.borderPen=new x(t.borderColor,i.width),Po(i,r)),r.borderStyle=i.style,r.borderWidth=i.width,s&&(n={r:0<=(a=[s.r-64,s.g-64,s.b-64])[0]?a[0]:0,g:0<=a[1]?a[1]:0,b:0<=a[2]?a[2]:0},r.shadowBrush=new A(n)),t._enableGrouping&&void 0===t.rotate?r.rotationAngle=0:r.rotationAngle=t.rotate,void 0!==t.textAlignment?t.textAlignment:M.PdfTextAlignment.left):(e=this.bounds,this._isLoaded&&this.page&&void 0!==this.page.rotation&&this.page.rotation!==M.PdfRotationAngle.angle0?r.bounds=this._rotateTextBox(e,this.page.size,this.page.rotation):r.bounds={x:0,y:0,width:e.width,height:e.height},(s=this.backColor)&&!s.isTransparent&&(r.backBrush=new A(s)),r.foreBrush=new A(this.color),i=this.border,this.borderColor&&(r.borderPen=new x(this.borderColor,i.width),Po(i,r)),r.borderStyle=i.style,r.borderWidth=i.width,s&&(n={r:0<=(a=[s.r-64,s.g-64,s.b-64])[0]?a[0]:0,g:0<=a[1]?a[1]:0,b:0<=a[2]?a[2]:0},r.shadowBrush=new A(n)),r.rotationAngle=this.rotationAngle,null!==this.rotate&&void 0!==this.rotate&&(r.rotationAngle=this.rotate),void 0!==this.textAlignment?this.textAlignment:M.PdfTextAlignment.left),this.multiSelect?M.PdfVerticalAlignment.top:M.PdfVerticalAlignment.middle),r.stringFormat=new I(e,i),r.required=this.required,new P(r.bounds,this._crossReference)),a=s.graphics;return a._sw._clear(),this.required||(a._sw._beginMarkupSequence("Tx"),a._initializeCoordinates()),this._isLoaded?(null!=(n=this._obtainFont(t))&&(this._isLoaded||1!==n.size)||(n=this._appearanceFont),this._drawListBox(a,r,n,r.stringFormat)):(this._font||(this._font=this._defaultItemFont),this._drawListBox(a,r,this._font,r.stringFormat)),this.required||a._sw._endMarkupSequence(),s},oi.prototype._drawListBox=function(p,f,g,y){p._isTemplateGraphics&&f.required&&(p.save(),p._initializeCoordinates()),this._drawRectangularControl(p,f),p._isTemplateGraphics&&f.required&&(p.restore(),p.save(),p._sw._beginMarkupSequence("Tx"),p._initializeCoordinates());for(var m=this._options,b=this,t=0;t<m.length;++t)!function(e){var t,i,n=m[e],r=[],s=f.borderWidth,a=2*s,o=f.borderStyle===M.PdfBorderStyle.inset||f.borderStyle===M.PdfBorderStyle.beveled,h=(o?(r.push(2*a),r.push((e+2)*s+g._getHeight()*e)):(r.push(2+a),r.push((e+1)*s+g._getHeight()*e+1)),f.foreBrush),c=f.bounds,_=c.width-a,d=c,l=(d.height-=o?a:s,p.setClip(d,M.PdfFillMode.winding),!1),u=b._dictionary.get("I"),u=(null!=u&&0<u.length&&u.forEach(function(t){l=l||t===e}),0===f.rotationAngle&&l&&(i=c.x+s,o&&(i+=s,_-=a),h=new A({r:153,g:193,b:218}),p.drawRectangle({x:i,y:r[1],width:_,height:g._getHeight()},h),h=new A(b.color||{r:0,g:0,b:0})),void 0),u=n&&"string"==typeof n?n:n[1]||n[0],n={x:r[0],y:r[1],width:_-r[0],height:g._getHeight()};0<f.rotationAngle?(t=p.save(),90===f.rotationAngle?(p.translateTransform({x:0,y:p._size.height}),p.rotateTransform(-90),d={x:i=p._size.height-(d.y+d.height),y:d.x,width:d.height+d.width,height:d.width}):270===f.rotationAngle?(p.translateTransform({x:p._size.width,y:0}),p.rotateTransform(-270),d={x:i=d.y,y:p._size.width-(d.x+d.width),width:d.height+d.width,height:d.width}):180===f.rotationAngle&&(p.translateTransform({x:p._size.width,y:p._size.height}),p.rotateTransform(-180),d={x:i=p._size.width-(d.x+d.width),y:p._size.height-(d.y+d.height),width:d.width,height:d.height}),l&&(i=c.x+s,o&&(i+=s,_-=a),h=new A({r:153,g:193,b:218}),p.drawRectangle({x:i,y:r[1],width:_,height:g._getHeight()},h),h=new A(b.color||{r:0,g:0,b:0})),p.drawString(u,g,n,null,h,y),p.restore(t)):p.drawString(u,g,n,null,h,y)}(t);p._isTemplateGraphics&&f.required&&(p._sw._endMarkupSequence(),p.restore())},oi.prototype._getFontHeight=function(t){var e=new E(t,12,M.PdfFontStyle.regular),i=new I(M.PdfTextAlignment.left,M.PdfVerticalAlignment.middle),t=0;if(k(this._listValues)&&0<this._listValues.length){for(var n=e.measureString(this._listValues[0],{width:0,height:0},i,0,0).width,r=1;r<this._listValues.length;++r)var s=e.measureString(this._listValues[r],{width:0,height:0},i,0,0).width,n=s<n?n:s;t=12<(t=12*(this.bounds.width-4*this.border.width)/n)?12:t}return t};var si,ai=oi;function oi(t,e,i,n){var r=si.call(this)||this;return t&&e&&i&&r._initialize(t,e,i),n&&("items"in n&&k(n.items)&&n.items.forEach(function(t){r.addItem(new Xn(t.text,t.value))}),"toolTip"in n&&k(n.toolTip)&&(r.toolTip=n.toolTip),"color"in n&&k(n.color)&&(r.color=n.color),"border"in n&&k(n.border)&&(r.border=n.border),"backColor"in n&&k(n.backColor)&&(r.backColor=n.backColor),"borderColor"in n&&k(n.borderColor)&&(r.borderColor=n.borderColor),"font"in n&&k(n.font)&&(r.font=n.font),"multiSelect"in n&&k(n.multiSelect)&&(r.multiSelect=n.multiSelect),"selectedIndex"in n)&&k(n.selectedIndex)&&(r.selectedIndex=n.selectedIndex),r}t(_i,hi=Ve),Object.defineProperty(_i.prototype,"isSigned",{get:function(){return this._isSigned||this._checkSigned(),this._isSigned},enumerable:!0,configurable:!0}),Object.defineProperty(_i.prototype,"backColor",{get:function(){return this._parseBackColor(!0)},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),_i._load=function(t,e,i,n){var r=new _i;return r._isLoaded=!0,r._form=t,r._dictionary=e,r._crossReference=i,r._ref=n,r._dictionary.has("Kids")&&(r._kids=r._dictionary.get("Kids")),r._defaultIndex=0,r._parsedItems=new Map,r},_i.prototype.getSignature=function(){return!this._signature&&this._dictionary.has("V")&&(this._signature=this._crossReference._document._getSignature(this._dictionary.get("V"),this)),this._signature},_i.prototype.setSignature=function(t){var e;this._crossReference&&(this._crossReference._document.form._signatureFlag=M._SignatureFlag.signatureExists|M._SignatureFlag.appendOnly,t._signatureField=this,t._signatureDictionary=t._createDictionary(this._crossReference._document,t),this._signature=t,e=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(e,t._signatureDictionary._dictionary),t._reference=e,t._signatureDictionary._dictionary._isSignature=!0,this._crossReference._signature=t._signatureDictionary,this._dictionary.update("V",e),this._dictionary.update("Ff",0),this._crossReference._signatureCollection.push(t))},_i.prototype.getAppearance=function(){var t;return this._isLoaded?null:(this._appearance||(t={x:0,y:0,width:this.bounds.width,height:this.bounds.height},this._appearance=new Ae(t,this._widgetAnnot),this._appearance.normal=new P(t,this._crossReference)),this._appearance)},_i.prototype.getRevision=function(){return this.isSigned&&-1===this._revision&&(this._revision=this._getSignedRevision()),this._revision},_i.prototype._initialize=function(t,e,i){this._crossReference=t._crossReference,this._page=t,this._name=e,this._dictionary=new D(this._crossReference),this._ref=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(this._ref,this._dictionary),this._dictionary.objId=this._ref.toString(),this._dictionary.update("FT",R.get("Sig")),this._dictionary.update("T",e),this._defaultIndex=0,this._initializeFont(this._defaultFont),this._createItem(i)},_i.prototype._createItem=function(t){this._widgetAnnot=new jn,this._widgetAnnot._create(this._page,t,this),this._widgetAnnot._dictionary.update("MK",new D(this._crossReference)),this._widgetAnnot._mkDictionary.update("BC",[0,0,0]),this._widgetAnnot._mkDictionary.update("BG",[1,1,1]),this._widgetAnnot._dictionary.update("DA",this._fontName+" 8 Tf 0 0 0 rg"),this._addToKid(this._widgetAnnot)},_i.prototype._doPostProcess=function(t){void 0===t&&(t=!1),this._signature&&this._signature._isLocked&&!this._signature._certify&&!this._signature._signed&&this._signature._lockSignature();var e,i=this._setAppearance||this._form._setAppearance;if((t||i||this._appearance)&&0<(e=this._kidsCount))for(var n=0;n<e;n++){var r,s,a,o=this.itemAt(n);this._appearance?(a=this._appearance.normal,this._rotateAngle=this._widgetAnnot._getRotationAngle(),ua(a,this.rotate),r=new D,a._content.dictionary._updated=!0,s=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(s,a._content),a._content.reference=s,r.set("N",s),r._updated=!0,this._widgetAnnot._dictionary.set("AP",r)):o&&o._dictionary&&(i||t&&!o._dictionary.has("AP"))&&(a=this._createAppearance(o,t),this._addAppearance(o._dictionary,a,"N"))}if(t)if(0<(e=this._kidsCount))for(var h,c=void 0,n=0;n<e;n++)(o=this.itemAt(n))&&o._dictionary&&(h=o.page)&&(c||0!==n||(c=this._getItemTemplate(o._dictionary)),this._appearance&&(c=this._appearance.normal),this._flattenSignature(o._dictionary,h,o.bounds,c));else this._flattenSignature(this._dictionary,this.page,this.bounds)},_i.prototype._createAppearance=function(t,e){var i=t.bounds,n=new P([0,0,i.width,i.height],this._crossReference),r=(ua(n,null),n._writeTransformation=!1,n.graphics),s=new or,i=(s.bounds={x:0,y:0,width:i.width,height:i.height},t.backColor),e=(e&&i&&!i.isTransparent&&(s.backBrush=new A(i)),s.foreBrush=new A(t.color),t.border);return t.borderColor&&(s.borderPen=new x(t.borderColor,e.width)),s.borderWidth=e.width,s.borderStyle=e.style,i&&(e=[i.r-64,i.g-64,i.b-64],s.shadowBrush=new A({r:0<=e[0]?e[0]:0,g:0<=e[1]?e[1]:0,b:0<=e[2]?e[2]:0})),s.rotationAngle=t.rotate,r.save(),r._initializeCoordinates(),this._drawRectangularControl(r,s),r.restore(),n},_i.prototype._flattenSignature=function(t,e,i,n){var r,s,a,o,h;t.has("AP")?(t=t.get("AP"))&&t.has("N")&&(r=t.get("N"),(t=t.getRaw("N"))&&r&&(r.reference=t),r)&&(s=n||new P(r,this._crossReference))&&e&&(o=(a=e.graphics).save(),this.isSigned&&(s._isSignature=!0),e.rotation!==M.PdfRotationAngle.angle0?(h=new kr(a._size,a._sw._stream,a._crossReference,e)).drawTemplate(s,this._calculateTemplateBounds(i,e,s,h)):a.drawTemplate(s,i),a.restore(o)):n&&e&&(s=n,o=(a=e.graphics).save(),e.rotation!==M.PdfRotationAngle.angle0?(h=new kr(a._size,a._sw._stream,a._crossReference,e)).drawTemplate(s,this._calculateTemplateBounds(i,e,s,h)):a.drawTemplate(s,i),a.restore(o))},_i.prototype._calculateTemplateBounds=function(t,e,i,n){var r=t.x,s=t.y;if(e){var a=this._obtainGraphicsRotation(e.graphics._matrix);if(90===a)n.translateTransform({x:i._size.height,y:0}),n.rotateTransform(90),r=t.x,s=-(e._size.height-t.y-t.height);else if(180===a)n.translateTransform({x:i._size.width,y:i._size.height}),n.rotateTransform(180),r=-(e._size.width-(t.x+i._size.width)),s=-(e._size.height-t.y-i._size.height);else if(270===a)if(n.translateTransform({x:0,y:i._size.width}),n.rotateTransform(270),e._size.width>e._size.height&&i._content&&i._content.dictionary&&i._content.dictionary.has("Matrix")){a=i._content.dictionary.get("Matrix");if(-1!==a[1]||1!==a[2])return{x:r=-(e._size.width-t.x-t.width),y:s=t.y+t.x+i._size.width,width:t.height,height:t.width};r=-(e._size.width-t.x-i.size.width),s=t.y-t.height}else r=-(e._size.width-t.x-t.width),s=t.y}return{x:r,y:s,width:t.width,height:t.height}},_i.prototype._obtainGraphicsRotation=function(t){var e=Math.round(180*Math.atan2(t._matrix._elements[2],t._matrix._elements[0])/Math.PI);switch(e){case-90:e=90;break;case-180:e=180;break;case 90:e=270}return e},_i.prototype._getItemTemplate=function(t){var e,i;return e=t&&t.has("AP")&&(t=t.get("AP"))&&t.has("N")&&(i=t.get("N"),(t=t.getRaw("N"))&&(i.reference=t),i)?new P(i,this._crossReference):e},_i.prototype._checkSigned=function(){var t;this._dictionary&&this._dictionary.has("V")&&null!=(t=this._dictionary.get("V"))&&0<t.size&&(this._isSigned=!0)},_i.prototype._getSignedRevision=function(){var t=this._dictionary.get("V").getArray("ByteRange"),e=t[0]+t[1],i=t[2]+t[3],n=-1;if(this._crossReference&&this._crossReference._document){var r=this._crossReference._document.getRevisions();if(r&&Array.isArray(r)&&0<r.length)for(var s=0;s<r.length;s++){var a=r[s];if(e<a&&a===i){n=s+1;break}}}return n};var hi,ci=_i;function _i(t,e,i,n){var r=hi.call(this)||this;return r._rotateAngle=0,r._isSigned=!1,r._revision=-1,t&&e&&i&&r._initialize(t,e,i),n&&("toolTip"in n&&k(n.toolTip)&&(r.toolTip=n.toolTip),"color"in n&&k(n.color)&&(r.color=n.color),"border"in n&&k(n.border)&&(r.border=n.border),"backColor"in n&&k(n.backColor)&&(r.backColor=n.backColor),"borderColor"in n)&&k(n.borderColor)&&(r.borderColor=n.borderColor),r}li.prototype.toString=function(){var t=[Number.parseFloat((this.color.r/255).toFixed(3)),Number.parseFloat((this.color.g/255).toFixed(3)),Number.parseFloat((this.color.b/255).toFixed(3))];return"/"+this.fontName+" "+this.fontSize+" Tf "+t[0].toString()+" "+t[1].toString()+" "+t[2].toString()+" rg"};var di=li;function li(t){var i,n,r="",s=0;t&&"string"==typeof t&&""!==t&&(n=t.split(" ")).forEach(function(t,e){switch(t){case"g":i=[Number.parseFloat(n[e-1])];break;case"rg":i=[Number.parseFloat(n[e-3]),Number.parseFloat(n[e-2]),Number.parseFloat(n[e-1])];break;case"k":i=[Number.parseFloat(n[e-4]),Number.parseFloat(n[e-3]),Number.parseFloat(n[e-2]),Number.parseFloat(n[e-1])];break;case"Tf":s=Number.parseFloat(n[e-1]),(r=n[e-2].substring(1)).includes("#2C")&&r.replace("#2C",",")}}),this.fontName=r,this.fontSize=s,this.color=void 0!==i?qs(i):{r:0,g:0,b:0}}pi.prototype._readContent=function(){return this._parseObject(M._TokenType.eof),this._recordCollection},pi.prototype._parseObject=function(t){for(var e;(e=this._getNextToken())!==M._TokenType.eof;){if(e===t||e===M._TokenType.none)return;switch(e){case M._TokenType.comment:break;case M._TokenType.number:"-"===this._lexer._operatorParams?this._operands.push("0"):this._operands.push(this._lexer._operatorParams);break;case M._TokenType.real:this._operands.push(this._lexer._operatorParams);break;case M._TokenType.string:case M._TokenType.hexString:case M._TokenType.unicodeHexString:case M._TokenType.unicodeString:case M._TokenType.name:this._operands.push(this._lexer._operatorParams);break;case M._TokenType.operator:"ID"===this._lexer._operatorParams?(this._createRecord(),this._operands=[],this._consumeValue()):(this._createRecord(),this._operands=[]);break;case M._TokenType.beginArray:break;case M._TokenType.endArray:throw new Error("Error while parsing content")}}},pi.prototype._consumeValue=function(){for(var t,e,i;;){var n,r=0;if("E"===(n=this._lexer._getNextCharForInlineStream())||n===String.fromCharCode(65535))if("I"===(t=this._lexer._getNextInlineChar())||t===String.fromCharCode(65535)&&n===String.fromCharCode(65535)){for(e=this._lexer._nextCharacter,i=this._lexer._nextCharacter;" "===i||"\r"===i||"\n"===i;)i=this._lexer._getNextChar(),r++;if(this._lexer._resetContentPointer(r)," "===e||"\n"===e||e===String.fromCharCode(65535)||"\r"===e){if("Q"===i||i===String.fromCharCode(65535)||"S"===i||"0"<=i&&i<="9"){this._lexer._operatorParams="",this._lexer._operatorParams+=n,this._lexer._operatorParams+=t,this._isByteOperand=!0,this._createRecord(),this._isByteOperand=!1,this._inlineImageBytes=[],t=this._lexer._getNextInlineChar();break}}else this._inlineImageBytes.push(255&n.charCodeAt(0)),this._inlineImageBytes.push(255&t.charCodeAt(0)),this._inlineImageBytes.push(255&e.charCodeAt(0)),this._inlineImageBytes.push(255&i.charCodeAt(0)),n=this._lexer._getNextCharForInlineStream()}else this._inlineImageBytes.push(255&n.charCodeAt(0)),this._inlineImageBytes.push(255&t.charCodeAt(0));else this._inlineImageBytes.push(255&n.charCodeAt(0))}},pi.prototype._createRecord=function(){var t=this._lexer._operatorParams,t=this._isByteOperand?new mi(t,new Uint8Array(this._inlineImageBytes)):new mi(t,this._operands);t._splitText=this._lexer._text,this._recordCollection.push(t)},pi.prototype._getNextToken=function(){return this._lexer._getNextToken()};var ui=pi;function pi(t){this._recordCollection=[],this._operands=[],this._inlineImageBytes=[],this._isByteOperand=!1,this._lexer=new fi(t)}gi.prototype._getNextToken=function(){this._operatorParams="";var t=this._moveToNextChar();switch(t){case"%":return this._tokenType=this._getComment();case"/":return this._tokenType=this._getName();case"[":case"(":return this._tokenType=this._getLiteralString();case"+":case"-":return this._tokenType=this._getNumber();case"<":return this._tokenType=this._getEncodedDecimalString();case".":return this._tokenType=this._getNumber();case'"':case"'":return this._tokenType=this._getOperator()}return isNaN(parseInt(t,10))?/[a-zA-Z]/.test(t)?this._tokenType=this._getOperator():t===String.fromCharCode(65535)?this._tokenType=M._TokenType.eof:this._tokenType=M._TokenType.none:this._tokenType=this._getNumber()},gi.prototype._getComment=function(){this._operatorParams="";for(var t,e="\n"!==(t=this._consumeValue())&&t!==String.fromCharCode(65535);e;)e="\n"!==(t=this._consumeValue())&&t!==String.fromCharCode(65535);return M._TokenType.comment},gi.prototype._getName=function(){this._operatorParams="";for(var t=!1;!t;)switch(this._consumeValue()){case"\0":case"\t":case"\n":case"\f":case"\r":case"\b":case" ":case"%":case"(":case")":case"<":case">":case"[":case"]":case"/":return t=!0,M._TokenType.name}return M._TokenType.none},gi.prototype._getNumber=function(){var t=this._currentCharacter;for("+"!==t&&"-"!==t||(this._operatorParams+=this._currentCharacter,t=this._getNextChar());!isNaN(parseInt(t,10))||"."===t;){if(isNaN(parseInt(t,10))){if("."===t){if(this._operatorParams.includes("."))break;this._operatorParams+=this._currentCharacter}}else this._operatorParams+=this._currentCharacter;t=this._getNextChar()}return M._TokenType.number},gi.prototype._getOperator=function(){this._operatorParams="";for(var t=this._currentCharacter;this._isOperator(t);)t=this._consumeValue();return M._TokenType.operator},gi.prototype._isOperator=function(t){if(/[a-zA-Z]/.test(t))return!0;switch(t){case"*":case"'":case'"':case"1":case"0":return!0}return!1},gi.prototype._getLiteralString=function(){this._operatorParams="";var t,e=this._currentCharacter,i=this._consumeValue(),n=!0,r=0,s="";for(this._text=[];n;){if("("===e){t=this._getLiteralStringValue(i),this._operatorParams+=t,i=this._getNextChar(),n=!1;break}if("("===i)""!==s&&(this._text[r]=s.slice(0,-1),s="",r++),i=this._consumeValue(),t=this._getLiteralStringValue(i),this._text[r]="("+t,r++,this._operatorParams+=t,s+=i=this._getNextChar();else{if("]"===i){n=!1,i=this._consumeValue();break}">"===i?(this._text[r]="<"+s,r++,s=""):"<"===i&&(""!==s&&(this._text[r]=s.slice(0,-1),r++),s=""),s+=i=this._consumeValue()}}return M._TokenType.string},gi.prototype._getEncodedDecimalString=function(){for(var t=0,e=this._consumeValue(),i=!0;i;)if("<"===e)t++,e=this._consumeValue();else if(">"===e){if(0===t){this._consumeValue(),i=!1;break}if(1===t){if(">"===(e=this._consumeValue())&&t--,1===t&&" "===e){i=!1;break}}else">"===e&&t--,e=this._consumeValue()}else if((e=this._consumeValue())===String.fromCharCode(65535)){i=!1;break}return M._TokenType.hexString},gi.prototype._getLiteralStringValue=function(t){for(var e=0,i="",n=!0;n;)if("\\"===t)i=(i+=t)+(t=this._getNextChar()),t=this._getNextChar();else if("("===t)e++,i+=t,t=this._getNextChar();else if(")"===t&&0!==e)i+=t,t=this._getNextChar(),e--;else{if(")"===t&&0===e)return n=!1,i+=t;i+=t,t=this._getNextChar()}return i},gi.prototype._consumeValue=function(){return this._operatorParams+=this._currentCharacter,this._getNextChar()},gi.prototype._moveToNextChar=function(){for(;this._currentCharacter!==String.fromCharCode(65535);)switch(this._currentCharacter){case"\0":case"\t":case"\n":case"\f":case"\r":case"\b":case" ":this._getNextChar();break;default:return this._currentCharacter}return this._currentCharacter},gi.prototype._resetContentPointer=function(t){this._offset=this._offset-t},gi.prototype._getNextInlineChar=function(){return this._data.length<=this._offset?(this._currentCharacter=String.fromCharCode(65535),this._nextCharacter=String.fromCharCode(65535)):(this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(this._data[this._offset++]),"\r"===this._currentCharacter&&("\n"===this._nextCharacter?this._currentCharacter="\r":this._currentCharacter="\n")),this._currentCharacter},gi.prototype._getNextCharForInlineStream=function(){return this._data.length<=this._offset?(this._currentCharacter=String.fromCharCode(65535),this._nextCharacter=String.fromCharCode(65535)):(this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(this._data[this._offset++]),"\r"===this._currentCharacter&&"\n"===this._nextCharacter&&this._data.length<=this._offset&&(this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(65535))),this._currentCharacter},gi.prototype._getNextChar=function(){if(this._data.length<=this._offset){if("Q"===this._nextCharacter||"D"===this._currentCharacter&&"o"===this._nextCharacter)return this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(65535),this._currentCharacter;this._currentCharacter=String.fromCharCode(65535),this._nextCharacter=String.fromCharCode(65535)}else this._currentCharacter=this._nextCharacter,this._nextCharacter=String.fromCharCode(this._data[this._offset++]),"\r"===this._currentCharacter&&("\n"===this._nextCharacter?(this._currentCharacter=this._nextCharacter,this._data.length<=this._offset?this._nextCharacter=String.fromCharCode(65535):this._nextCharacter=String.fromCharCode(this._data[this._offset++])):this._currentCharacter="\n");return this._currentCharacter};var fi=gi;function gi(t){this._tokenType=M._TokenType.none,this._currentCharacter="\0",this._nextCharacter="\0",this._offset=0,this._text=[],this._data=t instanceof Uint8Array?t:new Uint8Array(t)}var yi,mi=function(t,e){this._operator=t,Array.isArray(e)?this._operands=e:this._inlineImageBytes=e},t=(yi=function(t,e){return(yi=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)},function(t,e){function i(){this.constructor=t}yi(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),bi=(Object.defineProperty(a.prototype,"author",{get:function(){var t;return void 0===this._author&&this._dictionary.has("Author")&&(t=this._dictionary.get("Author"))&&(this._author=t),void 0===this._author&&this._dictionary.has("T")&&(t=this._dictionary.get("T"))&&(this._author=t),this._author},set:function(t){var e;this._isLoaded&&"string"==typeof t&&t!==this.author&&(e=!1,this._dictionary&&this._dictionary.has("T")&&(this._dictionary.update("T",t),this._author=t,e=!0),this._dictionary&&this._dictionary.has("Author")&&(this._dictionary.update("Author",t),this._author=t,e=!0),e||(this._dictionary.update("T",t),this._author=t)),this._isLoaded||"string"!=typeof t||this._dictionary.update("T",t)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"border",{get:function(){if(void 0===this._border){var t,e=new nr({width:1,style:M.PdfBorderStyle.solid}),i=(e._dictionary=this._dictionary,this._dictionary&&this._dictionary.has("Border")&&(t=this._dictionary.getArray("Border"))&&3<=t.length&&(e._hRadius=t[0],e._vRadius=t[1],e._width=t[2]),void 0);if(this._dictionary&&this._dictionary.has("BS")?i=this._dictionary:this instanceof qn&&this._field&&this._field._dictionary&&this._field._dictionary.has("BS")&&(i=this._field._dictionary),i)if(t=i.get("BS")){if(!t.has("W")||void 0===(i=t.get("W"))||Number.isNaN(i)||(e._width=i),t.has("S")){var i=t.get("S");if(i)switch(i.name){case"D":e._style=M.PdfBorderStyle.dashed;break;case"B":e._style=M.PdfBorderStyle.beveled;break;case"I":e._style=M.PdfBorderStyle.inset;break;case"U":e._style=M.PdfBorderStyle.underline;break;default:e._style=M.PdfBorderStyle.solid}}t.has("D")&&(i=t.getArray("D"))&&(e._dash=i)}this._border=e}return this._border},set:function(t){var e,i,n,r,s,a=this.border;this._isLoaded&&(void 0===t.width||a.width===t.width)||(e=t.width),this._isLoaded&&(void 0===t.hRadius||a.hRadius===t.hRadius)||(i=t.hRadius),this._isLoaded&&(void 0===t.vRadius||a.vRadius===t.vRadius)||(n=t.vRadius),this._isLoaded&&(void 0===t.style||a.style===t.style)||(r=t.style),void 0!==t.dash&&a.dash!==t.dash&&(s=t.dash),(!this._isWidget&&this._dictionary&&this._dictionary.has("Border")||e||n||i)&&(this._border._hRadius=void 0!==i?i:a.hRadius,this._border._vRadius=void 0!==n?n:a.vRadius,this._border._width=void 0!==e?e:a.width,this._dictionary.update("Border",[this._border.hRadius,this._border.vRadius,this._border.width])),(null!==this._dictionary&&this._dictionary&&this._dictionary.has("BS")||e||r||s)&&(this._border._width=void 0!==e?e:a.width,this._border._style=void 0!==r?r:a.style,this._border._dash=void 0!==s?s:a.dash,(t=this._dictionary.has("BS")?this._dictionary.get("BS"):new D(this._crossReference)).update("Type",R.get("Border")),t.update("W",this._border.width),t.update("S",Gs(this._border.style)),void 0!==this._border.dash&&t.update("D",this._border.dash),this._dictionary.update("BS",t),this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"flags",{get:function(){return void 0===this._annotFlags&&(this._annotFlags=M.PdfAnnotationFlag.default,this._dictionary)&&this._dictionary.has("F")&&(this._annotFlags=this._dictionary.get("F")),this._annotFlags},set:function(t){void 0!==t&&t!==this._annotFlags&&(this._annotFlags=t,this._dictionary.update("F",t))},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"color",{get:function(){return void 0===this._color&&this._dictionary.has("C")&&(this._color=qs(this._dictionary.getArray("C"))),this._color},set:function(t){var e;null!=t&&(e=this.color,this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._color=t,this._dictionary.update("C",[Number.parseFloat((t.r/255).toFixed(7)),Number.parseFloat((t.g/255).toFixed(7)),Number.parseFloat((t.b/255).toFixed(7))])))},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"innerColor",{get:function(){return void 0===this._innerColor&&this._dictionary.has("IC")&&(this._innerColor=qs(this._dictionary.getArray("IC"))),this._innerColor},set:function(t){var e;t&&(e=this.innerColor,this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._innerColor=t,this._dictionary.update("IC",[Number.parseFloat((t.r/255).toFixed(7)),Number.parseFloat((t.g/255).toFixed(7)),Number.parseFloat((t.b/255).toFixed(7))])))},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"creationDate",{get:function(){var t;return void 0!==this._creationDate&&null!==this._creationDate||!this._dictionary.has("CreationDate")||null!==(t=this._dictionary.get("CreationDate"))&&"string"==typeof t&&(this._creationDate=this._stringToDate(t)),this._creationDate},set:function(t){this._creationDate=t,this._dictionary.update("CreationDate",this._dateToString(t))},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"modifiedDate",{get:function(){var t;return void 0!==this._modifiedDate&&null!==this._modifiedDate||(t=void 0,this._dictionary&&this._dictionary.has("ModDate")?t=this._dictionary.get("ModDate"):this._dictionary.has("M")&&(t=this._dictionary.get("M")),null!==t&&"string"==typeof t&&(this._modifiedDate=this._stringToDate(t))),this._modifiedDate},set:function(t){this._modifiedDate=t,this._dictionary.update("M",this._dateToString(t))},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"bounds",{get:function(){return this._isLoaded&&(this._bounds=Ls(this._dictionary,this._page)),this._bounds},set:function(t){var e,i;t&&(this._isBounds=!0,this._isLoaded?t.x===this.bounds.x&&t.y===this.bounds.y&&t.width===this.bounds.width&&t.height===this.bounds.height||(e=this._page.size)&&(i=(e=e.height-(t.y+t.height))+t.height,this._dictionary.update("Rect",[t.x,e,t.x+t.width,i]),this._bounds=t,this._isChanged=!0):(this._bounds=t,this._isChanged=!0))},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"caption",{get:function(){var t,e;return void 0===this._caption&&((t=new Yn)._dictionary=this._dictionary,this._dictionary&&this._dictionary.has("Cap")&&(t._cap=this._dictionary.get("Cap")),this._dictionary&&this._dictionary.has("CP")&&(e=this._dictionary.get("CP"))&&(t._type="Top"===e.name?M.PdfLineCaptionType.top:M.PdfLineCaptionType.inline),this._dictionary&&this._dictionary.has("CO")&&(e=this._dictionary.getArray("CO"),t._offset={x:e[0],y:e[1]}),this._caption=t),this._caption},set:function(t){var e=this.caption;t&&(this._isLoaded&&t.cap===e.cap||(this._caption.cap=t.cap),this._isLoaded&&t.type===e.type||(this._caption.type=t.type),this._isLoaded&&t.offset===e.offset||(this._caption.offset=t.offset))},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"opacity",{get:function(){var t;return this._dictionary&&this._dictionary.has("CA")&&void 0!==(t=this._dictionary.get("CA"))&&(this._opacity=t),this._opacity},set:function(t){void 0===t||Number.isNaN(t)||(0<=t&&t<=1?(this._dictionary.update("CA",t),this._opacity=t):t<0?this._dictionary.update("CA",0):this._dictionary.update("CA",1))},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"subject",{get:function(){return void 0===this._subject&&(this._subject=this._dictionary.get("Subject","Subj")),this._subject},set:function(t){"string"==typeof t&&this.subject!==t&&(this._dictionary.update("Subj",t),this._subject=t,this._dictionary.has("Subject"))&&this._dictionary.update("Subject",t)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"name",{get:function(){return void 0===this._name&&this._dictionary.has("NM")&&(this._name=this._dictionary.get("NM")),this._name},set:function(t){"string"==typeof t&&(this._dictionary.update("NM",t),this._name=t)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"text",{get:function(){return void 0===this._text&&this._dictionary.has("Contents")&&(this._text=this._dictionary.get("Contents")),this._text},set:function(t){var e;"string"==typeof t&&(this._text=this._dictionary.get("Contents"),t!==this._text)&&((this instanceof xi||this instanceof Ci||this instanceof Bi)&&this.measure&&(void 0===this._unit||this._isLoaded)&&this._dictionary.has("Contents")&&(this._isTextUpdated=!0,e=this._dictionary.get("Contents"),this._unit=ma(e.substring(e.length-2))),this._dictionary.update("Contents",t),this._text=t)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"rotationAngle",{get:function(){return void 0===this._rotate&&this._dictionary&&this._dictionary.has("Rotate")&&(this._rotate=this._dictionary.get("Rotate")/90),null!==this._rotate&&void 0!==this._rotate||(this._rotate=M.PdfRotationAngle.angle0),this._rotate},set:function(t){var e=this.rotationAngle;this._dictionary.update("Rotate",90*(t=void 0!==t&&void 0!==e?(t+e)%4:t)),this._isRotated=!0,this._rotate=t},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"rotate",{get:function(){var t=this._getRotationAngle();return t=360<=(t=t<0?360+t:t)?360-t:t},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"flattenPopups",{get:function(){return this._isFlattenPopups},set:function(t){void 0!==t&&(this._isFlattenPopups=t)},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"_hasFlags",{get:function(){return this._dictionary.has("F")},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"_degreeToRadian",{get:function(){return void 0===this._ratio&&(this._ratio=Math.PI/180),this._ratio},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"layer",{get:function(){return this._layer||(this._layer=this._getDocumentLayer()),this._layer},set:function(t){this._layer||(this._layer=t,this._layer?this._dictionary.update("OC",this._layer._referenceHolder):delete this._dictionary._map.OC)},enumerable:!0,configurable:!0}),a.prototype.setAppearance=function(t){(this._setAppearance=t)&&(this._dictionary._updated=!0)},a.prototype.getValues=function(t){var e=[];if(!this._dictionary||!this._dictionary.has(t))throw new Error("PdfException: "+t+" is not found");var i=this._dictionary.get(t);if(Array.isArray(i))(i=this._dictionary.getArray(t)).forEach(function(t){t instanceof R?e.push(t.name):"string"==typeof t?e.push(t):"number"==typeof t&&e.push(t.toString())});else if(i instanceof R)e.push(i.name);else{if("string"!=typeof i)throw new Error("PdfException: "+t+" is not found");e.push(i)}return e},a.prototype.setValues=function(t,e){t&&""!==t&&e&&""!==e&&this._dictionary.update(t,e)},a.prototype._export=function(t){if(!this._page||!this._dictionary)throw new Error("Annotation must be added to a page before export.");var e,i=this._crossReference._document;if(e=this._dictionary&&this._dictionary.has("P")?ls(i,this._dictionary.get("P")):this._page._pageIndex,t===M.DataFormat.xfdf)return this._exportAsXfdf(i,e);if(t===M.DataFormat.json)return this._exportAsJson(i,e);throw new Error("Unsupported export format. Use DataFormat.xfdf or DataFormat.json.")},a.prototype._exportAsXfdf=function(t,e){var i=new Q,n=(i.exportAppearance=!0,i._document=t,i._crossReference=t._crossReference,this._crossReference=t._crossReference,i._isAnnotationExport=!0,new j),r=(n._writeStartDocument(),n._writeStartElement("xfdf"),n._writeAttributeString(null,"http://ns.adobe.com/xfdf/","xmlns",null),n._writeAttributeString("space","preserve","xml",null),n._writeStartElement("annots"),this._doPostProcess(!1),i._exportAnnotationData(this,n,e),this);if(r&&r.reviewHistory&&0<r.reviewHistory.count)for(var s=0;s<r.reviewHistory.count;s++){var a=r.reviewHistory.at(s);a._page=this._page,a._doPostProcess(!1),i._exportAnnotationData(a,n,e)}if(r&&r.comments&&0<r.comments.count)for(s=0;s<r.comments.count;s++){var o=r.comments.at(s),h=(o._page=this._page,o._doPostProcess(!1),i._exportAnnotationData(o,n,e),o);if(h&&h.reviewHistory&&0<h.reviewHistory.count)for(var c=0;c<h.reviewHistory.count;c++){var _=h.reviewHistory.at(c);_._page=this._page,_._doPostProcess(!1),i._exportAnnotationData(_,n,e)}}n._writeEndElement(),i._asPerSpecification||(n._writeStartElement("f"),n._writeAttributeString("href",i._fileName||""),n._writeEndElement()),n._writeEndElement();t=n._save();return n._destroy(),t},a.prototype._exportAsJson=function(t,e){var i=new it,n=(i.exportAppearance=!0,i._document=t,i._crossReference=t._crossReference,this._crossReference=t._crossReference,i._isAnnotationExport=!0,{pdfAnnotation:((t={})[e]={shapeAnnotation:[]},t)}),r=(this._doPostProcess(!1),i._table.clear(),i._exportAnnotation(this,e),n.pdfAnnotation[e].shapeAnnotation.push(JSON.parse(i._convertToJson(i._table))),this);if(r&&r.reviewHistory&&0<r.reviewHistory.count)for(var s=0;s<r.reviewHistory.count;s++){var a=r.reviewHistory.at(s);a._page=this._page,a._doPostProcess(!1),i._table.clear(),i._exportAnnotation(a,e),n.pdfAnnotation[e].shapeAnnotation.push(JSON.parse(i._convertToJson(i._table)))}if(r&&r.comments&&0<r.comments.count)for(s=0;s<r.comments.count;s++){var o=r.comments.at(s),h=(o._page=this._page,o._doPostProcess(!1),i._table.clear(),i._exportAnnotation(o,e),n.pdfAnnotation[e].shapeAnnotation.push(JSON.parse(i._convertToJson(i._table))),o);if(h&&h.reviewHistory&&0<h.reviewHistory.count)for(var c=0;c<h.reviewHistory.count;c++){var _=h.reviewHistory.at(c);_._page=this._page,_._doPostProcess(!1),i._table.clear(),i._exportAnnotation(_,e),n.pdfAnnotation[e].shapeAnnotation.push(JSON.parse(i._convertToJson(i._table)))}}return v(JSON.stringify(n))},a.prototype._initialize=function(t,e){this._page=t,this._crossReference=t._crossReference,e&&(this._dictionary=e),this._isLoaded||(this._dictionary.set("P",this._page._ref),this._dictionary.assignXref(this._crossReference))},a.prototype._getRotationAngle=function(){var t=0;return!this._dictionary||this instanceof Mi||this instanceof ji||(this._dictionary.has("Rotate")?t=this._dictionary.get("Rotate"):this._dictionary.has("Rotation")&&(t=this._dictionary.get("Rotation"))),t},a.prototype._getMediaOrCropBox=function(t){var e;return t&&t._pageDictionary&&t._pageDictionary.has("MediaBox")?e=t._pageDictionary.get("MediaBox"):t&&t._pageDictionary&&t._pageDictionary.has("CropBox")&&(e=t._pageDictionary.get("CropBox")),e},a.prototype._getBoundsValue=function(t,e){var i=0,n=(k(t)&&(i=t.length),[]),r=[];return 0<i&&t.forEach(function(t,e){(e%2==0?n:r).push(t)}),n.sort(function(t,e){return e<t?1:-1}),r.sort(function(t,e){return e<t?1:-1}),e?(i=2*this.border.width,{x:n[0]-i,y:r[0]-i,width:n[n.length-1]-n[0]+2*i,height:r[r.length-1]-r[0]+2*i}):{x:n[0],y:r[0],width:n[n.length-1]-n[0],height:r[r.length-1]-r[0]}},a.prototype._validateTemplateMatrix=function(t,e){var i,n,r,s,a,o,h=!1,c=!0;return null==e?(t&&t.has("Matrix")?(s=t.getArray("Matrix"))&&3<s.length&&void 0!==s[0]&&void 0!==s[1]&&void 0!==s[2]&&void 0!==s[3]&&1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&(h=!0,i=o=a=r=0,n=void(4<s.length&&(o=-s[4],5<s.length)&&(i=-s[5])),this._dictionary&&this._dictionary.has("Rect")&&(n=this._dictionary.getArray("Rect"))&&1<n.length&&(r=n[0],a=n[1]),r===o&&a===i||0!==o||0!==i||(this._locationDisplaced=!0)):h=!0,h):(n=this.bounds,t&&t.has("Matrix")&&(r=t.getArray("BBox"),s=t.getArray("Matrix"))&&r&&3<s.length&&2<r.length&&void 0!==s[0]&&void 0!==s[1]&&void 0!==s[2]&&void 0!==s[3]&&1===s[0]&&0===s[1]&&0===s[2]&&1===s[3]&&void 0!==r[0]&&void 0!==r[1]&&void 0!==r[2]&&void 0!==r[3]&&(this._page&&r[0]!==-s[4]&&r[1]!==-s[5]||0===r[0]&&0==-s[4])&&(o=(a=this._page.graphics).save(),void 0!==this.opacity&&this._opacity<1&&a.setTransparency(this._opacity),n.x-=r[0],n.y+=r[1],a.drawTemplate(e,n),a.restore(o),this._page.annotations.remove(this),c=!1),c)},a.prototype._flattenAnnotationTemplate=function(t,e,i){this._page._isLineAnnotation=i=void 0===i?!1:i;var n,r,s,a,o,h,i=this._page.graphics,c=this.bounds;this instanceof xi&&this._dictionary&&!this._dictionary.has("AP")&&(c=this._isLoaded||(!(this instanceof xi)||this.measure)&&this._setAppearance&&this.flatten&&!this.measure?this._bounds:Os([this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height]),this._page?(s=this._page.size,n=this._page.mediaBox,(r=this._page.cropBox)&&Array.isArray(r)&&4===r.length&&this._page._pageDictionary.has("CropBox")&&!this._isLoaded&&!this._flatten?0===r[0]&&0===r[1]&&s.width!==r[2]&&s.height!==r[3]||c.x===r[0]?c.y=s.height-(c.y+c.height):(c.x-=r[0],c.y=r[3]-(c.y+c.height)):n&&Array.isArray(n)&&4===n.length&&this._page._pageDictionary.has("MediaBox")&&!this._isLoaded&&!this._flatten?0<n[0]||0<n[1]||s.width===n[2]||s.height===n[3]?(c.x-=n[0],c.y=n[3]-(c.y+c.height)):c.y=s.height-(c.y+c.height):this instanceof xi&&!this.measure&&!this._isLoaded?c.y=s.height-(c.y+c.height):this._setAppearance&&this.flatten&&!this.measure?c=this.bounds:this._isLoaded||(c.y=s.height-(c.y+c.height))):c.y=c.y+c.height),null!=c&&(this._page&&"function"==typeof this._page._getTemplateReservedSpace&&(r=this._page._getTemplateReservedSpace())&&Array.isArray(r)&&4===r.length&&(c.x+=r[3],c.y-=r[0]),n=i.save(),this._page._needInitializeGraphics=!0,this._type===M._PdfAnnotationType.rubberStampAnnotation&&(o=!0,this._dictionary)&&this._dictionary.has("AP")&&((r=this._dictionary.get("AP"))&&r.has("N")&&(r=r.get("N"),270===this.rotate)&&this._page.rotation===M.PdfRotationAngle.angle270&&r&&r.dictionary&&r.dictionary.has("Matrix")&&(h=r.dictionary.getArray("Matrix"))&&6===h.length&&0===h[4]&&0!==h[5]&&(o=!1),!e)&&this.rotate!==M.PdfRotationAngle.angle180&&o&&(t._isAnnotationTemplate=!0,t._needScale=!0),e||this._type===M._PdfAnnotationType.rubberStampAnnotation||(t._isAnnotationTemplate=!0,t._needScale=!0),void 0!==this.opacity&&this._opacity<1&&i.setTransparency(this._opacity),r=this._calculateTemplateBounds(c,this._page,t,e,i),this._type===M._PdfAnnotationType.rubberStampAnnotation&&(s=void 0,s=this.rotate===M.PdfRotationAngle.angle0?{width:r.width,height:r.height}:t._size,e=!(c=[r.x,r.y]),this.rotate!==M.PdfRotationAngle.angle0&&t._content&&t._content.dictionary.has("Matrix")&&(h=t._content.dictionary.getArray("Matrix"))&&6===h.length&&0===h[4]&&0!==h[5]&&(e=!0),h=0<t._size.width?r.width/t._size.width:1,a=0<t._size.height?r.height/t._size.height:1,o=!(Math.trunc(1e3*h)/1e3==1&&Math.trunc(1e3*a)/1e3==1),this.rotate!==M.PdfRotationAngle.angle0)&&e&&(this.rotate===M.PdfRotationAngle.angle90?this._page&&this._page.rotation===M.PdfRotationAngle.angle270?!o||0===r.x&&0===r.y?(c[0]+=s.height,c[1]+=s.width-s.height+(s.width-s.height)):(c[0]+=s.width-s.height,c[1]+=s.width):o||(c[0]+=s.height):this.rotate===M.PdfRotationAngle.angle270?this._page&&this._page.rotation===M.PdfRotationAngle.angle270?o&&t._isAnnotationTemplate?c[1]=r.y-r.width:o&&(c[1]+=s.width-s.height):o||0===r.x&&0===r.y?c[1]+=-(s.width-s.height):c[1]+=-s.width:this.rotate===M.PdfRotationAngle.angle180&&(c[0]+=s.width,c[1]+=-s.height)),!t._content.dictionary.has("Matrix")&&t._content.dictionary.has("BBox")&&(h=t._content.dictionary.getArray("BBox"),r.x-=h[0],r.y+=h[1]),this instanceof qi&&!this._isLoaded&&(r=Ls(this._dictionary,this._page)),i.drawTemplate(t,r),i.restore(n)),this._page.annotations.remove(this)},a.prototype._calculateTemplateBounds=function(t,e,i,n,r){var s,a=t,o=t.x,h=t.y,c=t.width,_=t.height;return n||(s=this._dictionary.getArray("Rect"))&&(a=Os(s)),void 0!==e&&(90===(s=this._obtainGraphicsRotation(r._matrix))?(r.translateTransform({x:i._size.height,y:0}),r.rotateTransform(90),n||void 0!==this._rotate&&this._rotate===M.PdfRotationAngle.angle180?(o=t.x,h=this._locationDisplaced?e._origin&&0!==e._o[1]?t.y+t.height:-(e.size.height-(t.height+t.y)+(t.height-i._size.height)):-(e.size.height-t.y-t.height)):(o=t.x,h=-(e.size.height-(t.height+t.y)+(t.width-i._size.height)),c=t.height,_=t.width)):180===s?(r.translateTransform({x:i._size.width,y:i._size.height}),r.rotateTransform(180),n?(o=-(e.size.width-(t.x+t.width)),h=-(e.size.height-t.y-t.height)):(o=-(e.size.width-(t.x+i._size.width)),h=-(e.size.height-t.y-i._size.height),void 0===this.rotationAngle||this._rotate!==M.PdfRotationAngle.angle90&&this._rotate!==M.PdfRotationAngle.angle270||(h=-(e.size.height-t.y-i._size.height)-(t.width-t.height),c=t.height,_=t.width))):270===s?(r.translateTransform({x:0,y:i._size.width}),r.rotateTransform(270),n||void 0!==this.rotationAngle&&this._rotate===M.PdfRotationAngle.angle180?(o=-(e.size.width-t.x-t.width),h=t.y):(o=-(e.size.width-a.x-i._size.width),r=i._content.dictionary.getArray("Matrix"),e=i._content.dictionary.getArray("BBox"),h=r&&e&&r[5]!==e[2]?t.y-(t.height-t.width):t.y+t.height-t.width,c=t.height,_=t.width)):0!==s||n||void 0===this.rotationAngle||this.rotationAngle!==M.PdfRotationAngle.angle90&&this.rotationAngle!==M.PdfRotationAngle.angle270||(o=t.x,h=t.y+t.height-t.width,c=t.height,_=t.width)),{x:o,y:h,width:c,height:_}},a.prototype._obtainGraphicsRotation=function(t){var t=Math.atan2(t._matrix._elements[2],t._matrix._elements[0]),e=Math.round(180*t/Math.PI);switch(e){case-90:e=90;break;case-180:e=180;break;case 90:e=270}return e},a.prototype._removeAnnotation=function(t,e){t&&e&&(t.annotations.remove(e),t._pageDictionary._updated=!0)},a.prototype._drawCloudStyle=function(t,e,i,n,r,s,a){k(s)&&this._isClockWise(s)&&s.reverse();var o,h=[],c=2*n*r;k(s)?o=s[s.length-1]:s=[];for(var _=0;_<s.length;_++){var d=s[_],l=d.x-o.x,u=d.y-o.y,p=Math.sqrt(l*l+u*u);l/=p,u/=p;for(var f=0;f+.1*c<p;f+=c){var g=new hr;g.point={x:o.x+f*l,y:o.y+f*u},h.push(g)}o=d}for(var y=h[h.length-1],_=0;_<h.length;_++){var m=h[_],b=this._getIntersectionDegrees([y.point.x,y.point.y],[m.point.x,m.point.y],n);y.endAngle=b[0],m.startAngle=b[1],y=m}for(var w=new C,_=0;_<h.length;_++){var v=(T=h[_]).startAngle%360,S=T.endAngle%360,P=0;0<v&&S<0?P=180-v+(180-(S<0?-S:S)):v<0&&0<S?P=S-v:0<v&&0<S?P=S<v?360-(v-S):S-v:v<0&&S<0&&(P=S<v?360-(v-S):-(v-S)),P<0&&(P=-P),T.endAngle=P,w.addArc({x:T.point.x-n,y:T.point.y-n,width:2*n,height:2*n},v,P)}w.closeFigure();for(var x,r=[],A=(a&&(r=w._points.map(function(t){return{x:t.x,y:-t.y}})),(x=new C)._points=a?r:w._points,x._pathTypes=w._pathTypes,k(e)&&t.drawPath(x,e),180/(3*Math.PI)),w=new C,_=0;_<h.length;_++){var T=h[_];w.addArc({x:T.point.x-n,y:T.point.y-n,width:2*n,height:2*n},T.startAngle,T.endAngle+A)}w.closeFigure(),r=[],a&&(r=w._points.map(function(t){return{x:t.x,y:-t.y}})),(x=new C)._points=a?r:w._points,x._pathTypes=w._pathTypes,t.drawPath(x,i)},a.prototype._isClockWise=function(t){var e=0;if(k(t))for(var i=0;i<t.length;i++){var n=t[i],r=t[(i+1)%t.length];e+=(r.x-n.x)*(r.y+n.y)}return 0<e},a.prototype._getIntersectionDegrees=function(t,e,i){var n=e[0]-t[0],e=e[1]-t[1],t=.5*Math.sqrt(n*n+e*e)/i,i=(t<-1?t=-1:1<t&&(t=1),Math.atan2(e,n)),e=Math.acos(t);return[(i-e)*(180/Math.PI),(Math.PI+i+e)*(180/Math.PI)]},a.prototype._obtainStyle=function(t,e,i,n){var r,s,a=this.border.dash;return a&&0<a.length&&(r=a.slice(),a.some(function(t){return 0<t}))&&this.border.style===M.PdfBorderStyle.dashed&&(t._dashStyle=M.PdfDashStyle.dash,t._dashPattern=r),n?n instanceof or?(!this._isBounds&&this._dictionary.has("RD")?(s=this._dictionary.getArray("RD"))&&(e[0]=e[0]+s[0],e[1]=e[1]+i+s[1],e[2]=e[2]-(s[0]+s[2]),e[3]=e[3]-(s[1]+s[3])):(e[0]=e[0]+i,e[1]=e[1]+i,e[2]=e[2]-this.border.width,e[3]=e[3]-this.border.width),n.bounds={x:e[0],y:e[1],width:e[2],height:e[3]}):0!==n.intensity&&n.style===M.PdfBorderEffectStyle.cloudy?(a=5*n.intensity,e[0]=e[0]+a+i,e[1]=e[1]+a+i,e[2]=e[2]-2*a-2*i,e[3]=e[3]-2*a-2*i):(e[0]=e[0]+i,e[1]=e[1]+i,e[2]=e[2]-this.border.width,e[3]=this.bounds.height-this.border.width):!this._isBounds&&this._dictionary&&this._dictionary.has("RD")?(s=this._dictionary.getArray("RD"))&&(e[0]=e[0]+s[0],e[1]=e[1]+i+s[1],e[2]=e[2]-2*s[2],e[3]=e[3]-this.border.width,e[3]=e[3]-2*s[3]):(e[1]=e[1]+i,e[3]=this.bounds.height-this.border.width),e},a.prototype._createRectangleAppearance=function(t){var e,i,n,r=this.border.width,s=this._dictionary.getArray("RD"),s=(s||null==t||0===t.intensity||t.style!==M.PdfBorderEffectStyle.cloudy||(i={x:this.bounds.x-5*t.intensity-r/2,y:this.bounds.y-5*t.intensity-r/2,width:this.bounds.width+10*t.intensity+r,height:this.bounds.height+10*t.intensity+r},s=[(a=5*t.intensity)+r/2,a+r/2,a+r/2,a+r/2],this._dictionary.set("RD",s),this.bounds=i),!this._isBounds&&s&&(i={x:this.bounds.x+s[0],y:this.bounds.y+s[1],width:this.bounds.width-2*s[2],height:this.bounds.height-2*s[3]},0!==t.intensity&&t.style===M.PdfBorderEffectStyle.cloudy?(i.x=i.x-5*t.intensity-r/2,i.y=i.y-5*t.intensity-r/2,i.width=i.width+10*t.intensity+r,i.height=i.height+10*t.intensity+r,a=5*t.intensity,this._dictionary.set("RD",[a+r/2,a+r/2,a+r/2,a+r/2])):delete this._dictionary._map.RD,this.bounds=i),r/2),a=[0,0,this.bounds.width,this.bounds.height];return this._customTemplate.has("N")?e=this._customTemplate.get("N"):(ua(e=new P(a,this._crossReference),this._getRotationAngle()),0!==t.intensity&&t.style===M.PdfBorderEffectStyle.cloudy&&(e._writeTransformation=!1),i=e.graphics,n=new or,this.innerColor&&(n.backBrush=new A(this._innerColor)),0<r&&this.color&&(n.borderPen=new x(this._color,r)),this.color&&(n.foreBrush=new A(this._color)),r=this._obtainStyle(n.borderPen,a,s,t),void 0!==this.opacity&&this._opacity<1&&(i.save(),i.setTransparency(this._opacity)),0!==t.intensity&&t.style===M.PdfBorderEffectStyle.cloudy?this._drawRectangleAppearance(r,i,n,t.intensity):i.drawRectangle({x:r[0],y:r[1],width:r[2],height:r[3]},n.borderPen,n.backBrush),void 0!==this.opacity&&this._opacity<1&&i.restore()),e},a.prototype._drawRectangleAppearance=function(t,e,i,n){var r=new C,s=(k(t)&&4===t.length&&r.addRectangle({x:t[0],y:t[1],width:t[2],height:t[3]}),0);0<(s=k(n)?4.25*n:s)?(n=r._points.map(function(t){return{x:t.x,y:-t.y}}),(r=new C).addPolygon(n),this._drawCloudStyle(e,i.backBrush,i.borderPen,s,.833,r._points,!1)):e.drawRectangle({x:t[0],y:t[1],width:t[2],height:t[3]},i.borderPen,i.backBrush)},a.prototype._createCircleAppearance=function(){var t,e,i,n,r,s,a=[0,0,this.bounds.width,this.bounds.height];return this._customTemplate.has("N")?t=this._customTemplate.get("N"):(ua(t=new P(a,this._crossReference),this._getRotationAngle(),this),this._dictionary.has("BE")&&(t._writeTransformation=!1),void 0===this.color&&(this._isTransparentColor=!0),e=t.graphics,i=this.border.width,s=new x(this.color,i),this.border.style===M.PdfBorderStyle.dashed?(s._dashStyle=M.PdfDashStyle.dash,s._dashPattern=[3,1]):this.border.style===M.PdfBorderStyle.dot&&(s._dashStyle=M.PdfDashStyle.dot,s._dashPattern=[1,1]),n=new or,this.innerColor&&(n.backBrush=new A(this._innerColor)),0<i&&(n.borderPen=s),this.color&&(n.foreBrush=new A(this._color)),r=(n.borderWidth=i)/2,s=this._obtainStyle(s,a,r),void 0!==this.opacity&&this._opacity<1&&(e.save(),e.setTransparency(this._opacity)),this._dictionary.has("BE")?this._drawCircleAppearance(s,r,e,n):e.drawEllipse({x:s[0]+r,y:s[1],width:s[2]-i,height:s[3]},n.borderPen,n.backBrush),void 0!==this._opacity&&this._opacity<1&&e.restore()),t},a.prototype._drawCircleAppearance=function(t,e,i,n){var r=0;if(0<(r=this._dictionary.has("RD")&&(s=this._dictionary.getArray("RD"))&&0<s.length?s[0]:r)){for(var s=[t[0]+e,-t[1]-t[3],t[2]-this.border.width,t[3]],a=s[0],o=s[1],h=s[0]+s[2],c=s[1]+s[3],_=[],d=(_.push([h,c]),_.push([a,c]),_.push([a,o]),_.push([h,o]),[]),l=(d.push([h,o+s[3]/2]),d.push([a+s[2]/2,c]),d.push([a,o+s[3]/2]),d.push([a+s[2]/2,o]),[]),u=(l.push([a+s[2]/2,c]),l.push([a,o+s[3]/2]),l.push([a+s[2]/2,o]),l.push([h,o+s[3]/2]),[]),p=0;p<_.length;p++)this._createBezier(d[p],_[p],l[p],u);this._drawCloudStyle(i,n.backBrush,n.borderPen,r,.833,u.map(function(t){return{x:t[0],y:t[1]}}),!1)}else i.drawEllipse({x:t[0]+e,y:-t[1],width:t[2]-this.border.width,height:-t[3]},n.borderPen,n.backBrush)},a.prototype._createBezier=function(t,e,i,n){n.push(t),this._populateBezierPoints(t,e,i,0,n),n.push(i)},a.prototype._populateBezierPoints=function(t,e,i,n,r){var s,a;n<2&&(s=this._midPoint(t,e),e=this._midPoint(e,i),a=this._midPoint(s,e),this._populateBezierPoints(t,s,a,++n,r),r.push(a),this._populateBezierPoints(a,e,i,n,r))},a.prototype._midPoint=function(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]},a.prototype._getAngle=function(t){var e=t[0].x,i=t[0].y,n=t[1].x,t=t[1].y,r=0;return n-e==0?r=i<t?90:270:(r=Math.atan((t-i)/(n-e))*(180/Math.PI),(n-e<0||t-i<0)&&(r+=180),0<n-e&&t-i<0&&(r-=180),r<0&&(r+=360)),r},a.prototype._getAxisValue=function(t,e,i){return null==i&&(i=0),{x:t.x+Math.cos(e*this._degreeToRadian)*i,y:t.y+Math.sin(e*this._degreeToRadian)*i}},a.prototype._prepareOpenArrow=function(t,e,i,n){var r=t?30:150,s=9*n,e=this._getAxisValue(e,i,t?n:-n);return{startPoint:e,first:this._getAxisValue(e,i+r,s),second:this._getAxisValue(e,i-r,s)}},a.prototype._prepareReverseOpenArrow=function(t,e,i,n){var r=t?150:30,s=9*n,e=this._getAxisValue(e,i,t?-n:n);return{startPoint:e,first:this._getAxisValue(e,i+r,s),second:this._getAxisValue(e,i-r,s)}},a.prototype._prepareClosedArrow=function(t,e,i,n){var r=t?30:150,s=9*n,e=this._getAxisValue(e,i,t?n:-n);return{startPoint:e,first:this._getAxisValue(e,i+r,s),second:this._getAxisValue(e,i-r,s)}},a.prototype._prepareReverseCloseArrow=function(t,e,i,n){var r=t?150:30,s=9*n,e=this._getAxisValue(e,i,t?-n:n);return{startPoint:e,first:this._getAxisValue(e,i+r,s),second:this._getAxisValue(e,i-r,s)}},a.prototype._prepareSlash=function(t,e,i){i*=9;return{first:this._getAxisValue(t,e+60,i),second:this._getAxisValue(t,e-120,i)}},a.prototype._prepareDiamond=function(t,e){e*=3;return{first:this._getAxisValue(t,180,e),second:this._getAxisValue(t,90,e),third:this._getAxisValue(t,0,e),fourth:this._getAxisValue(t,-90,e)}},a.prototype._prepareButt=function(t,e,i){i*=3;return{first:this._getAxisValue(t,e+90,i),second:this._getAxisValue(t,e-90,i)}},a.prototype._getBoundsFromLineEndStyle=function(t,e,i,n,r,s){var a,o,h,c;switch(n){case M.PdfLineEndingStyle.square:case M.PdfLineEndingStyle.circle:a={x:t.x-3*r,y:t.y+3*r,width:6*r,height:6*r};break;case M.PdfLineEndingStyle.openArrow:c=this._prepareOpenArrow(s,t,e,r),(o=new C)._pen=i,o.addLine({x:c.startPoint.x,y:c.startPoint.y},{x:c.first.x,y:c.first.y}),o.addLine({x:c.startPoint.x,y:c.startPoint.y},{x:c.second.x,y:c.second.y}),a={x:(h=o._getBounds())[0],y:h[1],width:h[2],height:h[3]};break;case M.PdfLineEndingStyle.closedArrow:c=this._prepareClosedArrow(s,t,e,r),a=this._getBoundsValue([c.startPoint.x,c.startPoint.y,c.first.x,c.first.y,c.second.x,c.second.y]);break;case M.PdfLineEndingStyle.rOpenArrow:c=this._prepareReverseOpenArrow(s,t,e,r),(o=new C)._pen=i,o.addLine({x:c.startPoint.x,y:c.startPoint.y},{x:c.first.x,y:c.first.y}),o.addLine({x:c.startPoint.x,y:c.startPoint.y},{x:c.second.x,y:c.second.y}),a={x:(h=o._getBounds())[0],y:h[1],width:h[2],height:h[3]};break;case M.PdfLineEndingStyle.rClosedArrow:c=this._prepareReverseCloseArrow(s,t,e,r),a=this._getBoundsValue([c.startPoint.x,c.startPoint.y,c.first.x,c.first.y,c.second.x,c.second.y]);break;case M.PdfLineEndingStyle.slash:c=this._prepareSlash(t,e,r),a=this._getBoundsValue([t.x,t.y,c.first.x,c.first.y,c.second.x,c.second.y]);break;case M.PdfLineEndingStyle.diamond:c=this._prepareDiamond(t,r),a=this._getBoundsValue([c.first.x,c.first.y,c.second.x,c.second.y,c.third.x,c.third.y,c.fourth.x,c.fourth.y]);break;case M.PdfLineEndingStyle.butt:c=this._prepareButt(t,e,r),a=this._getBoundsValue([c.first.x,c.first.y,c.second.x,c.second.y])}return a},a.prototype._drawLineEndStyle=function(t,e,i,n,r,s,a,o){var h,c;switch(s){case M.PdfLineEndingStyle.square:e.drawRectangle({x:t.x-3*a,y:-(t.y+3*a),width:6*a,height:6*a},n,r);break;case M.PdfLineEndingStyle.circle:e.drawEllipse({x:t.x-3*a,y:-(t.y+3*a),width:6*a,height:6*a},n,r);break;case M.PdfLineEndingStyle.openArrow:c=this._prepareOpenArrow(o,t,i,a),(h=new C)._pen=n,h.addLine({x:c.startPoint.x,y:-c.startPoint.y},{x:c.first.x,y:-c.first.y}),h.addLine({x:c.startPoint.x,y:-c.startPoint.y},{x:c.second.x,y:-c.second.y}),e._stateControl(n,null,null),e._buildUpPath(h._points,h._pathTypes),e._drawGraphicsPath(n,null,h._fillMode,!1);break;case M.PdfLineEndingStyle.closedArrow:c=this._prepareClosedArrow(o,t,i,a),e.drawPolygon([{x:c.startPoint.x,y:-c.startPoint.y},{x:c.first.x,y:-c.first.y},{x:c.second.x,y:-c.second.y}],n,r);break;case M.PdfLineEndingStyle.rOpenArrow:c=this._prepareReverseOpenArrow(o,t,i,a),(h=new C)._pen=n,h.addLine({x:c.startPoint.x,y:-c.startPoint.y},{x:c.first.x,y:-c.first.y}),h.addLine({x:c.startPoint.x,y:-c.startPoint.y},{x:c.second.x,y:-c.second.y}),e._stateControl(n,null,null),e._buildUpPath(h._points,h._pathTypes),e._drawGraphicsPath(n,null,h._fillMode,!1);break;case M.PdfLineEndingStyle.rClosedArrow:c=this._prepareReverseCloseArrow(o,t,i,a),e.drawPolygon([{x:c.startPoint.x,y:-c.startPoint.y},{x:c.first.x,y:-c.first.y},{x:c.second.x,y:-c.second.y}],n,r);break;case M.PdfLineEndingStyle.slash:c=this._prepareSlash(t,i,a),e.drawLine(n,{x:t.x,y:-t.y},{x:c.first.x,y:-c.first.y}),e.drawLine(n,{x:t.x,y:-t.y},{x:c.second.x,y:-c.second.y});break;case M.PdfLineEndingStyle.diamond:c=this._prepareDiamond(t,a),e.drawPolygon([{x:c.first.x,y:-c.first.y},{x:c.second.x,y:-c.second.y},{x:c.third.x,y:-c.third.y},{x:c.fourth.x,y:-c.fourth.y}],n,r);break;case M.PdfLineEndingStyle.butt:c=this._prepareButt(t,i,a),e.drawLine(n,{x:c.first.x,y:-c.first.y},{x:c.second.x,y:-c.second.y})}},a.prototype._getCombinedRectangleBounds=function(t,e){var i=Math.min(t.x,e.x),n=Math.min(t.y,e.y);return{x:i,y:n,width:Math.max(t.x+t.width,e.x+e.width)-i,height:Math.max(t.y+t.height,e.y+e.height)-n}},a.prototype._drawLineStyle=function(t,e,i,n,r,s,a,o){0===o&&(o=1,r=null),this._drawLineEndStyle(t,i,n,r,s,a.begin,o,!0),this._drawLineEndStyle(e,i,n,r,s,a.end,o,!1)},a.prototype._obtainFontDetails=function(){var i,n="",e=M.PdfFontStyle.regular;if(this._dictionary.has("DS")||this._dictionary.has("DA")){var r,t=!1;if(this._dictionary.has("DS"))this._dictionary.get("DS").split(";").forEach(function(t){var e=t.split(":");if(-1!==t.indexOf("font-family"))n=e[1];else if(-1!==t.indexOf("font-size"))e[1].endsWith("pt")&&(i=Number.parseFloat(e[1].replace("pt","")));else if(-1!==t.indexOf("font-style")||-1!==t.indexOf("style"))r=e[1];else if(-1!==t.indexOf("font")){for(e[1].split(" ").forEach(function(t){""===t||t.endsWith("pt")||(n+=t+" "),t.endsWith("pt")&&(i=Number.parseFloat(t.replace("pt","")))});" "!==n&&n.endsWith(" ");)n=n.substring(0,n.length-1);-1!==n.indexOf(",")&&(n=n.split(",")[0])}});else{var s=this._dictionary.get("DA");if(s&&""!==s&&-1!==s.indexOf("Tf")){var a=s.split(" ");a.forEach(function(t,e){if(-1!==t.indexOf("Tf")){for(n=a[e-2];""!==n&&1<n.length&&"/"===n[0];)n=n.substring(1);i=Number.parseFloat(a[e-1])}})}else if(this._dictionary.has("AP")){var o,h=this._dictionary.get("AP");switch((o=this._parseFontFromAppearance(h,this instanceof Bn?["R","N","D"]:["N","R","D"])).name){case"Helvetica":case"Courier":case"Symbol":case"TimesRoman":case"ZapfDingbats":case"MonotypeSungLight":case"SinoTypeSongLight":case"MonotypeHeiMedium":case"HanyangSystemsGothicMedium":case"HanyangSystemsShinMyeongJoMedium":case"HeiseiKakuGothicW5":case"HeiseiMinchoW3":n=o.name;break;case"Times-Roman":n="TimesRoman";break;default:n="Helvetica"}i=o.fontSize,e=void 0===o.style||null===o.style?M.PdfFontStyle.regular:o.style,t=!0}}t||r&&""!==r&&(s=[r],r.includes(":")?s=r.split(":"):r.includes(",")&&(s=r.split(",")),s)&&s.forEach(function(t){switch((t=t.trim()).toLowerCase()){case"bold":e|=M.PdfFontStyle.bold;break;case"italic":e|=M.PdfFontStyle.italic;break;case"strikeout":e|=M.PdfFontStyle.strikeout;break;case"underline":e|=M.PdfFontStyle.underline}}),n=n&&n.trim()}else this._dictionary.has("AP")&&(h=this._dictionary.get("AP"),n=(o=this._parseFontFromAppearance(h,this instanceof Bn?["R","N","D"]:["N","R","D"])).name,i=o.fontSize,e=o.style);return this instanceof In&&this._font&&this._font.style!==e&&(e=this._font.style),{name:n,size:i,style:e}},a.prototype._parseFontFromAppearance=function(t,e){var i;if(t)for(var n=0,r=e;n<r.length;n++){var s=r[n];if(t.has(s)){s=t.get(s);s&&(i=this._obtainAppearanceFont(s,void 0,void 0,void 0));break}}return i},a.prototype._obtainAppearanceFont=function(t,e,i,n){if(t&&t instanceof y&&t.dictionary&&t.dictionary.has("Resources"))for(var r=t.dictionary.get("Resources"),s=0,a=new ui(t.getBytes())._readContent();s<a.length;s++){var o,h=a[s],c=h._operands;"Tf"===h._operator&&(h=c[0],r.has("Font"))&&(o=r.get("Font"))&&h.includes("/")&&(h=h.replace(/\//g,""),o=o.get(h))&&o.has("BaseFont")&&(e=o.get("BaseFont").name)&&(h=e.includes("Bold"),o=e.includes("Italic")||e.includes("Oblique"),(e.includes("Times")||e.includes("Helvetica")||e.includes("Courier"))&&(h&&o?n=M.PdfFontStyle.bold|M.PdfFontStyle.italic:h?n=M.PdfFontStyle.bold:o&&(n=M.PdfFontStyle.italic)),c[1])&&(i=Number.parseFloat(c[1]))}return{name:e,fontSize:i,style:n}},a.prototype._obtainFont=function(){var t=this._obtainFontDetails();return Ya(t.name,t.size,t.style,this)},a.prototype._getEqualPdfGraphicsUnit=function(t,e){var i;switch(t){case M.PdfMeasurementUnit.inch:i=M._PdfGraphicsUnit.inch,e="in";break;case M.PdfMeasurementUnit.centimeter:i=M._PdfGraphicsUnit.centimeter,e="cm";break;case M.PdfMeasurementUnit.millimeter:i=M._PdfGraphicsUnit.millimeter,e="mm";break;case M.PdfMeasurementUnit.pica:i=M._PdfGraphicsUnit.pica,e="p";break;case M.PdfMeasurementUnit.point:i=M._PdfGraphicsUnit.point,e="pt";break;default:i=M._PdfGraphicsUnit.inch,e="in"}return{graphicsUnit:i,unitString:e}},a.prototype._createMeasureDictionary=function(t){var e=new D,i=(e.set("C",1),e.set("D",100),e.set("F",R.get("D")),e.set("RD","."),e.set("RT",""),e.set("SS",""),e.set("U",t),new D),n=(i.set("C",1),i.set("D",100),i.set("F",R.get("D")),i.set("RD","."),i.set("RT",""),i.set("SS",""),i.set("U","sq "+t),new D),r=("in"===t?n.set("C",.0138889):"cm"===t?n.set("C",.0352778):"mm"===t?n.set("C",.352778):"pt"===t?n.set("C",1):"p"===t&&n.set("C",.0833333),n.set("D",100),n.set("F",R.get("D")),n.set("RD","."),n.set("RT",""),n.set("SS",""),n.set("U",t),new D);return r.set("A",[i]),r.set("D",[e]),r.set("R","1 "+t+" = 1 "+t),r.set("Type",R.get("Measure")),r.set("X",[n]),r},a.prototype._colorToHex=function(t){return t?"#"+this._componentToHex(t[0])+this._componentToHex(t[1])+this._componentToHex(t[2]):"#"+this._componentToHex(0)+this._componentToHex(0)+this._componentToHex(0)},a.prototype._componentToHex=function(t){t=t.toString(16);return 1===t.length?"0"+t:t},a.prototype._getRotatedBounds=function(t,e){if(0<t.width&&0<t.height){for(var i=new Rr,n=(i._rotate(e),[]),e=(n.push({x:t.x,y:t.y}),n.push({x:t.x+t.width,y:t.y}),n.push({x:t.x+t.width,y:t.y+t.height}),n.push({x:t.x,y:t.y+t.height}),n=n.map(function(t){return i._matrix._transform(t)}),new C),r=(e.addRectangle({x:t.x,y:t.y,width:t.width,height:t.height}),e._points=n.slice(0,4),n[0].x),s=n[3].x,a=n[0].y,o=n[3].y,h=0;h<4;h++)n[h].x<r&&(r=n[h].x),n[h].x>s&&(s=n[h].x),n[h].y<a&&(a=n[h].y),n[h].y>o&&(o=n[h].y);return{x:t.x,y:t.y,width:Math.round(s-r),height:Math.round(o-a)}}return t},a.prototype._flattenPopUp=function(){this._flattenPop(this._page,this.color,this.bounds,this.border,this.author,this.subject,this.text)},a.prototype._flattenPop=function(t,e,i,n,r,s,a){var o,h={width:0,height:0},i=[(h=t&&t.size?t.size:h).width-180,i.y+142<h.height?i.y:h.height-142,180,142],c=(this._dictionary.has("Popup")&&this._dictionary.get("Popup")&&(h=this._dictionary.getArray("Rect"))&&4===h.length&&(i=[c=h[0],_=h[1],h[2]-c,h[3]-_]),new A(e=void 0===e?{r:0,g:0,b:0}:e)),h=n.width/2,_=new x({r:0,g:0,b:0},1),d=0,e=new A(this._getForeColor(e)),e=(null!=r&&""!==r?d=this._drawAuthor(r,s,i,c,e,t,d,n):null!=s&&""!==s?(o=[i[0]+h,i[1]+h,i[2]-n.width,40],this._saveGraphics(t,M.PdfBlendMode.hardLight),this._isTransparentColor?t.graphics.drawRectangle({x:o[0],y:o[1],width:o[2],height:o[3]},_):t.graphics.drawRectangle({x:o[0],y:o[1],width:o[2],height:o[3]},_,c),t.graphics.restore(),r=[(r=[o[0]+11,o[1],o[2],o[3]/2])[0],r[1]+r[3]-2,r[2],o[3]/2],this._saveGraphics(t,M.PdfBlendMode.normal),this._drawSubject(s,{x:r[0],y:r[1],width:r[2],height:r[3]},t),t.graphics.restore(),d=40):(this._saveGraphics(t,M.PdfBlendMode.hardLight),o=[i[0]+h,i[1]+h,i[2]-n.width,20],this._isTransparentColor?t.graphics.drawRectangle({x:o[0],y:o[1],width:o[2],height:o[3]},_):t.graphics.drawRectangle({x:o[0],y:o[1],width:o[2],height:o[3]},_,c),d=20,t.graphics.restore()),[i[0]+h,i[1]+h+d,i[2]-n.width,i[3]-(d+n.width)]);this._saveGraphics(t,M.PdfBlendMode.hardLight),t.graphics.drawRectangle({x:e[0],y:e[1],width:e[2],height:e[3]},new x({r:0,g:0,b:0},1),new A({r:255,g:255,b:255})),e[0]+=11,e[1]+=5,e[2]-=22,t.graphics.restore(),this._saveGraphics(t,M.PdfBlendMode.normal),null!=a&&""!==a&&t.graphics.drawString(a,this._popUpFont,{x:e[0],y:e[1],width:e[2],height:e[3]},null,new A({r:0,g:0,b:0}),null),t.graphics.restore()},a.prototype._flattenLoadedPopUp=function(){var t,e,i,n,r,s,a="",o=(this._dictionary.has("Contents")&&(a=this._dictionary.get("Contents")),this.author),h=this.subject,c=new x({r:0,g:0,b:0},1);this._dictionary.has("Popup")?(t=this._getRectangleBoundsValue(),void 0===this.color&&(this.color={r:0,g:0,b:0}),e=new A(this.color),i=this.border.width/2,n=0,s=new A(this._getForeColor(this.color)),void 0!==this.author&&null!==this.author&&""!==this.author?n=this._drawAuthor(this.author,this.subject,t,e,s,this._page,n,this.border):(n=void 0!==this.subject&&null!==this.subject&&""!==this.subject?(r=[t[0]+i,t[1]+i,t[2]-this.border.width,40],this._saveGraphics(this._page,M.PdfBlendMode.hardLight),this._page.graphics.drawRectangle({x:r[0],y:r[1],width:r[2],height:r[3]},c,e),this._page.graphics.restore(),s=[(s=[r[0]+11,r[1],r[2],r[3]/2])[0],s[1]+s[3]-2,s[2],r[3]/2],this._saveGraphics(this._page,M.PdfBlendMode.normal),this._drawSubject(this.subject,{x:s[0],y:s[1],width:s[2],height:s[3]},this._page),40):(this._saveGraphics(this._page,M.PdfBlendMode.hardLight),r=[t[0]+i,t[1]+i,t[2]-this.border.width,20],this._page.graphics.drawRectangle({x:r[0],y:r[1],width:r[2],height:r[3]},c,e),20),this._page.graphics.restore()),this._saveGraphics(this._page,M.PdfBlendMode.hardLight),s=[t[0]+i,t[1]+i+n,t[2]-this.border.width,t[3]-(n+this.border.width)],this._page.graphics.drawRectangle({x:s[0],y:s[1],width:s[2],height:s[3]},c,new A({r:255,g:255,b:255})),s[0]+=11,s[1]+=5,s[2]-=22,this._page.graphics.restore(),this._saveGraphics(this._page,M.PdfBlendMode.normal),this._page.graphics.restore(),null!=a&&""!==a&&this._page.graphics.drawString(a,this._popUpFont,{x:s[0],y:s[1],width:s[2],height:s[3]},null,new A({r:0,g:0,b:0}),null),this._page.graphics.restore()):this._flattenPop(this._page,this.color,this.bounds,this.border,o,h,a),this._page.annotations.remove(this)},a.prototype._getRectangleBoundsValue=function(){var t;return this._dictionary.has("Popup")&&null!==(t=this._dictionary.get("Popup").getArray("Rect"))?(null!==this._page?0===t[1]&&0===t[3]?t[1]=t[1]+t[3]:t[1]=this._page._size.height-(t[1]+t[3]):t[1]=t[1]-t[3],t):[0,0,0,0]},a.prototype._getForeColor=function(t){return 128<(t.r+t.g+t.b)/3?{r:0,g:0,b:0}:{r:255,g:255,b:255}},a.prototype._drawAuthor=function(t,e,i,n,r,s,a,o){var h,c=this.border.width/2,_=new x({r:0,g:0,b:0},1),d=new I(M.PdfTextAlignment.left,M.PdfVerticalAlignment.middle),c=[i[0]+c,i[1]+c,i[2]-o.width,20];return null!=e&&""!==e?(c[3]+=20,a=c[3],this._saveGraphics(s,M.PdfBlendMode.hardLight),this._isTransparentColor?s.graphics.drawRectangle({x:c[0],y:c[1],width:c[2],height:c[3]},_):s.graphics.drawRectangle({x:c[0],y:c[1],width:c[2],height:c[3]},_,n),s.graphics.restore(),h={x:c[0]+11,y:c[1],width:c[2],height:c[3]/2},this._saveGraphics(this._page,M.PdfBlendMode.normal),s.graphics.drawString(t,this._authorBoldFont,h,null,r,d),h={x:h.x,y:h.y+h.height-2,width:h.width,height:c[3]/2},this._drawSubject(e,h,s)):(this._saveGraphics(s,M.PdfBlendMode.hardLight),this._isTransparentColor?s.graphics.drawRectangle({x:c[0],y:c[1],width:c[2],height:c[3]},_):s.graphics.drawRectangle({x:c[0],y:c[1],width:c[2],height:c[3]},_,n),s.graphics.restore(),h={x:c[0]+11,y:c[1],width:c[2],height:c[3]},this._saveGraphics(s,M.PdfBlendMode.normal),s.graphics.drawString(t,this._popUpFont,h,null,r,d),a=c[3]),s.graphics.restore(),a},a.prototype._drawSubject=function(t,e,i){var n=new I(M.PdfTextAlignment.left,M.PdfVerticalAlignment.middle);i.graphics.drawString(t,this._authorBoldFont,e,null,new A({r:0,g:0,b:0}),n)},a.prototype._saveGraphics=function(t,e){t.graphics.save(),t.graphics.setTransparency(.8,.8,e)},a.prototype._getBorderColorString=function(t){return(t.r/255).toFixed(3)+" "+(t.g/255).toFixed(3)+" "+(t.b/255).toFixed(3)+" rg "},a.prototype._dateToString=function(t){var e=t.getFullYear(),i=Vo(t.getMonth()+1),n=Vo(t.getDate()),r=Vo(t.getHours()),s=Vo(t.getMinutes()),a=Vo(t.getSeconds()),t=-t.getTimezoneOffset(),o=0<=t?"+":"-",t=Math.abs(t);return"D:"+e+i+n+r+s+a+o+Vo(Math.floor(t/60))+"'"+Vo(t%60)+"'"},a.prototype._stringToDate=function(t){var e,i,n,r,s,a,o,h,c,_,d;return t&&"string"==typeof t?-1!==t.indexOf("/")?(s=t.split("/"),d=parseInt(s[2].split(" ")[0],10),e=parseInt(s[0],10)-1,i=parseInt(s[1],10),s=(s[2].split(" ")[1]||"00:00:00").split(":"),n=parseInt(s[0]||"0",10),r=parseInt(s[1]||"0",10),s=parseInt(s[2]||"0",10),new Date(d,e,i,n,r,s)):(d=(t=t.startsWith("D:")?t.substring(2):t).replace(/'/g,"").trim(),e=parseInt(d.slice(0,4),10),i=6<=d.length,n=8<=d.length,r=10<=d.length,s=12<=d.length,a=14<=d.length,i=i?parseInt(d.slice(4,6),10):1,n=n?parseInt(d.slice(6,8),10):1,r=r?parseInt(d.slice(8,10),10):0,s=s?parseInt(d.slice(10,12),10):0,a=a?parseInt(d.slice(12,14),10):0,d=d.slice(14),o=!1,_=c=h=0,(d=/^[+-]\d{2}:\d{2}$/.test(d)?d.replace(":",""):d)&&(/^[Zz]$/.test(d)?(o=!0,h=1,_=c=0):/^[+-]\d{2}\d{2}$/.test(d)?(o=!0,h="+"===d[0]?1:-1,c=parseInt(d.slice(1,3),10),_=parseInt(d.slice(3,5),10)):/^[+-]\d{2}$/.test(d)&&(o=!0,h="+"===d[0]?1:-1,c=parseInt(d.slice(1,3),10),_=0)),o?(d=Date.UTC(e,i-1,n,r,s,a),new Date(d-60*(h*(60*c+_))*1e3)):new Date(e,i-1,n,r,s,a)):new Date(t)},a.prototype._obtainNativeRectangle=function(){var t,e=[this._bounds.x,this._bounds.y,this.bounds.x+this._bounds.width,this.bounds.y+this._bounds.height],i=this._getCropOrMediaBox();return this._page&&(t=this._page.size,e[1]=t.height-e[3],i)&&2<i.length&&(0!==i[0]||0!==i[1])&&(e[0]+=i[0],e[1]+=i[1]),e},a.prototype._getPoints=function(t){var e=this._getCropOrMediaBox(),i=t?t.map(function(t){return{x:t.x,y:t.y}}):[];if(e&&3<e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&(0!==e[0]||0!==e[1]))for(var n=0;n<i.length;n++){var r=i[n].x,s=i[n].y;i[n].x=r+e[0],this._page._pageDictionary.has("MediaBox")&&!this._page._pageDictionary.has("CropBox")&&0===e[3]&&0<e[1]?i[n].y=s+e[3]:i[n].y=s+e[1]}return i},a.prototype._getCropOrMediaBox=function(){var t,e,i;return(t=!(t=this._page&&this._page._pageDictionary.has("CropBox")?this._page.cropBox:t)&&this._page&&this._page._pageDictionary.has("MediaBox")?this._page.mediaBox:t)&&t[3]<0&&(e=t[1],i=t[3],t[3]=e,t[1]=i),t||[0,0,0,0]},a.prototype._getDocumentLayer=function(){var t,e,i;return this._dictionary.has("OC")&&(t=this._dictionary.getRaw("OC"),e=this._page,t)&&e&&this._crossReference._document&&(i=this._crossReference._document.layers)&&this._isMatched(i,t,e),this.layer},a.prototype._isMatched=function(t,e,i){for(var n=0;n<t.count;n++){var r=t.at(n)._referenceHolder;if(r&&r===e){if(t.at(n).name){this._layer=t.at(n);break}}else t.at(n).layers&&0<t.at(n).layers.count&&this._isMatched(t.at(n).layers,e,i)}},a.prototype._setQuadPoints=function(t){var e,i=[],n=t.height,r=(e=this._page&&this._page._isNew&&this._page._pageSettings&&this._page._pageSettings.margins?{left:(t=this._page._pageSettings.margins).left,top:t.top,right:t.right,bottom:t.bottom}:{left:0,top:0,right:0,bottom:0},0!==this.bounds.x&&0!==this.bounds.y&&0!==this.bounds.width&&0!==this.bounds.height&&(this._boundsCollection[0]=this.bounds),this._quadPoints.length/8),t=this._getMediaOrCropBox(this._page),s=!1;if(!this._isLoaded&&t&&3<t.length&&!this.flatten){var a=t[0],o=t[1];if(0!==a||0!==o){for(var h=0;h<r;h++){var c=(d=this._boundsCollection[h]).x+e.left+a,_=o+e.top;i[0+8*h]=c+e.left,i[1+8*h]=n+_-e.top-d.y,i[2+8*h]=c+d.width+e.left,i[3+8*h]=n+_-e.top-d.y,i[4+8*h]=c+e.left,i[5+8*h]=i[1+8*h]-d.height,i[6+8*h]=c+d.width+e.left,i[7+8*h]=i[5+8*h]}s=!0}}if(!s&&0<this._boundsCollection.length)for(h=0;h<r;h++){var d,c=(d=this._boundsCollection[h]).x,_=d.y;i[0+8*h]=c+e.left,i[1+8*h]=n-_-e.top,i[2+8*h]=c+d.width+e.left,i[3+8*h]=n-_-e.top,i[4+8*h]=c+e.left,i[5+8*h]=i[1+8*h]-d.height,i[6+8*h]=c+d.width+e.left,i[7+8*h]=i[5+8*h]}this._points=[];for(h=0;h<i.length;h+=2)this._points.push({x:i[h],y:i[h+1]});this._dictionary.set("QuadPoints",i)},a.prototype._createTemplate=function(t){var e;if(this._isLoaded&&(t=t||"N",this._dictionary.has("AP"))){var i=this._dictionary.get("AP");if(i&&i.has(t)){var n=i.get(t),r=i.getRaw(t);if(r&&n){(e=new P)._isExported=!0;var s=n.dictionary,a=s.getArray("Matrix"),o=s.getArray("BBox");if(a){for(var h,c,_=[],d=0;d<a.length;d++){var l=a[d];_[d]=l}o&&3<o.length&&(h=Os(o),c=this._transformBBox(h,_),e._size={width:c[2],height:c[3]},e._templateOriginalSize={width:h.width,height:h.height}),n&&"number"==typeof n.offset&&0!==n.offset&&(n.offset=0)}else o&&o[2]===this.bounds.width&&o[3]===this.bounds.height||gs(this._dictionary.get("Rect"),o)?(s.update("Matrix",[1,0,0,1,-o[0],-o[1]]),this._dictionary.has("Vertices")?e._size={width:o[2],height:o[3]}:(e._size={width:this.bounds.width,height:this.bounds.height},this._crossReference._cacheMap.set(r,n))):(c=this._getTransformMatrix(this._dictionary.get("Rect"),o,[1,0,0,1,0,0]),this.bounds.width===c[0]&&this.bounds.height===c[3]?(s.update("Matrix",[c[0],0,0,c[3],0,0]),e._size={width:c[0],height:c[3]},this._crossReference._cacheMap.set(r,n)):(s.update("Matrix",[1,0,0,1,-o[0],-o[1]]),e._size={width:o[2],height:o[3]}));e._exportStream(i,this._crossReference,t)}}}return e},a.prototype._getTransformMatrix=function(t,e,i){var e=this._getAxialAlignedBoundingBox(e,i),i=e[0],n=e[1],r=e[2],e=e[3];return i===r||n===e?[1,0,0,1,t[0],t[1]]:[r=(t[2]-t[0])/(r-i),0,0,e=(t[3]-t[1])/(e-n),t[0]-i*r,t[1]-n*e]},a.prototype._getAxialAlignedBoundingBox=function(t,e){var i=this._applyTransform(t,e),n=this._applyTransform(t.slice(2,4),e),r=this._applyTransform([t[0],t[3]],e),t=this._applyTransform([t[2],t[1]],e);return[Math.min(i[0],n[0],r[0],t[0]),Math.min(i[1],n[1],r[1],t[1]),Math.max(i[0],n[0],r[0],t[0]),Math.max(i[1],n[1],r[1],t[1])]},a.prototype._applyTransform=function(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]},a.prototype._transformBBox=function(t,e){var i=[],n=[],r=this._transformPoint(t.x,t.y+t.height,e),r=(i[0]=r[0],n[0]=r[1],this._transformPoint(t.x+t.width,t.y,e)),r=(i[1]=r[0],n[1]=r[1],this._transformPoint(t.x,t.y,e)),r=(i[2]=r[0],n[2]=r[1],this._transformPoint(t.x+t.width,t.y+t.height,e));return i[3]=r[0],n[3]=r[1],[this._minValue(i),this._minValue(n),this._maxValue(i),this._maxValue(n)]},a.prototype._transformPoint=function(t,e,i){var n=[];return n[0]=t*i[0]+e*i[2]+i[4],n[1]=t*i[1]+e*i[3]+i[5],n},a.prototype._minValue=function(t){for(var e=t[0],i=1;i<t.length;i++)t[i]<e&&(e=t[i]);return e},a.prototype._maxValue=function(t){for(var e=t[0],i=1;i<t.length;i++)t[i]>e&&(e=t[i]);return e},a.prototype._drawTemplate=function(t,e){t&&e&&((t._isExported||t._isResourceExport)&&(this._crossReference?(t._crossReference=this._crossReference,t._importStream(!0,t._isResourceExport)):t._importStream(!1,t._isResourceExport)),this._customTemplate.set(e,t))},a.prototype._drawCustomAppearance=function(n){var r=this;this._customTemplate.forEach(function(t,e){T(n,r._crossReference,e);var i=r._crossReference._getNextReference();t._content.reference=i,t._content.dictionary._update=!0,r._crossReference._cacheMap.set(i,t._content),n.update(e,i)})},a);function a(){this._isImported=!1,this._isLoaded=!1,this._setAppearance=!1,this._isExport=!1,this._opacity=1,this._isAllRotation=!0,this._flatten=!1,this._popUpFont=new E(M.PdfFontFamily.helvetica,10.5),this._authorBoldFont=new E(M.PdfFontFamily.helvetica,10.5,M.PdfFontStyle.bold),this._lineCaptionFont=new E(M.PdfFontFamily.helvetica,10,M.PdfFontStyle.regular),this._circleCaptionFont=new E(M.PdfFontFamily.helvetica,8,M.PdfFontStyle.regular),this._isTransparentColor=!1,this._isRotated=!1,this._isChanged=!1,this._quadPoints=new Array(8),this._boundsCollection=[],this._customTemplate=new Map,this._isTextUpdated=!1}t(Si,wi=bi),Object.defineProperty(Si.prototype,"comments",{get:function(){return this._comments||(this._comments=new dr(this,!1))},enumerable:!0,configurable:!0}),Object.defineProperty(Si.prototype,"reviewHistory",{get:function(){return this._reviewHistory||(this._reviewHistory=new dr(this,!0))},enumerable:!0,configurable:!0});var wi,vi=Si;function Si(){return null!==wi&&wi.apply(this,arguments)||this}t(Ai,Pi=vi),Object.defineProperty(Ai.prototype,"linePoints",{get:function(){var t;return void 0===this._linePoints&&this._dictionary.has("L")&&4===(t=this._dictionary.getArray("L")).length&&(this._linePoints=[{x:t[0],y:t[1]},{x:t[2],y:t[3]}]),this._linePoints},set:function(t){if(Array.isArray(t)&&(void 0===this._linePoints||ws(t,this._linePoints))){if(2!==t.length)throw new Error("Line points length should be 2.");this._dictionary.update("L",[t[0].x,t[0].y,t[1].x,t[1].y]),this._linePoints=t}},enumerable:!0,configurable:!0}),Object.defineProperty(Ai.prototype,"leaderExt",{get:function(){var t;return void 0===this._leaderExt&&this._dictionary.has("LLE")&&void 0!==(t=this._dictionary.get("LLE"))&&(this._leaderExt=t),this._leaderExt},set:function(t){Number.isNaN(t)||(this._dictionary.update("LLE",t),this._leaderExt=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Ai.prototype,"leaderLine",{get:function(){var t;return void 0===this._leaderLine&&this._dictionary.has("LL")&&void 0!==(t=this._dictionary.get("LL"))&&(this._leaderLine=t),this._leaderLine},set:function(t){Number.isNaN(t)||0===this.leaderExt||(this._dictionary.update("LL",t),this._leaderLine=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Ai.prototype,"lineEndingStyle",{get:function(){var t,e;return void 0===this._lineEndingStyle&&((t=new Zn)._dictionary=this._dictionary,this._dictionary.has("LE")&&(e=this._dictionary.getArray("LE"))&&Array.isArray(e)&&(t._begin=Js(e[0].name),t._end=Js(e[1].name)),this._lineEndingStyle=t),this._lineEndingStyle},set:function(t){var e=this.lineEndingStyle;e.begin===t.begin&&e.end===t.end||(e.begin=t.begin,e.end=t.end)},enumerable:!0,configurable:!0}),Object.defineProperty(Ai.prototype,"leaderOffset",{get:function(){var t;return void 0===this._leaderOffset&&this._dictionary.has("LLO")&&void 0!==(t=this._dictionary.get("LLO"))&&0<=t&&(this._leaderOffset=t),this._leaderOffset},set:function(t){Number.isNaN(t)||(this._dictionary.update("LLO",t),this._leaderOffset=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Ai.prototype,"lineIntent",{get:function(){var t;return void 0===this._lineIntent&&this._dictionary.has("IT")&&(t=this._dictionary.get("IT"))&&(this._lineIntent="LineDimension"===t.name?M.PdfLineIntent.lineDimension:M.PdfLineIntent.lineArrow),this._lineIntent},set:function(t){void 0!==t&&t!==this.lineIntent&&(this._lineIntent=t,this._dictionary.update("IT",R.get(t===M.PdfLineIntent.lineDimension?"LineDimension":"LineArrow")))},enumerable:!0,configurable:!0}),Object.defineProperty(Ai.prototype,"measure",{get:function(){return void 0===this._measure&&(this._measure=this._dictionary.has("Measure")),this._measure},set:function(t){!t||this._isLoaded||(this._measure=t,this.caption.cap=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(Ai.prototype,"unit",{get:function(){var t;return this._isTextUpdated||void 0!==this._unit&&!this._isLoaded||(this._dictionary.has("Contents")?(t=this._dictionary.get("Contents"),this._unitString=t.substring(t.length-2),this._unit=ma(this._unitString)):this._unit=M.PdfMeasurementUnit.centimeter),this._unit},set:function(t){!this._measure||this._isLoaded||void 0===t||(this._unit=t)},enumerable:!0,configurable:!0}),Ai._load=function(t,e){var i=new Ai;return i._isLoaded=!0,i._initialize(t,e),i},Ai.prototype._initialize=function(t,e){Pi.prototype._initialize.call(this,t,e)},Ai.prototype._postProcess=function(t){if(void 0===this.linePoints||null===this.linePoints)throw new Error("Line points cannot be null or undefined");var e,i,n,r,s=this._getCropOrMediaBox();s&&3<s.length&&1<this.linePoints.length&&"number"==typeof s[0]&&"number"==typeof s[1]&&(0!==s[0]||0!==s[1])&&(this._linePoints[0].x+=s[0],this._linePoints[0].y+=s[1],this._linePoints[1].x+=s[0],this._linePoints[1].y+=s[1],this._dictionary.update("L",[this._linePoints[0].x,this._linePoints[0].y,this._linePoints[1].x,this._linePoints[1].y])),this._dictionary.has("Cap")||this._dictionary.set("Cap",!1),this._dictionary.has("CP")||this._dictionary.set("CP",R.get("Inline")),this._dictionary.has("LE")||(this.lineEndingStyle=new Zn),this._dictionary.has("LL")||(this.leaderLine=0),this._dictionary.has("LLE")||(this.leaderExt=0),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),this._dictionary.has("BS")?e=this.border.width:((s=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",s)),void 0===e&&(e=1),null!==this.border.dash&&void 0!==this.border.dash||(this.border.dash=[],this.border.style===M.PdfBorderStyle.dashed?this.border.dash=[3,1]:this.border.style===M.PdfBorderStyle.dot&&(this.border.dash=[1,1])),this._measure?this._appearanceTemplate=this._createLineMeasureAppearance(t):(s=!1,this._setAppearance||this._customTemplate.has("N")?(this._appearanceTemplate=this._createAppearance(),!this._page._isNew||this._flatten||t||(n={x:(i=this._obtainLineBounds())[0],y:i[1],width:i[2],height:i[3]},this._bounds=n,r=[this._bounds.x,this._bounds.y,this._bounds.x+this._bounds.width,this._bounds.y+this._bounds.height],this._dictionary.update("Rect",r),s=!0)):(e=Ms({x:(n=this._obtainLineBounds())[0],y:n[1],width:n[2],height:n[3]}),this._page._isNew&&this._page._pageSettings&&this._setAppearance&&!this.flatten&&(e=no(this,n)),this.bounds={x:e[0],y:e[1],width:e[2],height:e[3]},this._dictionary.update("Rect",e),s=!0),this._dictionary.has("Measure")&&!s&&(n={x:(i=this._obtainLineBounds())[0],y:i[1],width:i[2],height:i[3]},r=void(this._bounds=n),r=this._page&&this._page._isNew&&this._page._pageSettings&&!this._setAppearance&&!this.flatten?no(this):[this._bounds.x,this._bounds.y,this._bounds.x+this._bounds.width,this._bounds.y+this._bounds.height],this._dictionary.update("Rect",r),this.flatten)&&!this.measure&&this._page&&this._page.size&&Array.isArray(this._page.size)&&2<=this._page.size.length&&(this._bounds={x:i[0],y:this._page.size[1]-(i[1]+i[3]),width:i[2],height:i[3]}))},Ai.prototype._doPostProcess=function(t){var e,i,n;void 0===t&&(t=!1),this._isLoaded?((this._setAppearance||0<this._customTemplate.size||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createLineMeasureAppearance(t):this._appearanceTemplate=this._createAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))instanceof y&&((n=e.getRaw("N"))&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference))):(this._postProcess(t),this._appearanceTemplate||t&&(this._dictionary.has("AP")?null!=(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))&&((n=e.getRaw("N"))&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createAppearance())),void 0!==this.flattenPopups&&this.flattenPopups&&t&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t?this._appearanceTemplate?(e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._flattenAnnotationTemplate(this._appearanceTemplate,e,!0)):this._page.annotations.remove(this):(i=void 0,(this._setAppearance||0<this._customTemplate.size)&&(this._dictionary.has("AP")?i=this._dictionary.get("AP"):(n=this._crossReference._getNextReference(),(i=new D(this._crossReference))._updated=!0,this._crossReference._cacheMap.set(n,i),this._dictionary.update("AP",n))),0<this._customTemplate.size?this._drawCustomAppearance(i):i&&this._appearanceTemplate&&this._appearanceTemplate._content&&(T(i,this._crossReference,"N"),n=this._crossReference._getNextReference(),this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=n,this._crossReference._cacheMap.set(n,this._appearanceTemplate._content),i.update("N",n)))},Ai.prototype._createLineMeasureAppearance=function(t){var e=[0,0,0,0],i=this._convertToUnit(),n=this._obtainLinePoints().slice(),r=new C,n=(r._points=n,r._pathTypes=[0,1],r._getBounds()),r=(this._bounds={x:n[0],y:n[1],width:n[2],height:n[3]},new x(void 0!==this.color?this._color:{r:0,g:0,b:0},this.border.width));if(this.innerColor&&(c=new A(this._innerColor)),e=this._obtainLineBounds(),this._customTemplate.has("N")){var s=this._customTemplate.get("N"),a=[e[0],e[1],e[0]+e[2],e[1]+e[3]];this._dictionary.update("Rect",a),this._bounds={x:a[0],y:a[1],width:a[2],height:a[3]}}else{ua(s=new P(e,this._crossReference),0);var o,h,c,_,d,n=new or,l=(s._writeTransformation=!1,s.graphics),u=(n.borderPen=r,this.border.style===M.PdfBorderStyle.dashed?(n.borderPen._dashStyle=M.PdfDashStyle.dash,n.borderPen._dashPattern=[3,1]):this.border.style===M.PdfBorderStyle.dot&&(n.borderPen._dashStyle=M.PdfDashStyle.dot,n.borderPen._dashPattern=[1,1]),n.backBrush=c,n.foreBrush=new A(this.color),this._obtainLinePoints()),p=this._obtainFont();if(null!=p&&(this._isLoaded||1!==p.size)||(p=this._lineCaptionFont,this._pdfFont=p),void 0!==u&&2===u.length&&(u=new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle),u=p.measureString(i.toFixed(2)+" "+this._unitString,{width:0,height:0},u,0,0),o=this._getAngle(this._linePoints),b=this.leaderLine<(b=w=0)?(w=-this.leaderLine,o+180):(w=this.leaderLine,o),S=void 0!==this.leaderOffset?w+this.leaderOffset:w,v=this._getAxisValue(this._linePoints[0],b+90,S),f=this._getAxisValue(this._linePoints[1],b+90,S),m=(h=Math.sqrt(Math.pow(f.x-v.x,2)+Math.pow(f.y-v.y,2)))/2-(u.width/2+this.border.width),d=this._getAxisValue(v,o,m),m=this._getAxisValue(f,o+180,m),_=this.lineEndingStyle.begin===M.PdfLineEndingStyle.openArrow||this.lineEndingStyle.begin===M.PdfLineEndingStyle.closedArrow?this._getAxisValue(v,o,this.border.width):v,y=this.lineEndingStyle.end===M.PdfLineEndingStyle.openArrow||this.lineEndingStyle.end===M.PdfLineEndingStyle.closedArrow?this._getAxisValue(f,o,-this.border.width):f,g=void 0,this.opacity&&this._opacity<1&&(g=l.save(),l.setTransparency(this._opacity)),this.caption.type===M.PdfLineCaptionType.top||!this.caption.cap&&this.caption.type===M.PdfLineCaptionType.inline?l.drawLine(r,{x:_.x,y:-_.y},{x:y.x,y:-y.y}):(l.drawLine(r,{x:_.x,y:-_.y},{x:d.x,y:-d.y}),l.drawLine(r,{x:y.x,y:-y.y},{x:m.x,y:-m.y})),this.opacity&&this._opacity<1&&l.restore(g),this._drawLineStyle(v,f,l,o,r,c,this.lineEndingStyle,this.border.width),_=void 0!==this.leaderExt?this._leaderExt:0,d=this._getAxisValue(v,b+90,_),l.drawLine(r,{x:v.x,y:-v.y},{x:d.x,y:-d.y}),y=this._getAxisValue(f,b+90,_),l.drawLine(r,{x:f.x,y:-f.y},{x:y.x,y:-y.y}),m=this._getAxisValue(v,b-90,w),l.drawLine(r,{x:v.x,y:-v.y},{x:m.x,y:-m.y}),g=this._getAxisValue(f,b-90,w),l.drawLine(r,{x:f.x,y:-f.y},{x:g.x,y:-g.y}),c=this._getAxisValue(v,o,h/2),d=void 0,_=p._getHeight(),d=this.caption.type===M.PdfLineCaptionType.top?this._getAxisValue(c,o+90,_):this._getAxisValue(c,o+90,_/2),l.translateTransform({x:d.x,y:-d.y}),l.rotateTransform(-o),l.drawString(i.toFixed(2)+" "+this._unitString,p,{x:-u.width/2,y:0,width:0,height:0},null,n.foreBrush),l.restore()),void 0!==t&&!t||!this._isLoaded){s._content.dictionary._updated=!0;var f,g,y=this._crossReference._getNextReference(),m=(this._crossReference._cacheMap.set(y,s._content),s._content.reference=y,[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height]),b=this._page.size,w=(m[1]=b.height-(this.bounds.y+this.bounds.height),this._isBounds&&!this.measure?this._dictionary.update("Rect",[(e=m)[0],m[1],m[2],m[3]]):this._dictionary.update("Rect",[e[0],e[1],e[2],e[3]]),"font:"+p._metrics._postScriptName+" "+p._size+"pt; color:"+this._colorToHex([this.color.r,this.color.g,this.color.b])),v=(this._dictionary.update("DS",w),void 0===t||t||(this._dictionary.has("AP")&&T(this._dictionary.get("AP"),this._crossReference,"N"),(r=new D).set("N",y),r._updated=!0,this._dictionary.set("AP",r),f=this._createMeasureDictionary(this._unitString),g=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(g,f),f._updated=!0,this._dictionary.has("Measure")&&T(this._dictionary,this._crossReference,"Measure"),this._dictionary.update("Measure",g)),[]);if(v.push(R.get(Xs(this.lineEndingStyle.begin))),v.push(R.get(Xs(this.lineEndingStyle.end))),this._dictionary.update("LE",v),null===this._linePoints)throw new Error("LinePoints cannot be null");this._dictionary.update("L",[this._linePoints[0].x,this._linePoints[0].y,this._linePoints[1].x,this._linePoints[1].y]),this._dictionary.update("C",[Number.parseFloat((this.color.r/255).toFixed(3)),Number.parseFloat((this.color.g/255).toFixed(3)),Number.parseFloat((this.color.b/255).toFixed(3))]);var S=this._dictionary.has("LLO")?this.leaderOffset:0,a=(this._dictionary.update("Subtype",new R("Line")),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+i.toFixed(2)+" "+this._unitString):this._dictionary.update("Contents",i.toFixed(2)+" "+this._unitString),this._dictionary.update("IT",new R("LineDimension")),this._dictionary.update("LLE",this.leaderExt),this._dictionary.update("LLO",S),void 0!==this.leaderLine&&null!==this.leaderLine&&this._dictionary.update("LL",this.leaderLine),this._dictionary.update("CP",R.get(this.caption.type===M.PdfLineCaptionType.top?"Top":"Inline")),this._dictionary.update("Cap",this.caption.cap),[e[0],e[1],e[0]+e[2],e[1]+e[3]]);this._dictionary.update("Rect",a),this._bounds={x:a[0],y:a[1],width:a[2],height:a[3]}}}return s},Ai.prototype._calculateAngle=function(t,e,i,n){return-(Math.atan2(n-e,i-t)*(180/Math.PI))},Ai.prototype._calculateLineBounds=function(t,e,i,n,r,s){var a,o,h,c,_,d={x:0,y:0,width:0,height:0};return t&&2===t.length&&(h=this._getAngle(t),_=i<(_=c=0)?(c=-i,h+180):(c=i,h),i={x:t[0].x,y:t[0].y},h={x:t[1].x,y:t[1].y},0!==n&&(a=this._getAxisValue(i,_+90,n),o=this._getAxisValue(h,_+90,n),t[0].x=a.x,t[0].y=a.y,t[1].x=o.x,t[1].y=o.y,this._dictionary.update("L",[t[0].x,t[0].y,t[1].x,t[1].y])),a=this._getAxisValue(i,_+90,c+n),o=this._getAxisValue(h,_+90,c+n),i=this._getAxisValue(i,_+90,e+c+n),h=this._getAxisValue(h,_+90,e+c+n),e=this._getLinePoint(r.begin,s),c=this._getLinePoint(r.end,s),n=[],r=[],45<=_&&_<=135||225<=_&&_<=315?(n[0]=e.y,r[0]=e.x,n[1]=c.y,r[1]=c.x):(n[0]=e.x,r[0]=e.y,n[1]=c.x,r[1]=c.y),0===(_=Math.max(n[0],n[1]))&&(_=1),0===(e=Math.max(r[0],r[1]))&&(e=1),a.x===Math.min(a.x,o.x)?(a.x-=_*s,o.x+=_*s,a.x=Math.min(a.x,t[0].x),a.x=Math.min(a.x,i.x),o.x=Math.max(o.x,t[1].x),o.x=Math.max(o.x,h.x)):(a.x+=_*s,o.x-=_*s,a.x=Math.max(a.x,t[0].x),a.x=Math.max(a.x,i.x),o.x=Math.min(o.x,t[1].x),o.x=Math.min(o.x,h.x)),a.y===Math.min(a.y,o.y)?(a.y-=e*s,o.y+=e*s,a.y=Math.min(a.y,t[0].y),a.y=Math.min(a.y,i.y),o.y=Math.max(o.y,t[1].y),o.y=Math.max(o.y,h.y)):(a.y+=e*s,o.y-=e*s,a.y=Math.max(a.y,t[0].y),a.y=Math.max(a.y,i.y),o.y=Math.min(o.y,t[1].y),o.y=Math.min(o.y,h.y)),d=this._getBounds([a,o])),d},Ai.prototype._getLinePoint=function(t,e){var i={x:0,y:0};if(t)switch(t){case M.PdfLineEndingStyle.square:case M.PdfLineEndingStyle.circle:case M.PdfLineEndingStyle.diamond:i.x=3,i.y=3;break;case M.PdfLineEndingStyle.openArrow:case M.PdfLineEndingStyle.closedArrow:i.x=1,i.y=5;break;case M.PdfLineEndingStyle.rOpenArrow:case M.PdfLineEndingStyle.rClosedArrow:i.x=9+e/2,i.y=5+e/2;break;case M.PdfLineEndingStyle.slash:i.x=5,i.y=9;break;case M.PdfLineEndingStyle.butt:i.x=1,i.y=3;break;default:i.x=0,i.y=0}return i},Ai.prototype._getBounds=function(t){var e={x:0,y:0,width:0,height:0};if(0<t.length){for(var i=t[0].x,n=t[0].x,r=t[0].y,s=t[0].y,a=1;a<t.length;++a)var o=t[a],i=Math.min(o.x,i),n=Math.max(o.x,n),r=Math.min(o.y,r),s=Math.max(o.y,s);e.x=i,e.y=r,e.width=n-i,e.height=s-r}return e},Ai.prototype._obtainLineBounds=function(){var t,e,i,n=this.bounds;return void 0!==this.linePoints&&2===this._linePoints.length&&(t=this._dictionary.has("LLO")?this.leaderOffset:0,e=this._dictionary.has("LLE")?this.leaderExt:0,i=this._dictionary.has("LL")?this.leaderLine:0,n={x:(n=this._calculateLineBounds(this._linePoints,e,i,t,this.lineEndingStyle,this.border.width)).x-8,y:n.y-8,width:n.width+16,height:n.height+16}),[n.x,n.y,n.width,n.height]},Ai.prototype._createAppearance=function(){var t,e,i,n,r,s,a,o,h,c,_,d,l,u,p,f,g,y=this._obtainLineBounds(),m=(this._customTemplate.has("N")?t=this._customTemplate.get("N"):(ua(t=new P(y,this._crossReference),0),e=new or,t._writeTransformation=!1,i=t.graphics,n=new x(void 0!==this.color?this._color:{r:0,g:0,b:0},this.border.width),this.border.style===M.PdfBorderStyle.dashed?(n._dashStyle=M.PdfDashStyle.dash,n._dashPattern=[3,1]):this.border.style===M.PdfBorderStyle.dot&&(n._dashStyle=M.PdfDashStyle.dot,n._dashPattern=[1,1]),this.border.style!==M.PdfBorderStyle.solid&&this.border.dash&&(n._dashPattern=this.border.dash),e.borderPen=n,p=void(e.foreBrush=new A(this.color)),this.innerColor&&(p=new A(this._innerColor)),null!=(r=this._obtainFont())&&(this._isLoaded||1!==r.size)||(r=this._lineCaptionFont,this._pdfFont=r),this.text||this._dictionary.has("Contents")||(this.text=this.subject),a=new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle),s=0,this.caption.cap&&(s=r.measureString(this.text||"",{width:0,height:0},a,0,0).width),void 0!==this.linePoints&&2===this._linePoints.length&&(a=this._getAngle(this._linePoints),h=o=0,h=(_=null==(_=this.leaderLine)?this._leaderLine=0:_)<0?(o=-_,a+180):(o=_,a),_=void 0!==this.leaderOffset?o+this.leaderOffset:o,c=this._getAxisValue(this._linePoints[0],h+90,_),_=this._getAxisValue(this._linePoints[1],h+90,_),u=(d=Math.sqrt(Math.pow(_.x-c.x,2)+Math.pow(_.y-c.y,2)))/2-(s/2+this.border.width),l=this._getAxisValue(c,a,u),u=this._getAxisValue(_,a+180,u),g=this.lineEndingStyle.begin===M.PdfLineEndingStyle.openArrow||this.lineEndingStyle.begin===M.PdfLineEndingStyle.closedArrow?this._getAxisValue(c,a,this.border.width):c,m=this.lineEndingStyle.end===M.PdfLineEndingStyle.openArrow||this.lineEndingStyle.end===M.PdfLineEndingStyle.closedArrow?this._getAxisValue(_,a,-this.border.width):_,this.opacity&&this._opacity<1?(f=i.save(),i.setTransparency(this._opacity),this._drawLine(i,n,g,m,l,u),i.restore(f)):this._drawLine(i,n,g,m,l,u),this._drawLineStyle(c,_,i,a,n,p,this.lineEndingStyle,this.border.width),f=void 0!==this.leaderExt?this._leaderExt:0,g=this._getAxisValue(c,h+90,f),i.drawLine(n,{x:c.x,y:-c.y},{x:g.x,y:-g.y}),m=this._getAxisValue(_,h+90,f),i.drawLine(n,{x:_.x,y:-_.y},{x:m.x,y:-m.y}),l=this._getAxisValue(c,h-90,o),i.drawLine(n,{x:c.x,y:-c.y},{x:l.x,y:-l.y}),u=this._getAxisValue(_,h-90,o),i.drawLine(n,{x:_.x,y:-_.y},{x:u.x,y:-u.y}),p=this._getAxisValue(c,a,d/2),g=void 0,f=r._getHeight(),g=this.caption.type===M.PdfLineCaptionType.top?this._measure?this._getAxisValue(p,a+90,2*f):this._getAxisValue(p,a+90,f):this._measure?this._getAxisValue(p,a+90,f/2*3):this._getAxisValue(p,a+90,f/2),i.translateTransform({x:g.x,y:-g.y}),i.rotateTransform(-a),this.caption.cap&&i.drawString(this.text,r,{x:-s/2,y:0,width:0,height:0},null,e.foreBrush),i.restore())),Ms({x:y[0],y:y[1],width:y[2],height:y[3]}));return this.bounds={x:m[0],y:m[1],width:m[2],height:m[3]},this.measure||this._dictionary.has("Measure")||this._dictionary.update("Rect",[m[0],m[1],m[2],m[3]]),t},Ai.prototype._drawLine=function(t,e,i,n,r,s){void 0===this.text||""===this._text||this.caption.type===M.PdfLineCaptionType.top||!this.caption.cap&&this.caption.type===M.PdfLineCaptionType.inline?t.drawLine(e,{x:i.x,y:-i.y},{x:n.x,y:-n.y}):(t.drawLine(e,{x:i.x,y:-i.y},{x:r.x,y:-r.y}),t.drawLine(e,{x:n.x,y:-n.y},{x:s.x,y:-s.y}))},Ai.prototype._convertToUnit=function(){for(var t=Ws(this._obtainLinePoints()),e=new Array(t.length/2),i=0,n=0;n<t.length;n+=2)e[i]=[t[n],t[n+1]],i++;var r=Math.sqrt(Math.pow(e[1][0]-e[0][0],2)+Math.pow(e[1][1]-e[0][1],2)),s=this._getEqualPdfGraphicsUnit(this.unit,this._unitString);return this._unitString=s.unitString,(new Mr)._convertUnits(r,M._PdfGraphicsUnit.point,s.graphicsUnit)},Ai.prototype._obtainLinePoints=function(){return this.linePoints?this._linePoints.slice():[]};var Pi,xi=Ai;function Ai(t,e,i){var n=Pi.call(this)||this;return n._unit=M.PdfMeasurementUnit.centimeter,n._unitString="",n._dictionary=new D,n._dictionary.update("Type",R.get("Annot")),n._dictionary.update("Subtype",R.get("Line")),null!=t&&null!=e&&(n.linePoints=[t,e]),n._type=M._PdfAnnotationType.lineAnnotation,i&&("text"in i&&k(i.text)&&(n.text=i.text),"author"in i&&k(i.author)&&(n.author=i.author),"subject"in i&&k(i.subject)&&(n.subject=i.subject),"color"in i&&k(i.color)&&(n.color=i.color),"innerColor"in i&&k(i.innerColor)&&(n.innerColor=i.innerColor),"lineEndingStyle"in i&&k(i.lineEndingStyle)&&(n.lineEndingStyle=i.lineEndingStyle),"opacity"in i&&k(i.opacity)&&(n.opacity=i.opacity),"border"in i&&k(i.border)&&(n.border=i.border),"measurementUnit"in i)&&k(i.measurementUnit)&&(n.measure=!0,n.unit=i.measurementUnit),n}t(ki,Ti=vi),Object.defineProperty(ki.prototype,"measure",{get:function(){return this._measure||(this._measure=this._dictionary.has("Measure")),this._measure},set:function(t){!t||this._isLoaded||(this._measure=t)},enumerable:!0,configurable:!0}),Object.defineProperty(ki.prototype,"unit",{get:function(){var t;return this._isTextUpdated||void 0!==this._unit&&!this._isLoaded||(this._dictionary.has("Contents")?(t=this._dictionary.get("Contents"),this._unitString=t.substring(t.length-2),this._unit=ma(this._unitString)):this._unit=M.PdfMeasurementUnit.centimeter),this._unit},set:function(t){!this._measure||this._isLoaded||void 0===t||(this._unit=t)},enumerable:!0,configurable:!0}),Object.defineProperty(ki.prototype,"measureType",{get:function(){var t;return this._dictionary.has("Contents")&&(t=this._dictionary.get("Contents"),this._unitString=t.substring(t.length-2),this._unit=ma(this._unitString),t=t.substring(0,t.length-2),(new Mr)._convertUnits(this.bounds.width/2,M._PdfGraphicsUnit.point,va(this._unitString)).toString()===t?this._measureType=M.PdfCircleMeasurementType.radius:this._measureType=M.PdfCircleMeasurementType.diameter),this._measureType},set:function(t){!this._measure||this._isLoaded||void 0===t||(this._measureType=t)},enumerable:!0,configurable:!0}),ki._load=function(t,e){var i=new ki;return i._isLoaded=!0,i._initialize(t,e),i},ki.prototype._initialize=function(t,e){Ti.prototype._initialize.call(this,t,e)},ki.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e,i;this._dictionary.has("BS")?e=this.border.width:((i=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",i)),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),void 0===e&&(e=1),this._measure?this._appearanceTemplate=this._createCircleMeasureAppearance(t):(this._dictionary.update("Rect",no(this)),(this._setAppearance||t&&!this._dictionary.has("AP")||0<this._customTemplate.size)&&(this._appearanceTemplate=this._createCircleAppearance()))},ki.prototype._doPostProcess=function(t){var e,i,n;void 0===t&&(t=!1),this._isLoaded?((this._setAppearance||0<this._customTemplate.size||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createCircleMeasureAppearance(t):this._appearanceTemplate=this._createCircleAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference))):(this._postProcess(t),!this._appearanceTemplate&&t&&(this._dictionary.has("AP")?null!=(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createCircleAppearance())),void 0!==this.flattenPopups&&this.flattenPopups&&t&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t?this._appearanceTemplate?(e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._flattenAnnotationTemplate(this._appearanceTemplate,e)):this._page.annotations.remove(this):(this._setAppearance||0<this._customTemplate.size)&&(i=void 0,t=this._crossReference,this._dictionary.has("AP")?i=this._dictionary.get("AP"):(n=t._getNextReference(),(i=new D(t))._updated=!0,t._cacheMap.set(n,i),this._dictionary.update("AP",n)),0<this._customTemplate.size?this._drawCustomAppearance(i):(T(i,t,"N"),n=this._crossReference._getNextReference(),this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=n,t._cacheMap.set(n,this._appearanceTemplate._content),i.update("N",n)))},ki.prototype._createCircleMeasureAppearance=function(t){var e,i,n,r,s,a=this.border.width,o=this._dictionary,h=this._obtainFont(),c=(null!=h&&(this._isLoaded||1!==h.size)||(h=this._circleCaptionFont,this._pdfFont=h),this._convertToUnit()),_=new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle),d=c.toFixed(2)+" "+this._unitString,d=h.measureString(d,{width:0,height:0},_,0,0),_=this.color||{r:0,g:0,b:0},l=new x(_,a),u=[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height];return u[1]=u[1]-u[3],this._customTemplate.has("N")?(e=this._customTemplate.get("N"),o.update("Rect",no(this))):(e=new P(u,this._crossReference),i=new or,e._writeTransformation=!1,n=e.graphics,s=a/2,i.borderPen=l,this.innerColor&&(i.backBrush=new A(this._innerColor)),i.foreBrush=new A(_),l=[u[0],-u[1]-u[3],u[2],u[3]],n.save(),n.drawEllipse({x:l[0]+s,y:l[1]+s,width:l[2]-a,height:l[3]-a},new x(_,this.border.width)),this._measureType===M.PdfCircleMeasurementType.diameter?(n.save(),n.translateTransform({x:u[0],y:-u[1]}),r=u[3]/2-d.width/2,n.drawLine(i.borderPen,{x:0,y:-u[3]/2},{x:u[0]+u[2],y:-u[3]/2})):(n.save(),n.translateTransform({x:u[0],y:-u[1]}),r=u[2]/2+(u[2]/4-d.width/2),n.drawLine(i.borderPen,{x:u[2]/2,y:-u[3]/2},{x:u[0]+u[2],y:-u[3]/2})),n.translateTransform({x:r,y:-u[3]/2-h._getHeight()}),n.drawString(c.toFixed(2)+" "+this._unitString,h,{x:0,y:0,width:0,height:0},null,i.foreBrush),n.restore(),n.restore(),(void 0===t||t)&&this._isLoaded||(o.has("AP")&&T(o.get("AP"),this._crossReference,"N"),s=new D,n._template._content.dictionary._updated=!0,l=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(l,n._template._content),n._template._content.reference=l,s.set("N",l),s._updated=!0,o.set("AP",s),o.update("Rect",no(this)),o.has("Measure")&&T(o,this._crossReference,"Measure"),a=this._createMeasureDictionary(this._unitString),_=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(_,a),a._updated=!0,o.update("Measure",_),o.update("Subtype",new R("Circle")),this._text&&""!==this._text?o.update("Contents",this._text+" "+c.toFixed(2)+" "+this._unitString):o.update("Contents",c.toFixed(2)+" "+this._unitString),d="font:"+h._metrics._postScriptName+" "+h._size+"pt; color:"+this._colorToHex([this.color.r,this.color.g,this.color.b]),o.update("DS",d))),e},ki.prototype._convertToUnit=function(){var t=new Mr,e=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),t=(this._unitString=e.unitString,t._convertUnits(this.bounds.width/2,M._PdfGraphicsUnit.point,e.graphicsUnit));return this._measureType===M.PdfCircleMeasurementType.diameter&&(t*=2),t};var Ti,Ci=ki;function ki(t,e){var i=Ti.call(this)||this;return i._unit=M.PdfMeasurementUnit.centimeter,i._measureType=M.PdfCircleMeasurementType.diameter,i._unitString="",i._dictionary=new D,i._dictionary.update("Type",R.get("Annot")),i._dictionary.update("Subtype",R.get("Circle")),null!=t&&void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height&&(i.bounds=t),i._type=M._PdfAnnotationType.circleAnnotation,e&&("text"in e&&k(e.text)&&(i.text=e.text),"author"in e&&k(e.author)&&(i.author=e.author),"subject"in e&&k(e.subject)&&(i.subject=e.subject),"color"in e&&k(e.color)&&(i.color=e.color),"innerColor"in e&&k(e.innerColor)&&(i.innerColor=e.innerColor),"opacity"in e&&k(e.opacity)&&(i.opacity=e.opacity),"border"in e&&k(e.border)&&(i.border=e.border),"measure"in e)&&k(e.measure)&&("unit"in(t=e.measure)&&k(t.unit)&&(i.measure=!0,i.unit=t.unit),"type"in t)&&k(t.type)&&(i.measure=!0,i.measureType=t.type),i}t(Ii,Ri=vi),Ii._load=function(t,e){var i=new Ii;return i._isLoaded=!0,i._initialize(t,e),i},Ii.prototype._initialize=function(t,e){Ri.prototype._initialize.call(this,t,e)},Ii.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e,i;this._dictionary.has("BS")?e=this.border.width:((i=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",i)),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),void 0===e&&(e=1),(this._setAppearance||t&&!this._dictionary.has("AP")||0<this._customTemplate.size)&&(this._appearanceTemplate=this._createCircleAppearance()),this._dictionary.update("Rect",no(this))},Ii.prototype._doPostProcess=function(t){var e,i,n;void 0===t&&(t=!1),this._isLoaded?((this._setAppearance||0<this._customTemplate.size||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createCircleAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference))):(this._postProcess(t),!this._appearanceTemplate&&t&&(this._dictionary.has("AP")?(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createCircleAppearance())),void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t?this._appearanceTemplate?(e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._flattenAnnotationTemplate(this._appearanceTemplate,e)):this._page.annotations.remove(this):(this._setAppearance||0<this._customTemplate.size)&&(i=void 0,t=this._crossReference,this._dictionary.has("AP")?i=this._dictionary.get("AP"):(n=t._getNextReference(),(i=new D(t))._updated=!0,t._cacheMap.set(n,i),this._dictionary.update("AP",n)),0<this._customTemplate.size?this._drawCustomAppearance(i):(T(i,t,"N"),n=t._getNextReference(),this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=n,t._cacheMap.set(n,this._appearanceTemplate._content),i.update("N",n)))};var Ri,Fi=Ii;function Ii(t,e){var i=Ri.call(this)||this;return i._dictionary=new D,i._dictionary.update("Type",R.get("Annot")),i._dictionary.update("Subtype",R.get("Circle")),null!=t&&void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height&&(i.bounds=t),i._type=M._PdfAnnotationType.ellipseAnnotation,e&&("text"in e&&k(e.text)&&(i.text=e.text),"author"in e&&k(e.author)&&(i.author=e.author),"subject"in e&&k(e.subject)&&(i.subject=e.subject),"color"in e&&k(e.color)&&(i.color=e.color),"innerColor"in e&&k(e.innerColor)&&(i.innerColor=e.innerColor),"opacity"in e&&k(e.opacity)&&(i.opacity=e.opacity),"border"in e)&&k(e.border)&&(i.border=e.border),i}t(Li,Di=vi),Object.defineProperty(Li.prototype,"borderEffect",{get:function(){var t,e;return void 0===this._borderEffect&&((t=new sr)._dictionary=this._dictionary,this._dictionary.has("BE")?(e=this._dictionary.get("BE"),t._intensity=e.get("I"),t._style=Ks(e.get("S").name)):t._style=M.PdfBorderEffectStyle.solid,this._borderEffect=t),this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Li.prototype,"measure",{get:function(){return void 0===this._measure&&this._dictionary.has("Measure")&&(this._measure=this._dictionary.get("Measure")),this._measure},set:function(t){void 0===t||this._isLoaded||(this._measure=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Li.prototype,"unit",{get:function(){var t;return this._isTextUpdated||void 0===this._unit&&(this._unit=M.PdfMeasurementUnit.centimeter,this._dictionary.has("Contents"))&&(t=this._dictionary.get("Contents"),this._unitString=t.substring(t.length-2),this._unit=ma(this._unitString)),this._unit},set:function(t){!this._measure||this._isLoaded||void 0===t||(this._unit=t)},enumerable:!0,configurable:!0}),Li._load=function(t,e){var i=new Li;return i._isLoaded=!0,i._initialize(t,e),i},Li.prototype._initialize=function(t,e){Di.prototype._initialize.call(this,t,e)},Li.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e,i;this._dictionary.has("BS")?e=this.border.width:((i=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",i)),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),void 0===e&&(e=1),this._measure?this._appearanceTemplate=this._createSquareMeasureAppearance(t):((this._setAppearance||t&&!this._dictionary.has("AP")||0<this._customTemplate.size)&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),this._dictionary.update("Rect",no(this)),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===M.PdfBorderEffectStyle.cloudy&&((i=new D(this._crossReference)).set("I",this.borderEffect._intensity),this.borderEffect._style===M.PdfBorderEffectStyle.cloudy&&i.set("S",R.get("C")),this._dictionary.update("BE",i)))},Li.prototype._doPostProcess=function(t){var e,i,n;void 0===t&&(t=!1),this._isLoaded?((this._setAppearance||0<this._customTemplate.size||t&&!this._dictionary.has("AP"))&&(this._dictionary.has("Measure")?this._appearanceTemplate=this._createSquareMeasureAppearance(t):this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference))):(this._postProcess(t),!this._appearanceTemplate&&t&&(this._dictionary.has("AP")?(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect))),void 0!==this.flattenPopups&&this.flattenPopups&&!this.measure&&(this._isLoaded&&!this._dictionary.has("Measure")?this._flattenLoadedPopUp():this._flattenPopUp()),t?this._appearanceTemplate?(e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._flattenAnnotationTemplate(this._appearanceTemplate,e)):this._page.annotations.remove(this):(this._setAppearance||0<this._customTemplate.size)&&(i=void 0,t=this._crossReference,this._dictionary.has("AP")?i=this._dictionary.get("AP"):(n=t._getNextReference(),(i=new D(this._crossReference))._updated=!0,t._cacheMap.set(n,i),this._dictionary.update("AP",n)),0<this._customTemplate.size?this._drawCustomAppearance(i):(T(i,t,"N"),n=t._getNextReference(),this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=n,t._cacheMap.set(n,this._appearanceTemplate._content),i.update("N",n)))},Li.prototype._createSquareMeasureAppearance=function(t){var e,i,n,r,s,a,o,h=this.border.width,c=this._obtainFont(),_=(null!=c&&(this._isLoaded||1!==c.size)||(c=this._circleCaptionFont,this._pdfFont=c),this._calculateAreaOfSquare()),d=new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle),l=_.toFixed(2)+" sq "+this._unitString,l=c.measureString(l,{width:0,height:0},d,0,0),d=new x(this.color,h),u=(this.innerColor&&(s=new A(this._innerColor)),[this.bounds.x,this.bounds.y+this.bounds.height,this.bounds.width,this.bounds.height]);return this._customTemplate.has("N")?(e=this._customTemplate.get("N"),n=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],r=this._page.size,i=this.bounds,n[1]=r.height-(i.y+i.height),n[2]=i.x+i.width,n[3]=r.height-i.y,this._isBounds&&(u=n),this._page._isNew&&this._page._pageSettings&&(n=no(this)),this._dictionary.update("Rect",[n[0],n[1],n[2],n[3]])):(i=new Ae({x:this.bounds.x,y:this.bounds.y,width:this.bounds.width,height:this.bounds.height},this),u[1]=u[1]-u[3],i.normal=new P(u,this._crossReference),e=i.normal,o=new or,e._writeTransformation=!1,i=i.normal.graphics,a=h/2,o.borderPen=d,o.backBrush=s,o.foreBrush=new A(this.color),d=[u[0],-u[1]-u[3],u[2],u[3]],i.drawRectangle({x:d[0]+a,y:d[1]+a,width:d[2]-h,height:d[3]-h},new x(this.color,this.border.width)),i.save(),i.translateTransform({x:u[0],y:-u[1]}),s=u[2]/2-l.width/2,a=u[3]/2-l.height/2,i.translateTransform({x:s,y:-a-c._getHeight()}),i.drawString(_.toFixed(2)+" sq "+this._unitString,c,{x:0,y:0,width:0,height:0},null,o.foreBrush),i.restore(),(void 0===t||t)&&this._isLoaded||(this._dictionary.has("AP")&&T(this._dictionary.get("AP"),this._crossReference,"N"),d=new D,(h=i._template._content).dictionary._updated=!0,l=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(l,h),i._template._content.reference=l,d.set("N",l),d._updated=!0,this._dictionary.set("AP",d),n=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],r=this._page.size,n[1]=r.height-(this.bounds.y+this.bounds.height),n[2]=this.bounds.x+this.bounds.width,n[3]=r.height-this.bounds.y,this._isBounds&&(u=n),this._page._isNew&&this._page._pageSettings&&(n=no(this)),this._dictionary.update("Rect",[n[0],n[1],n[2],n[3]]),this._dictionary.has("Measure")&&T(this._dictionary,this._crossReference,"Measure"),s=this._crossReference._getNextReference(),a=this._createMeasureDictionary(this._unitString),this._crossReference._cacheMap.set(s,a),a._updated=!0,this._dictionary.update("Measure",s),o="font:"+c._metrics._postScriptName+" "+c._size+"pt; color:"+this._colorToHex([this.color.r,this.color.g,this.color.b]),this._dictionary.update("DS",o),this._text&&""!==this._text?this._dictionary.update("Contents",this._text+" "+_.toFixed(2)+" sq "+this._unitString):this._dictionary.update("Contents",_.toFixed(2)+" sq "+this._unitString),this._dictionary.update("Subject","Area Measurement"),void 0===this.subject&&this._dictionary.update("Subject","Area Measurement"),this._dictionary.update("MeasurementTypes",129),this._dictionary.update("Subtype",new R("Square")),this._dictionary.update("IT",new R("SquareDimension")),t=this._dictionary.getArray("Rect"),(h=new Array(2*t.length))[0]=t[0],h[1]=t[3],h[2]=t[0],h[3]=t[1],h[4]=t[2],h[5]=t[1],h[6]=t[2],h[7]=t[3],this._dictionary.update("Vertices",h))),e},Li.prototype._calculateAreaOfSquare=function(){var t,e,i=new Mr;return this.bounds.width===this.bounds.height?(e=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=e.unitString,(t=i._convertUnits(this.bounds.width,M._PdfGraphicsUnit.point,e.graphicsUnit))*t):(e=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=e.unitString,t=i._convertUnits(this.bounds.width,M._PdfGraphicsUnit.point,e.graphicsUnit),e=this._getEqualPdfGraphicsUnit(this.unit,this._unitString),this._unitString=e.unitString,t*i._convertUnits(this.bounds.height,M._PdfGraphicsUnit.point,e.graphicsUnit))};var Di,Bi=Li;function Li(t,e){var i=Di.call(this)||this;return i._unit=M.PdfMeasurementUnit.centimeter,i._dictionary=new D,i._dictionary.update("Type",R.get("Annot")),i._dictionary.update("Subtype",R.get("Square")),null!=t&&void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height&&(i.bounds=t),i._type=M._PdfAnnotationType.squareAnnotation,e&&("text"in e&&k(e.text)&&(i.text=e.text),"author"in e&&k(e.author)&&(i.author=e.author),"subject"in e&&k(e.subject)&&(i.subject=e.subject),"color"in e&&k(e.color)&&(i.color=e.color),"innerColor"in e&&k(e.innerColor)&&(i.innerColor=e.innerColor),"opacity"in e&&k(e.opacity)&&(i.opacity=e.opacity),"border"in e&&k(e.border)&&(i.border=e.border),"measurementUnit"in e)&&k(e.measurementUnit)&&(i.measure=!0,i.unit=e.measurementUnit),i}t(Ei,Oi=vi),Object.defineProperty(Ei.prototype,"borderEffect",{get:function(){var t,e;return void 0===this._borderEffect&&((t=new sr)._dictionary=this._dictionary,this._dictionary.has("BE")?(e=this._dictionary.get("BE"),t._intensity=e.get("I"),t._style=Ks(e.get("S").name)):t._style=M.PdfBorderEffectStyle.solid,this._borderEffect=t),this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),Ei._load=function(t,e){var i=new Ei;return i._isLoaded=!0,i._initialize(t,e),i},Ei.prototype._initialize=function(t,e){Oi.prototype._initialize.call(this,t,e)},Ei.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e,i;this._dictionary.has("BS")?e=this.border.width:((i=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",i)),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),void 0===e&&(e=1),this._dictionary.update("Rect",no(this)),(this._setAppearance||0<this._customTemplate.size||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===M.PdfBorderEffectStyle.cloudy&&((i=new D(this._crossReference)).set("I",this.borderEffect._intensity),this.borderEffect._style===M.PdfBorderEffectStyle.cloudy&&i.set("S",R.get("C")),this._dictionary.update("BE",i))},Ei.prototype._doPostProcess=function(t){var e,i,n;void 0===t&&(t=!1),this._isLoaded?((this._setAppearance||0<this._customTemplate.size||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference))):(this._postProcess(t),!this._appearanceTemplate&&t&&(this._dictionary.has("AP")?(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createRectangleAppearance(this.borderEffect))),void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t?this._appearanceTemplate?((e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary))&&this._page&&this._page.rotation!==M.PdfRotationAngle.angle0||this._isValidTemplateMatrix(this._appearanceTemplate._content.dictionary,this.bounds,this._appearanceTemplate))&&this._flattenAnnotationTemplate(this._appearanceTemplate,e):this._page.annotations.remove(this):(this._setAppearance||0<this._customTemplate.size)&&(i=void 0,this._dictionary.has("AP")?i=this._dictionary.get("AP"):(n=this._crossReference._getNextReference(),i=new D(this._crossReference),this._crossReference._cacheMap.set(n,i),this._dictionary.update("AP",n)),0<this._customTemplate.size?this._drawCustomAppearance(i):(T(i,this._crossReference,"N"),n=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(n,this._appearanceTemplate._content),i.update("N",n)))},Ei.prototype._isValidTemplateMatrix=function(t,e,i){var n,r,s=!0;return t&&t.has("Matrix")&&(n=t.getArray("BBox"),t=t.getArray("Matrix"))&&n&&3<t.length&&2<n.length&&void 0!==t[0]&&void 0!==t[1]&&void 0!==t[2]&&void 0!==t[3]&&1===t[0]&&0===t[1]&&0===t[2]&&1===t[3]&&void 0!==n[0]&&void 0!==n[1]&&void 0!==n[2]&&void 0!==n[3]&&(Math.round(n[0])!==Math.round(-t[4])&&Math.round(n[1])!==Math.round(-t[5])||0===n[0]&&0===Math.round(-t[4]))&&(r=(t=this._page.graphics).save(),void 0!==this.opacity&&this._opacity<1&&t.setTransparency(this._opacity),e.x-=n[0],e.y+=n[1],t.drawTemplate(i,e),t.restore(r),this._page.annotations.remove(this),s=!1),s};var Oi,Mi=Ei;function Ei(t,e){var i=Oi.call(this)||this;return i._dictionary=new D,i._dictionary.update("Type",R.get("Annot")),i._dictionary.update("Subtype",R.get("Square")),null!=t&&void 0!==t.x&&void 0!==t.y&&void 0!==t.width&&void 0!==t.height&&(i.bounds=t),i._type=M._PdfAnnotationType.rectangleAnnotation,e&&("text"in e&&k(e.text)&&(i.text=e.text),"author"in e&&k(e.author)&&(i.author=e.author),"subject"in e&&k(e.subject)&&(i.subject=e.subject),"color"in e&&k(e.color)&&(i.color=e.color),"innerColor"in e&&k(e.innerColor)&&(i.innerColor=e.innerColor),"opacity"in e&&k(e.opacity)&&(i.opacity=e.opacity),"border"in e)&&k(e.border)&&(i.border=e.border),i}t(Vi,Ni=vi),Object.defineProperty(Vi.prototype,"borderEffect",{get:function(){var t,e;return void 0===this._borderEffect&&((t=new sr)._dictionary=this._dictionary,this._dictionary.has("BE")?(e=this._dictionary.get("BE"),t._intensity=e.get("I"),t._style=Ks(e.get("S").name)):t._style=M.PdfBorderEffectStyle.solid,this._borderEffect=t),this._borderEffect},set:function(t){void 0!==t&&(this._borderEffect=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Vi.prototype,"lineExtension",{get:function(){var t;return void 0===this._lineExtension&&this._dictionary.has("LLE")&&void 0!==(t=this._dictionary.get("LLE"))&&0<=t&&(this._lineExtension=t),this._lineExtension},set:function(t){if(!Number.isNaN(t)){if(!(0<=t))throw new Error("LineExtension should be non negative number");this._dictionary.update("LLE",t),this._lineExtension=t}},enumerable:!0,configurable:!0}),Vi._load=function(t,e){var i=new Vi;return i._isLoaded=!0,i._initialize(t,e),i},Vi.prototype._initialize=function(t,e){Ni.prototype._initialize.call(this,t,e)},Vi.prototype._postProcess=function(t){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");this._dictionary.has("LLE")||(this.lineExtension=0),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),this._dictionary.has("BS")?i=this.border.width:((e=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",e)),void 0===i&&(i=1);var e,i=[],i=(i.push.apply(i,this._points),this._points=this._getPoints(this._points),i[0]===i[i.length-2]&&i[1]===i[i.length-1]||this._points.push(this._points[0]),Ws(this._points)),i=this._getBoundsValue(i),i=[i.x,i.y,i.x+i.width,i.y+i.height],i=(this._dictionary.update("Rect",i),this._dictionary.update("LLE",this._lineExtension),(this._setAppearance||t&&!this._dictionary.has("AP")||0<this._customTemplate.size)&&(this._appearanceTemplate=this._createPolygonAppearance(t)),Ws(this._points));this._dictionary.update("Vertices",i),void 0===this._intensity&&void 0!==this._borderEffect&&this._borderEffect.style===M.PdfBorderEffectStyle.cloudy&&((e=new D(this._crossReference)).set("I",this.borderEffect._intensity),this.borderEffect._style===M.PdfBorderEffectStyle.cloudy&&e.set("S",R.get("C")),this._dictionary.update("BE",e))},Vi.prototype._doPostProcess=function(t){var e,i,n;this._flatten=t=void 0===t?!1:t,this._isLoaded?(this._setAppearance||0<this._customTemplate.size||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolygonAppearance(t)):this._postProcess(t),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)),void 0!==this.flattenPopups&&this.flattenPopups&&this._isLoaded&&this._flattenLoadedPopUp(),t?this._appearanceTemplate?(e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._appearanceTemplate._content.dictionary.has("Matrix")||(i=this._appearanceTemplate._content.dictionary.getArray("BBox"))&&2<=i.length&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-i[0],-i[1]]),this._flattenAnnotationTemplate(this._appearanceTemplate,e)):this._page.annotations.remove(this):(this._setAppearance||0<this._customTemplate.size)&&(t=void 0,this._dictionary.has("AP")?t=this._dictionary.get("AP"):(n=this._crossReference._getNextReference(),(t=new D(this._crossReference))._updated=!0,this._crossReference._cacheMap.set(n,t),this._dictionary.update("AP",n)),0<this._customTemplate.size?this._drawCustomAppearance(t):(T(t,this._crossReference,"N"),n=this._crossReference._getNextReference(),this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=n,this._crossReference._cacheMap.set(n,this._appearanceTemplate._content),t.update("N",n)))},Vi.prototype._createPolygonAppearance=function(t){var e,i,n,r,s,a,o;return void 0!==t&&t?(e=void 0,this._customTemplate.has("N")?(e=this._customTemplate.get("N"),t=Ws(this._points),t=this._getBoundsValue(t),this.bounds={x:t.x,y:this._page.size.height-t.y,width:t.width,height:t.height}):(t=void 0,r=void(this.color&&0<this.border.width&&(t=new x(this.color,this.border.width))),this.innerColor&&(r=new A(this.innerColor)),n=this._page.graphics,(t||r)&&((i=void 0)!==this.opacity&&this._opacity<1&&(i=n.save(),n.setTransparency(this._opacity)),0!==this.borderEffect.intensity&&this.borderEffect.style===M.PdfBorderEffectStyle.cloudy?(s=4*this.borderEffect.intensity+.5*this.border.width,(a=new C).addPolygon(this._getLinePoints()),this._drawCloudStyle(n,r,t,s,.833,a._points,!1)):n.drawPolygon(this._getLinePoints(),t,r),void 0!==this.opacity)&&this._opacity<1&&n.restore(i),e=n._template)):(t={x:0,y:0,width:0,height:0},r=((r=void 0)===this._points&&this._dictionary.has("Vertices")?(o=this._dictionary.get("Vertices"),this._points=Vs(o)):o=Ws(this._points),this._getBoundsValue(o)),e=void(void 0!==this._borderEffect&&void 0!==this.borderEffect.intensity&&0!==this.borderEffect.intensity&&this._borderEffect.style===M.PdfBorderEffectStyle.cloudy?(t.x=r.x-5*this.borderEffect.intensity-this.border.width,t.y=r.y-5*this.borderEffect.intensity-this.border.width,t.width=r.width+10*this.borderEffect.intensity+2*this.border.width,t.height=r.height+10*this.borderEffect.intensity+2*this.border.width):(t.x=r.x-this.border.width,t.y=r.y-this.border.width,t.width=r.width+2*this.border.width,t.height=r.height+2*this.border.width)),this._customTemplate.has("N")?e=this._customTemplate.get("N"):((i=new Ae({x:t.x,y:t.y,width:t.width,height:t.height},this)).normal=new P([t.x,t.y,t.width,t.height],this._crossReference),ua(e=i.normal,this._getRotationAngle()),e._writeTransformation=!1,n=i.normal.graphics,r=new or,this.innerColor&&(r.backBrush=new A(this._innerColor)),0<this.border.width&&this.color&&(r.borderPen=new x(this._color,this.border.width)),this.color&&(r.foreBrush=new A(this._color)),void 0!==this.opacity&&this._opacity<1?(n.save(),n.setTransparency(this._opacity)):n.save(),k(this.borderEffect)&&k(this.borderEffect.intensity)&&0!==this.borderEffect.intensity&&this.borderEffect.style===M.PdfBorderEffectStyle.cloudy?(s=4*this.borderEffect.intensity+.5*this.border.width,(a=new C).addPolygon(this._getLinePoints()),this._drawCloudStyle(n,r.backBrush,r.borderPen,s,.833,a._points,!1)):n.drawPolygon(this._getLinePoints(),r.borderPen,r.backBrush),void 0!==this.opacity&&this._opacity<1&&n.restore(),n.restore(),this._isBounds&&(e._content.dictionary._updated=!0,"number"==typeof this.lineExtension&&this._dictionary.update("LLE",this.lineExtension),o=Ws(this._points),this._dictionary.update("Vertices",o))),this._dictionary.update("Rect",[t.x,t.y,t.x+t.width,t.y+t.height])),e},Vi.prototype._getLinePoints=function(){var i=this,t=this._page.size,n=t.height,r=t.width;if(this._dictionary.has("Vertices")&&!this._isBounds){var t=void 0,e=(this._page._pageDictionary.has("Rotate")&&(t=this._page._pageDictionary.get("Rotate")),this._page.rotation),e=(this._page&&e&&(e===M.PdfRotationAngle.angle90?t=90:e===M.PdfRotationAngle.angle180?t=180:e===M.PdfRotationAngle.angle270&&(t=270)),this._dictionary.getArray("Vertices"));if(e){for(var s=e.slice(),a=[],o=0;o<s.length;o+=2){var h=this.flatten?n-s[o+1]:-s[o+1];a.push([s[o],h])}t&&(270===t?a.forEach(function(t){var e=t[0];t[0]=t[1],t[1]=r-e}):90===t?a.forEach(function(t){var e=t[0];0!==i._page._origin[1]?t[0]=n-(t[1]-n):t[0]=n-t[1],t[1]=e}):180===t&&a.forEach(function(t){var e=t[0];t[0]=r-e,t[1]=n-t[1]}))}}else if(this._points){s=Ws(this._points);a=[];for(o=0;o<s.length;o+=2){h=this.flatten?n-s[o+1]:-s[o+1];a.push([s[o],h])}}return Us(a)};var Ni,ji=Vi;function Vi(t,e){var i=Ni.call(this)||this;return i._dictionary=new D,i._dictionary.update("Type",R.get("Annot")),i._dictionary.update("Subtype",R.get("Polygon")),void 0!==t&&(i._points=t),i._type=M._PdfAnnotationType.polygonAnnotation,e&&("text"in e&&k(e.text)&&(i.text=e.text),"author"in e&&k(e.author)&&(i.author=e.author),"subject"in e&&k(e.subject)&&(i.subject=e.subject),"color"in e&&k(e.color)&&(i.color=e.color),"innerColor"in e&&k(e.innerColor)&&(i.innerColor=e.innerColor),"opacity"in e&&k(e.opacity)&&(i.opacity=e.opacity),"border"in e)&&k(e.border)&&(i.border=e.border),i}t(Hi,zi=vi),Object.defineProperty(Hi.prototype,"beginLineStyle",{get:function(){var t;return this._dictionary.has("LE")&&(t=this._dictionary.getArray("LE"))&&Array.isArray(t)&&(this._beginLine=Js(t[0].name)),this._beginLine},set:function(t){var e;t!==this._beginLine&&(this._beginLine=t,this._dictionary)&&((e=[]).push(R.get(Xs(t))),e.push(R.get(Xs(this.endLineStyle))),this._dictionary.update("LE",e))},enumerable:!0,configurable:!0}),Object.defineProperty(Hi.prototype,"endLineStyle",{get:function(){var t;return this._dictionary.has("LE")&&(t=this._dictionary.getArray("LE"))&&Array.isArray(t)&&(this._endLine=Js(t[1].name)),this._endLine},set:function(t){var e;t!==this._endLine&&(this._endLine=t,this._dictionary)&&((e=[]).push(R.get(Xs(this.beginLineStyle))),e.push(R.get(Xs(t))),this._dictionary.update("LE",e))},enumerable:!0,configurable:!0}),Object.defineProperty(Hi.prototype,"lineExtension",{get:function(){var t;return void 0===this._lineExtension&&this._dictionary.has("LLE")&&void 0!==(t=this._dictionary.get("LLE"))&&0<=t&&(this._lineExtension=t),this._lineExtension},set:function(t){if(!Number.isNaN(t)){if(!(0<=t))throw new Error("LineExtension should be non negative number");this._dictionary.update("LLE",t),this._lineExtension=t}},enumerable:!0,configurable:!0}),Hi._load=function(t,e){var i=new Hi;return i._isLoaded=!0,i._initialize(t,e),i},Hi.prototype._initialize=function(t,e){zi.prototype._initialize.call(this,t,e)},Hi.prototype._postProcess=function(t){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");this._dictionary.has("LLE")||(this.lineExtension=0),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),this._dictionary.has("BS")?c=this.border.width:((r=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",r)),void 0===c&&(c=1);var e=this._getLinePoints(),i=[];i.push(0);for(var n=1;n<e.length;n++)i.push(1);this._polylinePoints=e,this._pathTypes=i;for(var r=new C,s=(r._points=e,r._pathTypes=i,[]),a=0,o=this._points;a<o.length;a++){var h=o[a];s.push(h.x,h.y)}this._dictionary.update("Vertices",s);var c=[],r=(c.push(R.get(Xs(this.beginLineStyle))),c.push(R.get(Xs(this.endLineStyle))),this._dictionary.update("LE",c),this._dictionary.update("LLE",this._lineExtension),Ws(this._points)),c=this._getBoundsValue(r),r=[c.x,c.y,c.x+c.width,c.y+c.height];this._dictionary.update("Rect",r),(this._setAppearance||t&&!this._dictionary.has("AP")||0<this._customTemplate.size)&&(this._appearanceTemplate=this._createPolyLineAppearance(t))},Hi.prototype._doPostProcess=function(t){var e,i,n;this._flatten=t=void 0===t?!1:t,this._isLoaded?((this._setAppearance||0<this._customTemplate.size||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createPolyLineAppearance(t)),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference))):(this._postProcess(t),!this._appearanceTemplate&&t&&(this._dictionary.has("AP")?(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createPolyLineAppearance(t))),void 0!==this.flattenPopups&&this.flattenPopups&&this._isLoaded&&this._flattenLoadedPopUp(),t?this._appearanceTemplate?(e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._appearanceTemplate._content.dictionary.has("Matrix")||(i=this._appearanceTemplate._content.dictionary.getArray("BBox"))&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-i[0],-i[1]]),this._flattenAnnotationTemplate(this._appearanceTemplate,e)):this._page.annotations.remove(this):(this._setAppearance||0<this._customTemplate.size)&&(t=void 0,this._dictionary.has("AP")?t=this._dictionary.get("AP"):(n=this._crossReference._getNextReference(),(t=new D(this._crossReference))._updated=!0,this._crossReference._cacheMap.set(n,t),this._dictionary.update("AP",n)),0<this._customTemplate.size?this._drawCustomAppearance(t):(T(t,this._crossReference,"N"),n=this._crossReference._getNextReference(),this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=n,this._crossReference._cacheMap.set(n,this._appearanceTemplate._content),t.update("N",n)))},Hi.prototype._transformToPdfCoordinates=function(t){return{x:t.x,y:-t.y}},Hi.prototype._updateBorder=function(t,e){return{x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e}},Hi.prototype._prepareStartEndAngle=function(t){var e=this._transformToPdfCoordinates(t._points[0]),i=this._transformToPdfCoordinates(t._points[1]),n=this._transformToPdfCoordinates(t._points[t._points.length-1]),t=this._transformToPdfCoordinates(t._points[t._points.length-2]);return{startAngle:this._getAngle([e,i]),endAngle:this._getAngle([t,n]),transformedStart:e,transformedEnd:n}},Hi.prototype._createPolyLineAppearance=function(t){var e=this.color||{r:0,g:0,b:0};if(void 0!==t&&t){var i=void 0;if(this._customTemplate.has("N")){i=this._customTemplate.get("N");var n=Ws(this._points),t=this._getBoundsValue(n);this.bounds={x:t.x,y:this._page.size.height-t.y,width:t.width,height:t.height}}else{var t=void 0,r=(0<this.border.width&&(t=new x(e,this.border.width)),void 0),s=(this.innerColor&&(r=new A(this._innerColor)),this._page.graphics);if(t){var a=void 0,o=(void 0!==this.opacity&&this._opacity<1&&(a=s.save(),s.setTransparency(this._opacity)),this._getLinePoints()),h=[];if(h.push(0),o&&0<o.length){for(var c=1;c<o.length;c++)h.push(1);(l=new C)._points=o,l._pathTypes=h;var _=this._prepareStartEndAngle(l);u=this._getAxisValue(_.transformedStart,_.startAngle+90),p=this._getAxisValue(_.transformedEnd,_.endAngle+90);this.beginLineStyle!==M.PdfLineEndingStyle.closedArrow&&this.beginLineStyle!==M.PdfLineEndingStyle.openArrow||(d=this._getAxisValue(u,_.startAngle,this.border.width),l._points[0].x=d.x,l._points[0].y=-d.y),this.endLineStyle!==M.PdfLineEndingStyle.closedArrow&&this.endLineStyle!==M.PdfLineEndingStyle.openArrow||(d=this._getAxisValue(p,_.endAngle,-this.border.width),l._points[l._points.length-1].x=d.x),s.drawPath(l,t),this.beginLineStyle!==M.PdfLineEndingStyle.none&&this._drawLineEndStyle(u,s,_.startAngle,t,r,this.beginLineStyle,this.border.width,!0),this.endLineStyle!==M.PdfLineEndingStyle.none&&this._drawLineEndStyle(p,s,_.endAngle,t,r,this.endLineStyle,this.border.width,!1),void 0!==this.opacity&&this._opacity<1&&s.restore(a)}}i=s._template}}else{var d={x:0,y:0,width:0,height:0},n=void 0,t=((void 0===this._points||this._points&&0===this._points.length)&&this._dictionary.has("Vertices")?(n=this._dictionary.get("Vertices"),this._points=Vs(n)):js(this._points)&&(n=Ws(this._points)),d=this._updateBorder(this._getBoundsValue(n),this.border.width),new or),l=(this.innerColor&&(t.backBrush=new A(this._innerColor)),0<this.border.width&&e&&(t.borderPen=new x(e,this.border.width)),e&&(t.foreBrush=new A(e)),new C);if(void 0!==this._polylinePoints&&null!==this._polylinePoints?l._points=this._polylinePoints:l._points=this._getLinePoints(),void 0===this._pathTypes||null===this._polylinePoints){this._pathTypes=[],this._pathTypes.push(0);for(c=1;c<l._points.length;c++)this._pathTypes.push(1)}l._pathTypes=this._pathTypes;var u,p,f,_=this._prepareStartEndAngle(l),i=(u=this._getAxisValue(_.transformedStart,_.startAngle+90),p=this._getAxisValue(_.transformedEnd,_.endAngle+90),this.beginLineStyle!==M.PdfLineEndingStyle.closedArrow&&this.beginLineStyle!==M.PdfLineEndingStyle.openArrow||(r=this._getAxisValue(u,_.startAngle,this.border.width),l._points[0].x=r.x,l._points[0].y=-r.y),this.endLineStyle!==M.PdfLineEndingStyle.closedArrow&&this.endLineStyle!==M.PdfLineEndingStyle.openArrow||(a=this._getAxisValue(p,_.endAngle,-this.border.width),l._points[l._points.length-1].x=a.x),this.beginLineStyle!==M.PdfLineEndingStyle.none&&(n=this._getBoundsFromLineEndStyle(u,_.startAngle,t.borderPen,this.beginLineStyle,this.border.width,!0),d=this._getCombinedRectangleBounds(d,n)),this.endLineStyle!==M.PdfLineEndingStyle.none&&(e=this._getBoundsFromLineEndStyle(p,_.endAngle,t.borderPen,this.endLineStyle,this.border.width,!1),d=this._getCombinedRectangleBounds(d,e)),void 0);this._customTemplate.has("N")?i=this._customTemplate.get("N"):((r=new Ae({x:d.x,y:d.y,width:d.width,height:d.height},this)).normal=new P([d.x,d.y,d.width,d.height],this._crossReference),ua(i=r.normal,0),i._writeTransformation=!1,s=r.normal.graphics,void 0!==this.opacity&&this._opacity<1?(s.save(),s.setTransparency(this._opacity)):s.save(),s.drawPath(l,t.borderPen),this.beginLineStyle!==M.PdfLineEndingStyle.none&&this._drawLineEndStyle(u,s,_.startAngle,t.borderPen,t.backBrush,this.beginLineStyle,this.border.width,!0),this.endLineStyle!==M.PdfLineEndingStyle.none&&this._drawLineEndStyle(p,s,_.endAngle,t.borderPen,t.backBrush,this.endLineStyle,this.border.width,!1),void 0!==this.opacity&&this._opacity<1&&s.restore(),s.restore(),this._isBounds&&(i._content.dictionary._updated=!0,this._dictionary.update("LE",[R.get(Xs(this.beginLineStyle)),R.get(Xs(this.endLineStyle))]),this._dictionary.update("LLE",this.lineExtension),f=[],this._points.forEach(function(t){f.push(t.x,t.y)}),this._dictionary.update("Vertices",f))),this._dictionary.update("Rect",[d.x,d.y,d.x+d.width,d.y+d.height])}return i},Hi.prototype._getLinePoints=function(){var t=this._page.size.height,e=[];if(this._dictionary.has("Vertices")&&!this._isBounds&&(!this._setAppearance||this._setAppearance&&this.flatten)){var i=this._dictionary.getArray("Vertices");if(i)for(var n=0;n<i.length;n+=2)e.push({x:i[n],y:t-i[n+1]})}else if(this._points){this._points=this._getPoints(this._points);var r=[];this._points.forEach(function(t){r.push(t.x,t.y)});for(n=0;n<r.length;n+=2){var s=this.flatten?t-r[n+1]:-r[n+1];e.push({x:r[n],y:s})}}return e};var zi,Ui=Hi;function Hi(t,e){var i=zi.call(this)||this;return i._beginLine=M.PdfLineEndingStyle.none,i._endLine=M.PdfLineEndingStyle.none,i._dictionary=new D,i._dictionary.update("Type",R.get("Annot")),i._dictionary.update("Subtype",R.get("PolyLine")),i._points=void 0!==t?t:[],i._type=M._PdfAnnotationType.polyLineAnnotation,e&&("text"in e&&k(e.text)&&(i.text=e.text),"author"in e&&k(e.author)&&(i.author=e.author),"subject"in e&&k(e.subject)&&(i.subject=e.subject),"color"in e&&k(e.color)&&(i.color=e.color),"innerColor"in e&&k(e.innerColor)&&(i.innerColor=e.innerColor),"lineEndingStyle"in e&&k(e.lineEndingStyle)&&(i.beginLineStyle=e.lineEndingStyle.begin,i.endLineStyle=e.lineEndingStyle.end),"opacity"in e&&k(e.opacity)&&(i.opacity=e.opacity),"border"in e)&&k(e.border)&&(i.border=e.border),i}t(Gi,Wi=vi),Object.defineProperty(Gi.prototype,"measure",{get:function(){return void 0===this._measure&&this._dictionary.has("Measure")&&(this._measure=this._dictionary.get("Measure")),this._measure},set:function(t){t&&!this._isLoaded&&(this._measure=t,this.caption.cap=!0)},enumerable:!0,configurable:!0}),Gi._load=function(t,e){var i=new Gi;return i._isLoaded=!0,i._initialize(t,e),i},Gi.prototype._initialize=function(t,e){Wi.prototype._initialize.call(this,t,e)},Gi.prototype._postProcess=function(){if(!this._pointArray)throw new Error("Points cannot be null or undefined");var t,e;this._dictionary.has("BS")?t=this.border.width:((e=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",e)),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),void 0===t&&(t=1),this._appearanceTemplate=this._createAngleMeasureAppearance()},Gi.prototype._doPostProcess=function(t){var e,i,n;void 0===t&&(t=!1),this._isLoaded?(!t&&(this._setAppearance||0<this._customTemplate.size)&&(this._appearanceTemplate=this._createAngleMeasureAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference))):(this._postProcess(),this._appearanceTemplate||t&&(this._dictionary.has("AP")?(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createAngleMeasureAppearance())),t?this._appearanceTemplate?(e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._appearanceTemplate._content.dictionary.has("Matrix")||(i=this._appearanceTemplate._content.dictionary.getArray("BBox"))&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-i[0],-i[1]]),this._flattenAnnotationTemplate(this._appearanceTemplate,e)):this._page.annotations.remove(this):(this._setAppearance||0<this._customTemplate.size)&&(t=void 0,this._dictionary.has("AP")?t=this._dictionary.get("AP"):(n=this._crossReference._getNextReference(),(t=new D(this._crossReference))._updated=!0,this._crossReference._cacheMap.set(n,t),this._dictionary.update("AP",n)),0<this._customTemplate.size?this._drawCustomAppearance(t):(T(t,this._crossReference,"N"),n=this._crossReference._getNextReference(),this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=n,this._crossReference._cacheMap.set(n,this._appearanceTemplate._content),t.update("N",n)))},Gi.prototype._createAngleMeasureAppearance=function(){var t=this.border.width,e=this._obtainFont(),i=(null!=e&&(this._isLoaded||1!==e.size)||(e=this._circleCaptionFont,this._pdfFont=e),new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle)),n=this._calculateAngle()*(180/Math.PI),r=(180<(n=n<0?-n:n)&&(n=360-n),this._dictionary.update("Vertices",this._linePoints),"font:"+e._metrics._postScriptName+" "+e._size+"pt; color:"+this._colorToHex([this.color.r,this.color.g,this.color.b])),r=(this._dictionary.update("DS",r),(this.text===" "+n.toFixed(2)+"°"||this.text)&&this._dictionary.update("Contents",this.text),void 0===this.subject&&this._dictionary.update("Subject","Angle Measurement"),this._dictionary.update("MeasurementTypes",1152),this._dictionary.update("Subtype",new R("PolyLine")),this._dictionary.update("IT",new R("PolyLineAngle")),new D),s=[],a=[],o=[],h=[],c=[],_=(r.set("Type",R.get("measureDictionary")),r.set("R","1 in = 1 in"),r.set("Subtype","RL"),r.set("TargetUnitConversion",.1388889),new D),_=(_.set("U","in"),_.set("Type","NumberFormat"),_.set("C",1),_.set("D",1),_.set("SS",""),s.push(_),new D),_=(_.set("U","°"),_.set("Type","NumberFormat"),_.set("C",1),_.set("D",1),_.set("FD",!0),_.set("SS",""),a.push(_),new D),_=(_.set("U","sq in"),_.set("Type","NumberFormat"),_.set("C",1),_.set("D",1),_.set("FD",!0),_.set("SS",""),o.push(_),new D),_=(_.set("U","cu in"),_.set("Type","NumberFormat"),_.set("C",1),_.set("D",1),_.set("FD",!0),_.set("SS",""),c.push(_),new D),_=(_.set("U","in"),_.set("Type","NumberFormat"),_.set("C",1),_.set("D",1),_.set("SS",""),h.push(_),r.set("D",s),r.set("T",a),r.set("A",o),r.set("X",h),r.set("V",c),this._dictionary.has("Measure")&&T(this._dictionary,this._crossReference,"Measure"),this._crossReference._getNextReference()),s=(this._crossReference._cacheMap.set(_,r),r._updated=!0,this._dictionary.update("Measure",_),[0,0,0,0]),a=this._getAngleBoundsValue(),d=this._obtainLinePoints(),l=[];l.push(0);for(var u=1;u<d.length;u++)l.push(1);(new C).addRectangle({x:d[1][0]-this._radius,y:-(d[1][1]+this._radius),width:2*this._radius,height:2*this._radius});var p,o=e.measureString(n.toString()+"°",{width:0,height:0},i,0,0),h=[(this._firstIntersectionPoint[0]+this._secondIntersectionPoint[0])/2,(this._firstIntersectionPoint[1]+this._secondIntersectionPoint[1])/2],c=[d[1][0],-d[1][1]],r=d[1][0]+this._radius*Math.cos((this._startAngle+this._sweepAngle/2)*(Math.PI/180)),_=d[1][1]+this._radius*Math.sin((this._startAngle+this._sweepAngle/2)*(Math.PI/180)),i=[h[0],h[1]],h=Math.atan2(i[1]-c[1],i[0]-c[0])*(180/Math.PI),i=!1,c=!1,f=!1,g=!1,h=(0<h?h<45?c=!0:45<=h&&h<135?f=!0:i=!0:0==(h=-h)?(new C).addRectangle({x:a[0],y:a[1],width:a[2],height:a[3]}):h<45?c=!0:45<=h&&h<135?g=!0:i=!0,0===s[0]&&0===s[1]&&0===s[2]&&0===s[3]&&(this.bounds={x:(s=a)[0],y:a[1],width:a[2],height:a[3]}),new C);return h._pathTypes=l,h._points=d.map(function(t){return{x:t[0],y:t[1]}}),this._dictionary.set("Rect",[s[0],s[1],s[0]+s[2],s[1]+s[3]]),this._customTemplate.has("N")?p=this._customTemplate.get("N"):((a=new Ae({x:a[0],y:a[1],width:a[2],height:a[3]},this)).normal=new P(s,this._crossReference),(p=a.normal)._writeTransformation=!1,s=a.normal.graphics,a=new x(this._color,t/2),this.border.style===M.PdfBorderStyle.dashed&&(a._dashStyle=M.PdfDashStyle.dash),t=new A(this._color),s.save(),s.drawPath(h,a),h.addArc({x:d[1][0]-this._radius,y:d[1][1]-this._radius,width:2*this._radius,height:2*this._radius},this._startAngle,this._sweepAngle),f?s.drawString(n.toString()+"°",e,{x:r-o.width/2,y:-(-_+e._getHeight()+2),width:0,height:0},null,t):c?s.drawString(n.toString()+"°",e,{x:r+2,y:-(-_+e._getHeight()/2),width:0,height:0},null,t):i?s.drawString(n.toString()+"°",e,{x:r-o.width-2,y:-(-_+e._getHeight()/2),width:0,height:0},null,t):g&&s.drawString(n.toString()+"°",e,{x:r-o.width/2,y:_+2,width:0,height:0},null,t),s.restore(),s._template._content.dictionary._updated=!0,a=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(a,s._template._content),s._template._content.reference=a,this._dictionary.has("AP")&&T(this._dictionary.get("AP"),this._crossReference,"N"),(h=new D).set("N",a),h._updated=!0,this._dictionary.set("AP",h)),p},Gi.prototype._getAngleBoundsValue=function(){for(var t=this._obtainLinePoints(),e=0;e<t.length;e++)t[e][1]=-t[e][1];var i=new C;return i._points=t.map(function(t){return{x:t[0],y:t[1]}}),i._pathTypes=[0,1,1],i._getBounds()},Gi.prototype._obtainLinePoints=function(){if(this._linePoints)for(var t=this._linePoints.slice(),e=new Array(t.length/2),i=0,n=0;n<t.length;n+=2)e[i]=[t[n],-t[n+1]],i++;return e},Gi.prototype._calculateAngle=function(){void 0!==this._linePoints&&0===this._linePoints.length&&this._isLoaded&&this._dictionary.has("Vertices")&&(this._linePoints=this._dictionary.get("Vertices")),t=this._linePoints.slice();for(var t,e=[],i=0;i<t.length;i+=2)e.push([t[i],t[i+1]]);var n=e[0],r=e[1],s=e[2],a=Math.sqrt(Math.pow(r[0]-n[0],2)+Math.pow(r[1]-n[1],2)),o=Math.sqrt(Math.pow(r[0]-s[0],2)+Math.pow(r[1]-s[1],2)),a=(this._radius=Math.min(a,o)/4,new C),o=(a._points=e.map(function(t){return{x:t[0],y:t[1]}}),a._pathTypes=[0,1,1],this._findLineCircleIntersectionPoints(r[0],r[1],this._radius,n,r,void 0,void 0)),a=(o.first,o.second),o=(0===this._firstIntersectionPoint[0]&&0===this._firstIntersectionPoint[1]&&(this._firstIntersectionPoint=a),(o=this._findLineCircleIntersectionPoints(r[0],r[1],this._radius,s,r,[0,0],[0,0])).first,a=o.second,0===this._secondIntersectionPoint[0]&&0===this._secondIntersectionPoint[1]&&(this._secondIntersectionPoint=a),this._firstIntersectionPoint[0]-r[0]),a=this._firstIntersectionPoint[1]-r[1],h=Math.atan2(a,o)*(180/Math.PI),o=this._secondIntersectionPoint[0]-r[0],a=this._secondIntersectionPoint[1]-r[1],a=0<(a=Math.atan2(a,o)*(180/Math.PI))?360-a:-a;return 180===(h=0<h?360-h:-h)&&0===a?(this._startAngle=h,this._sweepAngle=180):0===h&&180===a?(this._startAngle=a,this._sweepAngle=180):h<180?a<h?(this._startAngle=a,this._sweepAngle=h-a):h+180<a?(this._startAngle=a,this._sweepAngle=360-a+h):(this._startAngle=h,this._sweepAngle=a-h):h<a?(this._startAngle=h,this._sweepAngle=a-h):a<h-180?(this._startAngle=h,this._sweepAngle=360-h+a):(this._startAngle=a,this._sweepAngle=h-a),Math.atan2(s[0]-r[0],s[1]-r[1])-Math.atan2(n[0]-r[0],n[1]-r[1])},Gi.prototype._findLineCircleIntersectionPoints=function(t,e,i,n,r,s,a){var o,h=r[0]-n[0],r=r[1]-n[1],c=h*h+r*r,_=2*(h*(n[0]-t)+r*(n[1]-e)),t=_*_-4*c*((n[0]-t)*(n[0]-t)+(n[1]-e)*(n[1]-e)-i*i);return a=c<=1e-7||t<0?(s=[Number.NaN,Number.NaN],[Number.NaN,Number.NaN]):0==t?(s=[n[0]+(o=-_/(2*c))*h,n[1]+o*r],[Number.NaN,Number.NaN]):(o=(-_+Math.sqrt(t))/(2*c),s=[n[0]+o*h,n[1]+o*r],o=(-_-Math.sqrt(t))/(2*c),[n[0]+o*h,n[1]+o*r]),{first:s,second:a}};var Wi,qi=Gi;function Gi(t,e,i,n){var r=Wi.call(this)||this;if(r._linePoints=[],r._firstIntersectionPoint=[0,0],r._secondIntersectionPoint=[0,0],r._dictionary=new D,r._dictionary.update("Type",R.get("Annot")),r._dictionary.update("Subtype",R.get("PolyLine")),t&&e&&i&&(r._pointArray=[t,e,i]),Array.isArray(r._pointArray)&&3<r._pointArray.length)throw new Error("Points length should not be greater than 3");return r._linePoints=[],Array.isArray(r._pointArray)&&0<r._pointArray.length&&r._pointArray.forEach(function(t){r._linePoints.push(t.x),r._linePoints.push(t.y)}),r._type=M._PdfAnnotationType.angleMeasurementAnnotation,n&&("text"in n&&k(n.text)&&(r.text=n.text),"author"in n&&k(n.author)&&(r.author=n.author),"subject"in n&&k(n.subject)&&(r.subject=n.subject),"color"in n&&k(n.color)&&(r.color=n.color),"opacity"in n&&k(n.opacity)&&(r.opacity=n.opacity),"border"in n)&&k(n.border)&&(r.border=n.border),r}t(Ji,Ki=vi),Object.defineProperty(Ji.prototype,"inkPointsCollection",{get:function(){var t,n,r,e;return 0===this._inkPointsCollection.length&&this._dictionary.has("InkList")&&(t=this._dictionary.get("InkList"),Array.isArray(t))&&0<t.length&&(e=this._getMediaOrCropBox(this._page),n=e&&0<e.length?e[0]:0,r=e&&1<e.length?e[1]:0,0!==n||0!==r?(e=t.map(function(t){for(var e=t.slice(),i=0;i<e.length;i+=2)e[i]=e[i]-n,e[i+1]=e[i+1]-r;return e}),this._inkPointsCollection=zs(e)):this._inkPointsCollection=zs(t)),this._inkPointsCollection},set:function(t){Array.isArray(t)&&0<t.length&&t!==this._inkPointsCollection&&(this._inkPointsCollection=t,this._isModified=!0,this._isLoaded)&&this._dictionary.update("InkList",Hs(t))},enumerable:!0,configurable:!0}),Ji._load=function(t,e){var i=new Ji;return i._isLoaded=!0,i._initialize(t,e),i},Ji.prototype._initialize=function(t,e){Ki.prototype._initialize.call(this,t,e)},Ji.prototype._postProcess=function(){if(void 0===this._points||null===this._points)throw new Error("Points cannot be null or undefined");this._dictionary.has("BS")?n=this.border.width:((i=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",i)),this._dictionary.has("C")||(this.color={r:0,g:0,b:0},this._isTransparentColor=!0),void 0===n&&(n=1);var t,e,i=this._addInkPoints(),n=[i.x,i.y,i.x+i.width,i.y+i.height];this._dictionary.update("Rect",n),(this._setAppearance||0<this._customTemplate.size)&&(n=void 0,this._dictionary.has("AP")?n=this._dictionary.get("AP"):(e=this._crossReference._getNextReference(),n=new D(this._crossReference),this._crossReference._cacheMap.set(e,n),this._dictionary.update("AP",e)),0<this._customTemplate.size?(this._appearanceTemplate=this._customTemplate.get("N"),this._drawCustomAppearance(n)):(T(this._dictionary.get("AP"),this._crossReference,"N"),(t=new Ae(i,this)).normal=new P(i,this._crossReference),ua(i=t.normal,0,this),i._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(i),this._appearanceTemplate._content.dictionary._updated=!0,e=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(e,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=e,n.set("N",e),n._updated=!0))},Ji.prototype._doPostProcess=function(t){var e,i,n,r,s,a,o;this._isFlatten=t=void 0===t?!1:t,this._isLoaded?this._setAppearance||0<this._customTemplate.size||t&&!this._dictionary.has("AP")?(0===this._inkPointsCollection.length&&(this._inkPointsCollection=zs(this._obtainInkListCollection())),e=this._getInkBoundsValue(),0<this._customTemplate.size?this._appearanceTemplate=this._customTemplate.get("N"):(n=(o=new P(e,this._crossReference))._content.dictionary.getArray("BBox"),i=this._getRotationAngle(),n&&null!=i&&o._content.dictionary.set("Matrix",[1,0,0,1,-n[0],-n[1]]),o._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(o)),this._dictionary.update("Rect",[e[0],e[1],e[0]+e[2],e[1]+e[3]]),t||(i=void 0,this._dictionary.has("AP")?i=this._dictionary.get("AP"):(s=this._crossReference._getNextReference(),(i=new D(this._crossReference))._updated=!0,this._crossReference._cacheMap.set(s,i),this._dictionary.update("AP",s)),0<this._customTemplate.size?this._drawCustomAppearance(i):(T(i,this._crossReference,"N"),this._appearanceTemplate._content.dictionary._updated=!0,s=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(s,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=s,i.set("N",s),i._updated=!0))):!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(r=this._dictionary.get("AP"))&&r.has("N")&&(a=r.get("N"),s=r.getRaw("N"),a)&&(s&&(a.reference=s),this._appearanceTemplate=new P(a,this._crossReference)):(this._postProcess(),!this._appearanceTemplate&&t&&(this._dictionary.has("AP")?(r=this._dictionary.get("AP"))&&r.has("N")&&(a=r.get("N"),s=r.getRaw("N"),a)&&(s&&(a.reference=s),this._appearanceTemplate=new P(a,this._crossReference)):(0===this._inkPointsCollection.length&&(this._inkPointsCollection=zs(this._obtainInkListCollection())),e=this._getInkBoundsValue(),ua(o=new P(e,this._crossReference),this._getRotationAngle(),this),o._writeTransformation=!1,this._appearanceTemplate=this._createInkAppearance(o),this._dictionary.update("Rect",[e[0],e[1],e[0]+e[2],e[1]+e[3]])))),void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&(this._appearanceTemplate&&null!==this._appearanceTemplate._size&&void 0!==this._appearanceTemplate._size?(i=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),r=n=void 0,this._appearanceTemplate._content.dictionary.has("BBox")&&(n=this._appearanceTemplate._content.dictionary.getArray("BBox")),this._appearanceTemplate._content.dictionary.has("Matrix")&&(r=this._appearanceTemplate._content.dictionary.getArray("Matrix")),n&&r&&(n[0]!==-r[4]||n[1]!==-r[5])&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-n[0],-n[1]]),this._flattenAnnotationTemplate(this._appearanceTemplate,i)):this._page.annotations.remove(this),!this.flattenPopups)&&this._dictionary.has("Popup")&&(s=this._dictionary.getRaw("Popup"),this._page._pageDictionary.has("Annots"))&&(a=this._page._pageDictionary.getRaw("Annots"))&&Array.isArray(a)&&0<a.length&&0<=(o=a.indexOf(s))&&this._page.annotations.removeAt(o)},Ji.prototype._createInkAppearance=function(t){var e=t.graphics;if(null!==this.inkPointsCollection&&0<this.inkPointsCollection.length&&null!==this.color&&void 0!==this._color){for(var i,n=0;n<this.inkPointsCollection.length;n++){for(var r=!1,s=Hs(this.inkPointsCollection)[n],a=(2===s.length&&(s=[s[0]-.5,s[1]-.5,s[0]+.5,s[1]+.5],r=!0),new Array(s.length/2)),o=0,h=0;h<s.length;h+=2)a[o]=[s[h],s[h+1]],o++;var c=o+2*o-2,_=new Array(c);if(this._isEnableControlPoints)for(var d=this._getControlPoints(a,[],[]),l=d.controlP1,u=d.controlP2,p=0,f=0;f<c-1;f+=3)_[f]=a[p],_[f+1]=l[p],_[f+2]=u[p],p++;else if(o%3==1)c=o,_=new Array(c),_=a;else if(o%3==0)for(c=o+1,_=new Array(c),f=0;f<a.length;f++)_[f]=a[f];else{c=o+2,_=new Array(c);for(f=0;f<a.length;f++)_[f]=a[f];_[c-2]=a[a.length-2]}if(_[c-1]=a[a.length-1],null!==_){for(var g=_,y=0;y<g.length;y++){var m=g[y];g[y]=[m[0],-m[1]]}var b,d=new C,w=null,r=(r?(r=a[1][0]-a[0][0],b=a[1][1]-a[0][1],d.addEllipse({x:a[0][0]+.5,y:-(a[0][1]+b+.5),width:r,height:b}),(w=new C)._pathTypes=d._pathTypes,w._points=d._points):2===a.length?(d.addLine({x:a[0][0],y:-a[0][1]},{x:a[1][0],y:-a[1][1]}),(w=new C)._pathTypes=d._pathTypes,w._points=d._points):(d._addBezierPoints(g),(w=new C)._pathTypes=d._pathTypes,w._points=Us(g)),new x(this.color,this.border.width));this._isLoaded&&(r._lineCap=M.PdfLineCap.round),void 0!==this.opacity&&this._opacity<1?(b=e.save(),e.setTransparency(this._opacity),e.drawPath(w,r),e.restore(b)):e.drawPath(w,r)}}this._isFlatten&&(this._page&&this._page._isNew&&this._page._pageSettings&&this._page._pageSettings.margins?(i=this._page._pageSettings.margins,this.bounds={x:this.bounds.x-i.left,y:this._page.size.height-(this.bounds.y+this.bounds.height)-i.top,width:this.bounds.width,height:this.bounds.height}):this.bounds={x:this.bounds.x,y:this._page.size.height-(this.bounds.y+this.bounds.height),width:this.bounds.width,height:this.bounds.height})}return t},Ji.prototype._getControlPoints=function(t,e,i){if(null===t)throw new Error("pointCollection");var n=t.length-1;if(n<1)throw new Error("At least two knot PointFs required pointCollection");1==n&&(i=[[2*(e=[[(2*t[0][0]+t[1][0])/3,(2*t[0][1]+t[1][1])/3]])[0][0]-t[0][0],2*e[0][1]-t[0][1]]]);for(var r=[],s=1;s<n-1;++s)r[s]=4*t[s][0]+2*t[s+1][0];r[0]=t[0][0]+2*t[1][0],r[n-1]=(8*t[n-1][0]+t[n][0])/2;for(var a=this._getSingleControlPoint(r),s=1;s<n-1;++s)r[s]=4*t[s][1]+2*t[s+1][1];r[0]=t[0][1]+2*t[1][1],r[n-1]=(8*t[n-1][1]+t[n][1])/2;var o=this._getSingleControlPoint(r);e=new Array(n),i=new Array(n);for(var h,c,s=0;s<n;++s)e[s]=[a[s],o[s]],s<n-1?i[s]=[2*t[s+1][0]-a[s+1],2*t[s+1][1]-o[s+1]]:(h=(t[n][0]+a[n-1])/2,c=(t[n][1]+o[n-1])/2,i[s]=[h,c]);return{controlP1:e,controlP2:i}},Ji.prototype._getSingleControlPoint=function(t){var e=t.length,i=[],n=[],r=2;i[0]=t[0]/r;for(var s=1;s<e;s++)n[s]=1/r,i[s]=(t[s]-i[s-1])/(r=(s<e-1?4:3.5)-n[s]);for(s=1;s<e;s++)i[e-s-1]-=n[e-s]*i[e-s];return i},Ji.prototype._addInkPoints=function(){var a=this,o=[],t=(null===this._linePoints||0!==this._previousCollection.length&&!this._isModified||this._inkPointsCollection.unshift(this._linePoints),0===this.inkPointsCollection.length&&0<this._previousCollection.length&&(this._inkPointsCollection=this._previousCollection),io(this._inkPointsCollection,this._previousCollection)),e=Hs(this._inkPointsCollection),h=(null!==e&&0<e.length&&!t&&(e.forEach(function(t){t=t.slice();o.push(t)}),this._dictionary.update("InkList",o)),0<this._inkPointsCollection.length&&(!t||this._isModified)&&((e=this._previousCollection).push.apply(e,this._inkPointsCollection),this._isModified=!1),this._getCropOrMediaBox()),t=!1;return h&&3<h.length&&"number"==typeof h[0]&&"number"==typeof h[1]&&(0!==h[0]||0!==h[1])&&(t=!0,o.forEach(function(t,e){for(var i=t,n=0;n<t.length;n+=2){var r=t[n],s=t[n+1];r+=h[0],a._page._pageDictionary.has("MediaBox")&&!a._page._pageDictionary.has("CropBox")&&0===h[3]&&0<h[1]?s+=h[3]:s+=h[1],i[n]=r,i[n+1]=s,o[e]=i}}),this._dictionary.update("InkList",o)),this._isEnableControlPoints||t?{x:(e=this._getInkBoundsValue(o))[0],y:e[1],width:e[2],height:e[3]}:(this._isFlatten||this._updateInkListCollection(o),this.bounds)},Ji.prototype._updateInkListCollection=function(t){t=t.map(function(t){for(var e=[],i=0;i<t.length;i+=2)e.push({x:t[i],y:t[i+1]});return e});this._inkPointsCollection=t},Ji.prototype._getInkBoundsValue=function(t){var e=[0,0,0,0],i=(this._points&&0<this._points.length&&"number"==typeof(_=this._points[0]).x&&"number"==typeof _.y&&(1<this._points.length&&"number"==typeof(i=this._points[1]).x&&"number"==typeof i.y?this.bounds={x:_.x,y:_.y,width:i.x,height:i.y}:this.bounds={x:_.x,y:_.y,width:0,height:0}),e=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],this.border.width);if(null!==this._inkPointsCollection&&0<this._inkPointsCollection.length){for(var n,r,s,a,o,h,c=[],_=(Hs(this._inkPointsCollection).forEach(function(t){null!==t&&t.length%2==0&&c.push.apply(c,t)}),!1),d=(this._isLoaded||2!==c.length||(_=!0,c.push(c[0]+1),c.push(c[1]+1)),new Array(c.length/2)),l=0,u=0;u<c.length;u+=2)d[l]=[c[u],c[u+1]],l++;this._isLoaded?0<d.length?(o=!(a=s=r=n=0),d.forEach(function(t){o?(n=t[0],r=t[1],o=!1):(t[0]<n?n=t[0]:t[0]>s&&(s=t[0]),t[1]<r?r=t[1]:t[1]>a&&(a=t[1]))}),e=[n,r,s-n,a-r],this.bounds={x:e[0],y:e[1],width:e[2],height:e[3]},(this._isFlatten||this._setAppearance)&&(e[0]=this.bounds.x-i,e[1]=this.bounds.y-i,e[2]=this.bounds.width+2*i,e[3]=this.bounds.height+2*i)):e=this._points?Ws(this._points):0<d.length?this._dictionary.get("Rect"):[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height]:e=t?this._calculateInkBounds(d,e,i,_,t):this._calculateInkBounds(d,e,i,_),Array.isArray(e)&&0<e.length&&(t="number"==typeof e[0]?e[0]:0,i="number"==typeof e[1]?e[1]:0,_="number"==typeof e[2]?e[2]:0,h="number"==typeof e[3]?e[3]:0,this.bounds={x:t,y:i,width:_,height:h})}return e},Ji.prototype._calculateInkBounds=function(t,e,i,n,r){var s,a,o,h,c,_;return 5<t.length?(c=!(h=o=a=s=0),t.forEach(function(t){c?(s=t[0],a=t[1],o=t[0],h=t[1],c=!1):(t[0]<s?s=t[0]:t[0]>o&&(o=t[0]),t[1]<a?a=t[1]:t[1]>h&&(h=t[1]))}),_=this._getCropOrMediaBox(),e[2]<o?o=e[2]:_&&(o-=s),e[3]<h?h=e[3]:_&&(h-=a),_&&(s+=_[0],a+=_[1]),e=[s,a,o,h],(this._isFlatten||this._setAppearance)&&(_=n?2:3,e[0]=e[0]-i,e[1]=e[1]-i,e[2]=e[2]+_*i,e[3]=e[3]+_*i)):e=void 0===this._points&&0<t.length?this._dictionary.get("Rect"):Ws(this._points),!this._isFlatten&&r&&this._updateInkListCollection(r),e},Ji.prototype._obtainInkListCollection=function(){var t=[];if(this._dictionary.has("InkList"))for(var e=this._dictionary.getArray("InkList"),i=[],n=0;n<e.length;n++){for(var r=e[n],s=0;s<r.length;s++)i.push(r[s]);t.push(i),i.length===r.length&&(i=[])}return t};var Ki,Xi=Ji;function Ji(t,e,i){var n=Ki.call(this)||this;return n._inkPointsCollection=[],n._previousCollection=[],n._isModified=!1,n._isEnableControlPoints=!0,n._dictionary=new D,n._dictionary.update("Type",R.get("Annot")),n._dictionary.update("Subtype",R.get("Ink")),void 0!==e&&(n._points=[{x:t.x,y:t.y},{x:t.width,y:t.height}],n.bounds=t),void 0!==e&&(n._linePoints=e),n._type=M._PdfAnnotationType.inkAnnotation,i&&("text"in i&&k(i.text)&&(n.text=i.text),"author"in i&&k(i.author)&&(n.author=i.author),"subject"in i&&k(i.subject)&&(n.subject=i.subject),"color"in i&&k(i.color)&&(n.color=i.color),"thickness"in i&&k(i.thickness)&&(n.border.width=i.thickness),"opacity"in i&&k(i.opacity)&&(n.opacity=i.opacity),"pointsCollection"in i)&&k(i.pointsCollection)&&(n.inkPointsCollection=i.pointsCollection),n}t(Zi,Yi=vi),Object.defineProperty(Zi.prototype,"open",{get:function(){return this._dictionary.has("Open")&&(this._open=this._dictionary.get("Open")),this._open},set:function(t){void 0!==t&&(this._open=t,this._dictionary.update("Open",this._open))},enumerable:!0,configurable:!0}),Object.defineProperty(Zi.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=Pa(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",R.get(this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),Object.defineProperty(Zi.prototype,"stateModel",{get:function(){return this._dictionary.has("StateModel")&&(this._stateModel=Ca(this._dictionary.get("StateModel"))),this._stateModel},set:function(t){void 0!==t&&(this._stateModel=t,this._dictionary.update("StateModel",Ta(this._stateModel)))},enumerable:!0,configurable:!0}),Object.defineProperty(Zi.prototype,"state",{get:function(){return this._dictionary.has("State")&&(this._state=Aa(this._dictionary.get("State"))),this._state},set:function(t){void 0!==t&&(this._state=t,this._dictionary.update("State",xa(this._state)))},enumerable:!0,configurable:!0}),Zi._load=function(t,e){var i=new Zi;return i._isLoaded=!0,i._initialize(t,e),e.has("IRT")&&(i._isReview=Ba(e),i._isReview||(i._isComment=La(e))),i},Zi.prototype._initialize=function(t,e){Yi.prototype._initialize.call(this,t,e)},Zi.prototype._postProcess=function(){void 0!==this.bounds&&null!==this.bounds||(this._bounds={x:0,y:0,width:0,height:0}),this._dictionary.has("BS")?t=this.border.width:((i=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",i)),void 0===t&&(t=1);var t,e,i=[this.bounds.x,this.bounds.y,this.bounds.x+this.bounds.width,this.bounds.y+this.bounds.height];this._dictionary.update("Rect",i),(this._setAppearance||0<this._customTemplate.size)&&(t=void 0,this._dictionary.has("AP")?t=this._dictionary.get("AP"):(e=this._crossReference._getNextReference(),t=new D(this._crossReference),this._crossReference._cacheMap.set(e,t),this._dictionary.update("AP",e)),0<this._customTemplate.size?(this._appearanceTemplate=this._customTemplate.get("N"),this._drawCustomAppearance(t)):(this._appearanceTemplate=this._createPopupAppearance(),this._appearanceTemplate&&(T(this._dictionary.get("AP"),this._crossReference,"N"),this._appearanceTemplate._content.dictionary._updated=!0,e=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(e,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=e,t.set("N",e),t._updated=!0))),this._dictionary.update("Rect",no(this))},Zi.prototype._doPostProcess=function(t){var e,i,n,r;void 0===t&&(t=!1),this._isLoaded?!this._appearanceTemplate&&this._isFlattenPopups&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)),null!==this._appearanceTemplate)&&(r=this._page.graphics.save(),this.opacity<1&&this._page.graphics.setTransparency(this.opacity),this._page.graphics.drawTemplate(this._appearanceTemplate,this.bounds),this._page.graphics.restore(r)):(this._postProcess(),this._appearanceTemplate||t&&(this._dictionary.has("AP")?(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),n=e.getRaw("N"),i)&&(n&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createPopupAppearance())),void 0!==this.flattenPopups&&this.flattenPopups&&this.flatten&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate&&(r=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._flattenAnnotationTemplate(this._appearanceTemplate,r)),t&&this._removeAnnotation(this._page,this)},Zi.prototype._createPopupAppearance=function(){var t=[0,0,this.bounds.width,this.bounds.height],t=new P(t,this._crossReference),e=t.graphics;switch(e._sw._clear(),this.opacity<1&&(e.save(),e.setTransparency(this.opacity)),this.icon){case M.PdfPopupIcon.comment:e._sw._write(this._comment),this.color&&e._sw._setColorSpace([this.color.r,this.color.g,this.color.b],M._PdfColorSpace.rgb,!1),e._sw._write(this._commentSecondHalf);break;case M.PdfPopupIcon.paragraph:e._sw._write(this._paragraph),this.color&&e._sw._setColorSpace([this.color.r,this.color.g,this.color.b],M._PdfColorSpace.rgb,!1),e._sw._write(this._paragraphSecondHalf);break;case M.PdfPopupIcon.help:e._sw._write(this._help),this.color&&e._sw._setColorSpace([this.color.r,this.color.g,this.color.b],M._PdfColorSpace.rgb,!1),e._sw._write(this._helpSecondHalf);break;case M.PdfPopupIcon.note:this.color&&e._sw._setColorSpace([this.color.r,this.color.g,this.color.b],M._PdfColorSpace.rgb,!1),e._sw._write(this._note);break;case M.PdfPopupIcon.insert:e._sw._write("0 G "),this.color&&e._sw._setColorSpace([this.color.r,this.color.g,this.color.b],M._PdfColorSpace.rgb,!1),e._sw._write(this._insert);break;case M.PdfPopupIcon.key:e._sw._write(this._key),this.color&&e._sw._setColorSpace([this.color.r,this.color.g,this.color.b],M._PdfColorSpace.rgb,!1),e._sw._write(this._keySecondHalf);break;case M.PdfPopupIcon.newParagraph:e._sw._write(this._newParagraph),this.color&&e._sw._setColorSpace([this.color.r,this.color.g,this.color.b],M._PdfColorSpace.rgb,!1),e._sw._write(this._newParagraphSecondHalf)}return this.opacity<1&&e.restore(),t},Zi.prototype._obtainIconName=function(t){switch(t){case M.PdfPopupIcon.note:this._iconString="Note";break;case M.PdfPopupIcon.comment:this._iconString="Comment";break;case M.PdfPopupIcon.help:this._iconString="Help";break;case M.PdfPopupIcon.insert:this._iconString="Insert";break;case M.PdfPopupIcon.key:this._iconString="Key";break;case M.PdfPopupIcon.newParagraph:this._iconString="NewParagraph";break;case M.PdfPopupIcon.paragraph:this._iconString="Paragraph"}return this._iconString};var Yi,Qi=Zi;function Zi(t,e,i){var n=Yi.call(this)||this;return n._icon=M.PdfPopupIcon.note,n._iconString="",n._stateModel=M.PdfAnnotationStateModel.none,n._state=M.PdfAnnotationState.none,n._open=!1,n._isReview=!1,n._isComment=!1,n._comment="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 9 5.0908 cm 7.74 12.616 m -7.74 12.616 l -8.274 12.616 -8.707 12.184 -8.707 11.649 c h f Q 0 G ",n._commentSecondHalf="0 i 0.60 w 4 M 1 j 0 J [0 100]1 d 1 0 0 1 9 5.0908 cm 4.1 1.71 m -0.54 -2.29 l -0.54 1.71 l -5.5 1.71 l -5.5 14.42 l 10.5 14.42 l 10.5 1.71 l 4.1 1.71 l -2.33 9.66 m 7.34 9.66 l 7.34 8.83 l -2.33 8.83 l -2.33 9.66 l -2.33 7.28 m 5.88 7.28 l 5.88 6.46 l -2.33 6.46 l -2.33 7.28 l 14.9 23.1235 m -14.9 23.1235 l -14.9 -20.345 l 14.9 -20.345 l 14.9 23.1235 l b ",n._note="0 G 0 i 0.61 w 4 M 0 j 0 J []0 d q 1 0 0 1 16.959 1.3672 cm 0 0 m 0 -0.434 -0.352 -0.785 -0.784 -0.785 c -14.911 -0.785 l -15.345 -0.785 -15.696 -0.434 -15.696 0 c -15.696 17.266 l -15.696 17.699 -15.345 18.051 -14.911 18.051 c -0.784 18.051 l -0.352 18.051 0 17.699 0 17.266 c h b Q q 1 0 0 1 4.4023 13.9243 cm 0 0 m 9.418 0 l S Q q 1 0 0 1 4.4019 11.2207 cm 0 0 m 9.418 0 l S Q q 1 0 0 1 4.4023 8.5176 cm 0 0 m 9.418 0 l S Q q 1 0 0 1 4.4023 5.8135 cm 0 0 m 9.418 0 l S Q ",n._help="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 12.1465 10.5137 cm -2.146 9.403 m -7.589 9.403 -12.001 4.99 -12.001 -0.453 c -12.001 -5.895 -7.589 -10.309 -2.146 -10.309 c 3.296 -10.309 7.709 -5.895 7.709 -0.453 c 7.709 4.99 3.296 9.403 -2.146 9.403 c h f Q ",n._helpSecondHalf=" 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d 1 0 0 1 12.1465 10.5137 cm 0 0 m -0.682 -0.756 -0.958 -1.472 -0.938 -2.302 c -0.938 -2.632 l -3.385 -2.632 l -3.403 -2.154 l -3.459 -1.216 -3.147 -0.259 -2.316 0.716 c -1.729 1.433 -1.251 2.022 -1.251 2.647 c -1.251 3.291 -1.674 3.715 -2.594 3.751 c -3.202 3.751 -3.937 3.531 -4.417 3.2 c -5.041 5.205 l -4.361 5.591 -3.274 5.959 -1.968 5.959 c 0.46 5.959 1.563 4.616 1.563 3.089 c 1.563 1.691 0.699 0.771 0 0 c -2.227 -6.863 m -2.245 -6.863 l -3.202 -6.863 -3.864 -6.146 -3.864 -5.189 c -3.864 -4.196 -3.182 -3.516 -2.227 -3.516 c -1.233 -3.516 -0.589 -4.196 -0.57 -5.189 c -0.57 -6.146 -1.233 -6.863 -2.227 -6.863 c -2.146 9.403 m -7.589 9.403 -12.001 4.99 -12.001 -0.453 c -12.001 -5.895 -7.589 -10.309 -2.146 -10.309 c 3.296 -10.309 7.709 -5.895 7.709 -0.453 c 7.709 4.99 3.296 9.403 -2.146 9.403 c b ",n._insert=" 0 i 0.59 w 4 M 0 j 0 J []0 d 1 0 0 1 8.5386 19.8545 cm 0 0 m -8.39 -19.719 l 8.388 -19.719 l h B ",n._key="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 6.5 12.6729 cm 0.001 5.138 m -2.543 5.138 -4.604 3.077 -4.604 0.534 c -4.604 -1.368 -3.449 -3.001 -1.802 -3.702 c -1.802 -4.712 l -0.795 -5.719 l -1.896 -6.82 l -0.677 -8.039 l -1.595 -8.958 l -0.602 -9.949 l -1.479 -10.829 l -0.085 -12.483 l 1.728 -10.931 l 1.728 -3.732 l 1.737 -3.728 1.75 -3.724 1.76 -3.721 c 3.429 -3.03 4.604 -1.385 4.604 0.534 c 4.604 3.077 2.542 5.138 0.001 5.138 c f Q ",n._keySecondHalf=" 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d 1 0 0 1 6.5 12.6729 cm 0 0 m -1.076 0 -1.95 0.874 -1.95 1.95 c -1.95 3.028 -1.076 3.306 0 3.306 c 1.077 3.306 1.95 3.028 1.95 1.95 c 1.95 0.874 1.077 0 0 0 c 0.001 5.138 m -2.543 5.138 -4.604 3.077 -4.604 0.534 c -4.604 -1.368 -3.449 -3.001 -1.802 -3.702 c -1.802 -4.712 l -0.795 -5.719 l -1.896 -6.82 l -0.677 -8.039 l -1.595 -8.958 l -0.602 -9.949 l -1.479 -10.829 l -0.085 -12.483 l 1.728 -10.931 l 1.728 -3.732 l 1.737 -3.728 1.75 -3.724 1.76 -3.721 c 3.429 -3.03 4.604 -1.385 4.604 0.534 c 4.604 3.077 2.542 5.138 0.001 5.138 c b ",n._newParagraph="1 0.819611 0 rg 0 G 0 i 0.58 w 4 M 0 j 0 J []0 d ",n._newParagraphSecondHalf=" 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d q 1 0 0 1 6.4995 20 cm 0 0 m -6.205 -12.713 l 6.205 -12.713 l h b Q q 1 0 0 1 1.1909 6.2949 cm 0 0 m 1.278 0 l 1.353 0 1.362 -0.02 1.391 -0.066 c 2.128 -1.363 3.78 -4.275 3.966 -4.713 c 3.985 -4.713 l 3.976 -4.453 3.957 -3.91 3.957 -3.137 c 3.957 -0.076 l 3.957 -0.02 3.976 0 4.041 0 c 4.956 0 l 5.021 0 5.04 -0.029 5.04 -0.084 c 5.04 -6.049 l 5.04 -6.113 5.021 -6.133 4.947 -6.133 c 3.695 -6.133 l 3.621 -6.133 3.611 -6.113 3.574 -6.066 c 3.052 -4.955 1.353 -2.063 0.971 -1.186 c 0.961 -1.186 l 0.999 -1.68 0.999 -2.146 1.008 -3.025 c 1.008 -6.049 l 1.008 -6.104 0.989 -6.133 0.933 -6.133 c 0.009 -6.133 l -0.046 -6.133 -0.075 -6.123 -0.075 -6.049 c -0.075 -0.066 l -0.075 -0.02 -0.056 0 0 0 c f Q q 1 0 0 1 9.1367 3.0273 cm 0 0 m 0.075 0 0.215 -0.008 0.645 -0.008 c 1.4 -0.008 2.119 0.281 2.119 1.213 c 2.119 1.969 1.633 2.381 0.737 2.381 c 0.354 2.381 0.075 2.371 0 2.361 c h -1.146 3.201 m -1.146 3.238 -1.129 3.268 -1.082 3.268 c -0.709 3.275 0.02 3.285 0.729 3.285 c 2.613 3.285 3.248 2.314 3.258 1.232 c 3.258 -0.27 2.007 -0.914 0.607 -0.914 c 0.327 -0.914 0.057 -0.914 0 -0.904 c 0 -2.789 l 0 -2.836 -0.019 -2.865 -0.074 -2.865 c -1.082 -2.865 l -1.119 -2.865 -1.146 -2.846 -1.146 -2.799 c h f Q ",n._paragraph="q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d 1 0 0 1 19.6973 10.0005 cm 0 0 m 0 -5.336 -4.326 -9.662 -9.663 -9.662 c -14.998 -9.662 -19.324 -5.336 -19.324 0 c -19.324 5.335 -14.998 9.662 -9.663 9.662 c -4.326 9.662 0 5.335 0 0 c h f Q ",n._paragraphSecondHalf="0 G 0 i 0.59 w 4 M 1 j 0 J []0 d q 1 0 0 1 19.6973 10.0005 cm 0 0 m 0 -5.336 -4.326 -9.662 -9.663 -9.662 c -14.998 -9.662 -19.324 -5.336 -19.324 0 c -19.324 5.335 -14.998 9.662 -9.663 9.662 c -4.326 9.662 0 5.335 0 0 c h S Q q 1 0 0 1 11.6787 2.6582 cm 0 0 m -1.141 0 l -1.227 0 -1.244 0.052 -1.227 0.139 c -0.656 1.157 -0.52 2.505 -0.52 3.317 c -0.52 3.594 l -2.833 3.783 -5.441 4.838 -5.441 8.309 c -5.441 10.778 -3.714 12.626 -0.57 13.024 c -0.535 13.508 -0.381 14.129 -0.242 14.389 c -0.207 14.44 -0.174 14.475 -0.104 14.475 c 1.088 14.475 l 1.156 14.475 1.191 14.458 1.175 14.372 c 1.105 14.095 0.881 13.127 0.881 12.402 c 0.881 9.431 0.932 7.324 0.95 4.06 c 0.95 2.298 0.708 0.813 0.189 0.07 c 0.155 0.034 0.103 0 0 0 c b Q ",n._dictionary=new D,n._dictionary.update("Type",R.get("Annot")),n._dictionary.update("Subtype",R.get("Text")),null!=t&&"string"==typeof t?n.text=t:t&&"object"==typeof t&&(i=t),e&&(n.bounds=e),n._type=M._PdfAnnotationType.popupAnnotation,i&&("author"in i&&k(i.author)&&(n.author=i.author),"subject"in i&&k(i.subject)&&(n.subject=i.subject),"color"in i&&k(i.color)&&(n.color=i.color),"icon"in i&&k(i.icon)&&(n.icon=i.icon),"open"in i&&k(i.open)&&(n.open=i.open),"state"in i&&k(i.state)&&(n.state=i.state),"stateModel"in i)&&k(i.stateModel)&&(n.stateModel=i.stateModel),n}t(en,$i=bi),Object.defineProperty(en.prototype,"action",{get:function(){var t,e=this;return void 0===this._action&&this._dictionary.has("A")&&(t=this._dictionary.get("A"))&&t.has("Next")&&(t=t.get("Next"),Array.isArray(t))&&t.forEach(function(t){t&&t instanceof m&&(t=e._crossReference._fetch(t)).has("JS")&&(e._action=t.get("JS"))}),this._action},set:function(e){var t,i=this;this._isLoaded||"string"!=typeof e||(this._action=e),this._isLoaded&&"string"==typeof e&&this.action!==e&&this._dictionary.has("A")&&(t=this._dictionary.get("A"))&&t.has("Next")&&(t=t.get("Next"),Array.isArray(t))&&t.forEach(function(t){t&&t instanceof m&&(t=i._crossReference._fetch(t)).has("JS")&&(t.update("JS",e),i._action=e,i._dictionary._updated=!0)})},enumerable:!0,configurable:!0}),en._load=function(t,e){var i=new en;return i._isLoaded=!0,i._initialize(t,e),i},en.prototype._initialize=function(t,e){$i.prototype._initialize.call(this,t,e)},en.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t,e;this._dictionary.has("BS")?t=this.border.width:((e=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",e)),void 0===t&&(t=1),this._addAction(),this._dictionary.update("Rect",no(this))},en.prototype._addAction=function(){var t,e=this,i=(this._dictionary.has("A")&&((n=this._dictionary.get("A"))&&(void 0!==this._action&&null!==this._action&&n.has("Next")&&(i=n.get("Next"),Array.isArray(i))&&0<i.length&&i.forEach(function(t){t&&t instanceof m&&t._isNew&&e._crossReference._cacheMap.delete(t)}),n.has("F"))&&T(n,this._crossReference,"F"),T(this._dictionary,this._crossReference,"A")),new D),n=(i.set("Type",R.get("Action")),i.set("S",R.get("Launch")),new D),r=(n.set("Type",R.get("Filespec")),n.set("UF",this._fileName),void 0!==this._action&&null!==this._action&&((r=new D).set("Type",R.get("Action")),r.set("S",R.get("JavaScript")),r.set("JS",this._action),t=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(t,r),r._updated=!0,i.set("Next",[t])),this._crossReference._getNextReference());this._crossReference._cacheMap.set(r,n),n._updated=!0,i.set("F",r),i._updated=!0,this._dictionary.set("A",i)},en.prototype._doPostProcess=function(t){var e;void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t&&(t=void 0,this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(t=e.get("N"),e=e.getRaw("N"))&&t&&(t.reference=e),t?(e=new P(t,this._crossReference),t=this._validateTemplateMatrix(e._content.dictionary),this._flattenAnnotationTemplate(e,t)):this._removeAnnotation(this._page,this))};var $i,tn=en;function en(t,e,i){var n=$i.call(this)||this;return n._dictionary=new D,n._dictionary.update("Type",R.get("Annot")),n._dictionary.update("Subtype",R.get("Link")),t&&(n.bounds=t),null!=e&&(n._fileName=e),n._type=M._PdfAnnotationType.fileLinkAnnotation,i&&("text"in i&&k(i.text)&&(n.text=i.text),"author"in i&&k(i.author)&&(n.author=i.author),"subject"in i&&k(i.subject)&&(n.subject=i.subject),"color"in i&&k(i.color)&&(n.color=i.color),"opacity"in i&&k(i.opacity)&&(n.opacity=i.opacity),"action"in i)&&k(i.action)&&(n.action=i.action),n}t(sn,nn=bi),Object.defineProperty(sn.prototype,"uri",{get:function(){var t;return void 0===this._uri&&this._dictionary.has("A")&&(t=this._dictionary.get("A")).has("URI")&&(this._uri=t.get("URI")),this._uri},set:function(t){var e;"string"==typeof t&&(this._isLoaded&&this._dictionary.has("A")&&t!==this.uri?(e=this._dictionary.get("A")).has("URI")&&(this._uri=t,e.update("URI",t),this._dictionary._updated=!0):this._uri=t)},enumerable:!0,configurable:!0}),sn._load=function(t,e){var i=new sn;return i._isLoaded=!0,i._initialize(t,e),i},sn.prototype._initialize=function(t,e){nn.prototype._initialize.call(this,t,e)},sn.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t,e;this._dictionary.has("BS")?t=this.border.width:((e=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",e)),void 0===t&&(t=1),this._addAction(),this._dictionary.update("Rect",no(this))},sn.prototype._addAction=function(){var t=new D;t.set("Type",R.get("Action")),t.set("S",R.get("URI")),void 0!==this._uri&&t.set("URI",this._uri),t._updated=!0,this._dictionary.set("A",t),this._dictionary.update("Border",[this.border.hRadius,this.border.vRadius,this.border.width])},sn.prototype._doPostProcess=function(t){var e;void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t&&(t=void 0,this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(t=e.get("N"),e=e.getRaw("N"))&&t&&(t.reference=e),t?(e=new P(t,this._crossReference),t=this._validateTemplateMatrix(e._content.dictionary),this._flattenAnnotationTemplate(e,t)):this._removeAnnotation(this._page,this))};var nn,rn=sn;function sn(t,e,i){var n=nn.call(this)||this;return n._dictionary=new D,n._dictionary.update("Type",R.get("Annot")),n._dictionary.update("Subtype",R.get("Link")),t&&(n.bounds=t),null!=e&&(n._uri=e),n._type=M._PdfAnnotationType.uriAnnotation,i&&("text"in i&&k(i.text)&&(n.text=i.text),"author"in i&&k(i.author)&&(n.author=i.author),"subject"in i&&k(i.subject)&&(n.subject=i.subject),"color"in i&&k(i.color)&&(n.color=i.color),"innerColor"in i&&k(i.innerColor)&&(n.innerColor=i.innerColor),"opacity"in i&&k(i.opacity)&&(n.opacity=i.opacity),"border"in i)&&k(i.border)&&(n.border=i.border),n}t(hn,an=bi),Object.defineProperty(hn.prototype,"destination",{get:function(){var t,e;return this._isLoaded&&!this._destination&&(t=void 0,this._dictionary.has("Dest")?(t=new Pr(this._dictionary,"Dest"),this.destination=t._obtainDestination()):!this._destination&&this._dictionary.has("A")&&(e=this._dictionary.get("A"))&&e instanceof D&&e.has("D")&&(t=new Pr(e,"D"),this.destination=t._obtainDestination())),this._destination},set:function(t){t&&(this._destination=t,this._isLoaded)&&this._destination._initializePrimitive()},enumerable:!0,configurable:!0}),hn._load=function(t,e){var i=new hn;return i._isLoaded=!0,i._initialize(t,e),i},hn.prototype._initialize=function(t,e){an.prototype._initialize.call(this,t,e)},hn.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._addDocument(),this._dictionary.update("Rect",no(this))},hn.prototype._addDocument=function(){this.destination&&this._dictionary.set("Dest",this.destination._array)},hn.prototype._doPostProcess=function(t){var e;void 0===t&&(t=!1),this._isLoaded?this._destination&&this._dictionary.update("Dest",this._destination._array):this._postProcess(),t&&(t=void 0,this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(t=e.get("N"),e=e.getRaw("N"))&&t&&(t.reference=e),t?(e=new P(t,this._crossReference),t=this._validateTemplateMatrix(e._content.dictionary),this._flattenAnnotationTemplate(e,t)):this._removeAnnotation(this._page,this))};var an,on=hn;function hn(t,e,i){var n=an.call(this)||this;return n._dictionary=new D,n._dictionary.update("Type",R.get("Annot")),n._dictionary.update("Subtype",R.get("Link")),null!=t&&(n.bounds=t),null!=e&&(n.destination=e),n._type=M._PdfAnnotationType.documentLinkAnnotation,i&&("text"in i&&k(i.text)&&(n.text=i.text),"author"in i&&k(i.author)&&(n.author=i.author),"subject"in i&&k(i.subject)&&(n.subject=i.subject),"color"in i&&k(i.color)&&(n.color=i.color),"innerColor"in i&&k(i.innerColor)&&(n.innerColor=i.innerColor),"opacity"in i&&k(i.opacity)&&(n.opacity=i.opacity),"border"in i)&&k(i.border)&&(n.border=i.border),n}t(dn,cn=bi),Object.defineProperty(dn.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(dn.prototype,"url",{get:function(){var t;return void 0===this._url&&this._dictionary.has("A")&&(t=this._dictionary.get("A")).has("URI")&&(this._url=t.get("URI")),this._url},set:function(t){var e,i;"string"==typeof t&&(this._isLoaded&&this._dictionary.has("A")?(e=this._dictionary._get("A"),(i=this._dictionary.get("A"))&&i.has("URI")&&(this._url=t,i.update("URI",t),e instanceof m||(this._dictionary._updated=i._updated))):this._url=t)},enumerable:!0,configurable:!0}),dn._load=function(t,e){var i=new dn;return i._isLoaded=!0,i._initialize(t,e),i},dn.prototype._initialize=function(t,e){cn.prototype._initialize.call(this,t,e)},dn.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._isActionAdded||(this._addAction(),this._isActionAdded=!0),this._dictionary.update("Rect",no(this))},dn.prototype._addAction=function(){var t=[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height],e=(void 0!==this.font&&null!==this.font||(this.font=this._lineCaptionFont),new I(M.PdfTextAlignment.left,M.PdfVerticalAlignment.top)),t=(this._page.graphics.drawString(this._textWebLink,this.font,{x:t[0],y:t[1],width:t[2],height:t[3]},this._pen,this._brush,e),new D);t.set("Type",R.get("Action")),t.set("S",R.get("URI")),void 0!==this._url&&t.set("URI",this._url),t._updated=!0,this._dictionary.set("A",t),this._dictionary.update("Border",[0,0,0])},dn.prototype._doPostProcess=function(t){var e;void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t&&(t=void 0,this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(t=e.get("N"),e=e.getRaw("N"))&&t&&(t.reference=e),t?(e=new P(t,this._crossReference),t=this._validateTemplateMatrix(e._content.dictionary),this._flattenAnnotationTemplate(e,t)):this._removeAnnotation(this._page,this))};var cn,_n=dn;function dn(t,e,i,n,r){var s=cn.call(this)||this;return s._isActionAdded=!1,s._dictionary=new D,s._dictionary.update("Type",R.get("Annot")),s._dictionary.update("Subtype",R.get("Link")),t&&(s.bounds=t),s._textWebLink=r&&void 0!==r.text&&null!==r.text?r.text:"",null!=e&&(s._brush=new A(e)),null!=i&&(s._pen=new x(i,n||1)),s._type=M._PdfAnnotationType.textWebLinkAnnotation,r&&("url"in r&&k(r.url)&&(s.url=r.url),"font"in r&&k(r.font)&&(s.font=r.font),"text"in r&&k(r.text)&&(s.text=r.text),"author"in r&&k(r.author)&&(s.author=r.author),"subject"in r&&k(r.subject)&&(s.subject=r.subject),"color"in r&&k(r.color)&&(s.color=r.color),"opacity"in r&&k(r.opacity)&&(s.opacity=r.opacity),"border"in r)&&k(r.border)&&(s.border=r.border),s}t(pn,ln=vi),Object.defineProperty(pn.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=ka(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",R.get(this._obtainIconName(this._icon))))},enumerable:!0,configurable:!0}),pn._load=function(t,e){var i=new pn;return i._isLoaded=!0,i._initialize(t,e),i},pn.prototype._initialize=function(t,e){ln.prototype._initialize.call(this,t,e)},pn.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._dictionary.update("Rect",no(this)),this._addAttachment()},pn.prototype._addAttachment=function(){this._dictionary.has("FS")&&((t=this._dictionary.get("FS"))&&t.has("EF")&&(t=t.get("EF"))&&t.has("F")&&T(t,this._crossReference,"F"),T(this._dictionary,this._crossReference,"FS"));var t=new D,e=(t.set("Type",R.get("Filespec")),t.set("Desc",this._fileName),t.set("F",this._fileName),t.set("UF",this._fileName),new D),i=(e.set("Type",R.get("EmbeddedFile")),new D),n=new Date,n=(i.set("CreationDate",n.toTimeString()),i.set("ModDate",(new Date).toTimeString()),i.set("Size",this._stream.length),e.set("Params",i),this._stream.dictionary=new D,(this._stream.dictionary=e)._crossReference=this._crossReference,this._crossReference._newLine.charCodeAt(0)),i=this._crossReference._newLine.charCodeAt(1),n=(e._crossReference._writeObject(this._stream,[n,i,37,80,68,70,45]),this._crossReference._getNextReference()),i=(this._crossReference._cacheMap.set(n,this._stream),e._updated=!0,new D),e=(i.set("F",n),t.set("EF",i),this._crossReference._getNextReference());this._crossReference._cacheMap.set(e,t),t._updated=!0,this._dictionary.update("FS",e)},pn.prototype._doPostProcess=function(t){var e;void 0===t&&(t=!1),this._isLoaded||this._postProcess(),t&&(t=void 0,this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(t=e.get("N"),e=e.getRaw("N"))&&t&&(t.reference=e),t?(e=new P(t,this._crossReference),t=this._validateTemplateMatrix(e._content.dictionary),this._flattenAnnotationTemplate(e,t)):this._removeAnnotation(this._page,this))},pn.prototype._obtainIconName=function(t){switch(t){case M.PdfAttachmentIcon.pushPin:this._iconString="PushPin";break;case M.PdfAttachmentIcon.tag:this._iconString="Tag";break;case M.PdfAttachmentIcon.graph:this._iconString="Graph";break;case M.PdfAttachmentIcon.paperClip:this._iconString="Paperclip"}return this._iconString};var ln,un=pn;function pn(t,e,i,n){var r=ln.call(this)||this;return r._icon=M.PdfAttachmentIcon.pushPin,r._iconString="",r._dictionary=new D,r._dictionary.update("Type",R.get("Annot")),r._dictionary.update("Subtype",R.get("FileAttachment")),t&&(r.bounds=t),void 0!==e&&(r._fileName=e),r._stream=new g("string"==typeof i?Rs(i):i),r._type=M._PdfAnnotationType.fileAttachmentAnnotation,n&&("icon"in n&&k(n.icon)&&(r.icon=n.icon),"text"in n&&k(n.text)&&(r.text=n.text),"author"in n&&k(n.author)&&(r.author=n.author),"subject"in n&&k(n.subject)&&(r.subject=n.subject),"color"in n&&k(n.color)&&(r.color=n.color),"opacity"in n&&k(n.opacity)&&(r.opacity=n.opacity),"border"in n)&&k(n.border)&&(r.border=n.border),r}t(yn,fn=bi),yn._load=function(t,e){var i=new yn;return i._isLoaded=!0,i._initialize(t,e),i},yn.prototype._initialize=function(t,e){fn.prototype._initialize.call(this,t,e)},yn.prototype._doPostProcess=function(t){var e;(t=void 0===t?!1:t)&&(t=void 0,this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(t=e.get("N"),e=e.getRaw("N"))&&t&&(t.reference=e),t?(e=new P(t,this._crossReference),t=this._validateTemplateMatrix(e._content.dictionary),this._flattenAnnotationTemplate(e,t)):this._removeAnnotation(this._page,this))};var fn,gn=yn;function yn(){var t=fn.call(this)||this;return t._type=M._PdfAnnotationType.movieAnnotation,t}t(wn,mn=vi),Object.defineProperty(wn.prototype,"bounds",{get:function(){return this._isLoaded&&(this._bounds=Ls(this._dictionary,this._page)),this._bounds},set:function(t){var e,i;t&&(this._isLoaded?t.x===this.bounds.x&&t.y===this.bounds.y&&t.width===this.bounds.width&&t.height===this.bounds.height||(i=this._page.size)&&(e=(i=i.height-(t.y+t.height))+t.height,this._dictionary.update("Rect",[t.x,i,t.x+t.width,e]),this._bounds=t,this._isChanged=!0):(this._bounds=t,i=this._obtainNativeRectangle(),this._dictionary.update("Rect",Ms({x:i[0],y:i[1],width:i[2],height:i[3]})),this._isChanged=!0))},enumerable:!0,configurable:!0}),Object.defineProperty(wn.prototype,"textMarkUpColor",{get:function(){return void 0===this._textMarkUpColor&&this._dictionary.has("C")&&(this._textMarkUpColor=qs(this._dictionary.getArray("C"))),this._textMarkUpColor},set:function(t){var e;t&&(e=this.color,this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._color=t,this._textMarkUpColor=t,this._dictionary.update("C",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))])))},enumerable:!0,configurable:!0}),Object.defineProperty(wn.prototype,"textMarkupType",{get:function(){var t;return this._dictionary.has("Subtype")&&(t=this._dictionary.get("Subtype"),this._textMarkupType=ba(t.name)),this._textMarkupType},set:function(t){void 0!==t&&(this._textMarkupType=t,this._dictionary.update("Subtype",R.get(wa(t))))},enumerable:!0,configurable:!0}),Object.defineProperty(wn.prototype,"boundsCollection",{get:function(){if(!this._isLoaded)return this._boundsCollection;var t=[];if(this._dictionary.has("QuadPoints")){var e=this._dictionary.getArray("QuadPoints");if(e&&0!==e.length)for(var i=this._getMediaOrCropBox(this._page),n=i&&0<i.length?i[0]:0,r=i&&1<i.length?i[1]:0,s=this._page.size.height,a=e.length/8,o=0;o<a;o++){var h=8*o,c=e[4+h]-e[h],_=e[5+h]-e[1+h],d=Math.sqrt(c*c+_*_),c=e[6+h]-e[4+h],_=e[7+h]-e[5+h],c=Math.sqrt(c*c+_*_),_=e[h]-n,h=s-e[1+h]-r;t.push({x:_,y:h,width:c,height:d})}}return t},set:function(t){var e;if(this._isLoaded||void 0===t||(0<t.length?(this._quadPoints=new Array(8*t.length),(e=this._boundsCollection).push.apply(e,t)):(this._quadPoints=new Array(8),this._boundsCollection=t),this._isChanged=!0),this._isLoaded&&void 0!==t){var i=!1;if(this.boundsCollection.length===t.length)for(var n=0;n<t.length;n++){var r=t[n],s=this.boundsCollection[n];if(r.x!==s.x||r.y!==s.y||r.width!==s.width||r.height!==s.height){i=!0;break}}else i=!0;if(i){this._quadPoints=new Array(8*t.length);for(var a=this._page.size.height,n=0;n<t.length;n++){var o=t[n];this._quadPoints[0+8*n]=o.x,this._quadPoints[1+8*n]=a-o.y,this._quadPoints[2+8*n]=o.x+o.width,this._quadPoints[3+8*n]=a-o.y,this._quadPoints[4+8*n]=o.x,this._quadPoints[5+8*n]=this._quadPoints[1+8*n]-o.height,this._quadPoints[6+8*n]=o.x+o.width,this._quadPoints[7+8*n]=this._quadPoints[5+8*n]}this._dictionary.update("QuadPoints",this._quadPoints),this._isChanged=!0}}},enumerable:!0,configurable:!0}),wn._load=function(t,e){var i=new wn;return i._isLoaded=!0,i._initialize(t,e),i},wn.prototype._obtainNativeRectangle=function(){var t,e,i,n=[this._bounds.x,this._bounds.y+this._bounds.height,this._bounds.width,this._bounds.height];return this._page&&!this._page._isNew?(e=this._page.size,n[1]=e.height-n[1],t=this._getCropOrMediaBox()):this._page&&this._page._isNew&&(e=this._page._getActualBounds(this._page._pageSettings),n[0]+=e[0],n[1]=this._page._pageSettings.size.height-(e[1]+n[1]),t=this._getCropOrMediaBox()),t&&(t[3]<0&&(e=t[1],i=t[3],t[1]=i,t[3]=e),2<t.length)&&(0!==t[0]||0!==t[1])&&(n[0]+=t[0],this._page&&this._page._pageDictionary.has("MediaBox")&&!this._page._pageDictionary.has("CropBox")&&0<t[1]&&0===t[3]?n[1]+=t[3]:n[1]+=t[1]),n},wn.prototype._initialize=function(t,e){mn.prototype._initialize.call(this,t,e)},wn.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._dictionary.has("BS")?e=this.border.width:((t=new D(this._crossReference)).set("Type",R.get("Border")),t.set("W",this.border.width),this._dictionary.set("BS",t)),void 0===e&&(e=1),this._dictionary.has("C")||(this._isTransparentColor=!0);var t,e=this._page.size;this._dictionary.update("Subtype",R.get(wa(this._textMarkupType))),this._isChanged&&(this._setQuadPoints(e),this._dictionary.update("Rect",no(this))),this._setAppearance&&(this._appearanceTemplate=this._createMarkupAppearance(),!this._isLoaded&&1<this._boundsCollection.length&&this._isChanged&&(e=this._obtainNativeRectangle(),this._dictionary.update("Rect",[e[0],e[1],e[0]+e[2],e[1]+e[3]])),this._dictionary.has("AP")&&T(this._dictionary.get("AP"),this._crossReference,"N"),t=new D,this._appearanceTemplate._content.dictionary._updated=!0,e=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(e,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=e,t.set("N",e),t._updated=!0,this._dictionary.set("AP",t)),void 0!==this._text&&null!==this._text&&this._dictionary.set("Contents",this._text),this._isChanged=!1},wn.prototype._doPostProcess=function(t){var e,i,n;void 0===t&&(t=!1),this._isLoaded?((this._setAppearance||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createMarkupAppearance(),t||(this._dictionary.has("AP")&&T(this._dictionary.get("AP"),this._crossReference,"N"),i=new D,this._appearanceTemplate._content.dictionary._updated=!0,n=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(n,this._appearanceTemplate._content),this._appearanceTemplate._content.reference=n,i.set("N",n),i._updated=!0,this._dictionary.set("AP",i))),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(i=this._dictionary.get("AP"))&&i.has("N")&&(e=i.get("N"))&&((n=i.getRaw("N"))&&(e.reference=n),this._appearanceTemplate=new P(e,this._crossReference))):(this._postProcess(),this._appearanceTemplate||t&&(this._dictionary.has("AP")?(i=this._dictionary.get("AP"))&&i.has("N")&&(e=i.get("N"))&&((n=i.getRaw("N"))&&(e.reference=n),this._appearanceTemplate=new P(e,this._crossReference)):this._appearanceTemplate=this._createMarkupAppearance())),void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate&&(i=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._appearanceTemplate._content.dictionary.has("Matrix")||this._isLoaded||(n=this._appearanceTemplate._content.dictionary.getArray("BBox"))&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-n[0],-n[1]]),i&&void 0!==this._page.rotation&&this._page.rotation!==M.PdfRotationAngle.angle0||i&&this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary,this._appearanceTemplate)||!this._dictionary.has("AP")&&this._appearanceTemplate)&&this._flattenAnnotationTemplate(this._appearanceTemplate,i),t&&this._page.annotations.remove(this)},wn.prototype._createMarkupAppearance=function(){var t=0,e=0;if(1<this.boundsCollection.length){for(var i=new C,n=0;n<this.boundsCollection.length;n++)(w=[])[0]=this.boundsCollection[n].x,w[1]=this.boundsCollection[n].y,w[2]=this.boundsCollection[n].width,w[3]=this.boundsCollection[n].height,i.addRectangle({x:w[0],y:w[1],width:w[2],height:w[3]});var r={x:(f=i._getBounds())[0],y:f[1],width:f[2],height:f[3]},t=(this.bounds=r).width,e=r.height}else if(this._dictionary.has("QuadPoints")){var s=this._dictionary.get("QuadPoints");if(null!==this._quadPoints)for(n=0;n<s.length/8;n++)if(this._isLoaded){for(var a=[],o=0;o<s.length;){var h=s[o],c=s[o+1];a.push({x:h,y:c}),o+=2}var _=new C;_._addLines(a),t=(r={x:(f=_._getBounds())[0],y:f[1],width:f[2],height:f[3]}).width,e=r.height}else{var _=Math.floor(s[4+8*n])-Math.floor(s[0+8*n]),d=Math.floor(s[5+8*n])-Math.floor(s[1+8*n]);e=Math.sqrt(_*_+d*d),_=Math.floor(s[6+8*n])-Math.floor(s[4+8*n]),d=Math.floor(s[7+8*n])-Math.floor(s[5+8*n]),t=Math.sqrt(_*_+d*d),this.bounds={x:this.bounds.x,y:this.bounds.y,width:t,height:e}}}var l=new P([0,0,t,e],this._crossReference),u=(ua(l,this._getRotationAngle()),l.graphics);if(void 0!==this.opacity&&u.setTransparency(this.opacity,this.opacity,M.PdfBlendMode.multiply),this.textMarkUpColor){var p,f,g=new x(this.textMarkUpColor,this.border.width),y=new A(this.textMarkUpColor),h=0,c=0,m=0,b=0;if(1<this.boundsCollection.length)for(var w,n=0;n<this.boundsCollection.length;n++)(w=[])[0]=this.boundsCollection[n].x,w[1]=this.boundsCollection[n].y,w[2]=this.boundsCollection[n].width,w[3]=this.boundsCollection[n].height,this.textMarkupType===M.PdfTextMarkupAnnotationType.highlight?u.drawRectangle({x:w[0]-r.x,y:w[1]-r.y,width:w[2],height:w[3]},y):this.textMarkupType===M.PdfTextMarkupAnnotationType.underline?(h=w[0]-r.x,c=w[1]-r.y+(w[3]-w[3]/2/3),m=w[2]+(w[0]-r.x),b=w[1]-r.y+(w[3]-w[3]/2/3),u.drawLine(g,{x:h,y:c},{x:m,y:b})):this.textMarkupType===M.PdfTextMarkupAnnotationType.strikeOut?(h=w[0]-r.x,c=w[1]-r.y+(w[3]-w[3]/2),m=w[2]+(w[0]-r.x),b=w[1]-r.y+(w[3]-w[3]/2),u.drawLine(g,{x:h,y:c},{x:m,y:b})):this.textMarkupType===M.PdfTextMarkupAnnotationType.squiggly&&(g._width=.02*w[3],u.save(),u.translateTransform({x:w[0]-r.x,y:w[1]-r.y}),u.setClip({x:0,y:0,width:w[2],height:w[3]}),u.drawPath(this._drawSquiggly(w[2],w[3]),g),u.restore());else this.textMarkupType===M.PdfTextMarkupAnnotationType.highlight?u.drawRectangle({x:0,y:0,width:t,height:e},y):this.textMarkupType===M.PdfTextMarkupAnnotationType.underline?u.drawLine(g,{x:0,y:e-e/2/3},{x:t,y:e-e/2/3}):this.textMarkupType===M.PdfTextMarkupAnnotationType.strikeOut?u.drawLine(g,{x:0,y:e/2},{x:t,y:e/2}):this.textMarkupType===M.PdfTextMarkupAnnotationType.squiggly&&(g._width=.02*e,u.drawPath(this._drawSquiggly(Math.round(t),Math.round(e)),g)),this._isLoaded&&(p=[r.x,r.y,r.x+r.width,r.y+r.height],f=this._setAppearance?no(this):p,this._dictionary.update("Rect",f))}return l},wn.prototype._drawSquiggly=function(t,e){(Math.floor(t)%2!=0||Math.round(t)>t)&&(t=Math.floor(t)+1);for(var i=new C,n=[],r=Math.ceil(t/e*16),s=t/(r/2),a=parseFloat((.6*(s+s)).toFixed(2)),o=a,h=0,c=0;c<r;c++){var _={x:h,y:parseFloat((e-a+o-.02*e).toFixed(2))};n.push(_),o=0===o?a:0,h+=s}return i._addLines(n),i};var mn,bn=wn;function wn(t,e,i){var n=mn.call(this)||this;return n._textMarkupType=M.PdfTextMarkupAnnotationType.highlight,n._dictionary=new D,n._dictionary.update("Type",R.get("Annot")),void 0!==t&&(n._text=t),e&&(n.bounds=e),n._type=M._PdfAnnotationType.textMarkupAnnotation,i&&("boundsCollection"in i&&k(i.boundsCollection)&&(n.boundsCollection=i.boundsCollection),"author"in i&&k(i.author)&&(n.author=i.author),"subject"in i&&k(i.subject)&&(n.subject=i.subject),"innerColor"in i&&k(i.innerColor)&&(n.innerColor=i.innerColor),"textMarkUpColor"in i&&k(i.textMarkUpColor)&&(n.textMarkUpColor=i.textMarkUpColor),"textMarkupType"in i&&k(i.textMarkupType)&&(n.textMarkupType=i.textMarkupType),"opacity"in i&&k(i.opacity)&&(n.opacity=i.opacity),"border"in i)&&k(i.border)&&(n.border=i.border),n}t(Pn,vn=bi),Pn._load=function(t,e){var i=new Pn;return i._isLoaded=!0,i._initialize(t,e),i},Pn.prototype._initialize=function(t,e){vn.prototype._initialize.call(this,t,e)},Pn.prototype._postProcess=function(){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var t,e;this._dictionary.has("BS")?t=this.border.width:((e=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",e)),void 0===t&&(t=1),void 0===this.color&&(this.color={r:0,g:0,b:0}),this._appearanceTemplate=this._createWatermarkAppearance(),this._dictionary.update("Rect",no(this)),void 0!==this.opacity&&1!==this._opacity&&this._dictionary.set("CA",this._opacity)},Pn.prototype._createWatermarkAppearance=function(){var t=this._obtainFont(),e=((null==t||(!this._isLoaded||this._page&&this._page._isDuplicate)&&1===t.size)&&(t=this._lineCaptionFont,this._pdfFont=t),this._rotateAngle=this._getRotationAngle(),(void 0!==this.rotationAngle&&this._rotate!==M.PdfRotationAngle.angle0||this._rotateAngle!==M.PdfRotationAngle.angle0)&&(0===this._rotateAngle&&(this._rotateAngle=90*this.rotationAngle),this.bounds=this._getRotatedBounds(this.bounds,this._rotateAngle)),[0,0,this.bounds.width,this.bounds.height]),i=new Ae({x:0,y:0,width:this.bounds.width,height:this.bounds.height},this),e=(i.normal=new P(e,this._crossReference),i.normal),i=(ua(e,this._rotateAngle),i.normal.graphics),n=this.border.width/2,r=new I(M.PdfTextAlignment.left,M.PdfVerticalAlignment.top),n=new x(this.color,n),n=(this.innerColor&&(s=new A(this._innerColor)),this._isLoaded&&this._dictionary.has("Contents")&&(this._watermarkText=this._dictionary.get("Contents")),this._dictionary.update("Contents",this._watermarkText),void 0!==this._watermarkText&&i.drawString(this._watermarkText,t,{x:0,y:0,width:0,height:0},n,s,r),this._dictionary.has("AP")&&(t=this._dictionary.get("AP"))&&t instanceof D&&T(t,this._crossReference,"N"),new D),s=(i._template._content.dictionary._updated=!0,this._crossReference._getNextReference());return this._crossReference._cacheMap.set(s,i._template._content),i._template._content.reference=s,n.set("N",s),n._updated=!0,this._dictionary.set("AP",n),e},Pn.prototype._doPostProcess=function(t){var e,i,n;void 0===t&&(t=!1),this._isLoaded?(t||(this._appearanceTemplate=this._createWatermarkAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(i=this._dictionary.get("AP"))&&i.has("N")&&(e=i.get("N"))&&((n=i.getRaw("N"))&&(e.reference=n),this._appearanceTemplate=new P(e,this._crossReference))):(this._postProcess(),this._appearanceTemplate||t&&(this._dictionary.has("AP")?(i=this._dictionary.get("AP"))&&i.has("N")&&(e=i.get("N"))&&((n=i.getRaw("N"))&&(e.reference=n),this._appearanceTemplate=new P(e,this._crossReference)):this._appearanceTemplate=this._createWatermarkAppearance())),t&&this._appearanceTemplate?(i=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._appearanceTemplate._content.dictionary.has("Matrix")||(n=this._appearanceTemplate._content.dictionary.getArray("BBox"))&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-n[0],-n[1]]),this._flattenAnnotationTemplate(this._appearanceTemplate,i)):t&&this._page.annotations.remove(this)};var vn,Sn=Pn;function Pn(t,e,i){var n=vn.call(this)||this;return n._watermarkText="",null!=t&&e&&L.initializeTelemetryFeature("Watermark","PDFLibrary"),n._dictionary=new D,n._dictionary.update("Type",R.get("Annot")),n._dictionary.update("Subtype",R.get("Watermark")),void 0!==t&&(n._watermarkText=t,n.text=t),e&&(n.bounds=e),n._type=M._PdfAnnotationType.watermarkAnnotation,i&&("author"in i&&k(i.author)&&(n.author=i.author),"subject"in i&&k(i.subject)&&(n.subject=i.subject),"color"in i&&k(i.color)&&(n.color=i.color),"innerColor"in i&&k(i.innerColor)&&(n.innerColor=i.innerColor),"opacity"in i&&k(i.opacity)&&(n.opacity=i.opacity),"border"in i)&&k(i.border)&&(n.border=i.border),n}t(Tn,xn=vi),Object.defineProperty(Tn.prototype,"icon",{get:function(){return this._dictionary.has("Name")&&(this._icon=Sa(this._dictionary.get("Name").name)),this._icon},set:function(t){void 0!==t&&(this._icon=t,this._dictionary.update("Name",R.get("#"+this._obtainIconName(this._icon).replace(/\s+/g,""))))},enumerable:!0,configurable:!0}),Object.defineProperty(Tn.prototype,"appearance",{get:function(){var t;return this._isLoaded?null:(void 0===this._appearance&&(t={x:0,y:0,width:this.bounds.width,height:this.bounds.height},this._appearance=new Ae(t,this),this._appearance.normal=new P(t,this._crossReference)),this._appearance)},enumerable:!0,configurable:!0}),Tn.prototype.createTemplate=function(){var t=this._createTemplate();return t=void 0===t?this._createRubberStampAppearance():t},Object.defineProperty(Tn.prototype,"_innerTemplateBounds",{get:function(){var t;return this._isLoaded&&((t=this._obtainInnerBounds()).x=this.bounds.x,t.y=this.bounds.y),t},enumerable:!0,configurable:!0}),Tn._load=function(t,e){var i=new Tn;return i._isLoaded=!0,i._initialize(t,e),i},Tn.prototype._initialize=function(t,e){xn.prototype._initialize.call(this,t,e)},Tn.prototype._postProcess=function(){var t,e;this._dictionary.has("BS")?t=this.border.width:((e=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",e)),void 0===t&&(t=1),this._dictionary.has("C")||(this._isTransparentColor=!0),this._dictionary.has("AP")&&this._isLoaded?this._parseStampAppearance():this._appearanceTemplate=this._createRubberStampAppearance()},Tn.prototype._doPostProcess=function(t){void 0===t&&(t=!1);var e,i,n=!1;this._isLoaded&&(this._setAppearance||t||this._isExport)?((!t&&!this._isExport||this._setAppearance||this._isRotated)&&(this._appearanceTemplate=this._createRubberStampAppearance()),!this._appearanceTemplate&&(this._isExport||t)&&this._dictionary.has("AP")&&(n=this._parseStampAppearance())):(this._isImported&&this._dictionary.has("AP")||this._postProcess(),this._appearanceTemplate||!t&&!this._isImported||(this._dictionary.has("AP")?(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))&&((e=e.getRaw("N"))&&(i.reference=e),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createRubberStampAppearance())),void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate?(e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._appearanceTemplate._content.dictionary.has("Matrix")||(i=this._appearanceTemplate._content.dictionary.getArray("BBox"))&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-i[0],-i[1]]),n?this._flattenAnnotationTemplate(this._appearanceTemplate,n):this._flattenAnnotationTemplate(this._appearanceTemplate,e)):t&&this._page.annotations.remove(this)},Tn.prototype._parseStampAppearance=function(){var t,e,i,n,r,s=!1,a=this._dictionary.get("AP");return a&&a.has("N")&&(t=a.get("N"))&&((a=a.getRaw("N"))&&(t.reference=a),a=!1,this._type===M._PdfAnnotationType.rubberStampAnnotation&&(e=!1,i=r=void 0,t&&(e=(e=this._page.rotation===M.PdfRotationAngle.angle0&&this.rotationAngle===M.PdfRotationAngle.angle0)||this._page.rotation!==M.PdfRotationAngle.angle0&&this.rotationAngle===M.PdfRotationAngle.angle0),this._appearanceTemplate=new P(t,this._crossReference),a=!0,(s=!!e)&&t instanceof y?(e=t.dictionary.getArray("Matrix"))&&(e=e.slice(),(n=t.dictionary.getArray("BBox"))&&3<n.length?(i=Os(n),r=[(n=this._transformBBox(i,e))[2],n[3]],this._appearanceTemplate._size={width:r[0],height:r[1]}):r=[i.width,i.height]):i&&(r=[i.width,i.height])),a||(this._appearanceTemplate=new P(t,this._crossReference))),s},Tn.prototype._createRubberStampAppearance=function(){var t,e,i={x:0,y:0,width:this.bounds.width,height:this.bounds.height},i=(this._appearance?(n=this._appearance,this._dictionary.has("Name")||this._dictionary.update("Name",R.get("#23CustomStamp"))):(this._iconString=this._obtainIconName(this.icon),this._dictionary.update("Name",R.get("#23"+this._iconString.replace(/\s+/g,""))),(n=new Ae(i,this)).normal=new P(i,this._crossReference)),n.normal),n=(!this._alterRotateBounds||void 0===this._rotate||this._rotate===M.PdfRotationAngle.angle0&&0===this._getRotationAngle()?this.rotateAngle=this._getRotationAngle():(this.rotateAngle=this._getRotationAngle(),0===this.rotateAngle&&(this.rotateAngle=90*this.rotationAngle),this.bounds=this._getRotatedBounds(this.bounds,this.rotate)),ua(i,this.rotate,this),this._appearance||this._drawStampAppearance(i),this._dictionary&&this._dictionary.has("AP")&&(n=this._dictionary.get("AP"))&&n.has("N")&&(e=n.getRaw("N"))instanceof m&&(this._crossReference._cacheMap.delete(e),t=!0),new D);return i._content.dictionary._updated=!0,t||(e=this._crossReference._getNextReference()),this._crossReference._cacheMap.set(e,i._content),i._content.reference=e,n.set("N",e),n._updated=!0,this._dictionary.set("AP",n),this._dictionary.set("Border",[this.border.hRadius,this.border.vRadius,this.border.width]),this._dictionary.update("Rect",no(this)),i},Tn.prototype._drawStampAppearance=function(t){var e=new I,i=(e.alignment=M.PdfTextAlignment.center,e.lineAlignment=M.PdfVerticalAlignment.middle,new A(this._obtainBackGroundColor())),n=new x(this._obtainBorderColor(),this.border.width),r=t.graphics,t=(r.save(),r.scaleTransform(t._size.width/(this._stampWidth+4),t._size.height/28),this._stampAppearanceFont);void 0!==this.opacity&&this._opacity<1&&r.setTransparency(this._opacity),this._drawRubberStamp(r,n,i,t,e),r.restore()},Tn.prototype._obtainIconName=function(t){switch(t){case M.PdfRubberStampAnnotationIcon.approved:this._iconString="Approved",this._stampWidth=126;break;case M.PdfRubberStampAnnotationIcon.asIs:this._iconString="As Is",this._stampWidth=75;break;case M.PdfRubberStampAnnotationIcon.confidential:this._iconString="Confidential",this._stampWidth=166;break;case M.PdfRubberStampAnnotationIcon.departmental:this._iconString="Departmental",this._stampWidth=186;break;case M.PdfRubberStampAnnotationIcon.draft:this._iconString="Draft",this._stampWidth=90;break;case M.PdfRubberStampAnnotationIcon.experimental:this._iconString="Experimental",this._stampWidth=176;break;case M.PdfRubberStampAnnotationIcon.expired:this._iconString="Expired",this._stampWidth=116;break;case M.PdfRubberStampAnnotationIcon.final:this._iconString="Final",this._stampWidth=90;break;case M.PdfRubberStampAnnotationIcon.forComment:this._iconString="For Comment",this._stampWidth=166;break;case M.PdfRubberStampAnnotationIcon.forPublicRelease:this._iconString="For Public Release",this._stampWidth=240;break;case M.PdfRubberStampAnnotationIcon.notApproved:this._iconString="Not Approved",this._stampWidth=186;break;case M.PdfRubberStampAnnotationIcon.notForPublicRelease:this._iconString="Not For Public Release",this._stampWidth=290;break;case M.PdfRubberStampAnnotationIcon.sold:this._iconString="Sold",this._stampWidth=75;break;case M.PdfRubberStampAnnotationIcon.topSecret:this._iconString="Top Secret",this._stampWidth=146;break;case M.PdfRubberStampAnnotationIcon.completed:this._iconString="Completed",this._stampWidth=136;break;case M.PdfRubberStampAnnotationIcon.void:this._iconString="Void",this._stampWidth=75;break;case M.PdfRubberStampAnnotationIcon.informationOnly:this._iconString="Information Only",this._stampWidth=230;break;case M.PdfRubberStampAnnotationIcon.preliminaryResults:this._iconString="Preliminary Results",this._stampWidth=260}return this._iconString},Tn.prototype._obtainBackGroundColor=function(){var t=this._icon===M.PdfRubberStampAnnotationIcon.notApproved||this._icon===M.PdfRubberStampAnnotationIcon.void?{r:251,g:222,b:221}:this._icon===M.PdfRubberStampAnnotationIcon.approved||this._icon===M.PdfRubberStampAnnotationIcon.final||this._icon===M.PdfRubberStampAnnotationIcon.completed?{r:229,g:238,b:222}:{r:219,g:227,b:240};return t},Tn.prototype._obtainBorderColor=function(){var t=this._icon===M.PdfRubberStampAnnotationIcon.notApproved||this._icon===M.PdfRubberStampAnnotationIcon.void?{r:151,g:23,b:15}:this._icon===M.PdfRubberStampAnnotationIcon.approved||this._icon===M.PdfRubberStampAnnotationIcon.final||this._icon===M.PdfRubberStampAnnotationIcon.completed?{r:73,g:110,b:38}:{r:24,g:37,b:100};return t},Tn.prototype._drawRubberStamp=function(t,e,i,n,r){var s={x:2,y:1,width:this._stampWidth,height:26},e=(t.drawRoundedRectangle(s,3,e,i),new A(this._obtainBorderColor()));t.drawString(this._iconString.toUpperCase(),n,s,null,e,r)},Tn.prototype._obtainInnerBounds=function(){var t,e={x:0,y:0,width:0,height:0};return e=this._dictionary&&this._dictionary.has("AP")&&(t=this._dictionary.get("AP"))&&t.has("N")&&(t=t.get("N"))&&void 0!==t.dictionary&&(t=t.dictionary).has("BBox")&&(t=t.getArray("BBox"))&&4===t.length?Os(t):e};var xn,An=Tn;function Tn(t,e){var i=xn.call(this)||this;return i._icon=M.PdfRubberStampAnnotationIcon.draft,i._stampWidth=0,i._iconString="",i.rotateAngle=0,i._alterRotateBounds=!0,i._stampAppearanceFont=new E(M.PdfFontFamily.helvetica,20,M.PdfFontStyle.italic|M.PdfFontStyle.bold),i._dictionary=new D,i._dictionary.update("Type",R.get("Annot")),i._dictionary.update("Subtype",R.get("Stamp")),t&&(i.bounds=t),i._type=M._PdfAnnotationType.rubberStampAnnotation,e&&("text"in e&&k(e.text)&&(i.text=e.text),"author"in e&&k(e.author)&&(i.author=e.author),"subject"in e&&k(e.subject)&&(i.subject=e.subject),"color"in e&&k(e.color)&&(i.color=e.color),"innerColor"in e&&k(e.innerColor)&&(i.innerColor=e.innerColor),"icon"in e&&k(e.icon)&&(i.icon=e.icon),"opacity"in e&&k(e.opacity)&&(i.opacity=e.opacity),"border"in e)&&k(e.border)&&(i.border=e.border),i}t(Rn,Cn=vi),Rn._load=function(t,e){var i=new Rn;return i._isLoaded=!0,i._initialize(t,e),i},Rn.prototype._initialize=function(t,e){Cn.prototype._initialize.call(this,t,e)},Rn.prototype._doPostProcess=function(t){var e;(t=void 0===t?!1:t)&&(t=void 0,this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(t=e.get("N"),e=e.getRaw("N"))&&t&&(t.reference=e),t?(e=new P(t,this._crossReference),t=this._validateTemplateMatrix(e._content.dictionary),this._flattenAnnotationTemplate(e,t)):this._removeAnnotation(this._page,this))};var Cn,kn=Rn;function Rn(){var t=Cn.call(this)||this;return t._type=M._PdfAnnotationType.soundAnnotation,t}t(o,Fn=vi),Object.defineProperty(o.prototype,"calloutLines",{get:function(){return null!==this._calloutLines&&void 0!==this._calloutLines||(this._calloutLines=this._getCalloutLinePoints()),this._calloutLines},set:function(t){if(this._isLoaded){var e=!1;if(this._isLoaded&&2<=t.length)if(this._calloutLines.length===t.length)for(var i=0;i<t.length;i++){var n=t[i],r=this._calloutLines[i];if(n.x!==r.x||n.y!==r.y){e=!0;break}}else e=!0;if(e){for(var s=this._page.size.height,a=[],i=0;i<t.length;i++)a.push(t[i].x+this._cropBoxValueX),a.push(s+this._cropBoxValueY-t[i].y);this._calloutLines=t,this._dictionary.update("CL",a)}}else this._calloutLines=t},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"lineEndingStyle",{get:function(){return this._isLoaded?this._lineEndingStyle=this._obtainLineEndingStyle():void 0===this._lineEndingStyle&&(this._lineEndingStyle=M.PdfLineEndingStyle.none),this._lineEndingStyle},set:function(t){void 0!==t&&this._dictionary.update("LE",R.get(Xs(t))),this._lineEndingStyle=t},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"textMarkUpColor",{get:function(){if(void 0===this._textMarkUpColor){var t,e=void 0;if(this._dictionary.has("TextColor"))return this._textMarkUpColor=qs(this._dictionary.getArray("TextColor")),this._textMarkUpColor;if(this._dictionary.has("DS"))for(var i=this._dictionary.get("DS").split(";"),n=0;n<i.length;n++)-1!==i[n].indexOf("color")&&((e=i[n].split(":")[1]).startsWith("#")&&(e=e.substring(1)),this._textMarkUpColor=Ns(e));!this._textMarkUpColor&&this._dictionary.has("RC")&&(t=void 0,0<this._parsedXMLData.length)&&this._parsedXMLData[3]&&(t=this._parsedXMLData[3]._color,this._textMarkUpColor=t),this._isLoaded&&!this._textMarkUpColor&&this._dictionary.has("DA")?this._textMarkUpColor=this._obtainColor():this._isLoaded||this._textMarkUpColor||(this._textMarkUpColor={r:0,g:0,b:0})}return this._textMarkUpColor},set:function(t){t&&(this._textMarkUpColor=t,this._updateStyle(this.font,t,this.textAlignment)),this._isContentUpdated=!0},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"textAlignment",{get:function(){var t;return this._dictionary.has("Q")?this._textAlignment=this._dictionary.get("Q"):this._dictionary.has("RC")&&(t=void 0,0<this._parsedXMLData.length)&&this._parsedXMLData[1]&&(t=this._parsedXMLData[1],this._textAlignment=t),this._textAlignment},set:function(t){this._textAlignment!==t&&this._dictionary.update("Q",t),this._textAlignment=t,this._isContentUpdated=!0},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"font",{get:function(){return!this._font&&(this._font=this._obtainFont(),null===this._font||void 0===this._font||!this._isLoaded&&1===this._font.size)&&(this._font=this._markUpFont),this._font},set:function(t){this._font=t,this._isContentUpdated=!0},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"borderColor",{get:function(){return void 0===this._borderColor&&this._dictionary.has("DA")&&(this._borderColor=this._obtainColor()),this._borderColor},set:function(t){t&&(this._borderColor=t,this._dictionary.update("DA",this._getBorderColorString(this.borderColor)))},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"annotationIntent",{get:function(){return void 0!==this._annotationIntent&&null!==this._annotationIntent||(this._dictionary.has("IT")?this._annotationIntent=Ra(this._dictionary.get("IT").name):this._annotationIntent=M.PdfAnnotationIntent.none),this._annotationIntent},set:function(t){void 0!==t&&(this._annotationIntent=t,void 0!==this.subject&&"null"!==this.subject||t!==M.PdfAnnotationIntent.none||this._calloutLines&&(!this._calloutLines||0!==this._calloutLines.length)?this._dictionary.update("IT",R.get(this._obtainAnnotationIntent(this._annotationIntent))):this._dictionary.update("Subj","Text Box"))},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_mkDictionary",{get:function(){var t;return t=this._dictionary.has("MK")?this._dictionary.get("MK"):t},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"_innerBounds",{get:function(){var t=this.border.width/2,e=this._obtainAppearanceBounds(),i=new or,n=this._obtainColor(),n=new x(n,this.border.width),n=(0<this.border.width&&(i.borderPen=n),this._obtainStyle(n,e,t,i));return this.calloutLines&&0<this._calloutLines.length&&(this._innerTextBoxBounds={x:n[0],y:this._page.size.height-(n[1]+n[3]),width:n[2],height:n[3]}),this._innerTextBoxBounds},enumerable:!0,configurable:!0}),o._load=function(t,e){var i=new o;return i._isLoaded=!0,i._initialize(t,e),e.has("RC")&&(i._parsedXMLData=i._parseMarkupLanguageData(e.get("RC"))),i},o.prototype._setPaddings=function(t){this._paddings=t},o.prototype._initialize=function(t,e){Fn.prototype._initialize.call(this,t,e)},o.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");this._dictionary.has("BS")?e=this.border.width:((i=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",i)),void 0===e&&(e=1),this._dictionary.has("C")||(this._isTransparentColor=!0);var e,i=this._getCropOrMediaBox();i&&3<i.length&&"number"==typeof i[0]&&"number"==typeof i[1]&&(0!==i[0]||0!==i[1])&&(this._cropBoxValueX=i[0],this._cropBoxValueY=i[1]),(t||this._setAppearance||0<this._customTemplate.size)&&(this._appearanceTemplate=this._createAppearance()),t||(this._dictionary.update("Rect",no(this)),this._saveFreeTextDictionary())},o.prototype._doPostProcess=function(t){var e,i,n;void 0===t&&(t=!1),this._isLoaded?((this._setAppearance||0<this._customTemplate.size||t&&!this._dictionary.has("AP"))&&(this._appearanceTemplate=this._createAppearance()),!this._appearanceTemplate&&t&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))&&((n=e.getRaw("N"))&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference))):(this._postProcess(t),!this._appearanceTemplate&&t&&(this._dictionary.has("AP")?(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))&&((n=e.getRaw("N"))&&(i.reference=n),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createAppearance())),void 0!==this.flattenPopups&&this.flattenPopups&&(this._isLoaded?this._flattenLoadedPopUp():this._flattenPopUp()),t&&this._appearanceTemplate?(e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._appearanceTemplate._content.dictionary.has("Matrix")||this._isLoaded||(i=this._appearanceTemplate._content.dictionary.getArray("BBox"))&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-i[0],-i[1]]),(e&&void 0!==this._page.rotation&&this._page.rotation!==M.PdfRotationAngle.angle0||this._appearanceTemplate&&!this._dictionary.has("AP")||this._dictionary.has("AP")&&this._isValidTemplateMatrix(this._appearanceTemplate._content.dictionary,this.bounds,this._appearanceTemplate))&&this._flattenAnnotationTemplate(this._appearanceTemplate,e)):t&&this._page.annotations.remove(this),this._dictionary.has("RC")&&this._isContentUpdated&&this._updateStyle(this.font,this._textMarkUpColor,this.textAlignment),!t&&(this._setAppearance||0<this._customTemplate.size)&&(i=void 0,e=this._crossReference,this._dictionary.has("AP")?i=this._dictionary.get("AP"):(n=e._getNextReference(),i=new D(e),e._cacheMap.set(n,i),i._updated=!0,this._dictionary.update("AP",n)),0<this._customTemplate.size?this._drawCustomAppearance(i):(T(i,e,"N"),n=e._getNextReference(),e._cacheMap.set(n,this._appearanceTemplate._content),this._appearanceTemplate._content.dictionary._update=!0,this._appearanceTemplate._content.reference=n,i.update("N",n)))},o.prototype._isValidTemplateMatrix=function(t,e,i){var n,r,s=!0;return t&&t.has("Matrix")&&(n=t.getArray("BBox"),t=t.getArray("Matrix"))&&n&&3<t.length&&2<n.length&&void 0!==t[0]&&void 0!==t[1]&&void 0!==t[2]&&void 0!==t[3]&&1===t[0]&&0===t[1]&&0===t[2]&&1===t[3]&&void 0!==n[0]&&void 0!==n[1]&&void 0!==n[2]&&void 0!==n[3]&&(Math.round(n[0])!==Math.round(-t[4])&&Math.round(n[1])!==Math.round(-t[5])||0===n[0]&&0===Math.round(-t[4]))&&(r=(t=this._page.graphics).save(),void 0!==this.opacity&&this._opacity<1&&t.setTransparency(this._opacity),e.x-=n[0],e.y+=n[1],t.drawTemplate(i,e),t.restore(r),this._page.annotations.remove(this),s=!1),s},o.prototype._createAppearance=function(){var t,e;if(this._page&&this._page._pageSettings&&this._page._pageSettings.margins&&(e=this._page._pageSettings.margins),this._customTemplate.has("N"))t=this._customTemplate.get("N");else{var i=this.border.width/2,n=this._obtainAppearanceBounds(),r=this.rotate,r=(0!==r&&90!==r&&180!==r&&270!==r||(this._isAllRotation=!1),(t=0<r&&this._isAllRotation?new P([0,0,n[2],n[3]],this._crossReference):new P(n,this._crossReference))._content.dictionary.getArray("BBox")),s=this._getRotationAngle(),s=(r&&null!=s&&t._content.dictionary.set("Matrix",[1,0,0,1,-r[0],-r[1]]),new or),r=this._obtainText(),a=(t._writeTransformation=!1,t.graphics),o=this._obtainTextAlignment(),h=this._obtainColor(),h=new x(h,this.border.width),n=(0<this.border.width&&(s.borderPen=h),this._obtainStyle(h,n,i,s)),i=(this.color&&(s.foreBrush=new A(this._color)),this.textMarkUpColor?this._textMarkUpColor:{r:0,g:0,b:0});if(s.backBrush=new A(i),s.borderWidth=this.border.width,this.calloutLines&&2<=this._calloutLines.length){if(this._drawCallOuts(a,h),this._isLoaded&&void 0===this._lineEndingStyle&&(this._lineEndingStyle=this.lineEndingStyle),this._lineEndingStyle!==M.PdfLineEndingStyle.none){for(var c=this._obtainLinePoints(),_=[],d=0;d<c.length;d+=2)_.push({x:c[d],y:c[d+1]});var i=this._getAngle(_),l=this._getAxisValue({x:c[2],y:c[3]},90,0);this._drawLineEndStyle(l,a,i,h,s.foreBrush,this.lineEndingStyle,this.border.width,!1)}(n=this._dictionary.has("RD")?[n[0],-n[1],n[2],-n[3]]:[this.bounds.x+(e?e.left:0),-(this._page.size.height-(this.bounds.y+this.bounds.height+(e?e.top:0))),this.bounds.width,-this.bounds.height])[0]=n[0]+this._cropBoxValueX,n[1]=n[1]-this._cropBoxValueY,this._calculateRectangle(n)}else n=[n[0],-n[1],n[2],-n[3]];s.bounds={x:n[0],y:n[1],width:n[2],height:n[3]};for(var l=this._obtainAppearanceBounds(),u=[n[0]-l[0],-n[1]-l[1],n[2]-l[2],-n[1]-l[1]-n[3]-l[3]],d=0;d<u.length;d++)u[d]<0&&(u[d]=-u[d]);this._dictionary.update("RD",u),this.opacity&&this._opacity<1&&(a.save(),a.setTransparency(this._opacity)),this.rotationAngle&&this._rotate!==M.PdfRotationAngle.angle0&&a.save(),this._drawFreeTextRectangle(a,s,n,o),r&&this._drawFreeMarkUpText(a,s,n,r,o),this.opacity&&this._opacity<1&&a.restore(),this.rotationAngle&&this._rotate!==M.PdfRotationAngle.angle0&&a.restore()}i=this._obtainAppearanceBounds();return this.flatten&&(this._bounds={x:i[0]-(e?e.left:0),y:this._page.size.height-(i[1]+i[3])-(e?e.top:0),width:i[2],height:i[3]}),this._dictionary.set("Rect",[i[0],i[1],i[0]+i[2],i[1]+i[3]]),t},o.prototype._calculateRectangle=function(t){for(var e=this._obtainAppearanceBounds(),i=[t[0]-e[0],-t[1]-e[1],t[2]-e[2],-t[1]-e[1]-t[3]-e[3]],n=0;n<4;n++)i[n]<0&&(i[n]=-i[n]);this._dictionary.set("RD",i)},o.prototype._obtainAnnotationIntent=function(t){switch(t){case M.PdfAnnotationIntent.freeTextCallout:this._intentString="FreeTextCallout";break;case M.PdfAnnotationIntent.freeTextTypeWriter:this._intentString="FreeTextTypeWriter"}return this._intentString},o.prototype._obtainFont=function(){var t,e,i=this._obtainFontDetails();return 0<this._parsedXMLData.length&&this._dictionary.has("RC")&&(t=void 0,(t=0<this._parsedXMLData.length&&this._parsedXMLData[0]?this._parsedXMLData[0]:t)instanceof E?(e=t,i.size=e.size,i.style=e.style,i.name=this._getFontFamily(e._fontFamily)):t instanceof pe&&(e=t,i.size=e.size,i.style=e.style,i.name=e._fontFamily.toString())),Ya(i.name,i.size,i.style,this)},o.prototype._getFontFamily=function(t){switch(Math.floor(t)){case M.PdfFontFamily.helvetica:return"Helvetica";case M.PdfFontFamily.courier:return"Courier";case M.PdfFontFamily.timesRoman:return"TimesRoman";case M.PdfFontFamily.symbol:return"Symbol";case M.PdfFontFamily.zapfDingbats:return"ZapfDingbats";default:return"Helvetica"}},o.prototype._updateStyle=function(t,e,i){e&&(a=[e.r,e.g,e.b]);var n,r,e=t._metrics._name.includes("Times")?"Times":t._metrics._name,s="font:"+e+" "+t.size+"pt;style:"+Fa(t.style)+";color:"+this._colorToHex(a),s=(this._dictionary.update("DS",s),'<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" style="font:'+e+" "+t.size+"pt;font-weight:"+(t.isBold?"bold":"normal")+";color:"+this._colorToHex(a)+'"><p dir="ltr">');if(null!=i){switch(i){case M.PdfTextAlignment.left:r="left";break;case M.PdfTextAlignment.center:r="center";break;case M.PdfTextAlignment.right:r="right";break;case M.PdfTextAlignment.justify:r="justify"}r&&(n="text-align:"+r+";")}var e="",a="font-style:italic",i="font-style:bold";t.isUnderline?(e=t.isStrikeout?"text-decoration:word line-through":"text-decoration:word",t.isItalic?e+=";"+a:t.isBold&&(e+=";"+i)):t.isStrikeout?(e="text-decoration:line-through",t.isItalic?e+=";"+a:t.isBold&&(e+=";"+i)):t.isItalic?e+=a:t.isBold&&(e+=i),a=""!==e?'<span style = "'+n+e+'">'+(this.text?this._getXmlFormattedString(this.text):"")+"</span>":'<span style = "'+n+'">'+(this.text?this._getXmlFormattedString(this.text):"")+"</span>",this._dictionary.update("RC",s+a+"</p></body>")},o.prototype._drawFreeMarkUpText=function(t,e,i,n,r){var s,a,o,h=!1,c=this.rotate;this.rotationAngle!==M.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==M.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==M.PdfRotationAngle.angle270||this._isAllRotation?0!==c||this._isAllRotation||(i=[i[0],i[1]+i[3],i[2],i[3]]):i=[i[1]+i[3],-(i[0]+i[2]),-i[3],i[2]]:i=[-(i[2]+i[0]),-i[1],i[2],-i[3]]:i=[-i[1],i[0],-i[3],i[2]],void 0!==this._font&&null!==this._font&&(this._isLoaded||1!==this._font.size)||(this._font=this._markUpFont),0<c&&this._isAllRotation&&(h=!0,s=this.bounds,a=new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle),a=this._font.measureString(n,{width:0,height:0},a,0,0),0<c&&c<=91?t.translateTransform({x:a.height,y:-s.height}):91<c&&c<=181?t.translateTransform({x:s.width-a.height,y:-(s.height-a.height)}):181<c&&c<=271?t.translateTransform({x:s.width-a.height,y:-a.height}):271<c&&c<360&&t.translateTransform({x:a.height,y:-a.height}),t.rotateTransform(c),e.bounds={x:0,y:0,width:e.bounds.width,height:e.bounds.height}),i[0],i[1],i[2],i[3];this._paddings&&!this._isLoaded?(s=this._paddings._left,a=this._paddings._top,c=this._paddings._right+this._paddings._left,o=this._paddings._top+this._paddings._bottom,i=0<e.borderWidth?[i[0]+(e.borderWidth+s),i[1]+(e.borderWidth+a),i[2]-(2*e.borderWidth+c),0<i[3]?i[3]-(2*e.borderWidth+o):-i[3]-(2*e.borderWidth+o)]:[i[0]+s,i[1]+a,i[2]-c,0<i[3]?i[3]-o:-i[3]-o]):0<e.borderWidth&&(i=[i[0]+1.5*e.borderWidth,i[1]+1.5*e.borderWidth,i[2]-3*e.borderWidth,0<i[3]?i[3]-3*e.borderWidth:-i[3]-3*e.borderWidth]),this._drawFreeTextAnnotation(t,e,n,this._font,i,!0,r,h)},o.prototype._drawFreeTextRectangle=function(t,e,i,n){if(this._dictionary.has("BE")){for(var r=0;r<i.length;r++)i[r]<0&&(i[r]=-i[r]);this._drawAppearance(t,e,i),this.rotationAngle!==M.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==M.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==M.PdfRotationAngle.angle270||this._isAllRotation||t.rotateTransform(-270):t.rotateTransform(-180):t.rotateTransform(-90)}else this.rotationAngle!==M.PdfRotationAngle.angle90||this._isAllRotation?this.rotationAngle!==M.PdfRotationAngle.angle180||this._isAllRotation?this.rotationAngle!==M.PdfRotationAngle.angle270||this._isAllRotation||(t.rotateTransform(-270),e.bounds={x:i[1]+i[3],y:-i[0],width:-i[3],height:-i[2]}):(t.rotateTransform(-180),e.bounds={x:-(i[2]+i[0]),y:-(i[3]+i[1]),width:i[2],height:i[3]}):(t.rotateTransform(-90),e.bounds={x:-i[1],y:i[2]+i[0],width:-i[3],height:-i[2]}),0<e.borderWidth&&!this._isAllRotation&&(i=[e.bounds.x,e.bounds.y,e.bounds.width,e.bounds.height]),this._drawFreeTextAnnotation(t,e,"",this._font,i,!1,n,!1)},o.prototype._drawAppearance=function(t,e,i){var n=new C;n.addRectangle({x:i[0],y:i[1],width:i[2],height:i[3]}),this._dictionary.has("BE")&&(i=this._dictionary.get("BE"))&&i.has("I")&&(i=i.get("I"),this._drawCloudStyle(t,e.foreBrush,e.borderPen,1===i?4:9,.833,n._points,!0))},o.prototype._drawFreeTextAnnotation=function(t,e,i,n,r,s,a,o){s?((s=new I).lineAlignment=M.PdfVerticalAlignment.top,s.alignment=a,s.lineSpacing=0,s.lineLimit=!1,o?t.drawString(i,n,e.bounds,e.backBrush,s):t.drawString(i,n,{x:r[0],y:r[1],width:r[2],height:r[3]},e.backBrush,s)):t.drawRectangle({x:r[0],y:r[1],width:r[2],height:r[3]},e.borderPen,e.foreBrush)},o.prototype._getCalloutLinePoints=function(){if(this._dictionary.has("CL")){var t=this._dictionary.getArray("CL");if(t){this._calloutLines=[];for(var e=0;e<t.length;e+=2){var i={x:t[e],y:this._page.size.height-t[e+1]};this._calloutLines.push(i)}}}return this._calloutLines},o.prototype._obtainAppearanceBounds=function(){var t=[0,0,0,0];if(this.calloutLines&&0<this._calloutLines.length){for(var e=new C,i=[],n=2===this._calloutLines.length?2:3,r=0;r<n;r++)i.push({x:0,y:0});if(2<=this._calloutLines.length){this._obtainCallOutsNative();for(r=0;r<this._calloutLines.length&&r<3;r++)i[r]={x:this._calloutsClone[r][0],y:this._calloutsClone[r][1]}}0<i.length&&(this.lineEndingStyle!==M.PdfLineEndingStyle.none&&this._expandAppearance(i),e._addLines(i));var t=e._getBounds(),s=void 0;this._page&&this._page._pageSettings&&this._page._pageSettings.margins&&(s=this._page._pageSettings.margins),this._page&&this._page._isNew?e.addRectangle({x:this.bounds.x+this._cropBoxValueX+s.left-2,y:this._page.size.height+this._cropBoxValueY-(this.bounds.y+this.bounds.height+s.top)-2,width:this.bounds.width+4,height:this.bounds.height+4}):e.addRectangle({x:this.bounds.x+this._cropBoxValueX-2,y:this._page.size.height+this._cropBoxValueY-(this.bounds.y+this.bounds.height)-2,width:this.bounds.width+4,height:this.bounds.height+4}),t=e._getBounds()}else this._page&&(t=this._page._isNew?(s=this._page._pageSettings.margins,[this.bounds.x+s.left,this._page.size.height-(this.bounds.y+this.bounds.height+s.top),this.bounds.width,this.bounds.height]):[this.bounds.x+this._cropBoxValueX,this._page.size.height+this._cropBoxValueY-(this.bounds.y+this.bounds.height),this.bounds.width,this.bounds.height]);return t},o.prototype._obtainCallOutsNative=function(){if(this.calloutLines&&0<this._calloutLines.length){var t=this._page.size,e=void 0;this._page&&this._page._pageSettings&&this._page._pageSettings.margins&&(e=this._page._pageSettings.margins),this._calloutsClone=[];for(var i=0;i<this._calloutLines.length;i++)this._calloutsClone.push([this._calloutLines[i].x+(e?e.left:0)+this._cropBoxValueX,t.height+this._cropBoxValueY-(this._calloutLines[i].y+(e?e.top:0))])}},o.prototype._obtainLinePoints=function(){var t=this._page.size.height;return[this.calloutLines[1].x+this._cropBoxValueX,t+this._cropBoxValueY-this.calloutLines[1].y,this.calloutLines[0].x+this._cropBoxValueX,t+this._cropBoxValueY-this.calloutLines[0].y]},o.prototype._obtainLineEndingStyle=function(){var t,e;return e=this._dictionary.has("LE")?Js(t=(t=this._dictionary.get("LE"))instanceof R?t.name:t):e},o.prototype._obtainText=function(){var t,e="",i=this._dictionary.has("Contents");return i?((e=(t=this._dictionary.get("Contents"))?t:e)&&""!==e&&(this._text=e),e):this._dictionary.has("RC")&&!i&&null===e?this._rcText:e},o.prototype._obtainTextAlignment=function(){var t,e,i=M.PdfTextAlignment.left;return this._dictionary.has("Q")?void 0!==(e=this._dictionary.get("Q"))&&(i=e,t=!0):this._dictionary.has("RC")&&0<this._parsedXMLData.length&&this._parsedXMLData[1]&&(i=this._parsedXMLData[1],t=!0),!t&&this._dictionary.has("DS")&&(e=this._dictionary.get("DS")).split(";").forEach(function(t){if(-1!==t.indexOf("text-align"))switch(t){case"left":i=M.PdfTextAlignment.left;break;case"right":i=M.PdfTextAlignment.right;break;case"center":i=M.PdfTextAlignment.center;break;case"justify":i=M.PdfTextAlignment.justify}}),i},o.prototype._obtainColor=function(){var t,e;return this._isLoaded?this._dictionary.has("DA")?(e=this._dictionary.get("DA"),Array.isArray(e)&&0<e.length?t={r:e[0],g:e[1],b:e[2]}:"string"==typeof e&&(this._da=new di(e),t=this._da.color)):this._dictionary.has("MK")?(e=this._mkDictionary)&&e.has("BC")&&(t=qs(e.getArray("BC"))):t={r:0,g:0,b:0}:t=this._borderColor||{r:0,g:0,b:0},t},o.prototype._expandAppearance=function(t){var e=t[0].y,i=t[0].x;(e=this._isLoaded?e:this._page.size.height-e)>this.bounds.y?this.lineEndingStyle!==M.PdfLineEndingStyle.openArrow&&(t[0].y-=11*this.border.width):t[0].y+=11*this.border.width,i<=this.bounds.x?t[0].x-=11*this.border.width:t[0].x+=11*this.border.width},o.prototype._drawCallOuts=function(t,e){for(var i=new C,n=[],r=2===this._calloutLines.length?2:3,s=0;s<r;s++)n.push({x:0,y:0});if(2<=this._calloutLines.length){this._obtainCallOutsNative();for(s=0;s<this._calloutLines.length&&s<3;s++)n[s]={x:this._calloutsClone[s][0],y:-this._calloutsClone[s][1]}}0<n.length&&i._addLines(n),t.drawPath(i,e)},o.prototype._saveFreeTextDictionary=function(){if(void 0!==this.font&&null!==this.font&&(this._isLoaded||1!==this.font.size)||(this.font=this._markUpFont),"string"==typeof this.text&&null!==this.text&&this._dictionary.update("Contents",this.text),this._isLoaded&&(this._textAlignment=this.textAlignment),this._dictionary.update("Q",this._textAlignment),void 0!==this.subject&&"null"!==this.subject||this.annotationIntent!==M.PdfAnnotationIntent.none||this._calloutLines&&(!this._calloutLines||0!==this._calloutLines.length)?(this._calloutLines&&2<=this._calloutLines.length&&this.annotationIntent===M.PdfAnnotationIntent.none&&(this._annotationIntent=M.PdfAnnotationIntent.freeTextCallout),this._dictionary.update("IT",R.get(this._obtainAnnotationIntent(this._annotationIntent)))):this._dictionary.update("Subj","Text Box"),this._updateStyle(this.font,this.textMarkUpColor,this._textAlignment),this._dictionary.update("DA",this._getBorderColorString(this.borderColor?this._borderColor:{r:0,g:0,b:0})),this._calloutLines&&2<=this._calloutLines.length){for(var t=this._page.size.height,e=[],i=0;i<this._calloutLines.length&&i<3;i++)e.push(this._calloutLines[i].x+this._cropBoxValueX),e.push(t+this._cropBoxValueY-this._calloutLines[i].y);this._dictionary.update("CL",e)}var n;this._setAppearance&&(n=this._obtainAppearanceBounds(),this._dictionary.update("Rect",[n[0],n[1],n[0]+n[2],n[1]+n[3]]))},o.prototype._getXmlFormattedString=function(t){return t=(t=(t=t.replace("&","&")).replace("<","<")).replace(">",">")},o.prototype._parseMarkupLanguageData=function(t){var e,i,n,r,s,a=this,o=M.PdfFontStyle.regular,h=[];return(this._dictionary.has("Contents")?this._dictionary.get("Contents"):"").split("").some(function(t){return a._isSymbol(t)})||null!=t&&(e=(t=(new DOMParser).parseFromString(t,"text/xml").documentElement)&&t.namespaceURI||"",t)&&(r=void 0,0<(t=this._collectStyles(t)).size?(r=this._extractStylesToInput(t),n=this._getFontDetails(r,this.font.size,this.textAlignment,o,null),i=(n=this._updateFontProperties(n,"",o,null)).fontName,s=n.fontStyle,n=n.brush,i=Ya(i,this.font._size,s,this),h=this._fontCollection(h,i,e,this._textAlignment,n)):0===t.size&&this._dictionary.has("DS")&&(r=this._dictionary.get("DS").split(";")||[]),o=this.font.style,s=this._getFontDetails(r,this.font.size,this.textAlignment,o,null),n=(i=this._updateFontProperties(s,"",o,null)).fontName,t=i.fontStyle,r=i.brush,s=Ya(n,this.font._size,t,this),this._font=s,h=this._fontCollection(h,s,e,this._textAlignment,r)),this._parsedXMLData=h},o.prototype._collectStyles=function(t,e){if(void 0===e&&(e=new Map),t)for(var i=t.tagName.toLowerCase(),n=t.getAttribute("style"),r=(n&&(n=n.split(";").map(function(t){return t.trim()}).filter(Boolean),e.set(i,n)),t.firstElementChild);r;)this._collectStyles(r,e),r=r.nextElementSibling;return e},o.prototype._extractStylesToInput=function(t){var e=[];return t.forEach(function(t){e.push.apply(e,t)}),e},o.prototype._isSymbol=function(t){var e=t.charCodeAt(0);return"_"!==t&&"+"!==t&&"-"!==t&&"*"!==t&&"="!==t&&(8352<=e&&e<=8399||8704<=e&&e<=8959||10752<=e&&e<=11007||8448<=e&&e<=8527||8960<=e&&e<=9215||11088===e)},o.prototype._updateFontProperties=function(t,i,n,r){var s,a=this;return t.forEach(function(t,e){switch(e){case"font-family":i=t;break;case"font-size":a.font._size=parseFloat(t);break;case"font-style":case"font-weight":case"text-decoration":s=parseFloat(t),s=a._getStyles(s),n=a._maxStyle(n,s);break;case"text-align":a._textAlignment=a._parseTextAlignment(t);break;case"color":r=t;break;case"xfa-spacerun":a._rcText=t}}),{fontName:i,fontStyle:n,brush:r}},o.prototype._getStyles=function(t){t&=M.PdfFontStyle.bold|M.PdfFontStyle.italic|M.PdfFontStyle.underline|M.PdfFontStyle.strikeout;return 0==t?M.PdfFontStyle.regular:t},o.prototype._maxStyle=function(t,e){return e<=t?t:e},o.prototype._parseTextAlignment=function(t){switch(parseFloat(t)){case 0:return M.PdfTextAlignment.left;case 1:return M.PdfTextAlignment.center;case 2:return M.PdfTextAlignment.right;case 3:return M.PdfTextAlignment.justify;default:return M.PdfTextAlignment.left}},o.prototype._getFontDetails=function(t,n,r,s,a){var o=this,h=new Map;return t.forEach(function(t){var t=t.split(":").map(function(t){return t.trim()}),e=t[0],i=t[1];if(e&&i)switch(e.toLowerCase()){case"font":o._parseFont(i,h);break;case"font-size":n=o._parseFontSize(i),h.set("font-size",n);break;case"font-weight":s=o._parseFontWeight(i,s),h.set("font-weight",s);break;case"font-family":h.set("font-family",o._parseFontFamily(i));break;case"color":a=new A(o._rgbStringToArray(i)),h.set("color",a);break;case"font-style":s=o._parseFontStyle(i,s),h.set("font-style",s);break;case"text-decoration":s=o._parseTextDecoration(i,s),h.set("text-decoration",s);break;case"text-align":r=o._parseTextAlign(i),h.set("text-align",r);break;case"xfa-spacerun":o._rcText=1<i.length&&i.includes("yes")?o._rcText+" ":o._rcText,h.set("xfa-spacerun",o._rcText)}}),h},o.prototype._parseFont=function(t,e){var t=t.split(" ").map(function(t){return t.trim()}),i="";t.forEach(function(t){t&&!t.endsWith("pt")?i+=t+" ":t.endsWith("pt")&&e.set("font-size",parseFloat(t.replace("pt","").replace(",",".").trim()))}),e.set("font-family",i.trim().replace(/['",]/g,""))},o.prototype._parseFontSize=function(t){return t.endsWith("pt")?parseFloat(t.replace("pt","").replace(",",".").trim()):0},o.prototype._parseFontWeight=function(t,e){return t.includes("bold")&&(e|=M.PdfFontStyle.bold),e},o.prototype._parseFontFamily=function(t){return t.replace(/^'+|'+$/g,"").trim()},o.prototype._parseFontStyle=function(t,e){return(t.includes("normal")||t.includes("regular"))&&(e|=M.PdfFontStyle.regular),t.includes("underline")&&(e|=M.PdfFontStyle.underline),t.includes("strikeout")&&(e|=M.PdfFontStyle.strikeout),t.includes("italic")&&(e|=M.PdfFontStyle.italic),t.includes("bold")&&(e|=M.PdfFontStyle.bold),e},o.prototype._parseTextDecoration=function(t,e){return(t.includes("word")||t.includes("underline"))&&(e|=M.PdfFontStyle.underline),t.includes("line-through")&&(e|=M.PdfFontStyle.strikeout),e},o.prototype._parseTextAlign=function(t){switch(t.trim().toLowerCase()){case"left":return M.PdfTextAlignment.left;case"right":return M.PdfTextAlignment.right;case"center":return M.PdfTextAlignment.center;case"justify":return M.PdfTextAlignment.justify;default:return M.PdfTextAlignment.left}},o.prototype._rgbStringToArray=function(t){var e=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(e)return{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)};e=t.match(/^#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);if(e)return{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)};throw new Error("Invalid RGB string format")},o.prototype._fontCollection=function(t,e,i,n,r){return t.concat([e,n,i,r])};var Fn,In=o;function o(t,e){var i=Fn.call(this)||this;return i._intentString="",i._markUpFont=new E(M.PdfFontFamily.helvetica,7,M.PdfFontStyle.regular),i._textAlignment=M.PdfTextAlignment.left,i._cropBoxValueX=0,i._cropBoxValueY=0,i._dictionary=new D,i._dictionary.update("Type",R.get("Annot")),i._dictionary.update("Subtype",R.get("FreeText")),t&&(i.bounds=t),i._isContentUpdated=!1,i._type=M._PdfAnnotationType.freeTextAnnotation,i._parsedXMLData=[],e&&("text"in e&&k(e.text)&&(i.text=e.text),"author"in e&&k(e.author)&&(i.author=e.author),"subject"in e&&k(e.subject)&&(i.subject=e.subject),"textMarkUpColor"in e&&k(e.textMarkUpColor)&&(i.textMarkUpColor=e.textMarkUpColor),"innerColor"in e&&k(e.innerColor)&&(i.innerColor=e.innerColor),"lineEndingStyle"in e&&k(e.lineEndingStyle)&&(i.lineEndingStyle=e.lineEndingStyle),"opacity"in e&&k(e.opacity)&&(i.opacity=e.opacity),"border"in e&&k(e.border)&&(i.border=e.border),"borderColor"in e&&k(e.borderColor)&&(i.borderColor=e.borderColor),"annotationIntent"in e&&k(e.annotationIntent)&&(i.annotationIntent=e.annotationIntent),"textAlignment"in e&&k(e.textAlignment)&&(i.textAlignment=e.textAlignment),"font"in e&&k(e.font)&&(i.font=e.font),"calloutLines"in e)&&k(e.calloutLines)&&(i.calloutLines=e.calloutLines),i}t(Ln,Dn=vi),Object.defineProperty(Ln.prototype,"repeatText",{get:function(){return void 0===this._repeat&&this._dictionary.has("Repeat")&&(this._repeat=this._dictionary.get("Repeat")),this._repeat},set:function(t){t!==this._repeat&&(this._repeat=t,this._dictionary)&&this._dictionary.update("Repeat",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"textAlignment",{get:function(){return this._dictionary.has("Q")&&(this._textAlignment=this._dictionary.get("Q")),this._textAlignment},set:function(t){null!=t&&this._textAlignment!==t&&this._dictionary.update("Q",t),this._textAlignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"textColor",{get:function(){return void 0===this._textColor&&this._dictionary.has("C")&&(this._textColor=qs(this._dictionary.getArray("C"))),this._textColor},set:function(t){var e;t&&(e=this.textColor,this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._textColor=t,this._dictionary.update("C",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))])))},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"borderColor",{get:function(){return void 0===this._borderColor&&this._dictionary.has("OC")&&(this._borderColor=qs(this._dictionary.getArray("OC"))),this._borderColor},set:function(t){var e;t&&(e=this.borderColor,this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._borderColor=t,this._dictionary.update("OC",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))])))},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"overlayText",{get:function(){return void 0===this._overlayText&&this._dictionary.has("OverlayText")&&(this._overlayText=this._dictionary.get("OverlayText")),this._overlayText},set:function(t){"string"==typeof t&&(this._dictionary.update("OverlayText",t),this._overlayText=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"font",{get:function(){return this._font||(this._font=this._obtainFont()),this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"appearanceFillColor",{get:function(){var t;return null!==this._appearanceFillColor&&void 0!==this._appearanceFillColor||!this._dictionary.has("AFC")||(t=this._dictionary.getArray("AFC"))&&(this._appearanceFillColor=qs(t)),this._appearanceFillColor},set:function(t){var e;t&&(e=this.appearanceFillColor,this._isLoaded&&void 0!==e&&e.r===t.r&&e.g===t.g&&e.b===t.b||(this._appearanceFillColor=t,this._dictionary.update("AFC",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))])))},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"boundsCollection",{get:function(){if(this._isLoaded){var t=[];if(this._dictionary.has("QuadPoints")){var e=this._dictionary.getArray("QuadPoints");if(e&&0<e.length)for(var i=this._getMediaOrCropBox(this._page),n=i&&0<i.length?i[0]:0,r=i&&1<i.length?i[1]:0,s=e.length/8,a=0;a<s;a++){var o=e[4+8*a]-e[8*a],h=e[5+8*a]-e[1+8*a],c=Math.sqrt(o*o+h*h),o=e[6+8*a]-e[4+8*a],h=e[7+8*a]-e[5+8*a],o=Math.sqrt(o*o+h*h),h={x:e[8*a]-n,y:this._page.size.height-e[1+8*a]-r,width:o,height:c};t.push(h)}}return t}return this._boundsCollection},set:function(t){var e;if(this._isLoaded||void 0===t||(0<t.length?(this._quadPoints=new Array(8*t.length),(e=this._boundsCollection).push.apply(e,t)):(this._quadPoints=new Array(8),this._boundsCollection=t),this._isChanged=!0),this._isLoaded&&void 0!==t){var i=!1;if(this.boundsCollection.length===t.length)for(var n=0;n<t.length;n++){var r=t[n],s=this.boundsCollection[n];if(r.x!==s.x||r.y!==s.y||r.width!==s.width||r.height!==s.height){i=!0;break}}else i=!0;if(i){this._quadPoints=new Array(8*t.length);for(var a=this._page.size.height,n=0;n<t.length;n++){var o=t[n],h=8*n;this._quadPoints[0+h]=o.x,this._quadPoints[1+h]=a-o.y,this._quadPoints[2+h]=o.x+o.width,this._quadPoints[3+h]=a-o.y,this._quadPoints[4+h]=o.x,this._quadPoints[5+h]=this._quadPoints[1+h]-o.height,this._quadPoints[6+h]=o.x+o.width,this._quadPoints[7+h]=this._quadPoints[5+h]}this._dictionary.update("QuadPoints",this._quadPoints),this._isChanged=!0}}},enumerable:!0,configurable:!0}),Ln._load=function(t,e){var i=new Ln;return i._isLoaded=!0,i._initialize(t,e),i},Ln.prototype._initialize=function(t,e){Dn.prototype._initialize.call(this,t,e)},Ln.prototype._postProcess=function(t){if(void 0===this.bounds||null===this.bounds)throw new Error("Bounds cannot be null or undefined");var e,i;this._dictionary.has("BS")?e=this.border.width:((i=new D(this._crossReference)).set("Type",R.get("Border")),this._dictionary.set("BS",i)),void 0===e&&(e=1),this._isChanged&&this._setQuadPoints(this._page.size),(this._setAppearance||0<this._customTemplate.size)&&(this._appearanceTemplate=this._createRedactionAppearance(t)),this._dictionary.update("Rect",no(this))},Ln.prototype._doPostProcess=function(t){var e,i;void 0===t&&(t=!1),this._isImported||(this._isLoaded?this._appearanceTemplate=this._createRedactionAppearance(t):(this._postProcess(t),this._appearanceTemplate||t&&(this._dictionary.has("AP")?(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"))&&((e=e.getRaw("N"))&&(i.reference=e),this._appearanceTemplate=new P(i,this._crossReference)):this._appearanceTemplate=this._createRedactionAppearance(t))),t&&this._appearanceTemplate?(e=this._validateTemplateMatrix(this._appearanceTemplate._content.dictionary),this._appearanceTemplate._content.dictionary.has("Matrix")||(i=this._appearanceTemplate._content.dictionary.getArray("BBox"))&&this._appearanceTemplate._content.dictionary.update("Matrix",[1,0,0,1,-i[0],-i[1]]),this._flattenAnnotationTemplate(this._appearanceTemplate,e)):t&&this._page.annotations.remove(this))},Ln.prototype._createRedactionAppearance=function(t){var e,i,n,r=this._createNormalAppearance();return t?this._isLoaded&&null!==this._page&&this._page.annotations.remove(this):(t=this._createBorderAppearance(),e=void(this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e instanceof D&&(T(e,this._crossReference,"N"),T(e,this._crossReference,"R"))),this._dictionary.has("AP")?e=this._dictionary.get("AP"):(n=this._crossReference._getNextReference(),e=new D(this._crossReference),this._crossReference._cacheMap.set(n,e),this._dictionary.update("AP",n)),0<this._customTemplate.size?(r=this._customTemplate.get("R"),this._drawCustomAppearance(e)):(t._content.dictionary._updated=!0,i=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(i,t._content),t._content.reference=i,e.set("N",i),r._content.dictionary._updated=!0,n=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(n,r._content),r._content.reference=n,e.set("R",n),e._updated=!0)),r},Ln.prototype._createBorderAppearance=function(){if(1<this.boundsCollection.length){for(var t=new C,e=0,i=this.boundsCollection;e<i.length;e++){var n=i[e];t.addRectangle(n)}var r=t._getBounds(),s={x:r[0],y:r[1],width:r[2],height:r[3]};this.bounds=s}else{r=this.boundsCollection[0];s=r||this.bounds}var a,o,r=[0,0,this.bounds.width,this.bounds.height],r=new P(r,this._crossReference),h=r.graphics;0<this.border.width&&this.borderColor&&(a=new x(this.borderColor,this.border.width)),this.appearanceFillColor&&(o=new A(this.appearanceFillColor));for(var c=0,_=this.boundsCollection&&0<this.boundsCollection.length?this.boundsCollection:[{x:this.bounds.x,y:this.bounds.y,width:this.bounds.width,height:this.bounds.height}];c<_.length;c++){var d,n=_[c];this.opacity<1?(d=h.save(),h.setTransparency(this.opacity),h.drawRectangle({x:n.x-s.x,y:n.y-s.y,width:n.width,height:n.height},a,o),h.restore(d)):h.drawRectangle({x:n.x-s.x,y:n.y-s.y,width:n.width,height:n.height},a,o)}return r},Ln.prototype._drawText=function(t,e){if(this.overlayText){this.font||(this.font=this._lineCaptionFont),this._isLoaded&&(this._textAlignment=this.textAlignment);for(var i=this.textColor?new A(this.textColor):new A({r:128,g:128,b:128}),n=this.boundsCollection&&0<this.boundsCollection.length?this.boundsCollection:[{x:this.bounds.x,y:this.bounds.y,width:this.bounds.width,height:this.bounds.height}],r=[],s=(this.overlayText.trim().split(/\s+/).forEach(function(t){0<t.length&&r.push(t)}),0),a=0,o=n;a<o.length;a++){var h=o[a],c=h.x-e.x,_=h.y-e.y,d=h.width,h=h.height,s=this._drawWrappedTextAligned(t,c,_,d,h,r,s,this._textAlignment,i,this.repeatText);if(!this.repeatText&&r.length<=s)break}}},Ln.prototype._drawWrappedTextAligned=function(t,e,i,n,r,s,a,o,h,c){for(var _=this._getLineHeight(),d=new I(0,M.PdfVerticalAlignment.top),l=1===s.length,u=this._getSpaceWidth(),p=i,f=a;p+_<=i+r;){for(var g=[],y="",m=0;;){if(f>=s.length){if(!c)break;if(f=0,1<++m&&0===g.length)break}if(f>=s.length)break;var b,w=s[f],v=0===g.length?w:l?y+w:y+" "+w;if(!(this._measureText(v)<=n+.25)){0===g.length&&(0<(b=this._breakWordToFit(w,n,this._measureText.bind(this))).text.length&&(g.push(b.text),y=b.text),b.remainder&&0<b.remainder.length?s[f]=b.remainder:f++);break}g.push(w),y=v,f++}if(0===g.length)break;var S=!c&&f>=s.length;if(o===M.PdfTextAlignment.right){var P=this._measureText(y),x=e+Math.max(0,n-P);t.drawString(y,this.font,{x:x,y:p,width:P,height:_},null,h,d)}else if(o===M.PdfTextAlignment.center){P=this._measureText(y),x=e+Math.max(0,(n-P)/2);t.drawString(y,this.font,{x:x,y:p,width:P,height:_},null,h,d)}else if(o===M.PdfTextAlignment.justify&&!S&&1<g.length&&!l){for(var A=0,T=0,C=g;T<C.length;T++){w=C[T];A+=this._measureText(w)}for(var S=n-A-(g.length-1)*u,k=(S=S<0?0:S)/(g.length-1),x=e,R=0;R<g.length;R++){var w=g[R],F=this._measureText(w);t.drawString(w,this.font,{x:x,y:p,width:F,height:_},null,h,d),x+=F,R<g.length-1&&(x+=u+k)}}else t.drawString(y,this.font,{x:e,y:p,width:Math.min(this._measureText(y),n),height:_},null,h,d);p+=_}return f},Ln.prototype._breakWordToFit=function(t,e,i){if(!t)return{text:"",remainder:null};for(var n=1,r=t.length,s=0;n<=r;){var a=n+r>>1;i(t.slice(0,a))<=e?n=1+(s=a):r=a-1}return{text:t.slice(0,s),remainder:s<t.length?t.slice(s):null}},Ln.prototype._measureText=function(t){return this.font.measureString(t,{width:0,height:0}).width},Ln.prototype._getSpaceWidth=function(){return this._measureText(" ")},Ln.prototype._getLineHeight=function(){return this.font._getHeight()},Ln.prototype._createNormalAppearance=function(t,e,i){var n=new C,r=!1;if(e)n.addRectangle(v=e),r="number"==typeof t&&0<=t;else if("number"==typeof t&&0<=t&&t<this.boundsCollection.length)v=this.boundsCollection[t],n.addRectangle(v),r=!0;else for(var s=0,a=this.boundsCollection;s<a.length;s++){var o=a[s];n.addRectangle(o)}var h,c,_,t=n._getBounds(),d=(0===t[2]&&0===t[3]&&(t[0]=(e||this.bounds).x,t[1]=(e||this.bounds).y,t[2]=(e||this.bounds).width,t[3]=(e||this.bounds).height),{x:t[0],y:t[1],width:t[2],height:t[3]}),e=[0,0,(this.bounds=d).width,d.height],t=new P(e,this._crossReference),l=t.graphics,u=this.border.width/2,p=this.border.width,f=(this.borderColor&&0<this.border.width&&(h=new x(this.borderColor,this.border.width)),this.innerColor&&(c=new A(this.innerColor)),this.opacity<1);if(f&&(_=l.save(),l.setTransparency(this.opacity)),this.boundsCollection&&0<this.boundsCollection.length)if(r&&v)l.drawRectangle({x:v.x-d.x,y:v.y-d.y,width:v.width,height:v.height},h,c);else for(var g=0,y=this.boundsCollection;g<y.length;g++){var m=y[g];l.drawRectangle({x:m.x-d.x,y:m.y-d.y,width:m.width,height:m.height},h,c)}else l.drawRectangle({x:e[0]+u,y:e[1]+u,width:e[2]-p,height:e[3]-p},h,c);if(f&&_&&l.restore(_),this.overlayText){var r=l.save(),b=e[2],w=e[3];switch(i){case M.PdfRotationAngle.angle90:l.rotateTransform(90),l.translateTransform({x:0,y:-b});break;case M.PdfRotationAngle.angle180:l.rotateTransform(180),l.translateTransform({x:-b,y:-w});break;case M.PdfRotationAngle.angle270:l.rotateTransform(270),l.translateTransform({x:-w,y:0});break;case M.PdfRotationAngle.angle0:}var v=d;null==i||i!==M.PdfRotationAngle.angle90&&i!==M.PdfRotationAngle.angle270||(v.width=d.height,v.height=d.width),this._drawText(l,v),l.restore(r)}return t};var Dn,Bn=Ln;function Ln(t,e){var i=Dn.call(this)||this;return i._textAlignment=M.PdfTextAlignment.left,i._dictionary=new D,i._dictionary.update("Type",R.get("Annot")),i._dictionary.update("Subtype",R.get("Redact")),t&&(i.bounds=t,e)&&(k(e.borderColor)&&(i.borderColor=e.borderColor),k(e.repeatText)&&(i.repeatText=e.repeatText),k(e.overlayText)&&(i.overlayText=e.overlayText),e.font&&(i.font=e.font),k(e.textColor)&&(i.textColor=e.textColor),k(e.appearanceFillColor)&&(i.appearanceFillColor=e.appearanceFillColor),k(e.innerColor)&&(i.innerColor=e.innerColor),k(e.textAlignment)&&(i.textAlignment=e.textAlignment),k(e.text)&&(i.text=e.text),k(e.author)&&(i.author=e.author),k(e.subject)&&(i.subject=e.subject),k(e.opacity)&&(i.opacity=e.opacity),k(e.boundsCollection))&&Array.isArray(e.boundsCollection)&&0<e.boundsCollection.length&&(i.boundsCollection=e.boundsCollection),i._type=M._PdfAnnotationType.redactionAnnotation,i}t(En,On=bi),En._load=function(t,e){var i=new En;return i._isLoaded=!0,i._initialize(t,e),i},En.prototype._initialize=function(t,e){On.prototype._initialize.call(this,t,e)},En.prototype._doPostProcess=function(t){var e;void 0===t&&(t=!1),void 0!==this.flattenPopups&&this.flattenPopups&&this._flattenPopUp(),t&&(t=void 0,this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(t=e.get("N"),e=e.getRaw("N"))&&t&&(t.reference=e),t?(e=new P(t,this._crossReference),t=this._validateTemplateMatrix(e._content.dictionary),this._flattenAnnotationTemplate(e,t)):this._removeAnnotation(this._page,this))};var On,Mn=En;function En(){var t=On.call(this)||this;return t._type=M._PdfAnnotationType.richMediaAnnotation,t}t(Vn,Nn=bi),Vn._load=function(t,e){var i=new Vn;return i._isLoaded=!0,i._dictionary=t,i._crossReference=e,i},Object.defineProperty(Vn.prototype,"page",{get:function(){return this._getPage()},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"color",{get:function(){return void 0===this._color&&this._defaultAppearance&&(this._color=this._da.color),this._color},set:function(t){void 0!==this.color&&this._color===t||(this._color=t);var e=!1;this._defaultAppearance||(this._da=new di(""),e=!0),!e&&this._da.color===t||(this._da.color=t,this._dictionary.update("DA",this._da.toString()))},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"backColor",{get:function(){return this._parseBackColor()},set:function(t){this._updateBackColor(t)},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"_hasBackColor",{get:function(){var t;return this._isLoaded?(t=this._mkDictionary)&&t.has("BG"):!this._isTransparentBackColor},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"_hasBorderColor",{get:function(){var t;return this._isLoaded?(t=this._mkDictionary)&&t.has("BC"):!this._isTransparentBorderColor},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"borderColor",{get:function(){return this._parseBorderColor()},set:function(t){this._updateBorderColor(t)},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"rotate",{get:function(){return void 0===this._rotationAngle&&(this._mkDictionary&&this._mkDictionary.has("R")?this._rotationAngle=this._mkDictionary.get("R"):this._dictionary.has("R")&&(this._rotationAngle=this._dictionary.get("R"))),this._rotationAngle},set:function(t){void 0!==this.rotate&&this._rotationAngle===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new D(this._crossReference)),this._mkDictionary.update("R",t),this._rotationAngle=t,this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"highlightMode",{get:function(){var t;return void 0===this._highlightMode&&this._dictionary.has("H")&&(t=this._dictionary.get("H"),this._highlightMode=Ys(t.name)),this._highlightMode},set:function(t){this._highlightMode!==t&&this._dictionary.update("H",Qs(t))},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"bounds",{get:function(){return this._isLoaded&&void 0===this._bounds&&(this._bounds=Ls(this._dictionary,this._getPage())),void 0!==this._bounds&&null!==this._bounds||(this._bounds={x:0,y:0,width:0,height:0}),this._bounds},set:function(t){if(0===t.x&&0===t.y&&0===t.width&&0===t.height)throw new Error("Cannot set empty bounds");this._bounds=t,this._page&&this._page._isNew&&this._page._pageSettings?this._dictionary.update("Rect",no(this)):this._dictionary.update("Rect",Es([t.x,t.y,t.width,t.height],this._getPage()))},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"textAlignment",{get:function(){return void 0===this._textAlignment&&this._dictionary.has("Q")&&(this._textAlignment=this._dictionary.get("Q")),this._textAlignment},set:function(t){void 0!==this._textAlignment&&this._textAlignment===t||this._dictionary.update("Q",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"visibility",{get:function(){if(!this._isLoaded)return this._visibility;var t=M.PdfFormFieldVisibility.visible;M.PdfAnnotationFlag.default;if(this._hasFlags){var e,i=3;switch(((e=this.flags)&M.PdfAnnotationFlag.hidden)===M.PdfAnnotationFlag.hidden&&(i=0),(e&M.PdfAnnotationFlag.noView)===M.PdfAnnotationFlag.noView&&(i=1),(e&M.PdfAnnotationFlag.print)!==M.PdfAnnotationFlag.print&&(i&=2),i){case 0:t=M.PdfFormFieldVisibility.hidden;break;case 1:t=M.PdfFormFieldVisibility.hiddenPrintable;break;case 2:t=M.PdfFormFieldVisibility.visibleNotPrintable;break;case 3:t=M.PdfFormFieldVisibility.visible}}else t=M.PdfFormFieldVisibility.visibleNotPrintable;return t},set:function(t){if(this._isLoaded)Oa(this._dictionary,t),this._dictionary._updated=!0;else{switch(t){case M.PdfFormFieldVisibility.hidden:this.flags=M.PdfAnnotationFlag.hidden;break;case M.PdfFormFieldVisibility.hiddenPrintable:this.flags=M.PdfAnnotationFlag.noView|M.PdfAnnotationFlag.print;break;case M.PdfFormFieldVisibility.visible:this.flags=M.PdfAnnotationFlag.print;break;case M.PdfFormFieldVisibility.visibleNotPrintable:this.flags=M.PdfAnnotationFlag.default}this._visibility=t}},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"font",{get:function(){var e=this;if(!this._pdfFont){var t=void 0;if(this._crossReference){var i,n,r=this._crossReference._document.form,s=this._obtainFontDetails(),a=s.name+"_"+s.size+"_"+s.style;if(r&&r._fontCache.has(a))return r._fontCache.get(a);r&&r._dictionary.has("DR")&&(i=r._dictionary.get("DR")).has("Font")&&(i=i.get("Font")).has(s.name)&&(i=i.get(s.name))&&s.name&&i.has("BaseFont")&&(i=i.get("BaseFont"),n=M.PdfFontStyle.regular,i)&&(t=i.name,n=Ja(i.name),t.includes("-")&&(t=t.substring(0,t.indexOf("-"))),this._dictionary.has("DA")?this._pdfFont=qa(r,this):this._pdfFont=Ya(t,s.size,n,this),r._fontCache.has(a)||r._fontCache.set(a,this._pdfFont)),null!=r&&(null===this._pdfFont||void 0===this._pdfFont)&&r._parsedFields&&0<r._parsedFields.size&&(r._parsedFields.forEach(function(t){t instanceof Ue&&0<t._kidsCount&&(e._pdfFont=qa(r,e,t))}),r._fontCache.has(a)||r._fontCache.set(a,this._pdfFont))}}return null!==this._pdfFont&&void 0!==this._pdfFont&&(this._isLoaded||1!==this._pdfFont.size)||(this._pdfFont=this._circleCaptionFont),this._pdfFont},set:function(t){t&&t instanceof ce&&(this._pdfFont=t,this._initializeFont(t))},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"_defaultAppearance",{get:function(){var t;return void 0===this._da&&this._dictionary.has("DA")&&(t=this._dictionary.get("DA"))&&""!==t&&(this._da=new di(t)),this._da},enumerable:!0,configurable:!0}),Object.defineProperty(Vn.prototype,"_mkDictionary",{get:function(){var t;return t=this._dictionary.has("MK")?this._dictionary.get("MK"):t},enumerable:!0,configurable:!0}),Vn.prototype._create=function(t,e,i){return this._page=t,this._crossReference=t._crossReference,this._ref=this._crossReference._getNextReference(),this._dictionary=new D(this._crossReference),this._crossReference._cacheMap.set(this._ref,this._dictionary),(this._dictionary._currentObj=this)._dictionary.objId=this._ref.toString(),this._dictionary.update("Type",R.get("Annot")),this._dictionary.update("Subtype",R.get("Widget")),this.flags|=M.PdfAnnotationFlag.print,this._dictionary.update("P",t._ref),t._addWidget(this._ref),this.border=new nr,e&&(this.bounds=e),i&&(this._field=i,this._dictionary.update("Parent",this._field._ref)),this._dictionary},Vn.prototype._doPostProcess=function(t,e){var i,n,r,s;void 0===e&&(e=!1),((t=void 0===t?!1:t)||e)&&(i=void 0,e||t&&this._dictionary.has("AP"),!i&&this._dictionary.has("AP")&&(e=this._dictionary.get("AP"))&&e.has("N")&&(i=e.get("N"),s=e.getRaw("N"))&&i&&(i.reference=s),i&&(e=void 0,t?(t=new P(i,this._crossReference),(r=this._getPage())&&((n=r.graphics).save(),r.rotation===M.PdfRotationAngle.angle90?(n.translateTransform({x:n._size.width,y:n._size.height}),n.rotateTransform(90)):r.rotation===M.PdfRotationAngle.angle180?(n.translateTransform({x:n._size.width,y:n._size.height}),n.rotateTransform(-180)):r.rotation===M.PdfRotationAngle.angle270&&(n.translateTransform({x:n._size.width,y:n._size.height}),n.rotateTransform(270)),e={x:this.bounds.x,y:this.bounds.y,width:t._size.width,height:t._size.height},n.drawTemplate(t,e),n.restore())):(r=void 0,this._dictionary.has("AP")?r=this._dictionary.get("AP"):(t=this._crossReference._getNextReference(),r=new D(this._crossReference),this._crossReference._cacheMap.set(t,r),this._dictionary.update("AP",t)),T(r,this._crossReference,"N"),s=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(s,i),r.update("N",s))),this._dictionary._updated=!1)},Vn.prototype._initializeFont=function(t){var e,i,n,r,s,a;this._pdfFont=t,this._crossReference&&(n=i=void 0,r=!1,(i=(e=this._crossReference._document)?e.form._dictionary.has("DR")?e.form._dictionary.get("DR"):new D(this._crossReference):i).has("Font")&&((s=i.getRaw("Font"))&&s instanceof m?(r=!0,n=this._crossReference._fetch(s)):s instanceof D&&(n=s)),n||(n=new D(this._crossReference),i.update("Font",n)),s=R.get(ia()),a=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(a,this._pdfFont._dictionary),t instanceof ye?this._pdfFont._pdfFontInternals&&this._crossReference._cacheMap.set(a,this._pdfFont._pdfFontInternals):this._pdfFont._dictionary&&this._crossReference._cacheMap.set(a,this._pdfFont._dictionary),n.update(s.name,a),i._updated=!0,e.form._dictionary.update("DR",i),e.form._dictionary._updated=!0,this._fontName=s.name,(t=new di).fontName=this._fontName,t.fontSize=this._pdfFont._size,t.color=this.color||{r:0,g:0,b:0},this._dictionary.update("DA",t.toString()),r&&(i._updated=!0),this._isFont=!0)},Vn.prototype._getPage=function(){if(!this._page){this._crossReference&&(t=this._crossReference._document);var t,e=void 0;if(this._dictionary.has("P")){var i=this._dictionary.getRaw("P");if(i&&t)for(var n=0;n<t.pageCount;n++){var r=t.getPage(n);if(r&&r._ref===i){e=r;break}}}!e&&t&&this._ref&&(e=ha(t,this._ref)),this._page=e}return this._page},Vn.prototype._beginSave=function(){var t;this._isLoaded||this._page._isNew||(t=this._bounds,this._dictionary.update("Rect",Es([t.x,t.y,t.width,t.height],this._page)))},Vn.prototype._parseBackColor=function(){var t;return(this._isLoaded&&this._hasBackColor||!this._isLoaded&&!this._isTransparentBackColor)&&(void 0===this._backColor&&(t=this._mkDictionary)&&t.has("BG")&&(t=t.getArray("BG"))&&(this._backColor=qs(t)),void 0!==this._backColor&&null!==this._backColor||(this._backColor={r:255,g:255,b:255}),t=this._backColor),t},Vn.prototype._parseBorderColor=function(){var t;return(this._isLoaded&&this._hasBorderColor||!this._isLoaded&&!this._isTransparentBorderColor)&&(void 0===this._borderColor&&(t=this._mkDictionary)&&t.has("BC")&&(t=t.getArray("BC"))&&(this._borderColor=qs(t)),void 0!==this._borderColor&&null!==this._borderColor||(this._borderColor={r:0,g:0,b:0}),t=this._borderColor),t},Vn.prototype._updateBackColor=function(t,e){void 0===e&&(e=!1);var i,n=!1;t&&t.isTransparent?(this._isTransparentBackColor=!0,this._dictionary.has("BG")&&(delete this._dictionary._map.BG,n=!0),(i=this._mkDictionary)&&i.has("BG")&&(delete i._map.BG,n=this._dictionary._updated=!0)):(this._isTransparentBackColor=!1,i=(i=void 0)&&{r:this._backColor.r,g:this._backColor.g,b:this._backColor.b},void 0!==this.backColor&&i===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new D(this._crossReference)),this._mkDictionary.update("BG",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._backColor=t,n=this._dictionary._updated=!0)),e&&n&&this._field&&(this._field._setAppearance=!0)},Vn.prototype._updateBorderColor=function(t){var e;t&&t.isTransparent?(this._isTransparentBorderColor=!0,this._dictionary.has("BC")&&delete this._dictionary._map.BC,(e=this._mkDictionary)&&e.has("BC")&&(delete e._map.BC,this._dictionary.has("BS")&&(e=this._dictionary.get("BS"))&&e.has("W")&&delete e._map.W,this._dictionary._updated=!0)):(this._isTransparentBorderColor=!1,e=void 0,this.borderColor&&(e=this.borderColor),void 0!==this.borderColor&&e===t||(void 0===this._mkDictionary&&this._dictionary.update("MK",new D(this._crossReference)),this._mkDictionary.update("BC",[Number.parseFloat((t.r/255).toFixed(3)),Number.parseFloat((t.g/255).toFixed(3)),Number.parseFloat((t.b/255).toFixed(3))]),this._borderColor=t,this._dictionary._updated=!0))};var Nn,jn=Vn;function Vn(){var t=Nn.call(this)||this;return t._isAutoResize=!1,t._visibility=M.PdfFormFieldVisibility.visible,t._isFont=!1,t._isTransparentBackColor=!1,t._isTransparentBorderColor=!1,t._isWidget=!0,t._type=M._PdfAnnotationType.widgetAnnotation,t}t(Hn,zn=jn),Hn._load=function(t,e,i){var n=new Hn;return n._isLoaded=!0,n._dictionary=t,n._crossReference=e,n._field=i,n},Object.defineProperty(Hn.prototype,"checked",{get:function(){return ca(this._dictionary)},set:function(t){this.checked!==t&&(this._field&&(this._setCheckedStatus(t),this._field._setAppearance=!0),this._exportValue?this._dictionary.update("AS",R.get(t?this._exportValue:"Off")):this._field&&null!==this._field._exportValue&&void 0!==this._field._exportValue?this._dictionary.update("AS",R.get(t?this._field._exportValue:"Off")):this._dictionary.update("AS",R.get(t?"Yes":"Off")))},enumerable:!0,configurable:!0}),Object.defineProperty(Hn.prototype,"style",{get:function(){var t;return this._isLoaded&&((t=this._mkDictionary)&&t.has("CA")?this._style=ya(t.get("CA")):this._style=M.PdfCheckBoxStyle.check),this._style},set:function(t){var e;this.style!==t&&(this._style=t,(e=this._mkDictionary)||(e=new D(this._crossReference),this._dictionary.update("MK",e)),e.update("CA",ga(t)))},enumerable:!0,configurable:!0}),Object.defineProperty(Hn.prototype,"exportValue",{get:function(){return this._tryGetExportValue(this)},set:function(t){var e,i,n,r;""!==t&&(this._exportValue=t),this.checked?(this._dictionary.update("AS",R.get(t)),this._setCheckedStatus(this.checked)):this._dictionary.update("AS",R.get("Off")),this._dictionary.has("AP")&&((e=this._dictionary.get("AP")).has("N")||e.has("D"))&&(i=this._tryGetExportValue(this),t=t,e.has("N")&&(n=e.get("N"))&&n.has(i)&&(r=n.getRaw(i),delete n._map[i],n.update(t,r),n._updated=!0),e.has("D"))&&(n=e.get("D"))&&n.has(i)&&(r=n.getRaw(i),delete n._map[i],n.update(t,r),n._updated=!0),this._dictionary._updated=!0},enumerable:!0,configurable:!0}),Hn.prototype._setCheckedStatus=function(t){var e=t,i=this._tryGetExportValue(this);this._unCheckOthers(this,i,t),e?(i?this._exportValue=i:i="Yes",this._field._dictionary.update("V",R.get(i)),this._field._dictionary.update("AS",R.get(i)),this._dictionary.update("AS",R.get(i)),this._dictionary.update("V",R.get(i))):this._field._dictionary&&(this._field._dictionary.has("V")&&(t=this._field._dictionary.get("V"))&&t.name===i&&delete this._field._dictionary._map.V,this._field._dictionary.update("AS",R.get("Off")))},Hn.prototype._unCheckOthers=function(t,e,i){if(!this._field._isUpdating){this._field._isUpdating=!0;for(var n=this._field.itemsCount,r=0;r<n;++r){var s,a=this._field.itemAt(r);a&&(a!==t?(s=this._tryGetExportValue(a),a.checked=s===e&&i):a.checked||(a.checked=!0))}}},Hn.prototype._tryGetExportValue=function(t){var e=t._exportValue;if(t._dictionary&&t._dictionary.has("AP")){var i=t._dictionary.get("AP");if(i&&i.has("N")){var i=i.get("N"),n=[];if(i.forEach(function(t,e){n.push(t)}),0<n.length)for(var r=0;r<n.length;r++){var s=n[r];if(s&&"Off"!==s){e=s;break}}}}else t._dictionary&&t._dictionary.has("AS")&&(i=t._dictionary.get("AS"))&&"Off"!==i.name&&(e=i.name);return e},Hn.prototype._doPostProcess=function(){var t,e,i=da(this.checked?M._PdfCheckFieldState.checked:M._PdfCheckFieldState.unchecked,this);i&&(t=this._getPage())&&((e=t.graphics).save(),t.rotation===M.PdfRotationAngle.angle90?(e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(90)):t.rotation===M.PdfRotationAngle.angle180?(e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(-180)):t.rotation===M.PdfRotationAngle.angle270&&(e.translateTransform({x:e._size.width,y:e._size.height}),e.rotateTransform(270)),e._sw._setTextRenderingMode(M._TextRenderingMode.fill),e.drawTemplate(i,this.bounds),e.restore()),this._dictionary._updated=!1},Hn.prototype._postProcess=function(t){var e=this._field;t=t||(e&&e.checked?"Yes":"Off"),this._dictionary.update("AS",R.get(t))},Hn.prototype._setField=function(t){this._field=t,this._field._stringFormat=new I(this.textAlignment,M.PdfVerticalAlignment.middle),this._field._addToKid(this)};var zn,Un=Hn;function Hn(){var t=zn.call(this)||this;return t._exportValue="Yes",t}t(Gn,Wn=Un),Gn._load=function(t,e,i){var n=new Gn;return n._isLoaded=!0,n._dictionary=t,n._crossReference=e,n._field=i,n},Object.defineProperty(Gn.prototype,"selected",{get:function(){return this._index===this._field.selectedIndex},enumerable:!0,configurable:!0}),Object.defineProperty(Gn.prototype,"value",{get:function(){return this._isLoaded&&!this._optionValue&&(this._optionValue=_a(this._dictionary)),this._optionValue},set:function(t){this._optionValue=t},enumerable:!0,configurable:!0}),Object.defineProperty(Gn.prototype,"backColor",{get:function(){return this._parseBackColor()},set:function(t){this._updateBackColor(t,!0)},enumerable:!0,configurable:!0}),Gn.prototype._initializeItem=function(t,e,i,n){this._optionValue=t,this._page=i,this._create(this._page,e,this._field),this.textAlignment=M.PdfTextAlignment.left,this._dictionary.update("MK",new D(this._crossReference)),this._mkDictionary.update("BC",[0,0,0]),this._mkDictionary.update("BG",[1,1,1]),this.style=M.PdfCheckBoxStyle.circle,this._dictionary.update("DA","/TiRo 0 Tf 0 0 0 rg"),n&&(this._setField(n),this._dictionary.update("Parent",n._ref))},Gn.prototype._postProcess=function(t){this._field&&(this.value===t||this._index.toString()===t?this._dictionary.update("AS",R.get(t)):this._dictionary.update("AS",R.get("Off")))};var Wn,qn=Gn;function Gn(t,e,i){var n=Wn.call(this)||this;return i&&t&&e&&(i instanceof Ve?n._initializeItem(t,e,i.page,i):n._initializeItem(t,e,i)),n}t(Jn,Kn=Un),Jn._load=function(t,e,i){var n=new Jn;return n._isLoaded=!0,n._dictionary=t,n._crossReference=e,n._field=i,n},Object.defineProperty(Jn.prototype,"text",{get:function(){return void 0===this._text&&void 0!==this._field&&(this._field instanceof ai||this._field instanceof ni)&&(this._text=this._field._options[this._index][1]),this._text},set:function(t){"string"==typeof t&&void 0!==this._field&&(this._field instanceof ai||this._field instanceof ni)&&t!==this._field._options[this._index][1]&&(this._field._options[this._index][1]=t,this._text=t,this._field._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(Jn.prototype,"selected",{get:function(){return this._index===this._field.selectedIndex},enumerable:!0,configurable:!0}),Jn.prototype._initializeItem=function(t,e,i){this._text=t,this._value=e,i&&i instanceof ai&&i._addToOptions(this,i)};var Kn,Xn=Jn;function Jn(t,e,i){var n=Kn.call(this)||this;return t&&e&&n._initializeItem(t,e,i),n}Object.defineProperty(Qn.prototype,"cap",{get:function(){return this._cap},set:function(t){t!==this._cap&&(this._cap=t,this._dictionary)&&this._dictionary.update("Cap",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Qn.prototype,"type",{get:function(){return this._type},set:function(t){t!==this._type&&(this._type=t,this._dictionary)&&this._dictionary.update("CP",R.get(t===M.PdfLineCaptionType.top?"Top":"Inline"))},enumerable:!0,configurable:!0}),Object.defineProperty(Qn.prototype,"offset",{get:function(){return this._offset},set:function(t){t&&!this._offset?(this._offset=t,this._dictionary.update("CO",[t.x,t.y])):t&&this._offset&&(t.x!==this._offset.x||t.y!==this._offset.y)&&(this._offset=t,this._dictionary)&&this._dictionary.update("CO",[t.x,t.y])},enumerable:!0,configurable:!0});var Yn=Qn;function Qn(t){t&&"cap"in t&&null!==t.cap&&"boolean"==typeof t.cap?this._cap=t.cap:this._cap=!1,t&&"type"in t&&null!==t.type&&void 0!==t.type?this._type=t.type:this._type=M.PdfLineCaptionType.inline,t&&"offset"in t&&null!==t.offset&&void 0!==t.offset?this._offset=t.offset:this._offset={x:0,y:0}}Object.defineProperty($n.prototype,"begin",{get:function(){return this._begin},set:function(t){t!==this._begin&&(this._begin=t,this._dictionary)&&this._dictionary.update("LE",[R.get(Xs(t)),R.get(Xs(this._end))])},enumerable:!0,configurable:!0}),Object.defineProperty($n.prototype,"end",{get:function(){return this._end},set:function(t){t!==this._end&&(this._end=t,this._dictionary)&&this._dictionary.update("LE",[R.get(Xs(this._begin)),R.get(Xs(t))])},enumerable:!0,configurable:!0});var Zn=$n;function $n(t){t&&"begin"in t&&null!==t.begin&&void 0!==t.begin?this._begin=t.begin:this._begin=M.PdfLineEndingStyle.none,t&&"end"in t&&null!==t.end&&void 0!==t.end?this._end=t.end:this._begin=M.PdfLineEndingStyle.none}Object.defineProperty(er.prototype,"width",{get:function(){return this._width},set:function(t){t!==this._width&&(this._width=t,this._dictionary)&&((t=this._dictionary.has("BS")?this._dictionary.get("BS"):new D(this._crossReference)).update("Type",R.get("Border")),t.update("W",this._width),t.update("S",Gs(this._style)),this._dash&&t.update("D",this._dash),this._dictionary.update("BS",t),this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(er.prototype,"style",{get:function(){return this._style},set:function(t){t!==this._style&&(this._style=t,(Array.isArray(this._dash)&&0===this._dash.length||!this._dash)&&(t===M.PdfBorderStyle.dot?this._dash=[1,1]:t===M.PdfBorderStyle.dashed&&(this._dash=[3,1])),this._dictionary)&&((t=this._dictionary.has("BS")?this._dictionary.get("BS"):new D(this._crossReference)).update("Type",R.get("Border")),t.update("W",this._width),t.update("S",Gs(this._style)),this._dash&&t.update("D",this._dash),this._dictionary.update("BS",t),this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(er.prototype,"dash",{get:function(){return this._dash},set:function(t){(void 0===this._dash||bs(t,this._dash))&&(this._dash=t,this._dictionary)&&((t=this._dictionary.has("BS")?this._dictionary.get("BS"):new D(this._crossReference)).update("Type",R.get("Border")),t.update("W",this._width),t.update("S",Gs(this._style)),t.update("D",this._dash),this._dictionary.update("BS",t),this._dictionary._updated=!0)},enumerable:!0,configurable:!0});var tr=er;function er(t){t&&"width"in t&&null!==t.width&&void 0!==t.width?this._width=t.width:this._width=1,t&&"style"in t&&null!==t.style&&void 0!==t.style?this._style=t.style:this._style=M.PdfBorderStyle.solid,t&&"dash"in t&&null!==t.dash&&Array.isArray(t.dash)&&(this._dash=t.dash)}t(rr,ir=tr),Object.defineProperty(rr.prototype,"width",{get:function(){return this._width},set:function(t){t!==this._width&&(this._width=t,this._dictionary)&&(this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width]),(t=this._dictionary.has("BS")?this._dictionary.get("BS"):new D(this._crossReference)).update("Type",R.get("Border")),t.update("W",this._width),t.update("S",Gs(this._style)),this._dash&&t.update("D",this._dash),this._dictionary.update("BS",t),this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"hRadius",{get:function(){return this._hRadius},set:function(t){t!==this._hRadius&&(this._hRadius=t,this._dictionary)&&this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width])},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"vRadius",{get:function(){return this._vRadius},set:function(t){t!==this._vRadius&&(this._vRadius=t,this._dictionary)&&this._dictionary.update("Border",[this._hRadius,this._vRadius,this._width])},enumerable:!0,configurable:!0});var ir,nr=rr;function rr(t){var e=ir.call(this,t)||this;return null!=t&&(t&&"hRadius"in t&&null!==t.hRadius&&void 0!==t.hRadius?e._hRadius=t.hRadius:e._hRadius=0,t&&"vRadius"in t&&null!==t.vRadius&&void 0!==t.vRadius?e._vRadius=t.vRadius:e._vRadius=0),e}Object.defineProperty(ar.prototype,"intensity",{get:function(){return this._intensity},set:function(t){t!==this._intensity&&(this._intensity=t,this._dictionary&&((t=this._dictionary.has("BE")?this._dictionary.get("BE"):new D(this._crossReference)).update("I",this._intensity),t.update("S",this._styleToEffect(this._style)),this._dictionary.update("BE",t),this._dictionary._updated=!0),this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(ar.prototype,"style",{get:function(){return this._style},set:function(t){t!==this._style&&(this._style=t,this._dictionary)&&((t=this._dictionary.has("BE")?this._dictionary.get("BE"):new D(this._crossReference)).update("I",this._intensity),t.update("S",this._styleToEffect(this._style)),this._dictionary.update("BE",t),this._dictionary._updated=!0)},enumerable:!0,configurable:!0}),ar.prototype._getBorderEffect=function(t){return"/C"===t?M.PdfBorderEffectStyle.cloudy:M.PdfBorderEffectStyle.solid},ar.prototype._styleToEffect=function(t){return t===M.PdfBorderEffectStyle.cloudy?"C":"S"};var sr=ar;function ar(t){var e;this._intensity=0,null!=t?t instanceof D?t.has("BE")&&(e=this._dictionary.get("BE"))&&(e.has("I")&&(this._intensity=e.get("I")),e.has("S"))&&(this._style=this._getBorderEffect(e.get("S"))):("intensity"in t&&null!==t.intensity&&void 0!==t.intensity&&(this._intensity=t.intensity),"style"in t&&null!==t.style&&void 0!==t.style&&(this._style=t.style),this._dictionary=new D,this._dictionary.set("I",this._intensity),this._dictionary.set("S",this._styleToEffect(this._style))):(this._dictionary=new D,this._dictionary.set("I",this._intensity),this._dictionary.set("S",this._styleToEffect(this._style)))}var or=function(){this.borderWidth=1},hr=function(){this.startAngle=0,this.endAngle=0},cr=(Object.defineProperty(_r.prototype,"count",{get:function(){return this._annotations.length},enumerable:!0,configurable:!0}),_r.prototype.at=function(t){if(t<0||t>=this._annotations.length)throw Error("Index out of range.");var e;return this._parsedAnnotations.has(t)||(e=(e=this._annotations[t])&&e instanceof m?this._crossReference._fetch(e):e)&&e instanceof D&&(e=this._parseAnnotation(e,t))&&(e._ref=this._annotations[t],this._parsedAnnotations.set(t,e)),this._parsedAnnotations.get(t)},_r.prototype.add=function(t){var e,i=this;if(L.initializeTelemetryFeature("Annotation","PDFLibrary"),null==t)throw Error("annotation cannot be null or undefined");if(t instanceof Qi&&(t._isReview||t._isComment)&&t.bounds&&(t.bounds.y=-t.bounds.y,t.bounds.height=-t.bounds.height),t._isLoaded)throw Error("cannot add an existing annotation");t._initialize(this._page),void 0!==t._ref&&t._ref._isNew?e=t._ref:(e=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(e,t._dictionary),t._ref=e);var n,r=this._annotations.length,s=(this._annotations.push(e),this._parsedAnnotations.set(r,t),!1);return this._page&&this._page._pageDictionary.has("Annots")&&null!=(n=this._page._pageDictionary.get("Annots"))&&-1===n.indexOf(e)&&(n.push(e),this._page._pageDictionary.set("Annots",n),s=!0),s||this._page._pageDictionary.set("Annots",this._annotations),this._page._pageDictionary._updated=!0,t&&t instanceof vi&&this._addCommentsAndReview(t,t._dictionary.get("F")),this._updateCustomAppearanceResource(t),t._customTemplate&&0<t._customTemplate.size&&t._customTemplate.forEach(function(t,e){t._updatePendingResource(i._crossReference)}),r},_r.prototype.remove=function(t){t&&t._ref&&-1<(t=this._annotations.lastIndexOf(t._ref))&&this.removeAt(t)},_r.prototype.removeAt=function(t){if(t<0||t>=this._annotations.length)throw Error("Index out of range.");var e,i,n,r,s=this._annotations[t];s&&this._page&&(e=this._page._getProperty("Annots"),n=void 0,this._parsedAnnotations.has(t)?n=this._parsedAnnotations.get(t):(r=this._crossReference._fetch(s),(n=this._parseAnnotation(r))._ref=s),n&&(r=n.comments,i=n.reviewHistory,this._processAnnotations(r,e),this._processAnnotations(i,e),n._dictionary)&&n._dictionary.has("Popup")&&-1<(i=(r=n._dictionary.getRaw("Popup"))&&r instanceof m?e.indexOf(r):-1)&&e.splice(i,1),-1<(n=e.indexOf(s))&&e.splice(n,1),this._page._pageDictionary.set("Annots",e),this._page._pageDictionary._updated=!0,-1<this._annotations.indexOf(s)&&this._annotations.splice(t,1),this._parsedAnnotations.has(t)&&(this._parsedAnnotations.delete(t),this._reorderParsedAnnotations(t)),r=this._page._crossReference)&&r._cacheMap.has(s)&&r._cacheMap.delete(s)},_r.prototype._processReferences=function(t,n){var r=this;t.forEach(function(t){var e,i;t&&-1!==n.indexOf(t)&&(e=n.indexOf(t),n.splice(e,1),-1<(i=r._annotations.indexOf(t))&&r._annotations.splice(i,1),r._parsedAnnotations.has(e)&&(r._parsedAnnotations.delete(e),r._reorderParsedAnnotations(e)),i=r._page._crossReference)&&i._cacheMap.has(t)&&i._cacheMap.delete(t)})},_r.prototype._processAnnotations=function(t,i){var n=this;t&&0<t._collection.length&&t._collection.forEach(function(t){var e=[t._ref];t.reviewHistory&&0<t.reviewHistory._collection.length&&e.push.apply(e,t.reviewHistory._collection.map(function(t){return t._ref})),n._processReferences(e,i)})},_r.prototype._reorderParsedAnnotations=function(i){var n=new Map;this._parsedAnnotations.forEach(function(t,e){i<e?n.set(e-1,t):n.set(e,t)}),this._parsedAnnotations=n},_r.prototype._updateCustomAppearanceResource=function(t){t&&t instanceof An&&void 0!==t._appearance&&t._appearance.normal.graphics._processResources(t._crossReference)},_r.prototype._addCommentsAndReview=function(t,e){this._updateChildReference(t,t.comments,e),this._updateChildReference(t,t.reviewHistory,e)},_r.prototype._updateChildReference=function(i,n,t){var r=this;if(n&&0<n.count){if(30===t)throw new Error("Could not add comments/reviews to the review");n._collection.forEach(function(t,e){t&&!t._dictionary.has("IRT")&&(0!==e&&n._isReview?t._dictionary.update("IRT",n._collection[e-1]._ref):t._dictionary.update("IRT",i._ref),n._isReview?t._isReview=!0:t._isComment=!0,r.add(t))})}},_r.prototype._getAnnotations=function(){if(0===this._parsedAnnotations.size)for(var t=0;t<this._annotations.length;t++){var e,i=this._annotations[t];(i=i&&i instanceof m?this._crossReference._fetch(i):i)&&i instanceof D&&(e=this._isPopupWithExternalParent(i),(i=this._parseAnnotation(i,t))?(i._ref=this._annotations[t],this._parsedAnnotations.set(t,i)):e&&t--)}},_r.prototype._isPopupWithExternalParent=function(t){if(t&&t.has("Subtype")){var e=t.get("Subtype");if(e&&"Popup"===e.name&&t.has("Parent"))return!0}return!1},_r.prototype._parseAnnotation=function(t,e){if(t&&t.has("Subtype")&&null!==this._page&&void 0!==this._page){var i=t.get("Subtype"),n=t.get("Rect");if(i){var r,s,a,o=void 0;switch(i.name){case"Line":r=xi._load(this._page,t);break;case"Circle":r=(t.has("Measure")||n[2]-n[0]==n[3]-n[1]?Ci:Fi)._load(this._page,t);break;case"Square":r=(n&&4<=n.length&&n[2]===n[3]?Bi:Mi)._load(this._page,t);break;case"Polygon":r=ji._load(this._page,t);break;case"PolyLine":r=(r=t.has("Measure")&&t.has("IT")&&(s=t.get("IT"))&&"PolyLineAngle"===s.name?qi._load(this._page,t):r)||Ui._load(this._page,t);break;case"Ink":r=Xi._load(this._page,t);break;case"Popup":a=this._isPopupWithExternalParent(t),"number"==typeof e&&a?this._annotations.splice(e,1):r=Qi._load(this._page,t);break;case"Text":r=Qi._load(this._page,t);break;case"Link":(o=t.has("A")?t.get("A"):o)&&o.has("S")?(s=o.get("S").name)&&(a=this._hasValidBorder(t.getArray("Border")),"URI"===s?r=a?_n._load(this._page,t):this._getLinkAnnotation(t):"Launch"===s?r=tn._load(this._page,t):"GoToR"===s?r=this._getLinkAnnotation(t):"GoTo"===s&&(r=on._load(this._page,t))):"Link"===i.name&&(r=on._load(this._page,t));break;case"FileAttachment":r=un._load(this._page,t);break;case"3D":r=gn._load(this._page,t);break;case"FreeText":r=In._load(this._page,t);break;case"Redact":r=Bn._load(this._page,t);break;case"RichMedia":r=Mn._load(this._page,t);break;case"Watermark":r=Sn._load(this._page,t);break;case"Stamp":r=An._load(this._page,t);break;case"Sound":r=kn._load(this._page,t);break;case"Caret":case"Highlight":case"Squiggly":case"StrikeOut":case"Underline":r=bn._load(this._page,t)}}}return r},_r.prototype._getLinkAnnotation=function(t){var e,i,n;return this._page&&(t&&t.has("A")?(i=t.get("A"))&&i.has("S")&&((n=i.get("S"))&&"GoToR"===n.name&&i.has("F")?e=tn._load(this._page,t):n&&"URI"===n.name&&(e=rn._load(this._page,t))):e=rn._load(this._page,t)),e},_r.prototype._hasValidBorder=function(t){return null!=t&&!t.some(function(t){return null!=t&&0<t})},_r.prototype._doPostProcess=function(t){for(var e=0;e<this.count;){var i,n=this.at(e);n&&((i=n.flatten||t)&&!n.flatten&&(n.flatten=i),n._isExport=this._isExport,i&&-1===this._annotations.lastIndexOf(n._ref)&&e++,n._doPostProcess(i),i)||e++}},_r.prototype._reArrange=function(t,e,i){var n;return this._annotations&&(e>this._annotations.length&&(e=0),i>=this._annotations.length&&(i=this._annotations.indexOf(t)),n=this._crossReference._fetch(this._annotations[i]))&&n.has("Parent")&&((n=n.getRaw("Parent"))&&n===t||t===this._annotations[i])&&(n=this._annotations[i],this._annotations[i]=this._annotations[e],this._annotations[e]=n),this._annotations},_r.prototype._clear=function(){this._annotations=[],this._parsedAnnotations=new Map,this._comments=[]},_r);function _r(t,e,i){this._isExport=!1,k(t)?this._annotations=t:this._annotations=[],this._page=i,this._crossReference=e,this._parsedAnnotations=new Map,this._comments=[]}Object.defineProperty(lr.prototype,"count",{get:function(){return this._collection.length},enumerable:!0,configurable:!0}),lr.prototype.at=function(t){if(t<0||t>=this._collection.length)throw Error("Index out of range.");return this._collection[t]},lr.prototype.add=function(t){if(30===this._annotation._dictionary.get("F"))throw new Error("Could not add comments/reviews to the review");var e;t._dictionary.update("F",this._annotation.flags===M.PdfAnnotationFlag.locked?128:this._isReview?30:28),this._annotation&&(this._annotation._isLoaded||this._page&&this._annotation._ref)&&(this._page.annotations.add(t),0!==(e=this._collection.length)&&this._isReview?t._dictionary.update("IRT",this._collection[e-1]._ref):t._dictionary.update("IRT",this._annotation._ref),this._isReview?t._isReview=!0:t._isComment=!0),this._collection.push(t)},lr.prototype.remove=function(t){t=this._collection.indexOf(t);-1<t&&this.removeAt(t)},lr.prototype.removeAt=function(t){if(!(-1<t&&t<this._collection.length))throw new Error("Index out of range.");var e,i,n=this._collection[t];this._isReview&&t<this._collection.length-1&&(e=this._collection[t+1],i=n._dictionary._get("IRT"),e._dictionary.set("IRT",i),e._dictionary._updated=!0),this._collection.splice(t,1),this._page.annotations.remove(n)},lr.prototype._parseCommentsOrReview=function(){this._isReview?this._parseReview():this._parseComments()},lr.prototype._parseReview=function(){var t,i=this,n=(this._page&&(t=this._page.annotations),new Map);if(n.set(this._annotation._ref,this._annotation),t&&t._comments&&0<t._comments.length){var r=[];t._comments.forEach(function(t){var e=t._dictionary._get("IRT");t._isReview&&e&&n.has(e)?(i._collection.push(t),n.set(t._ref,t)):r.push(t)}),t._comments=0<r.length?r:[]}else if(t)for(var e=t.count,s=0;s<e;s++){var a,o=t.at(s);o&&o instanceof Qi&&(a=o._dictionary,o._dictionary.has("IRT"))&&(a=a._get("IRT"),o._isReview&&a&&n.has(a)?(this._collection.push(o),n.set(o._ref,o)):t._comments.push(o))}n.clear()},lr.prototype._parseComments=function(){var t,n=this;if((t=this._page?this._page.annotations:t)&&t._comments&&0<t._comments.length){var r=[];t._comments.forEach(function(t){var e=t._dictionary,i=Ba(e),e=e._get("IRT");(e&&e===n._annotation._ref&&!i?n._collection:r).push(t)}),t._comments=0<r.length?r:[]}else if(t)for(var e=t.count,i=0;i<e;i++){var s,a,o=t.at(i);o&&o instanceof Qi&&(a=o._dictionary,o._dictionary.has("IRT"))&&(s=Ba(a),((a=a._get("IRT"))&&a===this._annotation._ref&&!s?this._collection:t._comments).push(o))}};var dr=lr;function lr(t,e){this._collection=[],t&&(this._annotation=t),this._isReview=e,(t&&this._annotation._isLoaded||t._page)&&(this._page=t._page,this._parentDictionary=t._dictionary,this._annotation._isLoaded)&&this._parseCommentsOrReview()}Object.defineProperty(pr.prototype,"layout",{get:function(){return this._layout},set:function(t){this._layout=t},enumerable:!0,configurable:!0}),Object.defineProperty(pr.prototype,"break",{get:function(){return this._break},set:function(t){this._break=t},enumerable:!0,configurable:!0}),Object.defineProperty(pr.prototype,"paginateBounds",{get:function(){return this._paginateBounds},set:function(t){this._paginateBounds=t,this._boundSet=!0},enumerable:!0,configurable:!0}),Object.defineProperty(pr.prototype,"usePaginateBounds",{get:function(){return this._boundSet},enumerable:!0,configurable:!0}),Object.defineProperty(pr.prototype,"columns",{get:function(){return this._columns},set:function(t){this._columns=t},enumerable:!0,configurable:!0}),Object.defineProperty(pr.prototype,"columnGutter",{get:function(){return this._columnGutter},set:function(t){this._columnGutter=t},enumerable:!0,configurable:!0});var ur=pr;function pr(t){this._boundSet=!1,t?(this.break=t.break,this.layout=t.layout,this.paginateBounds=t.paginateBounds,this._boundSet=t._boundSet):(this.layout=M.PdfLayoutType.paginate,this.break=M.PdfLayoutBreakType.fitPage)}Object.defineProperty(gr.prototype,"Page",{get:function(){return this._page},enumerable:!0,configurable:!0}),Object.defineProperty(gr.prototype,"bounds",{get:function(){return this._bounds},enumerable:!0,configurable:!0}),Object.defineProperty(gr.prototype,"remainingText",{get:function(){return this._remainingText},enumerable:!0,configurable:!0});var fr=gr;function gr(t,e,i,n){this._hasRenderedContent=!1,this._page=t,this._bounds=e,this._lastLineBounds=i||e,"undefined"!==n&&null!==n&&(this._remainingText=n)}var yr=function(){this.markerWrote=!1,this.markerWidth=0,this.markerX=0},mr=function(){},br=(Object.defineProperty(wr.prototype,"annotations",{get:function(){var t,e,i;return void 0===this._annotations&&(this._pageDictionary&&this._pageDictionary.has("Annots")&&k(t=this._getProperty("Annots"))&&Array.isArray(t)&&((e=this._crossReference._document._catalog._catalogDictionary.has("AcroForm")?this._crossReference._document.form._parseWidgetReferences():e)&&0<e.length?(i=[],t.forEach(function(t){-1===e.indexOf(t)&&i.push(t)}),this._annotations=new cr(i,this._crossReference,this)):this._annotations=new cr(t,this._crossReference,this)),void 0===this._annotations&&(this._annotations=new cr([],this._crossReference,this)),this._annotations._getAnnotations()),this._annotations},enumerable:!0,configurable:!0}),Object.defineProperty(wr.prototype,"size",{get:function(){var t,e,i,n,r;return void 0!==this._size&&void 0!==this._size.width&&void 0!==this._size.height||(r=Ds(this._pageDictionary,"MediaBox",!1,!0,"Parent","P"),n=Ds(this._pageDictionary,"CropBox",!1,!0,"Parent","P"),i=e=0,t=this._pageDictionary&&this._pageDictionary.has("Rotate")?Ds(this._pageDictionary,"Rotate",!1,!0,"Parent"):0,n=this._parseBoxValues(n,"CropBox"),r=this._parseBoxValues(r,"MediaBox"),n&&null!=t?(e=n[2]-n[0],i=n[3]-n[1],n=!(r&&r[2]-r[0]<e),(0===t||180===t)&&e<i||(90===t||270===t)&&i<e||n||0!==t||!r||(e=r[2]-r[0],i=0!==r[3]?r[3]-r[1]:r[1])):i=r?(e=r[2]-r[0],0!==r[3]?r[3]-r[1]:r[1]):(this._pageDictionary.update("MediaBox",[0,0,612,792]),e=612,792),this._size={width:Math.abs(e),height:Math.abs(i)}),this._size},enumerable:!0,configurable:!0}),Object.defineProperty(wr.prototype,"rotation",{get:function(){var t=0;return void 0===this._rotation&&((t=Ds(this._pageDictionary,"Rotate",!1,!0,"Parent"))<0&&(t+=360),this._rotation=void 0!==t?t/90%4:M.PdfRotationAngle.angle0),this._rotation},set:function(t){this._isNew||(this._rotation=t,360<=(t=90*Math.floor(this._rotation))&&(t%=360),this._pageDictionary.update("Rotate",t))},enumerable:!0,configurable:!0}),Object.defineProperty(wr.prototype,"tabOrder",{get:function(){return this._obtainTabOrder()},set:function(t){this._tabOrder=t;t="";this._tabOrder!==M.PdfFormFieldsTabOrder.none&&(this._tabOrder===M.PdfFormFieldsTabOrder.row?t="R":this._tabOrder===M.PdfFormFieldsTabOrder.column?t="C":this._tabOrder===M.PdfFormFieldsTabOrder.structure&&(t="S")),this._pageDictionary.update("Tabs",R.get(t))},enumerable:!0,configurable:!0}),Object.defineProperty(wr.prototype,"cropBox",{get:function(){return void 0===this._cBox&&(this._cBox=Ds(this._pageDictionary,"CropBox",!1,!0,"Parent","P")),void 0===this._cBox&&(this._cBox=[0,0,0,0]),this._cBox},enumerable:!0,configurable:!0}),Object.defineProperty(wr.prototype,"mediaBox",{get:function(){return void 0===this._mBox&&(this._mBox=Ds(this._pageDictionary,"MediaBox",!1,!0,"Parent","P")),void 0===this._mBox&&(this._mBox=[0,0,0,0]),this._mBox},enumerable:!0,configurable:!0}),Object.defineProperty(wr.prototype,"orientation",{get:function(){var t;return void 0===this._orientation&&void 0!==this.size&&((t=this.size).width>t.height?this._orientation=M.PdfPageOrientation.landscape:this._orientation=M.PdfPageOrientation.portrait),this._orientation},enumerable:!0,configurable:!0}),Object.defineProperty(wr.prototype,"_origin",{get:function(){return(void 0===this._o||0===this._o[0]&&0===this._o[1])&&(this._o=[this.mediaBox[0],this._mBox[1]]),this._o},enumerable:!0,configurable:!0}),Object.defineProperty(wr.prototype,"graphics",{get:function(){return void 0===this._g||this._needInitializeGraphics?this._parseGraphics():this._crossReference&&this._crossReference._document&&this._crossReference._document._hasTemplateContentValue&&!this._templatesRendered&&!this._crossReference._document._templateRenderingStarted&&(this._accessedBeforeTemplate=!0),this._g},enumerable:!0,configurable:!0}),wr.prototype.drawTextElement=function(t,e){if(null==t)throw new Error("PdfTextElement cannot be null or undefined");if("string"!=typeof t.text||0===t.text.length)throw new Error("PdfTextElement.text must be a non-empty string");if(void 0===t.font||null===t.font)throw new Error("PdfTextElement.font is required");var i,n,r;if(void 0===t.layoutFormat||null===t.layoutFormat||t.layoutFormat instanceof ur)return e=this.graphics._isRectangle(e)?{x:e.x,y:e.y,width:e.width,height:e.height}:{x:e.x,y:e.y,width:0,height:0},i=t.brush||new A({r:0,g:0,b:0}),t.layoutFormat||"number"==typeof e.width&&"number"==typeof e.height&&(0<e.width||0<e.height)?(n=new mr,r=this._getActualBounds(this._pageSettings),e.y<0&&(e.y=0),0===e.height?e.height=r[3]-e.y:(r=r[3]-e.y,e.height>r&&(e.height=r)),n._page=this,n._bounds=[e.x,e.y,e.width,e.height],n._format=t.layoutFormat||new ur,n._graphics=this.graphics,this._layoutTextElement(n,t)):(this.graphics.drawString(t.text,t.font,e,t.pen,i,t.stringFormat),new fr(this,e));throw new Error("PdfTextElement.layoutFormat must be an instance of PdfLayoutFormat")},wr.prototype._addWidget=function(t){var e,i;this._pageDictionary.has("Annots")&&(e=this._pageDictionary.getRaw("Annots"),i=this._getProperty("Annots"),e)&&e instanceof m&&(delete this._pageDictionary._map.Annots,this._pageDictionary.update("Annots",i)),i&&Array.isArray(i)?i.push(t):this._pageDictionary.update("Annots",[t]),this._pageDictionary._updated=!0},wr.prototype._getProperty=function(t,e){t=Ds(this._pageDictionary,t,e=void 0===e?!1:e,!1);return Array.isArray(t)?1!==t.length&&t[0]instanceof D?D.merge(this._crossReference,t):t[0]:t},wr.prototype._parseGraphics=function(){this._loadContents();var t=new Sh([32,113,32,10]),e=this._crossReference._getNextReference(),t=(this._crossReference._cacheMap.set(e,t),this._contents.splice(0,0,e),new Sh([32,81,32,10])),e=this._crossReference._getNextReference(),t=(this._crossReference._cacheMap.set(e,t),this._contents.push(e),new Sh([])),e=this._crossReference._getNextReference();this._crossReference._cacheMap.set(e,t),this._contents.push(e),this._pageDictionary.set("Contents",this._contents),this._pageDictionary._updated=!0,this._initializeGraphics(t)},wr.prototype._loadContents=function(){var t,e=this._pageDictionary.getRaw("Contents");null!=e&&e instanceof m&&(t=e,e=this._crossReference._fetch(t)),e&&e instanceof y?this._contents=[t]:e&&Array.isArray(e)?this._contents=e:this._contents=[]},wr.prototype._initializeGraphics=function(t){var e,i,n,r=!1,s=0,a=0,o=0,h=0,c=this.size,_=this.mediaBox,d=(_&&4<=_.length&&(s=_[0],a=_[1],o=_[2],h=_[3]),this._pageDictionary.has("CropBox")?(_=this.cropBox)&&4<=_.length?(n=_[0],d=_[1],e=_[2],i=_[3],(n<0||d<0||e<0||i<0)&&Math.floor(Math.abs(d))===Math.floor(Math.abs(c.height))&&Math.floor(Math.abs(n))===Math.floor(Math.abs(c.width))?this._g=new kr({width:Math.max(n,e),height:Math.max(d,i)},t,this._crossReference,this):(this._g=new kr(c,t,this._crossReference,this),this._g._cropBox=_)):this._g=new kr(c,t,this._crossReference,this):(s<0||a<0||o<0||h<0)&&Math.floor(Math.abs(a))===Math.floor(Math.abs(c.height))&&Math.floor(Math.abs(o))===Math.floor(Math.abs(c.width))?(n=Math.max(s,o),e=Math.max(a,h),(n<=0||e<=0)&&(r=!0,s<0&&(s=-s),a<0&&(a=-a),o<0&&(o=-o),h<0&&(h=-h),n=Math.max(s,o),e=Math.max(a,h)),this._g=new kr({width:n,height:e},t,this._crossReference,this)):this._g=new kr(c,t,this._crossReference,this),this._pageDictionary.has("MediaBox")&&(this._g._mediaBoxUpperRightBound=r?-a:h),this._graphicsState=this._g.save(),this._origin);0<=d[0]&&0<=d[1]||Math.sign(d[0])!==Math.sign(d[1])?this._g._initializeCoordinates():this._g._initializeCoordinates(this),this._isNew||(i=this.rotation,Number.isNaN(i))||i===M.PdfRotationAngle.angle0&&!this._pageDictionary.has("Rotate")||(_=void 0,_=this._pageDictionary.has("Rotate")?this._pageDictionary.get("Rotate"):90*i,s=this._g._clipBounds,90===_?(this._g.translateTransform({x:0,y:c.height}),this._g.rotateTransform(-90),this._g._clipBounds=[s[0],s[1],c.width,c.height]):180===_?(this._g.translateTransform({x:c.width,y:c.height}),this._g.rotateTransform(-180)):270===_&&(this._g.translateTransform({x:c.width,y:0}),this._g.rotateTransform(-270),this._g._clipBounds=[s[0],s[1],c.height,c.width])),this._isNew&&this._pageSettings&&!this._isLineAnnotation&&(o=this._getActualBounds(this._pageSettings),this._crossReference._document._hasTemplateContentValue?(n=[o[0],o[1],this._pageSettings.margins._left,this._pageSettings.margins._top,this._pageSettings.margins._right,this._pageSettings.margins._bottom],this._g._clipTranslateMarginsWithBounds(n)):this._g._clipTranslateMargins(o)),this._needInitializeGraphics=!1},wr.prototype._getActualBounds=function(t,e){var i=e?[t.size.width,t.size.height]:t._getActualSize(),e=this._getTemplateReservedSpace(e);return[t.margins.left+e[3],t.margins.top+e[0],i[0]-e[3]-e[1],i[1]-e[0]-e[2]]},wr.prototype._getActualTemplateBounds=function(t,e){t=t._getActualSize(),e=this._getTemplateReservedSpace(e);return[e[3],e[0],t[0]-e[3]-e[1],t[1]-e[0]-e[2]]},wr.prototype._getTemplateReservedSpace=function(t){t=!!t;return[this._crossReference._document._getTopIndentHeight(this,t),this._crossReference._document._getRightIndentWidth(this,t),this._crossReference._document._getBottomIndentHeight(this,t),this._crossReference._document._getLeftIndentWidth(this,t)]},wr.prototype._fetchResources=function(){var t;return void 0===this._resourceObject&&(this._pageDictionary&&this._pageDictionary.has("Resources")?null!=(t=this._pageDictionary.getRaw("Resources"))&&t instanceof m?(this._hasResourceReference=!0,this._resourceObject=this._crossReference._fetch(t)):t&&t instanceof D&&(this._resourceObject=t):(this._resourceObject=new D(this._crossReference),this._pageDictionary.update("Resources",this._resourceObject))),this._resourceObject},wr.prototype._getCropOrMediaBox=function(){var t;return this._pageDictionary&&(this._pageDictionary.has("CropBox")?t=this._pageDictionary.getArray("CropBox"):this._pageDictionary.has("MediaBox")&&(t=this._pageDictionary.getArray("MediaBox"))),t},wr.prototype._beginSave=function(){void 0!==this._graphicsState&&(this.graphics.restore(this._graphicsState),this._graphicsState=null,this._needInitializeGraphics=!0)},wr.prototype._destroy=function(){this._pageDictionary=void 0,this._size=void 0,this._mBox=void 0,this._cBox=void 0,this._o=void 0,this._g=void 0,this._graphicsState=void 0,this._contents=void 0},wr.prototype._obtainTabOrder=function(){var t;return this._pageDictionary&&this._pageDictionary.has("Tabs")&&((t=this._pageDictionary.get("Tabs"))===R.get("R")?this._tabOrder=M.PdfFormFieldsTabOrder.row:t===R.get("C")?this._tabOrder=M.PdfFormFieldsTabOrder.column:t===R.get("S")?this._tabOrder=M.PdfFormFieldsTabOrder.structure:t===R.get("W")&&(this._tabOrder=M.PdfFormFieldsTabOrder.widget)),null!==this._tabOrder&&void 0!==this._tabOrder||(this._tabOrder=M.PdfFormFieldsTabOrder.none),this._tabOrder},wr.prototype._removeAnnotation=function(e){var t;this._pageDictionary&&this._pageDictionary.has("Annots")&&k(t=this._getProperty("Annots"))&&Array.isArray(t)&&(t=t.filter(function(t){return t!==e}),this._pageDictionary.set("Annots",t),this._pageDictionary._updated=!0)},Object.defineProperty(wr.prototype,"_contentTemplate",{get:function(){this._fetchResources();var t=this._combineContent(),t=new Sh(Array.from(t)),t=new P(t,this._crossReference);return t._content.dictionary.set("Resources",this._resourceObject),0<this.cropBox[0]||0<this.cropBox[1]?(t._content.dictionary.set("BBox",this.cropBox),gs(this.cropBox,this.mediaBox)?t._size={width:this.cropBox[0],height:this.cropBox[1]}:t._size={width:this.cropBox[2],height:this.cropBox[3]}):0<this.mediaBox[0]||0<this.mediaBox[1]?(t._content.dictionary.set("BBox",this.mediaBox),t._size={width:this.mediaBox[0],height:this.mediaBox[1]}):(t._content.dictionary.set("BBox",[0,0,this.size.width,this.size.height]),t._size={width:this.size.width,height:this.size.height}),t},enumerable:!0,configurable:!0}),wr.prototype._combineIntoSingleArray=function(t){var e=t.reduce(function(t,e){return t+e.length},0),i=new Uint8Array(e),n=0;return t.forEach(function(t){i.set(t,n),n+=t.length}),i},wr.prototype._combineContent=function(){var e,i=this,n=[];return this._loadContents(),n.push(new Uint8Array([32,113,32,10])),this._contents.forEach(function(t){t=i._crossReference._fetch(t);t&&(t instanceof Sh?e=new Uint8Array(t._bytes):t instanceof y&&(e=t.getBytes()),e)&&(n.push(e),n.push(new Uint8Array([13,10])))}),n.push(new Uint8Array([32,81,32,10])),n.push(new Uint8Array([13,10])),this._combineIntoSingleArray(n)},wr.prototype._layoutTextElement=function(t,e){for(var i=t._format,n=e.text||"",r=t._page,s=t._bounds.slice(),a=i&&i.paginateBounds,o=i&&i.usePaginateBounds&&a,h=!0,c=!1;0<n.length;){var _,d=void 0,d=h?s.slice():o?[a.x,a.y,a.width,a.height]:[s[0],0,s[2],s[3]],l=n,n=(_=this._layoutOnPage(n,r,d,t,e)).remainingText||"";if(i.layout===M.PdfLayoutType.onePage&&i.break===M.PdfLayoutBreakType.fitElement)return _;if(i.break!==M.PdfLayoutBreakType.fitElement&&i.break!==M.PdfLayoutBreakType.fitPage||!h||n!==l){_._hasRenderedContent&&!h&&(c=!0);d=i.break;if(i.layout===M.PdfLayoutType.paginate&&d===M.PdfLayoutBreakType.fitElement&&c)return _;if(n===l)break;if(!n||0===n.length)break;if(i.layout===M.PdfLayoutType.onePage)break;d=r._crossReference._document;r=r._pageIndex+1<d.pageCount?d.getPage(r._pageIndex+1):d.addPage(),h=!1}else l=r._crossReference._document,r=r._pageIndex+1<l.pageCount?l.getPage(r._pageIndex+1):l.addPage(),h=!1}return _},wr.prototype._parseBoxValues=function(t,e){if(!Array.isArray(t)||4!==t.length)return t;for(var i=new Array(4),n=0;n<4;n++){var r=t[parseInt(n.toString(),10)];if(!(r instanceof m))return t;i[parseInt(n.toString(),10)]=Number(this._crossReference._fetch(r))}return this._pageDictionary.update(e,i),i},wr.prototype._layoutOnPage=function(t,e,i,n,r){for(var s=r.font,a=r.brush||new A({r:0,g:0,b:0}),o=n._format,h=r.stringFormat||new I,c=new vt,_=e.graphics.clientSize.height-i[1],d=o&&o._columns?Math.max(1,o._columns):1,l=o&&o._columnGutter?o._columnGutter:0,u=(i[2]-(d-1)*l)/d,p=t,f=0;f<d&&0<p.length;f++){if((w=c._layout(p,s,h,[u,_]))._empty)return new fr(e,{x:i[0],y:i[1],width:0,height:0},void 0,p);p=w._remainder||""}r=!p||0===p.length,n=e===n._page;if(o.break===M.PdfLayoutBreakType.fitElement&&n&&!r)return new fr(e,{x:i[0],y:i[1],width:0,height:0},void 0,t);for(var g=t,y={x:i[0],y:i[1],width:0,height:0},m=y,b=!1,f=0;f<d&&0<g.length;f++){var w,v=i[0]+f*(u+l),S=i[1];if((w=c._layout(g,s,h,[u,_]))._empty)return new fr(e,y,m,g);var P=w._remainder||"";if(P===g)break;var x=g.length-P.length,x=g.substring(0,x);e.graphics.drawString(x,s,{x:v,y:S,width:u,height:w._actualSize.height},a,h),b=!0,y={x:v,y:S,width:w._actualSize.width,height:w._actualSize.height},m={x:v,y:S+Math.max(0,w._actualSize.height-w._lineHeight),width:w._actualSize.width,height:w._lineHeight},g=P}o=new fr(e,y,m,g);return o._hasRenderedContent=b,o},wr.prototype._getSectionIndex=function(){var t=this._pageDictionary.getRaw("Parent");return t?this._crossReference._document._getSectionIndexByPage(t):-1},wr);function wr(t,e,i,n){this._isAnnotationParsed=!1,this._isNew=!1,this._isDuplicate=!1,this._isLineAnnotation=!1,this._accessedBeforeTemplate=!1,this._templatesRendered=!1,this._pageIndex=e,this._pageDictionary=i,this._crossReference=t,this._ref=n}Object.defineProperty(Sr.prototype,"zoom",{get:function(){return this._zoom},set:function(t){t!==this._zoom&&(this._zoom=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(Sr.prototype,"page",{get:function(){return this._page},set:function(t){t!==this._page&&(this._page=t,this._initializePrimitive(),this._index=t._pageIndex)},enumerable:!0,configurable:!0}),Object.defineProperty(Sr.prototype,"pageIndex",{get:function(){return this._index},enumerable:!0,configurable:!0}),Object.defineProperty(Sr.prototype,"mode",{get:function(){return this._destinationMode},set:function(t){t!==this._destinationMode&&(this._destinationMode=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(Sr.prototype,"location",{get:function(){return this._location},set:function(t){t!==this._location&&(this._location=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(Sr.prototype,"destinationBounds",{get:function(){return this._destinationBounds},set:function(t){t!==this._destinationBounds&&(this._destinationBounds=t,this._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(Sr.prototype,"isValid",{get:function(){return this._isValid},enumerable:!0,configurable:!0}),Sr.prototype._setValidation=function(t){this._isValid=t},Sr.prototype._initializePrimitive=function(){this._array=[];var t=this._page;if(t&&t._pageDictionary){var e=t._pageDictionary;switch(null!=e&&this._array.push(this._page._ref),this._destinationMode){case M.PdfDestinationMode.location:this._array.push(R.get("XYZ")),this._array.push(this._location.x),this._array.push(this._page.graphics._size.height-this._location.y),this._array.push(this._zoom);break;case M.PdfDestinationMode.fitToPage:this._array.push(R.get("Fit"));break;case M.PdfDestinationMode.fitR:this._array.push(R.get("FitR")),this._array.push(this._destinationBounds.x),this._array.push(this._destinationBounds.y),this._array.push(this._destinationBounds.width),this._array.push(this._destinationBounds.height);break;case M.PdfDestinationMode.fitH:this._array.push(R.get("FitH")),this._array.push(null!=t?t.size.height-this._location.y:0)}this._parent&&(this._parent._dictionary.set(this._isBookmark?"Dest":"D",this._array),this._parent._dictionary._updated=!0)}};var vr=Sr;function Sr(t,e,i){this._location={x:0,y:0},this._destinationMode=M.PdfDestinationMode.location,this._zoom=0,this._isValid=!0,this._destinationBounds={x:0,y:0,width:0,height:0},this._array=Array(),null!=t&&(t.rotation===M.PdfRotationAngle.angle180?this._location={x:t.graphics._size.width,y:this._location.y}:t.rotation===M.PdfRotationAngle.angle90?this._location={x:0,y:0}:t.rotation===M.PdfRotationAngle.angle270?this._location={x:t.graphics._size.width,y:0}:this._location={x:0,y:this._location.y},this._page=t,this._index=t._pageIndex),null!=e&&(this._location={x:e.x,y:e.y},"width"in e)&&"height"in e&&"number"==typeof e.width&&"number"==typeof e.height&&(this._destinationBounds=e),null!=i&&("mode"in i&&null!==i.mode&&void 0!==i.mode&&(this.mode=i.mode),"zoom"in i)&&null!==i.zoom&&void 0!==i.zoom&&(this.zoom=i.zoom)}xr.prototype._obtainDestination=function(){var t,e,i;if(this._dictionary&&(this._dictionary.has(this._key)||this._dictionary.has("D"))){this._dictionary&&this._dictionary._crossReference&&this._dictionary._crossReference._document&&(i=this._dictionary._crossReference._document),this._dictionary.has("D")&&(this._key="D");var n,r,s,a,o,h,c,_,d,l=this._dictionary.getArray(this._key);if(("string"==typeof l||l instanceof R&&"string"==typeof l.name)&&i&&(l=this._getDestination(l,i)),"number"==typeof(d=Array.isArray(l)&&0<l.length?l[0]:d)?c=d:d instanceof D?c=ls(i,d):d instanceof m&&(d=i._crossReference._fetch(d))&&d instanceof D&&(c=ls(i,d)),!e&&"number"==typeof c&&0<=c&&c<i.pageCount&&(e=i.getPage(c)),(n=Array.isArray(l)&&0<l.length?l[1]:n)&&e&&l)switch(n.name){case"XYZ":r=l[2],s=l[3],h=l[4],_="number"==typeof s?e.size.height-s:0,e.rotation!==M.PdfRotationAngle.angle0&&(_=ds(e,s,r)),(t=new vr(e,{x:"number"==typeof r?r:0,y:_}))._index=e._pageIndex,t.zoom=null!=h?h:0,null!==r&&null!==s&&null!==h&&void 0!==r&&void 0!==s&&void 0!==h||t._setValidation(!1);break;case"FitR":2<l.length&&(r=l[2]),3<l.length&&(a=l[3]),4<l.length&&(o=l[4]),5<l.length&&(s=l[5]),(t=new vr(e,{x:r=null!=r?r:0,y:a=null!=a?a:0,width:o=null!=o?o:0,height:s=null!=s?s:0}))._index=e._pageIndex,t.mode=M.PdfDestinationMode.fitR;break;case"FitH":case"FitBH":_="number"==typeof(s=2<l.length?l[2]:s)?e.size.height-s:0,(t=new vr(e,{x:0,y:_}))._index=e._pageIndex,t.mode=M.PdfDestinationMode.fitH,null==s&&t._setValidation(!1);break;case"Fit":(t=new vr(e))._index=e._pageIndex,t.mode=M.PdfDestinationMode.fitToPage}else Array.isArray(l)&&(t=new vr,4<l.length&&(h=l[4]),1<l.length&&(n=l[1]),"number"==typeof h&&(t.zoom=h),n&&("Fit"===n.name?t.mode=M.PdfDestinationMode.fitToPage:"XYZ"===n.name&&(2<l.length&&(r=l[2]),3<l.length&&(_=l[3]),null!=r&&null!=_&&null!=h||t._setValidation(!1))),"number"==typeof c)&&0<=c&&c<i.pageCount&&(t._index=c);return t}},xr.prototype._getDestination=function(t,e){var i;return i=e?this._getNamedDestination(e,t):i},xr.prototype._getNamedDestination=function(t,e){var i,n,r=t._catalog;return r&&r._catalogDictionary&&(e&&"string"==typeof e?r._catalogDictionary.has("Names")&&(n=r._catalogDictionary.get("Names"))&&n.has("Dests")&&(n=n.get("Dests"))&&(n=this._getNamedObjectFromTree(n,e),i=this._extractDestination(n,t)):e&&e instanceof R&&(n=r._catalogDictionary.get("Dests"))&&(i=n.get(e.name))),i},xr.prototype._extractDestination=function(t,e){var i,n;return(i=t&&t instanceof m?e._crossReference._fetch(t):i)&&(i instanceof D&&i.has("D")?n=i.getRaw("D"):Array.isArray(i)&&(n=i)),n||t},xr.prototype._getNamedObjectFromTree=function(t,e){for(var i,n=!1,r=t;!n&&r;)r&&r.has("Kids")?r=this._getProperKid(r,e):r&&r.has("Names")&&(i=this._findName(r,e),n=!0);return i},xr.prototype._findName=function(t,e){var i,n=t.get("Names");if(Array.isArray(n)&&0!==n.length)for(var r=0;r<n.length;r+=2){var s=n[r];if(s instanceof m&&(s=t._crossReference._fetch(s)),0===this._stringCompare(e,s))return i=n[r+1]}return i},xr.prototype._getProperKid=function(t,e){var i;if((n=t&&t.has("Kids")?t.getRaw("Kids"):n)&&Array.isArray(n)&&0!==n.length)for(var n,r=(n=t.getArray("Kids")).length-1;0<=r&&(i=n[Number.parseInt(r.toString(),10)],!this._checkLimits(i,e));r--);return i},xr.prototype._checkLimits=function(t,e){var i,n=!1;return t&&t.has("Limits")&&(i=(t=t.get("Limits"))[0],t=t[1],i=this._stringCompare(i,e),t=this._stringCompare(t,e),n=0===i||0===t||i<0&&0<t),n},xr.prototype._stringCompare=function(t,e){for(var i=v(t),n=v(e),r=Math.min(i.length,n.length),s=0,a=0;a<r&&0===(s=i[Number.parseInt(a.toString(),10)]-n[Number.parseInt(a.toString(),10)]);a++);return s=0===s?i.length-n.length:s};var Pr=xr;function xr(t,e){t&&"string"==typeof e&&(this._dictionary=t,this._key=e)}h.prototype._writeOperator=function(t){this._stream.write(t),this._stream.write(this._newLine)},h.prototype._saveGraphicsState=function(){this._writeOperator("q")},h.prototype._restoreGraphicsState=function(){this._writeOperator("Q")},h.prototype._writeComment=function(t){t&&0<t.length&&this._writeOperator("% "+t)},h.prototype._setGraphicsState=function(t){this._stream.write("/"+na(t.name)+" "),this._writeOperator("gs")},h.prototype._modifyCtm=function(t){this._stream.write(t._toString()+" "),this._writeOperator("cm")},h.prototype._modifyTM=function(t){this._stream.write(t._toString()+" "),this._writeOperator("Tm")},h.prototype._setColorSpace=function(t,e,i){if("string"==typeof t&&"boolean"==typeof e)this._stream.write("/"+t+" "),this._writeOperator(e?"CS":"cs");else if(Array.isArray(t)&&"number"==typeof e&&"boolean"==typeof i){var n=void 0;switch(e){case M._PdfColorSpace.rgb:n="DeviceRGB";break;case M._PdfColorSpace.cmyk:n="DeviceCMYK";break;case M._PdfColorSpace.grayScale:n="DeviceGray";break;default:n="DeviceRGB"}this._stream.write("/"+n+" "),this._writeOperator(i?"CS":"cs"),this._setColor(t,i)}},h.prototype._setColor=function(t,e){this._stream.write((t[0]/255).toFixed(3)+" "+(t[1]/255).toFixed(3)+" "+(t[2]/255).toFixed(3)+" "),this._writeOperator(e?"RG":"rg")},h.prototype._appendRectangle=function(t,e,i,n){this._writePoint(t,e),this._writePoint(i,n),this._writeOperator("re")},h.prototype._writePoint=function(t,e){this._stream.write(t.toFixed(3)+" "+(-e).toFixed(3)+" ")},h.prototype._clipPath=function(t){this._stream.write((t?"W*":"W")+" n"+this._newLine)},h.prototype._fillPath=function(t){this._writeOperator(t?"f*":"f")},h.prototype._closeFillPath=function(t){this._writeOperator("h"),this._fillPath(t)},h.prototype._strokePath=function(){this._writeOperator("S")},h.prototype._closeStrokePath=function(){this._writeOperator("s")},h.prototype._fillStrokePath=function(t){this._writeOperator(t?"B*":"B")},h.prototype._closeFillStrokePath=function(t){this._writeOperator(t?"b*":"b")},h.prototype._endPath=function(){this._writeOperator("n")},h.prototype._setFont=function(t,e){this._stream.write("/"+t+" "+e.toFixed(3)+" "),this._writeOperator("Tf")},h.prototype._setTextScaling=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tz")},h.prototype._closePath=function(){this._writeOperator("h")},h.prototype._startNextLine=function(t,e){void 0===t?this._writeOperator("T*"):(this._writePoint(t,e),this._writeOperator("Td"))},h.prototype._setLeading=function(t){this._write(t.toFixed(3)+" "),this._write(this._whiteSpace),this._writeOperator("TL")},h.prototype._showText=function(t){this._writeText(t),this._writeOperator("Tj")},h.prototype._write=function(t){var e="";this._writeOperator(e+t+"\r\n")},h.prototype._writeText=function(t){for(var e="",i=this._escapeSymbols(t),n=0;n<i.length;n++)e+=String.fromCharCode(i[n]);this._stream.write(e="("+e+")")},h.prototype._beginText=function(){this._writeOperator("BT")},h.prototype._endText=function(){this._writeOperator("ET")},h.prototype._beginPath=function(t,e){this._writePoint(t,e),this._writeOperator("m")},h.prototype._appendLineSegment=function(t,e){this._writePoint(t,e),this._writeOperator("l")},h.prototype._appendBezierSegment=function(t,e,i,n,r,s){this._writePoint(t,e),this._writePoint(i,n),this._writePoint(r,s),this._writeOperator("c")},h.prototype._setTextRenderingMode=function(t){this._stream.write(t.toString()+" "),this._writeOperator("Tr")},h.prototype._setCharacterSpacing=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tc")},h.prototype._setWordSpacing=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("Tw")},h.prototype._showNextLineText=function(t,e){null!=e&&e?this._writeText(t):this._stream.write(t),this._writeOperator("'")},h.prototype._setLineDashPattern=function(t,e){var i="[";if(1<=t.length)for(var n=0;n<t.length;n++)n===t.length-1?i+=t[n].toString():i+=t[n].toString()+" ";i=(i+="] ")+e.toString(),this._writeOperator(i+=" d")},h.prototype._setMiterLimit=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("M")},h.prototype._setLineWidth=function(t){this._stream.write(t.toFixed(3)+" "),this._writeOperator("w")},h.prototype._setLineCap=function(t){this._stream.write(t+" "),this._writeOperator("J")},h.prototype._setLineJoin=function(t){this._stream.write(t+" "),this._writeOperator("j")},h.prototype._executeObject=function(t){this._stream.write("/"+t.name+" "),this._writeOperator("Do")},h.prototype._beginMarkupSequence=function(t){this._stream.write("/"+t+" "),this._writeOperator("BMC")},h.prototype._endMarkupSequence=function(){this._writeOperator("EMC")},h.prototype._clear=function(){this._stream._bytes=[]},h.prototype._escapeSymbols=function(t){for(var e=[],i=0;i<t.length;i++){var n=t.charCodeAt(i);switch(n){case 40:case 41:e.push(92),e.push(n);break;case 13:e.push(92),e.push(114);break;case 92:e.push(92),e.push(n);break;default:e.push(n)}}return e};var Ar=h;function h(t){this._newLine="\r\n",this._whiteSpace=" ",this._stream=t}Object.defineProperty(Cr.prototype,"width",{get:function(){return this._imageWidth},set:function(t){this._imageWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(Cr.prototype,"height",{get:function(){return this._imageHeight},set:function(t){this._imageHeight=t},enumerable:!0,configurable:!0}),Object.defineProperty(Cr.prototype,"physicalDimension",{get:function(){return this._imagePhysicalDimension=this._getPointSize(this.width,this.height,this._horizontalResolution),{width:this.width,height:this.height}},enumerable:!0,configurable:!0}),Cr.prototype.draw=function(t,e){!e||null!==e.x&&void 0!==e.x||null!==e.y&&void 0!==e.y||(e.x=0,e.y=0);var i,n=null;(i=e?0!==e.x||0!==e.y:i)&&(n=t.save(),t.translateTransform(e)),t.drawImage(this,{x:0,y:0}),i&&t.restore(n)},Cr.prototype._getPointSize=function(t,e,i){var n;return null==i?this._getPointSize(t,e,96):(i=new Mr,n=new Mr,[i._convertUnits(t,M._PdfGraphicsUnit.pixel,M._PdfGraphicsUnit.point),n._convertUnits(e,M._PdfGraphicsUnit.pixel,M._PdfGraphicsUnit.point)])};var Tr=Cr;function Cr(){}Object.defineProperty(c.prototype,"_matrix",{get:function(){return void 0===this._m&&(this._m=new Rr),this._m},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"_resources",{get:function(){var t,i=this;return void 0===this._resourceMap&&(this._resourceMap=new Map,this._resourceObject&&this._resourceObject.has("Font")&&(t=this._resourceObject.get("Font"))&&0<t.size&&t.forEach(function(t,e){null!=e&&e instanceof m&&i._resourceMap.set(e,R.get(t))}),this._resourceObject.has("XObject")&&(t=this._resourceObject.get("XObject"))&&0<t.size&&t.forEach(function(t,e){null!=e&&e instanceof m&&i._resourceMap.set(e,R.get(t))}),this._resourceObject.has("ExtGState"))&&(t=this._resourceObject.get("ExtGState"))&&0<t.size&&(this._transparencies||(this._transparencies=new Map),t.forEach(function(t,e){null!=e&&e instanceof m&&i._setTransparencyData(e,R.get(t))})),this._resourceMap},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"clientSize",{get:function(){var t;return this._page&&this._crossReference&&this._crossReference._document._hasTemplateContentValue?(t=!!this._isLayouter,{width:(t=this._page._getActualBounds(this._page._pageSettings,t))[2],height:t[3]}):{width:this._clipBounds[2],height:this._clipBounds[3]}},enumerable:!0,configurable:!0}),c.prototype.save=function(){var t=new Br(this,this._matrix);return t._textRenderingMode=this._textRenderingMode,t._charSpacing=this._characterSpacing,t._textScaling=this._textScaling,t._wordSpacing=this._wordSpacing,t._currentBrush=this._currentBrush,t._currentPen=this._currentPen,t._currentFont=this._currentFont,this._graphicsState.push(t),this._sw._saveGraphicsState(),t},c.prototype.restore=function(t){if(0<this._graphicsState.length)if(void 0===t)this._doRestore();else if(0<this._graphicsState.length&&-1!==this._graphicsState.indexOf(t))for(;0<this._graphicsState.length&&this._doRestore()!==t;);},c.prototype.scaleTransform=function(t,e){var i=new Rr;i._scale(t,e),this._sw._modifyCtm(i),this._matrix._multiply(i)},c.prototype.translateTransform=function(t){var e=new Rr;e._translate(t.x,-t.y),this._sw._modifyCtm(e),this._matrix._multiply(e)},c.prototype.rotateTransform=function(t){var e=new Rr;e._rotate(-t),this._sw._modifyCtm(e),this._matrix._multiply(e)},c.prototype.setClip=function(t,e){void 0===e&&(e=M.PdfFillMode.winding),this._sw._appendRectangle(t.x,t.y,t.width,t.height),this._sw._clipPath(e===M.PdfFillMode.alternate)},c.prototype.setTransparency=function(t,e,i){void 0===e&&(e=t),void 0===i&&(i=M.PdfBlendMode.normal),void 0===this._transparencies&&(this._transparencies=new Map);var n,r,s="CA:"+t.toString()+"_ca:"+e.toString()+"_BM:"+i.toString();0<this._transparencies.size&&this._transparencies.forEach(function(t,e){t===s&&(n=e)}),n||(n=new Lr,(r=new D).update("CA",t),r.update("ca",e),r.update("BM",Zs(i)),n._dictionary=r,n._key=s,t=void(n._name=R.get(ia())),e=!1,this._resourceObject.has("ExtGState")?null!=(i=this._resourceObject.getRaw("ExtGState"))&&(i instanceof m?(e=!0,t=this._crossReference._fetch(i)):i instanceof D&&(t=i)):(t=new D(this._crossReference),this._resourceObject.update("ExtGState",t)),this._crossReference?(i=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(i,r),n._reference=i,t.update(n._name.name,i)):this._pendingResource.push({resource:r,key:n._name,source:t}),e&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0)),this._sw._setGraphicsState(n._name)},c.prototype.drawLine=function(t,e,i){this._beginMarkContent(),this._stateControl(t),this._sw._beginPath(e.x,e.y),this._sw._appendLineSegment(i.x,i.y),this._sw._strokePath(),ea("PDF",this._resourceObject),this._endMarkContent()},c.prototype.drawRectangle=function(t,e,i){this._beginMarkContent();e=this._setPenBrush(e,i);this._sw._appendRectangle(t.x,t.y,t.width,t.height),this._drawGraphicsPath(e.pen,e.brush),this._endMarkContent()},c.prototype.drawBezier=function(t,e,i,n,r){this._beginMarkContent(),this._stateControl(r,null,null),this._sw._beginPath(t.x,t.y),this._sw._appendBezierSegment(e.x,e.y,i.x,i.y,n.x,n.y),this._drawGraphicsPath(r),this._endMarkContent()},c.prototype.drawPie=function(t,e,i,n,r){this._beginMarkContent();n=this._setPenBrush(n,r);this._constructPiePath(t.x,t.y,t.x+t.width,t.y+t.height,e,i),this._sw._appendLineSegment(t.x+t.width/2,t.y+t.height/2),this._drawGraphicsPath(n.pen,n.brush,null,!0),this._endMarkContent()},c.prototype.drawPolygon=function(t,e,i){var n=this;this._beginMarkContent(),0<t.length&&(e=this._setPenBrush(e,i),this._sw._beginPath(t[0].x,t[0].y),t.forEach(function(t,e){0<e&&n._sw._appendLineSegment(t.x,t.y)}),this._drawGraphicsPath(e.pen,e.brush,M.PdfFillMode.winding,!0)),this._endMarkContent()},c.prototype.drawEllipse=function(t,e,i){this._beginMarkContent();e=this._setPenBrush(e,i);this._constructArcPath(t.x,t.y,t.x+t.width,t.y+t.height,0,360),this._drawGraphicsPath(e.pen,e.brush,M.PdfFillMode.winding,!0),this._endMarkContent()},c.prototype.drawArc=function(t,e,i,n){0!==i&&(this._beginMarkContent(),this._stateControl(n),this._constructArcPath(t.x,t.y,t.x+t.width,t.y+t.height,e,i),this._drawGraphicsPath(n,null,M.PdfFillMode.winding,!1),this._endMarkContent())},c.prototype.drawImage=function(t,e){var i,n,r,s;L.initializeTelemetryFeature("ImageToPDF","PDFLibrary"),this._beginMarkContent(),e&&this._isRectangle(e)?(t._save(),i=new Rr,this._getTranslateTransform(e.x,e.y+e.height,i),this._getScaleTransform(e.width,e.height,i),this._sw._write("q"),i=void this._sw._modifyCtm(i),r=!(n=void 0),(r=this._resourceObject.has("XObject")&&((s=this._resourceObject.getRaw("XObject"))instanceof D?i=s:s instanceof m&&this._crossReference&&(i=this._crossReference._fetch(s)),i)?!1:r)&&(i=new D(this._crossReference),this._resourceObject.update("XObject",i)),void 0===n&&(t._key||(t._key=ia()),n=R.get(t._key)),this._crossReference?(this._updateImageResource(t,n,i,this._crossReference),this._source.update("Resources",this._resourceObject),this._source._updated=!0):this._pendingResource.push({resource:t,key:n,source:i}),this._sw._executeObject(n),this._sw._write("Q"),this._sw._write("\r\n"),ea("ImageB",this._resourceObject),ea("ImageC",this._resourceObject),ea("ImageI",this._resourceObject),ea("Text",this._resourceObject)):(s=t.physicalDimension,this.drawImage(t,{x:e.x,y:e.y,width:s.width,height:s.height})),this._endMarkContent()},c.prototype.drawTemplate=function(n,t){var e,i,r,s,a,o,h,c,_,d,l,u,p,f,g=this,y=(this._beginMarkContent(),!0);void 0!==n&&((n._isExported||n._isResourceExport)&&(this._crossReference?(n._crossReference=this._crossReference,n._importStream(!0,n._isResourceExport)):(n._importStream(!1,n._isResourceExport),this._pendingResource.push(n),y=!1)),i=e=void 0,i=this._page&&this._page.rotation&&n._isSignature&&this._page._size.width>this._page._size.height&&this._page.rotation===M.PdfRotationAngle.angle270&&n._content&&n._content.dictionary&&n._content.dictionary.has("Matrix")?(e=n&&0<n._size.width?t.width/n._size.height:1,n&&0<n._size.height?t.height/n._size.width:1):(e=n&&0<n._size.width?t.width/n._size.width:1,n&&0<n._size.height?t.height/n._size.height:1),r=!(Math.trunc(1e3*e)/1e3==1&&Math.trunc(1e3*i)/1e3==1),c=h=void 0,this._page&&(h=this._page.cropBox,c=this._page.mediaBox,this._page._pageDictionary.has("CropBox"))&&this._page._pageDictionary.has("MediaBox")&&0<h[0]&&0<h[1]&&c[0]<0&&c[1]<0&&(this.translateTransform({x:h[0],y:-h[1]}),t.x=-h[0],t.y=h[1]),s=this.save(),a=new Rr,this._page?(h=this._page._pageDictionary.has("CropBox")&&this._page._pageDictionary.has("MediaBox")&&h&&c&&h[0]===c[0]&&h[1]===c[1]&&h[2]===c[2]&&h[3]===c[3]||this._page._pageDictionary.has("MediaBox")&&c&&0===c[3],c=t.y+(0<=this._page._origin[0]||h?t.height:0),n&&n._isSignature&&n._content&&n._content.dictionary&&n._content.dictionary.has("BBox")?(o=0!==(h=n._content.dictionary.get("BBox"))[2]&&0!==h[3],d=0<h[0]&&o?0:t.x,h=0<h[1]&&o?this._page.size.height:c,a._translate(d,-h)):a._translate(t.x,-c)):a._translate(t.x,-(t.y+t.height)),o=!1,n._content&&n._content.dictionary&&(d=n._content.dictionary).has("Matrix")&&d.has("BBox")&&(h=d.getArray("Matrix"),c=d.getArray("BBox"),h)&&c&&5<h.length&&3<c.length&&(d=Number.parseFloat(ms(-h[1])),f=Number.parseFloat(ms(h[2])),_=Number.parseFloat(ms(e)),u=Number.parseFloat(ms(i)),_===d&&u===f&&c[2]===n._size.width&&c[3]===n._size.height&&n._isAnnotationTemplate&&n._needScale&&r?((a=new Rr)._translate(t.x-h[4],-(t.y+h[5])),a._scale(1,1),o=!0):0!==c[0]&&0!==c[1]&&c[0]===t.x&&this._page&&n._isSignature&&(a._translate(t.x-c[0],-this._page.size.height),a._scale(e,i),o=!0)),r&&!o&&a._scale(e,i),_=void this._sw._modifyCtm(a),u=!(d=!1),this._resourceObject.has("XObject")&&((f=this._resourceObject.getRaw("XObject"))&&(f instanceof m?(d=!0,_=this._crossReference._fetch(f)):f instanceof D&&(_=f)),_)&&(u=!1,this._resources.forEach(function(t,e){var i;e&&e instanceof m&&(i=g._crossReference._fetch(e))&&n&&i===n._content&&(l=t,p=e)})),u&&(_=new D(this._crossReference),this._resourceObject.update("XObject",_)),void 0===l&&(n._key||(n._key=ia()),l=R.get(n._key),n&&n._content.reference?p=n._content.reference:this._crossReference?p=this._crossReference._getNextReference():(this._pendingResource.push({resource:n._content,key:l,source:_}),this._template&&y&&this._pendingResource.push(n)),p&&this._crossReference&&(!this._crossReference._cacheMap.has(p)&&n&&n._content&&this._crossReference._cacheMap.set(p,n._content),_.update(l.name,p),this._resources.set(p,l)),this._resourceObject._updated=!0),n._isNew&&this._crossReference&&n.graphics._processResources(this._crossReference),d&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0),this._sw._executeObject(l),this.restore(s),ea("ImageB",this._resourceObject),ea("ImageC",this._resourceObject),ea("ImageI",this._resourceObject),ea("Text",this._resourceObject)),this._endMarkContent()},c.prototype.drawPath=function(t,e,i){this._beginMarkContent();e=this._setPenBrush(e,i);(e.pen||e.brush)&&(this._buildUpPath(t._points,t._pathTypes),this._drawGraphicsPath(e.pen,e.brush,t.fillMode,!1)),this._endMarkContent()},c.prototype.drawRoundedRectangle=function(t,e,i,n){if(null==i)throw new Error("Pen cannot be null or undefined");if(null==n)throw new Error("Brush cannot be null or undefined");var r=2*e,s=[r,r],s=[t.x,t.y,s[0],s[1]],a=new C;0===e?a.addRectangle(t):(a._isRoundedRectangle=!0,a.addArc({x:s[0],y:s[1],width:s[2],height:s[3]},180,90),s[0]=t.x+t.width-r,a.addArc({x:s[0],y:s[1],width:s[2],height:s[3]},270,90),s[1]=t.y+t.height-r,a.addArc({x:s[0],y:s[1],width:s[2],height:s[3]},0,90),s[0]=t.x,a.addArc({x:s[0],y:s[1],width:s[2],height:s[3]},90,90),a.closeFigure()),this.drawPath(a,i,n)},c.prototype.drawString=function(t,e,i,n,r,s){n instanceof x?(a=n,r instanceof A?(o=r,s instanceof I&&(h=s)):r instanceof I&&(h=r)):n instanceof A?(o=n,r instanceof I&&(h=r)):r instanceof A&&(o=r),r&&r instanceof I&&(h=r),s&&s instanceof I&&(h=s),this._beginMarkContent(),e&&e._document&&e._document._crossReference&&(this._crossReference=e._document._crossReference);var a,o,h,n=this._stringLayouter;void 0===n&&(n=new vt,this._stringLayouter=n),h=h||new I,t=t&&this._normalizeText(e,t),this._isRectangle(i)&&!(r=n._layout(t,e,h,[i.width,i.height]))._empty&&(s=this._checkCorrectLayoutRectangle([r._actualSize.width,r._actualSize.height],i.x,i.y,h),i.width<=0&&(i.x=s[0],i.width=s[2]),i.height<=0&&(i.y=s[1],i.height=s[3]),this._drawStringLayoutResult(r,e,a,o,[i.x,i.y,i.width,i.height],h)),ea("Text",this._resourceObject),this._endMarkContent()},c.prototype.drawTextElement=function(t,e){if(null==t)throw new Error("PdfTextElement cannot be null or undefined");if("string"!=typeof t.text||0===t.text.length)throw new Error("PdfTextElement.text must be a non-empty string");if(void 0===t.font||null===t.font)throw new Error("PdfTextElement.font is required");if(void 0!==t.layoutFormat&&null!==t.layoutFormat&&!(t.layoutFormat instanceof ur))throw new Error("PdfTextElement.layoutFormat must be an instance of PdfLayoutFormat");var e=this._isRectangle(e)?{x:e.x,y:e.y,width:e.width,height:e.height}:{x:e.x,y:e.y,width:0,height:0},i=new A({r:0,g:0,b:0}),i=void 0===t.brush||null===t.brush?i:t.brush;this.drawString(t.text,t.font,e,t.pen,i,t.stringFormat)},c.prototype._doRestore=function(){var t=this._graphicsState.pop();return this._m=t._transformationMatrix,this._currentBrush=t._currentBrush,this._currentPen=t._currentPen,this._currentFont=t._currentFont,this._characterSpacing=t._charSpacing,this._wordSpacing=t._wordSpacing,this._textScaling=t._textScaling,this._textRenderingMode=t._textRenderingMode,this._sw._restoreGraphicsState(),t},c.prototype._beginMarkContent=function(){this._layer&&this._layer._beginLayer(this)},c.prototype._endMarkContent=function(){if(this._layer){if(this._layer._isEndState&&0!==this._layer._parentLayer.length)for(var t=0;t<this._layer._parentLayer.length;t++)this._sw._write("EMC");this._layer._isEndState&&this._sw._write("EMC")}},c.prototype._processResources=function(n){var r=this;this._crossReference=n,0<this._pendingResource.length&&(this._pendingResource.forEach(function(t,e){var i;t instanceof P?(t._crossReference=n,t._isNew?t.graphics._processResources(n):t._updatePendingResource(n)):t.resource instanceof y||t.resource instanceof D?(i=void 0,t.resource._reference?i=t.resource._reference:(i=n._getNextReference(),t.resource._reference=i),!n._cacheMap.has(i)&&t.resource&&n._cacheMap.set(i,t.resource),t.source.update(t.key.name,i),r._resources.set(i,t.key)):t.resource instanceof Tr?r._updateImageResource(t.resource,t.key,t.source,n):t.resource instanceof ce&&r._updateFontResource(t.resource,t.key,t.source,n),r._source.update("Resources",r._resourceObject),r._source._updated=!0}),this._pendingResource=[])},c.prototype._updateImageResource=function(t,e,i,n){var r,s;t._reference?r=t._reference:(r=n._getNextReference(),t._reference=r),n._cacheMap.has(r)||t&&t._imageStream&&t._imageStream.dictionary&&(n._cacheMap.set(r,t._imageStream),t._imageStream.dictionary._updated=!0,t._maskStream)&&t._maskStream.dictionary&&(s=void 0,t._maskReference?s=t._maskReference:(s=n._getNextReference(),t._maskReference=s),n._cacheMap.set(s,t._maskStream),t._maskStream.dictionary._updated=!0,t._imageStream.dictionary.set("SMask",s)),i.update(e.name,r),this._resources.set(r,e),this._resourceObject._updated=!0},c.prototype._updateFontResource=function(t,e,i,n){var r;t._reference?r=t._reference:(r=n._getNextReference(),t._reference=r),n._cacheMap.has(r)||(t._dictionary?(n._cacheMap.set(r,t._dictionary),i.update(e.name,r),this._resources.set(r,e)):t instanceof ye&&((t=t._fontInternal)&&t._fontDictionary&&n._cacheMap.set(r,t._fontDictionary),i.update(e.name,r),this._resources.set(r,e)))},c.prototype._constructArcPath=function(t,e,i,n,r,s){var a=oa(t,e,i,n,r,s);if(0!==a.length){var o=[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]];this._sw._beginPath(o[0],o[1]);for(var h=0;h<a.length;h+=8)o=[a[h],a[h+1],a[h+2],a[h+3],a[h+4],a[h+5],a[h+6],a[h+7]],this._sw._appendBezierSegment(o[2],o[3],o[4],o[5],o[6],o[7])}},c.prototype._constructPiePath=function(t,e,i,n,r,s){var a=oa(t,e,i,n,r,s);if(8===a.length){var o=[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]];this._sw._beginPath(o[0],o[1]);for(var h=0;h<a.length;h+=8)o=[a[h],a[h+1],a[h+2],a[h+3],a[h+4],a[h+5],a[h+6],a[h+7]],this._sw._appendBezierSegment(o[2],o[3],o[4],o[5],o[6],o[7])}},c.prototype._writePen=function(t){var e=t._width,i=t._dashPattern;this._sw._setLineDashPattern(i,t._dashOffset*e),this._sw._setLineWidth(t._width),this._sw._setLineJoin(t._lineJoin),this._sw._setLineCap(t._lineCap),0<t._miterLimit&&this._sw._setMiterLimit(t._miterLimit),this._sw._setColor([t._color.r,t._color.g,t._color.b],!0)},c.prototype._isRectangle=function(t){return"width"in t&&"height"in t},c.prototype._normalizeText=function(t,e){var i="";if(t instanceof E){var n=[];if(null!=e&&0<e.length)for(var r=0;r<e.length;r++){var s=e.charCodeAt(r);19968<=s&&s<=40959||n.push(s)}if(n&&0<n.length)for(r=0;r<n.length;++r)i+=String.fromCharCode(n[Number.parseInt(r.toString(),10)])}else i=e;return i},c.prototype._buildUpPath=function(t,e){for(var i=0;i<t.length;i++){var n=t[i];switch(15&e[i]){case M.PathPointType.start:this._sw._beginPath(n.x,n.y);break;case M.PathPointType.bezier:var r=this._getBezierPoint(t,e,i),i=r.index,s=r.point,r=(i=(r=this._getBezierPoint(t,e,i)).index,r.point);this._sw._appendBezierSegment(n.x,n.y,s.x,s.y,r.x,r.y);break;case M.PathPointType.line:this._sw._appendLineSegment(n.x,n.y);break;default:throw new Error("Incorrect path formation.")}(e[Number.parseInt(i.toString(),10)]&M.PathPointType.closePath)===M.PathPointType.closePath&&this._sw._closePath()}},c.prototype._getBezierPoint=function(t,e,i){if(e[i]!==M.PathPointType.bezier)throw new Error("Malforming path.");return{index:++i,point:t[i]}},c.prototype._initialize=function(){this._mediaBoxUpperRightBound=0,this._characterSpacing=-1,this._wordSpacing=-1,this._textScaling=-100,this._textRenderingMode=-1,this._graphicsState=[],this._clipBounds=[0,0,this._size.width,this._size.height],this._colorSpaceInitialized=!1,this._startCutIndex=-1},c.prototype._initializeCurrentColorSpace=function(){this._colorSpaceInitialized||(this._sw._setColorSpace("DeviceRGB",!0),this._sw._setColorSpace("DeviceRGB",!1),this._colorSpaceInitialized=!0)},c.prototype._brushControl=function(t){this._sw._setColor([t._color.r,t._color.g,t._color.b],!1),this._currentBrush=t},c.prototype._penControl=function(t){this._currentPen=t,this._writePen(t),this._currentPen=t},c.prototype._fontControl=function(n,t){var e,r,s,i,a=this,t=n._getSize(t),o=(this._currentFont=n,!1),h=!0,c=!1;this._resourceObject.has("Font")&&(null!=(i=this._resourceObject.getRaw("Font"))&&(i instanceof m?(o=!0,e=this._crossReference._fetch(i)):i instanceof D&&(e=i)),null!=e)&&(h=!1,this._resources.forEach(function(t,e){var i;a._crossReference?null!=e&&(i=a._crossReference._fetch(e))&&(n instanceof E&&i===n._dictionary||n instanceof ye&&i===n._fontInternal._fontDictionary||n instanceof pe&&i===n._dictionary)&&(r=t,s=e,c=!0):n._reference&&n._reference===e&&(r=t,s=e,c=!0)})),h&&(e=new D(this._crossReference),this._resourceObject.update("Font",e)),void 0===r&&(n._key||(n._key=ia()),r=R.get(n._key),s||(n._reference?(s=n._reference,e.update(r.name,s)):this._crossReference?s=this._crossReference._getNextReference():this._pendingResource.push({resource:n,key:r,source:e})),s&&this._crossReference&&(n._reference||(n._reference=s),n._dictionary?(this._crossReference._cacheMap.set(s,n._dictionary),e.update(r.name,s)):n instanceof ye&&((i=n._fontInternal)&&i._fontDictionary&&!i._fontDictionary._currentObj&&this._crossReference._cacheMap.set(s,i._fontDictionary),e.update(r.name,s))),!c)&&s&&this._resources.set(s,r),o&&(this._resourceObject._updated=!0),this._hasResourceReference&&(this._source._updated=!0),this._sw._setFont(r.name,t)},c.prototype._setPenBrush=function(t,e){var i,n;return t&&(t instanceof x?i=t:n=t),e&&e instanceof A&&(n=e),this._stateControl(i,n,null),{pen:i,brush:n}},c.prototype._stateControl=function(t,e,i,n){(t||e)&&this._initializeCurrentColorSpace(),t&&this._penControl(t),e&&this._brushControl(e),i&&this._fontControl(i,n)},c.prototype._drawStringLayoutResult=function(t,e,i,n,r,s){var a,o,h,c,_,d,l,u=this;t._empty||(a=s&&void 0!==s.lineLimit&&!s.lineLimit,h=void 0===s||s&&void 0!==s.noClip&&!s.noClip,o=void 0,(a=a&&h)&&(o=this.save(),h=[r[0],r[1],t._actualSize.width,t._actualSize.height],0<r[2]&&(h[2]=r[2]),s.lineAlignment===M.PdfVerticalAlignment.middle?h[1]+=(r[3]-h[3])/2:s.lineAlignment===M.PdfVerticalAlignment.bottom&&(h[1]+=r[3]-h[3]),this.setClip({x:h[0],y:h[1],width:h[2],height:h[3]})),e&&e instanceof ye&&e._fontInternal&&e._fontInternal instanceof Qt&&e.isItalic&&(e._fontInternal._ttfMetrics._isItalic||(o=this.save(),this._isItalic=!0)),this._applyStringSettings(e,i,n,s),(h=null!=s?s.horizontalScalingFactor:100)!==this._textScaling&&(this._sw._setTextScaling(h),this._textScaling=h),i=this._getTextVerticalAlignShift(t._actualSize.height,r[3],s),h=null==s||0===s.lineSpacing?e._getHeight(s):s.lineSpacing+e._getHeight(s),_=0,_=null!=s&&s.subSuperScript===M.PdfSubSuperScript.subScript?h-(e.height+e._getDescent(s)):h-e._getAscent(s),s&&s.lineAlignment===M.PdfVerticalAlignment.bottom&&(d=ms(r[3]),c=ms(e._getHeight(s)),r[3]-t._actualSize.height!=0)&&r[3]-t._actualSize.height<e._size/2-1&&+d<=+c&&(_=-(h/e._size)),d=new Rr,this._isItalic?(this.translateTransform({x:r[0]+e.size/5,y:r[1]-_+i}),this._skewTransform(0,-11)):(d._translate(r[0],-(r[1]+e._getHeight(s))-(0<e._getDescent(s)?-e._getDescent(s):e._getDescent(s))-i),this._sw._modifyTM(d)),0!==(i=r[3]<e._size&&t._actualSize.height-r[3]<e._size/2-1?0:i)&&null!==s&&s.lineAlignment===M.PdfVerticalAlignment.bottom&&r[3]-t._actualSize.height!=0&&r[3]-t._actualSize.height>e._size/2-1&&(i-=(_-(h-e._size))/2),this._isItalic&&(this._sw._startNextLine(0,0),this._sw._setLeading(+h)),this._drawLayoutResult(t,e,s,r),l=this._currentFont._fontInternal,e instanceof ye&&e.isUnicode&&l&&l._fontDictionary&&l._fontDictionary._currentObj&&this._resourceMap.forEach(function(t,e){u._crossReference&&u._crossReference._cacheMap&&!u._crossReference._cacheMap.has(e)&&(l._fontDictionary._currentObj._beginSave(),u._crossReference._writeFontDictionary(l._fontDictionary),u._crossReference._cacheMap.set(e,l._fontDictionary))}),0!==i&&this._sw._startNextLine(0,-(i-t._lineHeight)),ea("Text",this._resourceObject),this._sw._endText(),this._isItalic&&this.restore(o),this._underlineStrikeoutText(n,t,e,r,s),a&&this.restore(o))},c.prototype._getNextPage=function(){var t=this._crossReference._document.pageCount,t=this._page._pageIndex<=t-2?this._crossReference._document.getPage(this._page._pageIndex+1):this._crossReference._document.addPage();return t},c.prototype._applyStringSettings=function(t,e,i,n){var r=M._TextRenderingMode.fill,s=!1,a=(e&&i?r=M._TextRenderingMode.fillStroke:e?r=M._TextRenderingMode.stroke:i&&(r=M._TextRenderingMode.fill),t&&t instanceof ye&&(t.isUnicode||0!=(t._style&M.PdfFontStyle.bold))&&(o=!1,(a=t._fontInternal._metrics._postScriptName)&&a.toLocaleLowerCase().includes("bold")&&(o=!0),t._fontInternal)&&t._fontInternal._metrics&&t._fontInternal._metrics._isBold!==t.isBold&&!0===t.isBold&&!o&&(!e&&i&&(e=new x(i._color,1)),r=M._TextRenderingMode.fillStroke,s=!0),n&&n.clipPath&&(r|=M._TextRenderingMode.clipFlag),this._sw._beginText(),this._stateControl(e,i,t,n),r!==this._textRenderingMode&&(this._sw._setTextRenderingMode(r),this._textRenderingMode=r),null!=n?n.characterSpacing:0),o=(a!==this._characterSpacing&&(this._sw._setCharacterSpacing(a),this._characterSpacing=a),null!=n?n.wordSpacing:0);o!==this._wordSpacing&&(this._sw._setWordSpacing(o),this._wordSpacing=o),t&&s&&this._sw._setLineWidth(t.size/30)},c.prototype._drawLayoutResult=function(t,e,i,n){for(var r=null==i||0===i.lineSpacing?e._getHeight(i):i.lineSpacing+e._getHeight(i),s=t._lines,a=null!==e&&e.isUnicode,o=0,h=s.length;o<h&&o!==this._startCutIndex;o++){var c=s[o],_=c._width,_=this._getHorizontalAlignShift(_,n[2],i)+this._getLineIndent(c,i,n[2],0===o);0!==_&&this._sw._startNextLine(_,0),e instanceof pe?this._drawCjkString(c,n,e,i):a?this._drawUnicodeLine(c,n[2],e,i):this._drawAsciiLine(c,n[2],i,e),o+1!==h&&(_=this._getTextVerticalAlignShift(t._actualSize.height,n[3],i),c=new Rr,_=-(n[1]+e._getHeight(i))-e._getDescent(i)-_-r*(o+1),c._translate(n[0],_),this._sw._modifyTM(c))}},c.prototype._drawCjkString=function(t,e,i,n){i&&(this._justifyLine(t,e[2],n,i),e=t._text,n=vs(this._getCjkString(e)),this._sw._showNextLineText("("+n+")",!1))},c.prototype._getCjkString=function(t){if(null==t)throw new Error("line cannot be null");t=xs(t);return this._escapeSymbols(t)},c.prototype._escapeSymbols=function(t){if(null===t)throw new Error("data cannot be null");for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];switch(r){case 40:case 41:case 92:e.push(92),e.push(r);break;case 13:e.push(92),e.push(114);break;default:e.push(r)}}return new Uint8Array(e)},c.prototype._drawUnicodeLine=function(t,e,i,n){var r,s,a=t._text,o=null!=n&&n.rightToLeft,h=null!=n&&0<n.wordSpacing,t=this._justifyLine(t,e,n,i),e=new ae;o||null!=n&&n.textDirection!==M.PdfTextDirection.none?(r=[],o=null!=n&&n.alignment===M.PdfTextAlignment.right,s=[],1<(r=null!=n&&n.textDirection!==M.PdfTextDirection.none?e._layout(a,i,n.textDirection===M.PdfTextDirection.rightToLeft,h,n):e._layout(a,i,o,h,n)).length?null!=n&&n.textDirection!==M.PdfTextDirection.none&&(s=e._splitLayout(a,i,n.textDirection===M.PdfTextDirection.rightToLeft,h,n)):s=[a],this._drawUnicodeBlocks(r,s,i,n,t)):h?(r=(o=this._breakUnicodeLine(a,i,null)).tokens,s=o.words,this._drawUnicodeBlocks(r,s,i,n,t)):(e=this._convertToUnicode(a,i),this._sw._showNextLineText(e,!0))},c.prototype._drawUnicodeBlocks=function(t,e,i,n,r){if(null!=t&&0<t.length&&null!=e&&0<e.length&&null!=i){this._sw._startNextLine();var s=0,a=0,o=0,h=0;try{null!=n&&(o=n.firstLineIndent,h=n.paragraphIndent,n.firstLineIndent=0,n.paragraphIndent=0);var c=i._getCharacterWidth(Tt._whiteSpace,n)+r,_=null!==n?n.characterSpacing:0;c+=_+(null!=n&&0===r?n.wordSpacing:0);for(var d=0;d<t.length;d++){var l=t[d],u=e[d],p=0;0!==s&&this._sw._startNextLine(s,0),0<u.length&&(p=p+i.measureString(u,n).width+_,this._sw._showText(l)),d!==t.length-1&&(a+=s=p+c)}0<a&&this._sw._startNextLine(-a,0)}finally{null!=n&&(n.firstLineIndent=o,n.paragraphIndent=h)}}},c.prototype._breakUnicodeLine=function(t,e,i){var n=[];if(null!=t&&0<t.length){i=t.split(null);for(var r=0;r<i.length;r++){var s=i[r],s=this._convertToUnicode(s,e);n.push(s)}}return{tokens:n,words:i}},c.prototype._convertToUnicode=function(t,e){var i,n=null;return null!=t&&null!=e&&e._fontInternal instanceof Qt&&(i=e._fontInternal._ttfReader,e._setSymbols(t),n=vs(xs(n=i._convertString(t)))),n},c.prototype._getTextVerticalAlignShift=function(t,e,i){var n=0;if(0<=e&&null!=i&&i.lineAlignment!==M.PdfVerticalAlignment.top)switch(i.lineAlignment){case M.PdfVerticalAlignment.middle:n=(e-t)/2;break;case M.PdfVerticalAlignment.bottom:n=e-t}return n},c.prototype._getHorizontalAlignShift=function(t,e,i){var n=0;if(0<=e&&null!=i&&i.alignment!==M.PdfTextAlignment.left)switch(i.alignment){case M.PdfTextAlignment.center:n=(e-t)/2;break;case M.PdfTextAlignment.right:n=e-t}return n},c.prototype._getLineIndent=function(t,e,i,n){var r=0,t=0<(t._lineType&M._LineType.firstParagraphLine);return e&&t&&(r=n?e.firstLineIndent:e.paragraphIndent,r=0<i?Math.min(i,r):r),r},c.prototype._drawAsciiLine=function(t,e,i,n){this._justifyLine(t,e,i,n);var r="";if(-1!==t._text.indexOf("(")||-1!==t._text.indexOf(")")||-1!==t._text.indexOf("\\")||-1!==t._text.indexOf("\r"))for(var s=t._text,a=0,o=s.length;a<o;a++){var h=s[a];r+="("===h?"\\(":")"===h?"\\)":"\\"===h?"\\\\":"\r"===h?"\\r":h}""===r&&(r=t._text),this._sw._showNextLineText("("+r+")")},c.prototype._justifyLine=function(t,e,i,n){var r=t._text,s=t._width,t=this._shouldJustify(t,e,i,n),a=i&&0!==i.wordSpacing,n=n._getCharacterCount(r,[" ","\t"]),r=0;return t?(a&&(s-=n*i.wordSpacing),this._sw._setWordSpacing(r=(e-s)/n)):i&&i.alignment===M.PdfTextAlignment.justify&&this._sw._setWordSpacing(0),r},c.prototype._shouldJustify=function(t,e,i,n){var r=t._text,s=t._width,i=i&&i.alignment===M.PdfTextAlignment.justify,s=0<=e&&s<e,e=0<n._getCharacterCount(r,[" ","\t"])&&" "!==r[0],n=0<(t._lineType&M._LineType.layoutBreak);return i&&s&&e&&n},c.prototype._underlineStrikeoutText=function(t,e,i,n,r){if(i.isUnderline||i.isStrikeout){var s=this._createUnderlineStrikeoutPen(t,i);if(null!=s)for(var t=this._getTextVerticalAlignShift(e._actualSize.height,n[3],r),a=n[1]+t+i._getAscent(r)+1.5*s._width,o=n[1]+t+i._getHeight(r)/2+1.5*s._width,h=e._lines,c=0,_=h.length;c<_;c++){var d=h[c],l=d._width,u=this._getHorizontalAlignShift(l,n[2],r),p=this._getLineIndent(d,r,n[2],0===c),u=n[0]+u,d=this._shouldJustify(d,n[2],r,i)?u+n[2]-p:u+l-p;i.isUnderline&&(this.drawLine(s,{x:u,y:a},{x:d,y:a}),a+=e._lineHeight),i.isStrikeout&&(this.drawLine(s,{x:u,y:o},{x:d,y:o}),o+=e._lineHeight)}}},c.prototype._createUnderlineStrikeoutPen=function(t,e){t=t?t._color:void 0;return new x(t,e._size/20)},c.prototype._checkCorrectLayoutRectangle=function(t,e,i,n){var r=[e,i,t[0],t[0]];if(n){switch(n.alignment){case M.PdfTextAlignment.center:r[0]=r[0]-r[2]/2;break;case M.PdfTextAlignment.right:r[0]=r[0]-r[2]}switch(n.lineAlignment){case M.PdfVerticalAlignment.middle:r[1]=r[1]-r[3]/2;break;case M.PdfVerticalAlignment.bottom:r[1]=r[1]-r[3]}}return r},c.prototype._drawGraphicsPath=function(t,e,i,n){e=null!=e,t=null!=t,i=(i=void 0===i?M.PdfFillMode.winding:i)===M.PdfFillMode.alternate;t&&e?n?this._sw._closeFillStrokePath(i):this._sw._fillStrokePath(i):t||e?t?n?this._sw._closeStrokePath():this._sw._strokePath():n?this._sw._closeFillPath(i):this._sw._fillPath(i):this._sw._endPath()},c.prototype._initializeCoordinates=function(t){var e,i,n,r;t?(i=!(e=[0,0]),t._pageDictionary.has("CropBox")&&t._pageDictionary.has("MediaBox")&&(n=t._pageDictionary.getArray("CropBox"),r=t._pageDictionary.getArray("MediaBox"),n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3]&&(i=!0),0<n[0]&&0<n[3]&&r[0]<0&&r[1]<0?(this.translateTransform({x:n[0],y:-n[3]}),e[0]=-n[0],e[1]=n[3]):t._pageDictionary.has("CropBox")||(i=!0),i)&&(this._sw._writeComment("Change co-ordinate system to left/top."),this._cropBox?this.translateTransform({x:this._cropBox[0],y:-this._cropBox[3]}):-t._origin[1]<this._mediaBoxUpperRightBound||0===this._mediaBoxUpperRightBound?this.translateTransform({x:0,y:-this._size.height}):this.translateTransform({x:0,y:-this._mediaBoxUpperRightBound}))):(this._sw._writeComment("Change co-ordinate system to left/top."),this._mediaBoxUpperRightBound!==-this._size.height&&(this._cropBox&&(0<(n=this._cropBox)[0]||0<n[1]||this._size.width===n[2]||this._size.height===n[3])?this.translateTransform({x:n[0],y:-n[3]}):this._mediaBoxUpperRightBound===this._size.height||0===this._mediaBoxUpperRightBound?this.translateTransform({x:0,y:-this._size.height}):this.translateTransform({x:0,y:-this._mediaBoxUpperRightBound})))},c.prototype._setTransparencyData=function(t,e){this._resourceMap.set(t,e);var i=this._crossReference._fetch(t),n=0,r=0,s=0,n=(i&&(i.has("CA")&&(n=i.get("CA")),i.has("ca")&&(r=i.get("ca")),i.has("ca")&&(r=i.get("ca")),i.has("BM"))&&(s=$s(i.get("BM"))),"CA:"+n.toString()+"_ca:"+r.toString()+"_BM:"+s.toString()),r=new Lr;r._dictionary=i,r._key=n,r._name=e,r._reference=t,this._transparencies.set(r,n)},c.prototype._getTranslateTransform=function(t,e,i){return i._translate(t,-e),i},c.prototype._getScaleTransform=function(t,e,i){return(i=null==i?new Rr:i)._scale(t,e),i},c.prototype._clipTranslateMargins=function(t){this._clipBounds=t,this._sw._writeComment("Clip margins."),this._sw._appendRectangle(t[0],t[1],t[2],t[3]),this._sw._closePath(),this._sw._clipPath(!1),this._sw._writeComment("Translate co-ordinate system."),this.translateTransform({x:t[0],y:t[1]})},c.prototype._clipTranslateMarginsWithBounds=function(t){var e=[t[2],t[3],this._size.width-t[2]-t[4],this._size.height-t[3]-t[4]];this._clipBounds=e,this._sw._writeComment("Clip margins."),this._sw._appendRectangle(e[0],e[1],e[2],e[3]),this._sw._closePath(),this._sw._clipPath(!1),this._sw._writeComment("Translate co-ordinate system."),this.translateTransform({x:t[0],y:t[1]})},c.prototype._skewTransform=function(t,e){var i=new Rr;this._getSkewTransform(t,e,i),this._sw._modifyCtm(i),i._multiply(i)},c.prototype._getSkewTransform=function(t,e,i){return i._skew(-t,-e),i};var kr=c;function c(t,e,i,n){var r;this._pendingResource=[],this._isItalic=!1,this._isLayouter=!1,this._hasResourceReference=!1,n instanceof br?(this._source=n._pageDictionary,this._page=n):n instanceof P&&(this._source=n._content.dictionary,this._template=n),this._source&&(n=void 0,this._source.has("Resources")?n=this._source.getRaw("Resources"):this._source.has("Parent")&&(r=this._source.get("Parent"))&&r.has("Resources")&&(n=r.getRaw("Resources"))&&n instanceof D&&this._source.update("Resources",n),n&&n instanceof m?(this._hasResourceReference=!0,this._resourceObject=i._fetch(n),this._resourceObject&&this._resourceObject instanceof g&&(this._resourceObject=this._resourceObject.dictionary)):n&&n instanceof D?this._resourceObject=n:(this._resourceObject=new D,this._source.update("Resources",this._resourceObject))),this._crossReference=i,this._sw=new Ar(e),this._size=t,ea("PDF",this._resourceObject),this._initialize()}Fr.prototype._translate=function(t,e){this._matrix._translate(t,e)},Fr.prototype._scale=function(t,e){this._matrix._elements[0]=t,this._matrix._elements[3]=e},Fr.prototype._rotate=function(t){t=t*Math.PI/180,this._matrix._elements[0]=Math.cos(t),this._matrix._elements[1]=Math.sin(t),this._matrix._elements[2]=-Math.sin(t),this._matrix._elements[3]=Math.cos(t)},Fr.prototype._multiply=function(t){this._matrix._multiply(t._matrix)},Fr.prototype._toString=function(){var e="";return this._matrix._elements.forEach(function(t){e+=ta(t)+" "}),e},Fr.prototype._skew=function(t,e){t=Math.tan(this._degreeToRadians(t)),e=Math.tan(this._degreeToRadians(e)),t=new Ir(1,t,e,1,0,0);this._matrix._multiply(t)},Fr.prototype._degreeToRadians=function(t){return Math.PI/180*t};var Rr=Fr;function Fr(){this._matrix=new Ir(1,0,0,1,0,0)}Object.defineProperty(Dr.prototype,"_offsetX",{get:function(){return this._elements[4]},enumerable:!0,configurable:!0}),Object.defineProperty(Dr.prototype,"_offsetY",{get:function(){return this._elements[5]},enumerable:!0,configurable:!0}),Dr.prototype._clone=function(){return new Dr(this._elements.slice())},Dr.prototype._translate=function(t,e){this._elements[4]=t,this._elements[5]=e},Dr.prototype._transform=function(t){var e=t.x,t=t.y;return{x:e*this._elements[0]+t*this._elements[2]+this._offsetX,y:e*this._elements[1]+t*this._elements[3]+this._offsetY}},Dr.prototype._multiply=function(t){this._elements=[this._elements[0]*t._elements[0]+this._elements[1]*t._elements[2],this._elements[0]*t._elements[1]+this._elements[1]*t._elements[3],this._elements[2]*t._elements[0]+this._elements[3]*t._elements[2],this._elements[2]*t._elements[1]+this._elements[3]*t._elements[3],this._offsetX*t._elements[0]+this._offsetY*t._elements[2]+t._offsetX,this._offsetX*t._elements[1]+this._offsetY*t._elements[3]+t._offsetY]};var Ir=Dr;function Dr(t,e,i,n,r,s){this._elements=void 0===t?[]:"number"==typeof t?[t,e,i,n,r,s]:t}var Br=function(t,e){t&&(this._g=t,this._transformationMatrix=e),this._charSpacing=0,this._wordSpacing=0,this._textScaling=100,this._textRenderingMode=M._TextRenderingMode.fill},Lr=function(){},A=((t=M._TextRenderingMode||(M._TextRenderingMode={}))[t.fill=0]="fill",t[t.stroke=1]="stroke",t[t.fillStroke=2]="fillStroke",t[t.none=3]="none",t[t.clipFlag=4]="clipFlag",t[t.clipFill=4]="clipFill",t[t.clipStroke=5]="clipStroke",t[t.clipFillStroke=6]="clipFillStroke",t[t.clip=7]="clip",function(t){this._color=void 0!==t?t:{r:0,g:0,b:0}}),x=(Object.defineProperty(Or.prototype,"color",{get:function(){return this._color},set:function(t){k(t)&&(this._color=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Or.prototype,"width",{get:function(){return this._width},set:function(t){!Number.isNaN(t)&&0<t&&(this._width=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Or.prototype,"dashOffset",{get:function(){return this._dashOffset},set:function(t){!Number.isNaN(t)&&0<t&&(this._dashOffset=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Or.prototype,"dashPattern",{get:function(){return this._dashPattern},set:function(t){Array.isArray(t)&&0<t.length&&(this._dashPattern=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Or.prototype,"dashStyle",{get:function(){return this._dashStyle},set:function(t){!Number.isNaN(t)&&t>=M.PdfDashStyle.solid&&t<=M.PdfDashStyle.custom&&(this._dashStyle=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Or.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){!Number.isNaN(t)&&k(t)&&(this._miterLimit=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Or.prototype,"lineCap",{get:function(){return this._lineCap},set:function(t){!Number.isNaN(t)&&t>=M.PdfLineCap.flat&&t<=M.PdfLineCap.square&&(this._lineCap=t)},enumerable:!0,configurable:!0}),Object.defineProperty(Or.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){!Number.isNaN(t)&&t>=M.PdfLineJoin.miter&&t<=M.PdfLineJoin.bevel&&(this._lineJoin=t)},enumerable:!0,configurable:!0}),Or);function Or(t,e,i){this._color=t,this._width=e,this._dashOffset=0,this._dashPattern=[],this._dashStyle=M.PdfDashStyle.solid,this._miterLimit=0,this._lineCap=M.PdfLineCap.flat,this._lineJoin=M.PdfLineJoin.miter,i&&(k(i.dashOffset)&&(this._dashOffset=i.dashOffset),k(i.dashPattern)&&Array.isArray(i.dashPattern)&&(this._dashPattern=i.dashPattern),k(i.dashStyle)&&(this._dashStyle=i.dashStyle),k(i.miterLimit)&&(this._miterLimit=i.miterLimit),k(i.lineCap)&&(this._lineCap=i.lineCap),k(i.lineJoin))&&(this._lineJoin=i.lineJoin)}Er.prototype._updateProportions=function(t){return[t/2.54,t/6,1,t/72,t,t/300,t/25.4]},Er.prototype._convertUnits=function(t,e,i){return this._convertFromPixels(this._convertToPixels(t,e),i)},Er.prototype._convertFromPixels=function(t,e){return t/this._proportions[e]},Er.prototype._convertToPixels=function(t,e){return t*this._proportions[e]};var Mr=Er;function Er(){this._horizontalResolution=96,this._proportions=this._updateProportions(this._horizontalResolution)}Nr.prototype._reset=function(){this._position=0},Nr.prototype._getBuffer=function(t){return this._stream[t]},Nr.prototype._read=function(t,e,i,n){if(n&&Array.isArray(n)){var r=0;if(i<=n.length&&n.length-e>=i)for(var s=0;s<i;s++)t[s]=n[e],e++,r++;return{outputBuffer:t,offset:e,length:r}}for(var a=e;a<i;a++){var o=this._position;t[a]=this._getBuffer(o),this._position++}},Nr.prototype._readString=function(t){for(var e="",i=0;i<t;i++)e+=String.fromCharCode(this._readByte());return e},Nr.prototype._seek=function(t){this._position+=t},Nr.prototype._readByte=function(){var t;if(this._position<this._stream.byteLength)return t=this._getBuffer(this._position),this._position+=1,t;throw new Error("Error decoding JPEG image. Invalid offset.")},Nr.prototype._toUnsigned16=function(t){return(t&=65535)<0?t+65536:t},Nr.prototype._readUnsigned32=function(t){return this._getBuffer(t+3)|this._getBuffer(t+2)<<8|this._getBuffer(t+1)<<16|this._getBuffer(t)<<24};t=Nr;function Nr(){this._format=M._ImageFormat.unknown,this._height=0,this._width=0,this._bitsPerComponent=8,this._position=0,this._noOfComponents=-1}jr=function(t,e){return(jr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}jr(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Ur,Vr=t),Object.defineProperty(Ur.prototype,"_imageDataAsNumberArray",{get:function(){return this._imageData},enumerable:!0,configurable:!0}),Ur.prototype._initialize=function(){this._format=M._ImageFormat.jpeg,this._readHeader(),this._reset(),this._imageData=new Uint8Array(this._stream.byteLength),this._read(this._imageData,0,this._imageData.byteLength)},Ur.prototype._readHeader=function(){this._reset();for(var t=new Uint8Array(this._stream.byteLength),e=(this._read(t,0,t.byteLength),4),i=256*this._getBuffer(e)+this._getBuffer(e+1),n=!1;e<t.byteLength;){if(!((e+=i)<t.byteLength)){n=!0;break}if(192===this._getBuffer(e+1)){if(this._height=256*this._getBuffer(e+5)+this._getBuffer(e+6),this._width=256*this._getBuffer(e+7)+this._getBuffer(e+8),this._noOfComponents=this._getBuffer(e+9),0!==this._width&&0!==this._height)return}else e+=2,i=256*this._getBuffer(e)+this._getBuffer(e+1)}n&&(this._reset(),this._seek(2),this._readExceededJpegImage())},Ur.prototype._getImageDictionary=function(){if(!(this._imageStream&&0<this._imageStream.length)){this._imageStream=new g([],new D),this._imageStream.isImageStream=!0;for(var t=this._imageDataAsNumberArray.byteLength,e=(this._imageStream.bytes=new Uint8Array(t),0);e<t;e+=1024)for(var i=Math.min(1024,t-e),n=0;n<i;n++)this._imageStream.bytes[e+n]=this._getBuffer(e+n);this._imageStream._isCompress=!1;var r=new D;r.set("Type",new R("XObject")),r.set("Subtype",new R("Image")),r.set("Width",this._width),r.set("Height",this._height),r.set("BitsPerComponent",this._bitsPerComponent),r.set("Filter",new R("DCTDecode")),r.set("ColorSpace",new R(this._getColorSpace())),r.set("DecodeParms",this._getDecodeParams()),this._imageStream.dictionary=r,this._imageStream.end=this._imageStream.bytes.length,this._imageStream.dictionary._updated=!0}return this._imageStream},Ur.prototype._getColorSpace=function(){return 1===this._noOfComponents?"DeviceGray":4===this._noOfComponents?"DeviceCMYK":"DeviceRGB"},Ur.prototype._getDecodeParams=function(){var t=new D;return t.set("Columns",this._width),t.set("BlackIs1",!0),t.set("K",-1),t.set("Predictor",15),t.set("BitsPerComponent",this._bitsPerComponent),t},Ur.prototype._skipStream=function(){var t=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1);if(this._seek(2),t<2)throw new Error("Error decoding JPEG image");0<t&&this._seek(t-2)},Ur.prototype._readExceededJpegImage=function(){for(var t=!0;t;)switch(this._getMarker()){case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:this._seek(3),this._height=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1),this._seek(2),this._width=this._getBuffer(this._position)<<8|this._getBuffer(this._position+1),this._seek(2),this._noOfComponents=this._getBuffer(this._position),this._seek(1),t=!1;break;default:this._skipStream()}},Ur.prototype._getMarker=function(){for(var t=0,e=this._readByte();255!==e;)t++,e=this._readByte();for(;255===(e=this._readByte()););if(0!==t)throw new Error("Error decoding JPEG image");return this._toUnsigned16(e)};var jr,Vr,zr=Ur;function Ur(t){var e=Vr.call(this)||this;return e._stream=t,e._initialize(),e}(d=M._InflaterState||(M._InflaterState={}))[d.readingHeader=0]="readingHeader",d[d.readingBFinal=1]="readingBFinal",d[d.readingBType=2]="readingBType",d[d.readingNlCodes=3]="readingNlCodes",d[d.readingNdCodes=4]="readingNdCodes",d[d.readingCodes=5]="readingCodes",d[d.readingClCodes=6]="readingClCodes",d[d.readingTcBefore=7]="readingTcBefore",d[d.readingTcAfter=8]="readingTcAfter",d[d.decodeTop=9]="decodeTop",d[d.iLength=10]="iLength",d[d.fLength=11]="fLength",d[d.dCode=12]="dCode",d[d.unCompressedAligning=13]="unCompressedAligning",d[d.unCompressedByte1=14]="unCompressedByte1",d[d.unCompressedByte2=15]="unCompressedByte2",d[d.unCompressedByte3=16]="unCompressedByte3",d[d.unCompressedByte4=17]="unCompressedByte4",d[d.decodeUnCompressedBytes=18]="decodeUnCompressedBytes",d[d.srFooter=19]="srFooter",d[d.rFooter=20]="rFooter",d[d.vFooter=21]="vFooter",d[d.done=22]="done",(d=M._BlockType||(M._BlockType={}))[d.unCompressedType=0]="unCompressedType",d[d.staticType=1]="staticType",d[d.dynamicType=2]="dynamicType";Object.defineProperty(Wr.prototype,"_unusedBytes",{get:function(){return Wr._dOutSize-this._usedBytes},enumerable:!0,configurable:!0}),Wr.prototype._write=function(t){this._dOutput[this._end++]=t,this._end&=Wr._dOutMask,++this._usedBytes},Wr.prototype._writeLD=function(t,e){this._usedBytes+=t;var i=this._end-e&Wr._dOutMask,n=Wr._dOutSize-t;if(i<=n&&this._end<n)if(t<=e)hs(this._dOutput,this._end,this._dOutput,i,i+t),this._end+=t;else for(;0<t--;)this._dOutput[this._end++]=this._dOutput[i++];else for(;0<t--;)this._dOutput[this._end++]=this._dOutput[i++],this._end&=Wr._dOutMask,i&=Wr._dOutMask},Wr.prototype._copyFrom=function(t,e){e=Math.min(Math.min(e,Wr._dOutSize-this._usedBytes),t._bytes);var i,n=Wr._dOutSize-this._end;return n<e?(i=t._copyTo(this._dOutput,this._end,n))===n&&(i+=t._copyTo(this._dOutput,0,e-n)):i=t._copyTo(this._dOutput,this._end,e),this._end=this._end+i&Wr._dOutMask,this._usedBytes+=i,i},Wr.prototype._copyTo=function(t,e,i){i>this._usedBytes?(n=this._end,i=this._usedBytes):n=this._end-this._usedBytes+i&Wr._dOutMask;var n,r=i,s=i-n,a=Wr._dOutSize-s;if(0<s){for(var o=0;o<s&&o+a<this._dOutput.length&&o+e<t.length;o++)t[e+o]=this._dOutput[a+o];var h=Wr._dOutSize-s;hs(t,e,this._dOutput,h,h+s),e+=s,i=n}a=n-i;return hs(t,e,this._dOutput,n-i,n),this._usedBytes-=r,{count:r,data:t}},Wr._dOutSize=32768,Wr._dOutMask=32767;var Hr=Wr;function Wr(){this._end=0,this._usedBytes=0,this._dOutput=Array(Wr._dOutSize).fill(0),this._end=0,this._usedBytes=0}Object.defineProperty(Gr.prototype,"_bytes",{get:function(){return this._end-this._begin+Math.floor(this._bInBuffer/8)},enumerable:!0,configurable:!0}),Gr.prototype._needsInput=function(){return this._begin===this._end},Gr.prototype._availableBits=function(t){if(this._bInBuffer<t){if(this._needsInput())return!1;if(this._bBuffer|=as(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8,this._bInBuffer<t){if(this._needsInput())return!1;this._bBuffer|=as(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8}}return!0},Gr.prototype._load16Bits=function(){return this._bInBuffer<8?(this._begin<this._end&&(this._bBuffer|=as(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8),this._begin<this._end&&(this._bBuffer|=as(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8)):this._bInBuffer<16&&this._begin<this._end&&(this._bBuffer|=as(this._buffer[this._begin++],32)<<this._bInBuffer,this._bInBuffer+=8),this._bBuffer},Gr.prototype._getBitMask=function(t){return(as(1,32)<<t)-1},Gr.prototype._getBits=function(t){var e;return this._availableBits(t)?(e=this._bBuffer&this._getBitMask(t),this._bBuffer>>=t,this._bInBuffer-=t,e):-1},Gr.prototype._copyTo=function(t,e,i){for(var n=0;0<this._bInBuffer&&0<i;)t[e++]=as(this._bBuffer,8),this._bBuffer>>=8,this._bInBuffer-=8,i--,n++;if(0===i)return n;var r=this._end-this._begin;r<i&&(i=r);for(var s=0;s<i&&s+this._begin<this._buffer.length&&s+e<t.length;s++)t[e+s]=this._buffer[this._begin+s];return this._begin+=i,n+i},Gr.prototype._setInput=function(t,e,i){this._buffer=t,this._begin=e,this._end=e+i},Gr.prototype._skipBits=function(t){this._bBuffer>>=t,this._bInBuffer-=t},Gr.prototype._skipByteBoundary=function(){this._bBuffer>>=this._bInBuffer%8,this._bInBuffer=this._bInBuffer-this._bInBuffer%8};var qr=Gr;function Gr(){this._bBuffer=0,this._bInBuffer=0,this._begin=0,this._end=0}Xr.prototype._load=function(t){this._clArray=t,this._initialize()},Xr.prototype._loadTree=function(t){this._clArray=t?this._getLengthTree():this._getDepthTree(),this._initialize()},Xr.prototype._initialize=function(){this._clArray.length===Xr._maxLengthTree?this._tBits=9:this._tBits=7,this._tMask=(1<<this._tBits)-1,this._createTable()},Xr.prototype._getLengthTree=function(){for(var t=Array(Xr._maxLengthTree).fill(0),e=0;e<=143;e++)t[e]=as(8,8);for(e=144;e<=255;e++)t[e]=as(9,8);for(e=256;e<=279;e++)t[e]=as(7,8);for(e=280;e<=287;e++)t[e]=as(8,8);return t},Xr.prototype._getDepthTree=function(){return Array(Xr._maxDepthTree).fill(5)},Xr.prototype._calculateHashCode=function(){for(var t=Array(17).fill(0),e=0;e<this._clArray.length;e++)t[this._clArray[e]]++;t[0]=0;for(var i=Array(17).fill(0),n=0,r=1;r<=16;r++)n=n+t[r-1]<<1,i[r]=n;for(var s=Array(Xr._maxLengthTree).fill(0),e=0;e<this._clArray.length;e++){var a=this._clArray[e];0<a&&(s[e]=this._bitReverse(i[a],a),i[a]++)}return s},Xr.prototype._bitReverse=function(t,e){for(var i=0;i=(i|1&t)<<1,t>>=1,0<--e;);return i>>1},Xr.prototype._createTable=function(){for(var t=this._calculateHashCode(),e=(this._table=Array(1<<this._tBits).fill(0),this._left=Array(2*this._clArray.length).fill(0),this._right=Array(2*this._clArray.length).fill(0),os(this._clArray.length)),i=0;i<this._clArray.length;i++){var n=this._clArray[i];if(0<n){var r=t[i];if(n<=this._tBits){var s=1<<n;if(s<=r)throw new Error("Invalid Data.");for(var a=1<<this._tBits-n,o=0;o<a;o++)this._table[r]=os(i),r+=s}else{var h=n-this._tBits,c=1<<this._tBits,_=r&(1<<this._tBits)-1,d=this._table;do{var l=os(d[_]);if(0===l&&(d[_]=os(-e),l=os(-e),e++),0<l)throw new Error("Invalid Data.")}while(d=0==(r&c)?this._left:this._right,_=-l,c<<=1,0!==--h);d[_]=os(i)}}}},Xr.prototype._getNextSymbol=function(t){var e=t._load16Bits();if(0===t._bInBuffer)return-1;var i=this._table[e&this._tMask];if(i<0)for(var n=as(1<<this._tBits,32);i=(0==(e&n)?this._left:this._right)[i=-i],n<<=1,i<0;);var r=this._clArray[i];if(r<=0)throw new Error("Invalid Data.");return r>t._bInBuffer?-1:(t._skipBits(r),i)},Xr._maxLengthTree=288,Xr._maxDepthTree=32,Xr._nCLength=19;var Kr=Xr;function Xr(){}Object.defineProperty(Yr.prototype,"_finished",{get:function(){return this._inflaterState===M._InflaterState.done||this._inflaterState===M._InflaterState.vFooter},enumerable:!0,configurable:!0}),Yr.prototype._setInput=function(t,e,i){this._input._setInput(t,e,i)},Yr.prototype._inflate=function(t,e,i){var n=0;do{var r=this._output._copyTo(t,e,i),s=r.count}while((t=r.data,0<s&&(e+=s,n+=s,i-=s),0!==i)&&(!this._finished&&this._decode()));return{count:n,data:t}},Yr.prototype._decode=function(){var t,e=!1,i=!1;if(this._finished)return!0;if(this._inflaterState===M._InflaterState.readingBFinal){if(!this._input._availableBits(1))return!1;this._bfinal=this._input._getBits(1),this._inflaterState=M._InflaterState.readingBType}if(this._inflaterState===M._InflaterState.readingBType){if(!this._input._availableBits(2))return this._inflaterState=M._InflaterState.readingBType,!1;this._blockType=this._getBlockType(this._input._getBits(2)),this._blockType===M._BlockType.dynamicType?this._inflaterState=M._InflaterState.readingNlCodes:this._blockType===M._BlockType.staticType?(this._llTree=new Kr,this._llTree._loadTree(!0),this._distanceTree=new Kr,this._distanceTree._loadTree(!1),this._inflaterState=M._InflaterState.decodeTop):this._blockType===M._BlockType.unCompressedType&&(this._inflaterState=M._InflaterState.unCompressedAligning)}return this._blockType===M._BlockType.dynamicType?this._getInflaterStateValue(this._inflaterState)<this._getInflaterStateValue(M._InflaterState.decodeTop)?i=this._decodeDynamicBlockHeader():(i=(t=this._decodeBlock(e)).result,e=t.eob,this._output=t.output):this._blockType===M._BlockType.staticType?(i=(t=this._decodeBlock(e)).result,e=t.eob,this._output=t.output):this._blockType===M._BlockType.unCompressedType&&(i=(t=this._decodeUncompressedBlock(e)).result,e=t.eob,this._output=t.output),e&&0!==this._bfinal&&(this._inflaterState=M._InflaterState.done),i},Yr.prototype._decodeUncompressedBlock=function(t){for(t=!1;;)switch(this._inflaterState){case M._InflaterState.unCompressedAligning:if(this._input._skipByteBoundary(),this._inflaterState=M._InflaterState.unCompressedByte1,this._unCompressedByte())break;return{result:!1,eob:t,output:this._output};case M._InflaterState.unCompressedByte1:case M._InflaterState.unCompressedByte2:case M._InflaterState.unCompressedByte3:case M._InflaterState.unCompressedByte4:if(this._unCompressedByte())break;return{result:!1,eob:t,output:this._output};case M._InflaterState.decodeUnCompressedBytes:return this._bLength-=this._output._copyFrom(this._input,this._bLength),0===this._bLength?(this._inflaterState=M._InflaterState.readingBFinal,{result:t=!0,eob:t,output:this._output}):0===this._output._unusedBytes?{result:!0,eob:t,output:this._output}:{result:!1,eob:t,output:this._output}}},Yr.prototype._unCompressedByte=function(){var t=this._input._getBits(8);if(t<0)return!1;var e=this._getInflaterStateValue(this._inflaterState),i=this._getInflaterStateValue(M._InflaterState.unCompressedByte1);if(this._blBuffer[e-i]=as(t,8),this._inflaterState===M._InflaterState.unCompressedByte4&&(this._bLength=this._blBuffer[0]+256*this._blBuffer[1],as(this._bLength,16)!==as(~(this._blBuffer[2]+256*this._blBuffer[3]),16)))throw new Error("Ivalid block length.");return this._inflaterState=this._getInflaterState(this._getInflaterStateValue(this._inflaterState)+1),!0},Yr.prototype._decodeBlock=function(t){t=!1;for(var e=this._output._unusedBytes;258<e;){var i,n=void 0,r=void 0;switch(this._inflaterState){case M._InflaterState.decodeTop:if((n=this._llTree._getNextSymbol(this._input))<0)return{result:!1,eob:t,output:this._output};if(n<256)this._output._write(as(n,8)),--e;else{if(256===n)return t=!0,this._inflaterState=M._InflaterState.readingBFinal,{result:!0,eob:t,output:this._output};if((n-=257)<8)n+=3,this._extraBits=0;else if(28===n)n=258,this._extraBits=0;else{if(n<0||n>=this._extraLengthBits.length)throw new Error("Invalid data.");this._extraBits=this._extraLengthBits[n]}if(this._length=n,e=(r=this._inLength(e)).fb,!r.value)return{result:!1,eob:t,output:this._output}}break;case M._InflaterState.iLength:if(e=(r=this._inLength(e)).fb,r.value)break;return{result:!1,eob:t,output:this._output};case M._InflaterState.fLength:if(e=(i=this._fLength(e)).fb,i.value)break;return{result:!1,eob:t,output:this._output};case M._InflaterState.dCode:if(e=(i=this._dcode(e)).fb,i.value)break;return{result:!1,eob:t,output:this._output}}}return{result:!0,eob:t,output:this._output}},Yr.prototype._inLength=function(t){if(0<this._extraBits){this._inflaterState=M._InflaterState.iLength;var e=this._input._getBits(this._extraBits);if(e<0)return{value:!1,fb:t};if(this._length<0||this._length>=this._lengthBase.length)throw new Error("Invalid data.");this._length=this._lengthBase[this._length]+e}this._inflaterState=M._InflaterState.fLength;e=this._fLength(t);return t=e.fb,e.value?{value:!0,fb:t}:{value:!1,fb:t}},Yr.prototype._fLength=function(t){if(this._blockType===M._BlockType.dynamicType?this._distanceCode=this._distanceTree._getNextSymbol(this._input):(this._distanceCode=this._input._getBits(5),0<=this._distanceCode&&(this._distanceCode=this._staticDistanceTreeTable[this._distanceCode])),this._distanceCode<0)return{value:!1,fb:t};this._inflaterState=M._InflaterState.dCode;var e=this._dcode(t);return t=e.fb,e.value?{value:!0,fb:t}:{value:!1,fb:t}},Yr.prototype._dcode=function(t){if(3<this._distanceCode){this._extraBits=this._distanceCode-2>>1;var e=this._input._getBits(this._extraBits);if(e<0)return{value:!1,fb:t};e=this._distanceBasePosition[this._distanceCode]+e}else e=this._distanceCode+1;return this._output._writeLD(this._length,e),t-=this._length,this._inflaterState=M._InflaterState.decodeTop,{value:!0,fb:t}},Yr.prototype._decodeDynamicBlockHeader=function(){switch(this._inflaterState){case M._InflaterState.readingNlCodes:if(this._llCodeCount=this._input._getBits(5),this._llCodeCount<0||(this._llCodeCount+=257,this._inflaterState=M._InflaterState.readingNdCodes,!this._readingNDCodes()))return!1;break;case M._InflaterState.readingNdCodes:if(this._readingNDCodes())break;return!1;case M._InflaterState.readingCodes:if(this._readingCodes())break;return!1;case M._InflaterState.readingClCodes:if(this._readingCLCodes())break;return!1;case M._InflaterState.readingTcBefore:case M._InflaterState.readingTcAfter:if(this._readingTCBefore())break;return!1}var t=Array(Kr._maxLengthTree).fill(0),e=(hs(t,0,this._codeList,0,this._llCodeCount),Array(Kr._maxDepthTree).fill(0));return hs(e,0,this._codeList,this._llCodeCount,this._llCodeCount+this._dCodeCount),this._llTree=new Kr,this._llTree._load(t),this._distanceTree=new Kr,this._distanceTree._load(e),this._inflaterState=M._InflaterState.decodeTop,!0},Yr.prototype._readingNDCodes=function(){return this._dCodeCount=this._input._getBits(5),!(this._dCodeCount<0||(this._dCodeCount+=1,this._inflaterState=M._InflaterState.readingCodes,!this._readingCodes()))},Yr.prototype._readingCodes=function(){return this._clCodeCount=this._input._getBits(4),!(this._clCodeCount<0||(this._clCodeCount+=4,this._loopCounter=0,this._inflaterState=M._InflaterState.readingClCodes,!this._readingCLCodes()))},Yr.prototype._readingCLCodes=function(){for(;this._loopCounter<this._clCodeCount;){var t=this._input._getBits(3);if(t<0)return!1;this._cltcl[this._codeOrder[this._loopCounter]]=as(t,8),++this._loopCounter}for(var e=this._clCodeCount;e<this._codeOrder.length;e++)this._cltcl[this._codeOrder[e]]=0;return this._clTree=new Kr,this._clTree._load(this._cltcl),this._caSize=this._llCodeCount+this._dCodeCount,this._loopCounter=0,this._inflaterState=M._InflaterState.readingTcBefore,!!this._readingTCBefore()},Yr.prototype._readingTCBefore=function(){for(;this._loopCounter<this._caSize;){if(this._inflaterState===M._InflaterState.readingTcBefore&&(this._lengthCode=this._clTree._getNextSymbol(this._input),this._lengthCode<0))return!1;if(this._lengthCode<=15)this._codeList[this._loopCounter++]=as(this._lengthCode,8);else{if(!this._input._availableBits(7))return this._inflaterState=M._InflaterState.readingTcAfter,!1;var t=void 0;if(16===this._lengthCode){if(0===this._loopCounter)throw new Error("Invalid data.");var e=as(this._codeList[this._loopCounter-1],8),t=this._input._getBits(2)+3;if(this._loopCounter+t>this._caSize)throw new Error("Invalid data.");for(var i=0;i<t;i++)this._codeList[this._loopCounter++]=e}else{if(17===this._lengthCode){if(t=this._input._getBits(3)+3,this._loopCounter+t>this._caSize)throw new Error("Invalid data.")}else if(t=this._input._getBits(7)+11,this._loopCounter+t>this._caSize)throw new Error("Invalid data.");for(i=0;i<t;i++)this._codeList[this._loopCounter++]=0}}this._inflaterState=M._InflaterState.readingTcBefore}return!0},Yr.prototype._getBlockType=function(t){return t===M._BlockType.unCompressedType?M._BlockType.unCompressedType:t===M._BlockType.staticType?M._BlockType.staticType:M._BlockType.dynamicType},Yr.prototype._getInflaterState=function(t){switch(t){case 0:return M._InflaterState.readingHeader;case 2:return M._InflaterState.readingBFinal;case 3:return M._InflaterState.readingBType;case 4:return M._InflaterState.readingNlCodes;case 5:return M._InflaterState.readingNdCodes;case 6:return M._InflaterState.readingCodes;case 7:return M._InflaterState.readingClCodes;case 8:return M._InflaterState.readingTcBefore;case 9:return M._InflaterState.readingTcAfter;case 10:return M._InflaterState.decodeTop;case 11:return M._InflaterState.iLength;case 12:return M._InflaterState.fLength;case 13:return M._InflaterState.dCode;case 15:return M._InflaterState.unCompressedAligning;case 16:return M._InflaterState.unCompressedByte1;case 17:return M._InflaterState.unCompressedByte2;case 18:return M._InflaterState.unCompressedByte3;case 19:return M._InflaterState.unCompressedByte4;case 20:return M._InflaterState.decodeUnCompressedBytes;case 21:return M._InflaterState.srFooter;case 22:return M._InflaterState.rFooter;case 23:return M._InflaterState.vFooter;case 24:return M._InflaterState.done;default:return M._InflaterState.readingHeader}},Yr.prototype._getInflaterStateValue=function(t){switch(t){case M._InflaterState.readingHeader:return 0;case M._InflaterState.readingBFinal:return 2;case M._InflaterState.readingBType:return 3;case M._InflaterState.readingNlCodes:return 4;case M._InflaterState.readingNdCodes:return 5;case M._InflaterState.readingCodes:return 6;case M._InflaterState.readingClCodes:return 7;case M._InflaterState.readingTcBefore:return 8;case M._InflaterState.readingTcAfter:return 9;case M._InflaterState.decodeTop:return 10;case M._InflaterState.iLength:return 11;case M._InflaterState.fLength:return 12;case M._InflaterState.dCode:return 13;case M._InflaterState.unCompressedAligning:return 15;case M._InflaterState.unCompressedByte1:return 16;case M._InflaterState.unCompressedByte2:return 17;case M._InflaterState.unCompressedByte3:return 18;case M._InflaterState.unCompressedByte4:return 19;case M._InflaterState.decodeUnCompressedBytes:return 20;case M._InflaterState.srFooter:return 21;case M._InflaterState.rFooter:return 22;case M._InflaterState.vFooter:return 23;case M._InflaterState.done:return 24;default:return 0}};var Jr=Yr;function Yr(){this._extraLengthBits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],this._staticDistanceTreeTable=[0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31],this._lengthBase=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],this._distanceBasePosition=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],this._codeOrder=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],this._bfinal=0,this._bLength=0,this._blBuffer=[0,0,0,0],this._blockType=M._BlockType.unCompressedType,this._caSize=0,this._clCodeCount=0,this._extraBits=0,this._lengthCode=0,this._length=0,this._llCodeCount=0,this._output=new Hr,this._input=new qr,this._loopCounter=0,this._codeList=Array(Kr._maxLengthTree+Kr._maxDepthTree).fill(0),this._cltcl=Array(Kr._nCLength).fill(0),this._inflaterState=M._InflaterState.readingBFinal}Zr.prototype._read=function(t,e,i){for(var n=e,r=i;;){var s=this._inflater._inflate(t,n,r),a=s.count;if(t=s.data,n+=a,0===(r-=a))break;if(this._inflater._finished)break;s=this._readBytes(),a=s.count;if(this._buffer=s.buffer,0===a)break;this._inflater._setInput(this._buffer,0,a)}return{count:i-r,data:t}},Zr.prototype._readBytes=function(){if(k(this._offset)&&this._offset>=this._data.length)return{buffer:[],count:0};for(var t=0,e=0;e<this._buffer.length&&e+this._offset<this._data.length;e++)this._buffer[e]=this._data[this._offset+e],t++;return this._offset+=t,{buffer:this._buffer,count:t}};var Qr=Zr;function Zr(t,e,i){k(t)?this._data=t:this._data=[],k(i)&&(this._leaveOpen=i),this._offset=e,this._inflater=new Jr,this._buffer=Array(8192).fill(0)}$r=function(t,e){return($r=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}$r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(is,ts=t),is.prototype._initialize=function(){for(var t,e=this._hasValidChunkType(void 0);e.hasValidChunk;){switch(t=e.type){case _.iHDR:this._readHeader();break;case _.iDAT:this._readImageData();break;case _.sRGB:this._isRedGreenBlue=!0,this._ignoreChunk();break;case _.pLTE:this._readPhotoPlate();break;case _.iEND:this._decodeImageData();break;case _.tRNS:this._readTransparency();break;case _.tEXt:case _.iTXt:case _.zTXt:case _.hIST:case _.sBIT:case _.iCCP:case _.pHYs:case _.tIME:case _.bKGD:case _.gAMA:case _.cHRM:case _.unknown:this._ignoreChunk()}e=this._hasValidChunkType(t)}},is.prototype._hasValidChunkType=function(t){var e;return t=_.unknown,this._position+8<=this._stream.byteLength?(this._currentChunkLength=this._readUnsigned32(this._position),this._seek(4),e=this._readString(4),null!=(e=this._getChunkType(e))?{type:t=e,hasValidChunk:!0}:this._stream.byteLength===this._position?{type:t,hasValidChunk:!1}:{type:t,hasValidChunk:!0}):{type:t,hasValidChunk:!1}},is.prototype._ignoreChunk=function(){0<this._currentChunkLength&&this._seek(this._currentChunkLength+4)},is.prototype._readHeader=function(){this._header=new ss,this._header._width=this._readUnsigned32(this._position),this._seek(4),this._header._height=this._readUnsigned32(this._position),this._seek(4),this._header._bitDepth=this._readByte(),this._header._colorType=this._readByte(),this._header._compression=this._readByte(),this._header._filter=this._getFilterType(this._readByte()),this._header._interlace=this._readByte(),this._colors=3===this._header._colorType||0==(2&this._header._colorType)?1:3,this._width=this._header._width,this._height=this._header._height,this._bitsPerComponent=this._header._bitDepth,this._setBitsPerPixel(),this._seek(4)},is.prototype._setBitsPerPixel=function(){this._bitsPerPixel=16===this._header._bitDepth?2:1,0===this._header._colorType?(this._idatLength=Math.floor((this._bitsPerComponent*this._width+7)/8)*this._height,this._inputBands=1):2===this._header._colorType?(this._idatLength=this._width*this._height*3,this._inputBands=3,this._bitsPerPixel*=3):3===this._header._colorType?(1!==this._header._interlace&&0!==this._header._interlace||(this._idatLength=Math.floor((this._header._bitDepth*this._width+7)/8)*this._height),this._inputBands=1,this._bitsPerPixel=1):4===this._header._colorType?(this._idatLength=this._width*this._height,this._inputBands=2,this._bitsPerPixel*=2):6===this._header._colorType&&(this._idatLength=3*this._width*this._height,this._inputBands=4,this._bitsPerPixel*=4)},is.prototype._readImageData=function(){var t,e,i;this._encodedStream||(t=Math.max(2*this._currentChunkLength,1024),this._encodedStream=new Uint8Array(t),this._encodedStreamLength=0),this._currentChunkLength<=this._stream.byteLength&&this._stream.byteLength-this._position>=this._currentChunkLength&&(e=(t=this._encodedStreamLength)+this._currentChunkLength,this._encodedStream.length<e&&(i=this._encodedStream.length,i=Math.max(e,2*i),(i=new Uint8Array(i)).set(this._encodedStream.subarray(0,t)),this._encodedStream=i),this._encodedStream.set(this._stream.subarray(this._position,this._position+this._currentChunkLength),t),this._encodedStreamLength=e,this._position+=this._currentChunkLength),this._seek(4)},is.prototype._readPhotoPlate=function(){var t;3===this._header._colorType?(this._colorSpace=[],this._colorSpace.push(R.get("Indexed")),this._colorSpace.push(this._getPngColorSpace()),this._colorSpace.push(this._currentChunkLength/3-1),t=new Uint8Array(this._currentChunkLength),this._read(t,0,this._currentChunkLength),this._colorSpace.push(vs(t)),this._seek(4)):this._ignoreChunk()},is.prototype._readTransparency=function(){if(3===this._header._colorType){for(var t=new Uint8Array(this._currentChunkLength),e=(this._read(t,0,this._currentChunkLength),this._seek(4),t.length),i=(this._alpha=new Uint8Array(e),!1),n=0;n<e;n++){var r=255&t[n];this._alpha[n]=r,i||0==r||255==r||(i=!0)}this._shades=i}else this._ignoreChunk()},is.prototype._getPngColorSpace=function(){var t,e,i,n,r,s,a,o,h,c,_,d;return this._isRedGreenBlue?(t=[],d=[1,1,1],(e=new D).set("Gamma",[2.2,2.2,2.2]),this._isRedGreenBlue&&(n=.64*(i=.2126390058715103)/.33,a=.3*(s=-.0527286/(h=-.0737289))/.6,c=.15*(h=-.005321898/h)/.06,r=i*(.36/.33-1),o=s*(.7/.6-1),_=h*(.85/.06-1),d=[.9504300891509299,1,1.088921671149305],e.set("Matrix",[n,i,r,a,s,o,c,h,_])),e.set("WhitePoint",d),t.push(R.get("CalRGB")),t.push(e),t):0==(2&this._header._colorType)?R.get("DeviceGray"):R.get("DeviceRGB")},is.prototype._decodeImageData=function(){var t=this._header;this._isDecode=1===t._interlace||16===t._bitDepth||0!=(4&t._colorType)||this._shades,this._isDecode&&(0==(4&t._colorType)&&!this._shades||(this._maskData=new Uint8Array(this._width*this._height)),this._encodedStream&&(this._dataStream=this._getDeflatedData(this._encodedStream.subarray(0,this._encodedStreamLength)),this._dataStreamOffset=0),0<this._idatLength&&(this._decodedImageData=new Uint8Array(this._idatLength)),this._readDecodeData(),!this._decodedImageData||0!==this._decodedImageData.length||!this._shades)||(this._ideateDecode=!1,this._decodedImageData=this._encodedStream.subarray(0,this._encodedStreamLength))},is.prototype._getDeflatedData=function(t){for(var t=t.subarray(2,t.length-4),e=new Qr(Array.from(t),0,!0),i=[],n=0;;){var r=new Array(4096),r=e._read(r,0,4096),s=r.count,a=r.data;if(s<=0)break;for(var o=new Uint8Array(s),h=0;h<s;h++)o[h]=a[h];i.push(o),n+=s}for(var c=new Uint8Array(n),_=0,d=0,l=i;d<l.length;d++){o=l[d];c.set(o,_),_+=o.length}return c},is.prototype._readDecodeData=function(){1!==this._header._interlace?this._decodeData(0,0,1,1,this._width,this._height):(this._decodeData(0,0,8,8,Math.floor((this._width+7)/8),Math.floor((this._height+7)/8)),this._decodeData(4,0,8,8,Math.floor((this._width+3)/8),Math.floor((this._height+7)/8)),this._decodeData(0,4,4,8,Math.floor((this._width+3)/4),Math.floor((this._height+3)/8)),this._decodeData(2,0,4,4,Math.floor((this._width+1)/4),Math.floor((this._height+3)/4)),this._decodeData(0,2,2,4,Math.floor((this._width+1)/2),Math.floor((this._height+1)/4)),this._decodeData(1,0,2,2,Math.floor(this._width/2),Math.floor((this._height+1)/2)),this._decodeData(0,1,1,2,this._width,Math.floor(this._height/2)))},is.prototype._decodeData=function(t,e,i,n,r,s){if(0!==r&&0!==s)for(var a=Math.floor((this._inputBands*r*this._header._bitDepth+7)/8),o=new Uint8Array(a),h=new Uint8Array(a),c=0,_=e;c<s;c++,_+=n){var d=this._dataStream[this._dataStreamOffset++];switch(this._dataStreamOffset=this._readStream(this._dataStream,this._dataStreamOffset,o,a),this._getFilterType(d)){case ns.none:break;case ns.sub:this._decompressSub(o,a,this._bitsPerPixel);break;case ns.up:this._decompressUp(o,h,a);break;case ns.average:this._decompressAverage(o,h,a,this._bitsPerPixel);break;case ns.paeth:this._decompressPaeth(o,h,a,this._bitsPerPixel);break;default:throw new Error("Unknown PNG filter")}this._processPixels(o,t,i,_,r),h=(d=[o,h])[0],o=d[1]}},is.prototype._readStream=function(t,e,i,n){if(e+n>t.length)throw new Error("Insufficient data");return i.set(t.subarray(e,e+n)),e+n},is.prototype._decompressSub=function(t,e,i){for(var n=i;n<e;n++)t[n]=t[n]+t[n-i]&255},is.prototype._decompressUp=function(t,e,i){for(var n=0;n<i;n++)t[n]=t[n]+e[n]&255},is.prototype._decompressAverage=function(t,e,i,n){for(var r=0;r<n;r++)t[r]=t[r]+(e[r]>>1)&255;for(r=n;r<i;r++)t[r]=t[r]+(t[r-n]+e[r]>>1)&255},is.prototype._decompressPaeth=function(t,e,i,n){for(var r=0;r<n;r++)t[r]=t[r]+e[r]&255;for(r=n;r<i;r++)t[r]=t[r]+this._paethPredictor(t[r-n],e[r],e[r-n])&255},is.prototype._paethPredictor=function(t,e,i){var n=t+e-i,r=Math.abs(n-t),s=Math.abs(n-e),n=Math.abs(n-i);return r<=s&&r<=n?t:s<=n?e:i},is.prototype._processPixels=function(t,e,i,n,r){var s=0,a=0,o=0,h=this._getPixel(t);if(0===this._header._colorType||3===this._header._colorType||4===this._header._colorType?o=1:2!==this._header._colorType&&6!==this._header._colorType||(o=3),this._decodedImageData&&0<this._decodedImageData.length)for(var a=e,t=16===this._header._bitDepth?8:this._header._bitDepth,c=Math.floor((o*r*t+7)/8),s=0;s<r;s++)this._setPixel(this._decodedImageData,h,this._inputBands*s,o,a,n,this._header._bitDepth,c),a+=i;if(0!=(4&this._header._colorType)||this._shades)if(0!=(4&this._header._colorType)){if(16===this._header._bitDepth)for(var _=h,d=0;d<r;++d){var l=d*this._inputBands+o;_[l]=_[l]>>8}c=r;for(a=e,s=0;s<r;s++)this._setPixel(this._maskData,h,this._inputBands*s+o,1,a,n,8,c),a+=i}else{var c=r,u=new Uint8Array(1);for(a=e,s=0;s<r;s++){var p=h[s];u[0]=p<this._alpha.length?this._alpha[p]:255,this._setPixel(this._maskData,u,0,1,a,n,8,c),a+=i}}},is.prototype._getPixel=function(t){var e=this._header._bitDepth;if(8===e)return t;if(16===e)for(var i=Math.floor(t.length/2),n=new Uint16Array(i),r=0;r<i;r++)n[r]=t[2*r]<<8|t[2*r+1];else for(var i=Math.floor(8*t.length/e),n=new Uint8Array(i),s=0,a=Math.floor(8/e),o=(1<<e)-1,h=0;h<t.length;h++)for(var c=t[h],r=a-1;0<=r;r--)n[s++]=c>>e*r&o;return n},is.prototype._setPixel=function(t,e,i,n,r,s,a,o){if(8===a)for(var h=o*s+n*r,c=0;c<n;++c)t[h+c]=e[c+i];else if(16===a)for(h=o*s+n*r,c=0;c<n;++c)t[h+c]=e[c+i]>>8;else{h=Math.floor((o*s+r)/(8/a)),o=e[i]<<8-a*(r%(8/a))-a;t[h]=t[h]|255&o}},is.prototype._getImageDictionary=function(){var t;return this._imageStream&&0<this._imageStream.length||(this._imageStream=new g([],new D),this._imageStream.isImageStream=!0,this._imageStream.bytes=this._decodedImageData,this._imageStream._isCompress=this._isDecode&&this._ideateDecode,(t=new D).set("Type",new R("XObject")),t.set("Subtype",new R("Image")),t.set("Width",this._width),t.set("Height",this._height),16===this._bitsPerComponent?t.set("BitsPerComponent",8):t.set("BitsPerComponent",this._bitsPerComponent),this._isDecode&&this._ideateDecode||t.set("Filter",new R("FlateDecode")),0==(2&this._header._colorType)?t.set("ColorSpace",R.get("DeviceGray")):t.set("ColorSpace",R.get("DeviceRGB")),this._isDecode&&(!this._shades||this._ideateDecode)||t.set("DecodeParms",this._getDecodeParams()),this._imageStream.dictionary=t,this._imageStream.end=this._imageStream.bytes.length,this._imageStream.dictionary._updated=!0,this._setMask()),this._imageStream},is.prototype._setMask=function(){var t;this._maskData&&0<this._maskData.length&&(this._maskStream=new g(this._maskData,new D),this._maskStream.bytes=this._maskData,this._maskStream._isCompress=this._isDecode&&this._ideateDecode,(t=new D).set("Type",new R("XObject")),t.set("Subtype",new R("Image")),t.set("Width",this._width),t.set("Height",this._height),16===this._bitsPerComponent?t.set("BitsPerComponent",8):t.set("BitsPerComponent",this._bitsPerComponent),t.set("ColorSpace",R.get("DeviceGray")),this._maskStream.dictionary=t,this._maskStream.end=this._maskStream.bytes.length,this._maskStream.dictionary._updated=!0)},is.prototype._getDecodeParams=function(){var t=new D;return t.set("Columns",this._width),t.set("Colors",this._colors),t.set("Predictor",15),t.set("BitsPerComponent",this._bitsPerComponent),t},is.prototype._getChunkType=function(t){switch(t){case"IHDR":return _.iHDR;case"PLTE":return _.pLTE;case"IDAT":return _.iDAT;case"IEND":return _.iEND;case"bKGD":return _.bKGD;case"cHRM":return _.cHRM;case"gAMA":return _.gAMA;case"hIST":return _.hIST;case"pHYs":return _.pHYs;case"sBIT":return _.sBIT;case"tEXt":return _.tEXt;case"tIME":return _.tIME;case"tRNS":return _.tRNS;case"zTXt":return _.zTXt;case"sRGB":return _.sRGB;case"iCCP":return _.iCCP;case"iTXt":return _.iTXt;case"Unknown":return _.unknown;default:return null}},is.prototype._getFilterType=function(t){switch(t){case 1:return ns.sub;case 2:return ns.up;case 3:return ns.average;case 4:return ns.paeth;default:return ns.none}},is.prototype.dispose=function(){this._encodedStream=null,this._maskData=null,this._alpha=null,this._dataStream=null,this._decodedImageData=null,this._colorSpace=null};var $r,ts,es=is;function is(t){var e=ts.call(this)||this;return e._stream=t,e._format=M._ImageFormat.png,e._isRedGreenBlue=!1,e._isDecode=!1,e._shades=!1,e._ideateDecode=!0,e._colors=0,e._bitsPerPixel=0,e._idatLength=0,e._inputBands=0,e._position=8,e._initialize(),e}var _,ns,rs,ss=function(){this._width=0,this._height=0,this._colorType=0,this._compression=0,this._bitDepth=0,this._interlace=0,this._filter=ns.none},d=((d=_=_||{})[d.iHDR=0]="iHDR",d[d.pLTE=1]="pLTE",d[d.iDAT=2]="iDAT",d[d.iEND=3]="iEND",d[d.bKGD=4]="bKGD",d[d.cHRM=5]="cHRM",d[d.gAMA=6]="gAMA",d[d.hIST=7]="hIST",d[d.pHYs=8]="pHYs",d[d.sBIT=9]="sBIT",d[d.tEXt=10]="tEXt",d[d.tIME=11]="tIME",d[d.tRNS=12]="tRNS",d[d.zTXt=13]="zTXt",d[d.sRGB=14]="sRGB",d[d.iCCP=15]="iCCP",d[d.iTXt=16]="iTXt",d[d.unknown=17]="unknown",(d=ns=ns||{})[d.none=0]="none",d[d.sub=1]="sub",d[d.up=2]="up",d[d.average=3]="average",d[d.paeth=4]="paeth",rs=function(t,e){return(rs=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)},function(t,e){function i(){this.constructor=t}rs(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});function as(t,e){return t&Math.pow(2,e)-1}function os(t){return t<<16>>16}function hs(t,e,i,n,r){void 0===n&&(n=0),void 0===r&&(r=i.length),n=Math.max(0,Math.min(i.length,n));var s=(r=Math.max(0,Math.min(i.length,r)))-n;t.length=Math.max(t.length,e+s);for(var a=0;a<s;a++)t[e+a]=i[n+a]}function cs(i,t){return t.every(function(t,e){return t===i[e]})}function _s(t){var e;if(cs(t,[255,216]))e=new zr(t);else{if(!cs(t,[137,80,78,71,13,10,26,10]))throw new Error("Unsupported image format");e=new es(t)}return e}function ds(t,e,i){var n=0;return i=null==i?0:i,t.rotation===M.PdfRotationAngle.angle90?n=null==e?0:i:t.rotation===M.PdfRotationAngle.angle180?n=null==e?0:e:t.rotation===M.PdfRotationAngle.angle270&&(t=t.size,n=null==e?0:t.width-i),n}function ls(t,e){var i=-1;if(e&&e instanceof D)for(var n=0;n<t.pageCount;n++){var r=t.getPage(n);if(r&&r._pageDictionary&&(r._pageDictionary===e||r._pageDictionary.objId===e.objId)){i=n;break}}return i}function us(t){var e=[];return 0!=(t&M.PdfAnnotationFlag.hidden)&&e.push("hidden"),0!=(t&M.PdfAnnotationFlag.invisible)&&e.push("invisible"),0!=(t&M.PdfAnnotationFlag.locked)&&e.push("locked"),0!=(t&M.PdfAnnotationFlag.noRotate)&&e.push("norotate"),0!=(t&M.PdfAnnotationFlag.noView)&&e.push("noview"),0!=(t&M.PdfAnnotationFlag.noZoom)&&e.push("nozoom"),0!=(t&M.PdfAnnotationFlag.print)&&e.push("print"),0!=(t&M.PdfAnnotationFlag.readOnly)&&e.push("readonly"),0!=(t&M.PdfAnnotationFlag.toggleNoView)&&e.push("togglenoview"),0!=(t&M.PdfAnnotationFlag.default)&&e.push("default"),e.join(",")}function ps(t){switch(t){case"hidden":return M.PdfAnnotationFlag.hidden;case"invisible":return M.PdfAnnotationFlag.invisible;case"locked":return M.PdfAnnotationFlag.locked;case"norotate":return M.PdfAnnotationFlag.noRotate;case"noview":return M.PdfAnnotationFlag.noView;case"nozoom":return M.PdfAnnotationFlag.noZoom;case"print":return M.PdfAnnotationFlag.print;case"readonly":return M.PdfAnnotationFlag.readOnly;case"togglenoview":return M.PdfAnnotationFlag.toggleNoView;default:return M.PdfAnnotationFlag.default}}function fs(t){if("string"==typeof t&&0<t.length&&t.charCodeAt(0)>="ï".charCodeAt(0)){var e=void 0;if("ï"===t[0]&&"»"===t[1]&&"¿"===t[2]?e="utf-8":"ÿ"===t[0]&&"þ"===t[1]?e="utf-16le":"þ"===t[0]&&"ÿ"===t[1]&&(e="utf-16be"),e)try{return new TextDecoder(e,{fatal:!0}).decode(v(t))}catch(t){}}for(var i=[],n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364],r=0;r<t.length;r++){var s=n[t.charCodeAt(r)];i.push(s?String.fromCharCode(s):t.charAt(r))}return i.join("")}function v(t,e,i,n){if(void 0===e&&(e=!1),i=void 0===i?!1:i){var r=t.length;if(n){for(var s=0;s<r;s++)n.push(t.charCodeAt(s));return n}for(var a=new Uint8Array(r),s=0;s<r;s++)a[s]=t.charCodeAt(s);return e?Array.from(a):a}for(var o=0,s=0;s<t.length;s++)(h=t.charCodeAt(s))<128?o+=1:h<2048?o+=2:h<55296||57344<=h?o+=3:(s++,o+=4);for(var h,c=new Uint8Array(o),_=0,s=0;s<t.length;s++)(h=t.charCodeAt(s))<128?c[_++]=h:(h<2048?c[_++]=h>>6|192:(h<55296||57344<=h?c[_++]=h>>12|224:(s++,h=65536+((1023&h)<<10|1023&t.charCodeAt(s)),c[_++]=h>>18|240,c[_++]=h>>12&63|128),c[_++]=h>>6&63|128),c[_++]=63&h|128);if(n){for(s=0;s<c.length;s++)n.push(c[s]);return n}return e?Array.from(c):c}function gs(t,i){return t.length===i.length&&t.every(function(t,e){return t===i[e]})}function ys(t,i){return t.length===i.length&&t.every(function(t,e){return t.x===i[e].x&&t.y===i[e].y})}function ms(t){return Number.isInteger(t)?t.toString():t.toFixed(7)}function bs(t,e){var i=!1;if(t.length!==e.length)return!0;for(var n=0;n<t.length;n++)if(t[n]!==e[n]){i=!0;break}return i}function ws(t,e){if(t.length!==e.length)return!0;for(var i=0;i<t.length;i++)if(t[i].x!==e[i].x||t[i].y!==e[i].y)return!0;return!1}function vs(t,e){if(!t||0===t.length)return"";if(e=void 0===e?!1:e)return Ps(t);for(var i="",n=0;n<t.length;n+=8192){var r=n+8192<t.length?n+8192:t.length;i+=String.fromCharCode.apply(null,t.subarray(n,r))}return i}function Ss(t){return t&&0!==t.length?t.replace(/_[Xx]([0-9A-Fa-f]{4}|[0-9A-Fa-f]{8})_/g,function(t,e){e=parseInt(e,16);return isNaN(e)?t:e<=65535?String.fromCharCode(e):(t=e-65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}):t}function Ps(t){var e=t.length;if(0===e)return"";for(var i="",n=new Uint16Array(4096),r=0,s=0;r<e;){var a=t[r++];a<128?n[s++]=a:a<224?n[s++]=(31&a)<<6|63&t[r++]:a<240?n[s++]=(15&a)<<12|(63&t[r++])<<6|63&t[r++]:(a=(7&a)<<18|(63&t[r++])<<12|(63&t[r++])<<6|(63&t[r++])-65536,n[s++]=55296+(a>>10),n[s++]=56320+(1023&a)),4094<=s&&(i+=String.fromCharCode.apply(null,n.subarray(0,s)),s=0)}return 0<s&&(i+=String.fromCharCode.apply(null,n.subarray(0,s))),i}function xs(t){var e=[];if(null!=t)for(var i=0;i<t.length;i++){var n=t.charCodeAt(i);e.push(n/256>>>0),e.push(255&n)}return new Uint8Array(e)}function As(t){for(var e=new Array(256),i=0;i<256;i++){var n=i.toString(16).toUpperCase();e[i]=1===n.length?"0"+n:n}var r=t.length;if(0===r)return"";for(var s=new Array(r),i=0;i<r;i++)s[i]=e[t[i]];return s.join("")}function Ts(t,e){void 0===e&&(e=!1);for(var i=new Int16Array(256).fill(-1),n=0;n<10;n++)i[48+n]=n;for(n=0;n<6;n++)i[65+n]=10+n,i[97+n]=10+n;if(!t)return e?[]:new Uint8Array(0);for(var r=t.length>>1,s=new Uint8Array(r),a=0,n=0;n<r;n++){var o=i[t.charCodeAt(a++)],h=i[t.charCodeAt(a++)];s[n]=o<<4|h}return e?Array.from(s):s}function Cs(t){var e="";if(t&&"#"===t[0]){t=t.substring(1);for(var i=0;i<t.length;i+=2)e+=String.fromCharCode(parseInt(t.substring(i,i+2),16));return e}return t}function ks(t){return 32===t||9===t||13===t||10===t}function Rs(t,e){void 0===e&&(e=!1);if(3e6<=t.length){t=t.replace(/[^A-Za-z0-9+/=]/g,"");for(var i=[],n=0,r=0;r<t.length;r+=3e6){var s=function(t){for(var e,i,n,r,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,o=0,h=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4,c=(t.charAt(t.length-1)===s.charAt(64)&&h--,new Array(0|h));a<t.length;)i=s.indexOf(t.charAt(a++)),e=(15&(n=s.indexOf(t.charAt(a++))))<<4|(r=s.indexOf(t.charAt(a++)))>>2,r=(3&r)<<6|s.indexOf(t.charAt(a++)),o<h&&(c[o++]=i<<2|n>>4),o<h&&(c[o++]=e),o<h&&(c[o++]=r);return new Uint8Array(c)}(_=t.substring(r,r+3e6));i.push(s),n+=s.length}for(var a=new Uint8Array(n),o=0,h=0,c=i;h<c.length;h++){var _=c[h];a.set(_,o),o+=_.length}return e?Array.from(a):a}for(var d,l,u,p,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=0,g=0,n=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4,a=(t.charAt(t.length-1)===f.charAt(64)&&n--,new Array(0|n));r<t.length;)l=f.indexOf(t.charAt(r++)),d=(15&(u=f.indexOf(t.charAt(r++))))<<4|(p=f.indexOf(t.charAt(r++)))>>2,p=(3&p)<<6|f.indexOf(t.charAt(r++)),g<n&&(a[g++]=l<<2|u>>4),g<n&&(a[g++]=d),g<n&&(a[g++]=p);return e?a:new Uint8Array(a)}function Fs(t,e){void 0===e&&(e=!1);for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=[],r=t.length,s=0;s<r;){var a=t[s++],o=s<r?t[s++]:0,h=s<r?t[s++]:0;n.push(i[a>>2],i[(3&a)<<4|o>>4],r<s-1?"=":i[(15&o)<<2|h>>6],r<s?"=":i[63&h])}return e&&(r%3==1?(n[n.length-1]="=",n[n.length-2]="="):r%3==2&&(n[n.length-1]="=")),n.join("")}function Is(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=t.length;if(3e6<=i){var n=[];if(3e6<i)for(var r=0;r<i;r+=3e6){var s=t.subarray(r,Math.min(r+3e6,i));i<=r+3e6?n.push(Fs(s,!0)):n.push(Fs(s))}else n.push(Fs(t,!0));return n.join("")}for(var n="",a=0,o=0;o<t.length;o++)o%3==0?(n+=e[a=t[o]>>2],a=t[o]<<4&63):o%3==1?(n+=e[a+=t[o]>>4],a=t[o]<<2&63):o%3==2&&(n=(n+=e[a+=t[o]>>6])+e[a=63&t[o]]);return t.length%3==1&&(n+=e[a]+"=="),t.length%3==2&&(n+=e[a]+"="),n}function Ds(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!0);for(var r,s=[],a=4;a<arguments.length;a++)s[a-4]=arguments[a];for(var o=new Set;t instanceof D&&t.objId&&!o.has(t.objId);){t.objId&&o.add(t.objId);var h=i?t.getArray(e):t.get(e);if(void 0!==h){if(n)return h;(r=r||[]).push(h)}for(var c=0,_=!1;c<s.length;){var d=s[c];if(t.has(d)){t=t.get(d),_=!0;break}c++}if(!_)break}return r}function Bs(t,e){var i,n,r,s,a={x:0,y:0,width:0,height:0},t=t.getArray("Rect");return t&&Array.isArray(t)&&(i=t[0],n=t[1],r=t[2],s=t[3],void 0!==i)&&void 0!==n&&void 0!==r&&void 0!==s&&(a.x=Math.min(i,r),a.y=Math.min(n,s),a.width=Math.max(i,r)-a.x,a.height=Math.max(n,s)-a.y,e)&&(a.height=parseFloat(a.height.toFixed(3)),t[1]<0)&&(a.y=t[1],t[1]>t[3])&&(a.y-=a.height),a}function Ls(t,e){var i,n,r;return t.has("Rect")&&(r=Bs(t),e?(t=e.size,i=e.mediaBox,(n=e.cropBox)&&Array.isArray(n)&&4===n.length&&e._pageDictionary.has("CropBox")?0===n[0]&&0===n[1]&&t.width!==n[2]&&t.height!==n[3]||r.x===n[0]?r.y=t.height-(r.y+r.height):(r.x-=n[0],r.y=n[3]-(r.y+r.height)):i&&Array.isArray(i)&&4===i.length&&e._pageDictionary.has("MediaBox")&&(0<i[0]||0<i[1]||t.width===i[2]||t.height===i[3])?(r.x-=i[0],r.y=i[3]-(r.y+r.height)):r.y=t.height-(r.y+r.height)):r.y=r.y+r.height),r}function Os(t){return{x:Math.min(t[0],t[2]),y:Math.min(t[1],t[3]),width:Math.abs(t[0]-t[2]),height:Math.abs(t[1]-t[3])}}function Ms(t){return[t.x,t.y,t.x+t.width,t.y+t.height]}function Es(t,e){var i,n,r,s=t[0],a=t[1],o=t[2],t=t[3];return e&&(i=(n=e.size).width,n=n.height,r=e.mediaBox,a=(e=e.cropBox)&&Array.isArray(e)&&4===e.length?0!==e[0]||0!==e[1]||i===e[2]||n===e[3]?(s+=e[0],e[3]-(a+t)):n-(a+t):r&&Array.isArray(r)&&4===r.length&&(0<r[0]||0<r[1]||i===r[2]||n===r[3])?(s-=r[0],r[3]-(a+t)):n-(a+t)),[s,a,s+o,a+t]}function Ns(t){var e=la(t);return e||(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(e=[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]),e?{r:e[0],g:e[1],b:e[2]}:void 0}function js(t){return Array.isArray(t)&&t.every(function(t){return t&&"number"==typeof t.x&&"number"==typeof t.y})}function Vs(t){for(var e=[],i=0;i<t.length;i+=2)e.push({x:t[i],y:t[i+1]});return e}function zs(t){return t.map(function(t){for(var e=[],i=0;i<t.length;i+=2)e.push({x:t[i],y:t[i+1]});return e})}function Us(t){for(var e=[],i=0,n=t;i<n.length;i++)for(var r=n[i],s=0;s<r.length;s+=2)e.push({x:r[s],y:r[s+1]});return e}function Hs(t){return t.map(function(t){for(var e=[],i=0,n=t;i<n.length;i++){var r=n[i];e.push(r.x,r.y)}return e})}function Ws(t){for(var e=[],i=0;i<t.length;i++){var n=t[i];e.push(n.x,n.y)}return e}function qs(t){var e,i,n,r;return t&&(1===t.length?void 0!==(i=t[0])&&(e={r:i=Math.round(255*i),g:i,b:i}):3===t.length?(i=t[0],n=t[1],r=t[2],void 0!==i&&void 0!==n&&void 0!==r&&(e={r:Math.round(255*i),g:Math.round(255*n),b:Math.round(255*r)})):4===t.length&&(i=t[0],n=t[1],r=t[2],t=t[3],void 0!==i)&&void 0!==n&&void 0!==r&&void 0!==t&&(t=255*t,e={r:Math.round(255-Math.min(255,i*(255-t)+t)),g:Math.round(255-Math.min(255,n*(255-t)+t)),b:Math.round(255-Math.min(255,r*(255-t)+t))})),e}function Gs(t){var e="S";switch(t){case M.PdfBorderStyle.dot:case M.PdfBorderStyle.dashed:e="D";break;case M.PdfBorderStyle.beveled:e="B";break;case M.PdfBorderStyle.inset:e="I";break;case M.PdfBorderStyle.underline:e="U"}return R.get(e)}function Ks(t){var e=M.PdfBorderEffectStyle.solid;return e="C"===t?M.PdfBorderEffectStyle.cloudy:e}function Xs(t){var e="None";if(void 0!==t)switch(t){case M.PdfLineEndingStyle.openArrow:e="OpenArrow";break;case M.PdfLineEndingStyle.closedArrow:e="ClosedArrow";break;case M.PdfLineEndingStyle.rOpenArrow:e="ROpenArrow";break;case M.PdfLineEndingStyle.rClosedArrow:e="RClosedArrow";break;case M.PdfLineEndingStyle.butt:e="Butt";break;case M.PdfLineEndingStyle.diamond:e="Diamond";break;case M.PdfLineEndingStyle.circle:e="Circle";break;case M.PdfLineEndingStyle.square:e="Square";break;case M.PdfLineEndingStyle.slash:e="Slash"}return e}function Js(t,e){var i;switch(t.toLowerCase()){case"openarrow":i=M.PdfLineEndingStyle.openArrow;break;case"closedarrow":i=M.PdfLineEndingStyle.closedArrow;break;case"ropenarrow":i=M.PdfLineEndingStyle.rOpenArrow;break;case"rclosedarrow":i=M.PdfLineEndingStyle.rClosedArrow;break;case"butt":i=M.PdfLineEndingStyle.butt;break;case"diamond":i=M.PdfLineEndingStyle.diamond;break;case"circle":i=M.PdfLineEndingStyle.circle;break;case"square":i=M.PdfLineEndingStyle.square;break;case"slash":i=M.PdfLineEndingStyle.slash;break;default:i=M.PdfLineEndingStyle.none}return i}function Ys(t){switch(t){case"P":return M.PdfHighlightMode.push;case"N":return M.PdfHighlightMode.noHighlighting;case"O":return M.PdfHighlightMode.outline;default:return M.PdfHighlightMode.invert}}function Qs(t){switch(t){case M.PdfHighlightMode.push:return R.get("P");case M.PdfHighlightMode.noHighlighting:return R.get("N");case M.PdfHighlightMode.outline:return R.get("O");default:return R.get("I")}}function Zs(t){var e="Normal";switch(t){case M.PdfBlendMode.multiply:e="Multiply";break;case M.PdfBlendMode.screen:e="Screen";break;case M.PdfBlendMode.overlay:e="Overlay";break;case M.PdfBlendMode.darken:e="Darken";break;case M.PdfBlendMode.lighten:e="Lighten";break;case M.PdfBlendMode.colorDodge:e="ColorDodge";break;case M.PdfBlendMode.colorBurn:e="ColorBurn";break;case M.PdfBlendMode.hardLight:e="HardLight";break;case M.PdfBlendMode.softLight:e="SoftLight";break;case M.PdfBlendMode.difference:e="Difference";break;case M.PdfBlendMode.exclusion:e="Exclusion";break;case M.PdfBlendMode.hue:e="Hue";break;case M.PdfBlendMode.saturation:e="Saturation";break;case M.PdfBlendMode.color:e="Color";break;case M.PdfBlendMode.luminosity:e="Luminosity";break;default:e="Normal"}return R.get(e)}function $s(t){var e=M.PdfBlendMode.normal;switch(t.name){case"Multiply":e=M.PdfBlendMode.multiply;break;case"Screen":e=M.PdfBlendMode.screen;break;case"Overlay":e=M.PdfBlendMode.overlay;break;case"Darken":e=M.PdfBlendMode.darken;break;case"Lighten":e=M.PdfBlendMode.lighten;break;case"ColorDodge":e=M.PdfBlendMode.colorDodge;break;case"ColorBurn":e=M.PdfBlendMode.colorBurn;break;case"HardLight":e=M.PdfBlendMode.hardLight;break;case"SoftLight":e=M.PdfBlendMode.softLight;break;case"Difference":e=M.PdfBlendMode.difference;break;case"Exclusion":e=M.PdfBlendMode.exclusion;break;case"Hue":e=M.PdfBlendMode.hue;break;case"Saturation":e=M.PdfBlendMode.saturation;break;case"Color":e=M.PdfBlendMode.color;break;case"Luminosity":e=M.PdfBlendMode.luminosity;break;default:e=M.PdfBlendMode.normal}return e}function ta(t){t=t.toFixed(2);return t="0.00"===t?".00":t}function ea(t,e){var i,t=R.get(t);e.has("ProcSet")?(i=e.getArray("ProcSet"))&&-1===i.indexOf(t)&&(i.push(t),e.update("ProcSet",i)):e.update("ProcSet",[t])}function ia(){return"aaaaaaaa-aaaa-4aaa-baaa-aaaaaaaaaaaa".replace(/[ab]/g,function(t){var e=16*Math.random()|0;return("a"===t?e:3&e|8).toString(16)})}function na(t){if(!t||0===t.length)return t;for(var e=[],i=0;i<t.length;){var n=t[i],r=t.charCodeAt(i);if("#"===n&&i+2<t.length){var s=t[i+1],a=t[i+2];if(aa(s)&&aa(a)){e.push("#",s.toUpperCase(),a.toUpperCase()),i+=3;continue}}if(33<=r&&r<=126&&!("("===n||")"===n||"<"===n||">"===n||"["===n||"]"===n||"{"===n||"}"===n||"/"===n||"%"===n||"#"===n))e.push(n),i++;else if(r<=127)e.push("#",sa(r)),i+=1;else for(var s=void 0,o=(55296<=r&&r<=56319?i+1<t.length&&56320<=(a=t.charCodeAt(i+1))&&a<=57343?(s=a-56320+(r-55296<<10)+65536,i+=2):(s=65533,i+=1):(s=56320<=r&&r<=57343?65533:r,i+=1),ra(s)),h=0;h<o.length;h++)e.push("#",sa(o[h]))}return e.join("")}function ra(t){return t<=127?[t]:t<=2047?[192|t>>6,128|63&t]:t<=65535?[224|t>>12,128|t>>6&63,128|63&t]:[240|t>>18,128|t>>12&63,128|t>>6&63,128|63&t]}function sa(t){t=t.toString(16).toUpperCase();return 1===t.length?"0"+t:t}function aa(t){t=t.charCodeAt(0);return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function oa(t,e,i,n,r,s){i<t&&(l=t,t=i,i=l),e<n&&(l=e,e=n,n=l),Math.abs(s)<=90?(a=s,o=1):a=s/(o=Math.ceil(Math.abs(s)/90));for(var a,o,h=(t+i)/2,c=(e+n)/2,_=(i-t)/2,d=(n-e)/2,l=a*(Math.PI/360),u=Math.abs(4/3*(1-Math.cos(l))/Math.sin(l)),p=[],f=0;f<o;f++){var g=(r+f*a)*(Math.PI/180),y=(r+(f+1)*a)*(Math.PI/180),m=Math.cos(g),b=Math.cos(y),g=Math.sin(g),y=Math.sin(y);0<a?(p.push(h+_*m),p.push(c-d*g),p.push(h+_*(m-u*g)),p.push(c-d*(g+u*m)),p.push(h+_*(b+u*y)),p.push(c-d*(y-u*b))):(p.push(h+_*m),p.push(c-d*g),p.push(h+_*(m+u*g)),p.push(c-d*(g-u*m)),p.push(h+_*(b-u*y)),p.push(c-d*(y+u*b))),p.push(h+_*b),p.push(c-d*y)}return p}function ha(t,e){for(var i,n=0;n<t.pageCount&&void 0===i;n++){var r,s=t.getPage(n);s&&s._pageDictionary.has("Annots")&&(r=s._pageDictionary.get("Annots"),Array.isArray(r))&&void 0===i&&r.some(function(t){return t instanceof m&&t===e})&&(i=s)}return i}function ca(t){var e,i=!1;return t.has("AS")&&((e=t.get("AS"))?i="Off"!==e.name:(e=t.get("V"))&&(i=e.name===_a(t))),i}function _a(t){var e,i,n="";return t&&t instanceof D&&(t.has("AS")?null!==(e=t.get("AS"))&&"Off"!==e.name&&(n=e.name):t.has("V")&&null!==(e=t.get("V"))&&"Off"!==e.name&&(n=e.name),""===n)&&t&&t.has("AP")&&(e=t.get("AP"))&&e.has("N")&&(t=(t=e.get("N"))instanceof y?t.dictionary:t)&&t instanceof D&&(i=!1,t.forEach(function(t,e){i||"Off"===t||(n=t,i=!0)})),n}function da(t,e){var i,n,r,t=t===M._PdfCheckFieldState.checked?_a(e._dictionary):"Off";return i=e._dictionary.has("AP")&&(r=e._dictionary.get("AP"))&&r.has("N")&&(r=(r=r.get("N"))&&r instanceof y?r.dictionary:r)&&r instanceof D&&t&&""!==t&&r.has(t)&&(n=r.get(t),(r=r.getRaw(t))&&(n.reference=r),n)?new P(n,e._crossReference):i}function la(t){var e;switch(t){case"transparent":e=[255,255,255];break;case"aliceblue":e=[240,248,255];break;case"antiquewhite":e=[250,235,215];break;case"aqua":e=[0,255,255];break;case"aquamarine":e=[127,255,212];break;case"azure":e=[240,255,255];break;case"beige":e=[245,245,220];break;case"bisque":e=[255,228,196];break;case"black":e=[0,0,0];break;case"blanchedalmond":e=[255,235,205];break;case"blue":e=[0,0,255];break;case"blueviolet":e=[138,43,226];break;case"brown":e=[165,42,42];break;case"burlywood":e=[222,184,135];break;case"cadetBlue":e=[95,158,160];break;case"chartreuse":e=[127,255,0];break;case"chocolate":e=[210,105,30];break;case"coral":e=[255,127,80];break;case"cornflowerblue":e=[100,149,237];break;case"cornsilk":e=[255,248,220];break;case"crimson":e=[220,20,60];break;case"cyan":e=[0,255,255];break;case"darkblue":e=[0,0,139];break;case"darkcyan":e=[0,139,139];break;case"darkgoldenrod":e=[184,134,11];break;case"darkgray":e=[169,169,169];break;case"darkgreen":e=[0,100,0];break;case"darkkhaki":e=[189,183,107];break;case"darkmagenta":e=[139,0,139];break;case"darkolivegreen":e=[85,107,47];break;case"darkorange":e=[255,140,0];break;case"darkorchid":e=[153,50,204];break;case"darkred":e=[139,0,0];break;case"darksalmon":e=[233,150,122];break;case"darkseagreen":e=[143,188,139];break;case"darkslateblue":e=[72,61,139];break;case"darkslategray":e=[47,79,79];break;case"darkturquoise":e=[0,206,209];break;case"darkviolet":e=[148,0,211];break;case"deeppink":e=[255,20,147];break;case"deepskyblue":e=[0,191,255];break;case"dimgray":e=[105,105,105];break;case"dodgerblue":e=[30,144,255];break;case"firebrick":e=[178,34,34];break;case"floralwhite":e=[255,250,240];break;case"forestgreen":e=[34,139,34];break;case"fuchsia":e=[255,0,255];break;case"gainsboro":e=[220,220,220];break;case"ghostwhite":e=[248,248,255];break;case"gold":e=[255,215,0];break;case"goldenrod":e=[218,165,32];break;case"gray":e=[128,128,128];break;case"green":e=[0,128,0];break;case"greenyellow":e=[173,255,47];break;case"honeydew":e=[240,255,240];break;case"hotpink":e=[255,105,180];break;case"indianred":e=[205,92,92];break;case"indigo":e=[75,0,130];break;case"ivory":e=[255,255,240];break;case"khaki":e=[240,230,140];break;case"lavender":e=[230,230,250];break;case"lavenderblush":e=[255,240,245];break;case"lawngreen":e=[124,252,0];break;case"lemonchiffon":e=[255,250,205];break;case"lightblue":e=[173,216,230];break;case"lightcoral":e=[240,128,128];break;case"lightcyan":e=[224,255,255];break;case"lightgoldenrodyellow":e=[250,250,210];break;case"lightgreen":e=[144,238,144];break;case"lightgray":e=[211,211,211];break;case"LightPink":e=[255,182,193];break;case"lightsalmon":e=[255,160,122];break;case"lightseagreen":e=[32,178,170];break;case"lightskyblue":e=[135,206,250];break;case"lightslategray":e=[119,136,153];break;case"lightsteelblue":e=[176,196,222];break;case"lightyellow":e=[255,255,224];break;case"lime":e=[0,255,0];break;case"limeGreen":e=[50,205,50];break;case"linen":e=[250,240,230];break;case"magenta":e=[255,0,255];break;case"maroon":e=[128,0,0];break;case"mediumaquamarine":e=[102,205,170];break;case"mediumblue":e=[0,0,205];break;case"mediumorchid":e=[186,85,211];break;case"mediumpurple":e=[147,112,219];break;case"mediumseagreen":e=[60,179,113];break;case"mediumslateblue":e=[123,104,238];break;case"mediumspringgreen":e=[0,250,154];break;case"mediumturquoise":e=[72,209,204];break;case"mediumvioletred":e=[199,21,133];break;case"midnightblue":e=[25,25,112];break;case"mintcream":e=[245,255,250];break;case"mistyrose":e=[255,228,225];break;case"moccasin":e=[255,228,181];break;case"navajowhite":e=[255,222,173];break;case"navy":e=[0,0,128];break;case"oldLace":e=[253,245,230];break;case"olive":e=[128,128,0];break;case"olivedrab":e=[107,142,35];break;case"orange":e=[255,165,0];break;case"orangered":e=[255,69,0];break;case"orchid":e=[218,112,214];break;case"palegoldenrod":e=[238,232,170];break;case"palegreen":e=[152,251,152];break;case"paleturquoise":e=[175,238,238];break;case"palebioletred":e=[219,112,147];break;case"papayawhip":e=[255,239,213];break;case"peachpuff":e=[255,218,185];break;case"peru":e=[205,133,63];break;case"pink":e=[255,192,203];break;case"plum":e=[221,160,221];break;case"powderblue":e=[176,224,230];break;case"purple":e=[128,0,128];break;case"red":e=[255,0,0];break;case"rosybrown":e=[188,143,143];break;case"royalblue":e=[65,105,225];break;case"saddlebrown":e=[139,69,19];break;case"salmon":e=[250,128,114];break;case"sandybrown":e=[244,164,96];break;case"seagreen":e=[46,139,87];break;case"seashell":e=[255,245,238];break;case"sienna":e=[160,82,45];break;case"silver":e=[192,192,192];break;case"skyblue":e=[135,206,235];break;case"slateblue":e=[106,90,205];break;case"slategray":e=[112,128,144];break;case"snow":e=[255,250,250];break;case"springgreen":e=[0,255,127];break;case"steelblue":e=[70,130,180];break;case"tan":e=[210,180,140];break;case"teal":e=[0,128,128];break;case"thistle":e=[216,191,216];break;case"tomato":e=[255,99,71];break;case"turquoise":e=[64,224,208];break;case"violet":e=[238,130,238];break;case"wheat":e=[245,222,179];break;case"white":e=[255,255,255];break;case"whitesmoke":e=[245,245,245];break;case"yellow":e=[255,255,0];break;case"yellowgreen":e=[154,205,50]}return e}function ua(t,e,i){var n=t._content.dictionary.getArray("BBox"),r=.1,s=.1;if(n&&null!=e)if(0===e)t._content.dictionary.set("Matrix",[1,0,0,1,-n[0],-n[1]]);else{var a=new Rr;if(90===e?a._translate(n[3],-n[0]):180===e?a._translate(n[2],n[3]):270===e&&(i?a._translate(-n[1],n[2]):a._translate(-n[1],n[3])),e%90!=0&&i&&i instanceof An){var o=void 0,h=void 0,c=(n&&Array.isArray(n)&&1<n.length&&(o=n[0],h=n[1]),i.bounds.width),_=i.bounds.height;if("number"==typeof o&&"number"==typeof h&&0!==o&&0!==h){o=pa(e,n,r,i),h=fa(e,n,s,i);if(0<o)if(o<c)for(;Math.round(10*c)/10!=Math.round(10*pa(e,n,r,i))/10&&Math.round(10*c)/10>Math.round(10*pa(e,n,r,i))/10;)r+=.1;else for(;Math.round(10*c)/10!=Math.round(10*pa(e,n,r,i))/10&&Math.round(10*c)/10<Math.round(10*pa(e,n,r,i))/10;)r-=.1;else for(;Math.round(10*c)/10!=Math.round(10*pa(e,n,r,i))/10&&Math.round(10*c)/10>Math.round(10*pa(e,n,r,i))/10;)r+=.1;if(0<h)if(h<_)for(;Math.round(10*_)/10!=Math.round(10*fa(e,n,s,i))/10&&Math.round(10*_)/10>Math.round(10*fa(e,n,s,i))/10;)s+=.1;else for(;Math.round(10*_)/10!=Math.round(10*fa(e,n,s,i))/10&&Math.round(10*_)/10<Math.round(10*fa(e,n,s,i))/10;)s-=.1;else for(;Math.round(10*_)/10!=Math.round(10*fa(e,n,s,i))/10&&Math.round(10*_)/10>Math.round(10*fa(e,n,s,i))/10;)s+=.1}else{o=Math.abs(i.bounds.width-Math.round(pa(e,n,r,i))),h=Math.abs(i.bounds.height-Math.round(fa(e,n,s,i)));Math.round(i.bounds.width)>r&&(r=Math.round(o/r)*r),Math.round(i.bounds.width)>s&&(s=Math.round(h/s)*s)}a._translate(r,s)}a._rotate(e),t._content.dictionary.set("Matrix",a._matrix._elements)}}function pa(t,e,i,n){var r=new Rr;return r._translate(i,i),r._rotate(t),n._transformBBox({x:e[0],y:e[1],width:e[2],height:e[3]},r._matrix._elements)[2]}function fa(t,e,i,n){var r=new Rr;return r._translate(i,i),r._rotate(t),n._transformBBox({x:e[0],y:e[1],width:e[2],height:e[3]},r._matrix._elements)[3]}function ga(t){var e="4";switch(t){case M.PdfCheckBoxStyle.circle:e="l";break;case M.PdfCheckBoxStyle.cross:e="8";break;case M.PdfCheckBoxStyle.diamond:e="u";break;case M.PdfCheckBoxStyle.square:e="n";break;case M.PdfCheckBoxStyle.star:e="H"}return e}function ya(t){var e=M.PdfCheckBoxStyle.check;switch(t){case"l":e=M.PdfCheckBoxStyle.circle;break;case"8":e=M.PdfCheckBoxStyle.cross;break;case"u":e=M.PdfCheckBoxStyle.diamond;break;case"n":e=M.PdfCheckBoxStyle.square;break;case"H":e=M.PdfCheckBoxStyle.star}return e}function ma(t){var e;switch(t){case"cm":e=M.PdfMeasurementUnit.centimeter;break;case"in":e=M.PdfMeasurementUnit.inch;break;case"mm":e=M.PdfMeasurementUnit.millimeter;break;case"p":e=M.PdfMeasurementUnit.pica;break;case"pt":e=M.PdfMeasurementUnit.point;break;default:e=M.PdfMeasurementUnit.centimeter}return e}function ba(t){var e;switch(t){case"Highlight":e=M.PdfTextMarkupAnnotationType.highlight;break;case"Squiggly":e=M.PdfTextMarkupAnnotationType.squiggly;break;case"StrikeOut":e=M.PdfTextMarkupAnnotationType.strikeOut;break;case"Underline":e=M.PdfTextMarkupAnnotationType.underline;break;default:e=M.PdfTextMarkupAnnotationType.highlight}return e}function wa(t){var e="Highlight";switch(t){case M.PdfTextMarkupAnnotationType.highlight:e="Highlight";break;case M.PdfTextMarkupAnnotationType.squiggly:e="Squiggly";break;case M.PdfTextMarkupAnnotationType.strikeOut:e="StrikeOut";break;case M.PdfTextMarkupAnnotationType.underline:e="Underline";break;default:e="Highlight"}return e}function va(t){var e;switch(t){case"cm":e=M._PdfGraphicsUnit.centimeter;break;case"in":e=M._PdfGraphicsUnit.inch;break;case"mm":e=M._PdfGraphicsUnit.millimeter;break;case"p":e=M._PdfGraphicsUnit.pica;break;case"pt":e=M._PdfGraphicsUnit.point;break;default:e=M._PdfGraphicsUnit.centimeter}return e}function Sa(t){var e;switch(t=t.includes("23")?t.replace(/\s+/g,"").replace(/23/g,""):t){case"#Approved":case"SBApproved":e=M.PdfRubberStampAnnotationIcon.approved;break;case"#AsIs":case"SBAsIs":e=M.PdfRubberStampAnnotationIcon.asIs;break;case"#Completed":case"SBCompleted":e=M.PdfRubberStampAnnotationIcon.completed;break;case"#Confidential":case"SBConfidential":e=M.PdfRubberStampAnnotationIcon.confidential;break;case"#Departmental":case"SBDepartmental":e=M.PdfRubberStampAnnotationIcon.departmental;break;case"#Draft":case"SBDraft":e=M.PdfRubberStampAnnotationIcon.draft;break;case"#Experimental":case"SBExperimental":e=M.PdfRubberStampAnnotationIcon.experimental;break;case"#Expired":case"SBExpired":e=M.PdfRubberStampAnnotationIcon.expired;break;case"#Final":case"SBFinal":e=M.PdfRubberStampAnnotationIcon.final;break;case"#ForComment":case"SBForComment":e=M.PdfRubberStampAnnotationIcon.forComment;break;case"#ForPublicRelease":case"SBForPublicRelease":e=M.PdfRubberStampAnnotationIcon.forPublicRelease;break;case"#InformationOnly":case"SBInformationOnly":e=M.PdfRubberStampAnnotationIcon.informationOnly;break;case"#NotApproved":case"SBNotApproved":e=M.PdfRubberStampAnnotationIcon.notApproved;break;case"#NotForPublicRelease":case"SBNotForPublicRelease":e=M.PdfRubberStampAnnotationIcon.notForPublicRelease;break;case"#PreliminaryResults":case"SBPreliminaryResults":e=M.PdfRubberStampAnnotationIcon.preliminaryResults;break;case"#Sold":case"SBSold":e=M.PdfRubberStampAnnotationIcon.sold;break;case"#TopSecret":case"SBTopSecret":e=M.PdfRubberStampAnnotationIcon.topSecret;break;case"#Void":case"SBVoid":e=M.PdfRubberStampAnnotationIcon.void;break;default:e=M.PdfRubberStampAnnotationIcon.draft}return e}function Pa(t){var e;switch(t){case"Note":e=M.PdfPopupIcon.note;break;case"Comment":e=M.PdfPopupIcon.comment;break;case"Help":e=M.PdfPopupIcon.help;break;case"Insert":e=M.PdfPopupIcon.insert;break;case"Key":e=M.PdfPopupIcon.key;break;case"NewParagraph":e=M.PdfPopupIcon.newParagraph;break;case"Paragraph":e=M.PdfPopupIcon.paragraph;break;default:e=M.PdfPopupIcon.note}return e}function xa(t){var e="None";switch(t){case M.PdfAnnotationState.none:e="None";break;case M.PdfAnnotationState.accepted:e="Accepted";break;case M.PdfAnnotationState.rejected:e="Rejected";break;case M.PdfAnnotationState.cancel:e="Cancelled";break;case M.PdfAnnotationState.completed:e="Completed";break;case M.PdfAnnotationState.marked:e="Marked";break;case M.PdfAnnotationState.unmarked:e="Unmarked";break;case M.PdfAnnotationState.unknown:e="Unknown";break;default:e="None"}return e}function Aa(t){var e=M.PdfAnnotationState.none;switch(t){case"None":e=M.PdfAnnotationState.none;break;case"Accepted":e=M.PdfAnnotationState.accepted;break;case"Rejected":e=M.PdfAnnotationState.rejected;break;case"Cancelled":e=M.PdfAnnotationState.cancel;break;case"Completed":e=M.PdfAnnotationState.completed;break;case"Marked":e=M.PdfAnnotationState.marked;break;case"Unmarked":e=M.PdfAnnotationState.unmarked;break;case"Unknown":e=M.PdfAnnotationState.unknown}return e}function Ta(t){var e="None";switch(t){case M.PdfAnnotationStateModel.none:e="None";break;case M.PdfAnnotationStateModel.marked:e="Marked";break;case M.PdfAnnotationStateModel.review:e="Review";break;default:e="None"}return e}function Ca(t){var e=M.PdfAnnotationStateModel.none;switch(t){case"None":e=M.PdfAnnotationStateModel.none;break;case"Marked":e=M.PdfAnnotationStateModel.marked;break;case"Review":e=M.PdfAnnotationStateModel.review}return e}function ka(t){var e;switch(t){case"PushPin":e=M.PdfAttachmentIcon.pushPin;break;case"Tag":e=M.PdfAttachmentIcon.tag;break;case"Graph":e=M.PdfAttachmentIcon.graph;break;case"Paperclip":e=M.PdfAttachmentIcon.paperClip;break;default:e=M.PdfAttachmentIcon.pushPin}return e}function Ra(t){var e;switch(t){case"None":e=M.PdfAnnotationIntent.none;break;case"FreeTextCallout":e=M.PdfAnnotationIntent.freeTextCallout;break;case"FreeTextTypeWriter":e=M.PdfAnnotationIntent.freeTextTypeWriter;break;default:e=M.PdfAnnotationIntent.none}return e}function Fa(t){var e=[];return 0<(t&M.PdfFontStyle.bold)&&e.push("Bold"),0<(t&M.PdfFontStyle.italic)&&e.push("Italic"),0<(t&M.PdfFontStyle.underline)&&e.push("Underline"),0<(t&M.PdfFontStyle.strikeout)&&e.push("Strikeout"),0===e.length?"Regular":e.join(", ")}function Ia(t){var e;switch(t){case"head2right":e="➢";break;case"aacute":e="á";break;case"eacute":e="é";break;case"iacute":e="í";break;case"oacute":e="ó";break;case"uacute":e="ú";break;case"circleright":e="➲";break;case"bleft":e="⇦";break;case"bright":e="⇨";break;case"bup":e="⇧";break;case"bdown":e="⇩";break;case"barb4right":e="➔";break;case"bleftright":e="⬄";break;case"bupdown":e="⇳";break;case"bnw":e="⬀";break;case"bne":e="⬁";break;case"bsw":e="⬃";break;case"bse":e="⬂";break;case"bdash1":e="▭";break;case"bdash2":e="▫";break;case"xmarkbld":e="✗";break;case"checkbld":e="✓";break;case"boxxmarkbld":e="☒";break;case"boxcheckbld":e="☑";break;case"space":e=" ";break;case"pencil":e="✏";break;case"scissors":e="✂";break;case"scissorscutting":case"readingglasses":case"bell":case"book":case"telephonesolid":case"telhandsetcirc":case"envelopeback":e="✁";break;case"hourglass":e="⌛";break;case"keyboard":e="⌨";break;case"tapereel":e="✇";break;case"handwrite":e="✍";break;case"handv":e="✌";break;case"handptleft":e="☜";break;case"handptright":e="☞";break;case"handptup":e="☝";break;case"handptdown":e="☟";break;case"smileface":e="☺";break;case"frownface":e="☹";break;case"skullcrossbones":e="☠";break;case"flag":e="⚐";break;case"pennant":e="Ὢ9";break;case"airplane":e="✈";break;case"sunshine":e="☼";break;case"droplet":e="Ὂ7";break;case"snowflake":e="❄";break;case"crossshadow":e="✞";break;case"crossmaltese":e="✠";break;case"starofdavid":e="✡";break;case"crescentstar":e="☪";break;case"yinyang":e="☯";break;case"om":e="ॐ";break;case"wheel":e="☸";break;case"aries":e="♈";break;case"taurus":e="♉";break;case"gemini":e="♊";break;case"cancer":e="♋";break;case"leo":e="♌";break;case"virgo":e="♍";break;case"libra":e="♎";break;case"scorpio":e="♏";break;case"saggitarius":e="♐";break;case"capricorn":e="♑";break;case"aquarius":e="♒";break;case"pisces":e="♓";break;case"ampersanditlc":case"ampersandit":e="&";break;case"circle6":e="●";break;case"circleshadowdwn":e="❍";break;case"square6":e="■";break;case"box3":e="□";break;case"boxshadowdwn":e="❑";break;case"boxshadowup":e="❒";break;case"lozenge4":e="⬧";break;case"lozenge6":e="⧫";break;case"rhombus6":e="◆";break;case"xrhombus":e="❖";break;case"rhombus4":e="⬥";break;case"clear":e="⌧";break;case"escape":e="⍓";break;case"command":e="⌘";break;case"rosette":e="❀";break;case"rosettesolid":e="✿";break;case"quotedbllftbld":e="❝";break;case"quotedblrtbld":e="❞";break;case".notdef":e="▯";break;case"zerosans":e="⓪";break;case"onesans":e="①";break;case"twosans":e="②";break;case"threesans":e="③";break;case"foursans":e="④";break;case"fivesans":e="⑤";break;case"sixsans":e="⑥";break;case"sevensans":e="⑦";break;case"eightsans":e="⑧";break;case"ninesans":e="⑨";break;case"tensans":e="⑩";break;case"zerosansinv":e="⓿";break;case"onesansinv":e="❶";break;case"twosansinv":e="❷";break;case"threesansinv":e="❸";break;case"foursansinv":e="❹";break;case"circle2":e="·";break;case"circle4":e="•";break;case"square2":e="▪";break;case"ring2":e="○";break;case"ringbutton2":e="◉";break;case"target":e="◎";break;case"square4":e="▪";break;case"box2":e="◻";break;case"crosstar2":e="✦";break;case"pentastar2":e="★";break;case"hexstar2":e="✶";break;case"octastar2":e="✴";break;case"dodecastar3":e="✹";break;case"octastar4":e="✵";break;case"registercircle":e="⌖";break;case"cuspopen":e="⟡";break;case"cuspopen1":e="⌑";break;case"circlestar":e="★";break;case"starshadow":e="✰";break;case"deleteleft":e="⌫";break;case"deleteright":e="⌦";break;case"scissorsoutline":e="✄";break;case"telephone":e="☏";break;case"telhandset":e="ὍE";break;case"handptlft1":e="☜";break;case"handptrt1":e="☞";break;case"handptlftsld1":e="☚";break;case"handptrtsld1":e="☛";break;case"handptup1":e="☝";break;case"handptdwn1":e="☟";break;case"xmark":e="✗";break;case"check":e="✓";break;case"boxcheck":e="☑";break;case"boxx":case"boxxbld":e="☒";break;case"circlex":e="=⌔";break;case"circlexbld":e="⌔";break;case"prohibit":case"prohibitbld":e="⦸";break;case"ampersanditaldm":case"ampersandbld":case"ampersandsans":case"ampersandsandm":e="&";break;case"interrobang":case"interrobangdm":case"interrobangsans":case"interrobngsandm":e="‽";break;case"sacute":e="ś";break;case"Sacute":e="Ś";break;case"eogonek":e="ę";break;case"cacute":e="ć";break;case"aogonek":e="ą";break;default:e=t}return e}function Da(t){var e;switch(t){case"zero":e="0";break;case"one":e="1";break;case"two":e="2";break;case"three":e="3";break;case"four":e="4";break;case"five":e="5";break;case"six":e="6";break;case"seven":e="7";break;case"eight":e="8";break;case"nine":e="9";break;case"aacute":e="á";break;case"asciicircum":e="^";break;case"asciitilde":e="~";break;case"asterisk":e="*";break;case"at":e="@";break;case"atilde":e="ã";break;case"backslash":e="\\";break;case"bar":e="|";break;case"braceleft":e="{";break;case"braceright":e="}";break;case"bracketleft":e="[";break;case"bracketright":e="]";break;case"breve":e="˘";break;case"brokenbar":e="|";break;case"bullet3":case"bullet":e="•";break;case"caron":e="ˇ";break;case"ccedilla":e="ç";break;case"cedilla":e="¸";break;case"cent":e="¢";break;case"circumflex":e="ˆ";break;case"colon":e=":";break;case"comma":e=",";break;case"copyright":e="©";break;case"currency1":e="¤";break;case"dagger":e="†";break;case"daggerdbl":e="‡";break;case"degree":e="°";break;case"dieresis":e="¨";break;case"divide":e="÷";break;case"dollar":e="$";break;case"dotaccent":e="˙";break;case"dotlessi":e="ı";break;case"eacute":e="é";break;case"middot":e="˙";break;case"edieresis":e="ë";break;case"egrave":e="è";break;case"ellipsis":e="...";break;case"emdash":e="—";break;case"endash":e="–";break;case"equal":e="=";break;case"eth":e="ð";break;case"exclam":e="!";break;case"exclamdown":e="¡";break;case"florin":e="ƒ";break;case"fraction":e="⁄";break;case"germandbls":e="ß";break;case"grave":e="`";break;case"greater":e=">";break;case"guillemotleft4":e="«";break;case"guillemotright4":e="»";break;case"guilsinglleft":e="‹";break;case"guilsinglright":e="›";break;case"hungarumlaut":e="˝";break;case"hyphen5":e="-";break;case"iacute":e="í";break;case"icircumflex":e="î";break;case"idieresis":e="ï";break;case"igrave":e="ì";break;case"less":e="<";break;case"logicalnot":e="¬";break;case"lslash":e="ł";break;case"Lslash":e="Ł";break;case"macron":e="¯";break;case"minus":e="−";break;case"mu":e="μ";break;case"multiply":e="×";break;case"ntilde":e="ñ";break;case"numbersign":e="#";break;case"oacute":e="ó";break;case"ocircumflex":e="ô";break;case"odieresis":e="ö";break;case"oe":e="oe";break;case"ogonek":e="˛";break;case"ograve":e="ò";break;case"onehalf":e="1/2";break;case"onequarter":e="1/4";break;case"onesuperior":e="¹";break;case"ordfeminine":e="ª";break;case"ordmasculine":e="º";break;case"otilde":e="õ";break;case"paragraph":e="¶";break;case"parenleft":e="(";break;case"parenright":e=")";break;case"percent":e="%";break;case"period":e=".";break;case"periodcentered":e="·";break;case"perthousand":e="‰";break;case"plus":e="+";break;case"plusminus":e="±";break;case"question":e="?";break;case"questiondown":e="¿";break;case"quotedbl":e="'";break;case"quotedblbase":e="„";break;case"quotedblleft":e="“";break;case"quotedblright":e="”";break;case"quoteleft":e="‘";break;case"quoteright":e="’";break;case"quotesinglbase":e="‚";break;case"quotesingle":e="'";break;case"registered":e="®";break;case"ring":e="˚";break;case"scaron":e="š";break;case"section":e="§";break;case"semicolon":e=";";break;case"slash":e="/";break;case"space6":case"space":e=" ";break;case"udieresis":e="ü";break;case"uacute":e="ú";break;case"Ecircumflex":e="Ê";break;case"hyphen":e="-";break;case"underscore":e="_";break;case"adieresis":e="ä";break;case"ampersand":e="&";break;case"Adieresis":e="Ä";break;case"Udieresis":e="Ü";break;case"ccaron":e="č";break;case"Scaron":e="Š";break;case"zcaron":e="ž";break;case"sterling":e="£";break;case"agrave":e="à";break;case"ecircumflex":e="ê";break;case"acircumflex":e="â";break;case"Oacute":e="Ó";break;default:e=t}return e}function Ba(t){var e=t.get("F");return(t.has("State")||t.has("StateModel"))&&(30===e||128===e)}function La(t){var e=t.get("F");return!(t.has("State")||t.has("StateModel")||28!==e&&128!==e)}function Oa(t,e){switch(t.has("F")&&(delete t._map.F,t._updated=!0),e){case M.PdfFormFieldVisibility.hidden:t.update("F",M.PdfAnnotationFlag.hidden);break;case M.PdfFormFieldVisibility.hiddenPrintable:t.update("F",M.PdfAnnotationFlag.noView|M.PdfAnnotationFlag.print);break;case M.PdfFormFieldVisibility.visible:var i;t.has("DV")&&(delete t._map.DV,t._updated=!0),t.has("MK")&&(i=t.get("MK"))&&i.has("BG")&&(delete i._map.BG,i._updated=!0)}}function T(t,e,i){var n;t&&t.has(i)&&(n=t.getRaw(i))&&n instanceof m&&n._isNew&&((t=t.get(i))&&(i=void 0,(t=t instanceof m?e._fetch(t):t)instanceof D?i=t:t instanceof y&&(i=t.dictionary),i)&&i.has("Resources")&&Ma(i.get("Resources"),e),e._cacheMap.delete(n))}function Ma(r,s){r&&0<r.size&&r.forEach(function(t,e){var i,n;void 0!==t&&void 0!==e&&(e instanceof m?(i=e)._isNew&&(n=r.get(t))&&n instanceof D&&("XObject"===t&&n.has("Resources")&&Ma(n.get("Resources"),s),s._cacheMap.delete(i)):e instanceof D&&(e.has("Resources")&&Ma(e.get("Resources"),s),"Font"!==t&&"XObject"!==t&&"ExtGState"!==t||Ma(e,s)))})}function Ea(t,e,i,n){var r;t&&(t instanceof D?r=t:t instanceof g&&(r=t.dictionary)),r&&(T(r,e,i),T(r,e,n))}var Na,ja=function(t,e){this.message=t,this.name=e},S=(d(Va,Na=ja),Va);function Va(t){return Na.call(this,t,"FormatError")||this}d(Ha,za=ja);var za,Ua=Ha;function Ha(t){return za.call(this,t,"ParserEndOfFileException")||this}function Wa(t){return"[object String]"===Object.prototype.toString.call(t)?"$s"+t:"$o"+t.toString()}function qa(t,e,i){var n,r,s,a="",o=!0;if((d=(d=e&&e._dictionary.has("DA")||i._dictionary.has("DA")?(e&&e._dictionary.has("DA")?e:i)._dictionary.get("DA"):d)instanceof R?d.name:d)&&d.includes("Tf")&&2<=(p=(c=d.trim().split(/\s+/)).indexOf("Tf"))&&(a=(a=(a=c[p-2]).startsWith("/")?a.slice(1):a)&&So(a),n=parseFloat(c[p-1])),a=a&&a.trim(),t&&t._dictionary.has("DR")){var h,c=t._dictionary.get("DR");if(c.has("Font")&&(y=c.get("Font")).has(a)&&(_=y.get(a))&&a&&_.has("BaseFont")&&(l=_.get("BaseFont"),u=M.PdfFontStyle.regular,h=M.PdfFontFamily.helvetica,null!=a&&""!==a&&(h=Xa(a)),0===n&&(n=Ka(i,h)),(o=i&&i._dictionary.has("AP")?$a(i):o)&&(s=a+"_"+n+"_"+u),l&&(d=l.name,"Helvetica"===l.name&&(l.name="Helv"),u=Ja(l.name),t&&t._fontCache&&t._fontCache.has(s)&&0!==n&&(r=t._fontCache.get(s),i)&&i._dictionary&&i._dictionary.has("V")&&r instanceof ye&&(r._isUnicode=Qa(i._dictionary)),r||(d.includes("-")&&(d=d.substring(0,d.indexOf("-"))),e&&e._dictionary.has("DA")?r=e._dictionary.has("AP")?Ya(d,n,u,e):Ya(d,n,u,e,_):i&&i._dictionary.has("DA")&&(r=i._dictionary.has("AP")?Ya(d,n,u,i):Ya(d,n,u,i,_)))),!o)&&r instanceof E&&i instanceof Ue&&!i._isTextChanged&&_&&(p=r._metrics._widthTable,(d=Ga(_,r.height,l.name,r))&&(r._metrics=d),r._metrics._widthTable=p),r&&r._dictionary&&r._dictionary.has("BaseFont")){o=r._dictionary.get("BaseFont").name;if(o&&o!==a)if((y=c.get("Font"))&&y.has(a)){var _,d=(_=y.get(a)).get("Subtype").name;if(_&&a&&_.has("BaseFont")){var l,u=(l=_.get("BaseFont"))?Ja(l.name):M.PdfFontStyle.regular;if("TrueType"===d){var p=bo(t,_);if(p&&0<p.length){o=Is(p);if(o&&0<o.length){var f=!0;if(e||i){c=(e||i)._dictionary;if(c&&c.has("V")){var g=c.get("V");if(null!=g){f=wo(g);if(c.has("FT"))if("Ch"===c.get("FT").name&&c.has("Opt")){var y=c.get("Opt");if(y&&0<y.length)for(var m=0,b=y.filter(function(t){return 1<t.length});m<b.length;m++){var w=b[m],v=w[0],w=w[1];if(v===g){f=wo(w);break}}}}}}(r=new ye(o,n,u))._isUnicode=f}}}}}}}return null==r&&void 0!==n&&(h=M.PdfFontFamily.helvetica,null!=a&&""!==a&&(h=Xa(a)),0===n&&(n=Ka(i,h)),r=new E(h,n,M.PdfFontStyle.regular)),(null==r||r&&1===r.size)&&(!e||e._field instanceof ni?i&&(r=i._circleCaptionFont):r=e._circleCaptionFont),t&&t._fontCache&&0!==n&&r&&"string"==typeof s&&!t._fontCache.has(s)&&t._fontCache.set(s,r),r}function Ga(t,e,i,n){var r,s;return t.has("FontDescriptor")&&(r=new ht,s=t.get("FontDescriptor"))&&(n._ascent=s.get("Ascent"),n._descent=s.get("Descent"),n._ascent=s.get("Ascent"),n._height=n._ascent-n._descent,r._postScriptName=i),r&&t.has("Widths")&&(s=t.getArray("Widths"),r._widthTable=new ct(s)),r&&(r._name=i),r}function Ka(e,t){var i,n,r,s,a,o,h,c=[],_=0;try{if(e instanceof ni){var d=e.bounds.width,l=e.bounds.height,u=new E(t,12);if("number"==typeof e.selectedIndex){var p=e.itemAt(e.selectedIndex);p&&"string"==typeof p.text&&(i=p.text,c.push(u.measureString(i)))}else if(Array.isArray(e.selectedIndex))for(var f=0;f<e.selectedIndex.length;f++)i=e.itemAt(e.selectedIndex[f]).text,c.push(u.measureString(i));var g,y,m,b=[0,0],w=2*(g=e.border.width),v=2,S=e.border.style===M.PdfBorderStyle.inset||e.border.style===M.PdfBorderStyle.beveled,P=(S?(b[0]=2*w,b[1]=2*g):(b[0]=w+v,b[1]=v-1+ +g),[0,0,d,l]),x=P[2]-w,A=P;if(A[3]-=S?w:g,0===e.rotationAngle&&S&&(x-=w),_=0<c.length?(y=12*(x-b[0])/c[c.length-1].width,m=12*(P[3]-b[1])/c[c.length-1].height,Math.min(y,m)):12,0!==e._obtainSelectedValue().length){var T=new E(t,_),C=e._dictionary.get("V"),k=void 0;if(void 0!==(k=void 0!==C?Array.isArray(C)&&1<=C.length?T.measureString(C[0]):T.measureString(C):k)&&(k.width>d||k.height>l))for(var R=d-4*e.border.width,F=l-4*e.border.width,I=_,f=1;f<=l;f++){(T=new E(t,f))._size=f;var D=void 0;if((D=void 0!==C?Array.isArray(C)&&1<=C.length?T.measureString(C[0]):T.measureString(C):D).width>d||D.height>F){I=f;do{if((I-=.001)<.248){T._size=.248;break}(T=new E(t,I))._size=I;var B=e._getStringFormat(),L=(Array.isArray(C)&&1<=C.length&&(C=C[0]),T.getLineWidth(C,B)),O=T.measureString(C,B);if(L<R&&O.height<F){T._size=I;break}}while(.248<I);_=I;break}}}else 12<_&&(_=12)}else e instanceof Ue&&(d=e.bounds.width,l=e.bounds.height,C=e.text||"",b=[0,0],w=2*(g=e.border.width),v=2,e.border.style===M.PdfBorderStyle.inset||e.border.style===M.PdfBorderStyle.beveled?(b[0]=2*w,b[1]=2*g):(b[0]=w+v,b[1]=g+v-1),n=d-b[0],r=l-b[1],s=new E(t,12),_=e.multiLine?12.5:0<(a=s.measureString(C)).width&&0<a.height?(o=12*n/a.width,h=12*r/a.height,Math.min(o,h)):8)}catch(t){_=e instanceof Ue?e.multiLine?12.5:8:12}return 0===_?12:_}function Xa(t){t=t||"";switch(t=t.includes("-")?t.substring(0,t.indexOf("-")):t){case"Helv":case"Helvetica":return M.PdfFontFamily.helvetica;case"Cour":case"Courier":return M.PdfFontFamily.courier;case"Symb":case"Symbol":return M.PdfFontFamily.symbol;case"Times":case"TiRo":case"TimesRoman":return M.PdfFontFamily.timesRoman;case"ZaDb":case"ZapfDingbats":return M.PdfFontFamily.zapfDingbats}return M.PdfFontFamily.helvetica}function Ja(t){var e=t.indexOf("-"),i=(e<0&&(e=t.indexOf(",")),M.PdfFontStyle.regular);if(0<=e)switch(t.substring(e+1,t.length)){case"Bold":case"BoldMT":i=M.PdfFontStyle.bold;break;case"Italic":case"ItalicMT":case"Oblique":case"It":i=M.PdfFontStyle.italic;break;case"BoldItalic":case"BoldItalicMT":case"BoldOblique":i=M.PdfFontStyle.bold|M.PdfFontStyle.italic}return i}function Ya(t,e,i,n,r){var s,a,o,h,c,_=t||"",d=(_.includes("-")&&(_=_.substring(0,_.indexOf("-"))),void 0!==(e=void 0===e&&n instanceof xi&&n._isLoaded?10:e)?e:1);if(n._dictionary.has("DS")||n._dictionary.has("DA")||n instanceof Bn&&n._dictionary.has("AP"))switch(_){case"Helv":case"Helvetica":c=new E(M.PdfFontFamily.helvetica,d,i);break;case"Cour":case"Courier":c=new E(M.PdfFontFamily.courier,d,i);break;case"Symb":case"Symbol":c=new E(M.PdfFontFamily.symbol,d,i);break;case"Times":case"TiRo":case"TimesRoman":c=new E(M.PdfFontFamily.timesRoman,d,i);break;case"ZaDb":case"ZapfDingbats":c=new E(M.PdfFontFamily.zapfDingbats,d,i);break;case"MonotypeSungLight":c=new pe(M.PdfCjkFontFamily.monotypeSungLight,d,i);break;case"SinoTypeSongLight":c=new pe(M.PdfCjkFontFamily.sinoTypeSongLight,d,i);break;case"MonotypeHeiMedium":c=new pe(M.PdfCjkFontFamily.monotypeHeiMedium,d,i);break;case"HanyangSystemsGothicMedium":c=new pe(M.PdfCjkFontFamily.hanyangSystemsGothicMedium,d,i);break;case"HanyangSystemsShinMyeongJoMedium":c=new pe(M.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium,d,i);break;case"HeiseiKakuGothicW5":c=new pe(M.PdfCjkFontFamily.heiseiKakuGothicW5,d,i);break;case"HeiseiMinchoW3":c=new pe(M.PdfCjkFontFamily.heiseiMinchoW3,d,i);break;default:n._dictionary.has("AP")?s=to(n._crossReference,n,t):r&&(s=eo(r)),s&&0<s.length&&(s=new ye(s,d,i),n._dictionary&&n._dictionary.has("V")&&(s._isUnicode=Qa(n._dictionary)),c=s)}return c=null==c&&(e=n instanceof bi,_=n instanceof Ve,e&&!(n instanceof Bn)||_)&&(_=n._type,a=n._circleCaptionFont&&d>n._circleCaptionFont.size,e=e&&_!==M._PdfAnnotationType.widgetAnnotation,o=n instanceof Ue&&a,h=n instanceof ni&&a,c=e||o||h?new E(M.PdfFontFamily.helvetica,d,i):n._circleCaptionFont,_===M._PdfAnnotationType.widgetAnnotation)&&a?new E(M.PdfFontFamily.helvetica,d,i):c}function Qa(t){var e=!0,i=t.get("V");if(null!=i){e=wo(i);if(t.has("FT"))if("Ch"===t.get("FT").name&&t.has("Opt")){var n=t.get("Opt");if(n&&0<n.length)for(var r=0;r<n.length;r++){var s=n[r];if(s&&1<s.length){var a=s[0],s=s[1];if(a&&s&&a===i&&s){e=wo(s);break}}}}}return e}function Za(t){var e,i,t=t._dictionary;return e=t&&t.has("AP")&&(t=t.get("AP"))&&t instanceof D&&t.has("N")&&(i=void 0,(t=t.get("N"))&&(t instanceof g?i=t:t.stream&&t.stream instanceof g&&(i=t.stream)),i)&&i.dictionary&&i.dictionary.has("Resources")&&(t=i.dictionary.get("Resources"))&&t instanceof D&&t.has("Font")&&(i=t.get("Font"))instanceof D?i:e}function $a(t){var e,i,n=!1,r=Za(t);return r&&t instanceof Ve&&(t=t.form)&&t._dictionary.has("DR")&&(e=t._dictionary.get("DR")).has("Font")&&(t._fontResources||(t._fontResources=e.get("Font")),i=t._fontResources)&&r.forEach(function(t,e){i.has(t)&&(n=!0)}),n}function to(i,t,e){var n,r=Za(t);return r&&r.forEach(function(t,e){!n&&e instanceof m&&(e=i._fetch(e),n=eo(e))}),n=!n&&t instanceof Ve&&e&&(r=t.form)&&r._dictionary.has("DR")&&(t=r._dictionary.get("DR"))&&t.has("Font")&&(r=t.get("Font"))&&r.has(e)&&(t=r.get(e))?eo(t):n}function eo(t){var e,i,n;return t&&t.has("DescendantFonts")?(n=t.getArray("DescendantFonts"))&&0<n.length&&n.forEach(function(t){t&&t instanceof D&&t.has("FontDescriptor")&&(i=t.get("FontDescriptor"))}):t&&t.has("FontDescriptor")&&(i=t.get("FontDescriptor")),i&&i.has("FontFile2")&&((n=i.get("FontFile2"))instanceof g&&0<n.length?e=n.getByteRange(n.start,n.end):n.stream&&n.dictionary&&(n.dictionary.has("Length1")||n.dictionary.has("Length"))&&(t=n.dictionary.get(n.dictionary.has("Length1")?"Length1":"Length"),n.getBytes(t),e=n.buffer.subarray(0,t))),e}function io(t,i){return t.length===i.length&&t.every(function(t,e){return ys(t,i[e])})}function no(t,e){var i,n;return e&&(t._bounds={x:e[0],y:e[1],width:e[2],height:e[3]}),t._page&&t.bounds?(n=[t.bounds.x,t.bounds.y+t.bounds.height,t.bounds.width,t.bounds.height],t._page._isNew&&t._page._pageSettings?(i=[(e=t._page._pageSettings).margins.left,e.margins.top,e.size.width-(e.margins.left+e.margins.right),e.size.height-(e.margins.top+e.margins.bottom)],n[0]+=i[0],n[1]=e.size.height-(i[1]+n[1])):(e=t._page.size,n[1]=e.height-(t.bounds.y+t.bounds.height),(i=t._getCropOrMediaBox())&&2<i.length&&(0!==i[0]||0!==i[1])&&(n[0]+=i[0],n[1]+=i[1])),t._page&&"function"==typeof t._page._getTemplateReservedSpace&&(e=t._page._getTemplateReservedSpace())&&4<=e.length&&(n[0]+=e[3],n[1]-=e[0]),[n[0],n[1],n[0]+n[2],n[1]+n[3]]):n}function ro(t,e){if(!t||!e)return t;if(t.length<e.length)return t;for(var i=t.length-e.length,n=0;n<e.length;n++)if(t.charCodeAt(i+n)!==e.charCodeAt(n))return t;return t.substring(0,i)}function so(t,e,i){if(!t||"string"!=typeof t||e||i)return t;if(t.length<2)return t;var e=255&t.charCodeAt(0),i=255&t.charCodeAt(1),n=254==e&&255==i,e=255==e&&254==i;if(!n&&!e)return t;var r=t.substring(2),s=(r=0<(r=ro(r,n?"ÿý":"ýÿ")).length&&0==(255&r.charCodeAt(r.length-1))?r.substring(0,r.length-1):r).length;if(0===s)return"";for(var a=new Uint8Array(s),o=0;o<s;o++)a[o]=255&r.charCodeAt(o);return 0!=(1&a.length)?(i=new Uint8Array(a.length+1),e?(i.set(a,0),i[a.length]=0):(i[0]=0,i.set(a,1)),ao(i,n)):ao(a,n)}function ao(t,e){var i=t.length,n=new Array(i/2);if(e)for(var r=0,s=0;r<i;r+=2,s++)n[s]=t[r]<<8|t[r+1];else for(r=0,s=0;r<i;r+=2,s++)n[s]=t[r+1]<<8|t[r];return String.fromCharCode.apply(null,n)}function oo(t){return t<=4294967295?t<=65535?t<=255?1:2:t<=16777215?3:4:8}function ho(t){for(var e=[],i=0;i<t.length;i++){var n=t.charCodeAt(i);n<=65535&&(e.push(n>>8&255),e.push(255&n))}return e}function co(t,e){switch(e){case M.PdfNumberStyle.none:return"";case M.PdfNumberStyle.numeric:return t.toString();case M.PdfNumberStyle.lowerLatin:return lo(t).toLowerCase();case M.PdfNumberStyle.lowerRoman:return _o(t).toLowerCase();case M.PdfNumberStyle.upperLatin:return lo(t);case M.PdfNumberStyle.upperRoman:return _o(t)}}function _o(t){for(var e="",i=0,n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];i<n.length;i++)for(var r=n[i],s=r[0],a=r[1];s<=t;)e+=a,t-=s;return e}function lo(t){for(var e="";0<t;){var i=t%26;t=Math.floor(t/26),0===i&&(t--,i=26),e=uo(i)+e}return e}function uo(t){if(t<=0||26<t)throw new Error("Value can not be less 0 and greater 26");return String.fromCharCode(64+t)}function k(t){return null!=t}function po(t,e){var i;if(void 0===e&&(e=!1),t instanceof g&&t.bytes&&t.isImageStream)i=t.bytes;else{for(var n=t.getString(),r=[],s=0;s<n.length;s++)r.push(n.charCodeAt(s));i=new Uint8Array(r)}var a=new O.CompressedStreamWriter,o=(a.write(i,0,i.length),a.close(),a.getCompressedString);if(t.dictionary.update("Filter",R.get("FlateDecode")),e){for(var h=[],s=0;s<o.length;s++)h.push(255&o.charCodeAt(s));return As(new Uint8Array(h))}return o}function fo(t){return/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/.test(t)}function go(t,e){t.update("Count",t.get("Count")+e),t.has("Parent")&&(t=t.get("Parent"))&&"Pages"===t.get("Type").name&&go(t,e)}function yo(t,e){var i=[0,0,e.size.width,e.size.height],i=(t.update("MediaBox",i),t.update("CropBox",i),90*Math.floor(e.rotation));360<=i&&(i%=360),t.update("Rotate",i)}function mo(t){var e=/[^\x00-\x7F]/;return t.split("").some(function(t){return null!==e.exec(t)})}function bo(n,t){var r;return t&&t.forEach(function(t,e){var i;e&&e.objectNumber&&(i=n._crossReference._fetch(e))&&i instanceof D&&i.forEach(function(t,e){e&&e instanceof R&&"FontDescriptor"===e.name&&(e=void 0,i&&i.has("FontFile2")?(e=i.get("FontFile2"))&&e instanceof y&&(r=e.getBytes()):i&&i.has("FontFile3")&&(e=i.get("FontFile3"))&&e instanceof y&&(r=e.getBytes()))})}),r}function wo(t){if(null==t)throw new Error("ArgumentNullException: value");for(var e=0;e<t.length;e++)if(127<t.charCodeAt(e))return!0;return!1}function vo(t){if("0"<=t&&t<="9")return t.charCodeAt(0)-"0".charCodeAt(0);if("A"<=t&&t<="F")return t.charCodeAt(0)-"A".charCodeAt(0)+10;if("a"<=t&&t<="f")return t.charCodeAt(0)-"a".charCodeAt(0)+10;throw new Error("Invalid hex character: "+t)}function So(t){for(var e=[],i=t.length,n=0;n<i;++n){var r,s,a=t[n];"#"===a&&(r=vo(t[n+1]),s=vo(t[n+2]),a=String.fromCharCode((r<<4)+s),n+=2),e.push(a)}return e.join("")}function Po(t,e){t.style===M.PdfBorderStyle.dashed&&(e.borderPen._dashStyle=M.PdfDashStyle.dash,e.borderPen._dashPattern=[3])}function xo(t,e){return t[e]<<8|t[e+1]}function Ao(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}function To(t,e){return t[e]<<24>>24}function Co(t){return 0<t?Math.ceil(Math.log2(t)):0}function ko(t,e,i,n){return void 0===n&&(n=!1),Object.defineProperty(t,e,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}function Ro(){var t=new Uint8Array(4);return(t[0]=1)===new Uint32Array(t.buffer,0,1)[0]}function Fo(t){t=t._getSequence();if(3===t.length){t=t[2];if(t._tagClass===M._TagClassType.universal&&t._getTagNumber()===M._UniversalType.abstractSyntaxSet&&t._construction===M._ConstructionType.constructed)return t}}function Io(t,e){if(t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function Do(t,e,i){var n=jo(),r=n(1);for(t%=i;e>n(0);)e%n(2)===n(1)&&(r=r*t%i),e>>=n(1),t=t*t%i;return r}function Bo(t,e){var i=jo(),n=e,r=i(0),s=i(1);if(e===i(1))return i(0);for(;t>i(1);){if(e===i(0))return i(1);var a=t/e,o=e;e=t%e,t=o,r=s-a*(o=r),s=o}return s<i(0)&&(s+=n),s}function Lo(t){for(var e=jo(),i=e(0),n=0;n<t.length;n++)i=(i<<e(8))+e(t[n]);return i}function Oo(t){if(t===jo()(0))return new Uint8Array([0]);for(var e=t.toString(16),i=(e=e.length%2!=0?"0"+e:e).length/2,n=new Uint8Array(i),r=0;r<i;r++)n[r]=parseInt(e.substr(2*r,2),16);return n}function Mo(t){for(var e=Math.ceil(t/8),i=new Uint8Array(e),n=0;n<e;n++)i[n]=Math.floor(256*Math.random());t=(1<<t%8)-1;return 0<t&&(i[0]&=t),Lo(i)}function Eo(t,e){if(e<=t)return t;for(var i=e.toString(2).length,n=0;n<1e3;n++){var r=Mo(i);if(t<=r&&r<=e)return r}return Mo((e-t).toString(2).length-1)+t}function No(t){var e=t.length;return 77!==e&&109!==e&&93!==e&&65!==e||49!==t[0]?135!==e&&212!==e&&180!==e||49!==t[0]||129!==t[1]?119===e&&49===t[0]?t.slice(1):t:t.slice(2):t.slice(1)}function jo(){return Function("return BigInt")()}function Vo(t){return t<10?"0"+t:""+t}function zo(t){return"D:"+t.getUTCFullYear()+Vo(t.getUTCMonth()+1)+Vo(t.getUTCDate())+Vo(t.getUTCHours())+Vo(t.getUTCMinutes())+Vo(t.getUTCSeconds())+"Z"}function Uo(t){if(t.startsWith("D:")){var e=parseInt(t.substring(2,6),10),i=parseInt(t.substring(6,8),10)-1,n=parseInt(t.substring(8,10),10),r=parseInt(t.substring(10,12),10),s=parseInt(t.substring(12,14),10),a=parseInt(t.substring(14,16),10),e=Date.UTC(e,i,n,r,s,a);if(17<=t.length){i=t[16];if("Z"===i)return new Date(e);if(("+"===i||"-"===i)&&23<=t.length)return n=6e4*(60*parseInt(t.substring(17,19),10)+parseInt(t.substring(20,22),10)),e-="+"===i?n:-n,new Date(e)}return e-=198e5,new Date(e)}return new Date(t)}function Ho(t){var e="Unknown";switch(t){case M.PdfCjkFontFamily.hanyangSystemsGothicMedium:case M.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:e="UniKS-UCS2-H";break;case M.PdfCjkFontFamily.heiseiKakuGothicW5:case M.PdfCjkFontFamily.heiseiMinchoW3:e="UniJIS-UCS2-H";break;case M.PdfCjkFontFamily.monotypeHeiMedium:case M.PdfCjkFontFamily.monotypeSungLight:e="UniCNS-UCS2-H";break;case M.PdfCjkFontFamily.sinoTypeSongLight:e="UniGB-UCS2-H"}return new R(e)}function Wo(t,e,i){var n=new D;return n._updated=!0,n.set("Type",R.get("Font")),n.set("Subtype",R.get("CIDFontType2")),n.set("BaseFont",new R(i._postScriptName)),n.set("DW",i._widthTable._defaultWidth),n.set("W",i._widthTable._toArray()),n.set("CIDSystemInfo",qo(t)),[n]}function qo(t){var e=new D;switch(e._updated=!0,e.set("Registry","Adobe"),t){case M.PdfCjkFontFamily.hanyangSystemsGothicMedium:case M.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium:e.set("Ordering","Korea1"),e.set("Supplement",1);break;case M.PdfCjkFontFamily.heiseiKakuGothicW5:case M.PdfCjkFontFamily.heiseiMinchoW3:e.set("Ordering","Japan1"),e.set("Supplement",2);break;case M.PdfCjkFontFamily.monotypeHeiMedium:case M.PdfCjkFontFamily.monotypeSungLight:e.set("Ordering","CNS1"),e.set("Supplement","0");break;case M.PdfCjkFontFamily.sinoTypeSongLight:e.set("Ordering","GB1"),e.set("Supplement",2)}return e}function Go(t){return t.includes("Helvetica")?M.PdfFontFamily.helvetica:t.includes("Courier")?M.PdfFontFamily.courier:t.includes("Times")?M.PdfFontFamily.timesRoman:t.includes("Symbol")?M.PdfFontFamily.symbol:t.includes("ZapfDingbats")?M.PdfFontFamily.zapfDingbats:M.PdfFontFamily.helvetica}function Ko(t){switch(t){case"HeiseiKakuGo-W5":case"HeiseiKakuGo-W5,BoldItalic":case"HeiseiKakuGo-W5,Bold":case"HeiseiKakuGo-W5,Italic":return M.PdfCjkFontFamily.heiseiKakuGothicW5;case"HeiseiMin-W3":case"HeiseiMin-W3,BoldItalic":case"HeiseiMin-W3,Bold":case"HeiseiMin-W3,Italic":return M.PdfCjkFontFamily.heiseiMinchoW3;case"HYGoThic-Medium":case"HYGoThic-Medium,BoldItalic":case"HYGoThic-Medium,Bold":case"HYGoThic-Medium,Italic":return M.PdfCjkFontFamily.hanyangSystemsGothicMedium;case"HYSMyeongJo-Medium":case"HYSMyeongJo-Medium,BoldItalic":case"HYSMyeongJo-Medium,Bold":case"HYSMyeongJo-Medium,Italic":return M.PdfCjkFontFamily.hanyangSystemsShinMyeongJoMedium;case"MHei-Medium":case"MHei-Medium,BoldItalic":case"MHei-Medium,Bold":case"MHei-Medium,Italic":return M.PdfCjkFontFamily.monotypeHeiMedium;case"MSung-Light":case"MSung-Light,BoldItalic":case"MSung-Light,Bold":case"MSung-Light,Italic":return M.PdfCjkFontFamily.monotypeSungLight;case"STSong-Light":case"STSong-Light,BoldItalic":case"STSong-Light,Bold":case"STSong-Light,Italic":return M.PdfCjkFontFamily.sinoTypeSongLight;default:throw new Error("Unknown CJK font family for: "+t)}}function Xo(t,e,i){return void 0===i&&(i="0"),e>>=0,i=String(i||" "),t.length>=e?t:((e=e-t.length)>i.length&&(i+=i.repeat(e/i.length)),i.slice(0,e)+t)}function Jo(t){return Array.from(t).map(function(t){return Xo(t.toString(16),2,"0")}).join("").toUpperCase()}function Yo(t,e){switch(e){case M.PdfNumberStyle.numeric:return t.toString();case M.PdfNumberStyle.upperRoman:return Qo(t).toUpperCase();case M.PdfNumberStyle.lowerRoman:return Qo(t).toLowerCase();case M.PdfNumberStyle.upperLatin:return Zo(t).toUpperCase();case M.PdfNumberStyle.lowerLatin:return Zo(t).toLowerCase();default:return t.toString()}}function Qo(t){for(var e=[1e3,900,500,400,100,90,50,40,10,9,5,4,1],i=["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"],n="",r=0;r<e.length;r++)for(;e[r]<=t;)n+=i[r],t-=e[r];return n}function Zo(t){for(var e="";0<t;)t--,e=String.fromCharCode(97+t%26)+e,t=Math.floor(t/26);return e}var $o=Object.create(null),th=Object.create(null),eh=Object.create(null),R=(ih.get=function(t){return $o[t]||($o[t]=new ih(t))},ih);function ih(t){this.name=t}rh.get=function(t){return th[t]||(th[t]=new rh(t))};var nh=rh;function rh(t){this.command=t}sh.prototype.toString=function(){return this.objectNumber+" "+this.generationNumber},sh.get=function(t,e){var i=0===e?t+"R":t+"R"+e;return eh[i]||(eh[i]=new sh(t,e))};var m=sh;function sh(t,e){this._isNew=!1,this.objectNumber=t,this.generationNumber=e}oh.prototype.has=function(t){return this._set.has(t.toString())},oh.prototype.put=function(t){this._set.add(t.toString())},oh.prototype.remove=function(t){this._set.delete(t.toString())},oh.prototype.clear=function(){this._set.clear()};var ah=oh;function oh(t){void 0===t&&(t=null),this._set=new Set(t&&t._set)}Object.defineProperty(ch.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),ch.prototype.get=function(t){return this._map.get(t.toString())},ch.prototype.has=function(t){return this._map.has(t.toString())},ch.prototype.put=function(t,e){this._map.set(t.toString(),e)},ch.prototype.set=function(t,e){this._map.set(t,e)},ch.prototype.clear=function(){this._map.clear()};var hh=ch;function ch(){this._map=new Map}dh.prototype.getValue=function(t){t=this.table["$"+this.toStr(t)];if(void 0!==t)return t.value},dh.prototype.setValue=function(t,e){var i="$"+this.toStr(t);this.table[i];this.nElements++,this.table[i]={key:t,value:e}},dh.prototype.keys=function(){for(var t=[],e=Object.keys(this.table),i=0;i<e.length;i++){var n=this.table[e[i]];t.push(n.key)}return t},dh.prototype.containsKey=function(t){return!(void 0===this.getValue(t))},dh.prototype._size=function(){return this.nElements};var _h=dh;function dh(t){this.table={},this.nElements=0,this.toStr=t||Wa}Object.defineProperty(lh.prototype,"size",{get:function(){return Object.keys(this._map).length},enumerable:!0,configurable:!0}),lh.prototype.assignXref=function(t){this._crossReference=t},lh.prototype.getRaw=function(t){return this._map[t]},lh.prototype.getRawValues=function(){return this._map.values},lh.prototype.get=function(t,e,i){t=this._get(t,e,i);return t=this._crossReference&&void 0!==t&&t instanceof m?this._crossReference._fetch(t):t},lh.prototype.getArray=function(t,e,i){var n=this,t=this.get(t,e,i);return this._crossReference&&Array.isArray(t)?t.map(function(t){return t instanceof m?n._crossReference._fetch(t):t}):t},lh.prototype.set=function(t,e){this._map[t]=e},lh.prototype.has=function(t){return void 0!==this._map[t]},lh.prototype.forEach=function(t){for(var e in this._map)t(e,this.getRaw(e))},lh.prototype.update=function(t,e){var i;this.has(t)&&(i=null!=(i=this._map[t])&&i instanceof m&&this._crossReference?this._crossReference._fetch(i):i)===e||(this._map[t]=e,this._updated=!0)},lh.getEmpty=function(t){t=new lh(t);return t.set=function(t,e){throw new Error("Should not call set on the empty dictionary.")},t},lh.merge=function(t,e,i){void 0===i&&(i=!1);for(var n=new lh(t),r=Object.create(null),s=0,a=e;s<a.length;s++)if((b=a[s])instanceof lh)for(var o=0,h=b._map;o<h.length;o++){var c=h[o],_=c[0],d=c[1],c=r.get(_);if(void 0===c)r.set(_,c=[]);else if(!(i&&d instanceof lh))continue;c.push(d)}for(var l=0,u=r;l<u.length;l++){var p=u[l],f=p[0],p=p[1];if(1!==p.length&&p[0]instanceof lh){for(var g=new lh(t),y=0,m=p;y<m.length;y++)for(var b,w=0,v=(b=m[y])._map;w<v.length;w++){var S=v[w],_=S[0],d=S[1];void 0===g._map[_]&&(g._map[_]=d)}0<g.size&&(n._map[f]=g)}else n._map[f]=p[0]}return r.clear(),0<n.size?n:lh.getEmpty(t)},lh.prototype._initialize=function(t){this._map=Object.create(null),this.suppressEncryption=!1,this._updated=!1,this.isCatalog=!1,this._isNew=!1,t&&(this._crossReference=t)},lh.prototype._get=function(t,e,i){t=this._map[t];return void 0===t&&(t=this._map[e],null!=e?t=this._map[e]:null!=i&&(t=this._map[i])),t};var D=lh;function lh(t){this._isFont=!1,this._isProcessed=!1,this._isSignature=!1,this._isVisited=!1,this._initialize(t)}function uh(t){this.value=t=void 0===t?[]:t}function ph(){$o=Object.create(null),th=Object.create(null),eh=Object.create(null)}function fh(t,e){return t instanceof R&&(void 0===e||t.name===e)}function gh(t,e){return t instanceof nh&&(void 0===e||t.command===e)}yh=function(t,e){return(yh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var yh,d=function(t,e){function i(){this.constructor=t}yh(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},y=(mh.prototype.getByte=function(){return null},mh.prototype.getBytes=function(t){return null},Object.defineProperty(mh.prototype,"length",{get:function(){throw new Error("Abstract getter `length` accessed")},enumerable:!0,configurable:!0}),Object.defineProperty(mh.prototype,"isEmpty",{get:function(){throw new Error("Abstract getter `isEmpty` accessed")},enumerable:!0,configurable:!0}),Object.defineProperty(mh.prototype,"isDataLoaded",{get:function(){return!0},enumerable:!0,configurable:!0}),mh.prototype.peekByte=function(){var t=this.getByte();return-1!==t&&this.offset--,t},mh.prototype.peekBytes=function(t){t=this.getBytes(t);return this.offset-=t.length,t},mh.prototype.getUnsignedInteger16=function(){var t=this.getByte(),e=this.getByte();return-1===t||-1===e?-1:(t<<8)+e},mh.prototype.getInt32=function(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()},mh.prototype.getByteRange=function(t,e){return null},mh.prototype.makeSubStream=function(t,e,i){return null},mh.prototype.readBlock=function(){return null},mh.prototype.reset=function(){return null},mh.prototype.moveStart=function(){return null},mh.prototype.getString=function(t,e){return((t=void 0===t?!1:t)?As:vs)(e=null==e?this.getBytes():e)},mh.prototype.skip=function(t){this.offset+=t||1},mh.prototype.getBaseStreams=function(){return null},mh);function mh(){this._isCompress=!0,this._isImage=!1}d(wh,bh=y),Object.defineProperty(wh.prototype,"position",{get:function(){return this.offset},set:function(t){this.offset=t},enumerable:!0,configurable:!0}),Object.defineProperty(wh.prototype,"length",{get:function(){return this.end-this.start},enumerable:!0,configurable:!0}),Object.defineProperty(wh.prototype,"isEmpty",{get:function(){return 0===this.length},enumerable:!0,configurable:!0}),wh.prototype.getByte=function(){return this.position>=this.end?-1:this.bytes[this.position++]},wh.prototype.getBytes=function(t){var e=this.bytes,i=this.position,n=this.end;return t?(this.position=t=n<(t=i+t)?n:t,e.subarray(i,t)):e.subarray(i,n)},wh.prototype.getByteRange=function(t,e){return e>this.end&&(e=this.end),this.bytes.subarray(t=t<0?0:t,e)},wh.prototype.reset=function(){this.position=this.start},wh.prototype.moveStart=function(){this.start=this.position},wh.prototype.makeSubStream=function(t,e,i){return new wh(this.bytes.buffer,i=void 0===i?null:i,t,e)},wh.prototype.readBlock=function(){throw new Error("Abstract method `readBlock` called")},wh.prototype._clearStream=function(){null!==this.dictionary&&void 0!==this.dictionary&&this.dictionary.has("Filter")&&delete this.dictionary._map.Filter,this._isCompress=!0,this.dictionary._updated=!0},wh.prototype._write=function(t){this.bytes=new Uint8Array(t.length);for(var e=0;e<t.length;e++)this.bytes[e]=t.charCodeAt(e);this.end=this.bytes.length,this.dictionary._updated=!0},wh.prototype._writeBytes=function(t){this.bytes=new Uint8Array(t),this.end=this.bytes.length,this.dictionary._updated=!0};var bh,g=wh;function wh(t,e,i,n){var r=bh.call(this)||this;return r.isImageStream=!1,r.bytes=t instanceof Uint8Array?t:new Uint8Array(t),r.start=void 0!==i?i:0,r.position=r.start,r.end=i+n||r.bytes.length,r.dictionary=e,r}d(Ph,vh=y),Object.defineProperty(Ph.prototype,"length",{get:function(){return this._bytes.length},enumerable:!0,configurable:!0}),Ph.prototype.write=function(t){var e;if("string"==typeof t)for(var i=0;i<t.length;i++)this._bytes.push(t.charCodeAt(i));else(e=this._bytes).push.apply(e,t);this.dictionary._updated=!0},Ph.prototype.getString=function(t){void 0===t&&(t=!1);var e=new Uint8Array(this._bytes);if(t)return As(e);var i=e.length;if(i<8192)return String.fromCharCode.apply(null,e);for(var n=[],r=0;r<i;r+=8192)n.push(String.fromCharCode.apply(null,e.subarray(r,Math.min(r+8192,i))));return n.join("")};var vh,Sh=Ph;function Ph(t){var e=vh.call(this)||this;return k(t)?e._bytes=t:e._bytes=[],e.dictionary=new D,e.dictionary._updated=!0,e}d(Th,xh=g);var xh,Ah=Th;function Th(){return xh.call(this,new Uint8Array(0))||this}Ch=function(t,e){return(Ch=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Ch(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Rh,kh=y),Object.defineProperty(Rh.prototype,"isEmpty",{get:function(){for(;!this.eof&&0===this.bufferLength;)this.readBlock();return 0===this.bufferLength},enumerable:!0,configurable:!0}),Rh.prototype.ensureBuffer=function(t){var e=this.buffer;if(t<=e.byteLength)return e;for(var i=this.minBufferLength;i<t;)i*=2;var n=new Uint8Array(i);return n.set(e),this.buffer=n,this.buffer},Rh.prototype.getByte=function(){for(var t=this.offset;this.bufferLength<=t;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.offset++]},Rh.prototype.getBytes=function(t){var e,i=this.offset;if(t){for(this.ensureBuffer(i+t),e=i+t;!this.eof&&this.bufferLength<e;)this.readBlock();t=this.bufferLength;t<e&&(e=t)}else{for(;!this.eof;)this.readBlock();e=this.bufferLength}return this.offset=e,this.buffer.subarray(i,e)},Rh.prototype.reset=function(){this.offset=0},Rh.prototype.makeSubStream=function(t,e,i){if(void 0===e)for(;!this.eof;)this.readBlock();else for(var n=t+e;this.bufferLength<=n&&!this.eof;)this.readBlock();return new g(this.buffer,i,t,e)},Rh.prototype.getBaseStreams=function(){return this.stream?this.stream.getBaseStreams():null},Rh.prototype.moveStart=function(){throw new Error("Invalid call from decode stream")},Rh.prototype.getByteRange=function(t,e){throw new Error("Invalid call from decode stream. begin: "+t+", end: "+e)},Rh.prototype.readBlock=function(){throw new Error("Invalid call from decode stream")};var Ch,kh,d=Rh;function Rh(t){var e=kh.call(this)||this;if(e._rawMinBufferLength=t||0,e.offset=0,e.bufferLength=0,e.eof=!1,e.buffer=new Uint8Array(0),e.minBufferLength=512,t)for(;e.minBufferLength<t;)e.minBufferLength*=2;return e}Fh=function(t,e){return(Fh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Fh(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Bh,Ih=d),Bh.prototype.readBlock=function(){var t,e;this._initialized?t=this._nextChunk:(t=this.stream.getBytes(this._chunkSize),this._initialized=!0),t&&0!==t.length?(this._nextChunk=this.stream.getBytes(this._chunkSize),e=this._nextChunk&&0<this._nextChunk.length,e=(t=this._cipher._decryptBlock(t,!e)).length,this.ensureBuffer(this.bufferLength+e).set(t,this.bufferLength),this.bufferLength+=e):this.eof=!0};var Fh,Ih,Dh=Bh;function Bh(t,e,i){e=Ih.call(this,e)||this;return e._chunkSize=512,e.stream=t,e.dictionary=t.dictionary,e._cipher=i,e._nextChunk=null,e._initialized=!1,e}Lh=function(t,e){return(Lh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var Lh,Oh,Mh=function(t,e){function i(){this.constructor=t}Lh(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},Eh=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nh=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),jh=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Vh=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],zh=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],Uh=(Mh(Hh,Oh=d),Hh.prototype.getBits=function(t){for(var e,i=this.stream,n=this.codeSize,r=this.codeBuffer;n<t;)r|=(e=i.getByte())<<n,n+=8;return e=r&(1<<t)-1,this.codeBuffer=r>>t,this.codeSize=n-=t,e},Hh.prototype.getCode=function(t){for(var e=this.stream,i=t[0],n=t[1],r=this.codeSize,s=this.codeBuffer;r<n;)s|=e.getByte()<<r,r+=8;t=i[s&(1<<n)-1],i=t>>16,t&=65535;return i<1||r<i||(this.codeBuffer=s>>i,this.codeSize=r-i),t},Hh.prototype.generateHuffmanTable=function(t){var e=t.length,i=0;for(d=0;d<e;++d)t[d]>i&&(i=t[d]);for(var n=1<<i,r=new Int32Array(n),s=1,a=0,o=2;s<=i;++s,a<<=1,o<<=1)for(var h=0;h<e;++h)if(t[h]===s){for(var c=0,_=a,d=0;d<s;++d)c=c<<1|1&_,_>>=1;for(d=c;d<n;d+=o)r[d]=s<<16|h;++a}return[r,i]},Hh.prototype.readBlock=function(){var t,e,i=this.stream,n=this.getBits(3);if(1&n&&(this.eof=!0),0==(n>>=1)){var r,s,a=i.getByte(),o=(a|=i.getByte()<<8,i.getByte());if((o|=i.getByte()<<8)==(65535&~a)||0==a&&0==o)return this.codeBuffer=0,this.codeSize=0,o=this.bufferLength,s=this.ensureBuffer(r=o+a),this.bufferLength=r,void(0==a?-1===i.peekByte()&&(this.eof=!0):(r=i.getBytes(a),s.set(r,o),r.length<a&&(this.eof=!0)))}if(1==n)t=Vh,e=zh;else if(2==n){for(var i=this.getBits(5)+257,o=this.getBits(5)+1,h=this.getBits(4)+4,c=new Uint8Array(Eh.length),_=void 0,_=0;_<h;++_)c[Eh[_]]=this.getBits(3);var d=this.generateHuffmanTable(c),l=0;_=0;for(var u=i+o,p=new Uint8Array(u),f=void 0,g=void 0,y=void 0;_<u;){var m=this.getCode(d);if(16===m)f=2,g=3,y=l;else{if(17===m)g=f=3;else{if(18!==m){p[_++]=l=m;continue}f=7,g=11}y=l=0}for(var b=this.getBits(f)+g;0<b--;)p[_++]=y}t=this.generateHuffmanTable(p.subarray(0,i)),e=this.generateHuffmanTable(p.subarray(i,u))}for(var w=(s=this.buffer)?s.length:0,v=this.bufferLength;;)if((S=this.getCode(t))<256)w<=v+1&&(w=(s=this.ensureBuffer(v+1)).length),s[v++]=S;else{if(256===S)return void(this.bufferLength=v);var S,P=(S=Nh[S-=257])>>16,x=(l=(65535&S)+(P=0<P?this.getBits(P):P),S=this.getCode(e),(65535&(S=jh[S]))+(P=0<(P=S>>16)?this.getBits(P):P));w<=v+l&&(w=(s=this.ensureBuffer(v+l)).length);for(var A=0;A<l;++A,++v)s[v]=s[v-x]}},Hh);function Hh(t,e){var e=Oh.call(this,e)||this,i=(e.stream=t,e.dictionary=t.dictionary,t.getByte()),t=t.getByte();if(8!=(15&i))throw new S("Unknown compression method in flate stream: "+i+", "+t);if(((i<<8)+t)%31!=0)throw new S("Bad flag check in flate stream: "+i+", "+t);if(32&t)throw new S("Bad flag bit set in flate stream: "+i+", "+t);return e.codeSize=0,e.codeBuffer=0,e}Object.defineProperty(qh.prototype,"version",{get:function(){var t,e;return t=this._catalogDictionary.has("Version")&&(e=this._catalogDictionary.get("Version"))?e.name:t},enumerable:!0,configurable:!0}),Object.defineProperty(qh.prototype,"pageCount",{get:function(){var t=this._topPagesDictionary.get("Count");if(void 0!==t&&Number.isInteger(t))return t;throw new S("Invalid page count")},enumerable:!0,configurable:!0}),Object.defineProperty(qh.prototype,"acroForm",{get:function(){var t;return t=null==(t=this._catalogDictionary.has("AcroForm")?this._catalogDictionary.get("AcroForm"):t)?this._createForm():t},enumerable:!0,configurable:!0}),qh.prototype._createForm=function(){var t=new D(this._crossReference),e=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(e,t),this._catalogDictionary.set("AcroForm",e),this._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0,t._updated=!0,t},qh.prototype._addToCache=function(t,e,i){this._pageCache.set(t,{dictionary:e,reference:i,parent:e.get("Parent")}),this._parsedPages.push(t)},qh.prototype._getPageDictionary=function(t){if(0!==t&&this._checkPageTreeFormat()){var e=this._findNearestIndex(t);if(0<e){var i=this._pageCache.get(e);if(i){e=this._traverseFromCached(e,i,t);if(e)return e}}}return this._traverseFromRoot(t)},qh.prototype._checkPageTreeFormat=function(){var t;return void 0===this._hasInvalidPageTree&&(t=this._topPagesDictionary.get("Kids"),Array.isArray(t))&&(this._hasInvalidPageTree=this.pageCount===t.length),this._hasInvalidPageTree},qh.prototype._findNearestIndex=function(t){for(var e=this._parsedPages.length,i=this._parsedPages[0],n=Math.abs(i-t),r=1;r<e;r++){var s=this._parsedPages[r],a=Math.abs(s-t);a<n&&(i=s,n=a)}return i},qh.prototype._traverseFromCached=function(t,e,i){var n=new ah,r=t<i?1:-1,s=e.dictionary,a=t,o=e.parent,h=e.reference;if(a===i&&fh(s.get("Type"),"Page"))return{dictionary:s,reference:h};for(;s&&a!==i;){if(s instanceof m){if(n.has(s))throw new S("Pages tree contains circular reference.");n.put(s)}var c=this._findNextPage(s,o,r);if(!c)break;if(s=c.dictionary,h=c.reference,(a+=r)===i&&fh(s.get("Type"),"Page"))return this._addToCache(a,c.dictionary,c.reference),{dictionary:s,reference:h}}return null},qh.prototype._findNextPage=function(e,t,i){var n=this;if(!t||!t.has("Kids"))return null;t=t.getRaw("Kids");if(t instanceof m&&(t=this._crossReference._fetch(t)),!Array.isArray(t))throw new S("Page dictionary kids object is not an array.");var r=-1;if(-1===(r=e._reference?t.indexOf(e._reference):t.findIndex(function(t){return(t=t instanceof m?n._crossReference._fetch(t):t)===e})))return null;r+=i;if(r<0||r>=t.length)return null;i=t[r],t=i instanceof m?this._crossReference._fetch(i):i;if(t instanceof D)return{dictionary:t,reference:i instanceof m?i:null};throw new S("Invalid page dictionary type.")},qh.prototype._traverseFromRoot=function(t){for(var e=[this._topPagesDictionary],i=new ah,n=this._catalogDictionary.getRaw("Pages"),r=(n&&n instanceof m&&i.put(n),this._crossReference),s=this.pageKidsCountCache,a=this.pageIndexCache,o=0;0<e.length;){var h=e.pop();if(h&&h instanceof m){var c=s.get(h);if(0<=c&&o+c<=t)o+=c;else{if(i.has(h))throw new S("Pages tree contains circular reference.");i.put(h);c=r._fetch(h);if(c&&c instanceof D&&(fh(d=(d=c.getRaw("Type"))instanceof m?r._fetch(d):d,"Page")||!c.has("Kids"))){if(s.has(h)||s.put(h,1),a.has(h)||a.put(h,o),o===t)return this._addToCache(o,c,h),{dictionary:c,reference:h};o++}else e.push(c)}}else{if(!(h instanceof D))throw new S("Page dictionary kid reference points to wrong type of object.");var c=h.objId,_=h.get("Count");if(null!=(_=_ instanceof m?r._fetch(_):_)&&Number.isInteger(_)&&0<=_&&(c&&!s.has(c)&&s.set(c,_),o+_<=t))o+=_;else{var d,l=h.getRaw("Kids");if(l instanceof m&&(l=r._fetch(l)),Array.isArray(l))for(var u=l.length-1;0<=u;u--)e.push(l[u]);else{if(!fh(d=(d=h.getRaw("Type"))instanceof m?r._fetch(d):d,"Page")&&h.has("Kids"))throw new S("Page dictionary kids object is not an array.");if(o===t)return this._addToCache(o,h,null),{dictionary:h,reference:null};o++}}}}throw new Error("Page index "+t+" not found.")},qh.prototype._destroy=function(){this._catalogDictionary&&(this._catalogDictionary=void 0),this._topPagesDictionary&&(this._topPagesDictionary=void 0),this.pageIndexCache&&(this.pageIndexCache.clear(),this.pageIndexCache=void 0),this.pageKidsCountCache&&(this.pageKidsCountCache.clear(),this.pageKidsCountCache=void 0),this._hasInvalidPageTree=void 0,this._pageCache.clear(),this._parsedPages=[]};var Wh=qh;function qh(t){if(this._parsedPages=[],this._pageCache=new Map,this._crossReference=t,this._catalogDictionary=t._getCatalogObj(),!(this._catalogDictionary instanceof D))throw new S("Catalog object is not a dictionary.");this._catalogDictionary.isCatalog=!0,this._topPagesDictionary=this._catalogDictionary.get("Pages"),this.pageKidsCountCache=new hh,this.pageIndexCache=new hh}Gh=function(t,e){return(Gh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Gh(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Jh,Kh=d),Jh.prototype.readBlockTiff=function(){var t=this.rowBytes,e=this.bufferLength,i=this.ensureBuffer(e+t),n=this.bits,r=this.colors,s=this.stream.getBytes(t);if(this.eof=!s.length,!this.eof){var a=0,o=0,h=0,c=0,_=e;if(1===n&&1===r)for(u=0;u<t;++u){var d=s[u]^a,a=(1&(d=(d=(d^=d>>1)^d>>2)^d>>4))<<7;i[_++]=d}else if(8===n){for(u=0;u<r;++u)i[_++]=s[u];for(;u<t;++u)i[_]=i[_-r]+s[u],_++}else if(16===n){for(var l=2*r,u=0;u<l;++u)i[_++]=s[u];for(;u<t;u+=2){var p=((255&s[u])<<8)+(255&s[u+1])+((255&i[_-l])<<8)+(255&i[_-l+1]);i[_++]=p>>8&255,i[_++]=255&p}}else{var f=new Uint8Array(r+1),g=(1<<n)-1,y=0,m=e,b=this.columns;for(u=0;u<b;++u)for(var w=0;w<r;++w)h<n&&(a=a<<8|255&s[y++],h+=8),f[w]=f[w]+(a>>h-n)&g,h-=n,o=o<<n|f[w],8<=(c+=n)&&(i[m++]=o>>c-8&255,c-=8);0<c&&(i[m++]=(o<<8-c)+(a&(1<<8-c)-1))}this.bufferLength+=t}},Jh.prototype.readBlockPng=function(){var t=this.rowBytes,e=this.pixBytes,i=this.stream.getByte(),n=this.stream.getBytes(t);if(this.eof=!n.length,!this.eof){var r,s,a=this.bufferLength,o=this.ensureBuffer(a+t),h=o.subarray(a-t,a),c=(0===h.length&&(h=new Uint8Array(t)),a);switch(i){case 0:for(r=0;r<t;++r)o[c++]=n[r];break;case 1:for(r=0;r<e;++r)o[c++]=n[r];for(;r<t;++r)o[c]=o[c-e]+n[r]&255,c++;break;case 2:for(r=0;r<t;++r)o[c++]=h[r]+n[r]&255;break;case 3:for(r=0;r<e;++r)o[c++]=(h[r]>>1)+n[r];for(;r<t;++r)o[c]=(h[r]+o[c-e]>>1)+n[r]&255,c++;break;case 4:for(r=0;r<e;++r)_=h[r],s=n[r],o[c++]=_+s;for(;r<t;++r){var _=h[r],d=h[r-e],l=o[c-e],u=l+_-d,p=u-l,f=(p<0&&(p=-p),u-_),u=(f<0&&(f=-f),u-d);u<0&&(u=-u),s=n[r],o[c++]=p<=f&&p<=u?l+s:f<=u?_+s:d+s}break;default:throw new S("Unsupported predictor: "+i)}this.bufferLength+=t}};var Gh,Kh,Xh=Jh;function Jh(t,e,i){e=Kh.call(this,e)||this;if(!(i instanceof D))return t;var n=e.predictor=i.get("Predictor")||1;if(n<=1)return t;if(2!==n&&(n<10||15<n))throw new S("Unsupported predictor: "+n);e.readBlock=2===n?e.readBlockTiff:e.readBlockPng,e.stream=t,e.dictionary=t.dictionary;n=e.colors=i.get("Colors")||1,t=e.bits=i.get("BPC","BitsPerComponent")||8,i=e.columns=i.get("Columns")||1;return e.pixBytes=n*t+7>>3,e.rowBytes=i*n*t+7>>3,e}Yh=function(t,e){return(Yh=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Yh(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})($h,Qh=d),$h.prototype.readBlock=function(){this.decodeImage()},$h.prototype.decodeImage=function(t){return this.eof||(t=this.skipUselessBytes(t||this.stream.getBytes(this.maybeLength)),this.buffer=t,this.bufferLength=t.length,this.eof=!0),this.buffer},$h.prototype.skipUselessBytes=function(t){for(var e=0,i=t.length-1;e<i;e++)if(255===t[e]&&216===t[e+1]){0<e&&(t=t.subarray(e));break}return t};var Yh,Qh,Zh=$h;function $h(t,e,i){var n=Qh.call(this,e)||this;return n._jpegStreamStart=0,n._needsReprocessing=!1,n.stream=t,n.params=i,n.maybeLength=e,n}tc=function(t,e){return(tc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}tc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(nc,ec=d),nc.prototype.readBits=function(t){for(var e=this.bitsCached,i=this.cachedData;e<t;){var n=this.stream.getByte();if(-1===n)return this.eof=!0,null;i=i<<8|n,e+=8}return this.bitsCached=e-=t,this.cachedData=i,this.lastCode=null,i>>>e&(1<<t)-1},nc.prototype.readBlock=function(){var t,e,i=1024,n=this.lzwState;if(n){for(var r=n.earlyChange,s=n.nextCode,a=n.dictionaryValues,o=n.dictionaryLengths,h=n.dictionaryPrevCodes,c=n.codeLength,_=n.prevCode,d=n.currentSequence,l=n.currentSequenceLength,u=0,p=this.bufferLength,f=this.ensureBuffer(this.bufferLength+i),g=0;g<512;g++){var y=this.readBits(c),m=0<l;if(null===y)break;if(y<256)d[0]=y,l=1;else{if(!(258<=y)){if(256===y){c=9,s=258,l=0;continue}this.eof=!0,this.lzwState=null;break}if(y<s)for(t=(l=o[y])-1,e=y;0<=t;t--)d[t]=a[e],e=h[e];else d[l++]=d[0]}if(m&&(h[s]=_,o[s]=o[_]+1,a[s]=d[0],c=++s+r&s+r-1?c:Math.min(Math.log(s+r)/.6931471805599453+1|0,12)),_=y,i<(u+=l)){for(;(i+=512)<u;);f=this.ensureBuffer(this.bufferLength+i)}for(t=0;t<l;t++)f[p]=d[t],p++}n.nextCode=s,n.codeLength=c,n.prevCode=_,n.currentSequenceLength=l,this.bufferLength=p}};var tc,ec,ic=nc;function nc(t,e,i){for(var e=ec.call(this,e)||this,n=(e.stream=t,e.cachedData=0,e.bitsCached=0,{earlyChange:i||0,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(4096),dictionaryLengths:new Uint16Array(4096),dictionaryPrevCodes:new Uint16Array(4096),currentSequence:new Uint8Array(4096),currentSequenceLength:0}),r=0;r<256;++r)n.dictionaryValues[r]=r,n.dictionaryLengths[r]=1;return e.lzwState=n,e.lastCode=null,e}rc=function(t,e){return(rc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}rc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(oc,sc=d),Object.defineProperty(oc.prototype,"bytes",{get:function(){return this.stream.getBytes(this.maybeLength)},enumerable:!0,configurable:!0}),oc.prototype.readBlock=function(){throw new Error("JpxStream.readBlock")},Object.defineProperty(oc.prototype,"isAsyncDecoder",{get:function(){return!0},enumerable:!0,configurable:!0}),oc.prototype.decodeImage=function(t){return this.eof?this.buffer:(t=t||this.bytes,this.eof=!0,t)},Object.defineProperty(oc.prototype,"canAsyncDecodeImageFromBuffer",{get:function(){return this.stream.isAsync},enumerable:!0,configurable:!0});var rc,sc,ac=oc;function oc(t,e,i){var n=sc.call(this,e)||this;return n.stream=t,n.maybeLength=e,n.params=i,n}hc=function(t,e){return(hc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}hc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(dc,cc=d),dc.prototype.readBlock=function(){for(var t=this.stream,e=t.getByte();ks(e);)e=t.getByte();if(-1===e||126===e)this.eof=!0;else{var i,n=this.bufferLength;if(122===e){for(i=this.ensureBuffer(n+4),a=0;a<4;++a)i[n+a]=0;this.bufferLength+=4}else{var r=this.input;for(r[0]=e,a=1;a<5;++a){for(e=t.getByte();ks(e);)e=t.getByte();if(-1===(r[Number.parseInt(a.toString(),10)]=e)||126===e)break}if(i=this.ensureBuffer(n+a-1),this.bufferLength+=a-1,a<5){for(;a<5;++a)r[Number.parseInt(a.toString(),10)]=117;this.eof=!0}for(var s=0,a=0;a<5;++a)s=85*s+(r[Number.parseInt(a.toString(),10)]-33);for(a=3;0<=a;--a)i[n+a]=255&s,s>>=8}}};var hc,cc,_c=dc;function dc(t,e){var i=this;return e&&(e*=.8),(i=cc.call(this,e)||this).stream=t,i.input=new Uint8Array(5),i}lc=function(t,e){return(lc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}lc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(fc,uc=d),fc.prototype.readBlock=function(){var t=this.stream.getBytes(8e3);if(t.length){for(var e=t.length+1>>1,i=this.ensureBuffer(this.bufferLength+e),n=this.bufferLength,r=this.firstDigit,s=0,a=t;s<a.length;s++){var o=a[s],h=void 0;if(48<=o&&o<=57)h=15&o;else{if(!(65<=o&&o<=70||97<=o&&o<=102)){if(62!==o)continue;this.eof=!0;break}h=9+(15&o)}r=r<0?h:(i[n++]=r<<4|h,-1)}0<=r&&this.eof&&(i[n++]=r<<4,r=-1),this.firstDigit=r,this.bufferLength=n}else this.eof=!0};var lc,uc,pc=fc;function fc(t,e){var i=this;return e&&(e*=.5),(i=uc.call(this,e)||this).stream=t,i.firstDigit=-1,i}yc.prototype.readNextChar=function(){if(this._eof)return-1;var t,e,i,n,r,s=this._referenceLine,a=this._codingLine,o=this._columns;if(0===this._outputBits){if(this._rowsDone&&(this._eof=!0),this._eof)return-1;this.err=!1;var h=void 0,c=void 0,_=void 0;if(this._nextLine){for(n=0;a[Number.parseInt(n.toString(),10)]<o;++n)s[Number.parseInt(n.toString(),10)]=a[Number.parseInt(n.toString(),10)];for(s[Number.parseInt(n.toString(),10)]=o,n++,s[Number.parseInt(n.toString(),10)]=o,a[0]=0,e=t=this._codingPosition=0;a[this._codingPosition]<o;)switch(h=this._getTwoDimCode()){case 0:this._addPixels(s[t+1],e),s[t+1]<o&&(t+=2);break;case 1:if(h=c=0,e){for(;h+=_=this._getBlackCode(),64<=_;);for(;c+=_=this._getWhiteCode(),64<=_;);}else{for(;h+=_=this._getWhiteCode(),64<=_;);for(;c+=_=this._getBlackCode(),64<=_;);}for(this._addPixels(a[this._codingPosition]+h,e),a[this._codingPosition]<o&&this._addPixels(a[this._codingPosition]+c,1^e);s[Number.parseInt(t.toString(),10)]<=a[Number.parseInt(this._codingPosition.toString(),10)]&&s[Number.parseInt(t.toString(),10)]<o;)t+=2;break;case 7:if(this._addPixels(s[Number.parseInt(t.toString(),10)]+3,e),e^=1,a[this._codingPosition]<o)for(++t;s[Number.parseInt(t.toString(),10)]<=a[this._codingPosition]&&s[Number.parseInt(t.toString(),10)]<o;)t+=2;break;case 5:if(this._addPixels(s[Number.parseInt(t.toString(),10)]+2,e),e^=1,a[this._codingPosition]<o)for(++t;s[Number.parseInt(t.toString(),10)]<=a[this._codingPosition]&&s[Number.parseInt(t.toString(),10)]<o;)t+=2;break;case 3:if(this._addPixels(s[Number.parseInt(t.toString(),10)]+1,e),e^=1,a[this._codingPosition]<o)for(++t;s[Number.parseInt(t.toString(),10)]<=a[this._codingPosition]&&s[Number.parseInt(t.toString(),10)]<o;)t+=2;break;case 2:if(this._addPixels(s[Number.parseInt(t.toString(),10)],e),e^=1,a[this._codingPosition]<o)for(++t;s[Number.parseInt(t.toString(),10)]<=a[this._codingPosition]&&s[Number.parseInt(t.toString(),10)]<o;)t+=2;break;case 8:if(this._addPixelsNeg(s[Number.parseInt(t.toString(),10)]-3,e),e^=1,a[this._codingPosition]<o)for(0<t?--t:++t;s[Number.parseInt(t.toString(),10)]<=a[this._codingPosition]&&s[Number.parseInt(t.toString(),10)]<o;)t+=2;break;case 6:if(this._addPixelsNeg(s[Number.parseInt(t.toString(),10)]-2,e),e^=1,a[this._codingPosition]<o)for(0<t?--t:++t;s[Number.parseInt(t.toString(),10)]<=a[this._codingPosition]&&s[Number.parseInt(t.toString(),10)]<o;)t+=2;break;case 4:if(this._addPixelsNeg(s[Number.parseInt(t.toString(),10)]-1,e),e^=1,a[this._codingPosition]<o)for(0<t?--t:++t;s[Number.parseInt(t.toString(),10)]<=a[this._codingPosition]&&s[Number.parseInt(t.toString(),10)]<o;)t+=2;break;case-1:this._addPixels(o,0),this._eof=!0;break;default:this._addPixels(o,0),this.err=!0}}else for(a[0]=0,e=this._codingPosition=0;a[this._codingPosition]<o;){if(h=0,e)for(;h+=_=this._getBlackCode(),64<=_;);else for(;h+=_=this._getWhiteCode(),64<=_;);this._addPixels(a[this._codingPosition]+h,e),e^=1}var d=!1;if(this._byteAlign&&(this._inputBits&=-8),this._endOfBlock||this._row!==this._rows-1){if(h=this._lookBits(12),this._endOfLine)for(;-1!==h&&1!==h;)this._eatBits(1),h=this._lookBits(12);else for(;0===h;)this._eatBits(1),h=this._lookBits(12);1===h?(this._eatBits(12),d=!0):-1===h&&(this._eof=!0)}else this._rowsDone=!0;if(!this._eof&&0<this._encoding&&!this._rowsDone&&(this._nextLine=!this._lookBits(1),this._eatBits(1)),this._endOfBlock&&d&&this._byteAlign){if(1===(h=this._lookBits(12))){if(this._eatBits(12),0<this._encoding&&(this._lookBits(1),this._eatBits(1)),0<=this._encoding)for(n=0;n<4;++n)h=this._lookBits(12),this._eatBits(12),0<this._encoding&&(this._lookBits(1),this._eatBits(1));this._eof=!0}}else if(this.err&&this._endOfLine){for(;;){if(-1===(h=this._lookBits(13)))return this._eof=!0,-1;if(h>>1==1)break;this._eatBits(1)}this._eatBits(12),0<this._encoding&&(this._eatBits(1),this._nextLine=!(1&h))}this._outputBits=0<a[0]?a[this._codingPosition=0]:a[this._codingPosition=1],this._row++}if(8<=this._outputBits)r=1&this._codingPosition?0:255,this._outputBits-=8,0===this._outputBits&&a[this._codingPosition]<o&&(this._codingPosition++,this._outputBits=a[this._codingPosition]-a[this._codingPosition-1]);else{i=8,r=0;do{if("number"!=typeof this._outputBits)throw new Error('Invalid /CCITTFaxDecode data, "outputBits" must be a number.')}while(this._outputBits>i?(r<<=i,1&this._codingPosition||(r|=255>>8-i),this._outputBits-=i,i=0):(r<<=this._outputBits,1&this._codingPosition||(r|=255>>8-this._outputBits),i-=this._outputBits,this._outputBits=0,a[this._codingPosition]<o?(this._codingPosition++,this._outputBits=a[this._codingPosition]-a[this._codingPosition-1]):0<i&&(r<<=i,i=0)),i)}return this._black&&(r^=255),r},yc.prototype._addPixels=function(t,e){var i=this._codingLine,n=this._codingPosition;t>i[Number.parseInt(n.toString(),10)]&&(t>this._columns&&(this.err=!0,t=this._columns),1&n^e&&++n,i[Number.parseInt(n.toString(),10)]=t),this._codingPosition=n},yc.prototype._addPixelsNeg=function(t,e){var i=this._codingLine,n=this._codingPosition;if(t>i[Number.parseInt(n.toString(),10)])t>this._columns&&(this.err=!0,t=this._columns),1&n^e&&++n,i[Number.parseInt(n.toString(),10)]=t;else if(t<i[Number.parseInt(n.toString(),10)]){for(t<0&&(this.err=!0,t=0);0<n&&t<i[n-1];)--n;i[Number.parseInt(n.toString(),10)]=t}this._codingPosition=n},yc.prototype._findTableCode=function(t,e,i,n){for(var r=null!=n?n:0,s=t;s<=e;++s){var a=this._lookBits(s);if(-1===a)return[!0,1,!1];if(s<e&&(a<<=e-s),!r||r<=a){a=i[a-r];if(a[0]===s)return this._eatBits(s),[!0,a[1],!0]}}return[!1,0,!1]},yc.prototype._getTwoDimCode=function(){var t=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]];if(this._endOfBlock){if(e=this._lookBits(7),this._text+=e,(e=t[e])&&0<e[0])return this._eatBits(e[0]),e[1]}else{var e=this._findTableCode(1,7,t);if(e[0]&&e[2])return e[1]}return-1},yc.prototype._getWhiteCode=function(){var t=0,e=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],i=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]];if(this._endOfBlock){if(-1===(t=this._lookBits(12)))return 1;if(0<(t=t>>5==0?e[Number.parseInt(t.toString(),10)]:i[t>>3])[0])return this._eatBits(t[0]),t[1]}else{t=this._findTableCode(1,9,i);if(t[0])return t[1];if((t=this._findTableCode(11,12,e))[0])return t[1]}return this._eatBits(1),1},yc.prototype._getBlackCode=function(){var t=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],e=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],i=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];if(this._endOfBlock){if(-1===(n=this._lookBits(13)))return 1;if(0<(n=n>>7==0?t[Number.parseInt(n.toString(),10)]:n>>9==0&&n>>7!=0?e[(n>>1)-64]:i[n>>7])[0])return this._eatBits(n[0]),n[1]}else{var n=this._findTableCode(2,6,i);if(n[0])return n[1];if((n=this._findTableCode(7,12,e,64))[0])return n[1];if((n=this._findTableCode(10,13,t))[0])return n[1]}return this._eatBits(1),1},yc.prototype._lookBits=function(t){for(;this._inputBits<t;){var e=this._source.next();if(-1===e)return 0===this._inputBits?-1:this._inputBuffer<<t-this._inputBits&65535>>16-t;this._inputBuffer=this._inputBuffer<<8|e,this._inputBits+=8}return this._inputBuffer>>this._inputBits-t&65535>>16-t},yc.prototype._eatBits=function(t){this._inputBits-=t,this._inputBits<0&&(this._inputBits=0)};var gc=yc;function yc(t,e){if(void 0===e&&(e={}),this._text="",!t||"function"!=typeof t.next)throw new Error("CCITTFaxDecoder - invalid source parameter.");this._source=t,this._eof=!1,this._encoding=e.K||0,this._endOfLine=e.EndOfLine||!1,this._byteAlign=e.EncodedByteAlign||!1,this._columns=e.Columns||1728,this._rows=e.Rows||0,this._endOfBlock=void 0===e.EndOfBlock||null===e.EndOfBlock||e.EndOfBlock,this._black=e.BlackIs1||!1,this._codingLine=new Uint32Array(this._columns+1),this._referenceLine=new Uint32Array(this._columns+2),this._codingLine[0]=this._columns,this._codingPosition=0,this._row=0,this._nextLine=this._encoding<0,this._inputBits=0,this._inputBuffer=0,this._outputBits=0,this._rowsDone=!1;for(var i=this._lookBits(12);0===i;)this._eatBits(1);1===i&&this._eatBits(12),0<this._encoding&&(this._nextLine=!this._lookBits(1),this._eatBits(1))}mc=function(t,e){return(mc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}mc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(vc,bc=d),vc.prototype.readBlock=function(){for(;!this.eof;){var t=this.ccittFaxDecoder.readNextChar();if(-1===t)return void(this.eof=!0);this.ensureBuffer(this.bufferLength+1),this.buffer[this.bufferLength++]=t}};var mc,bc,wc=vc;function vc(t,e,i){var e=bc.call(this,e)||this,n=(e.stream=t,i instanceof D||(i=new D(null)),{next:function(){return t.getByte()}});return e.ccittFaxDecoder=new gc(n,{K:i.get("K"),EndOfLine:i.get("EndOfLine"),EncodedByteAlign:i.get("EncodedByteAlign"),Columns:i.get("Columns"),Rows:i.get("Rows"),EndOfBlock:i.get("EndOfBlock"),BlackIs1:i.get("BlackIs1")}),e}Sc=function(t,e){return(Sc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Sc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Ac,Pc=d),Ac.prototype.readBlock=function(){var t,e,i,n,r=this.stream.getBytes(2);!r||r.length<2||128===r[0]?this.eof=!0:(t=this.bufferLength,(e=r[0])<128?((n=this.ensureBuffer(t+e+1))[t++]=r[1],0<e&&(i=this.stream.getBytes(e),n.set(i,t),t+=e)):((n=this.ensureBuffer(t+(e=257-e)+1)).fill(r[1],t,t+e),t+=e),this.bufferLength=t)};var Sc,Pc,xc=Ac;function Ac(t,e){e=Pc.call(this,e)||this;return e.stream=t,e.dict=t.dict,e}Cc.prototype._byteIn=function(){var t=this._data,e=this._bitPosition;255===t[e]?143<t[e+1]?(this._low+=65280,this._bitCount=8):(this._low+=t[++e]<<9,this._bitCount=7,this._bitPosition=e):(this._low+=++e<this._dataEnd?t[e]<<8:65280,this._bitCount=8,this._bitPosition=e),65535<this._low&&(this._high+=this._low>>16,this._low&=65535)},Cc.prototype._readBit=function(t,e){var i,n=t[e],r=n>>1,n=1&n,s=this._quantizationTable[r],a=s.estimate,o=this._range-a;if(this._high<a)r=o<a?(o=a,i=n,s.nextMostProbableState):(o=a,i=1^n,1===s.switchFlag&&(n=i),s.nextLeastProbableState);else{if(this._high-=a,0!=(32768&o))return this._range=o,n;r=o<a?(i=1^n,1===s.switchFlag&&(n=i),s.nextLeastProbableState):(i=n,s.nextMostProbableState)}for(;0===this._bitCount&&this._byteIn(),o<<=1,this._high=this._high<<1&65535|this._low>>15&1,this._low=this._low<<1&65535,this._bitCount--,0==(32768&o););return this._range=o,t[e]=r<<1|n,i};var Tc=Cc;function Cc(t,e,i){this._quantizationTable=[{estimate:22017,nextMostProbableState:1,nextLeastProbableState:1,switchFlag:1},{estimate:13313,nextMostProbableState:2,nextLeastProbableState:6,switchFlag:0},{estimate:6145,nextMostProbableState:3,nextLeastProbableState:9,switchFlag:0},{estimate:2753,nextMostProbableState:4,nextLeastProbableState:12,switchFlag:0},{estimate:1313,nextMostProbableState:5,nextLeastProbableState:29,switchFlag:0},{estimate:545,nextMostProbableState:38,nextLeastProbableState:33,switchFlag:0},{estimate:22017,nextMostProbableState:7,nextLeastProbableState:6,switchFlag:1},{estimate:21505,nextMostProbableState:8,nextLeastProbableState:14,switchFlag:0},{estimate:18433,nextMostProbableState:9,nextLeastProbableState:14,switchFlag:0},{estimate:14337,nextMostProbableState:10,nextLeastProbableState:14,switchFlag:0},{estimate:12289,nextMostProbableState:11,nextLeastProbableState:17,switchFlag:0},{estimate:9217,nextMostProbableState:12,nextLeastProbableState:18,switchFlag:0},{estimate:7169,nextMostProbableState:13,nextLeastProbableState:20,switchFlag:0},{estimate:5633,nextMostProbableState:29,nextLeastProbableState:21,switchFlag:0},{estimate:22017,nextMostProbableState:15,nextLeastProbableState:14,switchFlag:1},{estimate:21505,nextMostProbableState:16,nextLeastProbableState:14,switchFlag:0},{estimate:20737,nextMostProbableState:17,nextLeastProbableState:15,switchFlag:0},{estimate:18433,nextMostProbableState:18,nextLeastProbableState:16,switchFlag:0},{estimate:14337,nextMostProbableState:19,nextLeastProbableState:17,switchFlag:0},{estimate:13313,nextMostProbableState:20,nextLeastProbableState:18,switchFlag:0},{estimate:12289,nextMostProbableState:21,nextLeastProbableState:19,switchFlag:0},{estimate:10241,nextMostProbableState:22,nextLeastProbableState:19,switchFlag:0},{estimate:9217,nextMostProbableState:23,nextLeastProbableState:20,switchFlag:0},{estimate:8705,nextMostProbableState:24,nextLeastProbableState:21,switchFlag:0},{estimate:7169,nextMostProbableState:25,nextLeastProbableState:22,switchFlag:0},{estimate:6145,nextMostProbableState:26,nextLeastProbableState:23,switchFlag:0},{estimate:5633,nextMostProbableState:27,nextLeastProbableState:24,switchFlag:0},{estimate:5121,nextMostProbableState:28,nextLeastProbableState:25,switchFlag:0},{estimate:4609,nextMostProbableState:29,nextLeastProbableState:26,switchFlag:0},{estimate:4353,nextMostProbableState:30,nextLeastProbableState:27,switchFlag:0},{estimate:2753,nextMostProbableState:31,nextLeastProbableState:28,switchFlag:0},{estimate:2497,nextMostProbableState:32,nextLeastProbableState:29,switchFlag:0},{estimate:2209,nextMostProbableState:33,nextLeastProbableState:30,switchFlag:0},{estimate:1313,nextMostProbableState:34,nextLeastProbableState:31,switchFlag:0},{estimate:1089,nextMostProbableState:35,nextLeastProbableState:32,switchFlag:0},{estimate:673,nextMostProbableState:36,nextLeastProbableState:33,switchFlag:0},{estimate:545,nextMostProbableState:37,nextLeastProbableState:34,switchFlag:0},{estimate:321,nextMostProbableState:38,nextLeastProbableState:35,switchFlag:0},{estimate:273,nextMostProbableState:39,nextLeastProbableState:36,switchFlag:0},{estimate:133,nextMostProbableState:40,nextLeastProbableState:37,switchFlag:0},{estimate:73,nextMostProbableState:41,nextLeastProbableState:38,switchFlag:0},{estimate:37,nextMostProbableState:42,nextLeastProbableState:39,switchFlag:0},{estimate:21,nextMostProbableState:43,nextLeastProbableState:40,switchFlag:0},{estimate:9,nextMostProbableState:44,nextLeastProbableState:41,switchFlag:0},{estimate:5,nextMostProbableState:45,nextLeastProbableState:42,switchFlag:0},{estimate:1,nextMostProbableState:45,nextLeastProbableState:43,switchFlag:0},{estimate:22017,nextMostProbableState:46,nextLeastProbableState:46,switchFlag:0}],this._data=t,this._bitPosition=e,this._dataEnd=i,this._high=t[e],this._low=0,this._byteIn(),this._high=this._high<<7&65535|this._low>>9&127,this._low=this._low<<7&65535,this._bitCount-=7,this._range=32768}Rc.prototype._readBits=function(t,e,i){for(var n=0,r=0;r<t;r++){var s=e._readBit(i,this.prev);this.prev=this.prev<256?this.prev<<1|s:511&(this.prev<<1|s)|256,n=n<<1|s}return n>>>0};var kc=Rc;function Rc(){this.prev=1}Ic.prototype.getContexts=function(t){t=t.toString();return t in this.cache||(this.cache[t]=new Int8Array(65536)),this.cache[t]};var Fc=Ic;function Ic(){this.cache={}}Object.defineProperty(Bc.prototype,"decoder",{get:function(){return ko(this,"decoder",new Tc(this._data,this._start,this._end))},enumerable:!0,configurable:!0}),Object.defineProperty(Bc.prototype,"contextCache",{get:function(){return ko(this,"contextCache",new Fc)},enumerable:!0,configurable:!0});var Dc=Bc;function Bc(t,e,i){this._data=t,this._start=e,this._end=i}Oc.prototype._onPageInformation=function(t){var e=(this._currentPageInfo=t)[0].width+7>>3,e=new Uint8ClampedArray(e*t[0].height);t.defaultPixelValue&&e.fill(255),this._buffer=e},Oc.prototype._drawBitmap=function(t,e){var i,n,r,s,a=this._currentPageInfo,o=t.width,h=t.height,c=a[0].width+7>>3,_=(a[0].combinationOperatorOverride?t:a[0]).combinationOperator,d=this._buffer,l=128>>(7&t.x),u=t.y*c+(t.x>>3);switch(_){case 0:for(i=0;i<h;i++){for(r=l,s=u,n=0;n<o;n++)e[i][n]&&(d[s]|=r),(r>>=1)||(r=128,s++);u+=c}break;case 2:for(i=0;i<h;i++){for(r=l,s=u,n=0;n<o;n++)e[i][n]&&(d[s]^=r),(r>>=1)||(r=128,s++);u+=c}break;default:throw new Error("The combination operator "+_+" is not supported")}},Oc.prototype._onImmediateGenericRegion=function(t,e,i,n){var r=t.info,e=new Dc(e,i,n),i=this._decodeBitmap(t.mmr,r.width,r.height,t.template,t.prediction,null,t.at,e);this._drawBitmap(r,i)},Oc.prototype._getCustomHuffmanTable=function(t,e,i){for(var n=0,r=0,s=e.length;r<s;r++){var a=i[e[r]];if(a){if(t===n)return a;n++}}throw new Error("Custom Huffman table not found in the input data.")},Oc.prototype._getTextRegionHuffmanTables=function(t,e,i,n,r){for(var s=[],a=0;a<=34;a++){var o=r._readBits(4);s.push(new Mc([a,o,0,0]))}for(var h=new jc(s,!1),a=s.length=0;a<n;)if(32<=(o=h.decode(r))){var c=void 0,_=void 0,d=void 0;switch(o){case 32:if(0===a)throw new Error("No previous value found in the symbol ID table");_=r._readBits(2)+3,c=s[a-1].prefixLength;break;case 33:_=r._readBits(3)+3,c=0;break;case 34:_=r._readBits(7)+11,c=0;break;default:throw new Error("JBIG2 decoding error: Invalid code length found in the symbol ID table")}for(d=0;d<_;d++)s.push(new Mc([a,c,0,0])),a++}else s.push(new Mc([a,o,0,0])),a++;r.byteAlign();var l,u,p,f=new jc(s,!1),g=0;switch(t.huffmanFS){case 0:case 1:l=this._getStandardTable(t.huffmanFS+6);break;case 3:l=this._getCustomHuffmanTable(g,e,i),g++;break;default:throw new Error("Invalid Huffman File Segment Selector: Selector does not match any recognized Huffman-coded segment.")}switch(t.huffmanDS){case 0:case 1:case 2:u=this._getStandardTable(t.huffmanDS+8);break;case 3:u=this._getCustomHuffmanTable(g,e,i),g++;break;default:throw new Error("Jbig2 decode error: Detected invalid Huffman Data Stream selector.")}switch(t.huffmanDT){case 0:case 1:case 2:p=this._getStandardTable(t.huffmanDT+11);break;case 3:p=this._getCustomHuffmanTable(g,e,i),g++;break;default:throw new Error("Invalid Huffman Decoding Table (DT) selector encountered.")}if(t.refinement)throw new Error("Refinement with Huffman encoding is not supported.");return{symbolIDTable:f,tableFirstS:l,tableDeltaS:u,tableDeltaT:p}},Oc.prototype._getStandardTable=function(t){var e,i=this._standardTablesCache[t];if(!i){switch(t){case 1:e=[[0,1,4,0],[16,2,8,2],[272,3,16,6],[65808,3,32,7]];break;case 2:e=[[0,1,0,0],[1,2,0,2],[2,3,0,6],[3,4,3,14],[11,5,6,30],[75,6,32,62],[6,63]];break;case 3:e=[[-256,8,8,254],[0,1,0,0],[1,2,0,2],[2,3,0,6],[3,4,3,14],[11,5,6,30],[-257,8,32,255,"lower"],[75,7,32,126],[6,62]];break;case 4:e=[[1,1,0,0],[2,2,0,2],[3,3,0,6],[4,4,3,14],[12,5,6,30],[76,5,32,31]];break;case 5:e=[[-255,7,8,126],[1,1,0,0],[2,2,0,2],[3,3,0,6],[4,4,3,14],[12,5,6,30],[-256,7,32,127,"lower"],[76,6,32,62]];break;case 6:e=[[-2048,5,10,28],[-1024,4,9,8],[-512,4,8,9],[-256,4,7,10],[-128,5,6,29],[-64,5,5,30],[-32,4,5,11],[0,2,7,0],[128,3,7,2],[256,3,8,3],[512,4,9,12],[1024,4,10,13],[-2049,6,32,62,"lower"],[2048,6,32,63]];break;case 7:e=[[-1024,4,9,8],[-512,3,8,0],[-256,4,7,9],[-128,5,6,26],[-64,5,5,27],[-32,4,5,10],[0,4,5,11],[32,5,5,28],[64,5,6,29],[128,4,7,12],[256,3,8,1],[512,3,9,2],[1024,3,10,3],[-1025,5,32,30,"lower"],[2048,5,32,31]];break;case 8:e=[[-15,8,3,252],[-7,9,1,508],[-5,8,1,253],[-3,9,0,509],[-2,7,0,124],[-1,4,0,10],[0,2,1,0],[2,5,0,26],[3,6,0,58],[4,3,4,4],[20,6,1,59],[22,4,4,11],[38,4,5,12],[70,5,6,27],[134,5,7,28],[262,6,7,60],[390,7,8,125],[646,6,10,61],[-16,9,32,510,"lower"],[1670,9,32,511]];break;case 9:e=[[-31,8,4,252],[-15,9,2,508],[-11,8,2,253],[-7,9,1,509],[-5,7,1,124],[-3,4,1,10],[-1,3,1,2],[1,3,1,3],[3,5,1,26],[5,6,1,58],[7,3,5,4],[39,6,2,59],[43,4,5,11],[75,4,6,12],[139,5,7,27],[267,5,8,28],[523,6,8,60],[779,7,9,125],[1291,6,11,61],[-32,9,32,510,"lower"],[3339,9,32,511]];break;case 10:e=[[-21,7,4,122],[-5,8,0,252],[-4,7,0,123],[-3,5,0,24],[-2,2,2,0],[2,5,0,25],[3,6,0,54],[4,7,0,124],[5,8,0,253],[6,2,6,1],[70,5,5,26],[102,6,5,55],[134,6,6,56],[198,6,7,57],[326,6,8,58],[582,6,9,59],[1094,6,10,60],[2118,7,11,125],[-22,8,32,254,"lower"],[4166,8,32,255]];break;case 11:e=[[1,1,0,0],[2,2,1,2],[4,4,0,12],[5,4,1,13],[7,5,1,28],[9,5,2,29],[13,6,2,60],[17,7,2,122],[21,7,3,123],[29,7,4,124],[45,7,5,125],[77,7,6,126],[141,7,32,127]];break;case 12:e=[[1,1,0,0],[2,2,0,2],[3,3,1,6],[5,5,0,28],[6,5,1,29],[8,6,1,60],[10,7,0,122],[11,7,1,123],[13,7,2,124],[17,7,3,125],[25,7,4,126],[41,8,5,254],[73,8,32,255]];break;case 13:e=[[1,1,0,0],[2,3,0,4],[3,4,0,12],[4,5,0,28],[5,4,1,13],[7,3,3,5],[15,6,1,58],[17,6,2,59],[21,6,3,60],[29,6,4,61],[45,6,5,62],[77,7,6,126],[141,7,32,127]];break;case 14:e=[[-2,3,0,4],[-1,3,0,5],[0,1,0,0],[1,3,0,6],[2,3,0,7]];break;case 15:e=[[-24,7,4,124],[-8,6,2,60],[-4,5,1,28],[-2,4,0,12],[-1,3,0,4],[0,1,0,0],[1,3,0,5],[2,4,0,13],[3,5,1,29],[5,6,2,61],[9,7,4,125],[-25,7,32,126,"lower"],[25,7,32,127]];break;default:throw new Error("Standard table B."+t+" does not exist")}for(var n=0,r=e.length;n<r;n++)e[n]=new Mc(e[n]);i=new jc(e,!0),this._standardTablesCache[t]=i}return i},Oc.prototype._getSymbolDictionaryHuffmanTables=function(t,e,i){var n,r,s,a=0;switch(t.huffmanDHSelector){case 0:case 1:n=this._getStandardTable(t.huffmanDHSelector+4);break;case 3:n=this._getCustomHuffmanTable(a,e,i),a++;break;default:throw new Error("Invalid Huffman DH selector: the provided selector value is not recognized or supported.")}switch(t.huffmanDWSelector){case 0:case 1:r=this._getStandardTable(t.huffmanDWSelector+2);break;case 3:r=this._getCustomHuffmanTable(a,e,i),a++;break;default:throw new Error("Invalid Huffman Dictionary Word selector: failed during decoding process.")}return t.bitmapSizeSelector?(s=this._getCustomHuffmanTable(a,e,i),a++):s=this._getStandardTable(1),{tableDeltaHeight:n,tableDeltaWidth:r,tableBitmapSize:s,tableAggregateInstances:t.aggregationInstancesSelector?this._getCustomHuffmanTable(a,e,i):this._getStandardTable(1)}},Oc.prototype._readUncompressedBitmap=function(t,e,i){for(var n=[],r=0;r<i;r++){var s=new Uint8Array(e);n.push(s);for(var a=0;a<e;a++)s[a]=t._readBit();t.byteAlign()}return n},Oc.prototype._decodeMmrBitmap=function(t,e,i,n){for(var r,s=new gc(t,{K:-1,Columns:e,Rows:i,BlackIs1:!0,EndOfBlock:n}),a=[],o=!1,h=0;h<i;h++)for(var c=new Uint8Array(e),_=(a.push(c),-1),d=0;d<e;d++)_<0&&(-1===(r=s.readNextChar())&&(o=!(r=0)),_=7),c[d]=r>>_&1,_--;if(n&&!o)for(var l=0;l<5&&-1!==s.readNextChar();l++);return a},Oc.prototype._onSymbolDictionary=function(t,e,i,n,r,s){t.huffman&&(a=this._getSymbolDictionaryHuffmanTables(t,i,this._customTables),o=new zc(n,r,s));for(var a,o,h=this._symbols,c=(h||(this._symbols=h={}),[]),_=0,d=i;_<d.length;_++){var l=h[d[_]];l&&c.push.apply(c,l)}i=new Dc(n,r,s);h[e]=this._decodeSymbolDictionary(t.huffman,t.refinement,c,t.numberOfNewSymbols,t.numberOfExportedSymbols,a,t.template,t.at,t.refinementTemplate,t.refinementAt,i,o)},Oc.prototype._onImmediateTextRegion=function(t,e,i,n,r){for(var s,a,o=t.info,h=this._symbols,c=[],_=0,d=e;_<d.length;_++){var l=d[_],l=h[Number.parseInt(l.toString(),10)];l&&c.push.apply(c,l)}var u=Co(c.length),e=(t.huffman&&(a=new zc(i,n,r),s=this._getTextRegionHuffmanTables(t,e,this._customTables,c.length,a)),new Dc(i,n,r)),i=this._decodeTextRegion(t.huffman,t.refinement,o.width,o.height,t.defaultPixelValue,t.numberOfSymbolInstances,t.stripSize,c,u,t.transposed,t.dsOffset,t.referenceCorner,t.combinationOperator,s,t.refinementTemplate,t.refinementAt,e,t.logStripSize,a);this._drawBitmap(o,i)},Oc.prototype._onPatternDictionary=function(t,e,i,n,r){var s=this._patterns,i=(s||(this._patterns=s={}),new Dc(i,n,r));s[Number.parseInt(e.toString(),10)]=this._decodePatternDictionary(t.mmr,t.patternWidth,t.patternHeight,t.maxPatternIndex,t.template,i)},Oc.prototype._onImmediateHalftoneRegion=function(t,e,i,n,r){var e=this._patterns[e[0]],s=t.info,i=new Dc(i,n,r),n=this._decodeHalftoneRegion(t.mmr,e,t.template,s.width,s.height,t.defaultPixelValue,t.enableSkip,t.combinationOperator,t.gridWidth,t.gridHeight,t.gridOffsetX,t.gridOffsetY,t.gridVectorX,t.gridVectorY,i);this._drawBitmap(s,n)},Oc.prototype._onTables=function(t,e,i,n){var r=this._customTables;r||(this._customTables=r={}),r[Number.parseInt(t.toString(),10)]=this._decodeTablesSegment(e,i,n)},Oc.prototype._decodeTablesSegment=function(t,e,i){for(var n,r,s=t[e],a=4294967295&Ao(t,e+1),o=4294967295&Ao(t,e+5),h=new zc(t,e+9,i),c=1+(s>>1&7),_=1+(s>>4&7),d=[],l=a;n=h._readBits(c),r=h._readBits(_),d.push(new Mc([l,n,r,0])),(l+=1<<r)<o;);return n=h._readBits(c),d.push(new Mc([a-1,n,32,0,"lower"])),n=h._readBits(c),d.push(new Mc([o,n,32,0])),1&s&&(n=h._readBits(c),d.push(new Mc([n,0]))),new jc(d,!1)},Oc.prototype._decodeBitmapTemplate0=function(t,e,i){for(var n,r,s,a,o,h,c=i.decoder,_=i.contextCache.getContexts("GB"),d=[],l=0;l<e;l++)for(a=d[l]=new Uint8Array(t),n=(h=l<2?a:d[l-2])[0]<<13|h[1]<<12|h[2]<<11|(o=l<1?a:d[l-1])[0]<<7|o[1]<<6|o[2]<<5|o[3]<<4,r=0;r<t;r++)a[r]=s=c._readBit(_,n),n=(31735&n)<<1|(r+3<t?h[r+3]<<11:0)|(r+4<t?o[r+4]<<4:0)|s;return d},Oc.prototype._decodeBitmap=function(t,e,i,n,r,s,a,o){if(t)return t=new zc(o._data,o._start,o._end),this._decodeMmrBitmap(t,e,i,!1);if(0===n&&!s&&!r&&4===a.length&&3===a[0].x&&-1===a[0].y&&-3===a[1].x&&-1===a[1].y&&2===a[2].x&&-2===a[2].y&&-2===a[3].x&&-2===a[3].y)return this._decodeBitmapTemplate0(e,i,o);for(var h=!!s,c=this._codingTemplates[n].concat(a),_=(c.sort(function(t,e){return t.y-e.y||t.x-e.x}),c.length),d=new Int8Array(_),l=new Int8Array(_),u=[],p=0,f=0,g=0,y=0,m=0;m<_;m++)d[m]=c[m].x,l[m]=c[m].y,f=Math.min(f,c[m].x),g=Math.max(g,c[m].x),y=Math.min(y,c[m].y),m<_-1&&c[m].y===c[m+1].y&&c[m].x===c[m+1].x-1?p|=1<<_-1-m:u.push(m);for(var b=u.length,w=new Int8Array(b),v=new Int8Array(b),S=new Uint16Array(b),P=0;P<b;P++)w[P]=c[m=u[P]].x,v[P]=c[m].y,S[P]=1<<_-1-m;for(var x,A,T,C,k,R=-f,M=-y,E=e-g,N=this._reusedContexts[n],F=new Uint8Array(e),I=[],D=o.decoder,B=o.contextCache.getContexts("GB"),j=0,L=0,O=0;O<i;O++){if(r)if(j^=D._readBit(B,N)){I.push(F);continue}for(F=new Uint8Array(F),I.push(F),x=0;x<e;x++)if(h&&s[O][x])F[x]=0;else{if(R<=x&&x<E&&M<=O)for(L=L<<1&p,m=0;m<b;m++)A=O+v[m],T=x+w[m],(C=I[A][T])&&(L|=C=S[m]);else for(k=_-1,m=L=0;m<_;m++,k--)0<=(T=x+d[m])&&T<e&&0<=(A=O+l[m])&&(C=I[A][T])&&(L|=C<<k);var V=D._readBit(B,L);F[x]=V}}return I},Oc.prototype._decodeRefinement=function(t,e,i,n,r,s,a,o,h){for(var c=this._refinementTemplates[i].coding,_=(c=0===i?c.concat([o[0]]):c).length,d=new Int32Array(_),l=new Int32Array(_),u=0;u<_;u++)d[u]=c[u].x,l[u]=c[u].y;for(var p=this._refinementTemplates[i].reference,f=(p=0===i?p.concat([o[1]]):p).length,g=new Int32Array(f),y=new Int32Array(f),u=0;u<f;u++)g[u]=p[u].x,y[u]=p[u].y;for(var m=n[0].length,b=n.length,w=this._refinementReusedContexts[i],v=[],S=h.decoder,P=h.contextCache.getContexts("GR"),x=0,A=0;A<e;A++){if(a)if(x^=S._readBit(P,w))throw new Error("Prediction functionality is not supported.");var T=new Uint8Array(t);v.push(T);for(var C=0;C<t;C++){for(var k=void 0,R=void 0,F=0,u=0;u<_;u++)k=A+l[u],R=C+d[u],k<0||R<0||t<=R?F<<=1:F=F<<1|v[k][R];for(u=0;u<f;u++)k=A+y[u]-s,R=C+g[u]-r,k<0||b<=k||R<0||m<=R?F<<=1:F=F<<1|n[k][R];var I=S._readBit(P,F);T[C]=I}}return v},Oc.prototype._decodeSymbolDictionary=function(t,e,i,n,M,r,E,N,s,a,o,h){if(t&&e)throw new Error("Huffman coding with symbol refinement is not supported.");var c,_=[],d=0,l=Co(i.length+n),u=o.decoder,p=o.contextCache,f=[];for(t&&(c=this._getStandardTable(1),l=Math.max(l,1));_.length<n;){d+=t?r.tableDeltaHeight.decode(h):this._decodeInteger(p,"IADH",u);for(var g=0,y=0,m=t?f.length:0;;){var b=t?r.tableDeltaWidth.decode(h):this._decodeInteger(p,"IADW",u);if(void 0===b)break;y+=g+=b;var w,v,S,b=void 0;e?(b=1<(S=this._decodeInteger(p,"IAAI",u))?this._decodeTextRegion(t,e,g,d,0,S,1,i.concat(_),l,0,0,1,0,r,s,a,o,0,h):(S=this._decodeImageData(p,u,l),w=this._decodeInteger(p,"IARDX",u),v=this._decodeInteger(p,"IARDY",u),S=S<i.length?i[S]:_[S-i.length],this._decodeRefinement(g,d,s,S,w,v,!1,a,o)),_.push(b)):t?f.push(g):(b=this._decodeBitmap(!1,g,d,E,!1,null,N,o),_.push(b))}if(t&&!e){var P,x=r.tableBitmapSize.decode(h),A=(h.byteAlign(),void 0),T=(0===x?A=this._readUncompressedBitmap(h,y,d):(P=h.end,x=h.position+x,h.end=x,A=this._decodeMmrBitmap(h,y,d,!1),h.end=P,h.position=x),f.length);if(m===T-1)_.push(A);else for(var C=0,k=void 0,R=m;R<T;R++){for(var j=C+f[R],k=[],F=0;F<d;F++)k.push(A[F].subarray(C,j));_.push(k),C=j}}}for(var I=[],D=[],B=!1,V=0,z=i.length+n;D.length<z;){for(var U=t?c.decode(h):this._decodeInteger(p,"IAEX",u);U--;)D.push(B);B=!B}for(var L=0;L<i.length;L++)D[L]&&I.push(i[L]);for(var O=0;O<n;O++,V++)D[V]&&I.push(_[O]);return I},Oc.prototype._decodeInteger=function(t,e,i){var n,t=t.getContexts(e),e=new kc,r=e._readBits(1,i,t),e=e._readBits(1,i,t)?e._readBits(1,i,t)?e._readBits(1,i,t)?e._readBits(1,i,t)?e._readBits(1,i,t)?e._readBits(32,i,t)+4436:e._readBits(12,i,t)+340:e._readBits(8,i,t)+84:e._readBits(6,i,t)+20:e._readBits(4,i,t)+4:e._readBits(2,i,t);if(0===r?n=e:0<e&&(n=-e),n>=-Math.pow(2,31)&&n<=Math.pow(2,31)-1)return n},Oc.prototype._decodeImageData=function(t,e,i){for(var n=t.getContexts("IAID"),r=1,s=0;s<i;s++)r=r<<1|e._readBit(n,r);return i<31?r&(1<<i)-1:2147483647&r},Oc.prototype._decodeTextRegion=function(t,e,i,n,r,s,a,o,M,h,E,c,_,d,N,j,l,V,u){if(t&&e)throw new Error("Huffman encoding with refinement is currently not supported.");for(var p=[],f=0;f<n;f++){var g=new Uint8Array(i);r&&g.fill(r),p.push(g)}for(var y=l.decoder,m=l.contextCache,b=t?-d.tableDeltaT.decode(u):-this._decodeInteger(m,"IADT",y),z=0,w=0;w<s;){b+=t?d.tableDeltaT.decode(u):this._decodeInteger(m,"IADT",y);for(var v=z+=t?d.tableFirstS.decode(u):this._decodeInteger(m,"IAFS",y);;){var S,P=0,P=a*b+(P=1<a?t?u._readBits(V):this._decodeInteger(m,"IAIT",y):P),x=t?d.symbolIDTable.decode(u):this._decodeImageData(m,y,M),A=e&&(t?u._readBit():this._decodeInteger(m,"IARI",y)),T=o[x],C=T[0].length,k=T.length,x=(A&&(x=this._decodeInteger(m,"IARDW",y),A=this._decodeInteger(m,"IARDH",y),O=this._decodeInteger(m,"IARDX",y),S=this._decodeInteger(m,"IARDY",y),C+=x,k+=A,T=this._decodeRefinement(C,k,N,T,(x>>1)+O,(A>>1)+S,!1,j,l)),0),R=(h?1&c?x=k-1:v+=k-1:1<c?v+=C-1:x=C-1,P-(1&c?0:k-1)),F=v-(2&c?C-1:0),I=void 0,D=void 0,B=void 0;if(h){for(I=0;I<k;I++)if(g=p[F+I]){var B=T[I],L=Math.min(i-R,C);switch(_){case 0:for(D=0;D<L;D++)g[R+D]|=B[D];break;case 2:for(D=0;D<L;D++)g[R+D]^=B[D];break;default:throw new Error("The combination operator "+_+" is not supported.")}}}else for(D=0;D<k;D++)if(g=p[R+D])switch(B=T[D],_){case 0:for(I=0;I<C;I++)g[F+I]|=B[I];break;case 2:for(I=0;I<C;I++)g[F+I]^=B[I];break;default:throw new Error("The combination operator "+_+" is not supported.")}w++;var O=t?d.tableDeltaS.decode(u):this._decodeInteger(m,"IADS",y);if(null==O)break;v+=x+O+E}}return p},Oc.prototype._decodePatternDictionary=function(t,e,i,n,r,s){var a=[];t||(a.push({x:-e,y:0}),0===r&&a.push({x:-3,y:-1},{x:2,y:-2},{x:-2,y:-2}));for(var o=this._decodeBitmap(t,(n+1)*e,i,r,!1,null,a,s),h=[],c=0;c<=n;c++){for(var _=[],d=e*c,l=d+e,u=0;u<i;u++)_.push(o[u].subarray(d,l));h.push(_)}return h},Oc.prototype._decodeHalftoneRegion=function(t,e,i,n,r,s,a,o,h,c,_,d,l,u,p){if(a)throw new Error("Operation failed: skip is not implemented or allowed here.");if(0!==o)throw new Error("The operator '"+o+"' is not supported in halftone region");for(var f=[],g=0;g<r;g++){var y=new Uint8Array(n);s&&y.fill(s),f.push(y)}var m,b,a=e.length,o=e[0],w=o[0].length,v=o.length,S=Co(a),P=[],x=(t||(P.push({x:i<=1?3:2,y:-1}),0===i&&P.push({x:-3,y:-1},{x:2,y:-2},{x:-2,y:-2})),[]);t&&(m=new zc(p.data,p.start,p.end));for(g=S-1;0<=g;g--)b=t?this._decodeMmrBitmap(m,h,c,!0):this._decodeBitmap(!1,h,c,i,!1,null,P,p),x[g]=b;for(var A=0;A<c;A++)for(var T=0;T<h;T++){for(var M=0,C=0,k=S-1;0<=k;k--)C|=(M^=x[k][A][T])<<k;var R=e[C],F=_+A*u+T*l>>8,I=d+A*l-T*u>>8;if(0<=F&&F+w<=n&&0<=I&&I+v<=r)for(g=0;g<v;g++)for(var D=f[I+g],B=R[g],k=0;k<w;k++)D[F+k]|=B[k];else for(var L,O,g=0;g<v;g++)if(!((O=I+g)<0||r<=O))for(D=f[O],B=R[g],k=0;k<w;k++)0<=(L=F+k)&&L<n&&(D[L]|=B[k])}return f};var Lc=Oc;function Oc(){this._standardTablesCache={},this._codingTemplates=[[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:2,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-2,y:0},{x:-1,y:0}],[{x:-3,y:-1},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}]],this._refinementTemplates=[{coding:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:-1,y:1},{x:0,y:1},{x:1,y:1}]},{coding:[{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:0,y:1},{x:1,y:1}]}],this._reusedContexts=[39717,1941,229,405],this._refinementReusedContexts=[32,8]}var Mc=function(t){2===t.length?(this.isoob=!0,this.rangeLow=0,this.prefixLength=t[0],this.rangeLength=0,this.prefixCode=t[1],this.isLowerRange=!1):(this.isoob=!1,this.rangeLow=t[0],this.prefixLength=t[1],this.rangeLength=t[2],this.prefixCode=t[3],this.isLowerRange="lower"===t[4])},Ec=(Nc.prototype._buildTree=function(t,e){var i,n=t.prefixCode>>e&1;e<=0?this.children[n]=new Nc(t):((i=this.children[n])||(this.children[n]=i=new Nc(null)),i._buildTree(t,e-1))},Nc.prototype._decodeNode=function(t){if(this.isLeaf)return this.isoob?null:(e=t._readBits(this.rangeLength),this.rangeLow+(this.isLowerRange?-e:e));var e=this.children[t._readBit()];if(e)return e._decodeNode(t);throw new Error("Failed to decode: Huffman data is invalid or corrupted.")},Nc);function Nc(t){this.children=[],t?(this.isLeaf=!0,this.rangeLength=t.rangeLength,this.rangeLow=t.rangeLow,this.isLowerRange=t.isLowerRange,this.isoob=t.isoob):this.isLeaf=!1}Vc.prototype.decode=function(t){return this.rootNode._decodeNode(t)},Vc.prototype.assignPrefixCodes=function(t){for(var e=t.length,i=0,n=0;n<e;n++)i=Math.max(i,t[n].prefixLength);for(var r=new Uint32Array(i+1),n=0;n<e;n++)r[t[n].prefixLength]++;var s,a,o,h=1,c=0;for(r[0]=0;h<=i;){for(s=c=c+r[h-1]<<1,a=0;a<e;)(o=t[a]).prefixLength===h&&(o.prefixCode=s,s++),a++;h++}};var jc=Vc;function Vc(t,e){e||this.assignPrefixCodes(t),this.rootNode=new Ec(null);for(var i=0,n=t.length;i<n;i++){var r=t[i];0<r.prefixLength&&this.rootNode._buildTree(r,r.prefixLength-1)}}Uc.prototype._readBit=function(){if(this.shift<0){if(this.position>=this.end)throw new Error("Unexpected end of input: No more data available while attempting to read a bit.");this.currentByte=this.data[this.position++],this.shift=7}var t=this.currentByte>>this.shift&1;return this.shift--,t},Uc.prototype._readBits=function(t){for(var e=0,i=t-1;0<=i;i--)e|=this._readBit()<<i;return e},Uc.prototype.byteAlign=function(){this.shift=-1},Uc.prototype.next=function(){return this.position>=this.end?-1:this.data[this.position++]};var zc=Uc;function Uc(t,e,i){this.data=t,this.start=e,this.end=i,this.position=e,this.shift=-1,this.currentByte=0}Wc.prototype._parseChunks=function(t){return this._parseJbig2Chunks(t)},Wc.prototype._parse=function(t){var t=this._parseJbig2(t),e=t.imgData,i=t.width,t=t.height;return this.width=i,this.height=t,e},Wc.prototype._processSegments=function(t,e){for(var i=0,n=t.length;i<n;i++)this._processSegment(t[i],e)},Wc.prototype._parseJbig2=function(t){var e=t.length,i=0;if(151!==t[i]||74!==t[i+1]||66!==t[i+2]||50!==t[i+3]||13!==t[i+4]||10!==t[i+5]||26!==t[i+6]||10!==t[i+7])throw new Error("JBIG2 parsing error: The image header is invalid or malformed.");for(var n=Object.create(null),r=(i+=8,t[i++]),r=(n.randomAccess=!(1&r),2&r||(n.numberOfPages=Ao(t,i),i+=4),this._readSegments(n,t,i,e)),n=new Lc,t=(this._processSegments(r,n),n._currentPageInfo),s=t.width,a=t.height,o=n._buffer,h=new Uint8ClampedArray(s*a),c=0,_=0,d=0;d<a;d++)for(var l=0,u=void 0,p=0;p<s;p++)l||(l=128,u=o[_++]),h[c++]=u&l?0:255,l>>=1;return{imgData:h,width:s,height:a}},Wc.prototype._parseJbig2Chunks=function(t){for(var e=new Lc,i=0,n=t.length;i<n;i++){var r=t[i],r=this._readSegments({},r.data,r.start,r.end);this._processSegments(r,e)}return e._buffer},Wc.prototype._readSegmentHeader=function(t,e){var i={number:Ao(t,e),type:0,typeName:null,deferredNonRetain:!1,retainBits:[],pageAssociation:0,length:0,referredTo:[],headerEnd:e},n=t[e+4],r=63&n;if(!this._segmentTypes[r])throw new Error("JBIG2 decoding error: Encountered an unknown or unsupported segment type"+r);i.type=r,i.typeName=this._segmentTypes[r],i.deferredNonRetain=!!(128&n);var n=!!(64&n),s=t[e+5],a=s>>5&7,o=[31&s],h=e+6;if(7===s){a=536870911&Ao(t,h-1),h+=3;var c=a+7>>3;for(o[0]=t[h++];0<--c;)o.push(t[h++])}else if(5===s||6===s)throw new Error("JBIG2 decoding error: Encountered invalid or malformed referred-to flags in the segment header.");i.retainBits=o;for(var _=4,d=(i.number<=256?_=1:i.number<=65536&&(_=2),[]),l=0;l<a;l++){var u=void 0,u=1===_?t[h]:(2===_?xo:Ao)(t,h);d.push(u),h+=_}if(i.referredTo=d,n?(i.pageAssociation=Ao(t,h),h+=4):i.pageAssociation=t[h++],i.length=Ao(t,h),h+=4,4294967295===i.length){if(38!=r)throw new Error("Segment length is unknown or invalid");var e=this._readRegionSegmentInformation(t,h),s=!!(1&t[h+this._regionSegmentInformationFieldLength]),p=new Uint8Array(6);s||(p[0]=255,p[1]=172),p[2]=e.height>>>24&255,p[3]=e.height>>16&255,p[4]=e.height>>8&255,p[5]=255&e.height;for(var l=h,f=t.length;l<f;l++){for(var g=0;g<6&&p[g]===t[l+g];)g++;if(6===g){i.length=l+6;break}}if(4294967295===i.length)throw new Error("Decoding error: Unable to find the end of the segment")}return i.headerEnd=h,i},Wc.prototype._readSegments=function(t,e,i,n){for(var r=[],s=i;s<n;){var a=this._readSegmentHeader(e,s),s=a.headerEnd,o={header:a,data:e};if(t.randomAccess||(o.start=s,s+=a.length,o.end=s),r.push(o),51===a.type)break}if(t.randomAccess)for(var h=0,c=r.length;h<c;h++)r[h].start=s,s+=r[h].header.length,r[h].end=s;return r},Wc.prototype._processSegment=function(t,e){var i,n,r,s,a,o,h=t.header,c=t.data,_=t.end,d=t.start;switch(h.type){case 0:if(o=xo(c,d),(a={}).huffman=!!(1&o),a.refinement=!!(2&o),a.huffmanDHSelector=o>>2&3,a.huffmanDWSelector=o>>4&3,a.bitmapSizeSelector=o>>6&1,a.aggregationInstancesSelector=o>>7&1,a.bitmapCodingContextUsed=!!(256&o),a.bitmapCodingContextRetained=!!(512&o),a.template=o>>10&3,a.refinementTemplate=o>>12&1,d+=2,!a.huffman){for(s=0===a.template?4:1,n=[],r=0;r<s;r++)n.push({x:To(c,d),y:To(c,d+1)}),d+=2;a.at=n}if(a.refinement&&!a.refinementTemplate){for(n=[],r=0;r<2;r++)n.push({x:To(c,d),y:To(c,d+1)}),d+=2;a.refinementAt=n}a.numberOfExportedSymbols=Ao(c,d),a.numberOfNewSymbols=Ao(c,d+=4),i=[a,h.number,h.referredTo,c,d+=4,_];break;case 6:case 7:if((o={}).info=this._readRegionSegmentInformation(c,d),a=xo(c,d+=this._regionSegmentInformationFieldLength),d+=2,o.huffman=!!(1&a),o.refinement=!!(2&a),o.logStripSize=a>>2&3,o.stripSize=1<<o.logStripSize,o.referenceCorner=a>>4&3,o.transposed=!!(64&a),o.combinationOperator=a>>7&3,o.defaultPixelValue=a>>9&1,o.dsOffset=a<<17>>27,o.refinementTemplate=a>>15&1,o.huffman&&(a=xo(c,d),d+=2,o.huffmanFS=3&a,o.huffmanDS=a>>2&3,o.huffmanDT=a>>4&3,o.huffmanRefinementDW=a>>6&3,o.huffmanRefinementDH=a>>8&3,o.huffmanRefinementDX=a>>10&3,o.huffmanRefinementDY=a>>12&3,o.huffmanRefinementSizeSelector=!!(16384&a)),o.refinement&&!o.refinementTemplate){for(n=[],r=0;r<2;r++)n.push({x:To(c,d),y:To(c,d+1)}),d+=2;o.refinementAt=n}o.numberOfSymbolInstances=Ao(c,d),i=[o,h.referredTo,c,d+=4,_];break;case 16:a=c[d++],(o={}).mmr=!!(1&a),o.template=a>>1&3,o.patternWidth=c[d++],o.patternHeight=c[d++],o.maxPatternIndex=Ao(c,d),i=[o,h.number,c,d+=4,_];break;case 22:case 23:(a={}).info=this._readRegionSegmentInformation(c,d),d+=this._regionSegmentInformationFieldLength,o=c[d++],a.mmr=!!(1&o),a.template=o>>1&3,a.enableSkip=!!(8&o),a.combinationOperator=o>>4&7,a.defaultPixelValue=o>>7&1,a.gridWidth=Ao(c,d),a.gridHeight=Ao(c,d+=4),a.gridOffsetX=4294967295&Ao(c,d+=4),a.gridOffsetY=4294967295&Ao(c,d+=4),a.gridVectorX=xo(c,d+=4),a.gridVectorY=xo(c,d+=2),i=[a,h.referredTo,c,d+=2,_];break;case 38:case 39:if((o={}).info=this._readRegionSegmentInformation(c,d),d+=this._regionSegmentInformationFieldLength,a=c[d++],o.mmr=!!(1&a),o.template=a>>1&3,o.prediction=!!(8&a),!o.mmr){for(s=0===o.template?4:1,n=[],r=0;r<s;r++)n.push({x:To(c,d),y:To(c,d+1)}),d+=2;o.at=n}i=[o,c,d,_];break;case 48:4294967295===(a={width:Ao(c,d),height:Ao(c,d+4),resolutionX:Ao(c,d+8),resolutionY:Ao(c,d+12)}).height&&delete a.height,o=c[d+16],xo(c,d+17),a.lossless=!!(1&o),a.refinement=!!(2&o),a.defaultPixelValue=o>>2&1,a.combinationOperator=o>>3&3,a.requiresBuffer=!!(32&o),a.combinationOperatorOverride=!!(64&o),i=[a];break;case 49:case 50:case 51:break;case 53:i=[h.number,c,d,_];break;case 62:break;default:throw new Error("Segment type "+h.typeName+"("+h.type+") is not implemented")}t="_on"+h.typeName;"_onImmediateLosslessGenericRegion"==t?e._onImmediateGenericRegion(i[0],i[1],i[2],i[3],i[4]):"_onImmediateLosslessTextRegion"==t?e._onImmediateTextRegion(i[0],i[1],i[2],i[3],i[4]):"_onImmediateLosslessHalftoneRegion"==t?e._onImmediateHalftoneRegion(i[0],i[1],i[2],i[3],i[4]):"_onPageInformation"==t?e._onPageInformation(i):"_onSymbolDictionary"==t&&e._onSymbolDictionary(i[0],i[1],i[2],i[3],i[4],i[5])},Wc.prototype._readRegionSegmentInformation=function(t,e){return{width:Ao(t,e),height:Ao(t,e+4),x:Ao(t,e+8),y:Ao(t,e+12),combinationOperator:7&t[e+16]}};var Hc=Wc;function Wc(){this._regionSegmentInformationFieldLength=17,this._segmentTypes=["SymbolDictionary",null,null,null,"IntermediateTextRegion",null,"ImmediateTextRegion","ImmediateLosslessTextRegion",null,null,null,null,null,null,null,null,"PatternDictionary",null,null,null,"IntermediateHalftoneRegion",null,"ImmediateHalftoneRegion","ImmediateLosslessHalftoneRegion",null,null,null,null,null,null,null,null,null,null,null,null,"IntermediateGenericRegion",null,"ImmediateGenericRegion","ImmediateLosslessGenericRegion","IntermediateGenericRefinementRegion",null,"ImmediateGenericRefinementRegion","ImmediateLosslessGenericRefinementRegion",null,null,null,null,"PageInformation","EndOfPage","EndOfStripe","EndOfFile","Profiles","Tables",null,null,null,null,null,null,null,null,"Extension"]}qc=function(t,e){return(qc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}qc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Xc,Gc=d),Object.defineProperty(Xc.prototype,"bytes",{get:function(){return this.stream.getBytes(this.maybeLength)},enumerable:!0,configurable:!0}),Xc.prototype.readBlock=function(){this.decodeImage()},Xc.prototype.decodeImage=function(t){if(!this.eof){t=t||this.bytes;for(var e,i=new Hc,n=[],r=(this.params instanceof D&&(e=this.params.get("JBIG2Globals"))instanceof y&&(e=e.getBytes(),n.push({data:e,start:0,end:e.length})),n.push({data:t,start:0,end:t.length}),i._parseChunks(n)),s=r.length,a=0;a<s;a++)r[a]^=255;this.buffer=r,this.bufferLength=s,this.eof=!0}return this.buffer};var qc,Gc,Kc=Xc;function Xc(t,e,i){var n=Gc.call(this,e)||this;return n.stream=t,n.maybeLength=e,n.params=i,n}Yc=function(t,e){return(Yc=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};function Jc(){}(function(t,e){function i(){this.constructor=t}Yc(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})($c,Qc=Jc),Object.defineProperty($c.prototype,"_mixCol",{get:function(){if(void 0===this._mixC||null===this._mixC){this._mixC=new Uint8Array(256);for(var t=0;t<256;t++)this._mixC[t]=t<128?t<<1:t<<1^27}return this._mixC},enumerable:!0,configurable:!0}),$c.prototype._decrypt=function(t,e){var i,n,r=new Uint8Array(16);r.set(t);for(var s=0,a=this._keySize;s<16;++s,++a)r[s]^=e[a];for(var o=this._cyclesOfRepetition-1;1<=o;--o){l=r[13],r[13]=r[9],r[9]=r[5],r[5]=r[1],r[1]=l,l=r[14],i=r[10],r[14]=r[6],r[10]=r[2],r[6]=l,r[2]=i,l=r[15],i=r[11],n=r[7],r[15]=r[3],r[11]=l,r[7]=i,r[3]=n;for(s=0;s<16;++s)r[s]=this._inverseS[r[s]];for(s=0,a=16*o;s<16;++s,++a)r[s]^=e[a];for(s=0;s<16;s+=4){var h=this._mix[r[s]],c=this._mix[r[s+1]],_=this._mix[r[s+2]],d=this._mix[r[s+3]],l=h^c>>>8^c<<24^_>>>16^_<<16^d>>>24^d<<8;r[s]=l>>>24&255,r[s+1]=l>>16&255,r[s+2]=l>>8&255,r[s+3]=255&l}}l=r[13],r[13]=r[9],r[9]=r[5],r[5]=r[1],r[1]=l,l=r[14],i=r[10],r[14]=r[6],r[10]=r[2],r[6]=l,r[2]=i,l=r[15],i=r[11],n=r[7],r[15]=r[3],r[11]=l,r[7]=i,r[3]=n;for(s=0;s<16;++s)r[s]=this._inverseS[r[s]],r[s]^=e[s];return r},$c.prototype._encryptBlock=function(t,e){var i,n,r=this._s,s=new Uint8Array(16);s.set(t);for(var a=0;a<16;++a)s[a]^=e[a];for(var o=1;o<this._cyclesOfRepetition;o++){for(a=0;a<16;++a)s[a]=r[s[a]];n=s[1],s[1]=s[5],s[5]=s[9],s[9]=s[13],s[13]=n,n=s[2],i=s[6],s[2]=s[10],s[6]=s[14],s[10]=n,s[14]=i,n=s[3],i=s[7],l=s[11],s[3]=s[15],s[7]=n,s[11]=i,s[15]=l;for(a=0;a<16;a+=4){var h=s[a+0],c=s[a+1],_=s[a+2],d=s[a+3],l=h^c^_^d;s[a+0]^=l^this._mixCol[h^c],s[a+1]^=l^this._mixCol[c^_],s[a+2]^=l^this._mixCol[_^d],s[a+3]^=l^this._mixCol[d^h]}for(var a=0,u=16*o;a<16;++a,++u)s[a]^=e[u]}for(a=0;a<16;++a)s[a]=r[s[a]];n=s[1],s[1]=s[5],s[5]=s[9],s[9]=s[13],s[13]=n,n=s[2],i=s[6],s[2]=s[10],s[6]=s[14],s[10]=n,s[14]=i,n=s[3],i=s[7],l=s[11],s[3]=s[15],s[7]=n,s[11]=i,s[15]=l;for(a=0,u=this._keySize;a<16;++a,++u)s[a]^=e[u];return s},$c.prototype._decryptBlockHelper=function(t,e){for(var i=t.length,n=this._buffer,r=this._position,s=[],a=this._iv,o=0;o<i;++o)if(n[r]=t[o],!(++r<16)){for(var h=this._decrypt(n,this._key),c=0;c<16;++c)h[c]^=a[c];a=n,s.push(h),n=new Uint8Array(16),r=0}if(this._buffer=n,this._bufferLength=r,this._iv=a,0===s.length)return new Uint8Array(0);var _=16*s.length;if(e){var d=s[s.length-1],l=d[15];if(l<=16){for(var o=15,u=16-l;u<=o;--o)if(d[o]!==l){l=0;break}_-=l,s[s.length-1]=d.subarray(0,16-l)}}for(var p=new Uint8Array(_),o=0,c=0;o<s.length;++o,c+=16)p.set(s[o],c);return p},$c.prototype._decryptBlock=function(t,e,i){var n=t.length,r=this._buffer,s=this._position;if(i)this._iv=i;else{for(var a=0;s<16&&a<n;++a,++s)r[s]=t[a];if(s<16)return this._bufferLength=s,new Uint8Array(0);this._iv=r,t=t.subarray(16)}return this._buffer=new Uint8Array(16),this._bufferLength=0,this._decryptBlock=this._decryptBlockHelper,this._decryptBlock(t,e)},$c.prototype._encrypt=function(t,e){var i=t.length,n=this._buffer,r=this._position,s=[];e=e||new Uint8Array(16);for(var a=0;a<i;++a)if(n[r]=t[a],!(++r<16)){for(var o=0;o<16;++o)n[o]^=e[o];var h=this._encryptBlock(n,this._key);s.push(e=h),n=new Uint8Array(16),r=0}if(this._buffer=n,this._bufferLength=r,this._iv=e,0===s.length)return new Uint8Array(0);for(var c=new Uint8Array(16*s.length),a=0,o=0;a<s.length;++a,o+=16)c.set(s[a],o);return c};var Yc,Qc,Zc=$c;function $c(){var t=null!==Qc&&Qc.apply(this,arguments)||this;return t._buffer=new Uint8Array(16),t._position=0,t._s=new Uint8Array([99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22]),t._inverseS=new Uint8Array([82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125]),t._mix=new Uint32Array([0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795]),t}e_.prototype.createStream=function(t,e){return new Dh(t,e,this._streamCipher)},e_.prototype.decryptString=function(t){t=v(t,!1,!0);return vs(this._stringCipher._decryptBlock(t,!0))},e_.prototype.encryptString=function(t){if(this._stringCipher instanceof Zc){var e=16-t.length%16,i=(t+=String.fromCharCode(e).repeat(e),new Uint8Array(16));if("undefined"!=typeof crypto&&null!==crypto)crypto.getRandomValues(i);else for(var n=0;n<16;n++)i[n]=Math.floor(256*Math.random());var e=this._stringCipher._encrypt(v(t,!1,!0),i),r=new Uint8Array(16+e.length);return r.set(i),r.set(e,16),vs(r)}return vs(this._stringCipher._encrypt(v(t,!1,!0)))};var t_=e_;function e_(t,e){this._stringCipher=t,this._streamCipher=e}n_.prototype._beToUint32=function(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0},n_.prototype._uint32ToBe=function(t,e,i){e[i]=t>>>24&255,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=255&t},n_.prototype._generateWorkingKey=function(t,e){for(var i=new Array(32).fill(0),n=new Array(56).fill(!1),r=new Array(56).fill(!1),s=0;s<56;s++){var a=this._pc1[s];n[s]=0!=(e[a>>3]&this._byteBit[7&a])}for(var o=0;o<16;o++){for(var h=t?o<<1:15-o<<1,c=1+h,s=i[h]=i[c]=0;s<28;s++){var _=s+this._rotationTable[o];r[s]=_<28?n[_]:n[_-28]}for(s=28;s<56;s++){_=s+this._rotationTable[o];r[s]=_<56?n[_]:n[_-28]}for(s=0;s<24;s++)r[this._pc2[s]]&&(i[h]|=this._bigByte[s]),r[this._pc2[s+24]]&&(i[c]|=this._bigByte[s])}for(o=0;32!==o;o+=2){var d=i[o],l=i[o+1];i[o]=(16515072&d)<<6|(4032&d)<<10|(16515072&l)>>>10|(4032&l)>>>6,i[o+1]=(258048&d)<<12|(63&d)<<16|(258048&l)>>>4|63&l}return i},n_.prototype._processBlock=function(t,e,i,n){var r=this._beToUint32(t,e)>>>0,s=this._beToUint32(t,e+4)>>>0,s=((s=(s=(s=(s^=h=252645135&(r>>>4^s))^(h=65535&((r^=h<<4)>>>16^s)))^(h=858993459&(s>>>2^(r^=h<<16)))<<2)^(h=16711935&(s>>>8^(r^=h)))<<8)<<1|s>>>31)>>>0;s^=h=2863311530&((r^=h)^s);for(var r=((r^=h)<<1|r>>>31)>>>0,a=0;a<8;a++){h=(s<<28|s>>>4)>>>0,h^=this._keys[4*a+0];var o=this._sp7[63&h]|this._sp5[h>>>8&63]|this._sp3[h>>>16&63]|this._sp1[h>>>24&63],h=(s^this._keys[4*a+1])>>>0;h=((r^=o|=this._sp8[63&h]|this._sp6[h>>>8&63]|this._sp4[h>>>16&63]|this._sp2[h>>>24&63])<<28|r>>>4)>>>0,h^=this._keys[4*a+2],o=this._sp7[63&h]|this._sp5[h>>>8&63]|this._sp3[h>>>16&63]|this._sp1[h>>>24&63],h=(r^this._keys[4*a+3])>>>0,s^=o|=this._sp8[63&h]|this._sp6[h>>>8&63]|this._sp4[h>>>16&63]|this._sp2[h>>>24&63]}r=((r^=h=2863311530&(r^(s=(s<<31|s>>>1)>>>0)))<<31|r>>>1)>>>0,r=(r=(r=(r^=(h=16711935&(r>>>8^(s^=h)))<<8)^(h=858993459&(r>>>2^(s^=h)))<<2)^(h=65535&((s^=h)>>>16^r)))^(h=252645135&((s^=h<<16)>>>4^r)),this._uint32ToBe(s^=h<<4,i,n),this._uint32ToBe(r,i,n+4)};var i_=n_;function n_(t,e){void 0===e&&(e=!0),this.blockSize=8,this._byteBit=[128,64,32,16,8,4,2,1],this._bigByte=[8388608,4194304,2097152,1048576,524288,262144,131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1],this._sp1=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],this._sp2=[2148565024,2147516416,32768,1081376,1048576,32,2148532256,2147516448,2147483680,2148565024,2148564992,2147483648,2147516416,1048576,32,2148532256,1081344,1048608,2147516448,0,2147483648,32768,1081376,2148532224,1048608,2147483680,0,1081344,32800,2148564992,2148532224,32800,0,1081376,2148532256,1048576,2147516448,2148532224,2148564992,32768,2148532224,2147516416,32,2148565024,1081376,32,32768,2147483648,32800,2148564992,1048576,2147483680,1048608,2147516448,2147483680,1048608,1081344,0,2147516416,32800,2147483648,2148532256,2148565024,1081344],this._sp3=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],this._sp4=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],this._sp5=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],this._sp6=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],this._sp7=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],this._sp8=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696],this._pc1=[56,48,40,32,24,16,8,0,57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,60,52,44,36,28,20,12,4,27,19,11,3],this._rotationTable=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],this._pc2=[13,16,10,23,0,4,2,27,14,5,20,9,22,18,11,3,25,7,15,6,26,19,12,1,40,51,30,36,46,54,29,39,50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31],this._keys=[],this._keys=this._generateWorkingKey(e,t)}var r_="EOF",s_=[1,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,2,0,0,2,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a_=(o_.prototype.nextChar=function(){return this.currentChar=this.stream.getByte()},o_.prototype.peekChar=function(){return this.stream.peekByte()},o_.prototype.getNumber=function(){var t=!1,e=0,i=0;if(45===(a=this.currentChar)?(i=-1,45===(a=this.nextChar())&&(a=this.nextChar())):43===a&&(i=1,a=this.nextChar()),10===a||13===a)for(;10===(a=this.nextChar())||13===a;);if(46===a&&(e=10,a=this.nextChar()),a<48||57<a){if(ks(a)||-1===a){if(10===e&&0===i)return 0;if(0===e&&-1===i)return 0}throw new S("Invalid number: "+String.fromCharCode(a)+" (charCode "+a+")")}for(var i=i||1,n=a-48,r=0,s=1,a=this.nextChar();0<=a;){if(48<=a&&a<=57){var o=a-48;t?r=10*r+o:(0!==e&&(e*=10),n=10*n+o)}else if(46===a){if(0!==e)break;e=1}else{if(45===a){a=this.nextChar();continue}if(69!==a&&101!==a)break;if(43===(a=this.peekChar())||45===a)s=45===a?-1:1,this.nextChar();else if(a<48||57<a)break;t=!0}a=this.nextChar()}return 0!==e&&(n/=e),t&&(n*=Math.pow(10,s*r)),i*n},o_.prototype.getString=function(){for(var t=1,e=!1,i=this.stringBuffer,n=(i.length=0,this.nextChar());;){var r=!1;switch(0|n){case-1:e=!0;break;case 40:++t,i.push("(");break;case 41:0==--t?(this.nextChar(),e=!0):i.push(")");break;case 92:switch(n=this.nextChar()){case-1:e=!0;break;case 110:i.push("\n");break;case 114:i.push("\r");break;case 116:i.push("\t");break;case 98:i.push("\b");break;case 102:i.push("\f");break;case 92:case 40:case 41:i.push(String.fromCharCode(n));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:var s=15&n,r=!0;48<=(n=this.nextChar())&&n<=55&&(s=(s<<3)+(15&n),48<=(n=this.nextChar()))&&n<=55&&(r=!1,s=(s<<3)+(15&n)),i.push(String.fromCharCode(s));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:i.push(String.fromCharCode(n))}break;default:i.push(String.fromCharCode(n))}if(e)break;r||(n=this.nextChar())}return i.join("")},o_.prototype.getName=function(){var t=this.stringBuffer,e=(t.length=0,["Root","T","V"]);for(r=this.nextChar();0<=r;){if(!this._isFormsDataFormat||32!==r||0<=e.indexOf(t.join(""))||this._isAnnotationImport){if(s_[r])break;if(35===r){if(r=this.nextChar(),s_[r]){t.push("#");break}var i=this._toHexDigit(r);if(-1!==i){var n=r,r=this.nextChar(),s=this._toHexDigit(r);if(-1===s){if(t.push("#",String.fromCharCode(n)),s_[r])break;t.push(String.fromCharCode(r)),r=this.nextChar();continue}t.push(String.fromCharCode(i<<4|s))}else t.push("#",String.fromCharCode(r))}else t.push(String.fromCharCode(r))}else{n=this.peekChar();s_[n]||t.push(String.fromCharCode(r))}r=this.nextChar()}return R.get(t.join(""))},o_.prototype.getHexString=function(){var t,e,i=this.stringBuffer,n=(i.length=0,this.currentChar),r=!0;for(this._hexStringNumber=0;;){if(n<0)break;if(62===n){this.nextChar();break}if(1!==s_[n]){if(r){if(-1===(t=this._toHexDigit(n))){n=this.nextChar();continue}}else{if(-1===(e=this._toHexDigit(n))){n=this.nextChar();continue}i.push(String.fromCharCode(t<<4|e))}r=!r}n=this.nextChar()}return i.join("")},o_.prototype.getObject=function(){for(var t=!1,e=this.currentChar;;){if(e<0)return r_;if(t){if(10!==e&&13!==e||(t=!1),92===e)break}else if(37===e)t=!0;else if(92===e){var i=this.peekChar();if(114===i||110===i)break}else if(1!==s_[e])break;e=this.nextChar()}switch(0|e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:return this.nextChar(),nh.get("[");case 93:return this.nextChar(),nh.get("]");case 60:return 60===(e=this.nextChar())?(this.nextChar(),nh.get("<<")):this.getHexString();case 62:return 62===(e=this.nextChar())?(this.nextChar(),nh.get(">>")):nh.get(">");case 123:return this.nextChar(),nh.get("{");case 125:return this.nextChar(),nh.get("}");case 41:throw this.nextChar(),new S("Illegal character: "+e)}var n=String.fromCharCode(e);if(e<32||127<e){var r=this.peekChar();if(32<=r&&r<=127)return this.nextChar(),nh.get(n)}for(e=this.nextChar();0<=e&&!s_[e];){var s=n+String.fromCharCode(e);if(!this._isFormsDataFormat&&128===n.length)throw new S("Command token too long: "+n.length);n=s,e=this.nextChar()}return"true"===n||"false"!==n&&("null"===n?null:("BI"===n&&(this.beginInlineImagePosition=this.stream.position),nh.get(n)))},o_.prototype.peekObj=function(){var t,e=this.stream.position,i=this.currentChar,n=this.beginInlineImagePosition;try{t=this.getObject()}catch(t){}return this.stream.position=e,this.currentChar=i,this.beginInlineImagePosition=n,t},o_.prototype.skipToNextLine=function(){for(var t=this.currentChar;0<=t;){if(13===t){10===(t=this.nextChar())&&this.nextChar();break}if(10===t){this.nextChar();break}t=this.nextChar()}},o_.prototype._toHexDigit=function(t){return 48<=t&&t<=57?15&t:65<=t&&t<=70||97<=t&&t<=102?9+(15&t):-1},o_);function o_(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1),this.stream=t,this.nextChar(),this.stringBuffer=[],this._hexStringNumber=0,this.beginInlineImagePosition=-1,this._isFormsDataFormat=e,this._isAnnotationImport=i}c_.prototype.refill=function(){this.first=this.lexicalOperator.getObject(),this.second=this.lexicalOperator.getObject()},c_.prototype.shift=function(){this.second instanceof nh&&"ID"===this.second.command?(this.first=this.second,this.second=null):(this.first=this.second,this.second=this.lexicalOperator.getObject())},c_.prototype.tryShift=function(){try{return this.shift(),!0}catch(t){return!1}},c_.prototype.getObject=function(t,e,i){var n,r,s=this.first;if(this.shift(),s instanceof nh)switch(s.command){case"BI":return"number"==typeof t&&"number"==typeof e?this.makeInlineImage(t,e,i):t instanceof t_?this.makeInlineImage(t):this.makeInlineImage();case"[":for(var a=[];!gh(this.first,"]")&&this.first!==r_;){var o=void 0,o="number"==typeof t&&"number"==typeof e?(n=this._encryptor._createCipherTransform(t,e),this.getObject(t,e,i)):t instanceof t_?this.getObject(n=t):this.getObject(t);0===a.length&&fh(o,"Indexed")&&(this._isColorSpace=!0),o=so(o,this._isColorSpace,this._isPassword),a.push(o)}if(this.first!==r_)return this._isColorSpace=!1,this.shift(),a;if(this.recoveryMode)return a;throw new Ua("End of file inside array.");case"<<":for(var h=new D(this.xref);!gh(this.first,">>")&&this.first!==r_;)if(this.first instanceof R){var c=this.first.name;if("U"!==c&&"O"!==c&&"ID"!==c||(this._isPassword=!0),this.shift(),this._checkEnd()||gh(this.first,">>")&&gh(this.second,"stream"))break;"number"==typeof t&&"number"==typeof e&&(n=this._encryptor._createCipherTransform(t,e));var _,d=void 0;(d=so(d="number"==typeof t&&"number"==typeof e?this.getObject(t,e,i):t instanceof t_?this.getObject(t):this.getObject(),this._isColorSpace,this._isPassword))&&d instanceof R&&(_=d.name).includes("#20")&&(d.name=_.replace(/#20/g," ")),this._isPassword=!1,h.set(c,d)}else this.shift();if(this.first!==r_)return gh(this.second,"stream")?!0===this.allowStreams?(t instanceof t_?n=t:i&&"number"==typeof e&&(n=this._encryptor._createCipherTransform(t,e)),"boolean"==typeof e&&e?this.makeStream(h,n,e):this.makeStream(h,n)):h:(this.shift(),h);if(this.recoveryMode)return h;throw new Ua("End of file inside dictionary.");default:return s}return Number.isInteger(s)?Number.isInteger(this.first)&&gh(this.second,"R")?(r=m.get(s,this.first),this.shift(),this.shift(),r):s:"string"==typeof s&&(t instanceof t_?n=t:"number"==typeof t&&"number"==typeof e&&(n=this._encryptor._createCipherTransform(t,e)),n)?n.decryptString(s):s},c_.prototype.findDiscreteDecodeInlineStreamEnd=function(t){for(var e,i=t.position,n=!1,r=t.getByte();-1!==r;){if(255!==r);else{switch(t.getByte()){case 0:break;case 255:t.skip(-1);break;case 217:n=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:2<(e=t.getUnsignedInteger16())?t.skip(e-2):t.skip(-2)}if(n)break}r=t.getByte()}i=t.position-i;return-1===r?(t.skip(-i),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),i)},c_.prototype.findDecodeInlineStreamEnd=function(t){for(var e=t.position;-1!==(n=t.getByte());)if(126===n){for(var i=t.position,n=t.peekByte();ks(n);)t.skip(),n=t.peekByte();if(62===n){t.skip();break}if(t.position>i){i=t.peekBytes(2);if(69===i[0]&&73===i[1])break}}e=t.position-e;return-1===n?(t.skip(-e),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),e)},c_.prototype.findHexDecodeInlineStreamEnd=function(t){for(var e=t.position,i=t.getByte();-1!==i&&62!==i;)i=t.getByte();e=t.position-e;return-1===i?(t.skip(-e),this.findDefaultInlineStreamEnd(t)):(this.inlineStreamSkipEI(t),e)},c_.prototype.inlineStreamSkipEI=function(t){for(var e=0,i=t.getByte();-1!==i;){if(0===e)e=69===i?1:0;else if(1===e)e=73===i?2:0;else if(2===e)break;i=t.getByte()}},c_.prototype.makeInlineImage=function(t,e,i){var n,r=this.lexicalOperator,s=r.stream,a=new D(this.xref);for(i&&(n=t instanceof t_?t:this._encryptor._createCipherTransform(t,e));!gh(this.first,"ID")&&this.first!==r_;){if(!(this.first instanceof R))throw new S("Dictionary key must be a name object");var o=this.first.name;if(this.shift(),this.first.name===r_)break;t instanceof t_?a.set(o,this.getObject(t)):a.set(o,this.getObject(t,e,i))}-1!==r.beginInlineImagePosition&&(l=s.position-r.beginInlineImagePosition);var h,c=a.get("F","Filter"),c=(c instanceof R?_=c.name:Array.isArray(c)&&(c=null!=(c=c[0])&&c instanceof m?this.xref._fetch(c):c)&&(_=c.name),s.position);switch(_){case"DCT":case"DCTDecode":h=this.findDiscreteDecodeInlineStreamEnd(s);break;case"A85":case"ASCII85Decode":h=this.findDecodeInlineStreamEnd(s);break;case"AHx":case"ASCIIHexDecode":h=this.findHexDecodeInlineStreamEnd(s);break;default:h=this.findDefaultInlineStreamEnd(s)}var _=s.makeSubStream(c,h,a);if(h<1e3&&l<5552){var c=_.getBytes(),d=(_.reset(),s.position),r=(s.position=r.beginInlineImagePosition,s.getBytes(l)),l=(s.position=d,d=this._computeMaxNumber(c)+"_"+this._computeMaxNumber(r),this.imageCache.get(d));if(void 0!==l)return this.second=nh.get("EI"),this.shift(),l.reset(),l}return n&&(_=n.createStream(_,h)),(_=this.filter(_,a,h)).dictionary=a,void 0!==d&&this.imageCache.set(d,_),this.second=nh.get("EI"),this.shift(),_},c_.prototype._computeMaxNumber=function(t){for(var e=t.length,i=1,n=0,r=0;r<e;++r)n+=i+=255&t[r];return n%65521<<16|i%65521},c_.prototype.makeStream=function(t,e,i){void 0===i&&(i=!1);var n=this.lexicalOperator,r=n.stream,s=(n.skipToNextLine(),r.position-1),a=t.get("Length");if(Number.isInteger(a)||(a=0),r.position=s+a,n.nextChar(),!this.tryShift()||!gh(this.second,"endstream")){var o=new Uint8Array([101,110,100,115,116,114,101,97,109]),h=this._findStreamLength(s,o);if(h<0){var c=o.length-1,o=o.slice(0,c),o=this._findStreamLength(s,o);if((h=0<=o&&ks(r.peekBytes(1+c)[c])?o:h)<0)throw new S("Missing endstream command.")}a=h,n.nextChar(),this.shift()}return this.shift(),this.shift(),r=r.makeSubStream(s,a,t),i||(e&&(r=e.createStream(r,a)),r=this.filter(r,t,a)),r.dictionary=t,r},c_.prototype.filter=function(i,t,e){var n=this,r=t.get("F","Filter"),s=t.get("DP","DecodeParms");if(r instanceof R)return this.makeFilter(i,r.name,e,s);if(Array.isArray(r)&&!this._isImageExtraction){t=r[0];if(t instanceof R)return this.makeFilter(i,t.name,e,s);if(t instanceof nh)return this.makeFilter(i,t.command,e,s)}var a,o=e;return Array.isArray(r)&&(a=s,r.forEach(function(t,e){if(!((r=t instanceof m?n.xref._fetch(t):t)instanceof R||r instanceof nh))throw new S("Bad filter name '"+r+"'");s=null,Array.isArray(a)&&null!=e&&e in a&&(t=a[e],s=t instanceof m?n.xref._fetch(t):t),r instanceof R?i=n.makeFilter(i,r.name,o,s):r instanceof nh&&(i=n.makeFilter(i,r.command,o,s)),o=null})),i},c_.prototype.makeFilter=function(t,e,i,n){if(0===i)return new Ah;var r=1;try{if("Fl"===e||"FlateDecode"===e)return n?new Xh(new Uh(t,i),i,n):new Uh(t,i);if(!this._isImageExtraction)return t;switch(e){case"LZW":case"LZWDecode":return n?(n.has("EarlyChange")&&(r=n.get("EarlyChange")),new Xh(new ic(t,i,r),i,n)):new ic(t,i,r);case"DCT":case"DCTDecode":return new Zh(t,i,n);case"JPX":case"JPXDecode":return new ac(t,i,n);case"A85":case"ASCII85Decode":return new _c(t,i);case"AHx":case"ASCIIHexDecode":return new pc(t,i);case"CCF":case"CCITTFaxDecode":return new wc(t,i,n);case"RL":case"RunLengthDecode":return new xc(t,i);case"JBIG2Decode":return new Kc(t,i,n);default:return t}}catch(t){return new Ah}},c_.prototype._findStreamLength=function(t,e){for(var i=this.lexicalOperator.stream,n=(i.position=t,e.length);i.position<i.end;){var r=i.peekBytes(2048),s=r.length-n;if(s<=0)break;for(var a=0;a<s;){for(var o=0;o<n&&r[a+o]===e[o];)o++;if(n<=o)return i.position+=a,i.position-t;a++}i.position+=s}return-1},c_.prototype.findDefaultInlineStreamEnd=function(t){for(var e=t.position,i=0,n=t.getByte();-1!==n;){if(0===i)i=69===n?1:0;else if(1===i)i=73===n?2:0;else{if(2!==i)throw new Error("findDefaultInlineStreamEnd - invalid state.");if(32===n||10===n||13===n){for(var r=t.position,s=t.peekBytes(10),a=0,o=s.length;a<o;a++)if((0!==(n=s[a])||0===s[a+1])&&10!==n&&13!==n&&(n<32||127<n)){i=0;break}if(2!==i){n=t.getByte();continue}if(2===i)break}else i=0}n=t.getByte()}-1===n&&void 0!==r&&t.skip(-(t.position-r));var h=4;return t.skip(-h),n=t.peekByte(),t.skip(h),ks(n)||h--,t.position-h-e},c_.prototype._checkEnd=function(){return this.first===r_};var h_=c_;function c_(t,e,i,n,r){void 0===i&&(i=!1),void 0===n&&(n=!1),this._isColorSpace=!1,this._isPassword=!1,this._isImageExtraction=!1,this.lexicalOperator=t,this.xref=e,this.allowStreams=i,this.recoveryMode=n,this.imageCache=new Map,this._encryptor=r,this.refill()}d_.prototype.getInt=function(t,e,i){void 0===i&&(i=!1);t=t.get(e);if(void 0!==t&&Number.isInteger(t)&&(i?0<=t:0<t))return t;throw new Error("The '"+e+"' parameter in the linearization dictionary is invalid.")},d_.prototype.getHints=function(t){var e=t.getArray("H"),i=e.length;if(!e||2!==i&&4!==i)throw new Error("Hint array in the linearization dictionary is invalid.");for(var n=0;n<i;n++){var r=e[n];if(!(Number.isInteger(r)&&0<r))throw new Error("Hint ("+n+") in the linearization dictionary is invalid.")}return e};var __=d_;function d_(t){this.isValid=!1;var e=new h_(new a_(t),null),i=e.getObject(),n=e.getObject(),r=e.getObject(),e=e.getObject();if(this.isValid=Number.isInteger(i)&&Number.isInteger(n)&&gh(r,"obj")&&void 0!==e,this.isValid&&(i=e.get("Linearized"),this.isValid=void 0!==i&&0<i),this.isValid){n=this.getInt(e,"L");if(n!==t.length)throw new Error("The L parameter in the linearization dictionary does not equal the stream length.");this.length=n,this.hints=this.getHints(e),this.objectNumberFirst=this.getInt(e,"O"),this.endFirst=this.getInt(e,"E"),this.pageCount=this.getInt(e,"N"),this.mainXRefEntriesOffset=this.getInt(e,"T"),this.pageFirst=e.has("P")?this.getInt(e,"P",!0):0}}u_.prototype.hash=function(t,e,i){for(var n=1732584193,r=-271733879,s=-1732584194,a=271733878,o=i+72&-64,h=new Uint8Array(o),c=0,_=0;c<i;++c)h[c]=t[e++];h[c++]=128;for(var d=o-8;c<d;)h[c++]=0;h[c++]=i<<3&255,h[c++]=i>>5&255,h[c++]=i>>13&255,h[c++]=i>>21&255,h[c++]=i>>>29&255,h[c++]=0,h[c++]=0,h[c++]=0;for(var l=new Int32Array(16),c=0;c<o;){for(_=0;_<16;++_,c+=4)l[_]=h[c]|h[c+1]<<8|h[c+2]<<16|h[c+3]<<24;for(var u=n,p=r,f=s,g=a,y=void 0,m=void 0,_=0;_<64;++_)var m=_<16?(y=p&f|~p&g,_):_<32?(y=g&p|~g&f,5*_+1&15):_<48?(y=p^f^g,3*_+5&15):(y=f^(p|~g),7*_&15),b=g,w=u+y+this._k[_]+l[m]|0,v=this._r[_],g=f,f=p,p=p+(w<<v|w>>>32-v)|0,u=b;n=n+u|0,r=r+p|0,s=s+f|0,a=a+g|0}return new Uint8Array([255&n,n>>8&255,n>>16&255,n>>>24&255,255&r,r>>8&255,r>>16&255,r>>>24&255,255&s,s>>8&255,s>>16&255,s>>>24&255,255&a,a>>8&255,a>>16&255,a>>>24&255])};var l_=u_;function u_(){this._r=new Uint8Array([7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21]),this._k=new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-701558691,38016083,-660478335,-405537848,568446438,-1019803690,-187363961,1163531501,-1444681467,-51403784,1735328473,-1926607734,-378558,-2022574463,1839030562,-35309556,-1530992060,1272893353,-155497632,-1094730640,681279174,-358537222,-722521979,76029189,-640364487,-421815835,530742520,-995338651,-198630844,1126891415,-1416354905,-57434055,1700485571,-1894986606,-1051523,-2054922799,1873313359,-30611744,-1560198380,1309151649,-145523070,-1120210379,718787259,-343485551])}p_=function(t,e){return(p_=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var p_,f_,Mh=function(t,e){function i(){this.constructor=t}p_(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},g_=(Mh(y_,f_=Zc),y_.prototype._expandKey=function(t){var e=this._s,i=this._key,n=new Uint8Array(176);n.set(t);for(var r=16,s=1;r<176;++s){var a=n[r-3],o=n[r-2],h=n[r-1],c=n[r-4],a=e[a],o=e[o],h=e[h],c=e[c];a^=i[s];for(var _=0;_<4;++_)n[r]=a^=n[r-16],n[r+1]=o^=n[r-15],n[r+2]=h^=n[r-14],n[r+3]=c^=n[r-13],r+=4}return n},y_);function y_(t){var e=f_.call(this)||this;return e._cyclesOfRepetition=10,e._keySize=160,e._key=new Uint8Array([141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141,1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145,57,114,228,211,189,97,194,159,37,74,148,51,102,204,131,29,58,116,232,203,141]),e._key=e._expandKey(t),e}Mh(w_,m_=Zc),w_.prototype._expandKey=function(t){for(var e,i,n,r,s=this._s,a=new Uint8Array(240),o=(a.set(t),1),h=32;h<240;){h%32==16?(e=s[e],i=s[i],n=s[n],r=s[r]):h%32==0&&(e=a[h-3],i=a[h-2],n=a[h-1],r=a[h-4],e=s[e],i=s[i],n=s[n],r=s[r],e^=o,256<=(o<<=1))&&(o=255&(27^o));for(var c=0;c<4;++c)a[h]=e^=a[h-32],a[h+1]=i^=a[h-31],a[h+2]=n^=a[h-30],a[h+3]=r^=a[h-29],h+=4}return a};var m_,b_=w_;function w_(t){var e=m_.call(this)||this;return e._cyclesOfRepetition=14,e._keySize=224,e._key=e._expandKey(t),e}S_.prototype._add=function(t){this._events.push(t),this._result=t.bytes},S_.prototype._setResult=function(t){this._result=t,this._events=[{bytes:t}]},S_.prototype._getResult=function(){return 0<this._events.length?this._events[this._events.length-1].bytes:this._result};var v_=S_;function S_(){this._events=[]}x_.prototype._add=function(t){if(this._closed)throw new Error("Cannot add data to closed hash input");for(var e=0;e<t.length;e++)this._buffer.push(t[e])},x_.prototype._close=function(){var t;this._closed||(this._closed=!0,0<this._buffer.length&&(t=new Uint8Array(this._buffer),t=this._hasher._hash(t,0,t.length),this._outputSink._add({bytes:t})))};var P_=x_;function x_(t,e){this._buffer=[],this._closed=!1,this._hasher=t,this._outputSink=e}T_.prototype._getEncoded=function(){var t=this._encodeObjectIdentifier(this._oid),e=new Uint8Array([5,0]),i=t.length+e.length,n=[];return n.push(48),n.push(i),n.push.apply(n,Array.from(t)),n.push.apply(n,Array.from(e)),new Uint8Array(n)},T_.prototype._encodeObjectIdentifier=function(t){var e=t.split(".").map(Number),i=[];i.push(40*e[0]+e[1]);for(var n=2;n<e.length;n++){var r=e[n];if(r<128)i.push(r);else{for(var s=[];0<r;)s.unshift(127&r),r=Math.floor(r/128);for(var a=0;a<s.length-1;a++)s[a]|=128;i.push.apply(i,s)}}t=[];return t.push(6),t.push(i.length),t.push.apply(t,i),new Uint8Array(t)};var A_=T_;function T_(t){this._oid=t}k_.prototype._startChunkedConversion=function(t){return new P_(this,t)},k_.prototype._rotateRight=function(t,e){return t>>>e|t<<32-e},k_.prototype._sigma=function(t){return this._rotateRight(t,2)^this._rotateRight(t,13)^this._rotateRight(t,22)},k_.prototype._sigmaPrime=function(t){return this._rotateRight(t,6)^this._rotateRight(t,11)^this._rotateRight(t,25)},k_.prototype._littleSigma=function(t){return this._rotateRight(t,7)^this._rotateRight(t,18)^t>>>3},k_.prototype._littleSigmaPrime=function(t){return this._rotateRight(t,17)^this._rotateRight(t,19)^t>>>10},k_.prototype._hash=function(t,e,i){for(var n=1779033703,r=3144134277,s=1013904242,a=2773480762,o=1359893119,h=2600822924,c=528734635,_=1541459225,d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],l=64*Math.ceil((i+9)/64),u=new Uint8Array(l),p=0;p<i;++p)u[p]=t[e++];u[p++]=128;for(var f=l-8;p<f;)u[p++]=0;u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=i>>>29&255,u[p++]=i>>21&255,u[p++]=i>>13&255,u[p++]=i>>5&255,u[p++]=i<<3&255;for(var g=new Uint32Array(64),p=0;p<l;){for(C=0;C<16;++C)g[C]=u[p]<<24|u[p+1]<<16|u[p+2]<<8|u[p+3],p+=4;for(C=16;C<64;++C)g[C]=this._littleSigmaPrime(g[C-2])+g[C-7]+this._littleSigma(g[C-15])+g[C-16]|0;for(var y,m,b=n,w=r,v=s,S=a,P=o,x=h,A=c,T=_,C=0;C<64;++C)y=T+this._sigmaPrime(P)+(P&x^~P&A)+d[C]+g[C],m=this._sigma(b)+(b&w^b&v^w&v),T=A,A=x,x=P,P=S+y|0,S=v,v=w,w=b,b=y+m|0;n=n+b|0,r=r+w|0,s=s+v|0,a=a+S|0,o=o+P|0,h=h+x|0,c=c+A|0,_=_+T|0}return new Uint8Array([n>>24&255,n>>16&255,n>>8&255,255&n,r>>24&255,r>>16&255,r>>8&255,255&r,s>>24&255,s>>16&255,s>>8&255,255&s,a>>24&255,a>>16&255,a>>8&255,255&a,o>>24&255,o>>16&255,o>>8&255,255&o,h>>24&255,h>>16&255,h>>8&255,255&h,c>>24&255,c>>16&255,c>>8&255,255&c,_>>24&255,_>>16&255,_>>8&255,255&_])};var C_=k_;function k_(){}F_.prototype._startChunkedConversion=function(t){return new P_(this,t)},F_.prototype._sigma=function(t,e,i){t.assign(e),t.rotateRight(28),i.assign(e),i.rotateRight(34),t.xor(i),i.assign(e),i.rotateRight(39),t.xor(i)},F_.prototype._sigmaPrime=function(t,e,i){t.assign(e),t.rotateRight(14),i.assign(e),i.rotateRight(18),t.xor(i),i.assign(e),i.rotateRight(41),t.xor(i)},F_.prototype._littleSigma=function(t,e,i){t.assign(e),t.rotateRight(1),i.assign(e),i.rotateRight(8),t.xor(i),i.assign(e),i.shiftRight(7),t.xor(i)},F_.prototype._littleSigmaPrime=function(t,e,i){t.assign(e),t.rotateRight(19),i.assign(e),i.rotateRight(61),t.xor(i),i.assign(e),i.shiftRight(6),t.xor(i)},F_.prototype._hash=function(t,e,i,n){d=(n=void 0===n?!1:n)?(r=new B(3418070365,3238371032),s=new B(1654270250,914150663),a=new B(2438529370,812702999),o=new B(355462360,4144912697),h=new B(1731405415,4290775857),c=new B(2394180231,1750603025),_=new B(3675008525,1694076839),new B(1203062813,3204075428)):(r=new B(1779033703,4089235720),s=new B(3144134277,2227873595),a=new B(1013904242,4271175723),o=new B(2773480762,1595750129),h=new B(1359893119,2917565137),c=new B(2600822924,725511199),_=new B(528734635,4215389547),new B(1541459225,327033209));for(var r,s,a,o,h,c,_,d,l=128*Math.ceil((i+17)/128),u=new Uint8Array(l),p=0;p<i;++p)u[p]=t[e++];u[p++]=128;for(var f=l-16;p<f;)u[p++]=0;u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=0,u[p++]=i>>>29&255,u[p++]=i>>21&255,u[p++]=i>>13&255,u[p++]=i>>5&255,u[p++]=i<<3&255;var g=new Array(80);for(p=0;p<80;p++)g[p]=new B(0,0);var y,m,b=new B(0,0),w=new B(0,0),v=new B(0,0),S=new B(0,0),P=new B(0,0),x=new B(0,0),A=new B(0,0),T=new B(0,0),C=new B(0,0),k=new B(0,0),R=new B(0,0),F=new B(0,0);for(p=0;p<l;){for(var I=void 0,I=0;I<16;++I)g[I].high=u[p]<<24|u[p+1]<<16|u[p+2]<<8|u[p+3],g[I].low=u[p+4]<<24|u[p+5]<<16|u[p+6]<<8|u[p+7],p+=8;for(I=16;I<80;++I)y=g[I],this._littleSigmaPrime(y,g[I-2],F),y.add(g[I-7]),this._littleSigma(R,g[I-15],F),y.add(R),y.add(g[I-16]);for(b.assign(r),w.assign(s),v.assign(a),S.assign(o),P.assign(h),x.assign(c),A.assign(_),T.assign(d),I=0;I<80;++I)C.assign(T),this._sigmaPrime(R,P,F),C.add(R),R.assign(P),R.and(x),F.assign(P),F.not(),F.and(A),R.xor(F),C.add(R),C.add(this._k[I]),C.add(g[I]),this._sigma(k,b,F),R.assign(b),R.and(w),F.assign(b),F.and(v),R.xor(F),F.assign(w),F.and(v),R.xor(F),k.add(R),y=T,T=A,A=x,x=P,S.add(C),P=S,S=v,v=w,w=b,y.assign(C),y.add(k),b=y;r.add(b),s.add(w),a.add(v),o.add(S),h.add(P),c.add(x),_.add(A),d.add(T)}return n?(m=new Uint8Array(48),r.copyTo(m,0),s.copyTo(m,8),a.copyTo(m,16),o.copyTo(m,24),h.copyTo(m,32),c.copyTo(m,40)):(m=new Uint8Array(64),r.copyTo(m,0),s.copyTo(m,8),a.copyTo(m,16),o.copyTo(m,24),h.copyTo(m,32),c.copyTo(m,40),_.copyTo(m,48),d.copyTo(m,56)),m};var R_=F_;function F_(){this._k=[new B(1116352408,3609767458),new B(1899447441,602891725),new B(3049323471,3964484399),new B(3921009573,2173295548),new B(961987163,4081628472),new B(1508970993,3053834265),new B(2453635748,2937671579),new B(2870763221,3664609560),new B(3624381080,2734883394),new B(310598401,1164996542),new B(607225278,1323610764),new B(1426881987,3590304994),new B(1925078388,4068182383),new B(2162078206,991336113),new B(2614888103,633803317),new B(3248222580,3479774868),new B(3835390401,2666613458),new B(4022224774,944711139),new B(264347078,2341262773),new B(604807628,2007800933),new B(770255983,1495990901),new B(1249150122,1856431235),new B(1555081692,3175218132),new B(1996064986,2198950837),new B(2554220882,3999719339),new B(2821834349,766784016),new B(2952996808,2566594879),new B(3210313671,3203337956),new B(3336571891,1034457026),new B(3584528711,2466948901),new B(113926993,3758326383),new B(338241895,168717936),new B(666307205,1188179964),new B(773529912,1546045734),new B(1294757372,1522805485),new B(1396182291,2643833823),new B(1695183700,2343527390),new B(1986661051,1014477480),new B(2177026350,1206759142),new B(2456956037,344077627),new B(2730485921,1290863460),new B(2820302411,3158454273),new B(3259730800,3505952657),new B(3345764771,106217008),new B(3516065817,3606008344),new B(3600352804,1432725776),new B(4094571909,1467031594),new B(275423344,851169720),new B(430227734,3100823752),new B(506948616,1363258195),new B(659060556,3750685593),new B(883997877,3785050280),new B(958139571,3318307427),new B(1322822218,3812723403),new B(1537002063,2003034995),new B(1747873779,3602036899),new B(1955562222,1575990012),new B(2024104815,1125592928),new B(2227730452,2716904306),new B(2361852424,442776044),new B(2428436474,593698344),new B(2756734187,3733110249),new B(3204031479,2999351573),new B(3329325298,3815920427),new B(3391569614,3928383900),new B(3515267271,566280711),new B(3940187606,3454069534),new B(4118630271,4000239992),new B(116418474,1914138554),new B(174292421,2731055270),new B(289380356,3203993006),new B(460393269,320620315),new B(685471733,587496836),new B(852142971,1086792851),new B(1017036298,365543100),new B(1126000580,2618297676),new B(1288033470,3409855158),new B(1501505948,4234509866),new B(1607167915,987167468),new B(1816402316,1246189591)]}D_.prototype._startChunkedConversion=function(t){return new P_(this,t)},D_.prototype._hash=function(t,e,i){return(new R_)._hash(t,e,i,!0)};var I_=D_;function D_(){}B_=function(t,e){return(B_=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var B_,Mh=function(t,e){function i(){this.constructor=t}B_(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},L_=(Object.defineProperty(O_.prototype,"_sha256",{get:function(){return void 0!==this._sha256Obj&&null!==this._sha256Obj||(this._sha256Obj=new C_),this._sha256Obj},enumerable:!0,configurable:!0}),Object.defineProperty(O_.prototype,"_sha512",{get:function(){return void 0!==this._sha512Obj&&null!==this._sha512Obj||(this._sha512Obj=new R_),this._sha512Obj},enumerable:!0,configurable:!0}),O_);function O_(){}Mh(N_,M_=L_),N_.prototype._checkOwnerPassword=function(t,e,i,n){var r=new Uint8Array(t.length+56);return r.set(t,0),r.set(e,t.length),r.set(i,t.length+e.length),gs(this._sha256._hash(r,0,r.length),n)},N_.prototype._checkUserPassword=function(t,e,i){var n=new Uint8Array(t.length+8);return n.set(t,0),n.set(e,t.length),gs(this._sha256._hash(n,0,n.length),i)},N_.prototype._getOwnerKey=function(t,e,i,n){var r=new Uint8Array(t.length+56),i=(r.set(t,0),r.set(e,t.length),r.set(i,t.length+e.length),this._sha256._hash(r,0,r.length));return new b_(i)._decryptBlock(n,!1,new Uint8Array(16))},N_.prototype._getUserKey=function(t,e,i){var n=new Uint8Array(t.length+8),e=(n.set(t,0),n.set(e,t.length),this._sha256._hash(n,0,n.length));return new b_(e)._decryptBlock(i,!1,new Uint8Array(16))};var M_,E_=N_;function N_(){return null!==M_&&M_.apply(this,arguments)||this}Mh(z_,j_=L_),z_.prototype._checkOwnerPassword=function(t,e,i,n){var r=new Uint8Array(t.length+56);return r.set(t,0),r.set(e,t.length),r.set(i,t.length+e.length),gs(this._hash(t,r,i),n)},z_.prototype._checkUserPassword=function(t,e,i){var n=new Uint8Array(t.length+8);return n.set(t,0),n.set(e,t.length),gs(this._hash(t,n,new Uint8Array([])),i)},z_.prototype._getOwnerKey=function(t,e,i,n){var r=new Uint8Array(t.length+56),e=(r.set(t,0),r.set(e,t.length),r.set(i,t.length+e.length),this._hash(t,r,i));return new b_(e)._decryptBlock(n,!1,new Uint8Array(16))},z_.prototype._getUserKey=function(t,e,i){var n=new Uint8Array(t.length+8),e=(n.set(t,0),n.set(e,t.length),this._hash(t,n,new Uint8Array([])));return new b_(e)._decryptBlock(i,!1,new Uint8Array(16))},z_.prototype._hash=function(t,e,i){for(var n=this._sha256._hash(e,0,e.length).subarray(0,32),r=new Uint8Array([0]),s=0;s<64||r[r.length-1]>s-32;){for(var a=t.length+n.length+i.length,o=new Uint8Array(a),h=0,c=(o.set(t,0),h+=t.length,o.set(n,h),h+=n.length,o.set(i,h),new Uint8Array(64*a)),_=0,d=0;_<64;_++)c.set(o,d),d+=a;for(var r=new g_(n.subarray(0,16))._encrypt(c,n.subarray(16,32)),l=0,u=0;u<16;u++)l=((l=+l%3)+(r[u]>>>0)%3)%3;2===l?n=this._sha512._hash(r,0,r.length):1===l?n=this._sha512._hash(r,0,r.length,!0):0===l&&(n=this._sha256._hash(r,0,r.length)),s++}return n.subarray(0,32)};var j_,V_=z_;function z_(){return null!==j_&&j_.apply(this,arguments)||this}U_=function(t,e){return(U_=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var U_,H_,Mh=function(t,e){function i(){this.constructor=t}U_(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},W_=(Mh(q_,H_=Jc),q_.prototype._encryptBlock=function(t){for(var e=this._a,i=this._b,n=this._s,r=t.length,s=new Uint8Array(r),a=0;a<r;++a){var o=n[e=e+1&255],h=n[i=i+o&255];n[e]=h,n[i]=o,s[a]=t[a]^n[o+h&255]}return this._a=e,this._b=i,s},q_.prototype._decryptBlock=function(t){return this._encryptBlock(t)},q_.prototype._encrypt=function(t){return this._encryptBlock(t)},q_);function q_(t){for(var e=H_.call(this)||this,i=(e._a=0,e._b=0,new Uint8Array(256)),n=0;n<256;++n)i[n]=n;for(var r=t.length,n=0,s=0;n<256;++n){var a=i[n],s=s+a+t[n%r]&255;i[n]=i[s],i[s]=a}return e._s=i,e}Mh(X_,G_=Jc),X_.prototype._decryptBlock=function(t){return t},X_.prototype._encrypt=function(t){return t};var G_,K_=X_;function X_(){return null!==G_&&G_.apply(this,arguments)||this}Mh(Q_,J_=Jc),Q_.prototype._expandKey=function(t,e){var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],n=new Uint8Array(128),r=(n.set(t),t.length);if(r<128)for(var s=0,a=n[r-1];r<128;)a=255&i[a+n[s++]&255],n[r++]=a;var o=e+7>>3,h=255&i[n[128-o]&255>>(7&-e)];n[128-o]=h;for(var c=128-o-1;0<=c;c--)h=255&i[h^n[c+o]],n[c]=h;for(var _=new Uint16Array(64),c=0;c<64;c++)_[c]=n[2*c]+(n[2*c+1]<<8);return _},Q_.prototype._rotateLeft=function(t,e){return 65535&(t<<e|t>>>16-e)},Q_.prototype._rotateRight=function(t,e){return 65535&(t>>>e|t<<16-e)},Q_.prototype._encryptBlock=function(t){for(var e=new Uint16Array(4),i=0;i<4;i++)e[i]=t[2*i]+(t[2*i+1]<<8);for(var n=0,r=0;r<16;r++)e[0]=this._rotateLeft(e[0]+(e[1]&~e[3])+(e[2]&e[3])+this._expandedKey[n++]&65535,1),e[1]=this._rotateLeft(e[1]+(e[2]&~e[0])+(e[3]&e[0])+this._expandedKey[n++]&65535,2),e[2]=this._rotateLeft(e[2]+(e[3]&~e[1])+(e[0]&e[1])+this._expandedKey[n++]&65535,3),e[3]=this._rotateLeft(e[3]+(e[0]&~e[2])+(e[1]&e[2])+this._expandedKey[n++]&65535,5),4!==r&&10!==r||(e[0]=e[0]+this._expandedKey[63&e[3]]&65535,e[1]=e[1]+this._expandedKey[63&e[0]]&65535,e[2]=e[2]+this._expandedKey[63&e[1]]&65535,e[3]=e[3]+this._expandedKey[63&e[2]]&65535);for(var s=new Uint8Array(8),i=0;i<4;i++)s[2*i]=255&e[i],s[2*i+1]=e[i]>>>8;return s},Q_.prototype._decryptBlock=function(t){for(var e=new Uint16Array(4),i=0;i<4;i++)e[i]=t[2*i]+(t[2*i+1]<<8);for(var n=63,r=15;0<=r;r--)4!==r&&10!==r||(e[3]=e[3]-this._expandedKey[63&e[2]]&65535,e[2]=e[2]-this._expandedKey[63&e[1]]&65535,e[1]=e[1]-this._expandedKey[63&e[0]]&65535,e[0]=e[0]-this._expandedKey[63&e[3]]&65535),e[3]=this._rotateRight(e[3],5),e[3]=e[3]-(e[0]&~e[2])-(e[1]&e[2])-this._expandedKey[n--]&65535,e[2]=this._rotateRight(e[2],3),e[2]=e[2]-(e[3]&~e[1])-(e[0]&e[1])-this._expandedKey[n--]&65535,e[1]=this._rotateRight(e[1],2),e[1]=e[1]-(e[2]&~e[0])-(e[3]&e[0])-this._expandedKey[n--]&65535,e[0]=this._rotateRight(e[0],1),e[0]=e[0]-(e[1]&~e[3])-(e[2]&e[3])-this._expandedKey[n--]&65535;for(var s=new Uint8Array(8),i=0;i<4;i++)s[2*i]=255&e[i],s[2*i+1]=e[i]>>>8;return s},Q_.prototype._encrypt=function(t){for(var e=this._blockSize-t.length%this._blockSize,i=new Uint8Array(t.length+e),n=(i.set(t),i.fill(e,t.length),[]),r=0;r<i.length;r+=this._blockSize){var s=i.subarray(r,r+this._blockSize);n.push(this._encryptBlock(s))}for(var e=n.reduce(function(t,e){return t+e.length},0),a=new Uint8Array(e),o=0,h=0,c=n;h<c.length;h++){var _=c[h];a.set(_,o),o+=_.length}return a},Q_.prototype._decrypt=function(t,e){for(var i=[],n=e,r=0;r<t.length;r+=this._blockSize){for(var s=t.subarray(r,r+this._blockSize),a=this._decryptBlock(s),o=0;o<this._blockSize;o++)a[o]^=n[o];i.push(a),n=s}for(var e=i.reduce(function(t,e){return t+e.length},0),h=new Uint8Array(e),c=0,_=0,d=i;_<d.length;_++){var l=d[_];h.set(l,c),c+=l.length}var u=h[h.length-1];if(0<u&&u<=this._blockSize){for(var p=!0,r=h.length-u;r<h.length;r++)if(h[r]!==u){p=!1;break}if(p)return h.subarray(0,h.length-u)}return h};var J_,Y_=Q_;function Q_(t,e){void 0===e&&(e=64);var i=J_.call(this)||this;if(i._blockSize=8,i._effectiveKeyBits=64,!(t instanceof Uint8Array)||t.length<5||128<t.length)throw new Error("RC2 key must be between 5 and 128 bytes.");return i._key=t,i._effectiveKeyBits=e,i._expandedKey=i._expandKey(t,i._effectiveKeyBits),i}Object.defineProperty($_.prototype,"_md5",{get:function(){return void 0!==this._messageDigest&&null!==this._messageDigest||(this._messageDigest=new l_),this._messageDigest},enumerable:!0,configurable:!0}),$_.prototype._createEncryptionKey=function(t,e,i,n,r,s,a,o){return t?o._getUserKey(e,r,a):o._getOwnerKey(e,i,n,s)},$_.prototype._prepareKeyData=function(t,e,i,n,r,s,a,o){var h=new Uint8Array(40+i.length+t.length),c=0,_=0;if(e)for(f=Math.min(32,e.length);c<f;++c)h[c]=e[c];for(;c<32;)h[c++]=this._defaultPasswordBytes[_++];for(_=0,f=i.length;_<f;++_)h[c++]=i[_];for(h[c++]=255&r,h[c++]=r>>8&255,h[c++]=r>>16&255,h[c++]=r>>>24&255,_=0,f=t.length;_<f;++_)h[c++]=t[_];4<=s&&!o&&(h[c++]=255,h[c++]=255,h[c++]=255,h[c++]=255);var d=this._md5.hash(h,0,c),l=a>>3;if(3<=s)for(_=0;_<50;++_)d=this._md5.hash(d,0,l);var u=d.subarray(0,l);if(3<=s){for(c=0;c<32;++c)h[c]=this._defaultPasswordBytes[c];for(_=0,f=t.length;_<f;++_)h[c++]=t[_];for(var p=new W_(u)._encryptBlock(this._md5.hash(h,0,c)),f=u.length,g=new Uint8Array(f),_=1;_<=19;++_){for(var y=0;y<f;++y)g[y]=u[y]^_;p=new W_(g)._encryptBlock(p)}for(_=0,f=p.length;_<f;++_)if(n[_]!==p[_])return null}else for(_=0,f=(p=new W_(u)._encryptBlock(this._defaultPasswordBytes)).length;_<f;++_)if(n[_]!==p[_])return null;return u},$_.prototype._decodeUserPassword=function(t,e,i,n){for(var r=new Uint8Array(32),s=0,a=0,o=Math.min(32,t.length);s<o;++s)r[s]=t[s];for(;s<32;)r[s++]=this._defaultPasswordBytes[a++];var h=this._md5.hash(r,0,s),c=n>>3;if(3<=i)for(a=0;a<50;++a)h=this._md5.hash(h,0,h.length);if(3<=i)for(var _=e,d=new Uint8Array(c),a=19;0<=a;a--){for(var l=0;l<c;++l)d[l]=h[l]^a;_=new W_(d)._encryptBlock(_)}else _=new W_(h.subarray(0,c))._encryptBlock(e);return _},$_.prototype._createCipherTransform=function(t,e){var i,n;return 4===this._algorithm||5===this._algorithm?(n=this._buildCipherConstructor(this._cipherDictionary,this._string,t,e,this._encryptionKey),i=this._buildCipherConstructor(this._cipherDictionary,this._stream,t,e,this._encryptionKey),new t_(n,i)):(n=this._buildObjectKey(t,e,this._encryptionKey,!1),new t_(new W_(n),new W_(n)))},$_.prototype._buildCipherConstructor=function(t,e,i,n,r){var s,t=t.get(e.name);if(!(s=t?t.get("CFM"):s))return new K_;switch(s.name){case"None":return new K_;case"AESV2":return new g_(this._buildObjectKey(i,n,r,!0));case"AESV3":return new b_(r);case"V2":return new W_(this._buildObjectKey(i,n,r,!1))}throw new S("Unknown cryptography method")},$_.prototype._buildObjectKey=function(t,e,i,n){void 0===n&&(n=!1);for(var r=new Uint8Array(i.length+9),s=0;s<i.length;++s)r[s]=i[s];return r[s++]=255&t,r[s++]=t>>8&255,r[s++]=t>>16&255,r[s++]=255&e,r[s++]=e>>8&255,n&&(r[s++]=115,r[s++]=65,r[s++]=108,r[s++]=84),this._md5.hash(r,0,s).subarray(0,Math.min(i.length+5,16))};var Z_=$_;function $_(t,e,i){this._isUserPassword=!0,this._hasUserPasswordOnly=!1,this._encryptOnlyAttachment=!1,this._encryptMetaData=!0,this._defaultPasswordBytes=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]),null==i&&(i="");var n=t.get("Filter");if(!fh(n,"Standard"))throw new S("unknown encryption method");this._filterName=n.name;n=(this._dictionary=t).get("V");if(!Number.isInteger(n)||1!==n&&2!==n&&4!==n&&5!==n)throw new S("unsupported encryption algorithm");this._algorithm=n;var r=t.get("Length");if(r||(n<=3?r=40:(y=t.get("CF"),g=t.get("StmF"),y&&g&&(y.suppressEncryption=!0,(r=(y=y.get(g.name))&&y.get("Length")||128)<40)&&(r<<=3))),!Number.isInteger(r)||r<40||r%8!=0)throw new S("invalid key length");var s,a,o,h,c,_,d,l,u,p,f,g=v(t.get("O"),!1,!0).subarray(0,32),y=v(t.get("U"),!1,!0).subarray(0,32),m=t.get("P"),b=t.get("R"),e=(this._encryptMetaData=(4===n||5===n)&&!1!==t.get("EncryptMetadata"),v(e,!1,!0));if(i&&(s=v(i,!1,!0)),5!==n?(a=this._prepareKeyData(e,s,g,y,m,b,r,this._encryptMetaData))&&(this._isUserPassword=!0,i)&&(w=this._decodeUserPassword(s,g,b,r),o=this._prepareKeyData(e,w,g,y,m,b,r,this._encryptMetaData))&&gs(o,a)&&(this._hasUserPasswordOnly=!0):(f=(o=v(t.get("O"),!1,!0)).subarray(32,40),o=o.subarray(40,48),h=(c=v(t.get("U"),!1,!0)).subarray(0,48),u=c.subarray(32,40),c=c.subarray(40,48),_=v(t.get("OE"),!1,!0),d=v(t.get("UE"),!1,!0),l=new(6===b?V_:E_),p=void 0,p=s?s.subarray(0,Math.min(127,s.length)):new Uint8Array([]),l._checkUserPassword(p,u,y)?(a=this._createEncryptionKey(!0,p,o,h,c,_,d,l),this._isUserPassword=!0,i.length&&l._checkOwnerPassword(p,f,h,g)&&(this._hasUserPasswordOnly=!0)):i.length&&l._checkOwnerPassword(p,f,h,g)&&(a=this._createEncryptionKey(!1,s,o,h,c,_,d,l),this._isUserPassword=!1)),!a){if(!i)throw new Error("Cannot open an encrypted document. The password is invalid.");var w=this._decodeUserPassword(s,g,b,r);a=this._prepareKeyData(e,w,g,y,m,b,r,this._encryptMetaData),this._isUserPassword=!1}if(4<=n&&((u=t.get("CF"))&&(u.suppressEncryption=!0,u.has("StdCF"))&&(p=u.get("StdCF"))&&p.has("AuthEvent")&&(f=p.get("AuthEvent"))&&"EFOpen"===f.name&&(this._encryptOnlyAttachment=!0),this._cipherDictionary=u,this._stream=t.get("StmF")||R.get("Identity"),this._string=t.get("StrF")||R.get("Identity"),this._eff=t.get("EFF")||this._stream),!a&&!this._encryptOnlyAttachment)throw new Error("Cannot open an encrypted document. The password is invalid.");this._encryptionKey=a}td.prototype.and=function(t){this.high&=t.high,this.low&=t.low},td.prototype.or=function(t){this.high|=t.high,this.low|=t.low},td.prototype.not=function(){this.high=~this.high,this.low=~this.low},td.prototype.xor=function(t){this.high^=t.high,this.low^=t.low},td.prototype.shiftRight=function(t){32<=t?(this.low=this.high>>>t-32|0,this.high=0):(this.low=this.low>>>t|this.high<<32-t,this.high=this.high>>>t|0)},td.prototype.shiftLeft=function(t){32<=t?(this.high=this.low<<t-32,this.low=0):(this.high=this.high<<t|this.low>>>32-t,this.low<<=t)},td.prototype.rotateRight=function(t){var e,i;32&t?(i=this.low,e=this.high):(e=this.low,i=this.high),this.low=e>>>(t&=31)|i<<32-t,this.high=i>>>t|e<<32-t},td.prototype.add=function(t){var e=(this.low>>>0)+(t.low>>>0),t=(this.high>>>0)+(t.high>>>0);4294967295<e&&(t+=1),this.low=0|e,this.high=0|t},td.prototype.copyTo=function(t,e){t[e]=this.high>>>24&255,t[e+1]=this.high>>16&255,t[e+2]=this.high>>8&255,t[e+3]=255&this.high,t[e+4]=this.low>>>24&255,t[e+5]=this.low>>16&255,t[e+6]=this.low>>8&255,t[e+7]=255&this.low},td.prototype.assign=function(t){this.high=t.high,this.low=t.low};var B=td;function td(t,e){this.high=0|t,this.low=0|e}var ed=function(s,a,o,h){return new(o=o||Promise)(function(t,e){function i(t){try{r(h.next(t))}catch(t){e(t)}}function n(t){try{r(h.throw(t))}catch(t){e(t)}}function r(e){e.done?t(e.value):new o(function(t){t(e.value)}).then(i,n)}r((h=h.apply(s,a||[])).next())})},id=function(n,r){var s,a,o,h={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(i){return function(t){var e=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;h;)try{if(s=1,a&&(o=2&e[0]?a.return:e[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,e[1])).done)return o;switch(a=0,(e=o?[2&e[0],o.value]:e)[0]){case 0:case 1:o=e;break;case 4:return h.label++,{value:e[1],done:!1};case 5:h.label++,a=e[1],e=[0];continue;case 7:e=h.ops.pop(),h.trys.pop();continue;default:if(!(o=0<(o=h.trys).length&&o[o.length-1])&&(6===e[0]||2===e[0])){h=0;continue}if(3===e[0]&&(!o||e[1]>o[0]&&e[1]<o[3]))h.label=e[1];else if(6===e[0]&&h.label<o[1])h.label=o[1],o=e;else{if(!(o&&h.label<o[2])){o[2]&&h.ops.pop(),h.trys.pop();continue}h.label=o[2],h.ops.push(e)}}e=r.call(n,h)}catch(t){e=[6,t],a=0}finally{s=o=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}},nd=(l.prototype._setStartXRef=function(t){this._startXRefQueue=[t],this._prevStartXref=t,void 0!==this._prevXRefOffset&&null!==this._prevXRefOffset||(this._prevXRefOffset=t)},l.prototype._parse=function(t){var e,i=t?this._indexObjects():this._readXRef(),n=(i.assignXref(this),i.get("Size")),n=(this._entries.length<n||this._entries.length===n?this._nextReferenceNumber=n:this._entries.length>n&&(this._nextReferenceNumber=0<this._entries.length?this._entries.length:1),(this._trailer=i).get("Encrypt")),r=(n&&(L.initializeTelemetryFeature("DecryptPDF","PDFLibrary"),this._document._isEncrypted=!0,this._ids=i.get("ID"),this._permissionFlags=n.get("P"),r=this._ids&&this._ids.length?this._ids[0]:"",n.suppressEncryption=!0,this._encrypt=new Z_(n,r,this._password),this._document._isUserPassword=this._encrypt._isUserPassword,this._document._encryptOnlyAttachment=this._encrypt._encryptOnlyAttachment,this._document._encryptOnlyAttachment&&(this._document.fileStructure.isIncrementalUpdate=!1),this._document.fileStructure.isIncrementalUpdate?this._document.fileStructure.crossReferenceType=M.PdfCrossReferenceType.stream:this._document.fileStructure.crossReferenceType=M.PdfCrossReferenceType.table,this._encrypt._encryptOnlyAttachment?(this._document._hasUserPasswordOnly=!0,this._document._encryptMetaData=!1):(this._document._hasUserPasswordOnly=this._encrypt._hasUserPasswordOnly,this._document._encryptMetaData=!n.has("EncryptMetadata")||n.get("EncryptMetadata"))),!1);try{e=i.get("Root")}catch(t){throw new ja("Invalid cross reference","XRefParseException")}if(e)try{e.get("Pages")&&(this._root=e,r=!0)}catch(t){throw new ja("Invalid cross reference","InvalidXRef")}if(!r)throw new ja("Invalid cross reference",t?"InvalidXRef":"XRefParseException")},l.prototype._getEntry=function(t){t=this._entries[t];return t&&!t.free&&t.offset?t:null},l.prototype._fetch=function(e,t){var i;if(!(e instanceof m))throw new Error("ref object is not a reference");var n=e.objectNumber,r=this._cacheMap.get(e);if(void 0!==r)return r instanceof D&&!r.objId&&(r.objId=n),r;r=this._getEntry(n);if(null===r)return this._cacheMap.set(e,r),r;if(this._pendingRefs.has(e))throw this._pendingRefs.remove(e),new Error("circular reference");this._pendingRefs.put(e);try{i=r.uncompressed?this._fetchUncompressed(e,r,t):this._fetchCompressed(e,r),this._pendingRefs.remove(e)}catch(t){throw this._pendingRefs.remove(e),t}return i},l.prototype._fetchUncompressed=function(t,e,i){var n=t.generationNumber,r=t.objectNumber;if(e.gen!==n)throw new ja("Inconsistent generation in XRef: "+t,"XRefEntryException");var e=this._stream.makeSubStream(e.offset+this._stream.start,void 0),e=new h_(new a_(e),this,!0,!1,this._encrypt),s=(e._isImageExtraction=this._isDecoderSupport,e.getObject()),a=e.getObject(),o=e.getObject();if(s!==r||a!==n||void 0===o)throw new ja("Bad (uncompressed) XRef entry: "+t,"XRefEntryException");return(s=this._encrypt&&!i?e.getObject(t.objectNumber,t.generationNumber,!0):e.getObject(null,i))instanceof y||this._cacheMap.set(t,s),s instanceof D?s.objId=t.toString():s instanceof y&&(s.dictionary.objId=t.toString()),s},l.prototype._fetchCompressed=function(t,e){var i=e.offset,n=this._fetch(m.get(i,0));if(void 0===n)throw new S("bad ObjStm stream");var r=n.dictionary.get("First"),s=n.dictionary.get("N"),a=t.generationNumber;if(!Number.isInteger(r)||!Number.isInteger(s))throw new S("invalid first and n parameters for ObjStm stream");(f=new h_(new a_(n),this,!0))._isImageExtraction=this._isDecoderSupport;for(var o=new Array(s),h=new Array(s),c=0;c<s;++c){var _=f.getObject();if(!Number.isInteger(_))throw new S("invalid object number in the ObjStm stream: "+_);var d=f.getObject();if(!Number.isInteger(d))throw new S("invalid object offset in the ObjStm stream: "+d);o[c]=_,h[c]=d}for(var l=(n.start||0)+r,u=new Array(s),c=0;c<s;++c){var p=c<s-1?h[c+1]-h[c]:void 0;if(p<0)throw new S("Invalid offset in the ObjStm stream.");var f,g,p=(f=new h_(new a_(n.makeSubStream(l+h[c],p,n.dictionary)),this,!0)).getObject();(u[c]=p)instanceof y||(_=o[c],(g=this._entries[_])&&g.offset===i&&g.gen===c&&(g=_+" "+a,this._cacheMap.set(m.get(_,a),p),p instanceof D)&&(p.objId=g))}r=u[e.gen];if(void 0===r)throw new ja("Bad (compressed) XRef entry: "+t,"XRefEntryException");return r},l.prototype._readXRef=function(t){void 0===t&&(t=!1);var e=this._stream,i=new Set;try{for(;this._startXRefQueue.length;){var n=this._startXRefQueue[0];if(this._prevStartXref<n&&(this._prevStartXref=n),i.has(n));else{i.add(n),e.position=n+e.start;var r,s=new h_(new a_(e),this,!0),a=s.getObject(),o=void 0;if(gh(a,"xref"))void 0===this._document._fileStructure._crossReferenceType&&(this._document._fileStructure._crossReferenceType=M.PdfCrossReferenceType.table,this._isCrossReferenceTable=!0),o=this._processXRefTable(s),this._topDictionary||(this._topDictionary=o),a=o.get("XRefStm"),!Number.isInteger(a)||(r=a)in this._crossReferencePosition||(this._crossReferencePosition[r]=1,this._startXRefQueue.push(r));else{if(!Number.isInteger(a))throw new S("Invalid XRef stream header");void 0===this._document._fileStructure._crossReferenceType&&(this._document._fileStructure._crossReferenceType=M.PdfCrossReferenceType.stream,this._isCrossReferenceStream=!0);var h=s.getObject(),c=s.getObject(),a=s.getObject();if(!(void 0!==h&&Number.isInteger(h)&&gh(c,"obj")&&a instanceof y))throw new S("Invalid cross reference stream");if(o=this._processXRefStream(a),this._topDictionary||(this._topDictionary=o),!o)throw new S("Failed to read XRef stream")}a=o.get("Prev"),Number.isInteger(a)?this._startXRefQueue.push(a):a instanceof m&&this._startXRefQueue.push(a.objectNumber)}this._startXRefQueue.shift()}var _=[];return i.forEach(function(t){return _.push(t)}),this._document._startXRefParsedCache=_,this._topDictionary}catch(t){this._startXRefQueue.shift()}if(!t)throw new ja("Invalid cross reference","XRefParseException")},l.prototype._readToken=function(t,e){for(var i="",n=t[e];10!==n&&13!==n&&60!==n&&!(++e>=t.length);)i+=String.fromCharCode(n),n=t[e];return i},l.prototype._skipUntil=function(t,e,i){for(var n=i.length,r=t.length,s=0;e<r;){for(var a=0;a<n&&t[e+a]===i[a];)++a;if(n<=a)break;e++,s++}return s},l.prototype._indexObjects=function(){for(var t=/^(\d+)\s+(\d+)\s+obj\b/,e=/\bendobj[\b\s]$/,i=/\s+(\d+\s+\d+\s+obj[\b\s<])$/,n=new Uint8Array([116,114,97,105,108,101,114]),r=new Uint8Array([115,116,97,114,116,120,114,101,102]),s=new Uint8Array([111,98,106]),a=new Uint8Array([47,88,82,101,102]),o=(this._entries.length=0,this._cacheMap.clear(),this._stream),h=(o.position=0,o.getBytes()),c=h.length,_=o.start,d=[],l=[];_<c;){var u=h[_];if(9===u||10===u||13===u||32===u)++_;else if(37===u)for(;!(c<=++_)&&10!==(u=h[_])&&13!==u;);else{var p=this._readToken(h,_);if(p.startsWith("xref")&&(4===p.length||/\s/.test(p[4])))_+=this._skipUntil(h,_,n),d.push(_),_+=this._skipUntil(h,_,r);else if(g=t.exec(p)){var f=0|g[1],g=0|g[2],y=void 0,m=_+p.length,b=!1;if(this._entries[f]){if(this._entries[f].gen===g)try{var w=o.makeSubStream(m,o.length-m),v=new a_(w);(T=new h_(v,null)).getObject(),b=!0}catch(t){b=!(t instanceof Ua)}}else b=!0;for(b&&((b=new rd).offset=_-o.start,b.gen=g,b.uncompressed=!0,this._entries[f]=b);m<h.length;){var S=m+this._skipUntil(h,m,s)+4,y=S-_,P=Math.max(S-25,m),P=vs(h.subarray(P,S));if(e.test(P))break;P=i.exec(P);if(P&&P[1]){y-=P[1].length;break}m=S}g=h.subarray(_,_+y),f=this._skipUntil(g,0,a);f<y&&g[f+5]<64&&(l.push(_-o.start),this._crossReferencePosition[_-o.start]=1),_+=y}else p.startsWith("trailer")&&(7===p.length||/\s/.test(p[7]))?(d.push(_),_+=this._skipUntil(h,_,r)):_+=p.length+1}}for(var x,A=0;A<l.length;++A)this._startXRefQueue.push(l[A]),this._readXRef(!0);for(var T,A=0;A<d.length;++A)if(o.position=d[A],gh((T=new h_(new a_(o),this,!0,!0)).getObject(),"trailer")){var C=T.getObject();if(C instanceof D){try{var k=C.get("Root");if(!(k instanceof D))continue;var R=k.get("Pages");if(!(R instanceof D))continue;var F=R.get("Count");if(void 0===F||!Number.isInteger(F))continue}catch(t){continue}if(C.has("ID"))return C;x=C}}if(x)return x;if(this._topDictionary)return this._topDictionary;throw new ja("Invalid PDF structure.","InvalidPDFException")},l.prototype._processXRefTable=function(t){if(void 0===this._tableState&&((i=new sd).entryNum=0,i.streamPos=t.lexicalOperator.stream.position,i.parserBuf1=t.first,i.parserBuf2=t.second,this._tableState=i),!gh(this._readXRefTable(t),"trailer"))throw new S("Invalid XRef table: could not find trailer dictionary");var e,i=t.getObject();if(i&&(i instanceof D?e=i:i instanceof y&&i.dictionary&&(e=i.dictionary)),e)return this._tableState=void 0,e;throw new S("Invalid cross reference: could not parse trailer dictionary")},l.prototype._readXRefTable=function(t){var e,i=t.lexicalOperator.stream;for(i.position=this._tableState.streamPos,t.first=this._tableState.parserBuf1,t.second=this._tableState.parserBuf2;;){if(void 0===this._tableState.firstEntryNum||void 0===this._tableState.entryCount){if(gh(e=t.getObject(),"trailer"))break;this._tableState.firstEntryNum=e,this._tableState.entryCount=t.getObject()}var n=this._tableState.firstEntryNum,r=this._tableState.entryCount;if(!Number.isInteger(n)||!Number.isInteger(r))throw new S("Invalid cross reference: wrong types in subsection header");for(var s=this._tableState.entryNum;s<r;s++){this._tableState.streamPos=i.position,this._tableState.entryNum=s,this._tableState.parserBuf1=t.first,this._tableState.parserBuf2=t.second;var a=new rd,o=(a.offset=t.getObject(),a.gen=t.getObject(),t.getObject());if(o)switch(o.command){case"f":a.free=!0;break;case"n":a.uncompressed=!0}if(!Number.isInteger(a.offset)||!Number.isInteger(a.gen)||!a.free&&!a.uncompressed)throw new S("Invalid entry in cross reference subsection: "+n+", "+r);0===s&&a.free&&1===n&&(n=0),this._entries[s+n]||(this._entries[s+n]=a)}this._tableState.entryNum=0,this._tableState.streamPos=i.position,this._tableState.parserBuf1=t.first,this._tableState.parserBuf2=t.second,this._tableState.firstEntryNum=void 0,this._tableState.entryCount=void 0}if(this._entries[0]&&!this._entries[0].free)throw new S("Invalid XRef table: unexpected first object");return e},l.prototype._processXRefStream=function(t){var e,i,n;return void 0===this._streamState&&(e=t.dictionary,i=new ad,n=(n=e.getArray("Index"))||[0,e.get("Size")],i.entryRanges=n,i.byteWidths=e.getArray("W"),i.entryNum=0,i.streamPos=t.position,this._streamState=i),this._readXRefStream(t),this._streamState=void 0,t.dictionary},l.prototype._readXRefStream=function(t){t.position=this._streamState.streamPos;for(var e=this._streamState.byteWidths[0],i=this._streamState.byteWidths[1],n=this._streamState.byteWidths[2],r=this._streamState.entryRanges;0<r.length;){var s=r[0],a=r[1];if(!Number.isInteger(s)||!Number.isInteger(a))throw new S("Invalid XRef range fields: "+s+", "+a);if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(n))throw new S("Invalid XRef entry fields length: "+s+", "+a);for(var o=this._streamState.entryNum;o<a;++o){this._streamState.entryNum=o,this._streamState.streamPos=t.position;for(var h=0,c=0,_=0,d=0;d<e;++d){var l=t.getByte();if(-1===l)throw new S("invalid cross reference byte width type.");h=h<<8|l}0===e&&(h=1);for(d=0;d<i;++d){var u=t.getByte();if(-1===u)throw new S("invalid cross reference byte width offset.");c=c<<8|u}for(d=0;d<n;++d){var p=t.getByte();if(-1===p)throw new S("invalid cross reference byte width generation.");_=_<<8|p}var f=new rd;switch(f.offset=c,f.gen=_,h){case 0:f.free=!0;break;case 1:f.uncompressed=!0;break;case 2:break;default:throw new S("Invalid XRef entry type: "+h)}this._entries[s+o]||(this._entries[s+o]=f)}this._streamState.entryNum=0,this._streamState.streamPos=t.position,r.splice(0,2)}},l.prototype._getCatalogObj=function(){return this._root},l.prototype._flushBuffer=function(t){if(0!==t.length){for(var e=new Uint8Array(t.length),i=0;i<t.length;i++)e[i]=t[i];this._uint8Chunks.push(e),this._bufferLength+=e.length,t.length=0}},l.prototype._save=function(){this._uint8Chunks=[],this._bufferLength=0;var t,e=[37,80,68,70,45],i=(this._writeString(""+this._version+this._newLine,e),e.push(37,131,146,250,254),this._writeString(this._newLine,e),0);if(this._signatureCollection&&0<this._signatureCollection.length){this._isCrossReferenceStream?this._document.fileStructure.crossReferenceType=M.PdfCrossReferenceType.stream:this._isCrossReferenceTable&&(this._document.fileStructure.crossReferenceType=M.PdfCrossReferenceType.table);for(var n=this._signatureCollection.length,r=0;r<n;r++)this._signatureCollection[r]._catalogBeginSave()}this._document.fileStructure.isIncrementalUpdate?(this._currentLength=this._stream.length,this._document._fileStructure._crossReferenceType===M.PdfCrossReferenceType.stream?this._saveAsStream(this._currentLength,e):this._saveAsTable(this._currentLength,e),0<e.length&&this._flushBuffer(e),(t=new Uint8Array(this._stream.length+this._bufferLength)).set(this._stream.bytes),i=this._stream.length):(this._currentLength=0,this._objectCollection=new cd(this),this._writeObjectCollection(this._objectCollection._mainObjectCollection,e),0<e.length&&this._flushBuffer(e),t=new Uint8Array(this._bufferLength));for(var s=0,a=this._uint8Chunks;s<a.length;s++){var o=a[s];t.set(o,i),i+=o.length}if(this._signatureCollection&&0<this._signatureCollection.length)for(n=this._signatureCollection.length,r=0;r<n;r++)this._signature=this._signatureCollection[r]._signatureDictionary,this._signature._documentSaved(t);return this._document.fileStructure.isIncrementalUpdate||(e=new g(t),this._stream=e,this._document._stream=e),this._uint8Chunks=[],t},l.prototype._saveAsStream=function(r,s){var a=this,n=new Map;this._indexes=[],this._indexes.push(0,1),this._offsets=[];this._cacheMap.forEach(function(t){t=t instanceof y?t.dictionary:t instanceof D?t:void 0;t&&(t._isProcessed=!1)}),this._cacheMap.forEach(function(t,e){var i,n;t instanceof y&&(!(i=t.dictionary)||!i._updated||i.isCatalog&&!a._allowCatalog||i._isProcessed||(n=void 0,a._encrypt&&(n=a._encrypt._createCipherTransform(e.objectNumber,e.generationNumber)),a._updatedDictionary(r,e,s,t,n),i._isProcessed=!0,512e3<s.length&&a._flushBuffer(s)))}),this._cacheMap.forEach(function(t,e){var i;t instanceof D?t._updated&&!t.isCatalog&&!t._isProcessed||t._isSignature?t._isSignature?a._updatedDictionary(r,e,s,t):a._writeArchiveStream(n,e,t):t._updated&&(t.isCatalog||a._allowCatalog)&&(a._updatedDictionary(r,e,s,t),512e3<s.length)&&a._flushBuffer(s):t instanceof y&&(!(i=t.dictionary)||!i._updated||i.isCatalog&&!a._allowCatalog||i._isProcessed||(a._updatedDictionary(r,e,s,t),512e3<s.length&&a._flushBuffer(s)))}),this._objectStream=void 0,this._objectStreamCollection=n,this._writeXrefStream(s)},l.prototype._writeXrefStream=function(n){var r=this,s=(this._objectStreamCollection.forEach(function(t,e){var i;t._save(n,r._currentLength),Array.isArray(t._collection)&&(i=r._indexes).push.apply(i,t._collection),r._indexes.push(e.objectNumber,1),524288<n.length&&r._flushBuffer(n)}),Math.max(oo(this._currentLength+this._bufferLength+n.length),oo(this._nextReferenceNumber))),t=this._getNextReference(),e=(this._indexes.push(t.objectNumber,1),this._currentLength+this._bufferLength+n.length),i=new D(this),a=(i.set("Type",R.get("XRef")),i.set("Index",this._indexes),i.set("W",[1,s,1]),this._copyTrailer(i),this._ids&&0<this._ids.length&&i.update("ID",[this._ids[0],this._computeMessageDigest(e)]),[]);if(this._writeLong(0,1,a),this._writeLong(0,s,a),this._writeLong(-1,1,a),0<this._offsets.length)for(var o=0;o<this._offsets.length;o++)this._writeLong(1,1,a),this._writeLong(this._offsets[o],s,a),this._writeLong(0,1,a);0<this._objectStreamCollection.size&&this._objectStreamCollection.forEach(function(t,e){for(var i=0;i<t._length;i++)r._writeLong(2,1,a),r._writeLong(e.objectNumber,s,a),r._writeLong(i,1,a);r._writeLong(1,1,a),r._writeLong(t._archiveOffset,s,a),r._writeLong(0,1,a)}),this._writeLong(1,1,a),this._writeLong(e,s,a),this._writeLong(0,1,a),i.set("Length",a.length);var h,i=new g(a,i,0,a.length);this._encrypt&&(h=this._encrypt._createCipherTransform(t.objectNumber,t.generationNumber)),this._writeObject(i,n,t,h,!0),this._writeString("startxref"+this._newLine+e+this._newLine+"%%EOF"+this._newLine,n),0<n.length&&this._flushBuffer(n)},l.prototype._updatedDictionary=function(t,e,i,n,r){this._indexes.push(e.objectNumber,1),this._offsets.push(t+this._bufferLength+i.length),this._writeObject(n,i,e,r),n._updated=!1},l.prototype._writeXrefTable=function(t){var n=this,r="",e=this._getSortedReferences(this._offsetReference),i=(e.forEach(function(t,e){var i=n._processString(t.toString(),10),e=n._processString(e.generationNumber?"0":"",5);r+=0!==t?i+" "+e+" n"+n._newLine:i+" "+e+" f"+n._newLine}),t.length+this._bufferLength),s="xref"+this._newLine,e="0 "+(e.size+1)+this._newLine,a="0000000000 65535 f"+this._newLine;this._writeString(s+e+a,t),this._writeXref(t,r,i),512e3<t.length&&this._flushBuffer(t)},l.prototype._writeXref=function(t,e,i){this._writeString(e,t),this._writeString("trailer"+this._newLine,t);e=new D(this);this._copyTrailer(e),this._writeDictionary(e,t,this._newLine),this._writeString("startxref"+this._newLine+i+this._newLine+"%%EOF"+this._newLine,t)},l.prototype._processString=function(t,e){for(;t.length<e;)t="0"+t;return t},l.prototype._copyTrailer=function(t){var e=this._getNextReference(),e=(t.set("Size",e.objectNumber),this._document.fileStructure.isIncrementalUpdate&&t.set("Prev",this._prevXRefOffset),this._trailer.getRaw("Root")),e=(null!=e&&t.set("Root",e),this._trailer.getRaw("Info")),e=(null!=e&&t.set("Info",e),this._trailer.getRaw("Encrypt"));null!=e&&t.set("Encrypt",e)},l.prototype._computeMessageDigest=function(t){var e=this,i=[Math.floor(Date.now()/1e3).toString(),"",t.toString()],t=this._trailer.getRaw("Info"),n=new D,r=(t&&t instanceof D&&t.forEach(function(t,e){e&&"string"==typeof e&&n.set(t,fs(e))}),n.forEach(function(t,e){i.push(e)}),[]);return i.forEach(function(t){e._writeString(t,r)}),vs((new l_).hash(new Uint8Array(r)))},l.prototype._getNextReference=function(){var t=new m(this._nextReferenceNumber++,0);return t._isNew=!0,t},l.prototype._writeObject=function(n,r,t,s,a){var e,o=this;t&&t instanceof m&&this._writeString(t.objectNumber+" "+t.generationNumber+" obj"+this._newLine,r),n instanceof D?this._writeDictionary(n,r,this._newLine,s,a):n instanceof y?this._writeStream(n,r,s,a):Array.isArray(n)&&0<n.length?(this._writeString("[ ",r),n.forEach(function(t,e){var i;t instanceof m?o._writeString(t.objectNumber+" "+t.generationNumber+" R",r):Array.isArray(t)?(o._writeString("[ ",r),t.forEach(function(t){t instanceof m?o._writeString(t.objectNumber+" "+t.generationNumber+" R",r):t instanceof R?o._writeString("/"+na(t.name),r):o._writeString(t+" ",r)}),o._writeString("]",r)):t instanceof R?o._writeString("/"+na(t.name),r):t instanceof D?o._writeDictionary(t,r,o._newLine,s,a):"string"==typeof t&&mo(t)?(i=As(v(t)),o._writeString("<",r),o._writeString(""+i,r),o._writeString(">",r)):o._writeString(t+"\n",r),e<n.length-1&&o._writeString(" ",r)}),this._writeString("]",r),this._writeString("\n",r)):"number"==typeof n?this._writeString(n+"\n",r):"string"==typeof n&&this._writeString("("+na(n)+")\n",r),n instanceof R&&(-1!==n.name.indexOf(" ")&&(n.name=n.name.replace(/ /g,"#20")),e=n.name,this._writeString("/"+e,r)),t&&t instanceof m&&this._writeString("endobj"+this._newLine,r)},l.prototype._writeDictionary=function(e,i,n,r,s){var t,a=this;e._currentObj&&e._currentObj._beginSave(),e._isFont&&this._writeFontDictionary(e),this._writeString("<<"+n,i),e._isSignature&&this._signatureCollection&&0<this._signatureCollection.length&&(t=this._signatureCollection.find(function(t){return t._signatureDictionary._dictionary.objId===e.objId}))&&t._signatureDictionary._dictionarySave(i),e.forEach(function(t,e){a._writeString("/"+na(t)+" ",i),a._writeValue(e,t,i,r,s),a._writeString(n,i)}),this._writeString(">>"+this._newLine,i)},l.prototype._writeFontDictionary=function(t){var e,i;t.has("DescendantFonts")&&(e=t.get("DescendantFonts"),Array.isArray(e)||(i=this._getNextReference(),this._cacheMap.set(i,e),t.update("DescendantFonts",[i]))),this._createFontReference("ToUnicode",t),this._createFontReference("FontFile2",t),this._createFontReference("FontFile3",t),this._createFontReference("FontDescriptor",t)},l.prototype._createFontReference=function(t,e){var i,n;!e.has(t)||(i=e.get(t))instanceof m||(n=this._getNextReference(),this._cacheMap.set(n,i),!1===this._document.fileStructure.isIncrementalUpdate&&this._objectCollection&&this._objectCollection._mainObjectCollection&&this._objectCollection._mainObjectCollection.set(n,i),e.update(t,n))},l.prototype._writeStream=function(t,e,i,n){var r,s=[];n?r=t.getString():(r=t._isCompress&&!t._isImage?po(t):t.getString(),i&&(r=i.encryptString(r))),this._writeString(r,s),t.dictionary.update("Length",s.length),this._writeDictionary(t.dictionary,e,this._newLine,i,n),this._writeString("stream"+this._newLine,e),this._writeBytes(s,e),this._writeString(this._newLine+"endstream"+this._newLine,e)},l.prototype._writeValue=function(t,e,i,n,r){if(t instanceof R){-1!==t.name.indexOf(" ")&&(t.name=t.name.replace(/ /g,"#20"));var s="V"===e||"AS"===e?na(t.name):t.name;this._writeString("/"+s,i)}else if(t instanceof m)this._writeString(t.toString()+" R",i);else if(Array.isArray(t)){this._writeString("[",i);for(var a=!0,o=0,h=t;o<h.length;o++){var c=h[o];a?a=!1:this._writeString(" ",i),this._writeValue(c,e,i,n,r)}this._writeString("]",i)}else if("string"==typeof t){!r&&n&&(t=n.encryptString(t));for(var _=!1,d=0;d<t.length;d++)if(255<t.charCodeAt([d])){_=!0;break}_?this._writeUnicodeString(t,i):this._writeString("("+this._escapeString(t)+")",i)}else"number"==typeof t?this._writeString(ms(t),i):"boolean"==typeof t?this._writeString(t.toString(),i):t instanceof D?this._writeDictionary(t,i,this._newLine,n,r):t instanceof y?this._writeStream(t,i,n,r):null===t&&this._writeString("null",i)},l.prototype._writeUnicodeString=function(t,e){var t=ho(t),i=(t.unshift(254,255),[]);t.forEach(function(t){switch(t){case 40:case 41:i.push(92),i.push(t);break;case 13:i.push(92),i.push(114);break;case 92:i.push(92),i.push(t);break;default:i.push(t)}}),e.push(255&"(".charCodeAt(0)),i.forEach(function(t){e.push(255&t)}),e.push(255&")".charCodeAt(0))},l.prototype._writeString=function(t,e){for(var i=0;i<t.length;i++)e.push(255&t.charCodeAt(i))},l.prototype._writeBytes=function(t,e){for(var i=0;i<t.length;i++)e.push(t[i])},l.prototype._writeLong=function(t,e,i){for(var n=e-1;0<=n;--n)i.push(t>>(n<<3)&255)},l.prototype._escapeString=function(t){return t.replace(/([()\\\n\r])/g,function(t){return"\n"===t?"\\n":"\r"===t?"\\r":"\\"+t})},l.prototype._destroy=function(){this._entries=void 0,this._pendingRefs&&(this._pendingRefs.clear(),this._pendingRefs=void 0),this._cacheMap&&this._cacheMap.clear(),this._offsetReference&&this._offsetReference.clear(),this._objectStreamCollection&&this._objectStreamCollection.clear(),this._objectCollection&&(this._objectCollection=void 0),this._offsets=[],this._startXRefQueue=[],this._root=void 0,this._startXRefQueue=void 0,this._stream=void 0,this._streamState=void 0,this._tableState=void 0,this._topDictionary=void 0,this._trailer=void 0,this._version=void 0,this._crossReferencePosition=void 0},l.prototype._writeObjectCollection=function(i,n){var r=this,s=new Map;this._indexes=[],this._indexes.push(0,1);i.forEach(function(t,e){r._writeObjectToBuffer(e,t,n,s),512e3<n.length&&r._flushBuffer(n)}),this._cacheMap.size>i.size&&this._cacheMap.forEach(function(t,e){i.has(e)||(r._writeObjectToBuffer(e,t,n,s),512e3<n.length&&r._flushBuffer(n))}),this._document.fileStructure._crossReferenceType===M.PdfCrossReferenceType.stream?(this._objectStream=void 0,this._objectStreamCollection=s,this._writeXrefStream(n)):this._writeXrefTable(n)},l.prototype._saveAsTable=function(r,s){var a=this,o="",h=0,t=(this._cacheMap.forEach(function(t,e){var i,n;t instanceof D?i=t:t instanceof y&&(i=t.dictionary),i&&(i._updated&&(!i.isCatalog||a._allowCatalog)||i._isSignature)&&(i=a._processString((r+a._bufferLength+s.length).toString(),10),n=a._processString(e.generationNumber.toString(),5),o+=e.objectNumber+" 1"+a._newLine+i+" "+n+" n"+a._newLine,a._writeObject(t,s,e),h++,512e3<s.length||h%2==0)&&a._flushBuffer(s)}),this._bufferLength+s.length+r);this._writeString("xref"+this._newLine+"0 1"+this._newLine+"0000000000 65535 f"+this._newLine,s),this._writeXref(s,o,t),0<s.length&&this._flushBuffer(s)},l.prototype._writeArchiveStream=function(t,e,i){var n;void 0!==this._objectStream&&100!==this._objectStream._length||(n=new od(this),t.set(n._reference,n),this._objectStream=n),this._objectStream._writeObject(e,i)},l.prototype._writeObjectToBuffer=function(t,e,i,n){var r;if(e instanceof D&&e.isCatalog)this._writeToBuffer(i,t,e);else if(e instanceof R)this._document.fileStructure._crossReferenceType===M.PdfCrossReferenceType.stream?this._writeArchiveStream(n,t,e):this._writeToBuffer(i,t,e);else if(e instanceof D){var s=e.get("Filter"),s=s&&"Standard"===s.name;this._document.fileStructure._crossReferenceType===M.PdfCrossReferenceType.stream?s||e._isSignature?this._writeToBuffer(i,t,e):this._writeArchiveStream(n,t,e):(this._offsetReference.set(t,this._bufferLength+i.length),this._indexes.push(t.objectNumber,1),this._writeObject(e,i,t))}else{if(e instanceof y){s=e.dictionary;s&&s._updated&&!s.isCatalog&&(this._encrypt&&(r=this._encrypt._createCipherTransform(t.objectNumber,t.generationNumber)),s._updated=!1)}else if((!Array.isArray(e)||0===e.length)&&"number"!=typeof e&&"string"!=typeof e)return;this._writeToBuffer(i,t,e,r)}},l.prototype._writeToBuffer=function(t,e,i,n){this._offsets.push(this._bufferLength+t.length),this._offsetReference.set(e,this._bufferLength+t.length),this._indexes.push(e.objectNumber,1),this._writeObject(i,t,e,n),512e3<t.length&&this._flushBuffer(t)},l.prototype._getSortedReferences=function(t){for(var i=[],e=(t.forEach(function(t,e){i.push([e,t])}),i.sort(function(t,e){return t[0].objectNumber-e[0].objectNumber}),new Map),n=1,r=0,s=i;r<s.length;r++){for(var a=s[r],o=a[0],a=a[1],h=o.objectNumber;n<h;)e.set({objectNumber:n},0),n++;e.set(o,a),n=h+1}return e},l.prototype._saveAsync=function(){return ed(this,void 0,void 0,function(){var e,i,n,r,s,a,o,h,c;return id(this,function(t){switch(t.label){case 0:return this._uint8Chunks=[],this._bufferLength=0,e=[37,80,68,70,45],[4,this._writeStringAsync(""+this._version+this._newLine,e)];case 1:return t.sent(),e.push(37,131,146,250,254),[4,this._writeStringAsync(this._newLine,e)];case 2:if(t.sent(),n=0,!(this._signatureCollection&&0<this._signatureCollection.length))return[3,6];this._isCrossReferenceStream?this._document.fileStructure.crossReferenceType=M.PdfCrossReferenceType.stream:this._isCrossReferenceTable&&(this._document.fileStructure.crossReferenceType=M.PdfCrossReferenceType.table),o=this._signatureCollection.length,h=0,t.label=3;case 3:return h<o?(this._signatureCollection[h]._catalogBeginSave(),h%50!=0?[3,5]:[4,new Promise(function(t){return setTimeout(t,0)})]):[3,6];case 4:t.sent(),t.label=5;case 5:return h++,[3,3];case 6:return this._document.fileStructure.isIncrementalUpdate?[3,10]:(this._currentLength=0,c=new cd(this),[4,this._writeObjectCollectionAsync(c._mainObjectCollection,e)]);case 7:return(t.sent(),0<e.length)?[4,this._flushBufferAsync(e)]:[3,9];case 8:t.sent(),t.label=9;case 9:return i=new Uint8Array(this._bufferLength),[3,17];case 10:return this._currentLength=this._stream.length,this._document._fileStructure._crossReferenceType!==M.PdfCrossReferenceType.stream?[3,12]:[4,this._saveAsStreamAsync(this._currentLength,e)];case 11:return t.sent(),[3,14];case 12:return[4,this._saveAsTableAsync(this._currentLength,e)];case 13:t.sent(),t.label=14;case 14:return 0<e.length?[4,this._flushBufferAsync(e)]:[3,16];case 15:t.sent(),t.label=16;case 16:(i=new Uint8Array(this._stream.length+this._bufferLength)).set(this._stream.bytes),n=this._stream.length,t.label=17;case 17:for(r=0,s=this._uint8Chunks;r<s.length;r++)a=s[r],i.set(a,n),n+=a.length;if(!(this._signatureCollection&&0<this._signatureCollection.length))return[3,21];o=this._signatureCollection.length,h=0,t.label=18;case 18:return h<o?(this._signature=this._signatureCollection[h]._signatureDictionary,[4,this._signature._documentSavedAsync(i)]):[3,21];case 19:t.sent(),t.label=20;case 20:return h++,[3,18];case 21:return this._document.fileStructure.isIncrementalUpdate||(c=new g(i),this._stream=c,this._document._stream=c),this._uint8Chunks=[],[2,i]}})})},l.prototype._writeStringAsync=function(i,n){return ed(this,void 0,void 0,function(){var e;return id(this,function(t){switch(t.label){case 0:e=0,t.label=1;case 1:return e<i.length?(n.push(255&i.charCodeAt(e)),e%1e4!=0?[3,3]:[4,new Promise(function(t){return setTimeout(t,0)})]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})},l.prototype._writeObjectCollectionAsync=function(a,o){return ed(this,void 0,void 0,function(){var n,r,s=this;return id(this,function(t){switch(t.label){case 0:return(n=new Map,this._indexes=[],this._indexes.push(0,1),r=0,a.forEach(function(e,i){return ed(s,void 0,void 0,function(){return id(this,function(t){switch(t.label){case 0:return(this._writeObjectToBuffer(i,e,o,n),512e3<o.length)?[4,this._flushBufferAsync(o)]:[3,2];case 1:t.sent(),t.label=2;case 2:return++r%100!=0?[3,4]:[4,new Promise(function(t){return setTimeout(t,0)})];case 3:t.sent(),t.label=4;case 4:return[2]}})})}),this._cacheMap.forEach(function(e,i){return ed(s,void 0,void 0,function(){return id(this,function(t){switch(t.label){case 0:return a.has(i)?[3,4]:(this._writeObjectToBuffer(i,e,o,n),512e3<o.length?[4,this._flushBufferAsync(o)]:[3,2]);case 1:t.sent(),t.label=2;case 2:return++r%100!=0?[3,4]:[4,new Promise(function(t){return setTimeout(t,0)})];case 3:t.sent(),t.label=4;case 4:return[2]}})})}),this._document.fileStructure._crossReferenceType!==M.PdfCrossReferenceType.stream)?[3,2]:(this._objectStream=void 0,this._objectStreamCollection=n,[4,this._writeXrefStreamAsync(o)]);case 1:return t.sent(),[3,4];case 2:return[4,this._writeXrefTableAsync(o)];case 3:t.sent(),t.label=4;case 4:return[2]}})})},l.prototype._flushBufferAsync=function(n){return ed(this,void 0,void 0,function(){var e,i;return id(this,function(t){if(0!==n.length){for(e=new Uint8Array(n.length),i=0;i<n.length;i++)e[i]=n[i];this._uint8Chunks.push(e),this._bufferLength+=e.length,n.length=0}return[2]})})},l.prototype._writeXrefStreamAsync=function(e){return ed(this,void 0,void 0,function(){return id(this,function(t){return this._writeXrefStream(e),[2]})})},l.prototype._writeXrefTableAsync=function(e){return ed(this,void 0,void 0,function(){return id(this,function(t){return this._writeXrefTable(e),[2]})})},l.prototype._saveAsStreamAsync=function(a,o){return ed(this,void 0,void 0,function(){var r,s,e=this;return id(this,function(t){switch(t.label){case 0:return r=new Map,this._indexes=[],this._indexes.push(0,1),this._offsets=[],s=0,this._cacheMap.forEach(function(n,r){return ed(e,void 0,void 0,function(){var e,i;return id(this,function(t){switch(t.label){case 0:return n instanceof y?!(e=n.dictionary)||!e._updated||e.isCatalog&&!this._allowCatalog||e._isProcessed?[3,4]:(i=void 0,this._encrypt&&(i=this._encrypt._createCipherTransform(r.objectNumber,r.generationNumber)),this._updatedDictionary(a,r,o,n,i),e._isProcessed=!0,512e3<o.length?[4,this._flushBufferAsync(o)]:[3,2]):[3,4];case 1:t.sent(),t.label=2;case 2:return++s%100!=0?[3,4]:[4,new Promise(function(t){return setTimeout(t,0)})];case 3:t.sent(),t.label=4;case 4:return[2]}})})}),this._cacheMap.forEach(function(i,n){return ed(e,void 0,void 0,function(){var e;return id(this,function(t){switch(t.label){case 0:return i instanceof D?i._updated&&!i.isCatalog&&!i._isProcessed||i._isSignature?(i._isSignature?this._updatedDictionary(a,n,o,i):this._writeArchiveStream(r,n,i),[3,3]):[3,1]:[3,4];case 1:return i._updated&&(i.isCatalog||this._allowCatalog)?(this._updatedDictionary(a,n,o,i),512e3<o.length?[4,this._flushBufferAsync(o)]:[3,3]):[3,3];case 2:t.sent(),t.label=3;case 3:return[3,6];case 4:return i instanceof y?(e=i.dictionary)&&e._updated&&(!e.isCatalog||this._allowCatalog)&&!e._isProcessed&&(this._updatedDictionary(a,n,o,i),512e3<o.length)?[4,this._flushBufferAsync(o)]:[3,6]:[3,6];case 5:t.sent(),t.label=6;case 6:return++s%100!=0?[3,8]:[4,new Promise(function(t){return setTimeout(t,0)})];case 7:t.sent(),t.label=8;case 8:return[2]}})})}),this._objectStream=void 0,this._objectStreamCollection=r,[4,this._writeXrefStreamAsync(o)];case 1:return t.sent(),[2]}})})},l.prototype._saveAsTableAsync=function(h,c){return ed(this,void 0,void 0,function(){var a,o,e,i=this;return id(this,function(t){switch(t.label){case 0:return a="",o=0,this._cacheMap.forEach(function(r,s){return ed(i,void 0,void 0,function(){var e,i,n;return id(this,function(t){switch(t.label){case 0:return(r instanceof D?e=r:r instanceof y&&(e=r.dictionary),e)?e._updated&&(!e.isCatalog||this._allowCatalog)||e._isSignature?(i=this._processString((h+this._bufferLength+c.length).toString(),10),n=this._processString(s.generationNumber.toString(),5),a+=s.objectNumber+" 1"+this._newLine+i+" "+n+" n"+this._newLine,this._writeObject(r,c,s),o++,512e3<c.length||o%2==0?[4,this._flushBufferAsync(c)]:[3,2]):[3,4]:[3,4];case 1:t.sent(),t.label=2;case 2:return o%100!=0?[3,4]:[4,new Promise(function(t){return setTimeout(t,0)})];case 3:t.sent(),t.label=4;case 4:return[2]}})})}),e=this._bufferLength+c.length+h,[4,this._writeStringAsync("xref"+this._newLine+"0 1"+this._newLine+"0000000000 65535 f"+this._newLine,c)];case 1:return t.sent(),[4,this._writeXrefAsync(c,a,e)];case 2:return(t.sent(),0<c.length)?[4,this._flushBufferAsync(c)]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2]}})})},l.prototype._writeXrefAsync=function(e,i,n){return ed(this,void 0,void 0,function(){return id(this,function(t){return this._writeXref(e,i,n),[2]})})},l);function l(t,e){this._uint8Chunks=[],this._version="",this._newLine="\r\n",this._bufferLength=0,this._isDecoderSupport=!1,this._signatureCollection=[],this._isCrossReferenceTable=!1,this._isCrossReferenceStream=!1,this._password=e,this._document=t,this._stream=t._stream,this._entries=[],this._crossReferencePosition=Object.create(null),this._cacheMap=new Map,this._offsetReference=new Map,this._pendingRefs=new ah,this._offsets=[]}var rd=function(){},sd=function(){},ad=function(){},od=(hd.prototype._writeObject=function(t,e){this._archiveXRef+=t.objectNumber+" "+this._updatedStream.length+this._crossReference._newLine,this._collection.push(t.objectNumber,1),this._crossReference._writeObject(e,this._updatedStream),this._length++},hd.prototype._save=function(t,e){var i,n=[],r=(this._crossReference._writeString(this._archiveXRef,n),this._crossReference._writeBytes(this._updatedStream,n),new D(this._crossReference)),r=(r.set("Type",R.get("ObjStm")),r.set("N",this._length),r.set("First",this._archiveXRef.length),r.set("Length",n.length),new g(n,r,0,n.length));this._archiveOffset=this._crossReference._bufferLength+e+t.length,this._crossReference._encrypt&&(i=this._crossReference._encrypt._createCipherTransform(this._reference.objectNumber,this._reference.generationNumber)),this._crossReference._writeObject(r,t,this._reference,i)},hd);function hd(t){this._indexes="",this._length=0,this._crossReference=t,this._reference=t._getNextReference(),this._archiveXRef="",this._updatedStream=[],this._collection=[]}_d.prototype._parseObjectCollection=function(){for(var r=this,t=this;this._pointer<this._mainObjectCollection.size;)!function(){var i=new Map,n=0;t._mainObjectCollection.forEach(function(t,e){n===r._pointer&&(i.set(e,t),r._parse(e,t)),n++}),t._pointer++}();return this._addReferencesToMainCollection(),this._mainObjectCollection},_d.prototype._addToMainObjectCollection=function(t,e){this._reference.push(t),this._mainObjectCollection.set(t,e)},_d.prototype._parseFetchValue=function(t){var e=this._crossReference._fetch(t);this._parse(t,e)},_d.prototype._parse=function(t,e){var i=this;e instanceof D?this._parseDictionary(e):e instanceof y?this._parseStream(t,e):e instanceof m?this._parseFetchValue(e):Array.isArray(e)&&0<e.length?e.every(function(t){return t instanceof m})?e.forEach(function(t){return i._parseFetchValue(t)}):(e.forEach(function(t){t instanceof m&&i._parseFetchValue(t)}),-1!==this._reference.indexOf(t)||this._mainObjectCollection.has(t)||this._addToMainObjectCollection(t,e)):"number"!=typeof e||-1!==this._reference.indexOf(t)||this._mainObjectCollection.has(t)||this._addToMainObjectCollection(t,e)},_d.prototype._addReferencesToMainCollection=function(){var i=this,n=[];this._cache.forEach(function(t,e){i._mainObjectCollection.has(e)||n.push({key:e,value:t})}),n.forEach(function(t){var e=t.key,t=t.value;i._addToMainObjectCollection(e,t)})},_d.prototype._parseDictionary=function(t){var n=this;t._isVisited||(t._isVisited=!0,t.forEach(function(t,e){function i(t){var e;n._mainObjectCollection.has(t)||-1!==n._reference.indexOf(t)||((e=(e=n._crossReference._fetch(t))instanceof m?n._crossReference._fetch(e):e)instanceof y?n._parseStream(t,e):n._addToMainObjectCollection(t,e))}e instanceof m?i(e):Array.isArray(e)?e.forEach(function(t){t instanceof m?i(t):t instanceof D&&n._parseDictionary(t)}):e instanceof D&&n._parseDictionary(e)}))},_d.prototype._parseStream=function(t,e){var i,n,r;this._parseDictionary(e.dictionary),-1!==this._reference.indexOf(t)||this._mainObjectCollection.has(t)||(i=e.dictionary.get("Type"),n=e.dictionary.get("Subtype"),r=void 0,e.dictionary._updated||i&&("XObject"===i.name||"Metadata"===i.name)&&("Form"===n.name||"XML"===n.name)?r=this._crossReference._fetch(t):(r=this._crossReference._fetch(t,!0))._isCompress=!1,this._addToMainObjectCollection(t,r))};var cd=_d;function _d(t){var i=this;if(this._pointer=0,!(t._cacheMap instanceof Map))throw new Error("Expected _cacheMap to be a Map.");this._reference=[],this._cache=t._cacheMap,this._mainObjectCollection=new Map;var e,n=!1;this._crossReference=t,this._cache.forEach(function(t,e){!n&&t instanceof D&&t.isCatalog&&(i._addToMainObjectCollection(e,t),n=!0)}),t._trailer&&t._trailer.has("Info")&&((e=t._trailer.getRaw("Info"))&&e instanceof m?(t=t._fetch(e))&&t instanceof D&&(t._updated=!0,this._addToMainObjectCollection(e,t)):e&&e instanceof D&&(e._updated=!0,this._addToMainObjectCollection(this._crossReference._getNextReference(),e))),this._parseObjectCollection()}Object.defineProperty(u.prototype,"count",{get:function(){return this._fields.length},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"needAppearances",{get:function(){return this._dictionary.has("NeedAppearances")&&(this._needAppearances=this._dictionary.get("NeedAppearances")),this._needAppearances},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"exportEmptyFields",{get:function(){return this._exportEmptyFields},set:function(t){this._exportEmptyFields=t},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"_signatureFlag",{get:function(){return this._signFlag},set:function(t){t!==this._signFlag&&(this._signFlag=t,this._dictionary.update("SigFlags",t))},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"fieldAutoNaming",{get:function(){return this._fieldAutoNaming},set:function(t){this._fieldAutoNaming=t},enumerable:!0,configurable:!0}),u.prototype.fieldAt=function(t){if(t<0||t>=this._fields.length)throw Error("Index out of range.");var e,i,n;return this._parsedFields.has(t)?(e=this._parsedFields.get(t),this._isNeedAppearances=!0):(i=void 0,(i=(n=this._fields[t])&&n instanceof m?this._crossReference._fetch(n):i)&&(e=this._parseFields(i,n),this._parsedFields.set(t,e),e)&&e instanceof Ve&&(e._annotationIndex=t)),e},u.prototype._getPageWidgetCollection=function(){this._pageWidgetReference=new Map;var t=this._crossReference._document;if(t)for(var e=0;e<t.pageCount;e++){var i=t.getPage(e);if(i&&i._pageDictionary){var n=[];if((n=i._pageDictionary.has("Annots")&&(n=i._pageDictionary.getRaw("Annots"))instanceof m?this._crossReference._fetch(n):n)&&Array.isArray(n))for(var r=0;r<n.length;r++){var s,a=n[r];a&&a instanceof m&&(s=this._crossReference._fetch(a))&&s.has("Subtype")&&s.get("Subtype")&&"Widget"===s.get("Subtype").name&&this._pageWidgetReference.set(a,s)}}}},u.prototype._getField=function(t){var i=this;if(!this._terminalFields||t<0||t>=this._terminalFields.length)return null;this._pageWidgetReference||this._getPageWidgetCollection();var n,r=this._terminalFields[t],s=r._reference,t=((this._dictionary?this._dictionary.get("Fields"):null)&&this._pageWidgetReference&&0<this._pageWidgetReference.size&&(n=!1,this._pageWidgetReference.forEach(function(t,e){n||r&&i._compareWidgets(t,r)&&(r.has("P")||(r=t,i._fieldsMap&&i._fieldsMap.has(t)&&(s=i._fieldsMap.get(t))),n=!0)})),this._parseFields(r,s));return t&&(t._form=this),t},u.prototype._getFieldFromDictionary=function(t){var i,n=this,r=(this._pageWidgetReference||this._getPageWidgetCollection(),t),s=r._reference,t=((this._dictionary?this._dictionary.get("Fields"):null)&&this._pageWidgetReference&&0<this._pageWidgetReference.size&&(i=!1,this._pageWidgetReference.forEach(function(t,e){i||r&&n._compareWidgets(t,r)&&(r.has("P")||(r=t,n._fieldsMap&&n._fieldsMap.has(t)&&(s=n._fieldsMap.get(t))),i=!0)})),this._parseFields(r,s));return t&&(t._form=this),t},u.prototype._parseFields=function(t,e){var i;if(t){var n=Ds(t,"FT",!1,!0,"Parent"),r=0,s=Ds(t,"Ff",!1,!0,"Parent");if(void 0!==s&&(r=s),n)switch(n.name.toLowerCase()){case"tx":i=Ue._load(this,t,this._crossReference,e);break;case"btn":i=(0!=(r&M._FieldFlag.pushButton)?qe:0!=(r&M._FieldFlag.radio)?Qe:Xe)._load(this,t,this._crossReference,e);break;case"ch":i=(0!=(r&M._FieldFlag.combo)?ni:ai)._load(this,t,this._crossReference,e);break;case"sig":i=ci._load(this,t,this._crossReference,e)}}return i},u.prototype.add=function(e){if(L.initializeTelemetryFeature("AcroForm","PDFLibrary"),0<this._fields.length){var t,i=this._getFields().find(function(t){return t.name===e.name});if(i&&this._fieldAutoNaming)return t=this._getCorrectName(e._name),e._name=t,e._dictionary.update("T",t),this._fieldName.push(e._name),this._doAdd(e);if(i&&(i instanceof ci&&(i._isLoaded||i._crossReference._document._isLoaded)||!(i instanceof ci))&&this._checkType(i,e))return this._fieldName.push(e._name),this._groupingFormFields(e,i)}return this._requiresPostProcessing=!0,this._fieldName.push(e._name),this._doAdd(e)},u.prototype._doAdd=function(t){return-1===this._fields.indexOf(t._ref)&&(this._fields.push(t._ref),this._dictionary.update("Fields",this._fields),this._parsedFields.set(this._fields.length-1,t),(t._form=this)._crossReference._root._updated=!0,t instanceof ci&&(t._form._signatureFlag=M._SignatureFlag.signatureExists|M._SignatureFlag.appendOnly),this._isNeedAppearances=!0),this._fields.length-1},u.prototype._groupingFormFields=function(t,e){var i,n,r,s,a;if(e._name===t._name&&(e.flatten||t.flatten)&&(t.flatten=!0,e.flatten=!0),t instanceof Qe&&e instanceof Qe){var o=e._dictionary,o=(o&&o.has("Opt")&&delete o._map.Opt,[]),h=(o.push(e),o.push(t),0),c=-1;if(o.forEach(function(t){var e;0<=t.selectedIndex&&(e=h+t.selectedIndex,c<e)&&(c=e),h+=t._kids.length}),e._kids.length!==e._parsedItems.size)for(var _=0;_<e._kids.length;_++){var d=e._parsedItems.get(_);d&&d.value===e.itemAt(_).value||e._parsedItems.set(_,e.itemAt(_))}if(0<t._dictionary.get("Kids").length){for(var l=e._dictionary.get("Kids"),u=e.itemsCount,p=0;p<t.itemsCount;p++){(f=t.itemAt(p)._dictionary)&&f.has("Parent")&&delete f._map.Parent,f.set("Parent",e._ref),t.itemAt(p)._field=e,t.itemAt(p)._index=u++,h++;var f,g=t.itemAt(p)._ref;l.push(g)}e._dictionary.update("Kids",l),e._dictionary._updated=!0}e.allowUnisonSelection=t.allowUnisonSelection;for(var y=e._parsedItems.size,_=0;_<t.itemsCount;_++)e._parsedItems.set(y,t.itemAt(_)),y++;t.allowUnisonSelection||this._addItemsToOptionsArray(e),0<o.length&&0<=c&&c<h&&(o[0].selectedIndex=c)}else(f=t.itemAt(0)._dictionary)&&f.has("Parent")&&delete f._map.Parent,t.itemAt(0)._dictionary.set("Parent",e._ref),g=t.itemAt(0)._ref,(l=e._dictionary.get("Kids"))&&0<l.length?(l.push(g),e._dictionary.update("Kids",l),e._dictionary._updated=!0):this._updateFieldsKids(e,t),t instanceof Xe&&e instanceof Xe?(o=void 0,(i=t.itemAt(0))&&"string"==typeof i.exportValue&&(o=i.exportValue),n=e.itemsCount-1,e._parsedItems.set(n,i),i._field=e,i._index=n,!o&&""!==o||(r=0<=(n=this._findFirstByExportValue(e,o)),s=this._getSelectedExportValue(e),i.checked?r&&((a=e.itemAt(n))&&!a.checked&&(a._field._isUpdating=!1,a.checked=!0),i.checked)||(i.checked=!0):(s&&s===o||r&&(a=e.itemAt(n))&&a.checked&&!i.checked)&&(i.checked=!0))):t instanceof qe&&e instanceof qe&&(e._setAppearance||(e._setAppearance=!0));return this._fields.length-1},u.prototype._findFirstByExportValue=function(t,e){if(t&&!(t.itemsCount<=0)&&null!=e)for(var i=0;i<t.itemsCount;i++){var n=t.itemAt(i);if(n&&n.exportValue===e)return i}return-1},u.prototype._getSelectedExportValue=function(t){var e,i;if(t){t._dictionary&&t._dictionary.has("V")&&(i=t._dictionary.get("V"))&&"string"==typeof i.name&&(e=i.name);for(var n=0;n<t.itemsCount;n++){var r=t.itemAt(n);r&&r.checked&&(e=r.exportValue)}return e}},u.prototype._updateFieldsKids=function(t,e){var i=t._dictionary,n=new D(this._crossReference),r=this._crossReference._getNextReference(),s=(["FT","T","V","Ff","Opt","I","TU"].forEach(function(t){i.has(t)&&(n.update(t,i.get(t)),delete i._map[t])}),t._dictionary._updated=!0,i.set("Parent",r),e.itemAt(0)._dictionary.set("Parent",r),[]),e=(s.push(t._ref),e.itemAt(0)._ref);s.push(e),n.update("Kids",s),n._updated=!0,this._crossReference._cacheMap.set(r,n);e=this._crossReference._document._catalog._catalogDictionary.get("AcroForm").get("Fields"),s=e.indexOf(t._ref);-1!==s&&(e[s]=r),t._ref=r,t._dictionary=n,t._kids=n.get("Kids"),t._dictionary._updated=!0},u.prototype._addItemsToOptionsArray=function(t){for(var e=new Set,i=new Set,n=[],r=t,s=0;s<r.itemsCount;s++){var a=r.itemAt(s).value;n.push(a),(e.has(a)?i:e).add(a)}0<i.size&&t._dictionary.set("Opt",n)},u.prototype._getCorrectName=function(t){var e=t;return e=-1!==this._fieldName.indexOf(t)?t+"_"+this._generateUniqueIdentifier():e},u.prototype._generateUniqueIdentifier=function(){return Math.floor(1e4*Math.random()).toString()},u.prototype.removeField=function(t){t=this._fields.indexOf(t._ref);0<=t&&this.removeFieldAt(t)},u.prototype.removeFieldAt=function(t){var e=this.fieldAt(t);if(e){if(0<e._kidsCount)for(var i=e._kidsCount-1;0<=i;i--){var n=e.itemAt(i),r=void 0;n&&(r=n._getPage())&&r._removeAnnotation(n._ref)}else e._dictionary.has("Subtype")&&"Widget"===e._dictionary.get("Subtype").name&&(r=e.page)&&r._removeAnnotation(e._ref);this._parsedFields.delete(t),this._reorderParsedAnnotations(t)}this._fields.splice(t,1);var t=this._crossReference._document,s=t._catalog;0===this._fields.length&&t&&s&&s._catalogDictionary&&(s._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0),this._dictionary.set("Fields",this._fields),this._dictionary._updated=!0},u.prototype._reorderParsedAnnotations=function(i){var n=new Map;this._parsedFields.forEach(function(t,e){i<e?n.set(e-1,t):n.set(e,t)}),this._parsedFields=n},u.prototype.setDefaultAppearance=function(t){this._setAppearance=!t,this._needAppearances=t,this._isDefaultAppearance=t},u.prototype.orderFormFields=function(t){var i,n,r,s,a,o,h=this;null==t?this.orderFormFields(new Map):(n=this._crossReference._document,t&&t instanceof Map?(s=!0,0<t.size||(s=!1),this._tabCollection=t,a=new Map,this._fieldCollection=this._getFields(),k(this._fieldCollection)&&0<this._fieldCollection.length&&this._fieldCollection[0].page&&n&&(this._fieldCollection.forEach(function(t){var e;t.page&&0<=(e=ls(n,h._sortItemByPageIndex(t,!0)._pageDictionary))&&(a.has(e)?(r=a.get(e)).push(t):((r=[]).push(t),a.set(e,r)),t=n.getPage(e),h._tabCollection.has(e)||h._tabCollection.set(e,t.tabOrder),s)&&(t.tabOrder=h._tabCollection.get(e))}),o=0,a.forEach(function(t,e){h._tabOrder=h._tabCollection.get(e),h._tabOrder!==M.PdfFormFieldsTabOrder.structure&&((e=t).sort(function(t,e){return h._compareFields(t,e)}),e.forEach(function(t,e){var i,t=h._fieldCollection.indexOf(t);-1!==t&&t!==o+e&&(i=h._fieldCollection[t],h._fieldCollection.splice(t,1),h._fieldCollection.splice(o+e,0,i))})),o+=t.length}))):(this._tabOrder=t,i=this._getOrder(this._tabOrder),this._fieldCollection=this._getFields(),this._fieldCollection.sort(function(t,e){return h._compareFields(t,e)})),this._parsedFields.clear(),this._fieldCollection.forEach(function(t,e){h._parsedFields.set(e,t),h._fields[e]=t._ref,i&&t.page._pageDictionary.update("Tabs",i)}),this._dictionary.update("Fields",this._fields))},u.prototype._createFields=function(){for(var r=this,s=new Map,a=(this._dictionary&&this._dictionary.has("Fields")&&(_=this._dictionary.get("Fields")),0),o=[],h=[];_&&0<_.length;){for(var c=this;a<_.length;a++)!function(){var t,i=_[a],e=void 0,n=(i&&i instanceof m&&(e=c._crossReference._fetch(i))&&e instanceof D&&s.set(e,i),void 0);e&&e instanceof D&&e.has("Kids")&&(n=e.get("Kids"))&&0<n.length&&n.forEach(function(t){var e;t instanceof m&&(e=r._crossReference._fetch(t))&&(s.set(e,t),e.has("Parent")||e.update("Parent",i))}),n?!e.has("FT")||c._isNode(n)?(o.push({fields:_,count:a}),c._hasKids=!0,a=-1,_=n):(h.push(e),e.has("T")&&(t=e.get("T"),-1===c._formNames.indexOf(t))&&c._formNames.push(t)):e&&e instanceof D&&-1===h.indexOf(e)&&(h.push(e),e.has("T"))&&(t=e.get("T"),-1===c._formNames.indexOf(t))&&c._formNames.push(t)}();if(0===o.length)break;var t=o.pop(),_=t.fields,a=t.count+1}this._terminalFields=h,this._fieldsMap=s,this._createFieldCollection(h,s)},u.prototype._createFieldCollection=function(t,e){var i=new Map,n=this._crossReference._document,r=[];if(this._widgetDictionary=new Map,n)for(var s=0;s<n.pageCount;s++){var a=n.getPage(s);if(a&&a._pageDictionary){var a=a._pageDictionary,o=[],h=[];if((o=a&&a.has("Annots")&&(o=a.getRaw("Annots"))instanceof m?this._crossReference._fetch(o):o)&&Array.isArray(o)&&0<o.length){for(var c=0;c<o.length;c++){var _,d,l=o[c];l&&l instanceof m&&(r.push(l),_=this._crossReference._fetch(l))&&_.has("Subtype")&&"Widget"===_.get("Subtype").name&&(_._reference=l,_.has("T")&&(l=_.get("T"),-1===this._formNames.indexOf(l))&&l&&((d=this._widgetDictionary.get(l))||this._widgetDictionary.set(l,d=[]),d.push(_)),h.push(_))}i.set(s,h)}}}for(s=0;s<t.length;s++){var u=t[s],p=e.get(u);p&&this._removeInvalidFields(u,i,p,r)&&-1===this._fields.indexOf(p)&&this._fields.push(p)}0<t.length&&this._processRemainingWidgets(),this._createFormFieldsFromWidgets(t.length)},u.prototype._processRemainingWidgets=function(){for(var t=this._crossReference._document,e=0;e<t.pageCount;e++){var i=t.getPage(e);if(i&&i._pageDictionary){var i=i._pageDictionary,n=[];i.has("Annots")&&(n=i.getRaw("Annots"))instanceof m&&(n=this._crossReference._fetch(n));for(var r=0;r<n.length;r++){var s,a,o,h=n[r];h instanceof m&&-1===this._fields.indexOf(h)&&(s=this._crossReference._fetch(h))&&s.has("Subtype")&&s.get("Subtype")&&"Widget"===s.get("Subtype").name&&s.has("P")&&(s.has("Parent")?(o=void 0,(a=s.getRaw("Parent"))&&a instanceof m&&(o=this._crossReference._fetch(a))&&o.has("T")&&(o=o.get("T"),-1===this._formNames.indexOf(o))&&-1===this._fields.indexOf(a)&&this._fields.push(a)):s.has("FT")&&s.has("T")&&-1===this._formNames.indexOf(s.get("T"))&&this._fields.push(h))}}}},u.prototype._hasValidKids=function(t){t=t.get("Kids");return t&&0<t.length},u.prototype._removeInvalidFields=function(t,e,i,n){if(!t)return!1;if(t.has("Kids")&&this._hasValidKids(t)){this._isValidKids=!0;for(var r=t.get("Kids"),s=[],a=!1,o=0;o<r.length;o++){var h=void 0,c=r[o];if(c instanceof m?h=this._crossReference._fetch(c):c instanceof D&&(h=c),h){if(h.has("P")){var _=h.get("P"),d=void 0;if(_ instanceof m?d=this._crossReference._fetch(_):_ instanceof D&&(d=_),d&&d.has("Annots")){_=d.get("Annots");if((_=_ instanceof m?this._crossReference._fetch(_):_)&&Array.isArray(_))if(!(-1!==_.indexOf(c))){s.push(o);continue}}}this._removeInvalidFields(h,e,c,n)?a=!0:s.push(o)}else s.push(o)}for(o=s.length-1;0<=o;o--)r.splice(s[o],1);return this._isValidKids=!1,0<r.length&&a?(t.update("Kids",r),!0):!1}return this._validateField(t,e,i,n)},u.prototype._validateField=function(s,t,e,i){var a,o=this;return!(!s||!t)&&(!(!s.has("P")||!s.has("Rect"))||!(!i||-1===i.indexOf(e))||(a=!1,t.forEach(function(t,e){if(t&&0<t.length)for(var i=0;i<t.length;i++){var n,r=t[i];if(r&&o._compareWidgets(r,s)){if(o._isValidKids)return a=!0,void(s.has("P")||r.has("P")||(n=r._crossReference._document.getPage(e),s.update("P",n._ref)));if(-1===o._fields.indexOf(r._reference))return r.has("FT")&&r.has("Type")&&"Annot"===r.get("Type").name&&r.has("Subtype")&&"Widget"===r.get("Subtype").name&&!r.has("P")&&(n=r._crossReference._document.getPage(e),r.update("P",n._ref)),void o._fields.push(r._reference)}}}),a))},u.prototype._compareWidgets=function(t,e){var i,n,r,s,a,o,h,c,_,d,l,u,p=!1;return t&&e&&((i=t.size)!==(n=e.size)&&i+1!==n&&i!==n+1||(i=t.get("FT"),n=e.get("FT"),i&&n&&i.name===n.name?(r=t.get("T"),s=e.get("T"),r&&s&&r===s&&(r=t.get("V"),s=e.get("V"),r&&s&&r===s?p=!0:t.has("Parent")&&e.has("Parent")?(r=t.getRaw("Parent"),s=e.getRaw("Parent"),r&&s&&r===s&&(p=!0)):t.has("TU")&&e.has("TU")?(a=t.get("TU"),o=e.get("TU"),a&&o&&a===o&&(p=!0)):t.has("Rect")&&e.has("Rect")&&(h=t.get("Rect"),c=e.get("Rect"),Array.isArray(h))&&Array.isArray(c)&&h.length===c.length&&(_=h[0],d=c[0],l=h[1],u=c[1],"number"==typeof _)&&"number"==typeof d&&"number"==typeof l&&"number"==typeof u&&_===d&&l===u&&(p=!0))):i||n||(t.has("TU")&&e.has("TU")&&(a=t.get("TU"),o=e.get("TU"),p=!(!a||!o||a!==o)),t.has("Rect")&&e.has("Rect")&&(h=t.get("Rect"),c=e.get("Rect"),Array.isArray(h))&&Array.isArray(c)&&h.length===c.length&&(_=h[0],d=c[0],l=h[1],u=c[1],"number"==typeof _)&&"number"==typeof d&&"number"==typeof l&&"number"==typeof u&&(p=_===d&&l===u)))),p},u.prototype._createFormFieldsFromWidgets=function(t){this._terminalFields&&(this._processTerminalFields(t),this._processWidgetDictionary())},u.prototype._processTerminalFields=function(t){for(var e=t;e<this._terminalFields.length;e++){var i,n=this.fieldAt(e);n&&((i=n.name)&&!this._addedFieldNames.has(i)?(this._doAdd(n),this._addedFieldNames.add(i)):i||this._doAdd(n))}},u.prototype._processWidgetDictionary=function(){var e=this;this._widgetDictionary&&this._widgetDictionary.forEach(function(t){t&&0!==t.length&&(1<t.length?e._processMultipleWidgets(t):e._processSingleWidget(t[0]))})},u.prototype._processMultipleWidgets=function(t){for(var e=t[0],e=this._getFieldFromDictionary(e),i=(e&&(this._terminalFields.push(e._dictionary),this._doAdd(e)),e instanceof Qe?e:void 0),n=1;n<t.length;n++){var r=t[n],r=this._getFieldFromDictionary(r);r&&(i&&r instanceof Qe&&this._mergeRadioButtonItems(i,r),r.name&&this._handleFieldNaming(r),this._terminalFields.push(r._dictionary),this._doAdd(r))}},u.prototype._mergeRadioButtonItems=function(t,e){for(var i=0;i<e.itemsCount;i++){var n,r=e.itemAt(i);r&&(n=t._parsedItems.size,t._parsedItems.set(n,r))}},u.prototype._handleFieldNaming=function(t){this._validFieldName(t)?this._fieldName.push(t.name):t._dictionary.update("T",this._getCorrectName(t.name))},u.prototype._processSingleWidget=function(t){t&&(-1===this._terminalFields.indexOf(t)&&this._terminalFields.push(t),t=0<=(t=this._terminalFields.length-1)?this._getField(t):void 0)&&this._doAdd(t)},u.prototype._validFieldName=function(t){return-1===this._fieldName.indexOf(t.name)},u.prototype._isNode=function(t){var e,i=!1;return i=k(t)&&0<t.length&&(e=void 0,k(t=t[0])&&(t instanceof D?e=t:t instanceof m&&(e=this._crossReference._fetch(t))),e)&&e.has("Subtype")&&(t=e.get("Subtype"))&&"Widget"!==t.name?!0:i},u.prototype._parseWidgetReferences=function(){var i=this;return void 0===this._widgetReferences&&0<this.count&&(this._widgetReferences=[],this._fields.forEach(function(t){var e=i._crossReference._fetch(t);e&&(e.has("Kids")?(e=e.get("Kids"))&&0<e.length&&e.forEach(function(t){var e;t&&t instanceof D?e=t:t&&t instanceof m&&(e=i._crossReference._fetch(t)),e&&e.has("Subtype")&&(e=e.get("Subtype"))&&"Widget"===e.name&&i._widgetReferences.push(t)}):i._widgetReferences.push(t))})),this._widgetReferences},u.prototype._doPostProcess=function(t,e){for(var i=this.count-1;0<=i;i--){var n=this.fieldAt(i);if(n&&!n._isLoaded&&void 0!==n._tabIndex&&0<=n._tabIndex){var r=n._page;if(r&&r._pageDictionary.has("Annots")&&(r.tabOrder===M.PdfFormFieldsTabOrder.manual||this._tabOrder===M.PdfFormFieldsTabOrder.manual)){var s=r._pageDictionary.get("Annots"),a=new cr(s,this._crossReference,r);r._annotations=a;for(var o=0;o<n.itemsCount;o++){var h=n.itemAt(o);h&&h instanceof jn&&0<=(h=(h=s.indexOf(h._ref))<0?n._annotationIndex:h)&&(h=r.annotations._reArrange(n._ref,n._tabIndex,h),r._pageDictionary.update("Annots",h),r._pageDictionary._updated=!0)}}}n&&(e&&n.page===e||!e)&&(e&&(n._isImport=!0),n._doPostProcess(t||n.flatten),!t&&n.flatten||t&&e&&n.page===e)&&this.removeFieldAt(i)}},u.prototype._getFieldIndex=function(t){var e=-1;if(0<this.count){this._fieldNames||(this._fieldNames=[]),this._indexedFieldNames||(this._indexedFieldNames=[]),this._actualFieldNames||(this._actualFieldNames=[]),this._indexedActualFieldNames||(this._indexedActualFieldNames=[]);for(var i=0;i<this.count;i++){var n,r=this.fieldAt(i);r&&((n=r.name)&&(this._fieldNames.push(n),this._indexedFieldNames.push(n.split("[")[0])),n=r.actualName)&&(this._actualFieldNames.push(n),this._indexedActualFieldNames.push(n.split("[")[0]))}var s=this._fieldNames.indexOf(t);-1===s&&-1===(s=this._indexedFieldNames.indexOf(t))&&-1===(s=this._actualFieldNames.indexOf(t))&&-1===(s=this._indexedActualFieldNames.indexOf(t))||(e=s)}return e},u.prototype._getFields=function(){for(var t=[],e=0;e<this._fields.length;e++){var i=this.fieldAt(e);i&&i instanceof Ve&&t.push(i)}return t},u.prototype._getOrder=function(t){var e;return t!==M.PdfFormFieldsTabOrder.none?(e="",t===M.PdfFormFieldsTabOrder.row?e="R":t===M.PdfFormFieldsTabOrder.column?e="C":t===M.PdfFormFieldsTabOrder.structure&&(e="S"),R.get(e)):null},u.prototype._compareFields=function(t,e){var i,n,r,s,a,o,h,c=0,_=t.page,d=e.page,l=_.rotation;return _&&!_._isNew&&_ instanceof br&&d&&!d._isNew&&d instanceof br&&(_=this._sortItemByPageIndex(t,!1)._pageIndex,d=this._sortItemByPageIndex(e,!1)._pageIndex,n=void 0,n=t._dictionary.has("Kids")?this._getItemRectangle(t):this._getRectangle(t._dictionary),s=void 0,s=e._dictionary.has("Kids")?this._getItemRectangle(e):this._getRectangle(e._dictionary),o=n[3]-n[1],h=s[3]-s[1],n)&&2<=n.length&&s&&2<=s.length&&(i=n[0],n=n[1],r=s[0],s=s[1],"number"==typeof i)&&"number"==typeof r&&"number"==typeof n&&"number"==typeof s&&(_=_-d,this._tabOrder===M.PdfFormFieldsTabOrder.row?l===M.PdfRotationAngle.angle0?(0!==(a=this._compare(s,n))&&(-1===a&&s<n&&n-o/2<s||1===a&&n<s&&s-h/2<n)&&(a=0),c=0!=_?_:0!==a?a:this._compare(i,r)):l===M.PdfRotationAngle.angle270&&(d=Math.abs(i-r),c=0!=_?_:d<=2?this._compare(s,n):this._compare(r,i)):this._tabOrder===M.PdfFormFieldsTabOrder.column?(a=this._compare(i,r),c=0!=_?_:0!==a?a:this._compare(s,n)):this._tabOrder!==M.PdfFormFieldsTabOrder.manual&&this._tabOrder!==M.PdfFormFieldsTabOrder.none&&this._tabOrder!==M.PdfFormFieldsTabOrder.structure&&this._tabOrder!==M.PdfFormFieldsTabOrder.widget||t instanceof Ve&&e instanceof Ve&&(o=t.tabIndex,h=e.tabIndex,a=this._compare(o,h),c=0!=_?_:a)),c},u.prototype._getRectangle=function(t){var e;return e=t&&t.has("Rect")?t.getArray("Rect"):e},u.prototype._getItemRectangle=function(t){var e,i=t._dictionary;if(i.has("Kids")||(e=this._getRectangle(i)),i.has("Kids")){var n=i.getArray("Kids");if(n&&0!==n.length||(e=this._getRectangle(i)),k(n)&&1<=n.length)if(1===n.length)e=this._getRectangle(n[0]);else{if(!(t&&1<t.itemsCount)){for(var r=i.getArray("Kids"),s=Number.MAX_VALUE,a=Number.MIN_VALUE,o=Number.MIN_VALUE,h=Number.MAX_VALUE,c=!1,_=0;_<r.length;_++){var d=void 0;(d=t&&t.itemsCount>_&&t.itemAt(_)?this._getRectangle(t.itemAt(_)._dictionary):this._getRectangle(r[_]))&&4===d.length&&(c=!0,s=Math.min(s,d[0]),h=Math.min(h,d[1]),o=Math.max(o,d[2]),a=Math.max(a,d[3]))}return c?[s,h,o,a]:this._getRectangle(i)}e=this._getRectangle(t.itemAt(0)._dictionary)}}return e},u.prototype._compare=function(t,e){return e<t?1:t<e?-1:0},u.prototype._compareKidsElement=function(t,e){t=this._crossReference._fetch(t),e=this._crossReference._fetch(e),t=this._getRectangle(t),e=this._getRectangle(e);if(t&&2<=t.length&&e&&2<=e.length){var i,n,r=t[0],t=t[1],s=e[0],e=e[1];if("number"==typeof r&&"number"==typeof s&&"number"==typeof t&&"number"==typeof e)return i=void 0,this._tabOrder===M.PdfFormFieldsTabOrder.row?0!==(i=this._compare(e,t))?i:this._compare(r,s):this._tabOrder===M.PdfFormFieldsTabOrder.column?0!==(i=this._compare(r,s))?i:this._compare(e,t):0}return n},u.prototype._sortItemByPageIndex=function(t,e){var i=t.page,n=this._tabOrder;return this._tabOrder=e?t.page.tabOrder:n,this._sortFieldItems(t),t._isLoaded&&1<t._kidsCount&&(i=t.itemAt(0).page),this._tabOrder=n,i=void 0===i?t.page:i},u.prototype._sortFieldItems=function(i){var t,n=this;i._isLoaded&&(i instanceof Ue||i instanceof ai||i instanceof Xe||i instanceof Qe)&&((t=i._parseItems()).sort(function(t,e){return n._compareFieldItem(t,e)}),i._parsedItems.clear(),t.forEach(function(t,e){i._parsedItems.set(e,t)}))},u.prototype._compareFieldItem=function(t,e){var i,n,r,s,a,o=0;return void 0!==t&&void 0!==e&&(i=t.page,n=e.page,t=this._getRectangle(t._dictionary),e=this._getRectangle(e._dictionary),t)&&e&&(r=t[0],t=t[1],s=e[0],e=e[1],a=void 0,this._tabOrder===M.PdfFormFieldsTabOrder.row?o=0!==(a=this._compare(i._pageIndex,n._pageIndex))||0!==(a=this._compare(e,t))?a:this._compare(r,s):this._tabOrder===M.PdfFormFieldsTabOrder.column&&(o=0!==(a=this._compare(i._pageIndex,n._pageIndex))||0!==(a=this._compare(r,s))?a:this._compare(e,t))),o},u.prototype._clear=function(){this._fields=[],this._parsedFields=new Map},u.prototype._checkType=function(t,e){return t instanceof Ue&&e instanceof Ue||t instanceof qe&&e instanceof qe||t instanceof Xe&&e instanceof Xe||t instanceof ni&&e instanceof ni||t instanceof ai&&e instanceof ai||t instanceof Qe&&e instanceof Qe||t instanceof ci&&e instanceof ci};var dd=u;function u(t,e){this._isDefaultAppearance=!1,this._hasKids=!1,this._setAppearance=!1,this._exportEmptyFields=!1,this._fieldCollection=[],this._signFlag=M._SignatureFlag.none,this._isNeedAppearances=!1,this._formNames=[],this._fieldAutoNaming=!1,this._fieldName=[],this._fontCache=new Map,this._requiresPostProcessing=!1,this._isValidKids=!1,this._dictionary=t,this._crossReference=e,this._parsedFields=new Map,this._fields=[],this._addedFieldNames=new Set,this._createFields()}ld=function(t,e){return(ld=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}ld(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(fd,ud=X),fd.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._exportAnnotationData(t,t.pageCount),this._save()},fd.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._key=ia(),this._save()},fd.prototype._save=function(){var n=this,e=0,r=[];if(!this._isAnnotationExport){this._asPerSpecification?(this.fdfString+="%FDF-1.2\n%"+this._specialCharacters+"\r\n1 0 obj\r<</FDF<</F(",this.fdfString+=this._fileName+")",this.fdfString+="/Fields["):this.fdfString+="%FDF-1.2\n";var t=this._document.form;if(null!=t){this._exportEmptyFields=t.exportEmptyFields;for(var i=this._document.form.count,s=this,a=0;a<i;a++)!function(t){var t=s._document.form.fieldAt(t),i=s._exportFormFieldsData(t);(t instanceof Ue||t instanceof ai||t instanceof ni||t instanceof Qe||t instanceof Xe)&&e++,s._asPerSpecification?t instanceof Ue||t instanceof ai||t instanceof ni?(r.push(e),s.fdfString+="<</T("+t.name+")/V","string"==typeof i||Array.isArray(i)&&1===i.length?s.fdfString+="("+(Array.isArray(i)?i[0]:i)+")":Array.isArray(i)&&(s.fdfString+="[",i.forEach(function(t,e){n.fdfString+="("+t+")",e!==i.length-1&&(n.fdfString+=" ")}),s.fdfString+="]"),s.fdfString+=">>"):(t instanceof Qe||t instanceof Xe)&&(r.push(e),s.fdfString+="<</T("+t.name+")/V/"+i+">>"):t instanceof Ue||t instanceof ai||t instanceof ni?(r.push(e),s.fdfString+=e+" 0 obj<</T <"+s._stringToHexString(t.name)+"> /V ","string"==typeof i||Array.isArray(i)&&1===i.length?s.fdfString+="<"+s._stringToHexString(Array.isArray(i)?i[0]:i)+">":Array.isArray(i)&&(s.fdfString+="[",i.forEach(function(t,e){n.fdfString+="<"+n._stringToHexString(t)+">",e!==i.length-1&&(n.fdfString+=" ")}),s.fdfString+="]"),s.fdfString+=" >>endobj\n"):(t instanceof Qe||t instanceof Xe)&&(r.push(e),s.fdfString+=e+" 0 obj<</T <"+s._stringToHexString(t.name)+"> /V /",s.fdfString+=i+" >>endobj\n")}(a)}if(this._asPerSpecification)this.fdfString+="]",this.fdfString+="/ID[]/UF("+this._fileName+")>>/Type/Catalog>>\rendobj\rtrailer\r\n<</Root 1 0 R>>\r\n",this.fdfString+="%%EOF\r\n";else{this.fdfString+=this._table.size+1+" 0 obj<</F <"+this._stringToHexString(this._fileName)+"> /Fields [";for(a=0;a<this._table.size;a++){var o=this._document.form.fieldAt(a);null!=o&&o.export&&(this.fdfString+=r[a]+" 0 R ")}this.fdfString+="]>>endobj\n",this.fdfString+=r.length+2+" 0 obj<</Version /1.4 /FDF "+(r.length+1)+" 0 R>>endobj\n",this.fdfString+="trailer\n<</Root "+(r.length+2)+" 0 R>>"}}var t=new ArrayBuffer(+this.fdfString.length),h=new Uint8Array(t);return h.forEach(function(t,e){h[e]=n.fdfString.charCodeAt(e)}),h},fd.prototype._importAnnotations=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._checkFdf(vs(e));t=new g(e),this._isAnnotationImport=!0,e=new h_(new a_(t,!0,this._isAnnotationImport),null,!0,!1);this._readFdfData(e),k(this._annotationObjects)&&0<this._annotationObjects.size&&this._annotationObjects.clear(),k(this._table)&&0<this._table.size&&this._table.clear()},fd.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._checkFdf(vs(e));t=new g(e),e=new h_(new a_(t,!0,this._isAnnotationExport),null,!1,!1);this._readFdfData(e)},fd.prototype._readFdfData=function(t){var e,i,c=this,n=t.getObject();if(this._isAnnotationImport){for(var r="";null!=n&&"EOF"!==n;)n instanceof D||n instanceof g||n instanceof Uh||n instanceof R||Array.isArray(n)?(this._table.set(r,n),r=""):null!==n&&Number.isInteger(n)&&0!==n?0<=t.first&&(r=n.toString()+" "+t.first.toString()):n instanceof nh&&null!==n.command&&void 0!==n.command&&"trailer"===n.command&&(r=n.command),n=t.getObject();this._annotationObjects=this._parseAnnotationData(),this._annotationObjects.forEach(function(t,e){var i,n,r,s,a,o,h;c._parseDictionary(t),t._crossReference=c._crossReference,t._updated=!0,t&&t.has("Page")&&null!=(n=t.get("Page"))&&n<c._document.pageCount&&(i=(n=c._document.getPage(n))._pageDictionary)&&null!=(r=(n=n.annotations)._parseAnnotation(t))&&(r._isImported=!0,s=c._crossReference._getNextReference(),c._crossReference._cacheMap.set(s,t),(t.has("NM")||t.has("IRT"))&&c._addReferenceToGroup(s,t),r._ref=s,h=n._annotations.length,r._dictionary.has("P")||"Popup"===r._dictionary.get("Subtype").name||(a=(o=i.objId.split(" ").map(Number))[0],o=o[1],r._dictionary.update("P",m.get(a,o))),delete r._dictionary._map.Page,n._annotations.push(s),n._comments&&0<n._comments.length&&(n._comments=[]),i.set("Annots",n._annotations),i._updated=!0,n._parsedAnnotations.set(h,r),c._handlePopup(n,s,t,i),r instanceof Qi)&&r._dictionary.has("Parent")&&(a=r._dictionary.getRaw("Parent"))&&a instanceof m&&(o=c._crossReference._cacheMap.get(a))&&o instanceof D&&o.has("Popup")&&(h=o.get("Popup"))instanceof D&&h.has("Parent")&&o.update("Popup",s)}),this._groupHolders&&0<this._groupHolders.length&&this._groupHolders.forEach(function(t){var e;t&&t.has("IRT")&&(e=t.get("IRT"))&&(c._groupReferences&&c._groupReferences.has(e)?t.update("IRT",c._groupReferences.get(e)):delete t._map.IRT)}),this._groupHolders=[],this._groupReferences=new Map}else{if(n=t.getObject(),this._asPerSpecification)for(;null!=n&&"EOF"!==n;)n instanceof D&&null!==n&&null!==n._map.FDF&&void 0!==n._map.FDF&&(n=n._map.FDF)instanceof D&&null!==n._map.Fields&&void 0!==n._map.Fields&&null!=(n=n._map.Fields)&&n.forEach(function(t){var e,i;t instanceof D&&null!=t&&(e=t.getArray("T"),i=void 0,i=t._map&&t._map.V instanceof R?t.get("V").name:t.getArray("V"),null!=e)&&0<e.length&&c._table.set(e,i)}),n=t.getObject();else for((n=t.getObject())instanceof nh&&null!==n.command&&(n=n.command);null!=n&&"EOF"!==n;)n instanceof D&&(e=n.getArray("T"),i=void 0,i=n._map&&n._map.V instanceof R?n.get("V").name:n.getArray("V"),null!=e)&&0<e.length&&this._table.set(e,i),n=t.getObject();this._importField()}},fd.prototype._parseDictionary=function(i){var n=this;null!=i&&0<i.size&&i.forEach(function(t,e){"Parent"!==t&&"P"!==t&&"Page"!==t&&n._parseDictionaryData(i,t)})},fd.prototype._parseDictionaryData=function(t,e){var i,n,r,s=t.get(e);s instanceof D?this._parseDictionary(s):s instanceof Uh?this._parseDictionary(s.dictionary):Array.isArray(s)?this._parseArray(s):s instanceof m&&s&&(s=s.objectNumber+" "+s.generationNumber,this._annotationObjects.has(s)?t.update(e,this._annotationObjects.get(s)):this._table.has(s)?(n=(i=this._table).get(s))instanceof g||n instanceof Uh?(this._parseDictionary(n.dictionary),r=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(r,n),n.dictionary._updated=!0,t.update(e,r),i.set(s,r)):n instanceof D?(this._parseDictionary(n),r=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(r,n),t.update(e,r),i.set(s,r)):n instanceof m?t.update(e,n):n instanceof R?(r=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(r,n),t.update(e,r),i.set(s,r)):Array.isArray(n)&&(this._parseArray(n),r=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(r,n),t.update(e,r),i.set(s,r)):delete t._map[e.toString()])},fd.prototype._parseArray=function(t){if(Array.isArray(t)&&0<t.length)for(var e=t.length,i=0;i<e;i++){var n,r,s,a=t[Number.parseInt(i.toString(),10)];a&&a instanceof m&&(a=a.objectNumber+" "+a.generationNumber,this._annotationObjects.has(a)?t[Number.parseInt(i.toString(),10)]=this._annotationObjects.get(a):this._table.has(a)&&((r=(n=this._table).get(a))instanceof m?t[Number.parseInt(i.toString(),10)]=r:(r instanceof D||r instanceof g)&&(s=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(s,r),t[Number.parseInt(i.toString(),10)]=s,n.set(a,s))))}},fd.prototype._parseAnnotationData=function(){var t=new Map,e=new Map;if(null!=(t=this._table)&&0<t.size&&t.has("trailer")){var i=t.get("trailer");if(i instanceof D&&null!=i&&i.has("Root")){i=i.getRaw("Root");if(null!=i){i=i.objectNumber.toString()+" "+i.generationNumber.toString();if(t.has(i)){var n=t.get(i);if(null!=n&&n.has("FDF")){n=n.get("FDF");if(null!=n&&n.has("Annots"))for(var r=0,s=n.get("Annots")||[];r<s.length;r++){var a=s[r],o=a.objectNumber+" "+a.generationNumber,h=t.get(o);if(h){if(h instanceof D&&h.has("Parent")&&h.has("Subtype")){var c=h.get("Subtype"),_=h._get("Parent");if("Popup"===c.name&&_.objectNumber===a.objectNumber)continue}e.set(o,h)}t.delete(o)}}}t.delete(i)}}t.delete("trailer")}return e},fd.prototype._importField=function(){var n=this,r=this._document.form,s=r.count;s&&this._table.forEach(function(t,e){0<n._table.size&&n._table.has(e)&&(i=n._table.get(e));var i,e=r._getFieldIndex(e);-1!==e&&e<s&&(e=r.fieldAt(e))&&(i&&""!==i&&e._dictionary.update("RV",i),i=[],Array.isArray(t)?i=t:i.push(t),n._importFieldData(e,i))})},fd.prototype._exportAnnotationData=function(t,e){for(var i=Tt._whiteSpace+"0"+Tt._whiteSpace,n=(this.fdfString+="%FDF-1.2\r\n",2),r=new Array,s=this.exportAppearance,a=0;a<e;a++){var o=t.getPage(a);if(null!=o&&0<o.annotations.count)for(var h=0;h<o.annotations.count;h++){var c=o.annotations.at(h);null==c||c instanceof tn||c instanceof _n||c instanceof on||c instanceof Qi&&c._dictionary.has("Parent")||(r=(n=(c=c instanceof An||c instanceof Mi?this._exportAnnotation(c,this.fdfString,n,r,a,!0):this._exportAnnotation(c,this.fdfString,n,r,a,s)).index,c.annot))}}if(2!==n){var _="1"+i;this.fdfString+=_+"obj\r\n<</FDF<</Annots[";for(a=0;a<r.length-1;a++)this.fdfString+=r[a]+i+"R ";this.fdfString+=r[r.length-1]+i+"R]/F("+this._fileName+")/UF(",this.fdfString+=this._fileName+")>>/Type/Catalog>>\r\nendobj\r\n",this.fdfString+="trailer\r\n<</Root "+_+"R>>\r\n%%EOF\r\n"}},fd.prototype._exportAnnotation=function(t,e,s,a,o,h){this.fdfString=e;for(var e=new yd,c=t._dictionary,_=Tt._whiteSpace+"0"+Tt._whiteSpace+"obj\r\n",d="\r\nendobj\r\n",l=(this._annotationID=s.toString(),this.fdfString+=s+_+"<<",new Map),u=new Array,t=(a.push(this._annotationID),c.set("Page",o),this._getEntries(l,u,s,c,this.fdfString,h)),p=(s=t.index,l=t.list,u=t.streamReference,delete c._map.Page,this.fdfString+=">>"+d,this);0<l.size;)!function(){var i=Array();l.forEach(function(t,e){i.push(e)});for(var t=0;t<i.length;t++){var e,n,r=i[t];l.get(r)instanceof D||l.get(r)instanceof g||l.get(r)instanceof Sh||l.get(r)instanceof Uh?null!=(c=l.get(r)instanceof D?l.get(r):l.get(r).dictionary)&&(c instanceof D&&c.has("Type")&&null!=(n=c.get("Type"))&&"Annot"===n.name&&(a.push(r.toString()),c.set("Page",o)),p.fdfString+=r+_+"<<",n=p._getEntries(l,u,s,c,p.fdfString,h),l=n.list,u=n.streamReference,s=n.index,c instanceof D&&c.has("Page")&&delete c._map.Page,p.fdfString+=">>",null!=u&&-1!==u.indexOf(r)&&p._appendStream(l.get(r),p.fdfString),p.fdfString+=d):l.get(r)instanceof R?(p.fdfString+=r+_,p.fdfString+="/"+l.get(r).name,p.fdfString+=d):Array.isArray(l.get(r))?(p.fdfString+=r+_,e=l.get(r),n=p._appendArray(e,p.fdfString,s,h,l,u),s=n.index,p.fdfString+=d):"boolean"==typeof l.get(r)?(p.fdfString+=r+_,p.fdfString+=" "+(l.get(r)?"true":"false"),p.fdfString+=d):"string"==typeof l.get(r)&&(p.fdfString+=r+_,p.fdfString+="("+p._getFormattedString(l.get(r))+")",p.fdfString+=d),l.delete(r)}}();return s++,e.index=s,e.annot=a,e},fd.prototype._appendStream=function(t,e){var i,n,r=t;this.fdfString=e,(t instanceof Uh||t instanceof g||t instanceof Sh)&&(r=t instanceof Uh?t.stream:t),(t instanceof Uh||t instanceof g||t instanceof Sh)&&(i=n=e=void 0,n=t instanceof Sh?r.getString():t instanceof Uh||t instanceof g?(e=r.getByteRange(r.start,r.end),vs(i=new Uint8Array(e))):(e=r.getBytes(),i=new Uint8Array(e),(t=new O.CompressedStreamWriter).write(i,0,i.length),t.close(),t.getCompressedString),this.fdfString+="stream\r\n",this.fdfString+=n,this.fdfString+="\r\nendstream")},fd.prototype._getEntries=function(t,n,r,s,e,a){var o=this,h=!1,i=new yd,c=(this.fdfString=e,t);return s.forEach(function(t,e){var i;!a&&"AP"===t||("P"!==t&&(o.fdfString+="/"+t),"Sound"!==t&&"F"!==t&&!a||(h=!0),"string"==typeof(e=e)?o.fdfString+="("+o._getFormattedString(e)+")":e instanceof R?o.fdfString+="/"+e.name:e instanceof Array?(i=o._appendArray(e,o.fdfString,r,h,c,n),c=i.list,n=i.streamReference,r=i.index):"number"==typeof e?o.fdfString+=" "+e.toString():"boolean"==typeof e?o.fdfString+=" "+(e?"true":"false"):e instanceof D?(o.fdfString+="<<",i=o._getEntries(c,n,r,e,o.fdfString,a),c=i.list,n=i.streamReference,r=i.index,o.fdfString+=">>"):e instanceof m&&(i=s.get("Page"),"Parent"===t?(o.fdfString+=" "+o._annotationID+" 0 R",o.fdfString+="/Page "+i):"IRT"===t?o._crossReference&&o._crossReference._fetch&&e&&(i=o._crossReference._fetch(e))&&i.has("NM")&&null!=(i=i.get("NM"))&&(o.fdfString+="("+o._getFormattedString(i)+")"):"P"!==t&&null!=e&&(r++,o.fdfString+=" "+r+" 0 R",h&&n.push(r),s._crossReference||s.assignXref(o._crossReference),c.set(r,s.get(t)))),h=!1)}),i.list=c,i.streamReference=n,i.index=r,i},fd.prototype._appendArray=function(t,e,i,n,r,s){this.fdfString=e,this.fdfString+="[";var e=new yd,a=r;if(k(t)&&0<t.length)for(var o=t.length,h=0;h<o;h++){var c=t[h],c=(0!==h&&("number"==typeof c||c instanceof m||"boolean"==typeof c)&&(this.fdfString+=" "),this._appendElement(c,this.fdfString,i,n,a,s)),a=c.list;s=c.streamReference,i=c.index}return this.fdfString+="]",e.list=a,e.streamReference=s,e.index=i,e},fd.prototype._appendElement=function(t,e,i,n,r,s){this.fdfString=e;var a,e=new yd;return"number"==typeof t?this.fdfString+=t.toString():t instanceof R?this.fdfString+="/"+t.name.toString():t instanceof Array?(r=(a=this._appendArray(t,this.fdfString,i,n,r,s)).list,s=a.streamReference,i=a.index):t instanceof D?(this.fdfString+="<<",r=(a=this._getEntries(r,s,i,t,this.fdfString,n)).list,s=a.streamReference,i=a.index,this.fdfString+=">>"):t instanceof m?null!=t&&(this.fdfString+=" "+ ++i+" 0 R",n&&s.push(i),r.set(i,this._crossReference._cacheMap.get(t))):"boolean"==typeof t?this.fdfString+=" "+(t?"true":"false"):"string"==typeof t&&(this.fdfString+="("+this._getFormattedString(t)+")"),e.list=r,e.streamReference=s,e.index=i,e},fd.prototype._getFormattedString=function(t){for(var e="",i=0;i<t.length;i++){var n=t.charCodeAt(i);40!==n&&41!==n||(e+="\\"),e+=String.fromCharCode(n)}return e},fd.prototype._checkFdf=function(t){if(((t.includes(this._specialCharacters)||t.includes("âãÃÃ")||t.includes("%����"))&&(this._asPerSpecification=!0),t.startsWith("%"))&&"FDF-"!==t.substring(1,5))throw new Error("Invalid FDF file.")},fd.prototype._stringToHexString=function(t){var e="";return e=null!=t&&0<t.length?As(v(t)):e};var ld,ud,pd=fd;function fd(t){var e=ud.call(this)||this;return e._annotationObjects=new Map,e._specialCharacters="âãÏÓ",null!=t&&(e._fileName=t),e}var gd,yd=function(){},Mh=(gd=function(t,e){return(gd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)},function(t,e){function i(){this.constructor=t}gd(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),md=(Object.defineProperty(bd.prototype,"count",{get:function(){return this._isLoadedBookmark&&0===this._bookMarkList.length&&this._reproduceTree(),this._bookMarkList.length},enumerable:!0,configurable:!0}),Object.defineProperty(bd.prototype,"isExpanded",{get:function(){return this._dictionary&&this._dictionary.has("Count")?0<=this._dictionary.get("Count"):this._isExpanded},set:function(t){this._isExpanded=t,0<this.count&&this._dictionary&&this._dictionary.update("Count",t?this._bookMarkList.length:-this._bookMarkList.length)},enumerable:!0,configurable:!0}),bd.prototype.at=function(t){var e;if(t<0||t>=this.count)throw Error("Index out of range.");return e=k(this._bookMarkList)&&0<this._bookMarkList.length&&t<this._bookMarkList.length?this._bookMarkList[t]:e},bd.prototype.contains=function(t){return-1!==this._bookMarkList.indexOf(t)},bd.prototype.add=function(t,e,i){var n,r;if(null!=e&&"number"==typeof e?r=e:e&&"object"==typeof e&&(i=e),this._dictionary){var s,e=new D(this._crossReference),a=(e.update("Parent",this._reference),this._crossReference._getNextReference());if(this._crossReference._cacheMap.set(a,e),(n=new vd(e,this._crossReference))._reference=a,n.title=t,void 0===r)0===this.count?(this._dictionary.update("First",a),this._dictionary.update("Last",a)):(s=this.at(this.count-1),this._dictionary.update("Last",a),s&&s._reference&&(e.update("Prev",s._reference),s._dictionary.update("Next",a))),this._bookMarkList.push(n);else{if(r<0||r>this.count)throw new Error("Index out of range");0===this.count?(this._dictionary.update("First",a),this._dictionary.update("Last",a),this._bookMarkList.push(n)):r===this.count?(s=this.at(this.count-1),this._dictionary.update("Last",a),s&&s._reference&&(e.update("Prev",s._reference),s._dictionary.update("Next",a)),this._bookMarkList.push(n)):(0===r?(t=this.at(0),this._dictionary.update("First",a),t&&t._reference&&(e.update("Next",t._reference),t._dictionary.update("Prev",a))):(s=this.at(r),(t=this.at(r-1))&&t._reference&&s&&s._reference&&(e.update("Prev",t._reference),t._dictionary.update("Next",a),s._dictionary.update("Prev",a),e.update("Next",s._reference))),this._updateBookmarkList(r,n))}this._updateCount()}return i&&n&&("textStyle"in i&&k(i.textStyle)&&(n.textStyle=i.textStyle),"color"in i&&k(i.color)&&(n.color=i.color),"destination"in i&&k(i.destination)&&(n.destination=i.destination),"namedDestination"in i)&&k(i.namedDestination)&&(n.namedDestination=i.namedDestination),n},bd.prototype.remove=function(t){var e,i;if("string"==typeof t)for(var n=this._bookMarkList.length-1;0<=n;n--){var r=this.at(n);r.title===t?this.remove(n):0<r.count&&r.remove(t)}else 0<=t&&t<this.count&&(1===this.count?(this._removeFirst(this._dictionary),this._removeLast(this._dictionary),this._removeCount(this._dictionary),this._bookMarkList=[]):(0===t?(i=this.at(t+1),this._dictionary&&i&&i._reference&&(this._removePrevious(i._dictionary),this._dictionary.update("First",i._reference))):t===this.count-1?(e=this.at(t-1),this._dictionary&&e&&e._reference&&(this._removeNext(e._dictionary),this._dictionary.update("Last",e._reference))):(e=this.at(t-1),i=this.at(t+1),e&&e._reference&&i&&i._reference&&(e._dictionary.update("Next",i._reference),i._dictionary.update("Prev",e._reference))),this._updateBookmarkList(t),this._dictionary&&this._updateCount()))},bd.prototype.clear=function(){this._removeFirst(this._dictionary),this._removeLast(this._dictionary),this._removeCount(this._dictionary),this._bookMarkList=[]},bd.prototype._removeFirst=function(t){t&&t.has("First")&&(delete t._map.First,t._updated=!0)},bd.prototype._removeLast=function(t){t&&t.has("Last")&&(delete t._map.Last,t._updated=!0)},bd.prototype._removeNext=function(t){t&&t.has("Next")&&(delete t._map.Next,t._updated=!0)},bd.prototype._removePrevious=function(t){t&&t.has("Prev")&&(delete t._map.Prev,t._updated=!0)},bd.prototype._removeCount=function(t){t&&t.has("Count")&&(delete t._map.Count,t._updated=!0)},bd.prototype._updateBookmarkList=function(e,i){var n=this,r=[],s=0;void 0===i?this._bookMarkList.forEach(function(t){s!==e?r.push(t):(t=t._reference)&&n._crossReference._cacheMap.has(t)&&(n._crossReference._cacheMap.get(t)._updated=!1),s++}):this._bookMarkList.forEach(function(t){s===e&&r.push(i),r.push(t),s++}),this._bookMarkList=r},bd.prototype._updateCount=function(){this.isExpanded||!this._dictionary.has("Count")?this._dictionary.update("Count",this._bookMarkList.length):this._dictionary.update("Count",-this._bookMarkList.length)},bd.prototype._reproduceTree=function(){for(var t=this._getBookmark(this),e=!!t;e&&t._dictionary;)this._bookMarkList.push(t),e=!!(t=t._next)},bd.prototype._getBookmark=function(t,e){void 0===e&&(e=!0);var i,t=t._dictionary;return t&&t.has(e?"First":"Last")&&k(t=t._get(e?"First":"Last"))&&(e=this._crossReference._fetch(t))&&((i=new vd(e,this._crossReference))._reference=t),i},bd);function bd(t,e){this._bookMarkList=[],this._isExpanded=!1,this._isLoadedBookmark=!1,this._dictionary=t,this._crossReference=e}Mh(Sd,wd=md),Object.defineProperty(Sd.prototype,"destination",{get:function(){if(!this._destination){var t=this._obtainNamedDestination(),e=new Pr(this._dictionary,"Dest");if(this._destination=e._obtainDestination(),!this._destination&&t&&t.destination)return t.destination}return this._destination},set:function(t){t&&(t._parent=this,t._isBookmark=!0,this._destination=t,this._destination._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(Sd.prototype,"namedDestination",{get:function(){return null!==this._namedDestination&&void 0!==this._namedDestination||(this._namedDestination=this._obtainNamedDestination()),this._namedDestination},set:function(t){var e;this._namedDestination!==t&&this._dictionary&&(this._namedDestination=t,(e=new D(this._crossReference)).update("D",t.title),e.update("S",R.get("GoTo")),t=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(t,e),this._dictionary.update("A",t))},enumerable:!0,configurable:!0}),Object.defineProperty(Sd.prototype,"title",{get:function(){return null!==this._title&&void 0!==this._title||(this._dictionary&&this._dictionary.has("Title")?this._title=this._dictionary.get("Title"):this._title=""),this._title},set:function(t){this._title=t,this._dictionary&&this._dictionary.update("Title",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Sd.prototype,"color",{get:function(){return null!==this._color&&void 0!==this._color||this._dictionary&&this._dictionary.has("C")&&(this._color=qs(this._dictionary.getArray("C"))),this._color||{r:0,g:0,b:0}},set:function(t){this._color=t,this._dictionary&&this._dictionary.update("C",[Number.parseFloat((t.r/255).toFixed(7)),Number.parseFloat((t.g/255).toFixed(7)),Number.parseFloat((t.b/255).toFixed(7))])},enumerable:!0,configurable:!0}),Object.defineProperty(Sd.prototype,"textStyle",{get:function(){return null!==this._textStyle&&void 0!==this._textStyle||(this._textStyle=this._obtainTextStyle()),this._textStyle},set:function(t){this._textStyle=t,this._updateTextStyle(t)},enumerable:!0,configurable:!0}),Object.defineProperty(Sd.prototype,"_next",{get:function(){var t,e,i;return this._dictionary&&this._dictionary.has("Next")&&k(e=this._dictionary._get("Next"))&&(i=this._crossReference._fetch(e))&&((t=new Sd(i,this._crossReference))._reference=e),t},enumerable:!0,configurable:!0}),Sd.prototype._updateTextStyle=function(t){t===M.PdfTextStyle.regular?this._dictionary&&this._dictionary.has("F")&&delete this._dictionary._map.F:this._dictionary&&this._dictionary.update("F",t)},Sd.prototype._obtainTextStyle=function(){var t,e=M.PdfTextStyle.regular;return this._dictionary&&this._dictionary.has("F")&&(e|=null!=(t=this._dictionary.get("F"))?t:0),e},Sd.prototype._obtainNamedDestination=function(){var t,e,i,n,r,s=this._crossReference._document;return i=(t=s?s._destinationCollection:t)&&((s=this._dictionary)&&(s.has("A")?(r=s.get("A"))&&r.has("D")&&(e=r.get("D")):s.has("Dest")&&(e=s.get("Dest"))),e)&&(e instanceof R?n=e.name:"string"==typeof e&&(n=e),n)&&(r=t._namedDestinations)&&0<r.length&&(s=r.find(function(t){return t._title===n}))?e=s:i};var wd,vd=Sd;function Sd(t,e){t=wd.call(this,t,e)||this;return t._dictionary&&!t._dictionary.has("Dest")&&t._dictionary.has("A")&&(e=t._dictionary.get("A"))&&e.has("D")&&(e=e.getRaw("D"),t._dictionary.update("Dest",e)),t._isLoadedBookmark=!0,t}Object.defineProperty(xd.prototype,"destination",{get:function(){return this._destination},set:function(t){t&&(t._parent=this,t._isBookmark=!1,this._destination=t,this._destination._initializePrimitive())},enumerable:!0,configurable:!0}),Object.defineProperty(xd.prototype,"title",{get:function(){return this._title},set:function(t){var e;t!==this._title&&this._dictionary&&(e=this._title,this._title=t,this._dictionary.update("Title",t),this._dictionary._updated=!0,this._updateNamedDestinationTitle(t,e))},enumerable:!0,configurable:!0}),xd.prototype._updateNamedDestinationTitle=function(t,e){var i,n=this._crossReference;n&&n._document&&(n=n._document._catalog._catalogDictionary)&&n.has("Names")&&(n=n.get("Names"))&&n.has("Dests")&&(n=n.get("Dests"))&&n.has("Names")&&-1!==(e=(i=n.get("Names")).indexOf(e))&&(i.splice(e,1,t),delete n._map.Names,n.update("Names",i),n._updated=!0)},xd.prototype._initialize=function(){this._dictionary=new D,this._dictionary.update("S",R.get("GoTo"))};var Pd=xd;function xd(t,e){t instanceof D&&e instanceof nd?(this._dictionary=t,this._crossReference=e):"string"==typeof t&&(this._initialize(),this.title=t,e)&&e instanceof vr&&(this.destination=e)}Td.prototype._findDestination=function(t){var e=this;t&&(t.has("Names")?this._addCollection(t):t.has("Kids")&&(t=t.getArray("Kids"))&&Array.isArray(t)&&0<t.length&&t.forEach(function(t){e._findDestination(t)}))},Td.prototype._addCollection=function(t){var e,i=t.getRaw("Names");if((i=(e=i&&i instanceof m?this._crossReference._fetch(i):e)&&Array.isArray(e)&&0<e.length?e:i)&&Array.isArray(i)&&0<i.length)for(var n=1;n<i.length;n+=2){var r=void 0,s=i[n];if(s&&s instanceof m?(o=this._crossReference._fetch(s))&&Array.isArray(o)&&0<o.length?(r=new D).update("D",o):r=this._crossReference._fetch(s):null==r&&Array.isArray(s)&&(r=new D).update("D",s),r){var a,o=new Pd(r,this._crossReference),s=i[n-1],h=void 0,c=void 0;if(s&&(o._title=s,r.has("D"))&&(c=r.get("D"),h=new vr,s=c[0])&&c&&c[0]instanceof m&&(r=this._crossReference._fetch(s),s=void 0,a=this._crossReference._document)&&r&&null!=(s=ls(a,r))&&0<=s&&(h._index=s,h.page=a.getPage(s)),c[1]instanceof R){var _,d,l=void 0,u=void 0,p=void 0,r=c[1].name,f=h.page;switch(r){case"Fit":h._destinationMode=M.PdfDestinationMode.fitToPage;break;case"XYZ":h._destinationMode=M.PdfDestinationMode.location,2<c.length&&(l=c[2]),3<c.length&&(u=c[3]),4<c.length&&(p=c[4]),f&&(_=f.size,d=null==u?0:_.height-u,h._location={x:null==l?0:l,y:d},f.rotation!==M.PdfRotationAngle.angle0&&(d=ds(f,u,l)),h._zoom=null!=p?p:0,null!==l&&null!==u&&null!==p&&void 0!==l&&void 0!==u&&void 0!==p||(h._isValid=!1));break;case"FitH":case"FitBH":h._destinationMode=M.PdfDestinationMode.fitH,3<=c.length&&(u=c[2]),f&&(_=f.size,d=null==u?0:_.height-u,h._location={x:0,y:d}),null==u&&(h._isValid=!1);break;case"FitR":h._destinationMode=M.PdfDestinationMode.fitR}}h._parent=o,h._isBookmark=!1,o._destination=h,this._namedDestinations.push(o)}}};var Ad=Td;function Td(t,e){var i=this;this._namedDestinations=[],t&&(this._dictionary=t),e&&(this._crossReference=e),t&&t.has("Dests")&&(e=t.get("Dests"))&&(e.has("Names")?this._addCollection(e):e.has("Kids")&&e.getArray("Kids").forEach(function(t){i._findDestination(t)}))}Cd=function(t,e){return(Cd=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Cd(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Fd,kd=X),Fd.prototype._exportAnnotations=function(){throw new Error("Method not implemented.")},Fd.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._format="XML",this._key=ia(),this._save()},Fd.prototype._save=function(){var t=new j,e=(t._writeStartDocument(),this._asPerSpecification?(t._writeStartElement("fields"),t._writeAttributeString("xfdf","http://ns.adobe.com/xfdf-transition/","xmlns",null)):t._writeStartElement("Fields"),this._document.form);if(null!=e){this._exportEmptyFields=e.exportEmptyFields;for(var i=this._document.form.count,n=0;n<i;n++){var r=this._document.form.fieldAt(n);null!=r&&r.export&&this._exportFormFieldData(r)}this._writeFormFieldData(t,this._asPerSpecification)}e=t._save();return t._destroy(),e},Fd.prototype._writeFormFieldData=function(n,t){(t=void 0===t?!1:t)?this._table.forEach(function(t,e){var i;e.includes(" ")?(i=e.replace(/ /g,""),n._writeStartElement(i.toString()),n._writeAttributeString("original",e.toString(),"xfdf",null)):n._writeStartElement(e.toString()),n._writeString(t.toString()),n._writeEndElement()}):this._table.forEach(function(t,e){e.includes(" ")&&(e=e.replace(/ /g,"_x0020_")),n._writeStartElement(e.toString()),n._writeString(t.toString()),n._writeEndElement()}),n._writeEndElement()},Fd.prototype._importFormData=function(t,e){this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1;t=vs(e);t=(t=t.replace(/(\r\n|\n|\r)/gm,"")).replace(/[^\x20-\x7E]/g,""),this._xmlDocument=(new DOMParser).parseFromString(t,"text/xml"),this._checkXml(this._xmlDocument),this._xmlImport=!0,this._parseFormData(this._xmlDocument.documentElement),this._xmlImport=!1},Fd.prototype._parseFormData=function(t){var e=t.childNodes;if(null!=e&&0<e.length)for(var i=0;i<e.length;i++){var n,r,s=e.item(i);null!=s&&1===s.nodeType&&(n="",null!==(s=s).attributes&&void 0!==s.attributes&&0<s.attributes.length?null!=(r=s.attributes.item(0))&&"xfdf:original"===r.name&&(n=r.value):n=s.tagName,r=s.textContent,null!=n)&&0<n.length&&this._table.set(n,r)}this._importField()},Fd.prototype._importField=function(){var n=this,r=this._document.form,s=r.count;s&&this._table.forEach(function(t,e){0<n._table.size&&n._table.has(e)&&(i=n._table.get(e));var i,e=e.toString(),e=(-1!==e.indexOf("_x0020_")&&(e=e.replace(/_x0020_/g," ")),r._getFieldIndex(e));-1!==e&&e<s&&(e=r.fieldAt(e))&&null!=e&&(i&&""!==i&&e._dictionary.update("RV",i),(i=[]).push(t),n._importFieldData(e,i))})},Fd.prototype._checkXml=function(t){if(0<t.getElementsByTagName("parsererror").length)throw new Error("Invalid XML file.")};var Cd,kd,Rd=Fd;function Fd(t){var e=kd.call(this)||this;return null!=t&&(e._fileName=t),e}Object.defineProperty(Dd.prototype,"crossReferenceType",{get:function(){return this._crossReferenceType},set:function(t){this._crossReferenceType=t},enumerable:!0,configurable:!0}),Object.defineProperty(Dd.prototype,"isIncrementalUpdate",{get:function(){return this._incrementalUpdate},set:function(t){this._incrementalUpdate=t},enumerable:!0,configurable:!0});var Id=Dd;function Dd(){this._incrementalUpdate=!0}Object.defineProperty(Ld.prototype,"targetIndex",{get:function(){return this._targetIndex},set:function(t){this._targetIndex=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ld.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ld.prototype,"optimizeResources",{get:function(){return this._optimizeResources},set:function(t){this._optimizeResources=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ld.prototype,"groupFormFields",{get:function(){return this._groupFormFields},set:function(t){this._groupFormFields=t},enumerable:!0,configurable:!0});var Bd=Ld;function Ld(t){this._optimizeResources=!0,this._groupFormFields=!1,t&&"targetIndex"in t&&null!==t.targetIndex&&void 0!==t.targetIndex&&(this._targetIndex=t.targetIndex),t&&"rotation"in t&&null!==t.rotation&&void 0!==t.rotation&&(this._rotation=t.rotation),t&&"optimizeResources"in t&&null!==t.optimizeResources&&void 0!==t.optimizeResources&&(this._optimizeResources=t.optimizeResources),t&&"groupFormFields"in t&&null!==t.groupFormFields&&void 0!==t.groupFormFields&&(this._groupFormFields=t.groupFormFields)}Md.prototype._importPages=function(t,e,i,n,r,s){var a,o,h=this,c=t._pageDictionary;this._isDuplicatePage=n,this._options.rotation=(r||t).rotation,a="number"==typeof e?this._insertNewPage(t,e):this._isDuplicatePage?this._insertNewPage(t,t._pageIndex+1):this._insertNewPage(t),(n||s)&&this._options.optimizeResources?(o=[],c.forEach(function(t,e){var i,n;"Contents"===t&&0===o.length?(i=e)instanceof m?(n=s?h._copier._copy(i):i,a._pageDictionary.update(t,n)):i instanceof Array&&(i.forEach(function(t){t=s?h._copier._copy(t):t;o.push(t)}),a._pageDictionary.update(t,o)):"Resources"===t&&e?(n=s?h._copier._copy(e):e)&&a._pageDictionary.update(t,n):"Resources"!==t&&"MediaBox"!==t&&"CropBox"!==t&&"Parent"!==t&&"Annots"!==t&&"Contents"!==t&&"Rotate"!==t&&a._pageDictionary.update(t,e)})):(r=t._contentTemplate,a.graphics.drawTemplate(r,{x:0,y:0,width:r._size.width,height:r._size.height}),r._content.dictionary.update("Resources",this._copier._copy(c.getRaw("Resources"))),this._pageReference.set(c,a),n||this._bookmarksPageLinkReference.set(t._ref,a._pageIndex)),c.has("Annots")&&(this._importAnnotation(t,a),void 0!==this._options&&this._options.groupFormFields&&this._sourceDocument._catalog._catalogDictionary.has("AcroForm")&&0<this._destinationDocument.form.count?this._formFieldsGroupingSupport(this._sourceDocument.form,t,a):this._sourceDocument._catalog._catalogDictionary.has("AcroForm")&&this._importFormField(t,this._sourceDocument.form,a)),n||(e=this._sourceDocument._parseBookmarkDestination())&&e.has(t)&&(r=e.get(t),(e=this._bookmarks).push.apply(e,r)),(n||!i)&&this._options.optimizeResources||this._mergeLayer(a._pageDictionary,c,this._sourceDocument._crossReference),a._pageDictionary._updated=!0},Md.prototype._importAnnotation=function(t,e){var i=t.annotations._annotations;if(i&&0!==i.length){for(var n=this._crossReference,r=this._sourceDocument._crossReference,s=[],a=i.length,o=0;o<a;o++){var h,c,_,d,l=i[o];l&&(d=r._fetch(l))&&(h=void 0,d.has("Dest")&&(c=d.get("Dest"),_=d._get("Dest"),Array.isArray(c)?h=c.slice():_ instanceof m&&(h=[_])),h&&0<h.length&&this._destination.push(h),d.has("OC")&&(c=d.getRaw("OC"))instanceof m&&this._annotationLayer.set(o,c),_=this._copier._copy(l),d=n._fetch(_),h&&0<h.length&&d.update("Dest",h),d.update("P",e._ref),s.push(_))}0<s.length&&e._pageDictionary.update("Annots",s)}},Md.prototype._formFieldsGroupingSupport=function(t,e,i){var n,r=[],s=[],a=[],o=t._dictionary.get("DR");if(t._dictionary.has("DR")&&(o=t._dictionary.get("DR")),i._pageDictionary.has("Annots")&&(r=i._pageDictionary.get("Annots")),e._pageDictionary.has("Annots")&&(a=e._pageDictionary.get("Annots")),!this._isDuplicatePage){n=this._destinationDocument.form,this._fieldCount=n.count;for(var h=0;h<this._fieldCount;h++)s.push(n.fieldAt(h).name)}for(var c=0;c<t.count;c++){var _=t.fieldAt(c),d=void 0,l=[],u=_._dictionary.get("Kids");if(-1!==s.indexOf(_.name)||this._isDuplicatePage){if(this._isDuplicatePage?(d=_,l=u):(d=n.fieldAt(s.indexOf(_.name)))._dictionary.get("Kids")&&(l=d._dictionary.get("Kids")),_._isDuplicatePage=!0,_ instanceof ci&&d instanceof ci||!(_ instanceof ci))if(void 0!==u&&0<u.length)for(var p=0;p<u.length;p++){var f=_.itemAt(p);f.page===e&&(d._page=i,r=this._groupFormFieldsKids(d,_,a,l,u,i._ref,r,p,c,o,f))}else r=this._groupFormFieldsKids(d,_,a,l,u,i._ref,r,0,c,o)}else r=this._insertFormFields(c,_,t,i._ref,r,a)}0<r.length&&i._pageDictionary.update("Annots",r)},Md.prototype._groupFormFieldsKids=function(t,e,i,n,r,s,a,o,h,c,_){var d,l,u;return e._dictionary.has("Kids")&&t._dictionary.has("Kids")?null!=o&&0<=o&&r.length>o&&(u=r[o])&&-1!==i.indexOf(u)&&(i=e._crossReference._fetch(u),(u=this._copier._copyDictionary(i,!this._isDuplicatePage)).update("P",s),d=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(d,u),a.push(d),u.update("Parent",t._ref),n.push(d),u._updated=!0,t._dictionary._updated=!0,this._isDuplicatePage||((t instanceof Ue||t instanceof qe||t instanceof ni)&&u.has("AS")&&delete u._map.AS,this._createAppearance(t,e,i,u,c,_))):e._dictionary.has("Kids")&&!t._dictionary.has("Kids")||this._isDuplicatePage?(l=this._copier._copyDictionary(t._dictionary,!this._isDuplicatePage),this._updateFieldsWithKids(t,e,l,o,h,s,r,a,c,t._dictionary)):!e._dictionary.has("Kids")&&t._dictionary.has("Kids")?(i=this._copier._copyDictionary(e._dictionary),this._updateFieldDictionary(i,s,t._ref),d=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(d,i),n.push(d),a.push(d),t._dictionary._updated=!0,this._createAppearance(t,e,e._dictionary,i,c,_)):e._dictionary.has("Kids")||t._dictionary.has("Kids")||(l=this._copier._copyDictionary(t._dictionary),u=this._copier._copyDictionary(e._dictionary,!this._isDuplicatePage),this._removeFieldDictionary(u,["Parent","FT","T","Ff"]),u.update("P",s),this._updateFieldsWithKids(t,e,l,o,h,s,r,a,c,u)),a},Md.prototype._updateFieldsWithKids=function(t,e,i,n,r,s,a,o,h,c){var _=this._crossReference._getNextReference(),d=this._createNewFieldDictionary(i,t._dictionary),l=(d.objId=_.toString(),this._crossReference._cacheMap.set(_,d),this._destinationDocument.form._parseFields(d,_)),a=(t._dictionary.update("Parent",_),l._dictionary._updated=!0,this._updateFieldDictionary(i,s,_),this._destinationDocument.form._dictionary._updated=!0,i=void 0!==a&&0<a.length&&null!=n&&a.length>n&&0<=n?e._crossReference._fetch(a[n]):c,this._copier._copyDictionary(i,!this._isDuplicatePage)),n=((t instanceof Ue||t instanceof qe||t instanceof ni)&&a.has("AS")&&delete a._map.AS,this._crossReference._getNextReference()),c=(this._crossReference._cacheMap.set(n,a),a.update("P",s),o.push(n),a.update("Parent",l._ref),[]);c.push(t._ref),c.push(n),a._updated=!0,t._dictionary._updated=!0,d.update("Kids",c),l._kids=c,this._formFieldsCollection.set(r,_),this._destinationDocument.form._parsedFields.set(r,l),this._isDuplicatePage||this._createAppearance(l,e,i,a,h),d._updated=!0},Md.prototype._removeFieldDictionary=function(e,t){return t.forEach(function(t){e.has(t)&&delete e._map[t]}),e},Md.prototype._updateFieldDictionary=function(t,e,i){(t=this._removeFieldDictionary(t,["Parent","FT","T","Ff"])).update("P",e),t.update("Parent",i),t._updated=!0},Md.prototype._createNewFieldDictionary=function(e,i){var n=new D(this._crossReference);return["Parent","FT","T","V","Ff","TU","Opt","I"].forEach(function(t){e.has(t)&&(n.update(t,e.get(t)),delete e._map[t],delete i._map[t])}),n},Md.prototype._getItemStyle=function(t,e){var i=t._dictionary.get("MK");i&&i.has("CA")?t._styleText=i.get("CA").charAt(0):t._styleText=e instanceof Qe?"l":"4"},Md.prototype._createAppearance=function(t,e,i,n,r,s){var a,o,h=t._kidsCount-1;t instanceof Xe?((a=t.itemAt(h))._enableGrouping=!0,this._getItemStyle(a,t),e instanceof Qe?(a._dictionary.update("AS",R.get("Off")),o=_a(i)):a._postProcess(t.checked?"Yes":"Off"),t._drawAppearance(a,o)):t instanceof Qe?(a=t.itemAt(h),this._getItemStyle(a,t),a._dictionary.has("AS")?a._postProcess(a._dictionary.get("AS").name):a._postProcess("Off"),a._enableGrouping=!0,t._enableGrouping=!0,t._drawAppearance(a)):t instanceof ti?(a=t.itemAt(h),void 0!==s&&(a.rotationAngle=s.rotationAngle),a&&!t._checkFieldFlag(a._dictionary)&&(a._enableGrouping=!0,e=t._createAppearance(a),t._addAppearance(a._dictionary,e,"N"),a._dictionary._updated=!0)):(t instanceof Ue||t instanceof qe||t instanceof ci)&&(i=jn._load(n,this._crossReference),null!=s&&t instanceof ci?t._createAppearance(s,!1):(i.setAppearance(!0),i._enableGrouping=!0,o=void 0,o=null!=s?this._obtainFont(s._dictionary,r):this._obtainFont(n,r),i._pdfFont=o,t instanceof ci?t._createAppearance(i,!1):t._postProcess(!1,i)))},Md.prototype._obtainFont=function(t,e){var i,n,r="",s=8,a=(t&&(t.has("DS")||t.has("DA"))&&(t.has("DS")?t.get("DS").split(";").forEach(function(t){var e=t.split(":");if(-1!==t.indexOf("font-family"))r=e[1];else if(-1===t.indexOf("font-style")&&-1!==t.indexOf("font")){for(e[1].split(" ").forEach(function(t){""===t||t.endsWith("pt")||(r+=t+" ")});" "!==r&&r.endsWith(" ");)r=r.substring(0,r.length-2);-1!==r.indexOf(",")&&(r=r.split(",")[0])}}):(t=t.get("DA"))&&""!==t&&-1!==t.indexOf("Tf")&&((n=t.split(" ")).forEach(function(t,e){if(-1!==t.indexOf("Tf")){for(r=n[e-2];""!==r&&1<r.length&&"/"===r[0];)r=r.substring(1);s=Number.parseFloat(n[e-1])}}),0===s)&&(s=8)),r=r.trim(),M.PdfFontStyle.regular);switch(void 0!==e&&e.has("Font")&&void 0!==(t=e.get("Font").get(r))&&(e=t.get("BaseFont").name,a=this._getFontStyle(e)),r){case"Helv":i=new E(M.PdfFontFamily.helvetica,s,a);break;case"Courier":case"Cour":i=new E(M.PdfFontFamily.courier,s,a);break;case"Symb":i=new E(M.PdfFontFamily.symbol,s,a);break;case"TiRo":case"TiIt":i=new E(M.PdfFontFamily.timesRoman,s,a);break;case"ZaDb":i=new E(M.PdfFontFamily.zapfDingbats,s,a);break;default:i=new E(M.PdfFontFamily.helvetica,s,a)}return i},Md.prototype._getFontStyle=function(t){var e=M.PdfFontStyle.regular;return t.includes("Bold")?e=M.PdfFontStyle.bold:t.includes("Italic")&&(e=M.PdfFontStyle.italic),e},Md.prototype._importFormField=function(t,e,i){var n,r=this._destinationDocument.form,s=[],a=(i&&i._pageDictionary&&i._pageDictionary.has("Annots")&&(s=i._pageDictionary.get("Annots")),[]);if(this._destinationDocument.form._dictionary.has("Fields")){var o=this._destinationDocument.form;this._fieldCount=o.count;for(var h=0;h<this._fieldCount;h++){var c=o.fieldAt(h).name;this._fieldNames.push(c)}}t._pageDictionary.has("Annots")&&(a=t._pageDictionary.get("Annots"));for(var _,d,l,u,p=e.count,f=0;f<p;++f){var g=e.fieldAt(f);if(g._dictionary.has("Kids"))if(1<(n=g._dictionary.get("Kids")).length){for(var y=0;y<n.length;y++)if(g.itemAt(y).page===t){s=this._insertFormFields(f,g,r,i._ref,s,a);break}}else 1===n.length&&g.page===t&&(s=this._insertFormFields(f,g,r,i._ref,s,a));else g.page===t&&(s=this._insertFormFields(f,g,r,i._ref,s,a))}e._dictionary.has("DR")&&(_=e._dictionary.get("DR"),d=void 0,(_=this._copier._copyDictionary(_)).has("Font")&&(d=_.get("Font")),this._destinationDocument.form._dictionary.has("DR")?(l=this._destinationDocument.form._dictionary.get("DR")).has("Font")&&(u=l.get("Font"),d&&d.forEach(function(t,e){u.set(t,e)}),u._updated=!0):this._destinationDocument.form._dictionary.update("DR",_)),0<s.length&&i._pageDictionary.update("Annots",s)},Md.prototype._insertFormFields=function(t,i,e,n,r,s){for(var a,o=this,h=new D,c=(i._dictionary.has("Kids")?i._dictionary.forEach(function(t,e){"Kids"!==t&&h.update(t,e)}):h=this._copier._copyDictionary(i._dictionary),this._crossReference._getNextReference()),_=(h.objId=c.toString(),e._parseFields(h,n)),d=(_._ref=c,this._crossReference._cacheMap.set(c,_._dictionary),i._dictionary.has("Kids")?(e=i._dictionary.get("Kids"),a=[],e.forEach(function(t){var e;-1!==s.indexOf(t)&&(t=i._crossReference._fetch(t),(t=o._copier._copyDictionary(t)).update("P",n),t.update("Parent",c),t._updated=!0,e=o._crossReference._getNextReference(),o._crossReference._cacheMap.set(e,t),r.push(e),a.push(e))}),h.update("Kids",a),_._kids=a):(_._dictionary.update("P",n),r.push(c)),_._dictionary._updated=!0,0),l=_.name,u=!1;-1!==this._fieldNames.indexOf(l);)l=_.name+d,u=!0,++d;return u&&(_._dictionary.update("T",l),_._name=l),_._dictionary._updated=!0,0<this._fieldCount?(this._destinationDocument.form._parsedFields.set(this._fieldCount,_),_._annotationIndex=this._fieldCount,this._fieldCount++):(this._destinationDocument.form._parsedFields.set(t,_),_._annotationIndex=t),this._destinationDocument.form._fields.push(c),r},Md.prototype._mergeFormFieldsWithDocument=function(){var t,i=[];0<this._formFieldsCollection.size?((t=this._destinationDocument.form._dictionary)&&t.has("Fields")&&(i=t.get("Fields")),this._formFieldsCollection.forEach(function(t,e){i[e]=t})):i=this._destinationDocument.form._fields,this._destinationDocument.form._dictionary.get("NeedAppearances")&&this._destinationDocument.form._dictionary.set("NeedAppearances",!1),this._destinationDocument.form._dictionary.set("Fields",i),this._destinationDocument.form._fields=i,this._destinationDocument.form._dictionary._updated=!0},Md.prototype._importLayers=function(t,e){var i,n,r,s,a,o,h;this._isLayersPresent=e,this._isLayersPresent&&this._destinationDocument._catalog._catalogDictionary.has("OCProperties")?(e=this._destinationDocument._catalog._catalogDictionary.get("OCProperties"),i=t.get("OCProperties"),e.has("OCGs")&&(n=e.get("OCGs"),r=i.get("OCGs"),0<n.length)&&n.push.apply(n,r),e._updated=!0,e.has("D")&&i.has("D")?(n=e.get("D"),r=i.get("D"),n&&r&&(n.has("Order")&&r.has("Order")?(o=n.get("Order"),h=r.get("Order"),0<o.length&&0<h.length&&o.push.apply(o,h)):r.has("Order")&&n.set("Order",r.get("Order")),n.has("RBGroups")&&r.has("RBGroups")?(o=n.get("RBGroups"),h=r.get("RBGroups"),0<o.length&&0<h.length&&o.push.apply(o,h)):r.has("RBGroups")&&(n.set("RBGroups",r.get("RBGroups")),n._updated=!0),n.has("ON")&&r.has("ON")?(o=n.get("ON"),h=r.get("ON"),0<o.length&&0<h.length&&o.push.apply(o,h)):r.has("ON")&&n.set("ON",r.get("ON")),n.has("AS")&&r.has("AS")?(o=n.get("AS"),h=r.get("AS"),0<o.length&&0<h.length&&(a=h[0],s=o[0],a instanceof m&&s instanceof m&&(a=this._crossReference._fetch(a),s=this._crossReference._fetch(s)),a.has("OCGs")&&s.has("OCGs")&&(a=a.get("OCGs"),s=s.get("OCGs"),0<a.length)&&0<s.length&&s.push.apply(s,a),o.push.apply(o,h))):r.has("AS")&&n.set("AS",r.get("AS")),n.has("OFF")&&r.has("OFF")?(s=n.get("OFF"),a=r.get("OFF"),0<s.length&&0<a.length&&s.push.apply(s,a)):r.has("OFF")&&n.set("OFF",r.get("OFF"))),n.has("Locked")&&r.has("Locked")?(o=n.get("Locked"),h=r.get("Locked"),0<o.length&&0<h.length&&o.push.apply(o,h)):r.has("Locked")&&n.set("Locked",r.get("Locked"))):i.has("D")&&e.set("D",i.get("D")),e._updated=!0,this._destinationDocument._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0):this._isLayersPresent&&(this._destinationDocument._catalog._catalogDictionary.update("OCProperties",t.get("OCProperties")),this._destinationDocument._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0)},Md.prototype._mergeLayer=function(t,e,i){var n,r,s,a,o,h=this,c=t.get("Resources").get("XObject"),_=(c&&c.forEach(function(t,e){n=h._crossReference._fetch(e)}),n&&(r=n.dictionary.get("Resources")),new Map),c=e.get("Resources");c.has("Properties")?(c.get("Properties").forEach(function(t,e){_.set(t,e)}),a=new D(this._crossReference),_.forEach(function(i,n){h._newList.forEach(function(t,e){i===e&&a.set(n,t)})}),r.set("Properties",a),r._updated=!0,a._updated=!0):c.has("XObject")&&(s=r.get("XObject"),c.get("XObject").forEach(function(r,t){t instanceof m&&i._fetch(t).dictionary.forEach(function(i,n){"OC"===i&&h._newList.forEach(function(t,e){e===n&&s.has(r)&&((e=s.get(r)).dictionary.set(i,t),e._updated=!0)})})})),0<this._annotationLayer.size&&(o=t._get("Annots"),this._annotationLayer.forEach(function(i,t){var t=o[t],n=h._crossReference._fetch(t);h._newList.forEach(function(t,e){i===e&&n.set("OC",t)})}))},Md.prototype._exportBookmarks=function(d,l){var u=this;if(0<this._bookmarks.length){var p=this._bookmarks,f=this._destinationDocument.bookmarks,g=d.bookmarks,y=void 0;if(g){var m=[],b={index:0,base:f,kids:g._bookMarkList};d.pageCount!==l&&(b={index:0,base:f,kids:p},y=[]);do{for(var w=this;b.index<b.kids.length;)!function(){var i,n,t,e,r,s,a,o,h,c,_;g=b.kids[b.index],-1!==p.indexOf(g)&&void 0!==y&&-1===y.indexOf(g.title)?(t=g,o=f.add(t.title),e=t.destination,o.color=t.color,o.textStyle=t.textStyle,n=i=r=null,(a=t.namedDestination)?a.destination&&(n=a.destination.page,w._bookmarksPageLinkReference.forEach(function(t,e){n._ref===e&&(i=u._destinationDocument.getPage(t))}),i)&&(h=w._getNamedDestination(a,i),o.namedDestination=h,delete o._dictionary._map.C,w._namedDestinations.push(h._title),c=w._crossReference._getNextReference(),w._crossReference._cacheMap.set(c,h._dictionary),w._namedDestinations.push(c)):e&&(n=e.page,w._bookmarksPageLinkReference.forEach(function(t,e){n._ref===e&&(i=u._destinationDocument.getPage(t))}),i)&&((r=new vr(i,e.location)).mode=e.mode,r.zoom=e.zoom,r.location=e.location,o.destination=r),f=o,y.push(o.title)):(void 0===y||void 0!==y&&-1===y.indexOf(g.title))&&(e=(t=g).destination,_=s=r=null,a=t.namedDestination,d.pageCount===l)&&(o=f.add(t.title),t._dictionary.has("A")&&o._dictionary.update("A",t._dictionary.get("A")),o.textStyle=t.textStyle,o.color=t.color,a?a._destination&&(_=a.destination.page,w._bookmarksPageLinkReference.forEach(function(t,e){_._ref===e&&(s=u._destinationDocument.getPage(t))}),s)&&(h=w._getNamedDestination(a,s),o.namedDestination=h,delete o._dictionary._map.C,w._namedDestinations.push(h._title),c=w._crossReference._getNextReference(),w._crossReference._cacheMap.set(c,h._dictionary),w._namedDestinations.push(c)):e&&(_=e.page,w._bookmarksPageLinkReference.forEach(function(t,e){_._ref===e&&(s=u._destinationDocument.getPage(t))}),s)&&((r=new vr(s,e.location)).mode=e.mode,r.zoom=e.zoom,r.location=e.location,o.destination=r),f=o),b.index+=1,0<g.count?(m.push(b),b={index:0,base:f,kids:g._bookMarkList}):f=b.base}();if(0<m.length){for(b=m.pop();b.index===b.kids.length&&0<m.length;)b=m.pop();f=b.base}}while(b.index<b.kids.length)}var t,e;0<this._namedDestinations.length&&((e=new D(this._crossReference)).update("Names",this._namedDestinations),t=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(t,e),(e=new D(this._crossReference)).update("Dests",t),t=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(t,e),this._destinationDocument._catalog._catalogDictionary.set("Names",t)),this._destinationDocument._catalog._catalogDictionary._updated=!0,this._destinationDocument._catalog._catalogDictionary.isCatalog=!0,this._crossReference._allowCatalog=!0}},Md.prototype._getNamedDestination=function(t,e){var i=new Pd(t.title);return i.destination=this._getDestination(e,t.destination),i},Md.prototype._getDestination=function(t,e){t=new vr(t,e.location);return t._location=e._location,t.mode=e.mode,t.zoom=e.zoom,t.location=e.location,t},Md.prototype._writeObject=function(t,e,i,n,r,s,a){var o;i instanceof R||"string"==typeof i||"number"==typeof i||"boolean"==typeof i?this._writeDictionary(i,e,r,s,a,null):Array.isArray(i)?(this._writeArray(t,o=[],i,n),this._writeDictionary(null,e,r,s,a,o)):i instanceof D?(o=new D(this._crossReference),this._writePropertiesDictionary(t,o,i),this._writeDictionary(null,e,r,s,a,o)):i instanceof m&&this._crossReference?this._writeObject(t,e,t._crossReference._fetch(i),n,r,s,i):null==i&&this._writeDictionary("null",e,r,s,a,null)},Md.prototype._writeDictionary=function(t,e,i,n,r,s){var a;i&&t?e.set(i,t):i&&s?e.set(i,s):s&&!r?n.push(s):t?n.push(t):r&&(this._newList&&0<this._newList.size&&this._newList.forEach(function(t,e){e===r&&(a=t)}),a?n.push(a):(e=s,a=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(a,e),e._updated=!0,n.push(a),this._newList.set(r,a)))},Md.prototype._writeArray=function(t,e,i,n){for(var r=0,s=i.length;r<s;r++)this._writeObject(t,null,i[r],n,null,e)},Md.prototype._writePropertiesDictionary=function(i,n,r){var s=this;r&&0<r.size&&r.forEach(function(t,e){s._writeObject(i,n,e instanceof m?r.get(t):e,r,t)})},Md.prototype._fixDestinations=function(n){var r=this._pageReference;0<this._destination.length&&this._destination.forEach(function(t){var e,i;t instanceof Array&&0<(t=t).length&&t[0]&&t[0]instanceof m&&(e=n._crossReference._fetch(t[0]),i=r.get(e),e&&r.has(e)&&null!==i&&(t[0]=i._ref),e)&&r.has(e)&&null===i&&(t[0]=null)})},Md.prototype._insertNewPage=function(t,e){var i,n=new Cp,n=(n.size=t.size,n.margins.left=0,n.margins.top=0,n.margins.right=0,void(n.margins.bottom=0)!==this._options&&void 0!==this._options.rotation?n.rotation=this._options.rotation:n.rotation=t.rotation,n.orientation=t.size.width>t.size.height?M.PdfPageOrientation.landscape:M.PdfPageOrientation.portrait,e=void 0!==e?this._destinationDocument.addPage(e,n):this._destinationDocument.addPage(n),t._pageDictionary);return n._get("MediaBox")&&(i=n._get("MediaBox"),e._pageDictionary.update("MediaBox",i)),n._get("CropBox")&&(i=n._get("CropBox"),e._pageDictionary.update("CropBox",i)),void 0===this._options.rotation&&!t._pageDictionary.has("Rotate")||(n=(n=void 0)!==this._options.rotation?90*Math.floor(this._options.rotation):90*Math.floor(t.rotation),e._pageDictionary.update("Rotate",n=360<=n?n%360:n)),e},Md.prototype._objectDispose=function(){this._bookmarkHashTable=new Map,this._namedDestinations=[],this._bookmarks=[],this._pageReference=new Map,this._bookmarksPageLinkReference.clear(),this._destination=[],this._newList=new Map,this._annotationLayer=new Map,this._fieldNames=[],this._destinationDocument&&this._destinationDocument._form&&this._destinationDocument._form._widgetReferences&&(this._destinationDocument._form._widgetReferences=[])};var Od=Md;function Md(t,e,i,n,r){this._namedDestinations=[],this._bookmarks=[],this._fields=[],this._pageReference=new Map,this._bookmarksPageLinkReference=new Map,this._destination=[],this._newList=new Map,this._annotationLayer=new Map,this._isLayersPresent=!1,this._fieldNames=[],this._options=new Bd,this._kidsReference=[],this._formFieldsCollection=new Map,this._formFields=[],this._isDuplicatePage=!1,this._fieldCount=0,this._crossReference=t,this._destinationDocument=e,this._sourceDocument=i,this._pageReference=n,void 0!==r&&(this._options=r),this._copier=new Ed(this._crossReference,this._sourceDocument._crossReference)}Nd.prototype._copy=function(t){var e;return t instanceof D?e=this._copyDictionary(t):Array.isArray(t)?e=this._copyArray(t):t instanceof y?e=this._copyStream(t):t instanceof m?e=this._copyReference(t):(t instanceof R||"number"==typeof t||"string"==typeof t||"boolean"==typeof t)&&(e=t),e},Nd.prototype._copyDictionary=function(t,i){var n=this,r=new D(this._targetCrossReference);return t&&0<t.size&&t.forEach(function(t,e){("OC"===t&&e instanceof Array||"P"!==t&&"Parent"!==t&&"Dest"!==t&&"OC"!==t&&("AP"!==t||!i))&&null!=(e=n._copy(e))&&r.update(t,e)}),r._updated=!0,r},Nd.prototype._copyArray=function(t){for(var e=[],i=0,n=t.length;i<n;i++)e.push(this._copy(t[i]));return e},Nd.prototype._copyStream=function(t){var e,i,n=!1,r=t,s=(t.dictionary.has("Subtype")&&"Image"===t.dictionary.get("Subtype").name?(n=!0,t instanceof g?e=t.getByteRange(t.offset,t.end):t&&r.stream&&r.stream instanceof g?e="boolean"==typeof r._initialized&&r._cipher?(s=r.stream.end-r.stream.start,r.getBytes(s),r.buffer.subarray(0,r.bufferLength)):(i=r.stream).getByteRange(i.start,i.end):r.stream&&r.stream.stream?e=(r=r.stream).stream instanceof g&&"boolean"==typeof r._initialized&&r._cipher?(s=r.stream.end-r.stream.start,r.getBytes(s),r.buffer.subarray(0,r.bufferLength)):r.stream&&r.stream instanceof g?(i=r.stream).getByteRange(i.start,i.end):[]:(!(e=t.getBytes())||0===e.length)&&t instanceof Sh&&(e=t._bytes)):(!(e=t.getBytes())||0===e.length)&&t instanceof Sh&&(e=t._bytes),e instanceof Array?new Sh(e):new Sh(Array.from(e)));return s._isImage=n,s.dictionary=this._copyDictionary(t.dictionary),s.dictionary._updated=!0,s},Nd.prototype._copyReference=function(t){var e,i;return this._traversedObjects.has(t)?this._traversedObjects.get(t):(this._traversedObjects.set(t,null),e=this._sourceCrossReference._fetch(t),(e=this._copy(e))instanceof D||e instanceof y?(i=this._addToDestination(e),this._traversedObjects.set(t,i),i):(this._traversedObjects.set(t,e),e))},Nd.prototype._addToDestination=function(t){var e=this._targetCrossReference._getNextReference();return this._targetCrossReference._cacheMap.set(e,t),t.objId=e.objectNumber+" "+e.generationNumber,e};var Ed=Nd;function Nd(t,e){this._traversedObjects=new Map,this._isGroupingSupport=!1,this._targetCrossReference=t,this._sourceCrossReference=e}Object.defineProperty(Vd.prototype,"_layerPage",{get:function(){return this._pageParsed||this._parseLayerPage(),this._page},enumerable:!0,configurable:!0}),Object.defineProperty(Vd.prototype,"_layerId",{get:function(){return this._pageParsed||this._parseLayerPage(),this._id},set:function(t){this._id=t},enumerable:!0,configurable:!0}),Object.defineProperty(Vd.prototype,"name",{get:function(){return this._name||""},set:function(t){this._name=t,this._dictionary&&this._name&&""!==this.name&&this._dictionary.update("Name",this._name)},enumerable:!0,configurable:!0}),Object.defineProperty(Vd.prototype,"visible",{get:function(){var t;return this._dictionary&&"boolean"==typeof(t=this._dictionary.get("Visible"))&&(this._visible=t),this._visible},set:function(t){this._visible=t,this._dictionary&&this._dictionary.update("Visible",t),this._setVisibility(t),this._document._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0},enumerable:!0,configurable:!0}),Object.defineProperty(Vd.prototype,"locked",{get:function(){return this._locked},set:function(t){"boolean"==typeof(this._locked=t)&&this._setLock(t),this._document._catalog._catalogDictionary._updated=!0,this._crossReference._allowCatalog=!0},enumerable:!0,configurable:!0}),Object.defineProperty(Vd.prototype,"printState",{get:function(){return this._printState},set:function(t){this._printState=t,this._printOption?this.printState===M.PdfPrintState.alwaysPrint?this._printOption.update("PrintState",new R("ON")):this.printState===M.PdfPrintState.neverPrint&&this._printOption.update("PrintState",new R("OFF")):this._setPrintState()},enumerable:!0,configurable:!0}),Object.defineProperty(Vd.prototype,"layers",{get:function(){return this._layers||(this._layers=new zd(this._document,this._layer),this._layers._subLayer=!0),this._layers},enumerable:!0,configurable:!0}),Vd.prototype.createGraphics=function(t){return this._graphics&&!this._needInitializeGraphics||(this._page=t,this._crossReference=t._crossReference,this._parseGraphics()),this._graphics},Vd.prototype._parseGraphics=function(){this._loadContents();var t=new Sh([32,113,32,10]),e=this._crossReference._getNextReference(),t=(this._crossReference._cacheMap.set(e,t),this._page._contents.splice(0,0,e),new Sh([32,81,32,10])),e=this._crossReference._getNextReference(),t=(this._crossReference._cacheMap.set(e,t),this._page._contents.push(e),new Sh([])),e=this._crossReference._getNextReference();this._crossReference._cacheMap.set(e,t),this._page._contents.push(e),this._page._pageDictionary.set("Contents",this._page._contents),this._page._pageDictionary._updated=!0,this._initializeGraphics(t),this._initializeProperties()},Vd.prototype._initializeProperties=function(){var t,e,i=this._graphics._resourceObject;i&&i.has("Properties")?(e=i.get("Properties"))?e.update(this._id,this._referenceHolder):((t=new D).update(this._id,this._referenceHolder),i.update("Properties",t)):((e=new D).update(this._id,this._referenceHolder),i.update("Properties",e))},Vd.prototype._loadContents=function(){var t,e=this._page._pageDictionary.getRaw("Contents");e&&e instanceof m&&(t=e,e=this._crossReference._fetch(t)),e&&e instanceof y?this._page._contents=[t]:e&&Array.isArray(e)?this._page._contents=e:this._page._contents=[]},Vd.prototype._initializeGraphics=function(t){var e,i,n,r=!1,s=0,a=0,o=0,h=0,c=this._page.size,_=this._page.mediaBox,d=(_&&4<=_.length&&(s=_[0],a=_[1],o=_[2],h=_[3]),this._page._pageDictionary.has("CropBox")?(_=this._page.cropBox)&&4<=_.length?(e=_[0],d=_[1],i=_[2],n=_[3],(e<0||d<0||i<0||n<0)&&Math.floor(Math.abs(d))===Math.floor(Math.abs(c.height))&&Math.floor(Math.abs(e))===Math.floor(Math.abs(c.width))?this._graphics=new kr({width:Math.max(e,i),height:Math.max(d,n)},t,this._crossReference,this._page):(this._graphics=new kr(c,t,this._crossReference,this._page),this._graphics._cropBox=_)):this._graphics=new kr(c,t,this._crossReference,this._page):(s<0||a<0||o<0||h<0)&&Math.floor(Math.abs(a))===Math.floor(Math.abs(c.height))&&Math.floor(Math.abs(o))===Math.floor(Math.abs(c.width))?(e=Math.max(s,o),i=Math.max(a,h),(e<=0||i<=0)&&(r=!0,s<0&&(s=-s),a<0&&(a=-a),o<0&&(o=-o),h<0&&(h=-h),e=Math.max(s,o),i=Math.max(a,h)),this._graphics=new kr({width:e,height:i},t,this._crossReference,this._page)):this._graphics=new kr(c,t,this._crossReference,this._page),this._page._pageDictionary.has("MediaBox")&&(this._graphics._mediaBoxUpperRightBound=r?-a:h),this._graphicsState=this._graphics.save(),this._page._origin);0<=d[0]&&0<=d[1]||Math.sign(d[0])!==Math.sign(d[1])?this._graphics._initializeCoordinates():this._graphics._initializeCoordinates(this._page),this._page._isNew||(n=this._page.rotation,Number.isNaN(n))||n===M.PdfRotationAngle.angle0&&!this._page._pageDictionary.has("Rotate")||(_=void 0,_=this._page._pageDictionary.has("Rotate")?this._page._pageDictionary.get("Rotate"):90*n,s=this._graphics._clipBounds,90===_?(this._graphics.translateTransform({x:0,y:c.height}),this._graphics.rotateTransform(-90),this._graphics._clipBounds=[s[0],s[1],c.width,c.height]):180===_?(this._graphics.translateTransform({x:c.width,y:c.height}),this._graphics.rotateTransform(-180)):270===_&&(this._graphics.translateTransform({x:c.width,y:0}),this._graphics.rotateTransform(-270),this._graphics._clipBounds=[s[0],s[1],c.height,c.width])),this._page._isNew&&this._page._pageSettings&&(o=this._page._getActualBounds(this._page._pageSettings),this._graphics._clipTranslateMargins(o)),this._needInitializeGraphics=!1,this._graphicsCollection.has(this._graphics)||this._graphicsCollection.set(this._graphics,this._graphics),this._pageGraphics.has(this._page)||this._pageGraphics.set(this._page,this._graphics),-1===this._pages.indexOf(this._page)&&this._pages.push(this._page),this._graphics._layer=this},Vd.prototype._beginLayer=function(t){var e=this;this._graphicsCollection&&(this._graphicsCollection.has(t)?this._graphics=this._graphicsCollection.get(t):this._graphics=t),this._graphics&&this._name&&""!==this._name&&(this._graphics._isEmptyLayer=!0,0!==this._parentLayer.length&&this._parentLayer.forEach(function(t){t._id&&""!==t._layerId&&e._graphics._sw._write("/OC /"+t._id+" BDC")}),t="/OC /"+this._id+" BDC",this.name&&""!==this.name?(this._graphics._sw._write(t),this._isEndState=!0):this._content.write(t))},Vd.prototype._setVisibility=function(t){var e,i,n,r,s=this._document._catalog._catalogDictionary;(e=s.has("OCProperties")?(e=s.get("OCProperties"))||new D(this._crossReference):e)&&(i=s=void 0,(r=(r=e.get("D"))||new D(this._crossReference))&&(r.has("ON")&&(i=(i=r.get("ON"))||[]),r.has("OFF")&&(s=(s=r.get("OFF"))||[]),this._referenceHolder&&(t?(s&&-1!==(n=s.indexOf(this._referenceHolder))&&s.splice(n,1),i&&-1!==(n=i.indexOf(this._referenceHolder))&&i.splice(n),i):(i&&-1!==(n=i.indexOf(this._referenceHolder))&&i.splice(n,1),void 0===s&&r.update("OFF",s=[]),s&&-1!==(n=s.indexOf(this._referenceHolder))&&s.splice(n),s)).push(this._referenceHolder),r._updated=!0),e._updated=!0)},Vd.prototype._setLock=function(t){var e,i,n=this._document._catalog._catalogDictionary;(e=n.has("OCProperties")?(e=n.get("OCProperties"))||new D(this._crossReference):e)&&((n=(n=e.get("D"))||new D(this._crossReference))&&(i=n.get("Locked"),this._referenceHolder&&(t?i?-1===i.indexOf(this._referenceHolder)&&i.push(this._referenceHolder):(this._lock=[],this._lock.push(this._referenceHolder),n.update("Locked",this._lock)):i&&-1!==(t=i.indexOf(this._referenceHolder))&&i.splice(t,1)),n._updated=!0),e._updated=!0)},Vd.prototype._parseLayerPage=function(){if(this._document)for(var t=0;t<this._document.pageCount;t++){var e=this._document.getPage(t)._pageDictionary,i=this._document.getPage(t);if(e.has("Resources")){e=e.get("Resources");if(e&&(e.has("Properties")||e.has("XObject"))){var n,r,s=e.get("Properties"),e=e.get("XObject");if(s)for(r in n=s._map)if(n[String(r)]instanceof m){var a=n[String(r)],o=this._crossReference._fetch(a),h=r;if(this._parseDictionary(o,a,i,h))break}if(e)for(r in n=e._map)if(n[String(r)]instanceof m){a=n[String(r)];if((o=this._crossReference._fetch(a).dictionary).has("OC")){var c=r,_=o.getRaw("OC");if(o=this._crossReference._fetch(_),this._parseDictionary(o,_,i,c)){this._layer._xObject.push(c);break}}}}}}},Vd.prototype._parseDictionary=function(e,i,n,r){var t,s=this,a=!1;return e.has("Name")&&e.has("OCGs")?(t=e.get("OCGs"))?t.forEach(function(t){t instanceof m&&(i=t,e=s._crossReference._fetch(i),a=s._setLayerPage(i,n,r))}):(i=e.getRaw("OCGs"),(e=e.get("OCGs"))&&e.has("Name")&&(a=this._setLayerPage(i,n,r))):e.has("Name")&&(a=this._setLayerPage(i,n,r)),a},Vd.prototype._setLayerPage=function(t,e,i){var n=!1;return this._layer._referenceHolder&&this._layer._referenceHolder===t&&(n=this._layer._pageParsed=!0,this._layer._layerId=i,this._layer._page=e,-1===this._layer._pages.indexOf(e))&&this._layer._pages.push(e),n},Vd.prototype._setPrintState=function(){var t,e=this._document._catalog._catalogDictionary,e=(e=(t=e.has("OCProperties")?(t=e.get("OCProperties"))||new D(this._crossReference):t).get("OCGs"))||[],i=this._dictionary.has("Usage")?this._dictionary.get("Usage"):new D,n=(this._layer._printOption=new D,this._layer._printOption.update("Subtype",new R("Print")),this._layer._printState===M.PdfPrintState.neverPrint?this._layer._printOption.update("PrintState",new R("OFF")):this._layer.printState===M.PdfPrintState.alwaysPrint&&this._layer._printOption.update("PrintState",new R("ON")),this._crossReference._getNextReference()),i=(this._crossReference._cacheMap.set(n,this._layer._printOption),i.update("Print",n),this._layer._usage=i,this._dictionary.update("Usage",this._layer._usage),[]),r=(i.push(new R("Print")),new D),i=(r.update("Category",i),r.update("OCGs",e),r.update("Event",new R("Print")),[]),n=this._crossReference._getNextReference();this._crossReference._cacheMap.set(n,r),i.push(n),(t.get("D")||new D(this._crossReference)).update("D",i)};var jd=Vd;function Vd(){this._visible=!0,this._printState=M.PdfPrintState.printWhenVisible,this._isEndState=!1,this._dictionary=new D,this._pages=[],this._subLayer=[],this._locked=!1,this._parentLayer=[],this._child=[],this._graphicsCollection=new Map,this._pageGraphics=new Map,this._pageParsed=!1,this._xObject=[],this._content=new Sh([])}Object.defineProperty(Ud.prototype,"_isSkip",{get:function(){return 0<this._bdcCount},enumerable:!0,configurable:!0}),Object.defineProperty(Ud.prototype,"count",{get:function(){return this._list.length},enumerable:!0,configurable:!0}),Ud.prototype.at=function(t){return this._list[t]},Ud.prototype.add=function(t,e){var i=new jd;return i._document=this._document,i._crossReference=this._document._crossReference,i.name=t,null!=e&&(i.visible=e),i._layerId="OCG_"+ia(),i._subLayerPosition=0,i._layer=i,this._addLayer(i),i},Ud.prototype.contains=function(e){if(e)return"string"==typeof e?this._list.some(function(t){return t.name===e}):e instanceof jd&&-1!==this._list.indexOf(e);throw new Error("Layer cannot be null or undefined")},Ud.prototype.clear=function(){for(var t=this._list.length-1;-1<t;t--){var e=this._list[t];this._removeLayer(e,!0)}this._list.length=0},Ud.prototype.indexOf=function(t){if(t)return this._list.indexOf(t);throw new Error("Layer cannot be null or undefined")},Ud.prototype.move=function(t,e){if(t<0||t>=this._list.length)throw new Error("Index cannot be less than 0 or greater than array length");if(!e)throw new Error("Layer cannot be null or undefined");for(var i,n=0;n<this._list.length;n++)if(this._list[n]===e){i=this.indexOf(this._list[n]);break}null!=i&&i!==t&&(this._list.splice(i,1),this._list.splice(t,0,e),this._insertLayer(t,e))},Ud.prototype.removeAt=function(t,e){if(t<0||t>=this._list.length)throw new Error("Index cannot be less than 0 or greater than array length");var i=this._list[t];if(this._list.splice(t,1),i&&(this._removeLayer(i,e||!1),0<i._child.length))for(var n=0,r=i._child;n<r.length;n++){var s=r[n],s=(this._removeLayer(s,!1),this._list.indexOf(s));-1!==s&&this._list.splice(s,1)}},Ud.prototype.remove=function(t,e){if(t instanceof jd){var i=t;-1!==(r=this._list.indexOf(i))&&this.removeAt(r,e||!1)}else if("string"==typeof t)for(var n=0;n<this._list.length;n++){var i=this._list[n],r=this._list.indexOf(i);i.name===t&&-1!==r&&(this.removeAt(r,e||!1),n-=1)}},Ud.prototype._setPrintState=function(t,e){t=t.get("PrintState");t&&t instanceof R&&("ON"===t.name?e.printState=M.PdfPrintState.alwaysPrint:e.printState=M.PdfPrintState.neverPrint)},Ud.prototype._addLayer=function(t){this._list.push(t);var e=this._list.length-1;return this._document instanceof Sp&&this._createLayer(t),t._layer=t,e},Ud.prototype._createLayer=function(e){var i=this,t=new D(this._crossReference),n=this._createOptionalContentDictionary(e),r=!1;if(this._document&&this._document._catalog&&this._document._catalog._catalogDictionary.has("OCProperties")&&this._isLayerContainsResource){var s=this._document._catalog._catalogDictionary.get("OCProperties");if(s&&s.has("OCGs")){var a,o,h,c=s.get("OCGs");if(c&&n)for(var r=!0,_=0,d=n;_<d.length;_++){var l=d[_];-1===c.indexOf(l)&&c.push(l)}s.has("D")&&(s=s.get("D"))&&(h=o=a=void 0,s.has("Order")||s.update("Order",this._document._order),s.has("OFF")&&(o=s.get("OFF")),s.has("ON")&&(a=s.get("ON")),(h=s.has("AS")?s.get("AS"):h)&&h.forEach(function(t){t instanceof m&&(t=i._crossReference._fetch(t))&&t instanceof D&&(t=t.get("OCGs"))&&n&&-1===t.indexOf(e._referenceHolder)&&t.push(e._referenceHolder)}),e.visible?a&&n&&-1===a.indexOf(e._referenceHolder)&&a.push(e._referenceHolder):o&&n&&-1===o.indexOf(e._referenceHolder)&&o.push(e._referenceHolder)),this._document._catalog._catalogDictionary._updated=!0}}r||(t.update("OCGs",n),t.update("D",this._createOptionalContentViews()),this._catalog._catalogDictionary.update("OCProperties",t)),this._crossReference._allowCatalog=!0},Ud.prototype._createOptionalContentDictionary=function(t){var e=new D(this._crossReference),i=this._crossReference._getNextReference(),n=(this._crossReference._cacheMap.set(i,e),e.update("Name",t.name),e.update("Type",new R("OCG")),e.update("LayerID",new R(t._layerId)),e.update("Visible",t.visible),t.printState!==M.PdfPrintState.alwaysPrint&&t.printState!==M.PdfPrintState.neverPrint&&t.printState!==M.PdfPrintState.printWhenVisible||(n=this._setPrintOption(t),e.update("Usage",n),this._document._printLayer.push(i)),this._document._optionalContentDictionaries.push(i),t._dictionary=e,t._referenceHolder=i,this._document._catalog._catalogDictionary.get("OCProperties"));return this._createSublayer(n,i,t),(t.visible?this._document._on:this._document._off).push(i),this._isLayerContainsResource=!0,this._document._optionalContentDictionaries},Ud.prototype._createOptionalContentViews=function(){var t=new D,e=(t.update("Name","Layers"),t.update("Order",this._document._order),t.update("ON",this._document._on),t.update("OFF",this._document._off),[]),i=(e.push(new R("Print")),new D),e=(i.update("Category",e),i.update("OCGs",this._document._printLayer),i.update("Event",new R("Print")),this._crossReference._getNextReference());return this._crossReference._cacheMap.set(e,i),this._document._as.push(e),t.update("AS",this._document._as),t},Ud.prototype._setPrintOption=function(t){var e=new D,i=new D,n=this._crossReference._getNextReference(),r=this._crossReference._getNextReference();return this._crossReference._cacheMap.set(n,e),this._crossReference._cacheMap.set(r,i),i.update("Subtype",new R("Print")),t.printState===M.PdfPrintState.neverPrint?i.update("PrintState",new R("OFF")):t.printState===M.PdfPrintState.alwaysPrint&&i.update("PrintState",new R("ON")),t._usage=e,t._printOption=i,e.update("Print",r),n},Ud.prototype._createSublayer=function(t,e,i){if(this._subLayer){var n;if(i._parent=this._parent,t&&(o=void 0,(h=t.get("D"))&&(o=h.get("Order")),this._document._order)&&o&&(this._document._order=o),0!==this._parent._child.length&&-1!==this._document._order.indexOf(this._parent._referenceHolder)&&(r=this._document._order.indexOf(this._parent._referenceHolder),this._document._order.splice(r+1,1)),this._parent._subLayer.push(e),-1!==this._document._order.indexOf(this._parent._referenceHolder)){var r=this._document._order.indexOf(this._parent._referenceHolder);this._document._order.splice(r+1,0,this._parent._subLayer)}else if(this._parent._parent)-1!==this._parent._parent._subLayer.indexOf(this._parent._referenceHolder)&&(r=this._parent._parent._subLayer.indexOf(this._parent._referenceHolder),1===this._parent._subLayer.length&&this._parent._parent._subLayer.splice(r+1,0,this._parent._subLayer),-1!==this._document._order.indexOf(this._parent._parent._referenceHolder))&&(n=this._document._order.indexOf(this._parent._parent._referenceHolder),this._document._order.splice(n+1,1),this._document._order.splice(n+1,0,this._parent._parent._subLayer));else if(document instanceof Sp)for(var s=0;s<document._order.length;s++)if(Array.isArray(document._order[s])){var a=document._order[s];if(-1!==a.indexOf(this._parent._referenceHolder)){r=a.indexOf(this._parent._referenceHolder);if(1===this._parent._subLayer.length){a.splice(r+1,0,this._parent._subLayer);break}}}-1===this._parent._child.indexOf(i)&&this._parent._child.push(i),(0===this._parent._parentLayer.length||(this._parent._parentLayer.forEach(function(t){-1===i._parentLayer.indexOf(t)&&i._parentLayer.push(t)}),-1===i._parentLayer.indexOf(this._parent)))&&i._parentLayer.push(this._parent)}else{var o,h;t&&(o=void 0,o=(h=t.get("D"))?h.get("Order"):o)&&(this._document._order=o),this._document._order.push(e)}},Ud.prototype._checkLayerLock=function(t){var e,i=this,t=t.get("D");(e=t&&t.has("Locked")?t.get("Locked"):e)&&e.forEach(function(t){t&&t instanceof m&&(t=i._layerDictionary.get(t))&&(t.locked=!0)})},Ud.prototype._checkLayerVisible=function(t){var e,i=this,n=this._document;n._catalog&&n._catalog._catalogDictionary.has("OCProperties")&&(e=(n=t.get("D"))&&n.has("OFF")?n.get("OFF"):e)&&e.forEach(function(t){var e;t instanceof m&&(e=i._layerDictionary)&&0<e.size&&t&&e.has(t)&&(e=e.get(t))&&e._visible&&(e._visible=!1,e._dictionary)&&e._dictionary.set("Visible",!1)})},Ud.prototype._checkParentLayer=function(t){var t=t.get("D");t&&(t=t.get("Order"))&&this._parsingLayerOrder(null,t,this._layerDictionary)},Ud.prototype._parsingLayerOrder=function(t,e,i){for(var n,r=0;r<e.length;r++){var s=e[r];if(s instanceof m)(n=i.has(s)?i.get(s):n)&&(t&&(-1===t._child.indexOf(n)&&t._child.push(n),0!==t._parentLayer.length&&t._parentLayer.forEach(function(t){-1!==n._parentLayer.indexOf(t)||t instanceof jd||!t||n._parentLayer.push(t)}),n._parentLayer.push(t),n._parent=t),e.length>r+1)&&Array.isArray(e[r+1])&&(s=e[++r],n._subLayer=s,this._parsingLayerOrder(n,s,i));else if(Array.isArray(e[r])){s=e[r];if(!s||0===s.length)return;"string"==typeof s[0]?this._parsingLayerOrder(t=null,s,i):this._parsingLayerOrder(t=null,e[r],i)}}},Ud.prototype._createLayerHierarchical=function(t){var i=this,t=t.get("D");t&&t.has("Order")&&this._layerDictionary&&0<this._layerDictionary.size&&(this._list.splice(0,this._list.length),this._layerDictionary.forEach(function(t,e){t instanceof jd&&e instanceof m&&(t._parent||-1!==i._list.indexOf(t)?0<t._child.length?i._addChildLayer(t._parent):t._parent&&0===t._child.length&&!t._parent.layers.contains(t)&&t._parent.layers._addNestedLayer(t):i._list.push(t))}))},Ud.prototype._addChildLayer=function(e){e._child.forEach(function(t){-1===e.layers.indexOf(t)&&e.layers._addNestedLayer(t)})},Ud.prototype._addNestedLayer=function(t){this._list.push(t);var e=this._list.length-1;return t._layer=t,e},Ud.prototype._removeLayer=function(t,e){var i,n,r,s,a,o;t&&this._document&&((o=this._document._catalog._catalogDictionary)&&o.has("OCProperties")&&((i=o.get("OCProperties"))&&((a=i.get("OCGs"))&&this._removeOCG(t,a),i.has("D")&&((a=i.get("D"))&&(n=s=void 0,a.has("Order")&&(r=a.get("Order"))&&this._removeOrder(t,r,[]),a.has("Locked")&&(r=a.get("Locked"))&&this._removeLocked(t,r),a.has("OFF")&&(n=a.get("OFF")),a.has("ON")&&(s=a.get("ON")),a.has("AS")&&(r=a.get("AS"))&&this._removeUsage(t,r),this._removeVisible(t,s,n)),a._updated=!0),t._layerPage&&(r=t._layerPage._pageDictionary.get("Resources")).has("Properties")&&(s=r.get("Properties"))&&s.has(t._layerId)&&delete s._map[t._layerId],(n=this._crossReference._cacheMap).has(t._referenceHolder)&&(a=this._crossReference._cacheMap.get(t._referenceHolder))&&(r=a.getRaw("Usage"))instanceof m&&(a=this._crossReference._cacheMap.get(r))&&(s=a.getRaw("Print"),n.delete(t._referenceHolder),n.delete(r),n.delete(s)),i._updated=!0,o._updated=!0),this._crossReference._allowCatalog=!0),e)&&this._removeLayerContent(t)},Ud.prototype._removeOCG=function(t,e){e&&-1!==e.indexOf(t._referenceHolder)&&e.splice(e.indexOf(t._referenceHolder),1)},Ud.prototype._removeUsage=function(t,e){if(e)for(var i=!1,n=0;n<e.length;n++){var r=e[n];if(r){var s=void 0;if(r instanceof m&&(s=this._crossReference._fetch(e[n])),s=r instanceof D?r:s){r=s.get("OCGs");if(r&&(-1!==r.indexOf(t._referenceHolder)&&(r.splice(r.indexOf(t._referenceHolder),1),i=!0),i))break}}}},Ud.prototype._removeOrder=function(t,e,i){var n=!1;if(e)for(var r=0;r<e.length;r++){var s=e[r];if(s&&s instanceof m&&s===t._referenceHolder){if(r!==e.length-1){if(Array.isArray(e[r+1])){e.splice(r,2),n=!0;break}e.splice(r,1),n=!0;break}e.splice(r,1),n=!0;break}Array.isArray(s)&&i.push(e[r])}if(!n&&i)for(r=0;r<i.length;r++)e=i[r],i.splice(r,1),--r,this._removeOrder(t,e,i)},Ud.prototype._removeVisible=function(t,e,i){var n;t.visible?e&&-1!==e.indexOf(t._referenceHolder)&&-1<(n=e.indexOf(t._referenceHolder))&&e.splice(n,1):i&&-1!==i.indexOf(t._referenceHolder)&&-1<(n=i.indexOf(t._referenceHolder))&&i.splice(n,1)},Ud.prototype._removeLocked=function(t,e){e&&-1!==e.indexOf(t._referenceHolder)&&e.splice(e.indexOf(t._referenceHolder),1)},Ud.prototype._removeLayerContent=function(t){var e,i,n=!1;if(t._layerPage)for(var r=0;r<t._pages.length;r++){var s=t._pages[r]._pageDictionary.get("Resources");if(s&&(e=s.get("Properties"),i=s.get("XObject"),e&&0<t._layerId.trim().length&&e.has(t._layerId)&&delete e._map[t._layerId],i)&&0<t._xObject.length){for(var a=i._map,o=0,h=a;o<h.length;o++){var c=h[o];if(-1!==t._xObject.indexOf(a[String(c)])){delete i._map[String(c)];break}}-1!==t._xObject.indexOf(t._layerId)&&t._xObject.splice(t._xObject.indexOf(t._layerId),1)}for(var _=t._pages[r]._pageDictionary.getArray("Contents"),d=0;d<_.length;d++){for(var l=new Sh([]),u=_[d],p=u.dictionary.objId,f=u.getBytes(),g=(u instanceof Sh?new ui(u._bytes):new ui(f))._readContent(),y=0;y<g.length;y++){var m=g[y],b=m._operator,w=("BMC"!==b&&"EMC"!==b&&"BDC"!==b||(w=m._operands,this._processBeginMarkContent(t,b,w,l,p),n=!0),!1);(w="Do"===b&&"/"+t._layerId===m._operands[0]?!0:w)||(n=("q"===b||"Q"===b||"w"===b||"J"===b||"j"===b||"M"===b||"d"===b||"ri"===b||"i"===b||"gs"===b||"g"===b||"cm"===b||"G"===b||"rg"===b||"RG"===b||"k"===b||"K"===b||"cs"===b||"CS"===b||"scn"===b||"SCN"===b||"sc"===b||"SC"===b?n||this._streamWrite(m._operands,b,!1,l):n||this._streamWrite(m._operands,b,!0,l),!1))}0<l.length&&(f=(u=t._pages[r])._pageDictionary.getRaw("Contents")[d],this._crossReference._cacheMap.set(f,l),u._pageDictionary._updated=!0)}t._pages[r]._pageDictionary._updated=!0}},Ud.prototype._processBeginMarkContent=function(t,e,i,n,r){if("BDC"===e){var s=void 0;if(1<i.length&&"OC"===i[0].substring(1)&&(s=i[1].substring(1)),0<this._bdcCount)return void this._bdcCount++;s&&s===t._layerId&&(this._bdcCount++,s=t._pages[0]._pageDictionary.getRaw("Contents"),r)&&(r=r.split(" "),s=s.indexOf(m.get(Number(r[0]),Number(r[1]))),t._pages[0]._pageDictionary.getRaw("Contents").splice(s,1))}this._streamWrite(i,e,!0,n),"EMC"===e&&0<this._bdcCount&&this._bdcCount--},Ud.prototype._streamWrite=function(t,e,i,n){if(!i||!this._isSkip){if(t)for(var r=0,s=t;r<s.length;r++){var a=s[r];n.write(a),n.write(" ")}n.write(a=e),n.write("\r\n")}},Ud.prototype._insertLayer=function(t,e){var i,n,r,e=e._referenceHolder;this._document&&(n=this._document._catalog._catalogDictionary).has("OCProperties")&&(n=n.get("OCProperties"))&&(i=n.get("OCGs"),n.has("D"))&&(n=n.get("D"))&&(n=n.get("Order"))&&i&&-1!==n.indexOf(e)&&t<n.length&&n[t]instanceof m&&t+1<n.length&&t+2<n.length&&(r=t+2,n[t+1]instanceof m)&&n[r]instanceof m&&(r=n.indexOf(e),n.splice(r,1),n.splice(t,0,e),-1!==i.indexOf(e))&&(r=i.indexOf(e),i.splice(r,1),i.splice(t,0,e))};var zd=Ud;function Ud(r,t){var s,a,e,o=this;this._subLayer=!1,this._isLayerContainsResource=!1,this._layerDictionary=new Map,this._bdcCount=0,this._list||(this._list=[]),this._crossReference=r._crossReference,this._catalog=r._catalog,this._document=r,t?this._parent=t:this._document&&this._document._catalog&&this._document._catalog._catalogDictionary&&this._document._catalog._catalogDictionary.has("OCProperties")&&(t=this._document._catalog._catalogDictionary.get("OCProperties"))&&t.has("OCGs")&&((e=t.get("OCGs"))&&Array.isArray(e)&&e.forEach(function(t){var e,i,n;(a=t)instanceof m&&(s=o._crossReference._fetch(a),t=new jd,s)&&(s.has("Name")&&(e=s.get("Name"),t.name=e,t._dictionary=s,t._crossReference=o._document._crossReference,t._referenceHolder=a,(e=s.get("LayerID"))&&(t._layerId=e.name),(e=s.getRaw("Usage"))&&e instanceof D&&((n=e.get("Print"))&&n instanceof D&&(t._printOption=n).has("PrintState")&&o._setPrintState(n,t),n=e.get("View"))&&n instanceof D&&n.has("ViewState")&&"OFF"===n.get("ViewState").name&&(t.visible=!1),e)&&e instanceof m&&(e=o._crossReference._fetch(e))&&e instanceof D&&((i=e.getRaw("Print"))&&i instanceof m&&(i=o._crossReference._fetch(i))&&i instanceof D&&(t._printOption=i).has("PrintState")&&o._setPrintState(i,t),i=e.getRaw("View"))&&i instanceof m&&(n=o._crossReference._fetch(i))&&n instanceof D&&n.has("ViewState")&&"OFF"===n.get("ViewState").name&&(t.visible=!1),t._document=r,t._layer=t,o._layerDictionary.set(a,t),o._list.push(t))}),this._checkLayerLock(t),this._checkLayerVisible(t),this._checkParentLayer(t),this._createLayerHierarchical(t))}Object.defineProperty(Wd.prototype,"template",{get:function(){return this._document._isLoaded||this._template||(this._template={}),this._template},enumerable:!0,configurable:!0}),Wd.prototype.addPage=function(){var t=0===this._document.pageCount?0:this._document.pageCount,e=new D(this._crossReference),i=(e.update("Type",R.get("Page")),this._crossReference._getNextReference()),n=(this._crossReference._cacheMap.set(i,e),e.objId=i.toString(),e.update("Parent",this._reference),this._dictionary.has("Kids")?(n=this._dictionary.get("Kids"))&&(n.push(i),this._dictionary.update("Kids",n),go(this._dictionary,1),this._document._pageCount++):(this._dictionary.update("Kids",[i]),go(this._dictionary,1),this._document._pageCount=1),this._pageCount++,new br(this._crossReference,t,e,i));return n._pageSettings=this._pageSettings,n._isNew=!0,this._document._pages.set(t,n),n};var Hd=Wd;function Wd(t,e){this._pageCount=0,this._document=t,this._crossReference=t._crossReference;var i,n,r,t=new D(this._crossReference),e=(t.update("Type",R.get("Pages")),yo(t,this._pageSettings=e),this._crossReference._getNextReference()),s=(this._crossReference._cacheMap.set(e,t),t.objId=e.toString(),t.update("Kids",[]),t.update("Count",0),this._dictionary=t,this._reference=e,this._document.pageCount);0===s?(n=this._document._catalog._catalogDictionary._get("Pages"),(i=this._document._catalog._topPagesDictionary)&&(i.has("Kids")?(r=i.get("Kids"))&&(r.push(e),i.update("Kids",r),t.update("Parent",n)):(i.update("Kids",[e]),t.update("Parent",n)))):(i=this._document.getPage(s-1))&&i._pageDictionary&&(n=i._pageDictionary._get("Parent"),s=this._crossReference._fetch(n))&&s.has("Kids")&&(r=s.get("Kids"))&&(r.push(e),s.update("Kids",r),t.update("Parent",n))}Gd.prototype._parseDecimalString=function(t){return t.split("").reverse().map(function(t){return parseInt(t,10)})},Gd.prototype._toString=function(){return this.digits.slice().reverse().join("").replace(/^0+/,"")||"0"},Gd.prototype._toBigInt=function(){var t=this.digits.slice().reverse().join("").replace(/^0+/,"")||"0";return jo()(t)},Gd.prototype._add=function(t){for(var e=t,i=0;i<this.digits.length||0<e;i++){var n=(this.digits[i]||0)+e;this.digits[i]=n%10,e=Math.floor(n/10)}},Gd.prototype._multiply=function(){for(var t=0,e=0;e<this.digits.length;e++){var i=256*this.digits[e]+t;this.digits[e]=i%10,t=Math.floor(i/10)}for(;0<t;)this.digits.push(t%10),t=Math.floor(t/10)},Gd.prototype._bitLength=function(){for(var t=this.digits.slice(),e=0;1<t.length||0!==t[0];){for(var i=0,n=t.length-1;0<=n;n--){var r=10*i+t[n];t[n]=Math.floor(r/2),i=r%2}for(;1<t.length&&0===t[t.length-1];)t.pop();e++}return e};var qd=Gd;function Gd(t){this.digits=this._parseDecimalString(t=void 0===t?"0":t)}Xd.prototype.equals=function(t){if(!(t instanceof Xd))return!1;if(!this._identifier||!t._identifier||this._identifier.length!==t._identifier.length)return!1;for(var e=0;e<this._identifier.length;e++)if(this._identifier[e]!==t._identifier[e])return!1;return!0},Xd.prototype._getHashCode=function(){if(!this._identifier)return 0;for(var t=0,e=0;e<this._identifier.length;e++){t=(t<<5)-t+this._identifier[e];t|=0}return t};var Kd=Xd;function Xd(t){t.pubicKey&&t.id?this._identifier=(new iu)._createSubjectKeyID(t.pubicKey,t.id)._bytes:t.id&&(this._identifier=t.id)}Yd.prototype._getKeys=function(){var i=[];return this._orig.forEach(function(t,e){i.push(e)}),i},Yd.prototype._clear=function(){this._orig.clear(),this._keys.clear()},Yd.prototype._remove=function(t){var i,n=t.toLowerCase();if(this._keys.forEach(function(t,e){e.toLowerCase()===n&&(i=t)}),!i)return null;this._keys.delete(n);t=this._orig.get(i);return this._orig.delete(i),t},Yd.prototype._get=function(t){var e,i=t.toLowerCase(),n=[];this._keys.forEach(function(t,e){n.push([e,t])});for(var r=0;r<n.length;r++){var s=n[r],a=s[0],s=s[1];if(a.toLowerCase()===i){e=s;break}}return e?this._orig.get(e):null},Yd.prototype._setValue=function(t,e){var i,n=t.toLowerCase(),r=[];this._keys.forEach(function(t,e){r.push([e,t])});for(var s=0;s<r.length;s++){var a=r[s],o=a[0],a=a[1];if(o.toLowerCase()===n){i=a;break}}i&&this._orig.delete(i),this._keys.set(n,t),this._orig.set(t,e)};var Jd=Yd;function Yd(){this._orig=new Map,this._orig=new Map,this._keys=new Map}Zd.prototype._startChunkedConversion=function(t){return new P_(this,t)},Zd.prototype._rotateLeft=function(t,e){return t<<e|t>>>32-e},Zd.prototype._hash=function(t,e,i){for(var n=i+9+63>>6<<6,r=new Uint8Array(n),s=0;s<i;++s)r[s]=t[e++];r[s++]=128;for(var a=8*i,o=(r[n-4]=a>>>24&255,r[n-3]=a>>>16&255,r[n-2]=a>>>8&255,r[n-1]=255&a,1732584193),h=4023233417,c=2562383102,_=271733878,d=3285377520,l=new Uint32Array(80),u=0;u<n;u+=64){for(var p=0;p<16;++p){var f=u+4*p;l[p]=r[f]<<24|r[f+1]<<16|r[f+2]<<8|r[f+3]}for(p=16;p<80;++p)l[p]=this._rotateLeft(l[p-3]^l[p-8]^l[p-14]^l[p-16],1);for(var g=o,y=h,m=c,b=_,w=d,p=0;p<80;++p)var v=void 0,S=void 0,S=p<20?(v=y&m|~y&b,1518500249):p<40?(v=y^m^b,1859775393):p<60?(v=y&m|y&b|m&b,2400959708):(v=y^m^b,3395469782),v=this._rotateLeft(g,5)+v+w+S+l[p]>>>0,w=b,b=m,m=this._rotateLeft(y,30),y=g,g=v;o=o+g>>>0,h=h+y>>>0,c=c+m>>>0,_=_+b>>>0,d=d+w>>>0}return new Uint8Array([o>>>24&255,o>>>16&255,o>>>8&255,255&o,h>>>24&255,h>>>16&255,h>>>8&255,255&h,c>>>24&255,c>>>16&255,c>>>8&255,255&c,_>>>24&255,_>>>16&255,_>>>8&255,255&_,d>>>24&255,d>>>16&255,d>>>8&255,255&d])};var Qd=Zd;function Zd(){}tl.prototype._generateKeyID=function(t){var e=new Qd,t=t._publicKey._data;return e._hash(t,0,t.length)};var $d=tl;function tl(t){this._bytes=this._generateKeyID(t)}il.prototype._fromParts=function(t,e){t="number"==typeof e?[e].concat(t):t;if(!e||"number"==typeof e){if(t.length<2)throw new Error("An oid must contain at least two nodes");if(t[0]<0||2<t[0])throw new Error("Invalid oid: The first node must be 0, 1, or 2.");if(t[0]<2&&39<t[1])throw new Error("Invalid oid: When Node #1 is 0 or 1, Node #2 must be 0–39. Received: "+t+".")}var i=new il,t=i._encodeRelativeObjectIdentifier("number"==typeof e?[40*t[0]+t[1]].concat(t.slice(2)):t);return i._encoding=e&&"number"!=typeof e?this._mergeUint8Arrays(e._encoding,t):t,i},il.prototype._getNodes=function(){var t=this._decodeRelativeObjectIdentifier(this._encoding);return[Math.min(2,Math.floor(t[0]/40)),80<=t[0]?t[0]-80:t[0]%40].concat(t.slice(1))},il.prototype._getDotDelimitedNotation=function(){return this._getNodes().join(".")},il.prototype._getAbstractSyntaxNotation=function(){return"{ "+this._getNodes().map(function(t){return t.toString()}).join(" ")+" }"},il.prototype._mergeUint8Arrays=function(t,e){var i=new Uint8Array(t.length+e.length);return i.set(t,0),i.set(e,t.length),i},il.prototype._fromString=function(t){for(var e,i=[],n=0,r=0;r<t.length;r++)t.charCodeAt(r)===this._period&&(e=Number.parseInt(t.slice(n,r),10),i.push(e),n=r+1);var s=Number.parseInt(t.slice(n),10);return i.push(s),this._fromParts(i)},il.prototype._fromBytes=function(t){if(0===t.length)throw new Error("Encoded value was too short to be an object identifier");if(0!=(128&t[t.length-1]))throw new Error("oid was truncated.");for(var e=0,i=1;i<t.length;i++){var n=t[i];if(0===e&&128===n)throw new Error("Padding is not allowed in object identifier nodes");n<128?e=0:e++}var r=new il;return r._encoding=new Uint8Array(t),r},il.prototype._fromBytesUnsafe=function(t){var e=new il;return e._encoding=new Uint8Array(t),e},il.prototype.toString=function(){return this._getDotDelimitedNotation()},il.prototype._toJson=function(){return this._getDotDelimitedNotation()},il.prototype._toBytes=function(){return new Uint8Array(this._encoding)},il.prototype._encodeRelativeObjectIdentifier=function(t){for(var e=[],i=0,n=t;i<n.length;i++){var r=n[i];if(r<128)e.push(r);else{for(var s=0,a=r;0<a;)s++,a>>>=7;for(var o=s-1;0<=o;o--){var h=r>>>7*o&127;0!==o&&(h|=128),e.push(h)}}}return new Uint8Array(e)},il.prototype._decodeRelativeObjectIdentifier=function(t){if(0===t.length)return[];if(1<t.length&&0!=(128&t[t.length-1]))throw new Error("The relative object identifier is too long and was shortened.");for(var e=[],i=0,n=0;n<t.length;n++){var r=t[n];if(128===r&&0===i)throw new Error("Relative oid node has unsupported padding.");i=(i<<7)+(127&r),0==(128&r)&&(e.push(i),i=0)}return e};var el=il;function il(){this._encoding=new Uint8Array(0),this._period=".".charCodeAt(0)}function nl(t){var e=t.length;if(0===e)return 0;if(4<e)throw new Error("Input too large to convert to number without BigInt.");for(var i=0,n=0;n<e;n++)i=i<<8|t[n];return i}function rl(t){var e;if(-128<=t&&t<=127)return e=new Uint8Array(1),new DataView(e.buffer).setInt8(0,t),e;if(-32768<=t&&t<=32767)return e=new Uint8Array(2),new DataView(e.buffer).setInt16(0,t,!1),e;if(-8388608<=t&&t<=8388607)return e=new Uint8Array(4),new DataView(e.buffer).setInt32(0,t,!1),e.subarray(1);if(-2147483648<=t&&t<=2147483647)return e=new Uint8Array(4),new DataView(e.buffer).setInt32(0,t,!1),e;throw new Error("Integer out of range for 32-bit encoding without BigInt.")}function sl(t){var e=new Float64Array([t]),e=new Uint32Array(e.buffer);return{negative:t<0,exponent:((2146435072&e[1])>>>20)-1023-31,mantissa:2147483648+((1048575&e[1])<<11|(4292870144&e[0])>>>21)}}function al(t){if(t<-2147483648)throw Error("Number "+t+" too small to be encoded as a big-endian signed integer.");if(2147483647<t)throw Error("Number "+t+" too big to be encoded as a big-endian signed integer.");return t<=127&&-128<=t?new Uint8Array([255&t]):t<=32767&&-32768<=t?new Uint8Array([t>>8&255,255&t]):t<=8388607&&-8388608<=t?new Uint8Array([t>>16&255,t>>8&255,255&t]):new Uint8Array([t>>24&255,t>>16&255,t>>8&255,255&t])}function ol(t){if(t<0)throw new Error("Number "+t+" too small to be encoded as a big-endian unsigned integer.");if(4294967295<t)throw new Error("Number "+t+" too big to be encoded as a big-endian unsigned integer.");for(var e=new Uint8Array(4),i=(new DataView(e.buffer).setUint32(0,t,!1),0),n=0;n<e.length-1&&0===e[n];n++)i++;return e.subarray(i)}function hl(t){for(var e=Math.ceil(t.length/8),i=new Uint8Array(e),n=-1,r=0;r<t.length;r++){var s=r%8;0==s&&n++,0!==t[r]&&(i[n]|=1<<7-s)}return i}function cl(t,e){if("utf-8"!==(e=void 0===e?"utf-8":e))throw new Error("Only utf-8 encoding is supported in fallback.");for(var i="",n=0;n<t.length;){var r,s,a=t[n++];a<128?i+=String.fromCharCode(a):192<=a&&a<224?(r=t[n++],i+=String.fromCharCode((31&a)<<6|63&r)):224<=a&&a<240?(r=t[n++],s=t[n++],i+=String.fromCharCode((15&a)<<12|(63&r)<<6|63&s)):240<=a&&(a=(7&a)<<18|(63&(r=t[n++]))<<12|(63&(s=t[n++]))<<6|63&t[n++],i+=String.fromCharCode(55296+(a-65536>>10),56320+(a-65536&1023)))}return i}function _l(t){for(var e=0;e<t.length-1;e++)if(48===t[e]&&128===t[e+1])return!0;return!1}function dl(i,n,r){return function(t,e){if(!Number.isInteger(e))throw new Error("Non-integral "+i+" supplied to "+t+".");if(r<e)throw new Error("Encountered "+i+" greater than "+r+" in "+t+".");if(e<n)throw new Error("Encountered "+i+" less than "+n+" in "+t+".")}}function ll(t){return t<=127}function ul(t){return 32<=t&&t<=126}function pl(t){return 39<=t&&t<=57&&42!==t||65<=t&&t<=90||97<=t&&t<=122||32===t||58===t||61===t||63===t}function fl(t,e,i,n){if(!Number.isSafeInteger(e))throw new Error("Invalid year in "+t);if(!Number.isSafeInteger(i))throw new Error("Invalid month in "+t);if(!Number.isSafeInteger(n)||n<1)throw new Error("Invalid day in "+t);switch(i){case 0:case 2:case 4:case 6:case 7:case 9:case 11:if(31<n)throw new Error("Day > 31 encountered in "+t+" with 31-day month.");break;case 3:case 5:case 8:case 10:if(30<n)throw new Error("Day > 31 encountered in "+t+" with 30-day month.");break;case 1:if(e%4==0&&e%100!=0||e%400==0){if(29<n)throw new Error("Day > 29 encountered in "+t+" with month of February in leap year.")}else if(28<n)throw new Error("Day > 28 encountered in "+t+" with month of February and non leap year.");break;default:throw new Error("Invalid month in "+t)}}function gl(t,e,i,n){if(!Number.isSafeInteger(e))throw new Error("Invalid hours in "+t);if(!Number.isSafeInteger(i))throw new Error("Invalid minutes in "+t);if(!Number.isSafeInteger(n)||n<0)throw new Error("Invalid seconds in "+t);if(23<e)throw new Error("Hours > 23 encountered in "+t+".");if(59<i)throw new Error("Minutes > 60 encountered in "+t+".");if(59<n)throw new Error("Seconds > 60 encountered in "+t+".")}function yl(t,e,i,n,r,s,a){fl(t,e,i,n),gl(t,r,s,a)}function ml(t){return 48<=t&&t<=57||32===t}p.prototype._getTagNumber=function(){return this._tagNumber},p.prototype._setTagNumber=function(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("Tag "+t+" was not a non-negative number.");this._tagNumber=t},p.prototype._getLength=function(){return this._getValue().length},p.prototype._tagLength=function(){var t=this._getTagNumber();if(t<31)return 1;for(var e=t,i=0;0!==e;)e>>>=7,i++;return 1+i},p.prototype._toBytes=function(){for(var t=this._toBuffers(),e=t.reduce(function(t,e){return t+e.length},0),i=new Uint8Array(e),n=0,r=0,s=t;r<s.length;r++){var a=s[r];i.set(a,n),n+=a.length}return i},p.prototype._validateSize=function(t,e,i,n,r){r=void 0===r?1/0:r;if(i<n)throw new Error(t+" must be at least "+n+" "+e+", but was "+i+" "+e+".");if(r<i)throw new Error(t+" must not exceed "+r+" "+e+", but was "+i+" "+e+".")},p.prototype._validateRange=function(t,e,i,n){if(e<i)throw new Error(t+" must be at least "+i+", but was "+e+".");if(null!=n&&n<e)throw new Error(t+" must not exceed "+n+", but was "+e+".")},p.prototype._sizeConstrainedString=function(t,e){var i=this._getBitString();return this._validateSize(this._name||"Bit string","bits",i.length,t,e),i},p.prototype._sizeConstrainedUtf8String=function(t,e){var i=this._getUtf8String();return this._validateSize(this._name||"Unicode string","characters",i.length,t,e),i},p.prototype._sizeConstrainedSequenceOf=function(t,e){var i=this._getSequenceOf();return this._validateSize(this._name||"Sequence of","elements",i.length,t,e),i},p.prototype._sizeConstrainedSetOf=function(t,e){var i=this._getSequenceOf();return this._validateSize(this._name||"Set of","elements",i.length,t,e),i},p.prototype._sizeConstrainedNumericString=function(t,e){var i=this._getNumericString();return this._validateSize(this._name||"Numeric string","characters",i.length,t,e),i},p.prototype._sizeConstrainedPrintableString=function(t,e){var i=this._getPrintableString();return this._validateSize(this._name||"Printable ASCII string","characters",i.length,t,e),i},p.prototype._sizeConstrainedTextString=function(t,e){var i=this._getTeleprinterText();return this._validateSize(this._name||"Legacy encoded string","characters",i.length,t,e),i},p.prototype._sizeConstrainedVideoString=function(t,e){var i=this._getVideoTextInformation();return this._validateSize(this._name||"Videotex string","characters",i.length,t,e),i},p.prototype._sizeConstrainedIA5String=function(t,e){var i=this._getInternationalAlphabetString();return this._validateSize(this._name||"ASCII string","characters",i.length,t,e),i},p.prototype._sizeConstrainedGraphicString=function(t,e){var i=this._getGraphicString();return this._validateSize(this._name||"Graphic string","characters",i.length,t,e),i},p.prototype._sizeConstrainedVisibleString=function(t,e){var i=this._getVisibleString();return this._validateSize(this._name||"Visible string","characters",i.length,t,e),i},p.prototype._sizeConstrainedUniversalString=function(t,e){var i=this._getUniversalString();return this._validateSize(this._name||"Unicode string","characters",i.length,t,e),i},p.prototype._rangeConstrainedNumber=function(t,e){var i=this._getInteger();return this._validateRange(this._name||"Number",i,t,e),i},p.prototype._validateTag=function(t,e,i){return-1===t.indexOf(this._tagClass)?-1:-1===e.indexOf(this._construction)?-2:-1===i.indexOf(this._getTagNumber())?-3:0},p.prototype._toElement=function(){return this},p.prototype._fromElement=function(t){this._tagClass=t._tagClass,this._construction=t._construction;var e=t._getTagNumber(),e=(this._setTagNumber(e),t._getValue());this._setValue(e)},p.prototype._toString=function(){if(this._tagClass!==M._TagClassType.universal)return this._tagClass===M._TagClassType.context?"[CTXT "+this._getTagNumber()+"]: "+this._getValue().toString():this._tagClass===M._TagClassType.abstractSyntaxPrivate?"[PRIV "+this._getTagNumber()+"]: "+this._getValue().toString():"[APPL "+this._getTagNumber()+"]: "+this._getValue().toString();switch(this._getTagNumber()){case M._UniversalType.endOfContent:return"END-OF-CONTENT";case M._UniversalType.abstractSyntaxBoolean:return this._getBooleanValue()?"TRUE":"FALSE";case M._UniversalType.integer:return this._getInteger().toString();case M._UniversalType.octetString:return"'"+Array.from(this._getOctetString()).map(function(t){return Xo(t.toString(16),2,"0")}).join("")+"'H";case M._UniversalType.nullValue:return"NULL";case M._UniversalType.objectIdentifier:return this._getObjectIdentifier()._getAbstractSyntaxNotation();case M._UniversalType.objectDescriptor:return'"'+this._getObjectDescriptor()+'"';case M._UniversalType.external:return"_PdfExternal";case M._UniversalType.enumerated:return this._getEnumerated().toString();case M._UniversalType.embeddedDataValue:return"EMBEDDED PDV";case M._UniversalType.utf8String:return'"'+this._getUtf8String()+'"';case M._UniversalType.relativeObjectIdentifier:return"{ "+this._getRelativeObjectIdentifier().map(function(t){return t.toString()}).join(".")+" }";case M._UniversalType.time:return'"'+this._getTime()+'"';case M._UniversalType.sequence:return"{ "+this._getSequenceOf().map(function(t){return t.name.length?t.name+" "+t.toString():t.toString()}).join(" , ")+" }";case M._UniversalType.abstractSyntaxSet:return"{ "+this._getAbstractSetOf().map(function(t){return t.name.length?t.name+" "+t.toString():t.toString()}).join(" , ")+" }";case M._UniversalType.numericString:return'"'+this._getNumericString()+'"';case M._UniversalType.printableString:return'"'+this._getPrintableString()+'"';case M._UniversalType.teleprinterTextExchange:return"TeletexString";case M._UniversalType.videoTextInformationSystem:return"VideotexString";case M._UniversalType.internationalAlphabetString:return'"'+this._getInternationalAlphabetString()+'"';case M._UniversalType.characterString:return"CHARACTER STRING";case M._UniversalType.date:return'"'+this._getDate().toISOString()+'"';case M._UniversalType.timeOfDay:var t=this._getTimeOfDay();return'"'+t.getUTCHours()+":"+t.getUTCMinutes()+":"+t.getUTCSeconds()+'"';case M._UniversalType.dateTime:return'"'+this._getDateTime().toISOString()+'"';case M._UniversalType.objectIdResourceIdentifier:return this._getObjectIdResourceIdentifier();case M._UniversalType.relativeResourceIdentifier:return this._getRelativeResourceIdentifier();default:return"[UNIV "+this._getTagNumber()+"]: "+this._getValue().toString()}},p.prototype._toJson=function(){if(this._tagClass===M._TagClassType.universal)switch(this._getTagNumber()){case M._UniversalType.endOfContent:return;case M._UniversalType.abstractSyntaxBoolean:return this._getBooleanValue();case M._UniversalType.integer:return this._getInteger();case M._UniversalType.bitString:var t=this._getBitString();return{length:t.length,value:Array.from(hl(t)).map(function(t){return t.toString(16)}).join("")};case M._UniversalType.octetString:return Array.from(this._getOctetString()).map(function(t){return t.toString(16)}).join("");case M._UniversalType.nullValue:return null;case M._UniversalType.objectIdentifier:return this._getObjectIdentifier()._toJson();case M._UniversalType.objectDescriptor:return this._getObjectDescriptor();case M._UniversalType.enumerated:return this._getEnumerated().toString();case M._UniversalType.utf8String:return this._getUtf8String();case M._UniversalType.relativeObjectIdentifier:return this._getRelativeObjectIdentifier().map(function(t){return t.toString()}).join(".");case M._UniversalType.teleprinterTextExchange:return String.fromCodePoint.apply(String,Array.from(this._getTeleprinterText()));case M._UniversalType.videoTextInformationSystem:return String.fromCodePoint.apply(String,Array.from(this._getVideoTextInformation()));case M._UniversalType.graphicString:return this._getGraphicString();case M._UniversalType.visibleString:return this._getVisibleString();case M._UniversalType.universalString:return this._getUniversalString();case M._UniversalType.bmpString:return this._getBmpString();case M._UniversalType.date:return this._getDate().toISOString();case M._UniversalType.timeOfDay:t=this._getTimeOfDay();return t.getUTCHours()+":"+t.getUTCMinutes()+":"+t.getUTCSeconds();case M._UniversalType.dateTime:return this._getDateTime().toISOString();case M._UniversalType.objectIdResourceIdentifier:return this._getObjectIdResourceIdentifier();case M._UniversalType.relativeResourceIdentifier:return this._getRelativeResourceIdentifier();default:return}},p.prototype._sortCanonically=function(t){return t.sort(function(t,e){for(var i=t._toBytes(),n=e._toBytes(),r=Math.min(i.length,n.length),s=0;s<r;s++)if(i[s]!==n[s])return i[s]-n[s];return i.length-n.length})},p.prototype._isUniquelyTagged=function(t){for(var e=new Set([]),i=0;i<t.length;i++){var n=(t[i]._tagClass<<30)+t[i]._getTagNumber();if(e.has(n))return!1;e.add(n)}return!0},p.prototype._getInteger=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("Number cannot be constructed.");var t=this._getValue();return this._decodeInteger(t)},p.prototype._setInteger=function(t){this._setValue(this._encodeInteger(t))},p.prototype._getObjectIdentifier=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("Object identifier cannot be constructed.");return this._decodeObjectIdentifier(this._getValue())},p.prototype._setObjectIdentifier=function(t){this._setValue(this._encodeObjectIdentifier(t))},p.prototype._getEnumerated=function(){return Number(this._getInteger())},p.prototype._setEnumerated=function(t){this._setInteger(t)},p.prototype._getRelativeObjectIdentifier=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("Relative oid cannot be constructed.");return this._decodeRelativeObjectIdentifier(this._getValue())},p.prototype._setRelativeObjectIdentifier=function(t){this._setValue(this._encodeRelativeObjectIdentifier(t))},p.prototype._getTime=function(){return this._decodeTime(this._getValue())},p.prototype._setTime=function(t){this._setValue(this._encodeTime(t))},p.prototype._getDate=function(){return this._decodeDate(this._getValue())},p.prototype._setDate=function(t){this._setValue(this._encodeDate(t))},p.prototype._getTimeOfDay=function(){return this._decodeTimeOfDay(this._getValue())},p.prototype._setTimeOfDay=function(t){this._setValue(this._encodeTimeOfDay(t))},p.prototype._getDateTime=function(){return this._decodeDateTime(this._getValue())},p.prototype._setDateTime=function(t){this._setValue(this._encodeDateTime(t))},p.prototype._getObjectIdResourceIdentifier=function(){return this._decodeObjectIdResourceIdentifier(this._getValue())},p.prototype._setObjectIdResourceIdentifier=function(t){this._setValue(this._encodeObjectIdResourceIdentifier(t))},p.prototype._getRelativeResourceIdentifier=function(){return this._decodeRelativeResourceIdentifier(this._getValue())},p.prototype._setRelativeResourceIdentifier=function(t){this._setValue(this._encodeRelativeResourceIdentifier(t))},p.prototype._encodeInteger=rl,p.prototype._decodeInteger=function(t){if(0===t.length)throw new Error("Integer or enumeration encoded on zero bytes");var e;if(2<t.length&&(255===t[0]&&128<=t[1]||0===t[0]&&t[1]<128))throw e=t.slice(0,16),e=Array.from(e).map(function(t){return Xo(t.toString(16),2,"0")}).join(""),new Error("Unnecessary padding bytes on . First 16 bytes of the offending value were: 0x"+e);return nl(t)},p.prototype._encodeObjectIdentifier=function(t){return t._toBytes()},p.prototype._decodeObjectIdentifier=function(t){return(new el)._fromBytes(t)},p.prototype._encodeRelativeObjectIdentifier=function(t){for(var e=[],i=0,n=t;i<n.length;i++){var r=n[i];if(r<128)e.push(r);else{for(var s=0,a=r;0<a;)s++,a>>>=7;for(var o=s-1;0<=o;o--){var h=r>>>7*o&127;0!==o&&(h|=128),e.push(h)}}}return new Uint8Array(e)},p.prototype._decodeRelativeObjectIdentifier=function(t){if(0===t.length)return[];if(1<t.length&&0!=(128&t[t.length-1]))throw new Error("The relative object identifier is too long and was shortened.");for(var e=[],i=0,n=0;n<t.length;n++){var r=t[n];if(128===r&&0===i)throw new Error("The relative object identifier node has unsupported padding.");i=(i<<7)+(127&r),0==(128&r)&&(e.push(i),i=0)}return e},p.prototype._encodeTime=function(t){return v(t.replace(/,/g,"."))},p.prototype._decodeTime=function(t){return cl(t)},p.prototype._encodeDate=function(t){if(t.getFullYear()<1582||9999<t.getFullYear())throw new Error("The Date "+t.toISOString()+" may not be encoded, because the year must be greater than 1581 and less than 10000.");return v(Xo(t.getFullYear().toString(),4,"0")+Xo((t.getMonth()+1).toString(),2,"0")+Xo(t.getDate().toString(),2,"0"))},p.prototype._decodeDate=function(t){var t=cl(t),e=parseInt(t.slice(0,4),10),i=parseInt(t.slice(4,6),10)-1,t=parseInt(t.slice(6,8),10);return fl("DATE",e,i,t),new Date(e,i,t)},p.prototype._encodeTimeOfDay=function(t){return v(Xo(t.getHours().toString(),2,"0")+Xo(t.getMinutes().toString(),2,"0")+Xo(t.getSeconds().toString(),2,"0"))},p.prototype._decodeTimeOfDay=function(t){var t=cl(t),e=parseInt(t.slice(0,2),10),i=parseInt(t.slice(2,4),10),t=parseInt(t.slice(4,6),10),n=(gl("TIME-OF-DAY",e,i,t),new Date);return n.setHours(e),n.setMinutes(i),n.setSeconds(t),n},p.prototype._decodeDateTime=function(t){var t=cl(t),e=parseInt(t.slice(0,4),10),i=parseInt(t.slice(4,6),10)-1,n=parseInt(t.slice(6,8),10),r=parseInt(t.slice(8,10),10),s=parseInt(t.slice(10,12),10),t=parseInt(t.slice(12,14),10);return yl("DATE-TIME",e,i,n,r,s,t),new Date(e,i,n,r,s,t)},p.prototype._decodeGeneralString=function(t){for(var e=0;e<t.length;e++)if(!ll(t[e]))throw new Error("The input must contain only standard ASCII characters.");return cl(t)},p.prototype._decodeGraphicString=function(t){for(var e=0;e<t.length;e++)if(!ul(t[e]))throw new Error("Only standard printable ASCII characters are allowed.");return cl(t)},p.prototype._decodeNumericString=function(t){for(var e=0;e<t.length;e++)if(!ml(t[e]))throw new Error("The input must contain only numeric characters and spaces.");return cl(t)},p.prototype._decodeObjectDescriptor=function(t){for(var e=0;e<t.length;e++)if(!ul(t[e]))throw new Error("Only standard printable ASCII characters are allowed in the object descriptor.");return cl(t)},p.prototype._decodeObjectIdResourceIdentifier=function(t){return cl(t)},p.prototype._decodeRelativeResourceIdentifier=function(t){return cl(t)},p.prototype._decodePrintableString=function(t){for(var e=0;e<t.length;e++){var i=t[e];if(!pl(i))throw new Error("Printable ASCII string can only contain these characters: etaoinsrhdlucmfywgpbvkxqjzETAOINSRHDLUCMFYWGPBVKXQJZ0123456789 '()+,-./:=?. Encountered character code "+i+".")}return cl(t)},p.prototype._decodeVisibleString=function(t){for(var e=0;e<t.length;e++){var i=t[e];if(!ul(i))throw new Error("Visible string can only contain characters between 0x20 and 0x7E. Encountered character code "+i+".")}return cl(t)},p.prototype._encodeBitString=function(t){var e;return 0===t.length?new Uint8Array([0]):(e=(t.length>>>3)+(t.length%8!=0?1:0),(e=new Uint8Array(1+e))[0]=8-t.length%8,8===e[0]&&(e[0]=0),e.set(hl(t),1),e)},p.prototype._encodeBoolean=function(t){return new Uint8Array([t?255:0])},p.prototype._encodeDateTime=function(t){var e=t.getFullYear();if(e<1582||9999<e)throw new Error("The date cannot be encoded");return v(Xo(e.toString(),4,"0")+Xo((t.getMonth()+1).toString(),2,"0")+Xo(t.getDate().toString(),2,"0")+Xo(t.getHours().toString(),2,"0")+Xo(t.getMinutes().toString(),2,"0")+Xo(t.getSeconds().toString(),2,"0"))},p.prototype._encodeObjectIdResourceIdentifier=function(t){return v(t)},p.prototype._encodeRelativeResourceIdentifier=function(t){return v(t)},p.prototype._encodeSequence=function(t){for(var t=t.map(function(t){return t._toBytes()}),e=t.reduce(function(t,e){return t+e.length},0),i=new Uint8Array(e),n=0,r=0,s=t;r<s.length;r++){var a=s[r];i.set(a,n),n+=a.length}return i},p.prototype._encodeNumericString=function(t){return v(t)},p.prototype._encodePrintableString=function(t){return v(t)},p.prototype._encodeGraphicString=function(t){return v(t)},p.prototype._encodeVisibleString=function(t){return v(t)},p.prototype._encodeObjectDescriptor=function(t){return v(t)},p.prototype._toEncodedBytes=function(){return this._toBytes()},p.prototype._isTagged=function(){return this._tagClass===M._TagClassType.context},p.prototype._isConstructed=function(){return this._construction===M._ConstructionType.constructed};var bl=p;function p(){this._recursionCount=0,this._nestingRecursionLimit=5,this._name="",this._tagClass=M._TagClassType.universal,this._construction=M._ConstructionType.primitive,this._tagNumber=0}wl=function(t,e){return(wl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}wl(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(f,vl=bl),f.prototype._getValue=function(){var t;return Array.isArray(this._value)?t=this._encodeSequence(this._value):(t=No(this._value))!==this._value&&(this._value=t),this._currentValueLength=t.length,t},f.prototype._setValue=function(t){this._currentValueLength=t.length,this._value=t},f.prototype._getBooleanValue=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("boolean cannot be constructed.");return this._decodeBoolean(this._getValue())},f.prototype._setBooleanValue=function(t){this._setValue(this._encodeBoolean(t))},f.prototype._getBitString=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("Bit string cannot be constructed.");return this._decodeBitString(this._getValue())},f.prototype._setBitString=function(t){this._setValue(this._encodeBitString(t))},f.prototype._getOctetString=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("Octet string cannot be constructed.");return new Uint8Array(this._getValue())},f.prototype._setOctetString=function(t){this._setValue(new Uint8Array(t))},f.prototype._getObjectDescriptor=function(){return this._decodeObjectDescriptor(this._getValue())},f.prototype._setObjectDescriptor=function(t){this._setValue(this._encodeObjectDescriptor(t))},f.prototype._getUtf8String=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("Unicode text cannot be constructed.");return cl(this._getValue())},f.prototype._setUtf8String=function(t){this._setValue(v(t))},f.prototype._getSequence=function(){if(this._construction!==M._ConstructionType.constructed)throw new Error("Set or sequence cannot be primitively constructed.");return Array.isArray(this._value)?this._value:this._decodeSequence(this._getValue())},f.prototype._setSequence=function(t){this._construct(t),this._construction=M._ConstructionType.constructed},f.prototype._getAbstractSetValue=function(){var t=this._getSequence();if(this._isUniquelyTagged(t))return t;throw new Error("Duplicate tag in Set.")},f.prototype._setAbstractSetValue=function(t){this._sortCanonically(t),this._setSequence(t)},f.prototype._getSequenceOf=function(){if(this._construction!==M._ConstructionType.constructed)throw new Error("Set or sequence cannot be primitively constructed.");return Array.isArray(this._value)?this._value:this._decodeSequence(this._getValue())},f.prototype._setSequenceOf=function(t){this._construct(t),this._construction=M._ConstructionType.constructed},f.prototype._getAbstractSetOf=function(){return this._getSequence()},f.prototype._setAbstractSetOf=function(t){this._setSequence(t)},f.prototype._getNumericString=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("Numeric string cannot be constructed.");return this._decodeNumericString(this._getValue())},f.prototype._setNumericString=function(t){this._setValue(this._encodeNumericString(t))},f.prototype._getPrintableString=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("Printable ASCII string cannot be constructed.");return this._decodePrintableString(this._getValue())},f.prototype._setPrintableString=function(t){this._setValue(this._encodePrintableString(t))},f.prototype._getTeleprinterText=function(){return this._serialize()},f.prototype._setTeleprinterText=function(t){this._setValue(new Uint8Array(t))},f.prototype._getVideoTextInformation=function(){return this._getOctetString()},f.prototype._setVideoTextInformation=function(t){this._setValue(new Uint8Array(t))},f.prototype._getInternationalAlphabetString=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("ASCII string cannot be constructed.");return cl(this._getValue())},f.prototype._setInternationalAlphabetString=function(t){this._setValue(v(t))},f.prototype._getGraphicString=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("Graphic string cannot be constructed.");return this._decodeGraphicString(this._getValue())},f.prototype._setGraphicString=function(t){this._setValue(this._encodeGraphicString(t))},f.prototype._getVisibleString=function(){return this._decodeVisibleString(this._getValue())},f.prototype._setVisibleString=function(t){this._setValue(this._encodeVisibleString(t))},f.prototype._getUniversalString=function(){var t=this._getValue();if(this._construction!==M._ConstructionType.primitive)throw new Error("Universal string cannot be constructed.");if(t.length%4)throw new Error("Universal string encoded on non-mulitple of four bytes.");for(var e="",i=0;i<t.length;i+=4)e+=String.fromCharCode((t[i+0]<<24)+(t[i+1]<<16)+(t[i+2]<<8)+(t[i+3]<<0));return e},f.prototype._setUniversalString=function(t){for(var e=new Uint8Array(t.length<<2),i=0;i<t.length;i++)e[i<<2]=t.charCodeAt(i)>>>24,e[1+(i<<2)]=t.charCodeAt(i)>>>16,e[2+(i<<2)]=t.charCodeAt(i)>>>8,e[3+(i<<2)]=t.charCodeAt(i);this._setValue(e)},f.prototype._getBmpString=function(){var t=this._getValue();if(this._construction!==M._ConstructionType.primitive)throw new Error("BMPString cannot be constructed.");if(t.length%2!=0)throw new Error("BMPString encoded on non-multiple of two bytes.");if("undefined"!=typeof TextDecoder)return new TextDecoder("utf-16be").decode(t);for(var e="",i=0;i<t.length;i+=2){var n=t[i]<<8|t[i+1];e+=String.fromCharCode(n)}return e},f.prototype._setBmpString=function(t){for(var e=new Uint8Array(t.length<<1),i=0;i<t.length;i++){var n=t.charCodeAt(i);e[i<<1]=n>>8,e[1+(i<<1)]=255&n}this._setValue(e)},f.prototype._construct=function(t){this._currentValueLength=void 0,this._value=t},f.prototype._encode=function(t){switch(typeof t){case"undefined":this._setValue(new Uint8Array(0));break;case"boolean":this._setTagNumber(M._UniversalType.abstractSyntaxBoolean),this._setBooleanValue(t);break;case"number":Number.isInteger(t)&&(this._setTagNumber(M._UniversalType.integer),this._setInteger(t));break;case"string":this._setTagNumber(M._UniversalType.utf8String),this._setUtf8String(t);break;case"object":if(t)if(t instanceof Uint8Array)this._setTagNumber(M._UniversalType.octetString),this._setOctetString(t);else if(t instanceof Uint8ClampedArray)this._setTagNumber(M._UniversalType.bitString),this._setBitString(t);else if(t instanceof bl)this._construction=M._ConstructionType.constructed,this._setSequence([t]);else if(Array.isArray(t))this._construction=M._ConstructionType.constructed,this._setTagNumber(M._UniversalType.sequence),this._setSequence(t.map(function(t){var e=new f;return e._encode(t),e}));else{if(!(t instanceof el))throw new Error("Cannot encode value of type "+t.constructor.name+".");this._setTagNumber(M._UniversalType.objectIdentifier),this._setObjectIdentifier(t)}else this._setTagNumber(M._UniversalType.nullValue),this._setValue(new Uint8Array(0));break;default:throw new Error("Cannot encode value of type "+typeof t+".")}},f.prototype._fromSet=function(t){var e=new f(M._TagClassType.universal,M._ConstructionType.constructed,M._UniversalType.abstractSyntaxSet);return e._setAbstractSetValue(t.filter(function(t){return Boolean(t)})),e},f.prototype._fromSetOf=function(t){var e=new f(M._TagClassType.universal,M._ConstructionType.constructed,M._UniversalType.abstractSyntaxSet);return e._setAbstractSetOf(t.filter(function(t){return Boolean(t)})),e},f.prototype._getInner=function(){if(this._construction!==M._ConstructionType.constructed)throw new Error("An explicitly-encoded element cannot be encoded using primitive construction.");if(Array.isArray(this._value)){if(1!==this._value.length)throw new Error("An explicitly-encoding element contained "+this._value.length+" encoded elements.");return this._value[0]}var t=new f;if(t._fromBytes(this._value)!==this._value.length)throw new Error("An explicitly-encoding element contained more than one single ");return t},f.prototype._setInner=function(t){this._construction=M._ConstructionType.constructed,this._value=[t]},f.prototype._fromBytes=function(t){if(t.length<2)throw new Error("Tried to decode a DER element that is less than two bytes.");var e=0;switch(192&t[e]){case 0:this._tagClass=M._TagClassType.universal;break;case 64:this._tagClass=M._TagClassType.application;break;case 128:this._tagClass=M._TagClassType.context;break;case 192:this._tagClass=M._TagClassType.abstractSyntaxPrivate}if(this._construction=32&t[e]?M._ConstructionType.constructed:M._ConstructionType.primitive,this._setTagNumber(31&t[e]),e++,31<=(i=this._getTagNumber())){if(128===t[e])throw new Error("Leading padding byte on long tag number encoding.");for(var i=0,n=4<=t.length-1?4:t.length-1;e<n&&128&t[e++];);if(128&t[e-1])throw n==t.length-1?new Error("ASN1 tag number appears to have been truncated."):new Error("ASN1 tag number too large.");for(var r=1;r<e;r++)i=(i<<=7)|127&t[r];if(i<31)throw new Error("ASN1 tag number could have been encoded in short form.")}if(128==(128&t[e])){var s=127&t[e];if(127==s)throw new Error("Length byte with undefined meaning encountered.");if(4<s)throw new Error("Element length too long to decode to an integer.");if(e+s>=t.length)throw new Error("Element length bytes appear to have been truncated.");e++;for(var a=new Uint8Array(4),r=s;0<r;r--)a[4-r]=t[e+s-r];var o=0;if(a.forEach(function(t){o=(o<<8)+t}),e+o<e)throw new Error("ASN1 element too large.");if((e+=s)+o>t.length)throw new Error("ASN1 element truncated.");if(o<=127&&-128<=o&&1<s||o<=32767&&-32768<=o&&2<s||o<=8388607&&-8388608<=o&&3<s)throw new Error("DER-encoded long-form length encoded on more octets than necessary");return this._setValue(t.slice(e,e+o)),e+o}var h=127&t[e++];if(e+h>t.length)throw new Error("ASN1 element was truncated.");return this._setValue(t.slice(e,e+h)),e+h},f.prototype._tagAndLengthBytes=function(){var t=this._getTagNumber(),e=(3&this._tagClass)<<6|(1&this._construction)<<5,i=[];if(t<31)i=[e|31&t];else{for(var i=[31|e],n=[],r=t;n.unshift(127&r),0<(r>>>=7););for(var s=0;s<n.length;s++)i.push(s<n.length-1?128|n[s]:n[s])}e=this._getLengthOctets(),t=new Uint8Array(i.length+e.length);return t.set(i,0),t.set(e,i.length),t},f.prototype._toBuffers=function(){var t=[this._tagAndLengthBytes()];if(Array.isArray(this._value))for(var e=0,i=this._value;e<i.length;e++){var n=i[e];t.push.apply(t,n._toBuffers())}else t.push(this._serialize());return t},f.prototype._serialize=function(){return new Uint8Array(this._getValue())},f.prototype._getLengthOctets=function(){var t=this._valueLength();if(t<128)return[t];for(var e=[],i=t;0<i;)e.unshift(255&i),i>>>=8;return[128|e.length].concat(e)},f.prototype._getComponents=function(){if(Array.isArray(this._value))return this._value;for(var t=[],e=0;e<this._value.length;){var i=new f;e+=i._fromBytes(this._getValue().subarray(e)),t.push(i)}return t},f.prototype._decodeBitString=function(t){if(0===t.length)throw new Error("ASN1 bit string cannot be encoded on zero bytes!");if(1===t.length&&0!==t[0])throw new Error("ASN1 bit string encoded with deceptive first byte!");if(7<t[0])throw new Error("First byte of an ASN1 bit string must be <= 7!");for(var e=[],i=1;i<t.length;i++){var n=t[i];e.push(128&n?1:0,64&n?1:0,32&n?1:0,16&n?1:0,8&n?1:0,4&n?1:0,2&n?1:0,1&n?1:0)}for(var r=t[0],s=0,a=e.slice(e.length-r);s<a.length;s++)if(0!==a[s])throw new Error("bit string had a trailing set bit.");return e.length-=r,new Uint8ClampedArray(e)},f.prototype._decodeBoolean=function(t){if(1!==t.length)throw new Error("Invalid Boolean format: Boolean values must be exactly one byte.");if(0!==t[0]&&255!==t[0])throw new Error("Boolean must be encoded as 0xFF or 0x00.");return 0!==t[0]},f.prototype._encodeCharacterString=function(t){return this._encodeSequence([t._identification,new f(M._TagClassType.universal,M._ConstructionType.primitive,M._UniversalType.octetString,t._stringValue)])},f.prototype._decodeSequence=function(t){if(0===t.length)return[];for(var e=[],i=0;i<t.length;){var n=new f;i+=n._fromBytes(t.subarray(i)),e.push(n)}return e},f.prototype._fromSequence=function(t){var e=new f(M._TagClassType.universal,M._ConstructionType.constructed,M._UniversalType.sequence);return e._setSequence(t.filter(function(t){return Boolean(t)})),e},f.prototype._getExternalEncoding=function(t){switch(t._getTagNumber()){case 0:return t._getInner();case 1:return t._getOctetString();case 2:return t._getBitString();default:throw new Error("External does not know of an encoding option having tag number "+t._getTagNumber()+".")}},f.prototype._valueLength=function(){if(void 0!==this._currentValueLength&&null!==this._currentValueLength&&!Array.isArray(this._value))return this._currentValueLength;var t;if(!Array.isArray(this._value))return t=this._getValue(),this._currentValueLength=t.length,t.length;for(var e=0,i=0,n=this._value;i<n.length;i++)e+=n[i]._tagValueLength();return this._currentValueLength=e},f.prototype._lengthLength=function(t){t=null!=t?t:this._valueLength();if(t<128)return 1;for(var e=0,i=t;0<i;)e++,i>>>=8;return 1+e},f.prototype._tagValueLength=function(){var t=this._valueLength();return this._tagLength()+this._lengthLength(t)+t};var wl,vl,w=f;function f(t,e,i,n){void 0===t&&(t=M._TagClassType.universal),void 0===e&&(e=M._ConstructionType.primitive),void 0===i&&(i=M._UniversalType.endOfContent),void 0===n&&(n=void 0);var r=vl.call(this)||this;return r._value=new Uint8Array(0),r._encode(n),r._tagClass=t,r._construction=e,r._setTagNumber(i),r}Pl.prototype._getAlgorithms=function(t){return t instanceof Pl?t:t instanceof bl?new Pl(t):void 0},Pl.prototype._uniqueEncoderEncode=function(){if(this._element)return this._element._getValue();throw new Error("Cannot DER encode: not a DER element")},Pl.prototype._getUniqueEncoderNull=function(){var t=new w;return t._setTagNumber(5),t._tagClass=0,t._setValue(new Uint8Array(0)),t},Pl.prototype._getAbstractSyntax=function(){var t=new w(M._TagClassType.universal,M._ConstructionType.constructed,M._UniversalType.sequence),e=new w(M._TagClassType.universal,M._ConstructionType.primitive,6);return t._setSequence([e]),t};var Sl=Pl;function Pl(t){if(t){t=(this._element=t)._getSequence();if(!t||t.length<1||2<t.length)throw new Error("Invalid Algorithm Identifier sequence length");var e=t[0]._getValue();this._objectID=(new el)._fromBytes(e),2===t.length?(this._parameters=t[1],this._parametersDefined=!0):this._parametersDefined=!1}}Al.prototype._fromAbstractSyntaxOctets=function(t){return new Al(t.subarray(1),t[0])},Al.prototype._getBytes=function(){return this._data},Al.prototype._getUniqueEncoded=function(){var t=new Uint8Array(this._data.length+1);return t[0]=this._extraBits,t.set(this._data,1),t},Al.prototype._equals=function(t){if(!(t instanceof Al))return!1;if(this._extraBits!==t._extraBits)return!1;if(this._data.length!==t._data.length)return!1;for(var e=0;e<this._data.length;e++)if(this._data[e]!==t._data[e])return!1;return!0},Al.prototype._getUniqueBitStringFromTag=function(t,e){var t=t._getInner(),i=new Al;return e||t instanceof Al?i._getUniqueBitString(t):i._fromAbstractSyntaxOctets(t._getOctetString())},Al.prototype._getUniqueBitString=function(t){if(null==t)return null;if(t instanceof Al)return t;throw new Error("Invalid Entry")},Al.prototype._getAbstractSyntax=function(){var t=new w(M._TagClassType.universal,M._ConstructionType.primitive,M._UniversalType.bitString);return t._setValue(this._getUniqueEncoded()),t};var xl=Al;function Al(t,e){this._data=new Uint8Array(0),this._extraBits=0,this._table=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],t&&0<t.length&&(this._data=t,this._extraBits="number"==typeof e?e:0)}Cl.prototype._fromAbstractSyntax=function(t){t=t._getSequence();if(Array.isArray(t)&&2===t.length)return new Cl((new Sl)._getAlgorithms(t[0]),(new xl)._fromAbstractSyntaxOctets(t[1]._getValue()));throw new Error("Invalid length in sequence")},Cl.prototype._getPublicKeyInformation=function(t){return t instanceof Cl?t:t&&t._getSequence()?this._fromAbstractSyntax(t):void 0};var Tl=Cl;function Cl(t,e){t&&e&&(this._algorithms=t,this._publicKey=e)}kl=function(t,e){return(kl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}kl(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(b,Rl=bl),b.prototype._getValue=function(){var t;return this._value instanceof Uint8Array?this._value:(t=this._encodeSequence(this._value),this._value=t)},b.prototype._setValue=function(t){this._currentValueLength=t.length,this._value=t},b.prototype._getBooleanValue=function(){if(this._construction!==M._ConstructionType.primitive)throw new Error("boolean cannot be constructed.");return this._decodeBoolean(this._getValue())},b.prototype._setBooleanValue=function(t){this._setValue(this._encodeBoolean(t))},b.prototype._getBitString=function(){if(this._construction===M._ConstructionType.primitive)return this._decodeBitString(this._getValue());if(this._recursionCount+1>this._nestingRecursionLimit)throw new Error;for(var t=[],e=this._getSequence(),i=0,n=e.slice(0,e.length-1);i<n.length;i++){var r=(s=n[i])._getValue();if(s._construction===M._ConstructionType.primitive&&0<r.length&&0!==r[0])throw new Error("Only the final part of a multi-part bit string may start with a non-zero value.")}for(var s,a=0,o=e;a<o.length;a++){if((s=o[a])._tagClass!==this._tagClass)throw new Error("Invalid tag class in recursively-encoded bit string.");if(s._getTagNumber()!==this._getTagNumber())throw new Error("Invalid tag class in recursively-encoded bit string.");s._recursionCount=this._recursionCount+1,t.push.apply(t,Array.from(s._getBitString()).map(function(t){return 0!==t}))}return new Uint8ClampedArray(t.map(function(t){return t?1:0}))},b.prototype._setBitString=function(t){this._setValue(this._encodeBitString(t))},b.prototype._getOctetString=function(){return this._serialize("OCTET STRING")},b.prototype._setOctetString=function(t){this._setValue(new Uint8Array(t))},b.prototype._getObjectDescriptor=function(){var t=this._serialize("ObjectDescriptor");return this._decodeObjectDescriptor(t)},b.prototype._setObjectDescriptor=function(t){this._setValue(this._encodeObjectDescriptor(t))},b.prototype._getUtf8String=function(){return cl(this._serialize("UTF8String"))},b.prototype._setUtf8String=function(t){this._setValue(v(t))},b.prototype._getSequence=function(){if(this._construction!==M._ConstructionType.constructed)throw new Error("Set or sequence cannot be primitively constructed.");return Array.isArray(this._value)?this._value:this._decodedSequence(this._getValue())},b.prototype._setSequence=function(t){this._construct(t),this._construction=M._ConstructionType.constructed},b.prototype._getAbstractSetValue=function(){var t=this._getSequence();if(this._isUniquelyTagged(t))return t;throw new Error("Duplicate tag in Set.")},b.prototype._setAbstractSetValue=function(t){this._setSequence(t)},b.prototype._getSequenceOf=function(){if(this._construction!==M._ConstructionType.constructed)throw new Error("Set or sequence cannot be primitively constructed.");return Array.isArray(this._value)?this._value:this._decodedSequence(this._getValue())},b.prototype._setSequenceOf=function(t){this._construct(t),this._construction=M._ConstructionType.constructed},b.prototype._getAbstractSetOf=function(){return this._getSequence()},b.prototype._setAbstractSetOf=function(t){this._setSequence(t)},b.prototype._getNumericString=function(){var t=this._serialize("NumericString");return this._decodeNumericString(t)},b.prototype._setNumericString=function(t){this._setValue(this._encodeNumericString(t))},b.prototype._getPrintableString=function(){var t=this._serialize("PrintableString");return this._decodePrintableString(t)},b.prototype._setPrintableString=function(t){this._setValue(this._encodePrintableString(t))},b.prototype._getTeleprinterText=function(){return this._serialize("TeletexString")},b.prototype._setTeleprinterText=function(t){this._setValue(new Uint8Array(t))},b.prototype._getVideoTextInformation=function(){return this._serialize("VideotexString")},b.prototype._setVideoTextInformation=function(t){this._setValue(new Uint8Array(t))},b.prototype._getInternationalAlphabetString=function(){return cl(this._serialize("IA5String"))},b.prototype._setInternationalAlphabetString=function(t){this._setValue(v(t))},b.prototype._getGraphicString=function(){var t=this._serialize("GraphicString");return this._decodeGraphicString(t)},b.prototype._setGraphicString=function(t){this._setValue(this._encodeGraphicString(t))},b.prototype._getVisibleString=function(){return this._decodeVisibleString(this._getValue())},b.prototype._setVisibleString=function(t){this._setValue(this._encodeVisibleString(t))},b.prototype._getGeneralString=function(){var t=this._serialize("GeneralString");return this._decodeGeneralString(t)},b.prototype._setCharacterString=function(t){this._setValue(this._encodeCharacterString(t)),this._construction=M._ConstructionType.constructed},b.prototype._getUniversalString=function(){var t=this._serialize("UniversalString");if(t.length%4)throw new Error("Unicode string encoded on non-mulitple of four bytes.");for(var e="",i=0;i<t.length;i+=4)e+=String.fromCharCode((t[i+0]<<24)+(t[i+1]<<16)+(t[i+2]<<8)+(t[i+3]<<0));return e},b.prototype._setUniversalString=function(t){for(var e=new Uint8Array(t.length<<2),i=0;i<t.length;i++)e[i<<2]=t.charCodeAt(i)>>>24,e[1+(i<<2)]=t.charCodeAt(i)>>>16,e[2+(i<<2)]=t.charCodeAt(i)>>>8,e[3+(i<<2)]=t.charCodeAt(i);this._setValue(e)},b.prototype._getBmpString=function(){var t=this._serialize("BMPString");if(t.length%2!=0)throw new Error("BMPString encoded on non-multiple of two bytes.");if("undefined"!=typeof TextDecoder)return new TextDecoder("utf-16be").decode(t);for(var e="",i=0;i<t.length;i+=2){var n=t[i]<<8|t[i+1];e+=String.fromCharCode(n)}return e},b.prototype._setBmpString=function(t){for(var e=new Uint8Array(t.length<<1),i=0;i<t.length;i++){var n=t.charCodeAt(i);e[i<<1]=n>>>8,e[1+(i<<1)]=255&n}this._setValue(e)},b.prototype._construct=function(t){this._currentValueLength=void 0,this._value=t},b.prototype._encode=function(t){switch(typeof t){case"undefined":this._setValue(new Uint8Array(0));break;case"boolean":this._setTagNumber(M._UniversalType.abstractSyntaxBoolean),this._setBooleanValue(t);break;case"number":Number.isInteger(t)&&(this._setTagNumber(M._UniversalType.integer),this._setInteger(t));break;case"string":this._setTagNumber(M._UniversalType.utf8String),this._setUtf8String(t);break;case"object":if(t)if(t instanceof Uint8Array)this._setTagNumber(M._UniversalType.octetString),this._setOctetString(t);else if(t instanceof Uint8ClampedArray)this._setTagNumber(M._UniversalType.bitString),this._setBitString(t);else if(t instanceof bl)this._construction=M._ConstructionType.constructed,this._setSequence([t]);else if(Array.isArray(t)&&t.every(function(t){return t instanceof bl}))this._construction=M._ConstructionType.constructed,this._setAbstractSetValue(Array.from(t));else if(t instanceof el)this._setTagNumber(M._UniversalType.objectIdentifier),this._setObjectIdentifier(t);else{if(!Array.isArray(t))throw new Error("Cannot encode value of type "+t.constructor.name+".");this._construction=M._ConstructionType.constructed,this._setTagNumber(M._UniversalType.sequence),this._setSequence(t.map(function(t){var e=new b;return e._encode(t),e}))}else this._setTagNumber(M._UniversalType.nullValue),this._setValue(new Uint8Array(0));break;default:throw new Error("Cannot encode value of type "+typeof t+".")}},b.prototype._fromBerSequence=function(t){var e=new b(M._TagClassType.universal,M._ConstructionType.constructed,M._UniversalType.sequence);return e._setSequence(t.filter(function(t){return Boolean(t)})),e},b.prototype._fromSet=function(t){var e=new b(M._TagClassType.universal,M._ConstructionType.constructed,M._UniversalType.abstractSyntaxSet);return e._setAbstractSetValue(t.filter(function(t){return Boolean(t)})),e},b.prototype._fromSetOf=function(t){var e=new b(M._TagClassType.universal,M._ConstructionType.constructed,M._UniversalType.abstractSyntaxSet);return e._setAbstractSetOf(t.filter(function(t){return Boolean(t)})),e},b.prototype._getInner=function(t){if(this._construction!==M._ConstructionType.constructed)throw new Error("An explicitly-encoded element cannot be encoded using primitive construction.");if(Array.isArray(this._value)){if(1!==this._value.length)throw new Error("An explicitly-encoding element contained "+this._value.length+" encoded elements.");return this._value[0]}var e=new b,i=e._fromBytes(this._value);if(i===this._value.length||t)return e;throw new Error("An explicitly-encoding element contained more than one single encoded element. The tag number of the first decoded element was "+e._getTagNumber()+", and it was encoded on "+i+" bytes.")},b.prototype._setInner=function(t){this._construction=M._ConstructionType.constructed,this._value=[t]},b.prototype._fromBytes=function(t){if(t.length<2)throw new Error("Tried to decode a BER element that is less than two bytes.");if(this._recursionCount+1>this._nestingRecursionLimit)throw new Error;var e=0,i=t[e];switch(192&i){case 0:this._tagClass=M._TagClassType.universal;break;case 64:this._tagClass=M._TagClassType.application;break;case 128:this._tagClass=M._TagClassType.context;break;case 192:this._tagClass=M._TagClassType.abstractSyntaxPrivate}if(this._construction=32&i?M._ConstructionType.constructed:M._ConstructionType.primitive,e++,31<=(s=31&i)){if(e>=t.length)throw new Error("ASN1 tag number appears to have been truncated.");if(128===t[e])throw new Error("Leading padding byte on long tag number encoding.");for(var n=!(s=0);n;){if(e>=t.length)throw new Error("ASN1 tag number appears to have been truncated.");var r=t[e++],s=s<<7|127&r;0==(128&r)&&(n=!1)}if(s<31)throw new Error("ASN1 tag number could have been encoded in short form.")}if(this._setTagNumber(s),e>=t.length)throw new Error("Element length bytes appear to have been truncated.");i=t[e++];if(128==(128&i)){var a=127&i;if(0==a){if(this._construction!==M._ConstructionType.constructed)throw new Error("Invalid format: indefinite-length elements must be constructed, not primitive.");for(var o=e,h=e;h<t.length;){var c=new b;if(h+=c._fromBytes(t.subarray(h)),c._tagClass===M._TagClassType.universal&&c._construction===M._ConstructionType.primitive&&c._getTagNumber()===M._UniversalType.endOfContent&&0===c._getValue().length)break}if(h!==t.length||0===t[h-1]&&0===t[h-2])return this._setValue(t.slice(o,h-2)),h;throw new Error("Invalid format: indefinite-length ASN1 elements must end with an End-of-Content marker")}var _=a;if(e+_>t.length)throw new Error("Element length bytes appear to have been truncated.");for(var d=0,l=0;l<_;l++)d=d<<8|t[e+l];if((e+=_)+d<e)throw new Error("ASN1 element too large.");if(e+d>t.length)throw new Error("ASN1 element truncated.");return this._setValue(t.slice(e,e+d)),e+d}o=127&i;if(e+o>t.length)throw new Error("ASN1 element was truncated.");return this._setValue(t.slice(e,e+o)),e+o},b.prototype._lengthLength=function(t){if(this._lengthEncodingPreference===M._EncodingLength.indefinite)return 1;t=null!=t?t:this._valueLength();if(t<128)return 1;for(var e=0,i=t;0<i;)e++,i>>>=8;return 1+e},b.prototype._valueLength=function(){if(void 0!==this._currentValueLength&&null!==this._currentValueLength&&!Array.isArray(this._value))return this._currentValueLength;var t;if(!Array.isArray(this._value))return t=this._getValue(),this._currentValueLength=t.length,t.length;for(var e=0,i=0,n=this._value;i<n.length;i++)e+=n[i]._tagValueLength();return this._currentValueLength=e},b.prototype._tagAndLengthBytes=function(){var t=[0],e=(t[0]|=this._tagClass<<6,t[0]|=this._lengthEncodingPreference===M._EncodingLength.indefinite||this._construction===M._ConstructionType.constructed?32:0,this._getTagNumber());if(e<31)t[0]|=e;else{t[0]|=31;for(var i=e,n=[];n.unshift(127&i),0<(i>>>=7););for(var r=0;r<n.length-1;r++)n[r]|=128;t.push.apply(t,n)}var s=[],a=this._valueLength();switch(this._lengthEncodingPreference){case M._EncodingLength.definite:if(a<128)s=[a];else{for(var o=[],h=a;0<h;)o.unshift(255&h),h>>>=8;s=[128|o.length].concat(o)}break;case M._EncodingLength.indefinite:s=[128];break;default:throw new Error("An unsupported length encoding preference was detected")}e=new Uint8Array(t.length+s.length);return e.set(t,0),e.set(s,t.length),e},b.prototype._toBuffers=function(){var t=[];if(t.push(this._tagAndLengthBytes()),Array.isArray(this._value))for(var e=0,i=this._value;e<i.length;e++)for(var n=0,r=i[e]._toBuffers();n<r.length;n++){var s=r[n];t.push(s)}else t.push(this._value);return this._lengthEncodingPreference===M._EncodingLength.indefinite&&t.push(new Uint8Array(2)),t},b.prototype._serialize=function(t){if(this._construction===M._ConstructionType.primitive)return this._getValue();if(this._recursionCount+1>this._nestingRecursionLimit)throw new Error("Exceeded recursion limit while deconstructing "+t);for(var e=[],i=this._getSequence(),n=this._getTagNumber(),r=0,s=i;r<s.length;r++){var a=s[r];if(n===M._UniversalType.octetString){if(a._tagClass!==M._TagClassType.universal||a._getTagNumber()!==M._UniversalType.octetString)throw new Error("Invalid constructed OCTET STRING: children must be OCTET STRING (tag 4).")}else if(a._tagClass!==this._tagClass||a._getTagNumber()!==n)throw new Error("Invalid constructed "+t+": children must be of the same type as the parent.");a._recursionCount=this._recursionCount+1,e.push(a._getValue())}for(var i=e.reduce(function(t,e){return t+e.length},0),o=new Uint8Array(i),h=0,c=0,_=e;c<_.length;c++){var d=_[c];o.set(d,h),h+=d.length}return o},b.prototype._getComponents=function(){if(Array.isArray(this._value))return this._value;for(var t=[],e=0;e<this._value.length;){var i=new b;e+=i._fromBytes(this._getValue().subarray(e)),t.push(i)}return t},b.prototype._decodeBitString=function(t){if(0===t.length)throw new Error("ASN1 Bit String cannot be encoded on zero bytes!");if(1===t.length&&0!==t[0])throw new Error("ASN1 Bit String encoded with deceptive first byte!");if(7<t[0])throw new Error("First byte of an ASN1 Bit String must be <= 7!");for(var e=[],i=1;i<t.length;i++){var n=t[i];e.push(128&n?1:0,64&n?1:0,32&n?1:0,16&n?1:0,8&n?1:0,4&n?1:0,2&n?1:0,1&n?1:0)}return e.length-=t[0],new Uint8ClampedArray(e)},b.prototype._decodeBoolean=function(t){if(1!==t.length)throw new Error("Invalid Boolean format: Boolean values must be exactly one byte.");return 0!==t[0]},b.prototype._decodedSequence=function(t){for(var e=[],i=0;i<t.length;){var n=new b;i+=n._fromBytes(t.subarray(i)),e.push(n)}return e},b.prototype._getRealEncodingBase=function(t){switch(48&t){case M._RealEncodingBase.base2:return 2;case M._RealEncodingBase.base8:return 8;case M._RealEncodingBase.base16:return 16;default:throw new Error("Impossible real encoding base encountered.")}},b.prototype._encodeCharacterString=function(t){return this._encodeSequence([t._identification,new w(M._TagClassType.universal,M._ConstructionType.primitive,M._UniversalType.octetString,t._stringValue)])},b.prototype._decodeSequence=function(t){if(0===t.length)return[];for(var e=[],i=0;i<t.length;){var n=new w;i+=n._fromBytes(t.subarray(i)),e.push(n)}return e},b.prototype._fromSequence=function(t){var e=new w(M._TagClassType.universal,M._ConstructionType.constructed,M._UniversalType.sequence);return e._setSequence(t.filter(function(t){return Boolean(t)})),e},b.prototype._getExternalEncoding=function(t){switch(t._getTagNumber()){case 0:return t._getInner();case 1:return t._getOctetString();case 2:return t._getBitString();default:throw new Error("external does not know of an encoding option having tag number "+t._getTagNumber()+".")}},b.prototype._tagValueLength=function(){var t=this._valueLength();return this._tagLength()+this._lengthLength(t)+t};var kl,Rl,Fl=b;function b(t,e,i,n){void 0===t&&(t=M._TagClassType.universal),void 0===e&&(e=M._ConstructionType.primitive),void 0===i&&(i=M._UniversalType.endOfContent),void 0===n&&(n=void 0);var r=Rl.call(this)||this;return r._lengthEncodingPreference=M._EncodingLength.definite,r._value=new Uint8Array(0),r._period=".".charCodeAt(0),r._comma=",".charCodeAt(0),r._z="Z".charCodeAt(0),r._plus="+".charCodeAt(0),r._minus="-".charCodeAt(0),r._encode(n),r._tagClass=t,r._construction=e,r._setTagNumber(i),r}(Mh=M._EncodingLength||(M._EncodingLength={}))[Mh.definite=0]="definite",Mh[Mh.indefinite=1]="indefinite",Dl=function(t,e){return(Dl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};function Il(t){this._isPrivate=t}(function(t,e){function i(){this.constructor=t}Dl(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Ol,Bl=Il);var Dl,Bl,Ll=Ol;function Ol(t,e,i){t=Bl.call(this,t)||this;return t._modulus=e,t._exponent=i,t}var Ml=function(t,e){this._value=e,this._critical=t},El=(Nl.prototype._fromSequence=function(t){for(var e=new Map,i=0,n=t;i<n.length;i++){var r=n[i]._getSequence();if(!r||r.length<2||3<r.length)throw new Error("Bad sequence size");var s=r[0]._getObjectIdentifier().toString(),a=3===r.length&&r[1]._getBooleanValue(),r=r[r.length-1];e.set(s,new Ml(a,r))}return new Nl(e)},Nl.prototype._getInstance=function(t){if(t instanceof Nl)return t;var e;if(t instanceof bl)return e=new Nl,t=t._getSequence(),e._fromSequence(t[0]._getSequence());throw new Error("Unknown object in factory")},Nl.prototype._getExtension=function(t){t=t._encoding.toString().replace(/,/g,"."),t=this._extensions.get(t);return t||null},Nl);function Nl(t,e){if(this._extensions=new Map,this._ordering=[],this._authorityKeyIdentifier=(new el)._fromString("2.5.29.35"),this._certificateRevocationListPoints=(new el)._fromString("2.5.29.31"),this._authorityInfoAccess=(new el)._fromString("1.3.6.1.5.5.7.1.1"),t||e){var i=[];t.forEach(function(t,e){i.push(e)}),this._ordering=null!=e?e:i;for(var n=0,r=this._ordering;n<r.length;n++){var s=r[n],a=t.get(s);a&&this._extensions.set(s,a)}}}jl.prototype._getExtension=function(t){var e=this._getExtensions();return(e=e&&e._getExtension(t))?e._value:null};Mh=jl;function jl(){}Vl=function(t,e){return(Vl=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Vl(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Hl,zl=Mh),Hl.prototype._getExtensions=function(){var t=this._structure._getSignedCertificate();return 3===t._getVersion()?t._extensions:new El},Hl.prototype._getPublicKey=function(){var t=this._structure._getSignedCertificate();return this._createKey(t._publicKeyInformation)},Hl.prototype._createKey=function(t){var e=t._algorithms._objectID.toString(),i=new w;if(i._fromBytes(t._publicKey._getBytes()),this._publicKeyBytes=t._publicKey._data,"1.2.840.113549.1.1.1"===e)return this._parsePublicKey(i);throw new Error("Unsupported Algorithm")},Hl.prototype._parsePublicKey=function(t){t=t._getSequence();if(!t||t.length<2)throw new Error("Invalid RSA public key structure");var e=t[0]._getValue(),t=t[1]._getValue();return new Ll(!0,e,t)},Hl.prototype._getTobeSignedCertificate=function(){return this._structure._getSignedCertificate()._getDistinguishEncoded()},Hl.prototype._getEncoded=function(){return this._structure._getDerEncoded()},Hl.prototype._getEncodedString=function(){return this._getEncoded()};var Vl,zl,Ul=Hl;function Hl(t){var e,i,n=zl.call(this)||this,t=(n._keyUsage=[],n._structure=t,(new el)._fromString("2.5.29.15")),t=n._getExtension(t);return t?((e=new(_l(t=t._getValue())?Fl:w))._fromBytes(t),e=(t=(e._construction===M._ConstructionType.constructed?e._getInner():e)._getValue())[0],t=8*(i=t.slice(1)).length-e,n._keyUsage=Array.from({length:Math.max(9,t)},function(t,e){return 0!=(i[Math.floor(e/8)]&128>>e%8)})):n._keyUsage=null,n}var Wl=function(t){this._hashValueSet=!1,this._certificate=t},ql=function(t){var n=this;this._ordering=[],this._values=[],this._added=[],this._countryNameOid="2.5.4.6",this._organizationNameOid="2.5.4.10",this._organizationalUnitNameOid="2.5.4.11",this._titleOid="2.5.4.12",this._commonNameOid="2.5.4.3",this._sequence=t,this._defaultSymbols=new Map([[this._countryNameOid,"C"],[this._organizationNameOid,"O"],[this._organizationalUnitNameOid,"OU"],[this._titleOid,"T"],[this._commonNameOid,"CN"]]),t.forEach(function(t){t&&t._getSequence().forEach(function(t,e){var i=[];(i=t?t._getSequence():i)&&2<=i.length&&(t=(new el)._fromBytes(i[0]._getValue()),n._ordering.push(t),t="",((i=i[1])instanceof w||i instanceof Fl)&&(t=vs(i._getOctetString())),n._values.push(t),n._added.push(0!==e))})})},Gl=(Kl.prototype._getUniversalTime=function(){if(23===this._time._getTagNumber()){var t=this._time._getValue();if("string"==typeof t)return t.trim();if(t instanceof Uint8Array){for(var e=[],i=0;i<t.length;i++)e.push(t[i]);return String.fromCharCode.apply(null,e).trim()}}},Kl.prototype._toDate=function(){var t=this._getUniversalTime();if(t){var e,i,n,r,s=t.match(/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z$/);if(s=s||t.match(/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z$/))return t=parseInt(s[1],10),t+=t<50?2e3:1900,e=parseInt(s[2],10)-1,i=parseInt(s[3],10),n=parseInt(s[4],10),r=parseInt(s[5],10),s=6<s.length&&void 0!==s[6]?parseInt(s[6],10):0,new Date(Date.UTC(t,e,i,n,r,s))}},Kl);function Kl(t){this._time=t}Jl.prototype._getVersion=function(){return this._version+1},Jl.prototype._getDistinguishEncoded=function(){var t=new w;return t._tagClass=M._TagClassType.universal,t._construction=M._ConstructionType.constructed,t._setTagNumber(M._UniversalType.sequence),t._setSequence(this._sequence),t._toBytes()};var Xl=Jl;function Jl(t){this._sequence=t._getSequence();for(var t=0,e=(0===this._sequence[0]._getTagNumber()&&2===this._sequence[0]._tagClass?this._version=2:(t=-1,this._version=0),this._serialNumber=this._sequence[t+1]._getValue(),this._signature=new Sl(this._sequence[t+2]),this._issuer=new ql(this._sequence[t+3]._getSequence()),this._sequence[t+4]._getSequence()),i=(this._startDate=new Gl(e[0]),this._endDate=new Gl(e[1]),this._subject=new ql(this._sequence[t+5]._getSequence()),this._publicKeyInformation=(new Tl)._getPublicKeyInformation(this._sequence[t+6]),t+6),n=this._sequence.length-1;i<n;n--){var r=this._sequence[n],s=new xl;switch(r._getTagNumber()){case 1:this._issuerID=s._getUniqueBitStringFromTag(r,!1);break;case 2:this._subjectID=s._getUniqueBitStringFromTag(r,!1);break;case 3:this._extensions=(new El)._getInstance(r)}}}Ql.prototype._getSignedCertificate=function(){return this._toBeSignedCertificate},Ql.prototype._getInstance=function(t){return Array.isArray(t)&&t.every(function(t){return t instanceof bl})?new Ql(t):null},Ql.prototype._getDerEncoded=function(){var t=new w;return t._tagClass=M._TagClassType.universal,t._construction=M._ConstructionType.constructed,t._setTagNumber(M._UniversalType.sequence),t._setSequence(this._sequence),t._toBytes()};var Yl=Ql;function Ql(t){if(t){if(!Array.isArray(t)||3!==t.length)throw new Error("Invalid certificate sequence length: "+t.length);this._sequence=t,this._toBeSignedCertificate=new Xl(t[0]),this._signatureAlgorithmIdentifier=new Sl(t[1]),this._signature=new xl(t[2]._getValue())}}$l.prototype._readDistinguishEncoderCertificate=function(t,e){var i=new Yl,n=new Fl,t=(n._fromBytes(t),n._getSequence()),n=t[0]._getTagNumber();if(1<t.length&&n===M._UniversalType.objectIdentifier&&"1.2.840.113549.1.7.2"===t[0]._getObjectIdentifier()._getDotDelimitedNotation()){if(2<=t.length)for(var r=0,s=t[1]._getInner()._getSequence();r<s.length;r++){var a=s[r];if(a instanceof Fl&&a._tagClass===M._TagClassType.context&&0===a._getTagNumber()){var a=a._getInner(e),o=void 0,o=e?a._getSequence():a._getAbstractSetValue();this._sData=o;break}}return this._getCertificate(e)}return this._createX509Certificate(i._getInstance(t))},$l.prototype._getCertificate=function(t){var e=new Yl;if(this._sData){if(t)return this._createX509Certificate(e._getInstance(this._sData));for(;this._sDataObjectCount<this._sData.length;){var i=this._sData[this._sDataObjectCount++];if(i._getTagNumber()===M._UniversalType.sequence)return this._createX509Certificate(e._getInstance(i._getSequence()))}}return null},$l.prototype._createX509Certificate=function(t){return new Ul(t)},$l.prototype._readCertificate=function(t,e){return this._readCertificateFromStream(t,e=void 0===e?!1:e)},$l.prototype._readCertificateFromStream=function(t,e){if(t&&0!==t.length)return this._currentStream!==t&&(this._currentStream=t,this._sData=null,this._sDataObjectCount=0),this._sData&&this._sDataObjectCount<this._sData.length?this._getCertificate():t[0]<0?null:this._readDistinguishEncoderCertificate(t,e);throw new Error("Input stream is empty or null")};var Zl=$l;function $l(){this._sDataObjectCount=0}eu.prototype._beToUint32=function(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0},eu.prototype._uint32ToBe=function(t,e,i){e[i]=t>>>24&255,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=255&t},eu.prototype._generateWorkingKey=function(t,e){for(var i=[128,64,32,16,8,4,2,1],n=[8388608,4194304,2097152,1048576,524288,262144,131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1],r=[56,48,40,32,24,16,8,0,57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,60,52,44,36,28,20,12,4,27,19,11,3],s=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],a=[13,16,10,23,0,4,2,27,14,5,20,9,22,18,11,3,25,7,15,6,26,19,12,1,40,51,30,36,46,54,29,39,50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31],o=new Int32Array(32),h=new Array(56).fill(!1),c=new Array(56).fill(!1),_=0;_<56;_++){var d=r[_];h[_]=0!=(e[d>>3]&i[7&d])}for(var l=0;l<16;l++){for(var u=t?l<<1:15-l<<1,p=1+u,_=o[u]=o[p]=0;_<28;_++){var f=_+s[l];c[_]=f<28?h[f]:h[f-28]}for(_=28;_<56;_++){f=_+s[l];c[_]=f<56?h[f]:h[f-28]}for(_=0;_<24;_++)c[a[_]]&&(o[u]|=n[_]),c[a[_+24]]&&(o[p]|=n[_])}for(l=0;32!==l;l+=2){var g=o[l],y=o[l+1];o[l]=(16515072&g)<<6|(4032&g)<<10|(16515072&y)>>>10|(4032&y)>>>6,o[l+1]=(258048&g)<<12|(63&g)<<16|(258048&y)>>>4|63&y}return o},eu.prototype._processEncryptionBlock=function(t,e,i,n,r){var s=this._beToUint32(e,i)>>>0,a=this._beToUint32(e,i+4)>>>0,a=((a=(a=(a=(a^=c=252645135&(s>>>4^a))^(c=65535&((s^=c<<4)>>>16^a)))^(c=858993459&(a>>>2^(s^=c<<16)))<<2)^(c=16711935&(a>>>8^(s^=c)))<<8)<<1|a>>>31)>>>0;a^=c=2863311530&((s^=c)^a);for(var s=((s^=c)<<1|s>>>31)>>>0,o=0;o<8;o++){c=(a<<28|a>>>4)>>>0,c^=t[4*o+0];var h=this._sp7[63&c]|this._sp5[c>>>8&63]|this._sp3[c>>>16&63]|this._sp1[c>>>24&63],c=(a^t[4*o+1])>>>0;c=((s^=h|=this._sp8[63&c]|this._sp6[c>>>8&63]|this._sp4[c>>>16&63]|this._sp2[c>>>24&63])<<28|s>>>4)>>>0,c^=t[4*o+2],h=this._sp7[63&c]|this._sp5[c>>>8&63]|this._sp3[c>>>16&63]|this._sp1[c>>>24&63],c=(s^t[4*o+3])>>>0,a^=h|=this._sp8[63&c]|this._sp6[c>>>8&63]|this._sp4[c>>>16&63]|this._sp2[c>>>24&63]}s=((s^=c=2863311530&(s^(a=(a<<31|a>>>1)>>>0)))<<31|s>>>1)>>>0,s=(s=(s=(s^=(c=16711935&(s>>>8^(a^=c)))<<8)^(c=858993459&(s>>>2^(a^=c)))<<2)^(c=65535&((a^=c)>>>16^s)))^(c=252645135&((a^=c<<16)>>>4^s)),this._uint32ToBe(a^=c<<4,n,r),this._uint32ToBe(s,n,r+4)},eu.prototype._processBlock=function(t,e,i,n){var r=this._blockSize,s=new Uint8Array(r);return this._isEncryption?(this._processEncryptionBlock(this._key1,t,e,s,0),this._processEncryptionBlock(this._key2,s,0,s,0),this._processEncryptionBlock(this._key3,s,0,i,n)):(this._processEncryptionBlock(this._key3,t,e,s,0),this._processEncryptionBlock(this._key2,s,0,s,0),this._processEncryptionBlock(this._key1,s,0,i,n)),r};var tu=eu;function eu(t,e){if(void 0===e&&(e=!0),this._blockSize=8,this._isEncryption=!0,this._sp1=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],this._sp2=[2148565024,2147516416,32768,1081376,1048576,32,2148532256,2147516448,2147483680,2148565024,2148564992,2147483648,2147516416,1048576,32,2148532256,1081344,1048608,2147516448,0,2147483648,32768,1081376,2148532224,1048608,2147483680,0,1081344,32800,2148564992,2148532224,32800,0,1081376,2148532256,1048576,2147516448,2148532224,2148564992,32768,2148532224,2147516416,32,2148565024,1081376,32,32768,2147483648,32800,2148564992,1048576,2147483680,1048608,2147516448,2147483680,1048608,1081344,0,2147516416,32800,2147483648,2148532256,2148565024,1081344],this._sp3=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],this._sp4=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],this._sp5=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],this._sp6=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],this._sp7=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],this._sp8=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696],!(t instanceof Uint8Array)||16!==t.length&&24!==t.length)throw new Error("Triple DES key must be 16 or 24 bytes.");this._isEncryption=e;var i=t.subarray(0,8),n=t.subarray(8,16),t=24===t.length?t.subarray(16,24):i;this._key1=this._generateWorkingKey(e,i),this._key2=this._generateWorkingKey(!e,n),this._key3=this._generateWorkingKey(e,t)}nu.prototype._createSubjectKeyID=function(t,e){var i;if(t instanceof Ll)return(i=new Sl)._objectID=(new el)._fromString("1.2.840.113549.1.1.1"),i._parameters=i._getUniqueEncoderNull(),i._parametersDefined=!0,e=new xl(e,0),i=new Tl(i,e),new $d(i);throw new Error("Invalid Key: "+t)},nu.prototype._loadCertificate=function(t,e){if(!t||0===t.length)throw new Error("input is null");if(!e)throw new Error("password is null");var i=new w;i._fromBytes(t);t=i._getSequence()[1]._getSequence()[1]._getSequence(),i=t&&t[0];if(!i||!i._getOctetString())throw new Error("Missing or invalid content octets");t=i._getOctetString(),i=new(_l(t)?Fl:w);i._fromBytes(t);for(var n=0,r=i._getSequence();n<r.length;n++){var s,a=r[n]._getSequence(),o=a[0]._getObjectIdentifier().toString();o===this._data?(s=(s=a[1])._getSequence()&&s._getSequence()[0])&&this._processData(s,e):o===this._encryptedData&&(s=(o=a[1])._getSequence()?o._getSequence()[0]:void 0,this._processEncryptedData(s,e))}this._certificateChain&&0<this._certificateChain.length&&this._processCertificateCollection(this._certificateChain)},nu.prototype._processCertificateCollection=function(t){this._certificates=new Jd,this._chainCertificates=new Map,this._keyCertificates=new Map;for(var e=0,i=t;e<i.length;e++){var n=i[e],r=n._getSequence()[1]._getSequence()[0]._getSequence()[1]._getSequence()[0]._getValue();if(r){r=(new Zl)._readCertificate(r);if(r){var s={},a=void 0,o=void 0,n=Fo(n);if(n){var h=void 0;try{n&&(h=n._getAbstractSetValue())}catch(t){n&&(h=n._getSequence())}for(var c=0,_=h;c<_.length;c++){var d=_[c]._getSequence();if(d&&!(d.length<2)){var l=d[0]._getObjectIdentifier().toString(),d=void 0!==d[1]._getAbstractSetValue()&&null!==d[1]._getAbstractSetValue()?d[1]._getAbstractSetValue():d[1]._getSequence();if(d&&0!==d.length){d=d[0];if(s[l]){if(JSON.stringify(s[l])!==JSON.stringify(d))throw new Error("attempt to add existing attribute with different value")}else s[l]=d;"1.2.840.113549.1.9.20"===l?o=d._getBmpString():"1.2.840.113549.1.9.21"===l&&(a=d._getOctetString())}}}}n=new Kd({pubicKey:r._getPublicKey(),id:r._publicKeyBytes}),h=new Wl(r);this._chainCertificates.set(n,h),this._isUnMarkedKey?(r=Jo(n._identifier),this._keyCertificates.set(r,h),n=this._keys.get("unmarked"),this._keys.delete("unmarked"),this._keys.set("name",n)):(a&&(r=Jo(a),this._keyCertificates.set(r,h)),o&&this._certificates._setValue(o,h))}}}},nu.prototype._processData=function(t,e){var i=t._getOctetString();if(i){t=new(_l(i)?Fl:w);t._fromBytes(i);for(var n=0,r=t._getSequence();n<r.length;n++){var s=r[n],a=s._getSequence(),o=a[0]._getObjectIdentifier().toString();if("1.2.840.113549.1.12.10.1.2"===o){var h=a[1]._getSequence()[0]._getSequence(),c=h[0]._getSequence(),h=h[1]._getOctetString(),c=this._getCryptographicData(c,h,e),h=new(_l(i)?Fl:w),c=(h._fromBytes(c),h._getSequence()),h=c[1]._getSequence()[0]._getObjectIdentifier().toString(),c=c[2]._getOctetString(),_=void 0,d=("1.2.840.113549.1.1.1"===h&&(h=this._parsePrivateKey(c),_=this._createPrivateKey(h.modulus,h.publicExponent,h.privateExponent,h.prime1,h.prime2,h.exponent1,h.exponent2,h.coefficient)),void 0),l=void 0,u={},c=void 0,h=(_&&(c={privateKey:_,attributes:u}),(a[2]&&a[2]._getSequence()?a[2]._getSequence():[]).map(function(t){return t}));if(h&&0<h.length)for(var p=0,f=h;p<f.length;p++){var g=f[p]._getSequence(),y=g[0]._getObjectIdentifier().toString(),g=g[1]._getAbstractSetValue();if(g&&0<g.length){g=g[0];if(u[y]&&u[y]!==g)throw new Error("Should not add existing attribute with different value");u[y]=g,"1.2.840.113549.1.9.20"===y?d=g._getBmpString()?g._getBmpString():g._getUtf8String()?g._getUtf8String():"":"1.2.840.113549.1.9.21"===y&&(l=g._getOctetString())}}l?(a=Array.from(l).map(function(t){return Xo(t.toString(16),2,"0")}).join(""),d?(this._localIdentifiers.set(d,a),this._keys.set(d,c)):this._keys.set(a,c)):(this._isUnMarkedKey=!0,this._keys.set("unmarked",_))}else o===this._certificateBag&&this._certificateChain.push(s)}}},nu.prototype._parseAndDecrypt=function(t,e){var t=t._getSequence()[1]._getSequence(),i=t[1]._getSequence(),t=t[2]._getOctetString();return this._getCryptographicData(i,t,e)},nu.prototype._decodeDecryptedBytes=function(t){var e=new(_l(t)?Fl:w);return e._fromBytes(t),e._getSequence()},nu.prototype._handleCertificateBag=function(t){this._certificateChain.push(t)},nu.prototype._extractPrivateKeyFromKeyInfo=function(t,e,i){var n,r;return e=i?(n=(i=t._getSequence()[0]._getSequence())[0]._getSequence(),i=i[1]._getOctetString(),(i=new(_l(n=this._getCryptographicData(n,i,e))?Fl:w))._fromBytes(n),n=(e=i._getSequence())[1]._getSequence()[0]._getObjectIdentifier().toString(),void(r=e[2]._getOctetString())):(n=(i=t._getSequence()[0]._getSequence())[1]._getSequence()[0]._getObjectIdentifier().toString(),void(r=i[2]._getOctetString())),"1.2.840.113549.1.1.1"===n&&(t=this._parsePrivateKey(r),e=this._createPrivateKey(t.modulus,t.publicExponent,t.privateExponent,t.prime1,t.prime2,t.exponent1,t.exponent2,t.coefficient)),{privateKey:e,attributesRoot:null}},nu.prototype._extractLocalIdentifiers=function(t){for(var e,i,n=0,r=(t&&t._getSequence()?t._getSequence():[]).map(function(t){return t});n<r.length;n++){var s=r[n]._getSequence(),a=s[0]._getObjectIdentifier().toString(),s=s[1]._getAbstractSetValue();0<s.length&&(s=s[0],"1.2.840.113549.1.9.20"===a?e=s._getBmpString()?s._getBmpString():s._getUtf8String()?s._getUtf8String():"":"1.2.840.113549.1.9.21"===a&&(i=s._getOctetString()))}return{localIdentifier:e,localId:i}},nu.prototype._storeKeyEntry=function(t,e,i){e?(e=Array.from(e).map(function(t){return Xo(t.toString(16),2,"0")}).join(""),t?(this._localIdentifiers.set(t,e),this._keys.set(t,i)):this._keys.set(e,i)):this._keys.set("unmarked",i)},nu.prototype._handleShroudedKeyBag=function(t,e){var i,n=t[1]._getSequence()[0]._getSequence(),r=n[0]._getSequence(),n=n[1]._getOctetString(),r=this._getCryptographicData(r,n,e),n=new(_l(r)?Fl:w),e=(n._fromBytes(r),n._getSequence()),r=e[1]._getSequence()[0]._getObjectIdentifier().toString(),n=e[2]._getOctetString(),r=("1.2.840.113549.1.1.1"===r&&(e=this._parsePrivateKey(n),i=this._createPrivateKey(e.modulus,e.publicExponent,e.privateExponent,e.prime1,e.prime2,e.exponent1,e.exponent2,e.coefficient)),t[2]),n=this._extractLocalIdentifiers(r),e=n.localIdentifier,t=n.localId;i&&this._storeKeyEntry(e,t,{privateKey:i,attributes:{}})},nu.prototype._handleKeyBag=function(t){var e,i=t[1]._getSequence()[0]._getSequence(),n=i[1]._getSequence()[0]._getObjectIdentifier().toString(),i=i[2]._getOctetString(),i=("1.2.840.113549.1.1.1"===n&&(n=this._parsePrivateKey(i),e=this._createPrivateKey(n.modulus,n.publicExponent,n.privateExponent,n.prime1,n.prime2,n.exponent1,n.exponent2,n.coefficient)),t[2]),n=this._extractLocalIdentifiers(i),t=n.localIdentifier,i=n.localId;e&&this._storeKeyEntry(t,i,{privateKey:e,attributes:{}})},nu.prototype._processEncryptedData=function(t,e){for(var t=this._parseAndDecrypt(t,e),i=0,n=this._decodeDecryptedBytes(t);i<n.length;i++){var r=n[i],s=r._getSequence(),a=s[0]._getObjectIdentifier().toString();a===this._certificateBag?this._handleCertificateBag(r):a===this._shroudedKeyBag?this._handleShroudedKeyBag(s,e):a===this._keyBag&&this._handleKeyBag(s)}},nu.prototype._createPrivateKey=function(t,e,i,n,r,s,a,o){var t=this._uint8ArrayToBigInt(t),h=this._uint8ArrayToBigInt(e),e=this._uint8ArrayToBigInt(i),c=this._uint8ArrayToBigInt(n),_=this._uint8ArrayToBigInt(r),d=this._uint8ArrayToBigInt(s),l=this._uint8ArrayToBigInt(a),u=this._uint8ArrayToBigInt(o);return this._validateValue("publicExponent",h),this._validateValue("p",c),this._validateValue("q",_),this._validateValue("dP",d),this._validateValue("dQ",l),this._validateValue("inverse",u),{modulus:t,publicExponent:h,privateExponent:e,p:c,q:_,dP:d,dQ:l,inverse:u,get PublicExponent(){return h},get P(){return c},get Q(){return _},get DP(){return d},get DQ(){return l},get QInv(){return u},get _isPrivate(){return!0},equals:function(t){return!!t&&this.dP===t.dP&&this.dQ===t.dQ&&this.privateExponent===t.privateExponent&&this.modulus===t.modulus&&this.p===t.p&&this.q===t.q&&this.publicExponent===t.publicExponent&&this.inverse===t.inverse},hashCode:function(){return this._extractLow32Bits(this.DP)^this._extractLow32Bits(this.DQ)^this._extractLow32Bits(this.privateExponent)^this._extractLow32Bits(this.modulus)^this._extractLow32Bits(this.P)^this._extractLow32Bits(this.Q)^this._extractLow32Bits(this.PublicExponent)^this._extractLow32Bits(this.QInv)}}},nu.prototype._validateValue=function(t,e){if(null==e)throw new Error("RSA parameter '"+t+"' is null or undefined")},nu.prototype._uint8ArrayToBigInt=function(t){for(var e=new qd("0"),i=0;i<t.length;i++)e._multiply(),e._add(t[i]);return e},nu.prototype._getPassword=function(t){for(var e=new Uint8Array(2*(t.length+1)),i=0;i<t.length;++i){var n=t.charCodeAt(i);e[2*i]=n>>8,e[2*i+1]=255&n}return e},nu.prototype._getCryptographicData=function(t,e,i){var n=t[0]._getObjectIdentifier().toString(),t=t[1]._getSequence(),r=t[0]._getOctetString(),t=Number(t[1]._getInteger()),i=this._getPassword(i),s={"1.2.840.113549.1.12.1.1":{name:"PBEwithSHA-1and128bitRC4",keySize:16,ivSize:0,cipher:"RC4",hash:"sha1"},"1.2.840.113549.1.12.1.2":{name:"PBEwithSHA-1and40bitRC4",keySize:5,ivSize:0,cipher:"RC4",hash:"sha1"},"1.2.840.113549.1.12.1.3":{name:"PBEwithSHA-1and3-KeyTripleDES-CBC",keySize:24,ivSize:8,cipher:"DESEDE",hash:"sha1"},"1.2.840.113549.1.12.1.4":{name:"PBEwithSHA-1and3-KeyTripleDES-CBC",keySize:24,ivSize:8,cipher:"DESEDE",hash:"sha1"},"1.2.840.113549.1.12.1.5":{name:"PBEwithSHA-1and128bitRC2-CBC",keySize:16,ivSize:8,cipher:"RC2",hash:"sha1"},"1.2.840.113549.1.12.1.6":{name:"PBEwithSHA-1and40bitRC2-CBC",keySize:5,ivSize:8,cipher:"RC2",hash:"sha1"},"1.2.840.113549.1.5.12":{name:"PBKDF2",keySize:0,ivSize:0,cipher:"AES",hash:"sha1"},"1.2.840.113549.1.5.3":{name:"pbeWithMD5AndDES-CBC",keySize:8,ivSize:8,cipher:"DES",hash:"md5"},"1.2.840.113549.1.5.10":{name:"pbeWithSHA1AndDES-CBC",keySize:8,ivSize:8,cipher:"DES",hash:"sha1"},"1.2.840.113549.1.12.1.8":{name:"PBEwithSHA-1and128bitRC2-CBC",keySize:16,ivSize:8,cipher:"RC2",hash:"sha1"},"1.2.840.113549.1.12.1.9":{name:"PBEwithSHA-1and40bitRC2-CBC",keySize:5,ivSize:8,cipher:"RC2",hash:"sha1"},"1.2.840.113549.1.5.6":{name:"pbeWithMD5AndRC2-CBC",keySize:16,ivSize:8,cipher:"RC2",hash:"md5"},"1.2.840.113549.1.5.11":{name:"pbeWithSHA1AndRC2-CBC",keySize:16,ivSize:8,cipher:"RC2",hash:"sha1"}},a={sha1:{hash:function(t){return(new Qd)._hash(t,0,t.length)},u:20,v:64},md5:{hash:function(t){return(new l_).hash(t,0,t.length)},u:16,v:64}};if(!(n in s))throw new Error("Unsupported oid: "+n);var o=s[n],s=a[o.hash],h=this._generateDerivedKey(i,r,1,t,o.keySize,s),c=0<o.ivSize?this._generateDerivedKey(i,r,2,t,o.ivSize,s):void 0,_=e;switch(o.cipher){case"AES":y=new g_(h)._decryptBlock(_,!0,c);break;case"RC4":y=new W_(h)._decryptBlock(_);break;case"DESEDE":var d=new tu(h,!1);if(_.length%8!=0)throw new Error("3DES expects multiples of 8 bytes");for(var l=new Uint8Array(_.length),u=c.slice(),p=0;p<_.length;p+=d._blockSize){var f=_.slice(p,p+d._blockSize);d._processBlock(_,p,l,p);for(var g=0;g<d._blockSize;g++)l[p+g]^=u[g];u=f}y=l;break;case"RC2":var y=new Y_(h,8*o.keySize)._decrypt(_,c);break;case"DES":if(_.length%8!=0)throw new Error("DES expects multiples of 8 bytes");for(var m=new i_(h,!1),b=new Uint8Array(_.length),p=0;p<_.length;p+=8)m._processBlock(_,p,b,p);y=b}return y},nu.prototype._generateDerivedKey=function(t,e,i,n,r,s){for(var a=s.u,o=s.v,h=new Uint8Array(o).fill(i),c=e.length?o*Math.ceil(e.length/o):0,_=new Uint8Array(c),d=0;d<c;++d)_[d]=e[d%e.length];for(var l=t.length?o*Math.ceil(t.length/o):0,u=new Uint8Array(l),d=0;d<l;++d)u[d]=t[d%t.length];for(var p=new Uint8Array(c+l),f=(p.set(_,0),p.set(u,c),Math.ceil(r/a)),g=new Uint8Array(r),y=0,d=0;d<f;++d){for(var m=new Uint8Array(h.length+p.length),b=(m.set(h),m.set(p,h.length),s.hash(m)),w=1;w<n;++w)b=s.hash(b);for(var m=Math.min(a,r-y),v=(g.set(b.subarray(0,m),y),y+=m,new Uint8Array(o)),w=0;w<o;++w)v[w]=b[w%b.length];for(w=0;w<p.length/o;++w)this._adjust(p,w*o,v)}return g},nu.prototype._adjust=function(t,e,i){var n=i[i.length-1]+t[e+i.length-1]+1;t[e+i.length-1]=255&n,n>>>=8;for(var r=i.length-2;0<=r;--r)n+=i[r]+t[e+r],t[e+r]=255&n,n>>>=8},nu.prototype._getCertificate=function(t){var e=this._certificates._get(t);if(e&&e instanceof Wl)return e;e=void 0;if(null!=(e=this._localIdentifiers.has(t)?this._localIdentifiers.get(t):e)){e=this._keyCertificates.get(e);if(e&&e instanceof Wl)return e}else{e=t.toUpperCase().trim(),t=this._keyCertificates.get(e);if(t&&t instanceof Wl)return t}},nu.prototype._parsePrivateKey=function(t){var e=new(_l(t)?Fl:w),t=(e._fromBytes(t),e._getSequence());return{version:new Uint8Array([t[0]._getInteger()]),modulus:t[1]._getValue(),publicExponent:t[2]._getValue(),privateExponent:t[3]._getValue(),prime1:t[4]._getValue(),prime2:t[5]._getValue(),exponent1:t[6]._getValue(),exponent2:t[7]._getValue(),coefficient:t[8]._getValue()}},nu.prototype._getCertificateChain=function(t){if(!this._keys.has(t))return null;var r=this._getCertificate(t);if(!r)return null;for(var s=[],a=this;r;)!function(){var i,t,n,e=r._certificate._getExtension((new el)._fromString("2.5.29.35"));e&&(e=e._getValue(),(t=new w)._fromBytes(e),e=t._getSequence().find(function(t){return t._tagClass===M._TagClassType.context&&0===t._getTagNumber()}))&&(t=e._getOctetString())&&(n=new Kd({id:t}),a._chainCertificates.forEach(function(t,e){Io(e._identifier,n._identifier)&&(i=t)})),s.push(r),r=i&&i!==r?i:void 0}();return 0<s.length?s:null};var iu=nu;function nu(t,e){this._certificateChain=[],this._keys=new Map,this._localIdentifiers=new Map,this._data="1.2.840.113549.1.7.1",this._encryptedData="1.2.840.113549.1.7.6",this._certificateBag="1.2.840.113549.1.12.10.1.3",this._shroudedKeyBag="1.2.840.113549.1.12.10.1.2",this._keyBag="1.2.840.113549.1.12.10.1.1",this._attributes={},this._certificates=new Jd,this._isUnMarkedKey=!1,t&&0<t.length&&null!==e&&this._loadCertificate(t,e)}su.prototype._initializePublicKeyCryptographyCertificate=function(t,e){var i,t=new iu(t,e);t&&(this._publicKeyCryptographyCertificate=t,i="",t._keys.forEach(function(t,e){t&&""===i&&(i=e)}),e=t._getCertificate(i))&&this._loadDetailsFromCertificate(e._certificate)},su.prototype._loadDetailsFromCertificate=function(t){t=t._structure._getSignedCertificate(),this._issuerName=this._getUniqueAttributes(t._issuer,"CN"),""===this._issuerName&&(this._issuerName=this._getUniqueAttributes(t._issuer,"OU")),this._subjectName=this._getUniqueAttributes(t._subject,"CN"),this._validFrom=t._startDate._toDate(),this._validTo=t._endDate._toDate(),this._version=t._getVersion(),t=t._serialNumber;this._serialNumber=t,this._isPublicKeyCryptographyCertificate=!0},su.prototype._getUniqueAttributes=function(t,e){for(var i,n=this,r=Object.keys(this._objectIdentifierToAttributeMap).find(function(t){return n._objectIdentifierToAttributeMap[t]===e||t===e})||e,s=0;s<t._ordering.length;s++)if(t._ordering[s].toString()===r)return(i=t._values[s])?i.trim():"";return""};var ru=su;function su(t,e){this._chains=[],this._objectIdentifierToAttributeMap={"2.5.4.3":"CN","2.5.4.6":"C","2.5.4.7":"L","2.5.4.8":"ST","2.5.4.10":"O","2.5.4.11":"OU"},t instanceof Uint8Array&&null!=e?this._initializePublicKeyCryptographyCertificate(t,e):t instanceof Ul&&this._loadDetailsFromCertificate(t)}var au=function(){this._secureHash256AlgorithmIdentifier={id:"2.16.840.1.101.3.4.2.1"},this._secureHash384AlgorithmIdentifier={id:"2.16.840.1.101.3.4.2.2"},this._secureHash512AlgorithmIdentifier={id:"2.16.840.1.101.3.4.2.3"},this._raceEvaluationMessageDigestAlgorithmIdentifier={id:"1.3.36.3.2.1"},this._digitalSignatureWithSecureHash256AlgorithmIdentifier={id:"2.16.840.1.101.3.4.3.2"},this._ronCipherWithRaceEvaluationAlgorithmIdentifier={id:"1.3.36.3.3.1.2"}},ou=function(){this._messageDigest5={id:"1.2.840.113549.2.5"},this._secureHash1WithRonCipherEncryption={id:"1.2.840.113549.1.1.5"},this._secureHash256WithRonCipherEncryption={id:"1.2.840.113549.1.1.11"},this._secureHash384WithRonCipherEncryption={id:"1.2.840.113549.1.1.12"},this._secureHash512WithRonCipherEncryption={id:"1.2.840.113549.1.1.13"},this._messageDigest2WithRonCipherEncryption={id:"1.2.840.113549.1.1.2"},this._raceEvaluationEncryption={id:"1.2.840.113549.1.1.1"}},hu=function(){this._cryptographicData="1.2.840.113549.1.7.1",this._cryptographicSignedData="1.2.840.113549.1.7.2",this._rsaEncryption="1.2.840.113549.1.1.1",this._dsaSignature="1.2.840.10040.4.1",this._ecPublicKey="1.2.840.10045.2.1",this._contentType="1.2.840.113549.1.9.3",this._messageDigest="1.2.840.113549.1.9.4",this._signingCertificate="1.2.840.113549.1.9.16.2.47",this._revocation="1.2.840.113583.1.1.8"},cu=(_u.prototype._startChunkedConversion=function(t){return new P_(this,t)},_u.prototype._rotateLeft=function(t,e){return t<<e|t>>>32-e},_u.prototype._fn1=function(t,e,i,n,r,s,a,o){return this._rotateLeft(t+(e^i^n)+s+a|0,o)+r|0},_u.prototype._fn2=function(t,e,i,n,r,s,a,o){return this._rotateLeft(t+(e&i|~e&n)+s+a|0,o)+r|0},_u.prototype._fn3=function(t,e,i,n,r,s,a,o){return this._rotateLeft(t+((e|~i)^n)+s+a|0,o)+r|0},_u.prototype._fn4=function(t,e,i,n,r,s,a,o){return this._rotateLeft(t+(e&n|i&~n)+s+a|0,o)+r|0},_u.prototype._fn5=function(t,e,i,n,r,s,a,o){return this._rotateLeft(t+(e^(i|~n))+s+a|0,o)+r|0},_u.prototype._readInt32LE=function(t,e){return t[e>>>=0]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24},_u.prototype._writeUInt32LE=function(t,e,i){return t[(i>>>=0)+3]=(e=+e)>>>24,t[i+2]=e>>>16,t[i+1]=e>>>8,t[i]=255&e,i+4},_u.prototype._writeInt32LE=function(t,e,i){return t[i>>>=0]=255&(e=+e),t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24,i+4},_u.prototype._update=function(){for(var t=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),e=new Uint8Array([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),i=new Uint8Array([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),n=new Uint8Array([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),r=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),s=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),a=new Array(16),o=0;o<16;++o)a[o]=this._readInt32LE(this._block,4*o);for(var h=0|this._a,c=0|this._b,_=0|this._c,d=0|this._d,l=0|this._e,u=0|this._a,p=0|this._b,f=0|this._c,g=0|this._d,y=0|this._e,m=0;m<80;m+=1)var b=void 0,w=void 0,w=m<16?(b=this._fn1(h,c,_,d,l,a[t[m]],r[0],i[m]),this._fn5(u,p,f,g,y,a[e[m]],s[0],n[m])):m<32?(b=this._fn2(h,c,_,d,l,a[t[m]],r[1],i[m]),this._fn4(u,p,f,g,y,a[e[m]],s[1],n[m])):m<48?(b=this._fn3(h,c,_,d,l,a[t[m]],r[2],i[m]),this._fn3(u,p,f,g,y,a[e[m]],s[2],n[m])):m<64?(b=this._fn4(h,c,_,d,l,a[t[m]],r[3],i[m]),this._fn2(u,p,f,g,y,a[e[m]],s[3],n[m])):(b=this._fn5(h,c,_,d,l,a[t[m]],r[4],i[m]),this._fn1(u,p,f,g,y,a[e[m]],s[4],n[m])),h=l,l=d,d=this._rotateLeft(_,10),_=c,c=b,u=y,y=g,g=this._rotateLeft(f,10),f=p,p=w;var v=this._b+_+g|0;this._b=this._c+d+y|0,this._c=this._d+l+u|0,this._d=this._e+h+p|0,this._e=this._a+c+f|0,this._a=v},_u.prototype._hash=function(t,e,i){for(var n=0,r=[0,0,0,0],s=this._block;64<=n+i-e;){for(var a=n;a<64;)s[a++]=t[e++];this._update(),n=0}for(;e<i;)s[n++]=t[e++];for(var o=0,h=8*i;0<h;++o)r[o]+=h,0<(h=r[o]/4294967296|0)&&(r[o]-=4294967296*h);this._block[n++]=128,56<n&&(this._block.fill(0,n,64),this._update(),n=0),this._block.fill(0,n,56),this._writeUInt32LE(this._block,r[0],56),this._writeUInt32LE(this._block,r[1],60),this._update();var c=new Uint8Array(20);this._writeInt32LE(c,this._a,0),this._writeInt32LE(c,this._b,4),this._writeInt32LE(c,this._c,8),this._writeInt32LE(c,this._d,12),this._writeInt32LE(c,this._e,16),this._block.fill(0);for(n=0,a=0;a<4;++a)r[a]=0;return c},_u);function _u(){this._block=new Uint8Array(64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}lu.prototype._initializeNameMappings=function(){this._names.set("1.2.840.113549.2.5","MD5"),this._names.set("1.3.14.3.2.26","SHA1"),this._names.set("2.16.840.1.101.3.4.2.1","SHA256"),this._names.set("2.16.840.1.101.3.4.2.2","SHA384"),this._names.set("2.16.840.1.101.3.4.2.3","SHA512"),this._names.set("1.3.36.3.2.1","RIPEMD160"),this._names.set("1.2.840.113549.1.1.4","MD5"),this._names.set("1.2.840.113549.1.1.5","SHA1"),this._names.set("1.2.840.113549.1.1.11","SHA256"),this._names.set("1.2.840.113549.1.1.12","SHA384"),this._names.set("1.2.840.113549.1.1.13","SHA512"),this._names.set("1.2.840.10040.4.3","SHA1"),this._names.set("2.16.840.1.101.3.4.3.2","SHA256"),this._names.set("2.16.840.1.101.3.4.3.3","SHA384"),this._names.set("2.16.840.1.101.3.4.3.4","SHA512"),this._names.set("1.3.36.3.3.1.2","RIPEMD160")},lu.prototype._initializeDigestMappings=function(){this._digests.set("MD5","1.2.840.113549.2.5"),this._digests.set("MD-5","1.2.840.113549.2.5"),this._digests.set("SHA1","1.3.14.3.2.26"),this._digests.set("SHA-1","1.3.14.3.2.26"),this._digests.set("SHA256","2.16.840.1.101.3.4.2.1"),this._digests.set("SHA-256","2.16.840.1.101.3.4.2.1"),this._digests.set("SHA384","2.16.840.1.101.3.4.2.2"),this._digests.set("SHA-384","2.16.840.1.101.3.4.2.2"),this._digests.set("SHA512","2.16.840.1.101.3.4.2.3"),this._digests.set("SHA-512","2.16.840.1.101.3.4.2.3"),this._digests.set("RIPEMD160","1.3.36.3.2.1"),this._digests.set("RIPEMD-160","1.3.36.3.2.1")},lu.prototype._initializeAlgorithmMappings=function(){var t=new au,e=new ou;this._algorithms.set("SHA1","SHA-1"),this._algorithms.set("1.3.14.3.2.26","SHA-1"),this._algorithms.set("SHA256","SHA-256"),this._algorithms.set(t._secureHash256AlgorithmIdentifier.id,"SHA-256"),this._algorithms.set("SHA384","SHA-384"),this._algorithms.set(t._secureHash384AlgorithmIdentifier.id,"SHA-384"),this._algorithms.set("SHA512","SHA-512"),this._algorithms.set(t._secureHash512AlgorithmIdentifier.id,"SHA-512"),this._algorithms.set("MD5","MD5"),this._algorithms.set(e._messageDigest5.id,"MD5"),this._algorithms.set("RIPEMD-160","RIPEMD160"),this._algorithms.set("RIPEMD160","RIPEMD160"),this._algorithms.set(t._raceEvaluationMessageDigestAlgorithmIdentifier.id,"RIPEMD160")},lu.prototype._getDigest=function(t){return t?this._names.get(t)||t:null},lu.prototype._getAllowedDigests=function(t){var i,n=t.toLowerCase();return this._digests.forEach(function(t,e){null==i&&n===e.toLowerCase()&&(i=t)}),i},lu.prototype._getMessageDigest=function(t){var i=t.toLowerCase(),n=i,r=!1,e=(this._algorithms.forEach(function(t,e){!r&&e&&e.toLowerCase()===i&&(n=t,r=!0)}),n.toLowerCase());if("sha1"===e||"sha-1"===e||"sha_1"===e)return new Qd;if("sha256"===e||"sha-256"===e||"sha_256"===e)return new C_;if("sha384"===e||"sha-384"===e||"sha_384"===e)return new I_;if("sha512"===e||"sha-512"===e||"sha_512"===e)return new R_;if("ripemd160"===e||"ripemd-160"===e||"ripemd_160"===e)return new cu;throw new Error("Invalid message digest algorithm: "+t)},lu.prototype._digest=function(t,e){return this._getMessageDigest(e)._hash(t,0,t.length)};var du=lu;function lu(){this._secureHash1="SHA-1",this._secureHash256="SHA-256",this._secureHash384="SHA-384",this._secureHash512="SHA-512",this._names=new Map,this._digests=new Map,this._algorithms=new Map,this._initializeNameMappings(),this._initializeDigestMappings(),this._initializeAlgorithmMappings()}pu.prototype._getInputBlockSize=function(){return this._isEncryption?this._bitSize-1>>>3:this._bitSize+7>>>3},pu.prototype._getOutputBlockSize=function(){return this._isEncryption?this._bitSize+7>>>3:this._bitSize-1>>>3},pu.prototype._initialize=function(t,e){this._key=e,this._isEncryption=t,this._bitSize=this._key.modulus._bitLength()},pu.prototype._convertInput=function(t,e,i){t=t.subarray(e,e+i);if(t.length>this._getInputBlockSize()+1)throw new Error("Input data too large for RSA block.");e=Lo(t);if(e>=this._key.modulus)throw new Error("Input data is larger than modulus.");return e},pu.prototype._convertOutput=function(t){t=Oo(t);if(this._isEncryption){var e,i=this._getOutputBlockSize();if(t.length<i)return(e=new Uint8Array(i)).set(t,i-t.length),e}return t},pu.prototype._processBlock=function(t){var e,i,n,r,s=jo(),a=this._key;return a._isPrivate&&a.p&&a.q?(e=a.p._toBigInt(),i=a.q._toBigInt(),n=a.dP._toBigInt(),r=a.dQ._toBigInt(),a=a.inverse._toBigInt(),r=(Do(t%e,n,e)-(n=Do(t%i,r,i)))*a,(r%=e)<s("0")&&(r+=e),r*i+n):Do(t,this._key.exponent,this._key.modulus)};var uu=pu;function pu(){}gu.prototype._getAlgorithmName=function(){return"RSA"},gu.prototype._getInputBlock=function(){return this._rsaCoreEngine._getInputBlockSize()},gu.prototype._getOutputBlock=function(){return this._rsaCoreEngine._getOutputBlockSize()},gu.prototype._initialize=function(t,e){this._rsaCoreEngine._initialize(t,e),this._key=e},gu.prototype._processBlock=function(t,e,i){var n=jo();if(this._key)return t=this._rsaCoreEngine._convertInput(t,e,i),i=(e=this._key)._isPrivate&&e.publicExponent?(i=e.publicExponent._toBigInt(),e=this._key.modulus._toBigInt(),i=Do(n=Eo(n(1),e-n(1)),i,e)*t%e,this._rsaCoreEngine._processBlock(i)*Bo(n,e)%e):this._rsaCoreEngine._processBlock(t),this._rsaCoreEngine._convertOutput(i);throw new Error("RSA engine not initialized.")};var fu=gu;function gu(){this._rsaCoreEngine=new uu}mu.prototype._getAlgorithmName=function(){return this._cipher._getAlgorithmName()+"/PKCS1Padding"},mu.prototype._getInputBlock=function(){return this._isEncryption?this._cipher._getInputBlock()-10:this._cipher._getInputBlock()},mu.prototype._getOutputBlock=function(){return this._isEncryption?this._cipher._getOutputBlock():this._cipher._getOutputBlock()-10},mu.prototype._initialize=function(t,e){this._cipher._initialize(t,e),this._isPrivateKey=e._isPrivate,this._isEncryption=t},mu.prototype._processBlock=function(t,e,i){return this._isEncryption?this._encodeBlock(t,e,i):this._decodeBlock(t,e,i)},mu.prototype._encodeBlock=function(t,e,i){if(i>this._getInputBlock())throw new Error("Input data too large for PKCS#1 padding.");var n=new Uint8Array(this._cipher._getInputBlock());if(this._isPrivateKey)for(var r=n[0]=1;r<n.length-i-1;r++)n[r]=255;else{n[0]=2;for(r=1;r<n.length-i-1;r++){for(var s=void 0;0===(s=Math.floor(255*Math.random())+1););n[r]=s}}return n[n.length-i-1]=0,n.set(t.subarray(e,e+i),n.length-i),this._cipher._processBlock(n,0,n.length)},mu.prototype._decodeBlock=function(t,e,i){var n=this._cipher._processBlock(t,e,i);if(n.length<this._getOutputBlock())throw new Error("Data block is truncated.");var r=n[0];if(1!==r&&2!==r)throw new Error("Invalid block type: "+r+".");for(var s=-1,a=1;a<n.length;a++){if(0===n[a]){s=a;break}if(1===r&&255!==n[a])throw new Error("Invalid PKCS#1 padding: bad padding byte.")}if(-1===s||s<9)throw new Error("Invalid PKCS#1 padding: separator not found or too short.");return n.subarray(s+1)};var yu=mu;function mu(t){this._cipher=t}wu.prototype._getUniqueEncoded=function(){var t=this._algorithm._getEncoded(),e=this._digest,i=t.length,n=e.length,i=i+n+1+this._getLengthBytes(n).length,r=[],s=(r.push(48),this._getLengthBytes(i));if(1===s.length)r.push(s[0]);else{r.push(128|s.length-1);for(var a=1;a<s.length;a++)r.push(s[a])}r.push.apply(r,Array.from(t)),r.push(4);var o=this._getLengthBytes(n);if(1===o.length)r.push(o[0]);else{r.push(128|o.length-1);for(a=1;a<o.length;a++)r.push(o[a])}return r.push.apply(r,Array.from(e)),new Uint8Array(r)},wu.prototype._getLengthBytes=function(t){if(t<128)return[t];for(var e=[],i=t;0<i;)e.unshift(255&i),i=Math.floor(i/256);return[128|e.length].concat(e)};var bu=wu;function wu(t,e){this._algorithm=t,this._digest=e}Su.prototype._getMap=function(){return this._map||(this._map=new Map,this._initializeMap()),this._map},Su.prototype._initializeMap=function(){this._map.set("sha1","1.3.14.3.2.26"),this._map.set("sha256","2.16.840.1.101.3.4.2.1"),this._map.set("sha384","2.16.840.1.101.3.4.2.2"),this._map.set("sha512","2.16.840.1.101.3.4.2.3"),this._map.set("md5","1.3.36.3.2.1")},Su.prototype._getDigest=function(t){switch(t.toLowerCase()){case"sha1":case"sha-1":return new Qd;case"sha256":case"sha-256":return new C_;case"sha384":case"sha-384":return new I_;case"sha512":case"sha-512":return new R_;case"md5":case"md-5":return new cu;default:throw new Error("Invalid digest algorithm: "+t)}},Su.prototype._getAlgorithmIdentifier=function(t){var e=t.toLowerCase(),e=this._getMap().get(e);if(e)return new A_(e);throw new Error("Unsupported digest: "+t)},Su.prototype._initialize=function(t,e){if((this._isSigning=t)&&e&&!e.privateExponent)throw new Error("Private key required for signing.");if(!t&&e&&e.privateExponent)throw new Error("Public key required for verification.");this._reset(),this._ronCipherEngine._initialize(t,e)},Su.prototype._blockUpdate=function(t,e,i){t=t.subarray(e,e+i);this._input._add(t)},Su.prototype._generateSignature=function(){if(!this._isSigning)throw new Error("Invalid operation: not in signing mode");this._input._close();var t=this._output._getResult();return t&&0!==t.length?(t=this._derEncode(t),this._ronCipherEngine._processBlock(t,0,t.length)):null},Su.prototype._derEncode=function(t){return this._id?this._id&&t&&0<t.length?new bu(this._id,t)._getUniqueEncoded():new Uint8Array(0):t},Su.prototype._reset=function(){this._output=new v_,this._input=this._digest._startChunkedConversion(this._output)},Su.prototype._update=function(t){this._input._add(new Uint8Array([t]))},Su.prototype._compareArrays=function(t,e){if(t.length!==e.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0};var vu=Su;function Su(t){this._isSigning=!1,this._algorithmName=t,this._digest=this._getDigest(t),this._output=new v_,this._input=this._digest._startChunkedConversion(this._output),this._ronCipherEngine=new yu(new fu),this._id=this._getAlgorithmIdentifier(t)}xu.prototype._initializeAlgorithmMappings=function(){var t=new au,e=new ou;this._algorithms.set("MD2WITHRSA","MD2withRSA"),this._algorithms.set("MD2WITHRSAENCRYPTION","MD2withRSA"),this._algorithms.set(e._messageDigest2WithRonCipherEncryption.id,"MD2withRSA"),this._algorithms.set(e._raceEvaluationEncryption.id,"RSA"),this._algorithms.set("SHA1WITHRSA","SHA-1withRSA"),this._algorithms.set("SHA1WITHRSAENCRYPTION","SHA-1withRSA"),this._algorithms.set(e._secureHash1WithRonCipherEncryption.id,"SHA-1withRSA"),this._algorithms.set("SHA-1WITHRSA","SHA-1withRSA"),this._algorithms.set("SHA256WITHRSA","SHA-256withRSA"),this._algorithms.set("SHA256WITHRSAENCRYPTION","SHA-256withRSA"),this._algorithms.set(e._secureHash256WithRonCipherEncryption.id,"SHA-256withRSA"),this._algorithms.set("SHA-256WITHRSA","SHA-256withRSA"),this._algorithms.set("SHA384WITHRSA","SHA-384withRSA"),this._algorithms.set("SHA384WITHRSAENCRYPTION","SHA-384withRSA"),this._algorithms.set(e._secureHash384WithRonCipherEncryption.id,"SHA-384withRSA"),this._algorithms.set("SHA-384WITHRSA","SHA-384withRSA"),this._algorithms.set("SHA512WITHRSA","SHA-512withRSA"),this._algorithms.set("SHA-512WITHRSA","SHA-512withRSA"),this._algorithms.set(e._secureHash512WithRonCipherEncryption.id,"SHA-512withRSA"),this._algorithms.set("SHA1WITHRSAANDMGF1","SHA-1withRSAandMGF1"),this._algorithms.set("SHA-1WITHRSAANDMGF1","SHA-1withRSAandMGF1"),this._algorithms.set("SHA1WITHRSA/PSS","SHA-1withRSAandMGF1"),this._algorithms.set("SHA-1WITHRSA/PSS","SHA-1withRSAandMGF1"),this._algorithms.set("SHA256WITHRSAANDMGF1","SHA-256withRSAandMGF1"),this._algorithms.set("SHA-256WITHRSAANDMGF1","SHA-256withRSAandMGF1"),this._algorithms.set("SHA256WITHRSA/PSS","SHA-256withRSAandMGF1"),this._algorithms.set("SHA-256WITHRSA/PSS","SHA-256withRSAandMGF1"),this._algorithms.set("SHA384WITHRSAANDMGF1","SHA-384withRSAandMGF1"),this._algorithms.set("SHA-384WITHRSAANDMGF1","SHA-384withRSAandMGF1"),this._algorithms.set("SHA384WITHRSA/PSS","SHA-384withRSAandMGF1"),this._algorithms.set("SHA-384WITHRSA/PSS","SHA-384withRSAandMGF1"),this._algorithms.set("SHA512WITHRSAANDMGF1","SHA-512withRSAandMGF1"),this._algorithms.set("SHA-512WITHRSAANDMGF1","SHA-512withRSAandMGF1"),this._algorithms.set("SHA512WITHRSA/PSS","SHA-512withRSAandMGF1"),this._algorithms.set("SHA-512WITHRSA/PSS","SHA-512withRSAandMGF1"),this._algorithms.set("DSAWITHSHA256","SHA-256withDSA"),this._algorithms.set("DSAWITHSHA-256","SHA-256withDSA"),this._algorithms.set("SHA256/DSA","SHA-256withDSA"),this._algorithms.set("SHA-256/DSA","SHA-256withDSA"),this._algorithms.set("SHA256WITHDSA","SHA-256withDSA"),this._algorithms.set("SHA-256WITHDSA","SHA-256withDSA"),this._algorithms.set(t._digitalSignatureWithSecureHash256AlgorithmIdentifier.id,"SHA-256withDSA"),this._algorithms.set("RIPEMD160WITHRSA","RIPEMD160withRSA"),this._algorithms.set("RIPEMD160WITHRSAENCRYPTION","RIPEMD160withRSA"),this._algorithms.set(t._ronCipherWithRaceEvaluationAlgorithmIdentifier.id,"RIPEMD160withRSA")},xu.prototype._initializeObjectIdentifierMappings=function(){var t=new au,e=new ou;this._objectIdentifiers.set("SHA-1withRSA",e._secureHash1WithRonCipherEncryption),this._objectIdentifiers.set("SHA-256withRSA",e._secureHash1WithRonCipherEncryption),this._objectIdentifiers.set("SHA-384withRSA",e._secureHash256WithRonCipherEncryption),this._objectIdentifiers.set("SHA-512withRSA",e._secureHash512WithRonCipherEncryption),this._objectIdentifiers.set("RIPEMD160withRSA",t._ronCipherWithRaceEvaluationAlgorithmIdentifier.id)},xu.prototype._getSigner=function(t){var i=t.toLowerCase(),n=t,r=!1;if(this._algorithms.forEach(function(t,e){r||e.toLowerCase()!==i||(n=t,r=!0)}),"SHA-1withRSA"===n)return new vu("sha1");if("SHA-256withRSA"===n)return new vu("sha256");if("SHA-384withRSA"===n)return new vu("sha384");if("SHA-512withRSA"===n)return new vu("sha512");if("RIPEMD160withRSA"===n)return new vu("md5");throw new Error("Signer "+t+" not recognised.")};var Pu=xu;function xu(){this._algorithms=new Map,this._objectIdentifiers=new Map,this._initializeAlgorithmMappings(),this._initializeObjectIdentifierMappings()}Tu.prototype._isRonCipherKey=function(t){return"modulus"in t&&"privateExponent"in t},Tu.prototype._sign=function(t){try{var e=this._hashAlgorithm+"with"+this._encryptionAlgorithm,i=(new Pu)._getSigner(e);return i._initialize(!0,this._key),i._blockUpdate(t,0,t.length),i._generateSignature()}catch(t){return null}},Tu.prototype._getHashAlgorithm=function(){return this._hashAlgorithm},Tu.prototype._getEncryptionAlgorithm=function(){return this._encryptionAlgorithm};var Au=Tu;function Tu(t,e){this._key=e;var i=new du,t=i._getAllowedDigests(t);if(this._hashAlgorithm=i._getDigest(t),e&&!this._isRonCipherKey(e))throw new Error("Invalid key type");this._encryptionAlgorithm="RSA"}var Cu=function(s,a,o,h){return new(o=o||Promise)(function(t,e){function i(t){try{r(h.next(t))}catch(t){e(t)}}function n(t){try{r(h.throw(t))}catch(t){e(t)}}function r(e){e.done?t(e.value):new o(function(t){t(e.value)}).then(i,n)}r((h=h.apply(s,a||[])).next())})},ku=function(n,r){var s,a,o,h={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(i){return function(t){var e=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;h;)try{if(s=1,a&&(o=2&e[0]?a.return:e[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,e[1])).done)return o;switch(a=0,(e=o?[2&e[0],o.value]:e)[0]){case 0:case 1:o=e;break;case 4:return h.label++,{value:e[1],done:!1};case 5:h.label++,a=e[1],e=[0];continue;case 7:e=h.ops.pop(),h.trys.pop();continue;default:if(!(o=0<(o=h.trys).length&&o[o.length-1])&&(6===e[0]||2===e[0])){h=0;continue}if(3===e[0]&&(!o||e[1]>o[0]&&e[1]<o[3]))h.label=e[1];else if(6===e[0]&&h.label<o[1])h.label=o[1],o=e;else{if(!(o&&h.label<o[2])){o[2]&&h.ops.pop(),h.trys.pop();continue}h.label=o[2],h.ops.push(e)}}e=r.call(n,h)}catch(t){e=[6,t],a=0}finally{s=o=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}},Ru=(Fu.prototype._initializeCmsSigner=function(t,e){var i,n=new Fl,t=(n._fromBytes(t),n._getSequence());"1.2.840.113549.1.7.2"===t[0]._getObjectIdentifier()._getDotDelimitedNotation()&&(i=(t=t[1]._getInner()._getSequence()[4]._getSequence()[0]._getSequence())[2]._getSequence()[0]._getValue(),i=(new el)._fromBytes(i),this._digestAlgorithmObjectIdentifier=i.toString(),"ETSI.RFC3161"!==e?(e=(i=this._getSignatureTimeStampToken(t)).hasTimeStamp,t=i.tokenBytes,(this._hasTimeStamp=e)&&t&&(this._timeStampTokenBytes=t)):(i=n._toBytes(),this._isTimestampOnly=!0,this._hasTimeStamp=0<i.length,this._timeStampTokenBytes=i))},Fu.prototype._getSignatureTimeStampToken=function(t){if(t&&!(t.length<=6)){t=t[6];if(t._isTagged()&&1===t._getTagNumber()&&t._isConstructed())for(var e=0,i=this._getChildElement(t);e<i.length;e++){var n=i[e]._getSequence();if(n&&!(n.length<2)){var r=n[0]._getObjectIdentifier()._getDotDelimitedNotation();if("1.2.840.113549.1.9.16.2.14"===r){r=this._getChildElement(n[1]);if(r&&0!==r.length)return{hasTimeStamp:0<(n=r[0]._toBytes()).length,tokenBytes:n}}}}}return{hasTimeStamp:!1}},Fu.prototype._getChildElement=function(t){var e=[];return e=(e=(e=t._getAbstractSetOf?t._getAbstractSetOf():e)&&0!==e.length||!t._getSequence?e:t._getSequence())&&0!==e.length?e:this._decodeChildrenFromContentOctets(t)},Fu.prototype._isRsaKey=function(t){return"modulus"in t&&"exponent"in t},Fu.prototype._getHashAlgorithm=function(){return this._hashAlgorithm||(this._hashAlgorithm=this._digestAlgorithm._getDigest(this._digestAlgorithmObjectIdentifier)),this._hashAlgorithm},Fu.prototype._getDigestAlgorithm=function(){return this._digestAlgorithm},Fu.prototype._getSequenceDataSet=function(t,e,i,n){var r=[],s=new w,a=(s._tagClass=M._TagClassType.universal,s._construction=M._ConstructionType.primitive,s._setTagNumber(M._UniversalType.objectIdentifier),s._setValue(this._encodeObjectIdentifier("1.2.840.113549.1.9.3")),new w),o=(a._tagClass=M._TagClassType.universal,a._construction=M._ConstructionType.primitive,a._setTagNumber(M._UniversalType.objectIdentifier),a._setValue(this._encodeObjectIdentifier("1.2.840.113549.1.7.1")),new w),a=(o._tagClass=M._TagClassType.universal,o._construction=M._ConstructionType.constructed,o._setTagNumber(M._UniversalType.abstractSyntaxSet),o._setValue(this._encodeSequence([a])),new w),s=(a._tagClass=M._TagClassType.universal,a._construction=M._ConstructionType.constructed,a._setTagNumber(M._UniversalType.sequence),a._setValue(this._encodeSequence([s,o])),r.push(a),new w),o=(s._tagClass=M._TagClassType.universal,s._construction=M._ConstructionType.primitive,s._setTagNumber(M._UniversalType.objectIdentifier),s._setValue(this._encodeObjectIdentifier("1.2.840.113549.1.9.4")),new w),a=(o._tagClass=M._TagClassType.universal,o._construction=M._ConstructionType.primitive,o._setTagNumber(M._UniversalType.octetString),o._setValue(t),new w),t=(a._tagClass=M._TagClassType.universal,a._construction=M._ConstructionType.constructed,a._setTagNumber(M._UniversalType.abstractSyntaxSet),a._setValue(this._encodeSequence([o])),new w),h=(t._tagClass=M._TagClassType.universal,t._construction=M._ConstructionType.constructed,t._setTagNumber(M._UniversalType.sequence),t._setValue(this._encodeSequence([s,a])),r.push(t),n===M.CryptographicStandard.cades&&this._signatureCertificate&&(o=this._hashCertificate(this._signatureCertificate),(s=new w)._tagClass=M._TagClassType.universal,s._construction=M._ConstructionType.primitive,s._setTagNumber(M._UniversalType.octetString),s._setValue(o),(a=new w)._tagClass=M._TagClassType.universal,a._construction=M._ConstructionType.primitive,a._setTagNumber(M._UniversalType.objectIdentifier),a._setValue(this._encodeObjectIdentifier("1.2.840.113549.1.9.16.2.47")),t=(new du)._secureHash256,n=void 0,this._digestAlgorithmObjectIdentifier===this._digestAlgorithm._getAllowedDigests(t)?((h=new w)._tagClass=M._TagClassType.universal,h._construction=M._ConstructionType.constructed,h._setTagNumber(M._UniversalType.sequence),h._setValue(this._encodeSequence([s]))):((o=new w)._tagClass=M._TagClassType.universal,o._construction=M._ConstructionType.primitive,o._setTagNumber(M._UniversalType.objectIdentifier),o._setValue(this._encodeObjectIdentifier(this._digestAlgorithmObjectIdentifier)),(t=new w)._tagClass=M._TagClassType.universal,t._construction=M._ConstructionType.constructed,t._setTagNumber(M._UniversalType.sequence),t._setValue(this._encodeSequence([o])),(h=new w)._tagClass=M._TagClassType.universal,h._construction=M._ConstructionType.constructed,h._setTagNumber(M._UniversalType.sequence),h._setValue(this._encodeSequence([t,s]))),(o=new w)._tagClass=M._TagClassType.universal,o._construction=M._ConstructionType.constructed,o._setTagNumber(M._UniversalType.sequence),o._setValue(this._encodeSequence([h])),(t=new w)._tagClass=M._TagClassType.universal,t._construction=M._ConstructionType.constructed,t._setTagNumber(M._UniversalType.sequence),t._setValue(this._encodeSequence([o])),(s=new w)._tagClass=M._TagClassType.universal,s._construction=M._ConstructionType.constructed,s._setTagNumber(M._UniversalType.abstractSyntaxSet),s._setValue(this._encodeSequence([t])),(n=new w)._tagClass=M._TagClassType.universal,n._construction=M._ConstructionType.constructed,n._setTagNumber(M._UniversalType.sequence),n._setValue(this._encodeSequence([a,s])),r.push(n)),new w);return h._tagClass=M._TagClassType.universal,h._construction=M._ConstructionType.constructed,h._setTagNumber(M._UniversalType.abstractSyntaxSet),h._setValue(this._encodeSequence(r)),this._encodeToUniqueElement(h)},Fu.prototype._createPrimitiveOid=function(t){var e=new w;return e._tagClass=M._TagClassType.universal,e._construction=M._ConstructionType.primitive,e._setTagNumber(M._UniversalType.objectIdentifier),e._setValue(this._encodeObjectIdentifier(t)),e},Fu.prototype._createPrimitiveOctet=function(t){var e=new w;return e._tagClass=M._TagClassType.universal,e._construction=M._ConstructionType.primitive,e._setTagNumber(M._UniversalType.octetString),e._setValue(t),e},Fu.prototype._createConstructed=function(t,e){var i=new w;return i._tagClass=M._TagClassType.universal,i._construction=M._ConstructionType.constructed,i._setTagNumber(t),i._setValue(this._encodeSequence(e)),i},Fu.prototype._encodeObjectIdentifier=function(t){var e=t.split(".").map(Number),i=[];i.push(40*e[0]+e[1]);for(var n=2;n<e.length;n++){var r=e[n];if(r<128)i.push(r);else{for(var s=[];0<r;)s.unshift(127&r),r>>>=7;for(var a=0;a<s.length-1;a++)s[a]|=128;i.push.apply(i,s)}}return new Uint8Array(i)},Fu.prototype._encodeSequence=function(t){for(var e=[],i=0,n=t;i<n.length;i++){var r=n[i],r=this._encodeToUniqueElement(r);e.push.apply(e,Array.from(r))}return new Uint8Array(e)},Fu.prototype._encodeToUniqueElement=function(t){var e=[],i=t._getTagNumber(),i=(t._construction===M._ConstructionType.constructed&&(i|=32),t._tagClass===M._TagClassType.context&&(i|=128),e.push(i),t._getValue()?t._getValue().length:0);return i<128?e.push(i):(i=this._encodeLength(i),e.push(128|i.length),e.push.apply(e,i)),t._getValue()&&e.push.apply(e,Array.from(t._getValue())),new Uint8Array(e)},Fu.prototype._encodeLength=function(t){for(var e=[];0<t;)e.unshift(255&t),t>>>=8;return e},Fu.prototype._hashCertificate=function(t){t=t._getEncoded();return this._digestAlgorithm._getMessageDigest(this._getHashAlgorithm())._hash(t,0,t.length)},Fu.prototype._setSignedData=function(t,e,i){if(this._signedData=t,this._signedRsaData=e,i)switch(i){case"RSA":this._encryptionAlgorithmObjectIdentifier=(new hu)._rsaEncryption;break;case"DSA":this._encryptionAlgorithmObjectIdentifier=(new hu)._dsaSignature;break;case"ECDSA":this._encryptionAlgorithmObjectIdentifier=(new hu)._ecPublicKey;break;default:throw new Error("Invalid algorithm: "+i)}},Fu.prototype._encodeCertificateSet=function(t){for(var e=t.reduce(function(t,e){return t+e.length},0),i=e<128?[e]:e<256?[129,e]:[130,e>>8&255,255&e],n=new Uint8Array(1+i.length+e),r=(n[0]=160,n.set(i,1),1+i.length),s=0,a=t;s<a.length;s++){var o=a[s];n.set(o,r),r+=o.length}return n},Fu.prototype._createPrimitive=function(t,e){var i=new w;return i._tagClass=M._TagClassType.universal,i._construction=M._ConstructionType.primitive,i._setTagNumber(t),i._setValue(e),i},Fu.prototype._createAsn1Constructed=function(t,e){var i=new w;return i._tagClass=M._TagClassType.universal,i._construction=M._ConstructionType.constructed,i._setTagNumber(t),i._setSequence(e),i},Fu.prototype._createContextConstructed=function(t,e){var i=new w;return i._tagClass=M._TagClassType.context,i._construction=M._ConstructionType.constructed,i._setTagNumber(t),Array.isArray(e)?i._setSequence(e):i._setValue(e),i},Fu.prototype._sign=function(t,e,i,n,r,s){var a=this,o=(this._signedData&&(this._digest=this._signedData,this._rsaData)&&(this._rsaData=this._signedRsaData),[]),h=(this._digestObjectIdentifier.forEach(function(t,e){var e=a._createPrimitive(M._UniversalType.objectIdentifier,a._encodeObjectIdentifier(e)),i=a._createPrimitive(M._UniversalType.nullValue,new Uint8Array(0));o.push(a._createAsn1Constructed(M._UniversalType.sequence,[e,i]))}),[this._createPrimitive(M._UniversalType.objectIdentifier,this._encodeObjectIdentifier((new hu)._cryptographicData))]),c=(this._rsaData&&0<this._rsaData.length&&(c=this._createPrimitive(M._UniversalType.octetString,this._rsaData),h.push(this._createContextConstructed(0,[c]))),this._createAsn1Constructed(M._UniversalType.sequence,h)),h=this._certificates.filter(function(t){return t}).map(function(t){var e=new w;return e._fromBytes(t._getEncodedString()),e}),_=[this._createPrimitive(M._UniversalType.integer,new Uint8Array([this._signerVersion]))],d=(this._signatureCertificate&&(l=[],d=this._signatureCertificate._getTobeSignedCertificate(),d=void((d=this._getIssuer(d))&&l.push(d)),u=this._signatureCertificate._structure._getSignedCertificate(),d=this._signatureCertificate._structure&&u&&u._serialNumber?u._serialNumber:new Uint8Array([1]),u=this._createPrimitive(M._UniversalType.integer,d),l.push(u),_.push(this._createAsn1Constructed(M._UniversalType.sequence,l))),this._createAsn1Constructed(M._UniversalType.sequence,[this._createPrimitive(M._UniversalType.objectIdentifier,this._encodeObjectIdentifier(this._digestAlgorithmObjectIdentifier)),this._createPrimitive(M._UniversalType.nullValue,new Uint8Array(0))])),l=(_.push(d),t&&(u=this._getSequenceDataSet(t,i,n,r),_.push(this._createContextImplicitFromTimestampValue(0,u))),this._createAsn1Constructed(M._UniversalType.sequence,[this._createPrimitive(M._UniversalType.objectIdentifier,this._encodeObjectIdentifier(this._encryptionAlgorithmObjectIdentifier)),this._createPrimitive(M._UniversalType.nullValue,new Uint8Array(0))])),d=(_.push(l),_.push(this._createPrimitive(M._UniversalType.octetString,this._digest||new Uint8Array(0))),this._createAsn1Constructed(M._UniversalType.sequence,_)),t=this._buildSignedDataBodyElements(this._version,o,c,h,d),i=this._concatAbstractSyntaxSequence(t),n=this._encodeObjectIdentifier((new hu)._cryptographicSignedData),r=this._createPrimitive(M._UniversalType.objectIdentifier,n),u=this._createContextConstructed(0,i);return this._createAsn1Constructed(M._UniversalType.sequence,[r,u])._toBytes()},Fu.prototype._buildSignedDataBodyElements=function(t,e,i,n,r){var s=[],t=(s.push(this._createPrimitive(M._UniversalType.integer,new Uint8Array([t]))),new w),t=(t._tagClass=M._TagClassType.universal,t._construction=M._ConstructionType.constructed,t._setTagNumber(M._UniversalType.abstractSyntaxSet),t._setAbstractSetValue(e),s.push(t),s.push(i),0<n.length&&((e=new w)._tagClass=M._TagClassType.context,e._construction=M._ConstructionType.constructed,e._setTagNumber(0),e._setAbstractSetValue(n),s.push(e)),new w);return t._tagClass=M._TagClassType.universal,t._construction=M._ConstructionType.constructed,t._setTagNumber(M._UniversalType.abstractSyntaxSet),t._setAbstractSetValue([r]),s.push(t),s},Fu.prototype._concatAbstractSyntaxSequence=function(t){for(var e=[],i=0,n=t;i<n.length;i++){var r=n[i];if(r instanceof Uint8Array)e.push(r);else{if(!(r instanceof w))throw new Error("Element for PKCS#7 serialization must be distinguished element or Uint8Array");e.push(r._toBytes())}}for(var t=e.reduce(function(t,e){return t+e.length},0),s=t<128?[t]:t<256?[129,t]:[130,t>>8,255&t],a=new Uint8Array(1+s.length+t),o=(a[0]=48,a.set(s,1),1+s.length),h=0,c=e;h<c.length;h++){var _=c[h];a.set(_,o),o+=_.length}return a},Fu.prototype._getIssuer=function(t){var e=new w;return e._fromBytes(t),e._getSequence()[3]},Fu.prototype._getTimestampAttributes=function(t){var e=new w,i=(e._tagClass=M._TagClassType.universal,e._construction=M._ConstructionType.primitive,e._setTagNumber(M._UniversalType.objectIdentifier),e._setValue(this._encodeObjectIdentifier("1.2.840.113549.1.9.16.2.14")),new w),t=(i._tagClass=M._TagClassType.universal,i._construction=M._ConstructionType.constructed,i._setTagNumber(M._UniversalType.abstractSyntaxSet),i._setValue(t),new w),e=(t._tagClass=M._TagClassType.universal,t._construction=M._ConstructionType.constructed,t._setTagNumber(M._UniversalType.sequence),t._setValue(this._encodeSequence([e,i])),new w);return e._tagClass=M._TagClassType.universal,e._construction=M._ConstructionType.constructed,e._setTagNumber(M._UniversalType.abstractSyntaxSet),e._setValue(this._encodeToUniqueElement(t)),this._encodeToUniqueElement(e)},Fu.prototype._signAsync=function(p,f,g,y,m,b){return Cu(this,void 0,void 0,function(){var n,e,i,r,s,a,o,h,c,_,d,l,u=this;return ku(this,function(t){switch(t.label){case 0:return(this._signedData&&(this._digest=this._signedData,this._rsaData)&&(this._rsaData=this._signedRsaData),n=[],this._digestObjectIdentifier.forEach(function(t,e){var e=u._createPrimitive(M._UniversalType.objectIdentifier,u._encodeObjectIdentifier(e)),i=u._createPrimitive(M._UniversalType.nullValue,new Uint8Array(0));n.push(u._createAsn1Constructed(M._UniversalType.sequence,[e,i]))}),i=[this._createPrimitive(M._UniversalType.objectIdentifier,this._encodeObjectIdentifier((new hu)._cryptographicData))],this._rsaData&&0<this._rsaData.length&&(e=this._createPrimitive(M._UniversalType.octetString,this._rsaData),i.push(this._createContextConstructed(0,[e]))),e=this._createAsn1Constructed(M._UniversalType.sequence,i),i=this._certificates.filter(function(t){return t}).map(function(t){var e=new w;return e._fromBytes(t._getEncodedString()),e}),r=[this._createPrimitive(M._UniversalType.integer,new Uint8Array([this._signerVersion]))],this._signatureCertificate&&(o=[],s=this._signatureCertificate._getTobeSignedCertificate(),(s=this._getIssuer(s))&&o.push(s),s=this._signatureCertificate._structure._getSignedCertificate(),a=void 0,a=s&&s._serialNumber?s._serialNumber:new Uint8Array([1]),o.push(this._createPrimitive(M._UniversalType.integer,a)),r.push(this._createAsn1Constructed(M._UniversalType.sequence,o))),s=this._createAsn1Constructed(M._UniversalType.sequence,[this._createPrimitive(M._UniversalType.objectIdentifier,this._encodeObjectIdentifier(this._digestAlgorithmObjectIdentifier)),this._createPrimitive(M._UniversalType.nullValue,new Uint8Array(0))]),r.push(s),p&&(a=this._getSequenceDataSet(p,y,m,b),o=this._createContextImplicitFromTimestampValue(0,a),r.push(o)),h=this._createAsn1Constructed(M._UniversalType.sequence,[this._createPrimitive(M._UniversalType.objectIdentifier,this._encodeObjectIdentifier(this._encryptionAlgorithmObjectIdentifier)),this._createPrimitive(M._UniversalType.nullValue,new Uint8Array(0))]),r.push(h),r.push(this._createPrimitive(M._UniversalType.octetString,this._digest||new Uint8Array(0))),g&&0!==g.length||!f)?[3,3]:f._timestampCallback?(h=this._getObjectIdentifierName("SHA256").oid,c=this._digestAlgorithm._digest(this._digest,"SHA256"),c=this._createTimestampRequestWithAlgorithm(c,h),[4,f._timestampCallback(c)]):[3,2];case 1:return h=t.sent(),g=h&&0<h.data.length?this._reEncodeTimestampResponse(h.data):void 0,[3,3];case 2:g=void 0,t.label=3;case 3:return g&&0<g.length&&(c=this._buildTimestampUnsignedAttribute(g),_=this._createAsn1Constructed(M._UniversalType.abstractSyntaxSet,[c]),r.push(this._createContextImplicitFromTimestampValue(1,_._toBytes())),this._hasTimeStamp=!0),_=this._createAsn1Constructed(M._UniversalType.sequence,r),l=this._buildSignedDataBodyElements(this._version,n,e,i,_),l=this._concatAbstractSyntaxSequence(l),d=this._encodeObjectIdentifier((new hu)._cryptographicSignedData),d=this._createPrimitive(M._UniversalType.objectIdentifier,d),l=this._createContextConstructed(0,l),[2,this._createAsn1Constructed(M._UniversalType.sequence,[d,l])._toBytes()]}})})},Fu.prototype._getObjectIdentifierName=function(t){switch((t||"SHA256").toUpperCase()){case"SHA1":return{oid:"1.3.14.3.2.26",name:"SHA1"};case"SHA256":return{oid:"2.16.840.1.101.3.4.2.1",name:"SHA256"};case"SHA384":return{oid:"2.16.840.1.101.3.4.2.2",name:"SHA384"};case"SHA512":return{oid:"2.16.840.1.101.3.4.2.3",name:"SHA512"};default:return{oid:"2.16.840.1.101.3.4.2.1",name:"SHA256"}}},Fu.prototype._createTimestampRequestWithAlgorithm=function(t,e){var i=this._createPrimitive(M._UniversalType.integer,new Uint8Array([1])),e=this._createPrimitive(M._UniversalType.objectIdentifier,this._encodeObjectIdentifier(e)),n=this._createPrimitive(M._UniversalType.nullValue,new Uint8Array(0)),e=this._createAsn1Constructed(M._UniversalType.sequence,[e,n]),n=this._createPrimitive(M._UniversalType.octetString,t),t=this._createAsn1Constructed(M._UniversalType.sequence,[e,n]),e=this._createPrimitive(M._UniversalType.integer,new Uint8Array([100])),n=this._createPrimitive(M._UniversalType.abstractSyntaxBoolean,new Uint8Array([255]));return this._createAsn1Constructed(M._UniversalType.sequence,[i,t,e,n])._toBytes()},Fu.prototype._reEncodeTimestampResponse=function(e){try{var t,i,n=new w,r=(n._fromBytes(e),n._getSequence());return!r||r.length<2?e:(t=r[1])&&(i=t._getSequence())&&0!==i.length?this._encodeTimeStampSequence(i):e}catch(t){return e}},Fu.prototype._encodeTimeStampSequence=function(t){var t=t.map(function(t){return t._toBytes()}),e=t.reduce(function(t,e){return t+e.length},0),i=32|M._UniversalType.sequence,n=this._encodeSequenceLength(e),r=new Uint8Array(1+n.length+e),s=0;r[s++]=i,r.set(n,s),s+=n.length;for(var a=0,o=t;a<o.length;a++){var h=o[a];r.set(h,s),s+=h.length}return r},Fu.prototype._encodeSequenceLength=function(t){if(t<128)return new Uint8Array([t]);for(var e=[];0<t;)e.unshift(255&t),t>>=8;return new Uint8Array([128|e.length].concat(e))},Fu.prototype._buildTimestampUnsignedAttribute=function(t){var e=this._createPrimitive(M._UniversalType.objectIdentifier,this._encodeObjectIdentifier("1.2.840.113549.1.9.16.2.14")),i=new w,t=(i._fromBytes(t),this._createAsn1Constructed(M._UniversalType.abstractSyntaxSet,[i]));return this._createAsn1Constructed(M._UniversalType.sequence,[e,t])},Fu.prototype._getEncodedTimestamp=function(i,n,r){return Cu(this,void 0,void 0,function(){var e;return ku(this,function(t){switch(t.label){case 0:return e=this._getObjectIdentifierName(r).oid,e=this._createTimestampRequestWithAlgorithm(i,e),[4,n._timestampCallback(e)];case 1:if((e=t.sent())&&0!==e.data.length)return[2,this._reEncodeTimestampResponse(e.data)];throw new Error("Timestamp server returned empty response")}})})},Fu.prototype._createContextImplicitFromTimestampValue=function(t,e){var i=new w;return i._fromBytes(e),i._tagClass=M._TagClassType.context,i._setTagNumber(t),i},Fu.prototype._decodeChildrenFromContentOctets=function(t){for(var e=t._getValue(),i=[],n=0;n<e.length;){var r=new Fl,s=r._fromBytes(e.subarray(n));if(s<=0)break;i.push(r),n+=s}return i},Fu);function Fu(t,e,i,n){if(this._digestAlgorithm=new du,this._hasTimeStamp=!1,this._isTimestampOnly=!1,!(t instanceof Uint8Array&&0===t.length||null==e))if(t instanceof Uint8Array&&"string"==typeof e)this._initializeCmsSigner(t,e);else{if(this._digestAlgorithm=new du,this._digestAlgorithmObjectIdentifier=this._digestAlgorithm._getAllowedDigests(i),!this._digestAlgorithmObjectIdentifier)throw new Error("Unknown hash algorithm: "+i);if(this._version=1,this._signerVersion=1,this._digestObjectIdentifier=new Map,this._digestObjectIdentifier.set(this._digestAlgorithmObjectIdentifier,null),Array.isArray(e)&&e.every(function(t){return t instanceof Ul})?(this._certificates=e.slice(),this._signatureCertificate=this._certificates[0]):(this._certificates=[],this._signatureCertificate=null),t){if(!this._isRsaKey(t))throw new Error("Unknown key algorithm");i=new hu;this._encryptionAlgorithmObjectIdentifier=i._rsaEncryption}n&&(this._rsaData=new Uint8Array(0))}}var Iu=function(s,a,o,h){return new(o=o||Promise)(function(t,e){function i(t){try{r(h.next(t))}catch(t){e(t)}}function n(t){try{r(h.throw(t))}catch(t){e(t)}}function r(e){e.done?t(e.value):new o(function(t){t(e.value)}).then(i,n)}r((h=h.apply(s,a||[])).next())})},Du=function(n,r){var s,a,o,h={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(i){return function(t){var e=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;h;)try{if(s=1,a&&(o=2&e[0]?a.return:e[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,e[1])).done)return o;switch(a=0,(e=o?[2&e[0],o.value]:e)[0]){case 0:case 1:o=e;break;case 4:return h.label++,{value:e[1],done:!1};case 5:h.label++,a=e[1],e=[0];continue;case 7:e=h.ops.pop(),h.trys.pop();continue;default:if(!(o=0<(o=h.trys).length&&o[o.length-1])&&(6===e[0]||2===e[0])){h=0;continue}if(3===e[0]&&(!o||e[1]>o[0]&&e[1]<o[3]))h.label=e[1];else if(6===e[0]&&h.label<o[1])h.label=o[1],o=e;else{if(!(o&&h.label<o[2])){o[2]&&h.ops.pop(),h.trys.pop();continue}h.label=o[2],h.ops.push(e)}}e=r.call(n,h)}catch(t){e=[6,t],a=0}finally{s=o=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}},Bu=(Lu.prototype._parsePdfContents=function(t){if(t instanceof Uint8Array)return t;if("string"==typeof t){var e=t.trim();if(e.startsWith("<")&&e.endsWith(">")){var i=e.slice(1,-1).replace(/[^0-9a-fA-F]/g,"");i.length%2!=0&&(i+="0");for(var n=new Uint8Array(i.length/2),r=0;r<i.length;r+=2)n[r/2]=parseInt(i.slice(r,r+2),16)}else{n=new Uint8Array(e.length);for(r=0;r<e.length;r++)n[r]=255&e.charCodeAt(r)}}return n},Lu.prototype._parseDigestAlgorithm=function(){var t,e,i;if(this._dictionary.has("Contents")&&(e=this._dictionary.get("Contents"),i=(e=this._parsePdfContents(e))&&0<e.length&&e.every(function(t){return 0===t}),e)&&0<e.length&&!i&&(i=(new Zl)._readCertificate(e,!0),i=new ru(i),this._certificate=i,this._cmsSigner=new Ru(e,this._dictionary.get("SubFilter").name),this._cmsSigner)&&this._cmsSigner._hasTimeStamp&&this._cmsSigner._timeStampTokenBytes&&0<this._cmsSigner._timeStampTokenBytes.length&&(this._signature._hasTimeStamp=this._cmsSigner._hasTimeStamp,this._signature._timeStampTokenBytes=this._cmsSigner._timeStampTokenBytes,this._signature._isTimestampOnly=this._cmsSigner._isTimestampOnly),this._cmsSigner)switch(this._cmsSigner._getHashAlgorithm()){case"SHA512":t=M.DigestAlgorithm.sha512;break;case"SHA384":t=M.DigestAlgorithm.sha384;break;case"SHA1":t=M.DigestAlgorithm.sha1;break;case"RIPEMD160":t=M.DigestAlgorithm.ripemd160;break;default:t=M.DigestAlgorithm.sha256}return t},Lu.prototype._parseDirect=function(t){var e;return e=this._dictionary.has(t)?this._dictionary.get(t):e},Lu.prototype._parseSignedDate=function(){var t;return this._dictionary.has("M")&&(t=this._dictionary.get("M"),t=this._parsePdfDate(t)),t},Lu.prototype._parsePdfDate=function(t){var e,i,n,r,s,a,o;if("string"==typeof t&&0!==t.length)return(t=t.trim()).startsWith("D:")&&(t=t.slice(2)),o=Number(t.slice(0,4)),e=Number(t.slice(4,6)||"01"),i=Number(t.slice(6,8)||"01"),n=Number(t.slice(8,10)||"00"),r=Number(t.slice(10,12)||"00"),s=Number(t.slice(12,14)||"00"),a=0,14<t.length&&"Z"!==(t=t.slice(14).replace(/'/g,"")).toUpperCase()&&(a=(t.startsWith("-")?-1:1)*(60*Number(t.slice(1,3))+(5<=t.length?Number(t.slice(3,5)):0))),t=Date.UTC(o,e-1,i,n,r,s),o=new Date(t-6e4*a),isNaN(o.getTime())?void 0:o},Lu.prototype._dictionarySave=function(t){if(!this._dictionary||t.length<=0)throw new Error("dictionary or writer is null.");this._signature&&(this._addRequiredItems(),this._addOptionalItems()),this._addContents(t),this._addRange(t),this._signature&&this._signature._certify&&this._addDigest(t)},Lu.prototype._addDigest=function(t){if(this._signature&&this._signature._certify&&this._allowMessageDigestProcessing()){var e=this._document._crossReference,i=(e._writeString("/Reference[<</TransformParams<<\r\n/V /1.2\r\n/P "+this._signature._documentPermissions+"\r\n /Type /TransformParams\r\n>>\r\n/TransformMethod/DocMDP/Type/SigRef/DigestValue",t),t.length+e._currentLength);e._writeString("<",t);for(var n=0;n<32;n++)e._writeString("0",t);var r=this._document._catalog._catalogDictionary.objId.toString();e._writeString(">/DigestLocation["+i+" 34]/DigestMethod/MD5/Data "+r+" R>><</TransformParams<<\r\n/V /1.2\r\n/Fields [(Signature)]\r\n/Type /TransformParams\r\n/Action /Include\r\n>>\r\n/TransformMethod/FieldMDP/Type/SigRef/DigestValue",t),i=t.length+e._currentLength,e._writeString("<",t);for(n=0;n<32;n++)e._writeString("0",t);e._writeString(">/DigestLocation["+i+" 34]/DigestMethod/MD5/Data "+r+" R>>]\r\n",t)}},Lu.prototype._addRequiredItems=function(){this._signature&&this._signature._certify&&this._allowMessageDigestProcessing()&&this._addReference(),this._addType(),this._addDate(),this._addFilter(),this._addSubFilter()},Lu.prototype._allowMessageDigestProcessing=function(){var t=this._document._catalog._catalogDictionary.get("Perms");if(null!=t){t=t.get("DocMDP");if(t instanceof m){var e=this._document._crossReference._fetch(t);if(this._dictionary.has("Reference")||e.has("Reference"))return!1}else if(t instanceof D&&t.objId!==this._dictionary.objId)return!1}return!0},Lu.prototype._addOptionalItems=function(){var t,e,i;this._signature&&(this._signature._reason&&this._dictionary.update("Reason",this._signature._reason),this._signature._locationInfo&&this._dictionary.update("Location",this._signature._locationInfo),this._signature._contactInfo&&this._dictionary.update("ContactInfo",this._signature._contactInfo),this._signature._signedName)&&(this._dictionary.update("Name",this._signature._signedName),t=new D,e=new D,t.update("Name",this._signature._signedName),i=this._document._crossReference._getNextReference(),this._document._crossReference._cacheMap.set(i,t),e.update("App",i),i=this._document._crossReference._getNextReference(),this._document._crossReference._cacheMap.set(i,e),this._dictionary.update("Prop_Build",i))},Lu.prototype._addReference=function(){var t=new D,e=new D,i=[];t.update("V",R.get("1.2")),t.update("P",this._signature._documentPermissions),t.update("Type",R.get(this._transParam)),e.update("TransformMethod",R.get(this._signaturePermissionsDictionary)),e.update("Type",R.get("SigRef")),e.update(this._transParam,t),e.update(this._transParam,t),i.push(e),this._dictionary.update("Reference",i)},Lu.prototype._addType=function(){this._signature&&this._signature._isTimestampOnly&&0===this._signature._externalChain.length?this._dictionary.update("Type",new R("DocTimeStamp")):this._dictionary.update("Type",new R("Sig"))},Lu.prototype._addDate=function(){var t=new Date,e=(t=this._signature&&this._signature._signedDate?this._signature._signedDate:t).getFullYear().toString(),i=Xo((t.getMonth()+1).toString(),2,"0"),n=Xo(t.getDate().toString(),2,"0"),r=Xo(t.getHours().toString(),2,"0"),s=Xo(t.getMinutes().toString(),2,"0"),a=Xo(t.getSeconds().toString(),2,"0"),t=t.getTimezoneOffset(),o=Xo(Math.floor(Math.abs(t)/60).toString(),2,"0"),h=Xo((Math.abs(t)%60).toString(),2,"0");this._dictionary.update("M","D:"+e+i+n+r+s+a+(0<t?"-":"+")+o+"'"+h+"'")},Lu.prototype._addFilter=function(){this._dictionary.update("Filter",new R("Adobe.PPKLite"))},Lu.prototype._addSubFilter=function(){this._signature&&this._signature._isTimestampOnly?this._dictionary.update("SubFilter",new R(this._requestForCommentsFilterType)):this._signature&&this._signature._cryptographicStandard===M.CryptographicStandard.cades?this._dictionary.update("SubFilter",new R(this._advanceFilterType)):this._dictionary.update("SubFilter",new R(this._cryptographicFilterType))},Lu.prototype._getLength=function(){var t=0;if(0<this._crossReference._uint8Chunks.length)for(var e=0;e<this._crossReference._uint8Chunks.length;e++)t+=this._crossReference._uint8Chunks[e].length;return t},Lu.prototype._addContents=function(t){var e=this._getLength(),i=this._crossReference,n=(i._writeString("/Contents ",t),this._firstRangeLength=this._crossReference._currentLength+t.length+e,2*this._estimatedSize);this._signature&&this._certificate&&(n=this._estimatedSize,this._signature)&&this._signature&&(n=this._estimatedSize+4192),i._writeString("<"+" ".repeat(2*n)+">",t),this._secondRangeIndex=t.length+e+this._crossReference._currentLength,i._writeString("\r\n",t)},Lu.prototype._addRange=function(t){var e=this._getLength(),i=this._crossReference;i._writeString("/ByteRange [",t),this._startPositionByteRange=t.length+this._document._crossReference._currentLength+e;for(var n=0;n<32;n++)i._writeString(" ",t);i._writeString("]\r\n",t)},Lu.prototype._documentSaved=function(t){var e=t.length-this._secondRangeIndex,e=["0 ",this._firstRangeLength+" ",this._secondRangeIndex+" ",e.toString()],i=this._saveRangeItem(t,e[0],this._startPositionByteRange),i=this._saveRangeItem(t,e[1],i),e=(i=this._saveRangeItem(t,e[2],i),this._saveRangeItem(t,e[3],i),t.subarray(0,this._firstRangeLength)),i=t.subarray(this._secondRangeIndex),n=new Uint8Array(e.length+i.length);n.set(e,0),n.set(i,e.length);var r=Jo(this._getCryptographicStandardContent(n)),s=this._firstRangeLength;t[s]=255&"<".charCodeAt(0);for(var a=0;a<r.length;a++)t[s+1+a]=255&r.charCodeAt(a);i=s+1+r.length,e=this._secondRangeIndex-i-1;0<e&&t.fill(255&"0".charCodeAt(0),i,i+e),t[this._secondRangeIndex-1]=255&">".charCodeAt(0)},Lu.prototype._getCryptographicStandardContent=function(t){try{var e="",i=void 0,n=[];if(this._signature._externalSignatureCallback){if(!(this._signature._externalChain&&0<this._signature._externalChain.length))return(h=this._signature._externalSignatureCallback(t,{algorithm:this._signature._digestAlgorithm,cryptographicStandard:M.CryptographicStandard.cms})).signedData;e=M.DigestAlgorithm[this._signature._digestAlgorithm],i=o=new Au(e),n.push.apply(n,this._signature._externalChain)}else{var r,s="";this._certificate._publicKeyCryptographyCertificate._keys.forEach(function(t,e){t.privateKey&&(s=e,r=t)});this._certificate._publicKeyCryptographyCertificate._getCertificateChain(s).forEach(function(t){n.push(t._certificate)});var a=M.DigestAlgorithm[this._signature._digestAlgorithm],o=new Au(a,r.privateKey);e=a,i=o}var h,c=new Ru(null,n,e,!1),_=c._getDigestAlgorithm()._digest(t,e),d=c._getSequenceDataSet(_,void 0,void 0,this._signature._cryptographicStandard),l=void 0;if(this._signature._externalChain&&0<this._signature._externalChain.length){if((h=this._signature._externalSignatureCallback(d,{algorithm:this._signature._digestAlgorithm,cryptographicStandard:this._signature._cryptographicStandard}))&&h.signedData&&(l=h.signedData),!h.signedData)return new Uint8Array(this._estimatedSize).fill(0)}else l=i._sign(d);c._setSignedData(l,null,i._getEncryptionAlgorithm());var u=void 0,u=this._signature&&this._signature._cryptographicStandard?this._signature._cryptographicStandard:M.CryptographicStandard.cms;return c._sign(_,null,void 0,void 0,u,e)}catch(t){return new Uint8Array(this._estimatedSize).fill(0)}},Lu.prototype._saveRangeItem=function(t,e,i){for(var n=[],r=0;r<e.length;r++)n.push(255&e.charCodeAt(r));return t.set(n,i),i+e.length},Lu.prototype._documentSavedAsync=function(h){return Iu(this,void 0,void 0,function(){var e,i,n,r,s,a,o;return Du(this,function(t){switch(t.label){case 0:return(o=h.length-this._secondRangeIndex,o=["0 ",this._firstRangeLength+" ",this._secondRangeIndex+" ",o.toString()],a=this._saveRangeItem(h,o[0],this._startPositionByteRange),a=this._saveRangeItem(h,o[1],a),a=this._saveRangeItem(h,o[2],a),this._saveRangeItem(h,o[3],a),o=h.subarray(0,this._firstRangeLength),a=h.subarray(this._secondRangeIndex),(e=new Uint8Array(o.length+a.length)).set(o,0),e.set(a,o.length),this._signature&&this._signature._isTimestampOnly)?[4,this._getCryptographicStandardTimestampContentAsync(e)]:[3,2];case 1:return i=t.sent(),[3,4];case 2:return[4,this._getCryptographicStandardContentAsync(e)];case 3:i=t.sent(),t.label=4;case 4:for(n=Jo(i),r=this._firstRangeLength,h[r]=255&"<".charCodeAt(0),s=0;s<n.length;s++)h[r+1+s]=255&n.charCodeAt(s);return a=r+1+n.length,0<(o=this._secondRangeIndex-a-1)&&h.fill(255&"0".charCodeAt(0),a,a+o),h[this._secondRangeIndex-1]=255&">".charCodeAt(0),[2]}})})},Lu.prototype._getCryptographicStandardContentAsync=function(f){return Iu(this,void 0,void 0,function(){var e,i,n,r,s,a,o,h,c,_,d,l,u,p;return Du(this,function(t){switch(t.label){case 0:if(t.trys.push([0,6,,7]),_="",r=n=i=void 0,s=[],this._signature._externalSignatureCallback){if(!(this._signature._externalChain&&0<this._signature._externalChain.length))return[2,(u=this._signature._externalSignatureCallback(f,{algorithm:this._signature._digestAlgorithm,cryptographicStandard:M.CryptographicStandard.cms})).signedData];_=M.DigestAlgorithm[this._signature._digestAlgorithm],h=new Au(_),i=h,s.push.apply(s,this._signature._externalChain)}else a="",this._certificate._publicKeyCryptographyCertificate._keys.forEach(function(t,e){t.privateKey&&(a=e,o=t)}),h=this._certificate._publicKeyCryptographyCertificate,h._getCertificateChain(a).forEach(function(t){return s.push(t._certificate)}),c=M.DigestAlgorithm[this._signature._digestAlgorithm],i=new Au(c,o.privateKey),_=c;return(c=new Ru(null,s,_,!1),_=c._getDigestAlgorithm()._digest(f,_),d=c._getSequenceDataSet(_,r,n,this._signature._cryptographicStandard),l=void 0,this._signature._externalChain&&0<this._signature._externalChain.length)?[4,this._signature._externalSignatureCallback(d,{algorithm:this._signature._digestAlgorithm,cryptographicStandard:this._signature._cryptographicStandard})]:[3,2];case 1:return((u=t.sent()).timestampData&&(e=u.timestampData),u.signedData)?(l=u.signedData,[3,4]):[2,new Uint8Array(this._estimatedSize).fill(0)];case 2:return[4,Promise.resolve(i._sign(d))];case 3:l=t.sent(),t.label=4;case 4:return c._setSignedData(l,null,i._getEncryptionAlgorithm()),p=this._signature._cryptographicStandard||M.CryptographicStandard.cms,[4,c._signAsync(_,this._signature,e,r,n,p)];case 5:return[2,t.sent()];case 6:return t.sent(),[2,new Uint8Array(this._estimatedSize).fill(0)];case 7:return[2]}})})},Lu.prototype._getCryptographicStandardTimestampContentAsync=function(s){return Iu(this,void 0,void 0,function(){var e,i,n,r;return Du(this,function(t){switch(t.label){case 0:return(t.trys.push([0,3,,4]),e=M.DigestAlgorithm[this._signature._digestAlgorithm]||"SHA256",n=new Ru(null,[],e,!1),r=n._getDigestAlgorithm()._digest(s,e),i=new Au(e),n._setSignedData(r,null,i._getEncryptionAlgorithm()),i=void 0,this._signature)?[4,n._getEncodedTimestamp(r,this._signature,e)]:[3,2];case 1:i=t.sent(),t.label=2;case 2:return(n=new Uint8Array(i.length)).set(i),[2,n];case 3:throw r=t.sent(),new Error(r.message);case 4:return[2]}})})},Lu);function Lu(t,e){if(this._dictionary=new D,this._transParam="TransformParams",this._signaturePermissionsDictionary="DocMDP",this._cryptographicFilterType="adbe.pkcs7.detached",this._advanceFilterType="ETSI.CAdES.detached",this._requestForCommentsFilterType="ETSI.RFC3161",this._estimatedSize=8192,!t)throw new Error("A valid argument must be provided.");if(!e)throw new Error("Argument signature is null or undefined.");t instanceof Sp?(this._document=t,this._crossReference=t._crossReference):this._dictionary=t,this._signature=e,this._certificate=e._certificate}Mu.create=function(t,e,i,n){var r=new Mu;if(L.initializeTelemetryFeature("DigitalSignature","PDFLibrary"),t instanceof Uint8Array||"string"==typeof t){if(!(a=t instanceof Uint8Array?t:Rs(t))||0===a.length)throw new Error("Certificate data is required.");var s=e;if(null==s||0===s.length)throw new Error("Password is required to open the certificate.");s=new ru(a,s);return r._certificate=s,r._certificateInfo={issuerName:s._issuerName,serialNumber:s._serialNumber,subjectName:s._subjectName,validFrom:s._validFrom,validTo:s._validTo,version:s._version},i&&r._applySignatureOptions(i),n&&"function"==typeof n&&(r._timestampCallback=n),r}if("function"==typeof t){if(r._externalSignatureCallback=t,Array.isArray(e)){for(var a,o=0,h=e;o<h.length;o++)(a=h[o])&&0<a.length&&r._externalChain.push((new Zl)._readCertificate(a));i&&r._applySignatureOptions(i),n&&"function"==typeof n&&(r._timestampCallback=n)}else e&&"object"==typeof e&&(r._applySignatureOptions(e),i)&&"function"==typeof i&&(r._timestampCallback=i);return r}if(t&&"object"==typeof t&&!Array.isArray(t))return r._applySignatureOptions(t),e&&"function"==typeof e&&(r._timestampCallback=e),r._isTimestampOnly=!0,r;if(null==t&&null==e&&i&&n&&"function"==typeof n)return r._applySignatureOptions(i),r._timestampCallback=n,r._isTimestampOnly=!0,r;throw new Error("Cannot create signature due to invalid arguments.")},Mu.prototype.getSignedDate=function(){return this._signedDate},Mu.prototype.getCertificateInformation=function(){return this._certificateInfo},Mu.prototype.getSignatureOptions=function(){return{cryptographicStandard:this._cryptographicStandard,digestAlgorithm:this._digestAlgorithm,contactInfo:this._contactInfo,reason:this._reason,locationInfo:this._locationInfo,certify:this._certify,documentPermissions:this._documentPermissions,signedName:this._signedName,isLocked:this._isLocked}},Mu.replaceEmptySignature=function(t,e,i,n,r,s,a){if(!(t instanceof Uint8Array&&(0!==t.length||i instanceof Uint8Array)&&0!==i.length))throw new Error("Invalid Uint8Array: Data is either not a Uint8Array or is empty.");if("string"!=typeof e&&""!==e)throw new Error("Signature field name is required");var o,h=[],a=s&&"string"!=typeof s?s:a;if(r&&Array.isArray(r))for(var c=0,_=r;c<_.length;c++){var d=_[c];d&&0<d.length&&h.push((new Zl)._readCertificate(d))}if(!Array.isArray(h)||0===h.length)throw new Error("Invalid certificate chain: Expected a non-empty array of Certificate.");r=a?(o=new Sp(t,a.password),void 0===a.skipSignatureEncoding||null===a.skipSignatureEncoding||!1===a.skipSignatureEncoding):(o=new Sp(t),!0);try{for(var l=o.form,u=void 0,p=0;p<l.count;p++)if(l.fieldAt(p).name===e){u=l.fieldAt(p);break}if(!u)throw new Error("Signature field name not found.");if((f=u._dictionary)&&f.has("V")){var f,g=(f=f.get("V")).getArray("ByteRange");if(4<=g.length){var y,m,b,w,v,S,P,x,A=t.subarray(0,g[1]),T=t.subarray(g[2]),C=new Uint8Array(A.length+T.length),k=(C.set(A,0),C.set(T,A.length),void 0),R=(r&&(y="",b=m=void 0,h&&0<h.length&&(y=M.DigestAlgorithm[n],m=new Au(y),b=h),v=(w=new Ru(null,b,y,!1))._getDigestAlgorithm()._digest(C,y),w._setSignedData(i,null,m._getEncryptionAlgorithm()),S={"adbe.pkcs7.detached":M.CryptographicStandard.cms,"ETSI.CAdES.detached":M.CryptographicStandard.cades},P=M.CryptographicStandard.cms,f.has("SubFilter")&&((x=f.get("SubFilter")).name?S[x.name]:void 0)===M.CryptographicStandard.cades&&(P=M.CryptographicStandard.cades),k=w._sign(v,null,void 0,void 0,P,y)),g[2]-g[1]-2);if(0!=(1&R))throw new Error("Allocated space was not enough");if(Math.floor(R/2)<k.length)throw new Error("Signature content space is not enough for signed bytes");var F=Jo(k),I=g[1];t[I]=255&"<".charCodeAt(0);for(p=0;p<F.length;p++)t[I+1+p]=255&F.charCodeAt(p);var D=I+1+F.length,B=g[2]-D-1;0<B&&t.fill(255&"0".charCodeAt(0),D,D+B),t[g[2]-1]=255&">".charCodeAt(0)}}if(!s||"string"!=typeof s)return t;N.Save.save(s,new Blob([t],{type:"application/pdf"}))}catch(t){throw new Error("Signing failed: "+t.message)}finally{o.destroy()}},Mu.prototype._applySignatureOptions=function(t){t&&(void 0!==t.cryptographicStandard&&null!==t.cryptographicStandard&&(this._cryptographicStandard=t.cryptographicStandard),void 0!==t.digestAlgorithm&&null!==t.digestAlgorithm&&(this._digestAlgorithm=t.digestAlgorithm),k(t.contactInfo)&&(this._contactInfo=t.contactInfo),k(t.reason)&&(this._reason=t.reason),k(t.locationInfo)&&(this._locationInfo=t.locationInfo),void 0!==t.documentPermissions&&null!==t.documentPermissions&&(this._documentPermissions=t.documentPermissions),k(t.signedName)&&(this._signedName=t.signedName),"boolean"==typeof t.certify&&(this._certify=t.certify),"boolean"==typeof t.isLocked)&&(this._isLocked=t.isLocked)},Mu.prototype._initializeInternals=function(t,e){this._crossReference=e._crossReference,this._signed=!0,this._signatureField=e;var i,n,r={"adbe.pkcs7.detached":M.CryptographicStandard.cms,"ETSI.CAdES.detached":M.CryptographicStandard.cades};this._signatureDictionary=new Bu(t,this),t.has("SubFilter")&&((n=t.get("SubFilter")).name?r[n.name]:void 0)===M.CryptographicStandard.cades&&(this._cryptographicStandard=M.CryptographicStandard.cades),t.has("Contents")&&(this._digestAlgorithm=this._signatureDictionary._parseDigestAlgorithm(),this._signatureDictionary._certificate)&&(r=this._signatureDictionary._certificate)&&(this._certificate=r,this._certificateInfo={issuerName:r._issuerName,serialNumber:r._serialNumber,subjectName:r._subjectName,validFrom:r._validFrom,validTo:r._validTo,version:r._version}),this._signedDate=this._signatureDictionary._parseSignedDate(),this._signedName=this._signatureDictionary._parseDirect("Name"),this._reason=this._signatureDictionary._parseDirect("Reason"),this._locationInfo=this._signatureDictionary._parseDirect("Location"),this._contactInfo=this._signatureDictionary._parseDirect("ContactInfo"),t.has("ByteRange")&&(n=t.get("ByteRange"),i=this._toNumberArray(n))&&0<i.length&&(r=!1,r=!!((n=this._crossReference._document._catalog._catalogDictionary)&&n.has("Perms")&&(n=n.get("Perms"))&&n.has("DocMDP")&&(n=n.get("DocMDP"))&&n.has("ByteRange")&&(n=n.get("ByteRange"),n=this._toNumberArray(n))&&i&&n.length===i.length&&n.every(function(t,e){return t===i[e]}))||r)&&t.has("Reference")&&(n=(n=t.get("Reference"))&&Array.isArray(n)?n[0]:n)&&n.has("TransformParams")&&(r=n.get("TransformParams"))&&r.has("P")&&(this._documentPermissions=r.get("P")),e._dictionary&&e._dictionary.has("Lock")?e._dictionary.get("Lock")&&(this._isLocked=!0):e._dictionary&&e._dictionary.has("Kids")&&this._crossReference&&(n=e._dictionary.get("Kids"),r=this._crossReference._cacheMap.get(n[0]))&&r.has("Lock")&&r.get("Lock")&&(this._isLocked=!0),!this._certify&&this._crossReference._document._isLoaded&&this._crossReference._document._catalog&&(this._certify=this._checkCertificated(t.objId))},Mu.prototype._toNumberArray=function(t){return t&&Array.isArray(t)&&(t=t.map(function(t){return"number"==typeof t?t:Number(t)})).every(function(t){return Number.isFinite(t)})?t:void 0},Mu.prototype._checkCertificated=function(t){var e,i=!1;return i=this._crossReference&&this._crossReference._document&&(e=this._crossReference._document)._catalog&&e._catalog._catalogDictionary&&e._catalog._catalogDictionary.has("Perms")&&(e=e._catalog._catalogDictionary.get("Perms"))&&e.has("DocMDP")&&(e=e.get("DocMDP"))&&e.objId&&t&&e.objId===t?!0:i},Mu.prototype._catalogBeginSave=function(){var t,e;this._certify&&(null==(t=(e=this._signatureField._crossReference._document)._catalog._catalogDictionary.get("Perms"))?((t=new D(this._crossReference)).update("DocMDP",this._reference),t._updated=!0,e._catalog._catalogDictionary.update("Perms",t),e._catalog._catalogDictionary._updated=!0):t.has("DocMDP")||(e=this._crossReference._getNextReference(),this._signatureField._crossReference._cacheMap.set(e,this._signatureDictionary._dictionary),t.set("DocMDP",e),t._updated=!0))},Mu.prototype._lockSignature=function(){var t,e=new D;e.update("Type",R.get("SigFieldLock")),e.update("Action",R.get("All")),e.update("P",M.PdfCertificationFlags.forbidChanges),this._signatureField&&this._signatureField._crossReference&&(t=this._signatureField._crossReference._getNextReference(),this._signatureField._crossReference._cacheMap.set(t,e),this._signatureField._dictionary.update("Lock",t))},Mu.prototype._createDictionary=function(t,e){return new Bu(t,e)};var Ou=Mu;function Mu(){this._visible=!0,this._externalChain=[],this._isLocked=!1,this._signed=!1,this._appendCertificates=!1,this._hasTimeStamp=!1,this._isTimestampOnly=!1,this._digestAlgorithm=M.DigestAlgorithm.sha256,this._cryptographicStandard=M.CryptographicStandard.cms,this._documentPermissions=M.PdfCertificationFlags.forbidChanges}Nu.prototype._setProperty=function(t,e){var i;null!=e&&(e instanceof Date?(i=e.toISOString().replace(/\.\d{3}Z$/,"Z"),this._properties.set(t,i)):"boolean"==typeof e?this._properties.set(t,e?"True":"False"):this._properties.set(t,e))},Nu.prototype._getProperty=function(t){return this._properties.get(t)},Nu.prototype._getNamespaceUri=function(){switch(this._prefix){case"xap":return"http://ns.adobe.com/xap/1.0/";case"dc":return"http://purl.org/dc/elements/1.1/";case"pdf":return"http://ns.adobe.com/pdf/1.3/";case"xmpTPg":return"http://ns.adobe.com/xap/1.0/t/pg/";case"xmpRights":return"http://ns.adobe.com/xap/1.0/rights/";case"xmpBJ":return"http://ns.adobe.com/xap/1.0/bj/";default:return void 0!==this._customNamespaceUri&&null!==this._customNamespaceUri?this._customNamespaceUri:""}},Nu.prototype._writeXml=function(t){for(var e="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i=[],n=!0,r=0,s=(i=this._properties&&"function"==typeof this._properties.keys?Array.from(this._properties.keys()):i).sort();r<s.length;r++){var a=s[r],o=this._properties.get(a);if(null!=o){var h=a.indexOf(":"),c=0<=h?a.substring(h+1):a,h=0<=h?a.substring(0,h):"",_=n&&h?this._getNamespaceUriForPrefix(h):void 0;if(Array.isArray(o)){if(0!==o.length){t._writeStartElement(c,h,_);var d=this._getArrayType(a);t._writeStartElement(d,"rdf",e);for(var l=0,u=o;l<u.length;l++){var p=u[l];"xap:Thumbnails"===a&&this._isThumbnailStruct(p)?(t._writeStartElement("li","rdf",e),t._writeAttributeString("parseType","Resource","rdf",e),t._writeElementString("Width",String(p.width),"xap","http://ns.adobe.com/xap/1.0/"),t._writeElementString("Height",String(p.height),"xap","http://ns.adobe.com/xap/1.0/"),t._writeElementString("Format",String(p.format),"xap","http://ns.adobe.com/xap/1.0/"),t._writeElementString("Image",String(p.image),"xap","http://ns.adobe.com/xap/1.0/"),t._writeEndElement()):t._writeElementString("li",String(p),"rdf",e)}t._writeEndElement(),t._writeEndElement(),n=!1}}else{if(this._isLangArray(o)){t._writeStartElement(c,h,_),t._writeStartElement("Alt","rdf",e);for(var f=o,g=0,y=Object.keys(f);g<y.length;g++){var m=y[g];t._writeStartElement("li","rdf",e),t._writeAttributeString("lang",m,"xml","http://www.w3.org/XML/1998/namespace"),Object.prototype.hasOwnProperty.call(f,m)&&t._writeString(f[m]),t._writeEndElement()}t._writeEndElement(),t._writeEndElement()}else t._writeElementString(c,String(o),h,_);n=!1}}}},Nu.prototype._isLangArray=function(e){var t;return null!==e&&"object"==typeof e&&!Array.isArray(e)&&0!==(t=Object.keys(e)).length&&t.every(function(t){return"string"==typeof t&&Object.prototype.hasOwnProperty.call(e,t)&&"string"==typeof e[t]})},Nu.prototype._isThumbnailStruct=function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&"number"==typeof t.width&&"number"==typeof t.height&&"string"==typeof t.format&&"string"==typeof t.image},Nu.prototype._getArrayType=function(t){return!(0<=["dc:contributor","dc:publisher","dc:relation","dc:subject","dc:type","xmpRights:Owner","xmpBJ:JobRef","xmpTPg:Fonts","xap:Thumbnails"].indexOf(t))&&0<=["dc:creator","dc:date","xmpTPg:PlateNames","xmpTPg:Colorants"].indexOf(t)?"Seq":"Bag"},Nu.prototype._getNamespaceUriForPrefix=function(t){switch(t){case"xap":return"http://ns.adobe.com/xap/1.0/";case"dc":return"http://purl.org/dc/elements/1.1/";case"pdf":return"http://ns.adobe.com/pdf/1.3/";case"xmpRights":return"http://ns.adobe.com/xap/1.0/rights/";case"xmpBJ":return"http://ns.adobe.com/xap/1.0/bj/";default:return void 0!==this._customNamespaceUri&&null!==this._customNamespaceUri?this._customNamespaceUri:""}};var Eu=Nu;function Nu(t){this._xmp=t,this._properties=new Map}ju=function(t,e){return(ju=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}ju(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Uu,Vu=Eu),Object.defineProperty(Uu.prototype,"schemaType",{get:function(){return M.PdfXmpSchemaType.basic},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"creatorTool",{get:function(){return this._creatorTool||(this._creatorTool=this._getProperty("xap:CreatorTool")),this._creatorTool},set:function(t){this._creatorTool=t,this._setProperty("xap:CreatorTool",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"label",{get:function(){return this._label||(this._label=this._getProperty("xap:Label")),this._label},set:function(t){this._label=t,this._setProperty("xap:Label",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"nickname",{get:function(){return this._nickname||(this._nickname=this._getProperty("xap:Nickname")),this._nickname},set:function(t){this._nickname=t,this._setProperty("xap:Nickname",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"baseUrl",{get:function(){return this._baseUrl||(this._baseUrl=this._getProperty("xap:BaseURL")),this._baseUrl},set:function(t){this._baseUrl=t,this._setProperty("xap:BaseURL",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"createDate",{get:function(){return this._createDate||(this._createDate=this._getProperty("xap:CreateDate")),this._createDate},set:function(t){this._createDate=t,this._setProperty("xap:CreateDate",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"modifyDate",{get:function(){return this._modifyDate||(this._modifyDate=this._getProperty("xap:ModifyDate")),this._modifyDate},set:function(t){this._modifyDate=t,this._setProperty("xap:ModifyDate",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"metadataDate",{get:function(){return this._metadataDate||(this._metadataDate=this._getProperty("xap:MetadataDate")),this._metadataDate},set:function(t){this._metadataDate=t,this._setProperty("xap:MetadataDate",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"advisory",{get:function(){return this._advisory||(this._advisory=this._getProperty("xap:Advisory")),this._advisory},set:function(t){this._advisory=t,this._setProperty("xap:Advisory",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"identifier",{get:function(){return this._identifier||(this._identifier=this._getProperty("xap:Identifier")),this._identifier},set:function(t){this._identifier=t,this._setProperty("xap:Identifier",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"thumbnails",{get:function(){return this._thumbnails||(this._thumbnails=this._getProperty("xap:Thumbnails")),this._thumbnails},set:function(t){this._thumbnails=t,this._setProperty("xap:Thumbnails",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Uu.prototype,"rating",{get:function(){return this._rating||(this._rating=this._getProperty("xap:Rating")),this._rating},set:function(t){this._rating=t,this._setProperty("xap:Rating",t)},enumerable:!0,configurable:!0});var ju,Vu,zu=Uu;function Uu(t){t=Vu.call(this,t)||this;return t._prefix="xap",t._name="Basic",t}Hu=function(t,e){return(Hu=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Hu(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Gu,Wu=Eu),Object.defineProperty(Gu.prototype,"schemaType",{get:function(){return M.PdfXmpSchemaType.dublinCore},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"contributor",{get:function(){return this._contributor||(this._contributor=this._getProperty("dc:contributor")),this._contributor},set:function(t){this._contributor=t,this._setProperty("dc:contributor",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"creator",{get:function(){return this._creator||(this._creator=this._getProperty("dc:creator")),this._creator},set:function(t){this._creator=t,this._setProperty("dc:creator",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"date",{get:function(){return this._date||(this._date=this._getProperty("dc:date")),this._date},set:function(t){this._date=t,this._setProperty("dc:date",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"publisher",{get:function(){return this._publisher||(this._publisher=this._getProperty("dc:publisher")),this._publisher},set:function(t){this._publisher=t,this._setProperty("dc:publisher",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"relation",{get:function(){return this._relation||(this._relation=this._getProperty("dc:relation")),this._relation},set:function(t){this._relation=t,this._setProperty("dc:relation",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"subject",{get:function(){return this._subject||(this._subject=this._getProperty("dc:subject")),this._subject},set:function(t){this._subject=t,this._setProperty("dc:subject",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"type",{get:function(){return this._type||(this._type=this._getProperty("dc:type")),this._type},set:function(t){this._type=t,this._setProperty("dc:type",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"title",{get:function(){return this._title||(this._title=this._getProperty("dc:title")),this._title},set:function(t){this._title=t,this._setProperty("dc:title",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"description",{get:function(){return this._description||(this._description=this._getProperty("dc:description")),this._description},set:function(t){this._description=t,this._setProperty("dc:description",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"rights",{get:function(){return this._rights||(this._rights=this._getProperty("dc:rights")),this._rights},set:function(t){this._rights=t,this._setProperty("dc:rights",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"coverage",{get:function(){return this._coverage||(this._coverage=this._getProperty("dc:coverage")),this._coverage},set:function(t){this._coverage=t,this._setProperty("dc:coverage",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"identifier",{get:function(){return this._identifier||(this._identifier=this._getProperty("dc:identifier")),this._identifier},set:function(t){this._identifier=t,this._setProperty("dc:identifier",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"source",{get:function(){return this._source||(this._source=this._getProperty("dc:source")),this._source},set:function(t){this._source=t,this._setProperty("dc:source",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Gu.prototype,"format",{get:function(){return this._format||(this._format=this._getProperty("dc:format")),this._format},set:function(t){this._format=t,this._setProperty("dc:format",t)},enumerable:!0,configurable:!0});var Hu,Wu,qu=Gu;function Gu(t){t=Wu.call(this,t)||this;return t._prefix="dc",t._name="DublinCore",t}Ku=function(t,e){return(Ku=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Ku(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Yu,Xu=Eu),Object.defineProperty(Yu.prototype,"schemaType",{get:function(){return M.PdfXmpSchemaType.pdf},enumerable:!0,configurable:!0}),Object.defineProperty(Yu.prototype,"keywords",{get:function(){return this._keywords||(this._keywords=this._getProperty("pdf:Keywords")),this._keywords},set:function(t){this._keywords=t,this._setProperty("pdf:Keywords",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Yu.prototype,"pdfVersion",{get:function(){return this._pdfVersion||(this._pdfVersion=this._getProperty("pdf:PDFVersion")),this._pdfVersion},set:function(t){this._pdfVersion=t,this._setProperty("pdf:PDFVersion",t)},enumerable:!0,configurable:!0}),Object.defineProperty(Yu.prototype,"producer",{get:function(){return this._producer||(this._producer=this._getProperty("pdf:Producer")),this._producer},set:function(t){this._producer=t,this._setProperty("pdf:Producer",t)},enumerable:!0,configurable:!0});var Ku,Xu,Ju=Yu;function Yu(t){t=Xu.call(this,t)||this;return t._prefix="pdf",t._name="PDF",t}Qu=function(t,e){return(Qu=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Qu(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(tp,Zu=Eu),Object.defineProperty(tp.prototype,"schemaType",{get:function(){return M.PdfXmpSchemaType.pagedText},enumerable:!0,configurable:!0}),Object.defineProperty(tp.prototype,"pageCount",{get:function(){return void 0!==this._pageCount?parseInt(this._pageCount,10):(this._pageCount=this._getProperty("xmpTPg:NPages"),void 0!==this._pageCount?parseInt(String(this._pageCount),10):0)},set:function(t){this._pageCount=String(t),this._setProperty("xmpTPg:NPages",String(t))},enumerable:!0,configurable:!0}),Object.defineProperty(tp.prototype,"maxPageSize",{get:function(){return void 0!==this._MaxPageSize?this._MaxPageSize:this._getProperty("xmpTPg:MaxPageSize")},set:function(t){this._MaxPageSize=t,this._setProperty("xmpTPg:MaxPageSize",t)},enumerable:!0,configurable:!0}),Object.defineProperty(tp.prototype,"fonts",{get:function(){return this._fonts||this._getProperty("xmpTPg:Fonts")||[]},set:function(t){this._fonts=t,this._setProperty("xmpTPg:Fonts",t)},enumerable:!0,configurable:!0}),Object.defineProperty(tp.prototype,"plateNames",{get:function(){return this._plateNames||this._getProperty("xmpTPg:PlateNames")||[]},set:function(t){this._plateNames=t,this._setProperty("xmpTPg:PlateNames",t)},enumerable:!0,configurable:!0}),Object.defineProperty(tp.prototype,"colorants",{get:function(){return this._Colorants||this._getProperty("xmpTPg:Colorants")||[]},set:function(t){this._Colorants=t,this._setProperty("xmpTPg:Colorants",t)},enumerable:!0,configurable:!0}),tp.prototype._writeXml=function(t){for(var e="http://ns.adobe.com/xap/1.0/t/pg/",i="http://www.w3.org/1999/02/22-rdf-syntax-ns#",n="http://ns.adobe.com/xap/1.0/sType/Dimensions#",n=(void 0!==this._MaxPageSize&&(t._writeStartElement("MaxPageSize","xmpTPg",e),t._writeStartElement("Description","rdf",i),t._writeNamespaceDeclaration("stDim",n),t._writeElementString("w",String(this._MaxPageSize.width),"stDim",n),t._writeElementString("h",String(this._MaxPageSize.height),"stDim",n),void 0!==this._MaxPageSize.unit&&t._writeElementString("unit",this._MaxPageSize.unit,"stDim",n),t._writeEndElement(),t._writeEndElement()),[]),r=0,s=(n=this._properties&&"function"==typeof this._properties.keys?Array.from(this._properties.keys()):n).sort();r<s.length;r++){var a=s[r];if("xmpTPg:MaxPageSize"!==a){var o=this._properties.get(a);if(null!=o){var h=a.indexOf(":"),c=0<=h?a.substring(h+1):a,h=0<=h?a.substring(0,h):"";if(Array.isArray(o)){if(0!==o.length){t._writeStartElement(c,h,e),t._writeStartElement("xmpTPg:Colorants"===a||"xmpTPg:PlateNames"===a?"Seq":"Bag","rdf",i);for(var _=0,d=o;_<d.length;_++){var l=d[_];t._writeElementString("li",String(l),"rdf",i)}t._writeEndElement(),t._writeEndElement()}}else t._writeElementString(c,String(o),h,e)}}}};var Qu,Zu,$u=tp;function tp(t){t=Zu.call(this,t)||this;return t._prefix="xmpTPg",t._name="PagedText",t}ep=function(t,e){return(ep=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}ep(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(rp,ip=Eu),Object.defineProperty(rp.prototype,"schemaType",{get:function(){return M.PdfXmpSchemaType.basicJobTicket},enumerable:!0,configurable:!0}),Object.defineProperty(rp.prototype,"jobRef",{get:function(){return void 0!==this._jobRef&&null!==this._jobRef?this._jobRef:(this._jobRef=this._getProperty("xmpBJ:JobRef"),this._jobRef||[])},set:function(t){this._jobRef=t,this._setProperty("xmpBJ:JobRef",t)},enumerable:!0,configurable:!0});var ep,ip,np=rp;function rp(t){t=ip.call(this,t)||this;return t._prefix="xmpBJ",t._name="BasicJobTicket",t}sp=function(t,e){return(sp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}sp(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(hp,ap=Eu),Object.defineProperty(hp.prototype,"schemaType",{get:function(){return M.PdfXmpSchemaType.rightsManagement},enumerable:!0,configurable:!0}),Object.defineProperty(hp.prototype,"certificateUrl",{get:function(){return this._certificate||(this._certificate=this._getProperty("xmpRights:Certificate")),this._certificate},set:function(t){this._certificate=t,this._setProperty("xmpRights:Certificate",t)},enumerable:!0,configurable:!0}),Object.defineProperty(hp.prototype,"webStatement",{get:function(){return this._webStatement||(this._webStatement=this._getProperty("xmpRights:WebStatement")),this._webStatement},set:function(t){this._webStatement=t,this._setProperty("xmpRights:WebStatement",t)},enumerable:!0,configurable:!0}),Object.defineProperty(hp.prototype,"isMarked",{get:function(){var t;return void 0!==this._isMarked?this._isMarked:"string"==typeof(t=this._getProperty("xmpRights:Marked"))&&"True"===t},set:function(t){this._isMarked=t,this._setProperty("xmpRights:Marked",t)},enumerable:!0,configurable:!0}),Object.defineProperty(hp.prototype,"owners",{get:function(){return this._owner||this._getProperty("xmpRights:Owner")||[]},set:function(t){this._owner=t,this._setProperty("xmpRights:Owner",t)},enumerable:!0,configurable:!0}),Object.defineProperty(hp.prototype,"usageTerms",{get:function(){return this._usageTerms||(this._usageTerms=this._getProperty("xmpRights:UsageTerms")),this._usageTerms},set:function(t){this._usageTerms=t,this._setProperty("xmpRights:UsageTerms",t)},enumerable:!0,configurable:!0});var sp,ap,op=hp;function hp(t){t=ap.call(this,t)||this;return t._prefix="xmpRights",t._name="RightsManagement",t}cp=function(t,e){return(cp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}cp(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(lp,_p=Eu),Object.defineProperty(lp.prototype,"schemaType",{get:function(){return M.PdfXmpSchemaType.custom},enumerable:!0,configurable:!0}),Object.defineProperty(lp.prototype,"customData",{get:function(){return this._customdata},set:function(t){this._customdata=t},enumerable:!0,configurable:!0}),lp.prototype._writeXml=function(i){var n=this;0!==this._customdata.size&&this._customdata.forEach(function(t,e){i._writeElementString(e,t,n._namespace,n._namespaceUri)})};var cp,_p,dp=lp;function lp(t,e,i){t=_p.call(this,t)||this;return t._namespace=e,t._namespaceUri=i,t._customNamespaceUri=i,t._prefix=e,t._name=i,t._customdata=new Map,t._xmp&&t._xmp._customSchemas.push(t),t}Object.defineProperty(pp.prototype,"dublinCoreSchema",{get:function(){return this._dublinCoreSchema||(this._dublinCoreSchema=new qu(this)),this._dublinCoreSchema},enumerable:!0,configurable:!0}),Object.defineProperty(pp.prototype,"basicSchema",{get:function(){return this._basicSchema||(this._basicSchema=new zu(this)),this._basicSchema},enumerable:!0,configurable:!0}),Object.defineProperty(pp.prototype,"pdfSchema",{get:function(){return this._pdfSchema||(this._pdfSchema=new Ju(this)),this._pdfSchema},enumerable:!0,configurable:!0}),Object.defineProperty(pp.prototype,"pagedTextSchema",{get:function(){return this._pagedTextSchema||(this._pagedTextSchema=new $u(this)),this._pagedTextSchema},enumerable:!0,configurable:!0}),Object.defineProperty(pp.prototype,"basicJobTicketSchema",{get:function(){return this._basicJobTicketSchema||(this._basicJobTicketSchema=new np(this)),this._basicJobTicketSchema},enumerable:!0,configurable:!0}),Object.defineProperty(pp.prototype,"rightsManagementSchema",{get:function(){return this._rightsManagementSchema||(this._rightsManagementSchema=new op(this)),this._rightsManagementSchema},enumerable:!0,configurable:!0}),Object.defineProperty(pp.prototype,"customSchema",{get:function(){return this._customSchema||(this._customSchema=new dp(this,"pdfx","http://ns.adobe.com/pdfx/1.3/")),this._customSchema},enumerable:!0,configurable:!0}),pp.prototype._build=function(){var t=new Date;this._basicSchema&&void 0!==this._basicSchema._getProperty("xap:CreateDate")||(this.basicSchema.createDate=t),this._basicSchema&&void 0!==this._basicSchema._getProperty("xap:ModifyDate")||(this.basicSchema.modifyDate=t),this._dublinCoreSchema&&void 0!==this._dublinCoreSchema._getProperty("dc:format")||(this.dublinCoreSchema.format="application/pdf"),this._xmlWriter=new j,this._namespaceRegistry.clear(),this._xmlWriter._writeStartElement("xmpmeta","x","adobe:ns:meta/"),this._xmlWriter._writeStartElement("RDF","rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this._writeSchemas(this._xmlWriter),this._xmlWriter._writeEndElement(),this._xmlWriter._writeEndElement();t='<?xml version="1.0" encoding="utf-8"?><?xpacket begin="\ufeff" id="W5M0MpCehiHzreSzNTczkc9d"?>'+vs(this._xmlWriter._save()).replace(/^<\?xml\s+version\s*=\s*["']1\.0["']\s+encoding\s*=\s*["']utf-8["']\s*\?>/,"")+'<?xpacket end="r"?>';return this._buffer=v(t.replace(/(>)(<)(\/*)/g,"$1\n$2$3")),this._buffer},pp.prototype._writeSchemas=function(t){var e=[];if(this._basicSchema&&0<this._basicSchema._properties.size&&e.push(this._basicSchema),this._dublinCoreSchema&&0<this._dublinCoreSchema._properties.size&&e.push(this._dublinCoreSchema),this._pdfSchema&&0<this._pdfSchema._properties.size&&e.push(this._pdfSchema),this._pagedTextSchema&&0<this._pagedTextSchema._properties.size&&e.push(this._pagedTextSchema),this._basicJobTicketSchema&&0<this._basicJobTicketSchema._properties.size&&e.push(this._basicJobTicketSchema),this._rightsManagementSchema&&0<this._rightsManagementSchema._properties.size&&e.push(this._rightsManagementSchema),this._customSchemas&&0<this._customSchemas.length)for(var i=0,n=this._customSchemas;i<n.length;i++){var r=n[i];(r.customData instanceof Map?0<r.customData.size:r._properties&&0<r._properties.size)&&e.push(r)}for(var s=0,a=e;s<a.length;s++)this._writeSchema(t,a[s])},pp.prototype._writeSchema=function(t,e){t._writeStartElement("Description","rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),t._writeAttributeString("about","","rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");var i=e._prefix,n=e._getNamespaceUri();this._namespaceRegistry.has(i)||(t._writeAttributeString(i,n,"xmlns","http://www.w3.org/2000/xmlns/"),this._namespaceRegistry.add(i)),e._writeXml(t),t._writeEndElement()},pp.prototype._serializeToStream=function(){var t=this._build();this._xmpStream=new g(t),this.xmpStream=this._xmpStream.bytes},pp.prototype._destroy=function(){this._xmlWriter=void 0,this._buffer=void 0,this._namespaceRegistry.clear(),this._dublinCoreSchema=void 0,this._basicSchema=void 0,this._pdfSchema=void 0,this._pagedTextSchema=void 0,this._basicJobTicketSchema=void 0,this._rightsManagementSchema=void 0,this._customSchema=void 0,this._xmpStream=void 0};var up=pp;function pp(){this._customSchemas=[],this._isUpdated=!1,this._namespaceRegistry=new Set}gp.prototype._load=function(t){var t=t instanceof Uint8Array?vs(t):t,e=t.lastIndexOf("<?xpacket begin");if(-1===e)throw new Error("XMP metadata not found in PDF");var i=t.indexOf("<?xpacket end=",e);if(-1===i)throw new Error("XMP metadata not found in PDF");e=t.substring(e,t.indexOf("?>",i)+2),t=new DOMParser;this._xmlDoc=t.parseFromString(e,"application/xml"),this._validate(this._xmlDoc)},gp.prototype._validate=function(t){var t=t.querySelector("parsererror");if(t)throw t=t.textContent||"Unknown parse error",new Error("Invalid XMP XML: "+t)},gp.prototype._parseXmp=function(){this._xmp=new up;for(var t=this._getRdfRoot().getElementsByTagNameNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"),e=0;e<t.length;e++)this._parseSchemaNode(t.item(e));return this._xmp},gp.prototype._getRdfRoot=function(){if(!this._xmlDoc)throw new Error("XML document not loaded");var t=this._xmlDoc.getElementsByTagNameNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#","RDF");if(0===t.length)throw new Error("rdf:RDF element not found in XMP metadata");return t[0]},gp.prototype._parseSchemaNode=function(t){for(var e=t.attributes,i=0;i<e.length;i++){var n,r=e.item(i);r.name.startsWith("xmlns:")&&(n=r.name.substring(6),r=r.value,this._mapSchema(n,r,t))}},gp.prototype._mapSchema=function(t,e,i){switch(e){case"http://purl.org/dc/elements/1.1/":this._parseDublinCore(i);break;case"http://ns.adobe.com/xap/1.0/":this._parseBasic(i);break;case"http://ns.adobe.com/pdf/1.3/":this._parsePdf(i);break;case"http://ns.adobe.com/xap/1.0/t/pg/":this._parsePagedText(i);break;case"http://ns.adobe.com/xap/1.0/rights/":this._parseRights(i);break;case"http://ns.adobe.com/xap/1.0/bj/":this._parseJobTicket(i);break;case"http://ns.adobe.com/pdfx/1.3/":this._parseInternalCustom(t,e,i);break;default:this._parseCustom(t,e,i)}},gp.prototype._parseBasic=function(t){var e=this._xmp.basicSchema,i=this._getValue(t,"CreatorTool"),i=(i&&(e.creatorTool=i),this._getValue(t,"Label")),i=(i&&(e.label=i),this._getValue(t,"Nickname")),i=(i&&(e.nickname=i),this._getValue(t,"BaseURL")),i=(i&&(e.baseUrl=i),this._getDate(t,"CreateDate")),i=(i&&(e.createDate=i),this._getDate(t,"ModifyDate")),i=(i&&(e.modifyDate=i),this._getDate(t,"MetadataDate")),i=(i&&(e.metadataDate=i),this._getArray(t,"Advisory")),i=(0<i.length&&(e.advisory=i),this._getArray(t,"Identifier")),i=(0<i.length&&(e.identifier=i),this._getThumbnails(t,"Thumbnails")),i=(0<i.length&&(e.thumbnails=i),this._getArray(t,"Rating"));0<i.length&&(e.rating=i.map(function(t){return parseFloat(t)}))},gp.prototype._parseDublinCore=function(t){var e=this._xmp.dublinCoreSchema,i=this._getArray(t,"contributor"),i=(0<i.length&&(e.contributor=i),this._getArray(t,"creator")),i=(0<i.length&&(e.creator=i),this._getArray(t,"date")),i=(0<i.length&&(e.date=i),this._getArray(t,"publisher")),i=(0<i.length&&(e.publisher=i),this._getArray(t,"relation")),i=(0<i.length&&(e.relation=i),this._getArray(t,"subject")),i=(0<i.length&&(e.subject=i),this._getArray(t,"type")),i=(0<i.length&&(e.type=i),this._getLangArray(t,"title")),i=(0<Object.keys(i).length&&(e.title=i),this._getLangArray(t,"description")),i=(0<Object.keys(i).length&&(e.description=i),this._getLangArray(t,"rights")),i=(0<Object.keys(i).length&&(e.rights=i),this._getValue(t,"coverage")),i=(i&&(e.coverage=i),this._getValue(t,"identifier")),i=(i&&(e.identifier=i),this._getValue(t,"source")),i=(i&&(e.source=i),this._getValue(t,"format"));i&&(e.format=i)},gp.prototype._parsePdf=function(t){var e=this._xmp.pdfSchema,i=this._getValue(t,"Keywords"),i=(i&&(e.keywords=i),this._getValue(t,"Producer")),i=(i&&(e.producer=i),this._getValue(t,"PDFVersion"));i&&(e.pdfVersion=i)},gp.prototype._parsePagedText=function(t){var e=this._xmp.pagedTextSchema,i=this._getValue(t,"NPages"),i=(i&&(e.pageCount=parseInt(i,10)),this._findChildElement(t,"MaxPageSize")),n=(i&&(i=this._findDirectChild(i,"Description"))&&(r=this._getValue(i,"w"),n=this._getValue(i,"h"),i=this._getValue(i,"unit"),r)&&n&&(r={width:parseFloat(r),height:parseFloat(n)},i&&(r.unit=i),e.maxPageSize=r),this._getArray(t,"Fonts")),i=(0<n.length&&(e.fonts=n),this._getArray(t,"PlateNames")),r=(0<i.length&&(e.plateNames=i),this._getArray(t,"Colorants"));0<r.length&&(e.colorants=r)},gp.prototype._parseRights=function(t){var e=this._xmp.rightsManagementSchema,i=this._getValue(t,"Certificate"),i=(i&&(e.certificateUrl=i),this._getValue(t,"WebStatement")),i=(i&&(e.webStatement=i),this._getValue(t,"Marked")),i=(i&&(e.isMarked="True"===i),this._getArray(t,"Owner")),i=(0<i.length&&(e.owners=i),this._getLangArray(t,"UsageTerms"));0<Object.keys(i).length&&e._setProperty("xmpRights:UsageTerms",i)},gp.prototype._parseJobTicket=function(t){var e=this._xmp.basicJobTicketSchema,t=this._getArray(t,"JobRef");0<t.length&&(e.jobRef=t)},gp.prototype._parseInternalCustom=function(t,e,i){for(var n=new dp(this._xmp,t,e),r=i.querySelectorAll("*"),s=0;s<r.length;s++){var a,o=r.item(s);o.prefix!==t&&!o.localName.startsWith(t+":")||(a=o.localName.replace(t+":",""),o=o.textContent||"",n.customData.set(a,o))}0<n.customData.size&&(this._xmp._customSchema=n)},gp.prototype._parseCustom=function(t,e,i){for(var n=new dp(this._xmp,t,e),r=i.querySelectorAll("*"),s=0;s<r.length;s++){var a,o=r.item(s);o.prefix!==t&&!o.localName.startsWith(t+":")||(a=o.localName.replace(t+":",""),o=o.textContent||"",n.customData.set(a,o))}},gp.prototype._getValue=function(t,e){var i=this._findChildElement(t,e);if(i){i=i.textContent?i.textContent.trim():"";if(i)return i}i=t.getAttribute(this._getAttributeName(t,e));if(i)return i},gp.prototype._getAttributeName=function(t,e){for(var i=t.attributes,n=0;n<i.length;n++){var r=i.item(n);if(r.localName===e)return r.name}return null},gp.prototype._getDate=function(t,e){t=this._getValue(t,e);if(t){e=new Date(t);if(!isNaN(e.getTime()))return e}},gp.prototype._getArray=function(t,e){var i=[],t=this._findChildElement(t,e);if(t){e=this._findDirectChild(t,"Bag")||this._findDirectChild(t,"Seq");if(e)for(var n=0,r=this._findDirectChildren(e,"li");n<r.length;n++){var s=r[n].textContent;s&&i.push(s.trim())}}return i},gp.prototype._getLangArray=function(t,e){var i={},t=this._findChildElement(t,e);if(t){e=this._findDirectChild(t,"Alt");if(e)for(var n=0,r=this._findDirectChildren(e,"li");n<r.length;n++){var s=r[n],a=s.getAttribute("xml:lang"),s=s.textContent;a&&s&&"__proto__"!==a&&"constructor"!==a&&"prototype"!==a&&(i[String(a)]=s.trim())}}return i},gp.prototype._getThumbnails=function(t,e){var i=[],t=this._findChildElement(t,e);if(t){e=this._findDirectChild(t,"Bag");if(e)for(var n=0,r=this._findDirectChildren(e,"li");n<r.length;n++){var s=r[n],a=this._getValue(s,"width")||this._getValue(s,"Width"),o=this._getValue(s,"height")||this._getValue(s,"Height"),h=this._getValue(s,"format")||this._getValue(s,"Format"),s=this._getValue(s,"image")||this._getValue(s,"Image");a&&o&&h&&s&&(a={width:parseInt(a,10),height:parseInt(o,10),format:h,image:s},i.push(a))}}return i},gp.prototype._findChildElement=function(t,e){for(var i=t.children,n=0;n<i.length;n++){var r=i.item(n);if(r.localName===e)return r}return null},gp.prototype._findDirectChild=function(t,e){for(var i=t.children,n=0;n<i.length;n++){var r=i.item(n);if(r.localName===e)return r}return null},gp.prototype._findDirectChildren=function(t,e){for(var i=[],n=t.children,r=0;r<n.length;r++){var s=n.item(r);s.localName===e&&i.push(s)}return i};var fp=gp;function gp(){}mp.prototype.set=function(t,e){if(null==t||null==e)throw new Error("Key and value should not be null");if(""===t||""===e)throw new Error("Key and value should not be empty");if(this._standardKeys.has(t.toLowerCase()))throw new Error("The Custom key cannot be a standard property");this._customData.set(t,e)},mp.prototype.get=function(t){if(null==t)throw new Error("Key value should not be null");return this._customData.get(t)},mp.prototype.has=function(t){if(null==t)throw new Error("Key value should not be null");return this._customData.has(t)},mp.prototype.remove=function(t){if(null==t)throw new Error("Key value should not be null");this._customData.delete(t)};var yp=mp;function mp(){this._customData=new Map,this._standardKeys=new Set(["title","author","subject","keywords","creator","producer","language","creationDate","modificationDate"])}var bp=function(){return(bp=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},wp=function(s,a,o,h){return new(o=o||Promise)(function(t,e){function i(t){try{r(h.next(t))}catch(t){e(t)}}function n(t){try{r(h.throw(t))}catch(t){e(t)}}function r(e){e.done?t(e.value):new o(function(t){t(e.value)}).then(i,n)}r((h=h.apply(s,a||[])).next())})},vp=function(n,r){var s,a,o,h={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(i){return function(t){var e=[i,t];if(s)throw new TypeError("Generator is already executing.");for(;h;)try{if(s=1,a&&(o=2&e[0]?a.return:e[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,e[1])).done)return o;switch(a=0,(e=o?[2&e[0],o.value]:e)[0]){case 0:case 1:o=e;break;case 4:return h.label++,{value:e[1],done:!1};case 5:h.label++,a=e[1],e=[0];continue;case 7:e=h.ops.pop(),h.trys.pop();continue;default:if(!(o=0<(o=h.trys).length&&o[o.length-1])&&(6===e[0]||2===e[0])){h=0;continue}if(3===e[0]&&(!o||e[1]>o[0]&&e[1]<o[3]))h.label=e[1];else if(6===e[0]&&h.label<o[1])h.label=o[1],o=e;else{if(!(o&&h.label<o[2])){o[2]&&h.ops.pop(),h.trys.pop();continue}h.label=o[2],h.ops.push(e)}}e=r.call(n,h)}catch(t){e=[6,t],a=0}finally{s=o=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}},Sp=(Object.defineProperty(F.prototype,"_allowImportCustomData",{get:function(){return this._allowCustomData},set:function(t){this._allowCustomData=t},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"_linearization",{get:function(){if(!this._linear){var t=void 0;try{t=new __(this._stream)}catch(t){}this._linear=t}return this._linear},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"_startXRef",{get:function(){var t=this._stream,e=0;if(this._linearization&&this._linearization.isValid)t.reset(),this._find(t,this._endObjSignature)&&(e=t.position+6-t.start);else{for(var i=this._startXrefSignature.length,n=!1,r=t.end;!n&&0<r;)(r-=1024-i)<0&&(r=0),t.position=r,n=this._find(t,this._startXrefSignature,1024,!0);if(n){t.skip(9);for(var s=void 0;ks(s=t.getByte()););for(var a="";32<=s&&s<=57;)a+=String.fromCharCode(s),s=t.getByte();e=parseInt(a,10),isNaN(e)&&(e=0)}}return e},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"isEncrypted",{get:function(){return this._isEncrypted},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"isUserPassword",{get:function(){return this._isUserPassword},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"pageCount",{get:function(){return void 0===this._pageCount&&(this._pageCount=0,this._linearization&&this._linearization.isValid?this._pageCount=this._linearization.pageCount:this._pageCount=this._catalog.pageCount),this._pageCount},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"form",{get:function(){return void 0===this._form&&(this._form=new dd(this._catalog.acroForm,this._crossReference)),this._form},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"flatten",{get:function(){return this._flatten},set:function(t){this._flatten=t},enumerable:!0,configurable:!0}),F.prototype._getDecompressedStreamBytes=function(t){var e;return t instanceof Uh?(e=t.bytes?t.bytes.length:t.bufferLength||0,t.getBytes(e)):t.bytes},F.prototype._getMetadataValue=function(){if(!this._xmpMetadata){if(this._catalog&&this._catalog._catalogDictionary.has("Metadata")){var t,e=this._catalog._catalogDictionary.getRaw("Metadata"),i=void 0;if(e instanceof m?((t=this._crossReference._fetch(e))instanceof g||t instanceof Uh)&&(i=t):(e instanceof g||e instanceof Uh)&&(i=e),i)return(t=new fp)._load(this._getDecompressedStreamBytes(i)),this._xmpMetadata=t._parseXmp(),this._xmpMetadata}this._xmpMetadata=new up}return this._xmpMetadata},Object.defineProperty(F.prototype,"permissions",{get:function(){var t;return this._crossReference&&void 0!==(t=this._crossReference._permissionFlags)&&(this._permissions=3903&t),this._permissions},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"bookmarks",{get:function(){var t,e,i=this._catalog;return i&&(i._catalogDictionary.has("Outlines")?(e=i._catalogDictionary._get("Outlines"),(t=i._catalogDictionary.get("Outlines"))&&(this._bookmarkBase=new md(t,this._crossReference),this._bookmarkBase._reference=e,t.has("First"))&&this._bookmarkBase._reproduceTree()):(t=new D(this._crossReference),e=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(e,t),i._catalogDictionary.update("Outlines",e),this._crossReference._allowCatalog=!0,this._bookmarkBase=new md(t,this._crossReference),this._bookmarkBase._reference=e)),this._bookmarkBase},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"fileStructure",{get:function(){return this._fileStructure},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"layers",{get:function(){return this._layers||(this._layers=new zd(this)),this._layers},enumerable:!0,configurable:!0}),Object.defineProperty(F.prototype,"template",{get:function(){return this._isLoaded||this._template||(this._template={}),this._template},enumerable:!0,configurable:!0}),F.prototype.getRevisions=function(){var t,i,n,r,s=this;if(this._isLoaded)return this._revisions||(0===(t=this._startXRefParsedCache?this._startXRefParsedCache.sort(function(t,e){return t-e}):[]).length?this._revisions=[]:(i=new Uint8Array([37,37,69,79,70]),n=this._stream,r=[],t.forEach(function(t){n.position=t;var e,t=n.end-n.position;t<i.length||!s._find(n,i,t,!1)||(t=n.position+i.length,n.position=t,n.position<n.end&&(13===(e=n.getByte())?(t++,n.position<n.end&&10===n.getByte()&&t++):10===e&&t++),r.push(t))}),this._revisions=r))},F.prototype.embedFont=function(t,e,i,n){var r,s,a,o,h,c;return"string"==typeof t||t instanceof Uint8Array?(o="string"==typeof t?Rs(t):t,r=this._computeFontHash(o),h=e,a=i,s=this._getOrCreateFontPrimitive(r,{type:"ttf",data:o}),this._fontCollection.set(r,s),c=M.PdfFontStyle.regular,a&&a.shouldUnderline&&(c=M.PdfFontStyle.underline),a&&a.shouldStrikeout&&(c=M.PdfFontStyle.strikeout),(a=new ye(o,h,c,s))._document=this,a):(o=t,h=i,c=e,s=("boolean"==typeof n?n:!1)?this._getOrCreateFontPrimitive(r="cjk_"+o+"_"+h,{type:"cjk",family:o,style:h}):this._getOrCreateFontPrimitive(r="standard_"+o+"_"+h,{type:"standard",family:o,style:h}),this._createFontFromPrimitive(s,c,h))},F.prototype._getOrCreateFontPrimitive=function(t,e){if("string"==typeof t&&this._fontCollection.has(t))return this._fontCollection.get(t);var i,n=new D;switch(e.type){case"standard":var r=be._getMetrics(e.family,e.style);n._updated=!0,n.set("Type",R.get("Font")),n.set("Subtype",R.get("Type1")),n.set("BaseFont",new R(r._postScriptName)),e.family!==M.PdfFontFamily.symbol&&e.family!==M.PdfFontFamily.zapfDingbats&&n.set("Encoding",new R("WinAnsiEncoding")),i={dictionary:n,metrices:r};break;case"cjk":r=we._getMetrics(e.family,e.style);n._updated=!0,n.set("Type",R.get("Font")),n.set("Subtype",R.get("Type0")),n.set("BaseFont",new R(r._postScriptName)),n.set("Encoding",Ho(e.family)),n.set("DescendantFonts",Wo(e.family,e.style,r)),i={dictionary:n,metrices:r};break;case"ttf":r=new Qt(e.data);r._createInternals(),n=r._getInternals(),r._metrics._isUnicodeFont=!0,i={dictionary:n,metrices:r._metrics,fontInternal:r};break;default:throw new Error("Unsupported font type.")}return this._fontCollection.set(t,i),i},F.prototype._createFontFromPrimitive=function(t,e,i){var n,r=t.dictionary.get("Subtype").name,s=t.dictionary.get("BaseFont").name;switch(r){case"Type1":n=new E(Go(s),e,i,t);break;case"Type0":n=new pe(Ko(s),e,i,t);break;default:throw new Error("Unsupported font subtype: "+r)}return n.style=i,n._document=this,n},F.prototype._computeFontHash=function(t){return Jo((new l_).hash(t,0,t.length))},F.prototype.getPage=function(t){if(t<0||t>=this.pageCount)throw new Error("Invalid page index");var e,i=this._pages.get(t);return i||(i=this._catalog,e=(e=this._linearization)&&e.isValid&&e.pageFirst===t?this._getLinearizationPage(t):i._getPageDictionary(t),i=new br(this._crossReference,t,e.dictionary,e.reference),this._pages.set(t,i),i)},F.prototype.addPage=function(t,e){void 0!==e?(i=e,this._checkPageNumber(n=t)):void 0===t?(i=new Cp,n=this.pageCount):t instanceof Cp?(i=t,n=this.pageCount):(i=new Cp,this._checkPageNumber(n=t));var i,n,r,s,a,o,e=new D(this._crossReference),h=(e.update("Type",R.get("Pages")),e.update("Count",1),yo(e,i),this._crossReference._getNextReference()),t=(this._crossReference._cacheMap.set(h,e),e.objId=h.toString(),new D(this._crossReference)),c=(t.update("Type",R.get("Page")),this._crossReference._getNextReference()),_=(this._crossReference._cacheMap.set(c,t),t.objId=c.toString(),t.update("Parent",h),e.update("Kids",[c]),0===this.pageCount?((s=this._catalog._catalogDictionary._get("Pages"))&&this._catalog._topPagesDictionary?(a=!1,this._catalog._topPagesDictionary.has("Kids")&&(_=this._catalog._topPagesDictionary.get("Kids"))&&(_.push(h),this._catalog._topPagesDictionary.update("Kids",_),a=!0),a||this._catalog._topPagesDictionary.update("Kids",[h]),this._catalog._topPagesDictionary.update("Count",1),e.update("Parent",s)):this._catalog._catalogDictionary.update("Pages",h),this._pages=new Map,this._pageCount=1):(r=this.getPage(n===this.pageCount?n-1:n))&&r._pageDictionary&&(s=r._pageDictionary._get("Parent"),a=this._crossReference._fetch(s))&&a.has("Kids")&&(_=a.get("Kids"))&&(n===this.pageCount?_.push(h):(o=[],_.forEach(function(t){t===r._ref&&o.push(h),o.push(t)}),_=o,this._updatePageCache(n)),a.update("Kids",_),e.update("Parent",s),go(a,1),this._pageCount=this.pageCount+1),new br(this._crossReference,n,t,c));return _._pageSettings=i,_._isNew=!0,this._pages.set(n,_),_},F.prototype.addSection=function(t){var e;return this._isLoaded||(t=t||new Cp,e=new Hd(this,t),this._sections.push(e)),e},F.prototype.removePage=function(t){t=t instanceof br?t:this.getPage(t);this._removePage(t)},F.prototype.getDocumentInformation=function(t){void 0===t&&(t=!0);var e=this._getInfoDictionary(!1),i=this._catalog._catalogDictionary,n={};if(e){n.title=this._readInfoString(e,"Title"),n.author=this._readInfoString(e,"Author"),n.subject=this._readInfoString(e,"Subject"),n.keywords=this._readInfoString(e,"Keywords"),n.creator=this._readInfoString(e,"Creator"),n.producer=this._readInfoString(e,"Producer"),n.language=this._readInfoString(i,"Lang");for(var i=this._readInfoString(e,"CreationDate"),i=("string"==typeof i&&(n.creationDate=Uo(i)),this._readInfoString(e,"ModDate")),r=("string"==typeof i&&(n.modificationDate=Uo(i)),t||(n.xmpMetadata=this._getMetadataValue()),new Set(["Title","Author","Subject","Keywords","Creator","Producer","CreationDate","ModDate","Trapped"])),s=new yp,a=0,o=Object.keys(e._map);a<o.length;a++){var h,c=o[a];r.has(c)||"string"==typeof(h=e.get(c))&&s.set(c,h)}n.customMetadata=s}else t||(n.xmpMetadata=this._getMetadataValue()),n.customMetadata=new yp;return n},F.prototype._readInfoString=function(t,e){return(!t||t.has(e))&&"string"==typeof(t=t.get(e))?t:void 0},F.prototype.setDocumentInformation=function(t){var i,n=this,r=this._getInfoDictionary(!0),e=this._catalog._catalogDictionary;this._writeInfoString(r,"Title",t.title),this._writeInfoString(r,"Author",t.author),this._writeInfoString(r,"Subject",t.subject),this._writeInfoString(r,"Keywords",t.keywords),this._writeInfoString(r,"Creator",t.creator),this._writeInfoString(r,"Producer",t.producer),this._writeInfoString(e,"Lang",t.language),this._writeInfoDate(r,"CreationDate",t.creationDate),this._writeInfoDate(r,"ModDate",t.modificationDate),t.customMetadata&&(e=t.customMetadata._customData,this._xmpMetadata&&(i=this._xmpMetadata.customSchema.customData),e.forEach(function(t,e){"string"==typeof e&&"string"==typeof t&&n._writeInfoString(r,e,t),n._xmpMetadata&&!i.has(e)&&i.set(e,t)}),this._xmpMetadata)&&(this._xmpMetadata.customSchema.customData=i),r._updated=!0},F.prototype._writeInfoString=function(t,e,i){null!==i&&"string"==typeof i&&t.update(e,i)},F.prototype._writeInfoDate=function(t,e,i){i&&i instanceof Date&&t.update(e,zo(i))},F.prototype._getInfoDictionary=function(t){var e;if(e=this._crossReference&&this._crossReference._trailer?this._crossReference._trailer:e){if(e.has("Info")){var i=e.get("Info");if(i instanceof m)return this._crossReference._fetch(i);if(i instanceof D)return i}if(t)return i=new D(this._crossReference),t=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(t,i),i.objId=t.toString(),e.update("Info",t),i}},F.prototype._checkPageNumber=function(t){if(t<0||t>this.pageCount)throw new Error("Index out of range")},F.prototype._updatePageCache=function(t,e){void 0===e&&(e=!0);for(var i=new Map,n=this.pageCount-1;0<=n;n--){var r=this.getPage(n);e?t<=n?(i.set(n+1,r),r._pageIndex=n+1):i.set(n,r):t<n?(i.set(n-1,r),r._pageIndex=n-1):n!==t&&i.set(n,r)}this._pages=i,e||(this._pageCount=this._pages.size)},F.prototype._removePage=function(t){var e=this._parseBookmarkDestination();e&&e.has(t)&&(e=e.get(t))&&e.forEach(function(t){t&&t._dictionary&&t._dictionary&&(t._dictionary.has("A")&&t._dictionary.update("A",null),t._dictionary.update("Dest",null))}),this._removePageTemplates(t);for(var i=this.form.count-1;0<=i;--i){var n=this.form.fieldAt(i);n&&n.page===t&&this.form.removeFieldAt(i)}this._updatePageCache(t._pageIndex,!1),this._removeParent(t._ref,t._pageDictionary),this._crossReference._cacheMap.has(t._ref)&&(t._pageDictionary._updated=!1),0===this.pageCount&&this._catalog._topPagesDictionary.update("Kids",[])},F.prototype._removeParent=function(e,t){var i,n;t.has("Parent")&&(t=t._get("Parent"),i=this._crossReference._fetch(t))&&i.has("Kids")&&(k(n=i.get("Kids"))&&1===n.length&&i&&"Pages"===i.get("Type").name?this._removeParent(t,i):(n=n.filter(function(t){return t!==e}),i.update("Kids",n),go(i,-1)))},F.prototype._parseBookmarkDestination=function(){var t=this.bookmarks;if(void 0===this._bookmarkHashTable&&t){this._bookmarkHashTable=new Map;var e=[],i={index:0,kids:t._bookMarkList};do{for(;i.index<i.kids.length;){var n,r,s=(t=i.kids[i.index]).namedDestination;s?s.destination&&(n=s.destination.page,(r=(r=this._bookmarkHashTable.get(n))||[]).push(t),this._bookmarkHashTable.set(n,r)):(s=t.destination)&&(n=s.page,(r=(r=this._bookmarkHashTable.get(n))||[]).push(t),this._bookmarkHashTable.set(n,r)),i.index+=1,0<t.count&&(e.push(i),i={index:0,kids:t._bookMarkList})}if(0<e.length)for(i=e.pop();i.index===i.kids.length&&0<e.length;)i=e.pop()}while(i.index<i.kids.length)}return this._bookmarkHashTable},F.prototype._removePageTemplates=function(t){var e;this._catalog._catalogDictionary.has("Names")&&(e=this._catalog._catalogDictionary.get("Names"))&&(this._removeInternalTemplates(e,"Pages",t),this._removeInternalTemplates(e,"Templates",t))},F.prototype._removeInternalTemplates=function(t,e,i){var n;t.has(e)&&(n=t.get(e))&&n.has("Names")&&(n=n.getArray("Names"))&&0<n.length&&(n=this._getUpdatedPageTemplates(n,i),(i=new D(this._crossReference)).update("Names",n),n=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(n,i),i.objId=n.toString(),t.update(e,n))},F.prototype._getUpdatedPageTemplates=function(t,e){if(0<t.length)for(var i=1;i<=t.length;i+=2){var n=t[i];if(n&&e._pageDictionary===n)return t.pop(),t.pop(),t}return t},F.prototype.reorderPages=function(t){for(var r=this,e=(t.forEach(function(t){r._checkPageNumber(t)}),this._sortedArray(t)),s=t.slice().sort(function(t,e){return t-e}),i=Array.from({length:this.pageCount},function(t,e){return e}).filter(function(t){return-1===e.indexOf(t)}),n=i.length-1;0<=n;n--)this.removePage(i[n]);var a=[],o=new Map,h=this._catalog._catalogDictionary._get("Pages");e.forEach(function(t,e){for(var t=r.getPage(s.indexOf(t)),i=(t._pageIndex=e,o.set(e,t),new D(r._crossReference)),e=(i.update("Type",R.get("Pages")),i.update("Count",1),i.update("Parent",h),r._crossReference._getNextReference()),n=(i.objId=e.toString(),i.update("Kids",[t._ref]),a.push(e),t._pageDictionary.get("Parent"));n&&"Pages"===n.get("Type").name&&(n.forEach(function(t,e){switch(t){case"Parent":case"Kids":case"Type":case"Count":break;case"Resources":r._cloneResources(n.get("Resources"),i);break;default:i.has(t)||i.update(t,e)}}),n.has("Parent"));)n=n.get("Parent");r._crossReference._cacheMap.set(e,i),r._crossReference._fetch(t._ref).update("Parent",e)}),this._pages=o,this._catalog&&(t=this._catalog._topPagesDictionary)&&t.has("Kids")&&(t.get("Kids"),t.update("Kids",a))},F.prototype._sortedArray=function(t){var e=[];return t.forEach(function(t){-1===e.indexOf(t)&&e.push(t)}),e},F.prototype._cloneResources=function(t,e){var i,n=this;e.has("Resources")?(i=e.get("Resources"),t.forEach(function(t,e){i.has(t)?n._cloneInnerResources(t,e,i):i.update(t,e)})):e.update("Resources",t)},F.prototype._cloneInnerResources=function(t,e,i){var n,r,s,a;e instanceof D?(n=i.get(t))?(r=!1,n.forEach(function(t,e){n.has(t)||(n.update(t,e),r=!0)}),r&&(i._updated=!0)):i.update(t,e):Array.isArray(e)&&((s=i.get(t))?(a=!1,e.forEach(function(t){-1===s.indexOf(t)&&(s.push(t),a=!0)}),a&&(i._updated=!0)):i.update(t,e))},F.prototype.save=function(t){if(this._isLoaded||0!==this.pageCount||this.addSection().addPage(),this._doPostProcess(this._flatten),L.validateLicense("pdf")||this._addWatermarkText(),"string"!=typeof t)return this._crossReference._save();N.Save.save(t,new Blob([this._crossReference._save()],{type:"application/pdf"}))},F.prototype.saveAsync=function(i){return wp(this,void 0,void 0,function(){var e;return vp(this,function(t){switch(t.label){case 0:return this._isLoaded||0!==this.pageCount||this.addSection().addPage(),[4,Promise.resolve(this._doPostProcess(this._flatten))];case 1:return t.sent(),"string"!=typeof i?[3,4]:[4,this._crossReference._saveAsync()];case 2:return e=t.sent(),[4,Promise.resolve(N.Save.save(i,new Blob([e],{type:"application/pdf"})))];case 3:return t.sent(),[3,6];case 4:return[4,this._crossReference._saveAsync()];case 5:return[2,t.sent()];case 6:return[2]}})})},F.prototype.saveAsBlob=function(){var e=this;return new Promise(function(t){t({blobData:new Blob([e._crossReference._save()],{type:"application/pdf"})})})},F.prototype.exportAnnotations=function(t,e){var i,n;if(L.initializeTelemetryFeature("Annotation","PDFLibrary"),this._isExport=!0,this._doPostProcessOnAnnotations(),t&&t instanceof Pp?n=t:e&&e instanceof Pp&&(n=e),n){if(n.dataFormat===M.DataFormat.xfdf)i=new Q;else if(n.dataFormat===M.DataFormat.json)i=new it;else{if(n.dataFormat!==M.DataFormat.fdf)return;i=new pd}i.exportAppearance=n.exportAppearance}else i=new Q;e=i._exportAnnotations(this);if(!t||"string"!=typeof t)return e;N.Save.save(t,new Blob([e],{type:"text/plain"}))},F.prototype.exportFormData=function(t,e){var i,n;if(L.initializeTelemetryFeature("AcroForm","PDFLibrary"),this._doPostProcessOnFormFields(),t&&t instanceof Ap?n=t:e&&e instanceof Ap&&(n=e),n){if(n.dataFormat===M.DataFormat.xfdf)i=new Q(n.exportName);else if(n.dataFormat===M.DataFormat.json)i=new it(n.exportName);else if(n.dataFormat===M.DataFormat.fdf)i=new pd(n.exportName);else{if(n.dataFormat!==M.DataFormat.xml)return;i=new Rd(n.exportName)}i._asPerSpecification=n.asPerSpecification}else(i=new Q)._asPerSpecification=!1;if(!t||"string"!=typeof t)return i._exportFormFields(this);N.Save.save(t,new Blob([i._exportFormFields(this)],{type:"text/plain"}))},F.prototype.importAnnotations=function(t,e){L.initializeTelemetryFeature("Annotation","PDFLibrary"),e===M.DataFormat.xfdf?(new Q)._importAnnotations(this,"string"==typeof t?Rs(t):t):e===M.DataFormat.json?(new it)._importAnnotations(this,"string"==typeof t?Rs(t):t):e===M.DataFormat.fdf&&(new pd)._importAnnotations(this,"string"==typeof t?Rs(t):t)},F.prototype.importFormData=function(t,e){L.initializeTelemetryFeature("AcroForm","PDFLibrary"),this._form&&this._form._requiresPostProcessing&&this._doPostProcessOnFormFields(),this._isFormImport=!0,0<this.form.count&&(e===M.DataFormat.xfdf?(new Q)._importFormData(this,"string"==typeof t?Rs(t):t):e===M.DataFormat.json?(new it)._importFormData(this,"string"==typeof t?Rs(t):t):e===M.DataFormat.fdf?(new pd)._importFormData(this,"string"==typeof t?Rs(t):t):e===M.DataFormat.xml&&(new Rd)._importFormData(this,"string"==typeof t?Rs(t):t))},F.prototype.destroy=function(){this._crossReference&&(this._crossReference._destroy(),this._crossReference=void 0),this._xmpMetadata&&this._xmpMetadata._destroy(),this._catalog&&(this._catalog._destroy(),this._catalog=void 0),this._endObjSignature=void 0,this._headerSignature=void 0,this._pages&&0<this._pages.size&&this._pages.forEach(function(t){t._destroy()}),this._pages&&(this._pages.clear(),this._pages=void 0),this._startXrefSignature=void 0,this._stream=void 0,this._form&&(this._form._fontCache=void 0,this._form=void 0),this._fontCollection.clear(),ph(),this._mergeHelperCache&&(0<this._mergeHelperCache.size&&this._mergeHelperCache.forEach(function(t){t&&t._objectDispose()}),this._mergeHelperCache.clear(),this._mergeHelperCache=void 0)},Object.defineProperty(F.prototype,"_destinationCollection",{get:function(){var t;return null!==this._namedDestinationCollection&&void 0!==this._namedDestinationCollection||(this._catalog._catalogDictionary.has("Names")?(t=this._catalog._catalogDictionary.get("Names"),this._namedDestinationCollection=new Ad(t,this._crossReference)):this._namedDestinationCollection=new Ad),this._namedDestinationCollection},enumerable:!0,configurable:!0}),F.prototype._getLinearizationPage=function(e){var i=this._catalog,t=this._linearization,n=this._crossReference,t=m.get(t.objectNumberFirst,0);try{var r=n._fetch(t);if(r instanceof D)if(fh(r.get("Type"),"Page")||!r.has("Type")&&!r.has("Kids"))return i.pageKidsCountCache.has(t)||i.pageKidsCountCache.put(t,1),i.pageIndexCache.has(t)||i.pageIndexCache.put(t,0),{dictionary:r,reference:t};throw new S("The Linearization dictionary does not point to a valid Page dictionary.")}catch(t){return i._getPageDictionary(e)}},F.prototype._checkHeader=function(){var t=this._stream;if(t.reset(),this._find(t,this._headerSignature)){t.moveStart();for(var e="",i=t.getByte();32<i&&!(12<=e.length);)e+=String.fromCharCode(i),i=t.getByte();this._version||(this._version=e.substring(5))}},F.prototype._parse=function(t){this._crossReference._parse(t),this._catalog=new Wh(this._crossReference),this._catalog.version&&(this._version=this._catalog.version)},F.prototype._find=function(t,e,i,n){void 0===n&&(n=!1);var r=e.length,s=t.peekBytes(i=void 0===i?1024:i),a=s.length-r;if(!(a<=0))if(n)for(var o=r-1,h=s.length-1;o<=h;){for(var c=0;c<r&&s[h-c]===e[o-c];)c++;if(r<=c)return t.position+=h-o,!0;h--}else for(h=0;h<=a;){for(c=0;c<r&&s[h+c]===e[c];)c++;if(r<=c)return t.position+=h,!0;h++}return!1},F.prototype._doPostProcess=function(t){void 0===t&&(t=!1),this._renderDocumentTemplates(M.PdfTemplateLayerMode.background),this._renderDocumentTemplates(void 0),this._doPostProcessOnFormFields(t),this._doPostProcessOnAnnotations(t),this._addXmpMetadata(),this._renderDocumentTemplates(M.PdfTemplateLayerMode.foreground)},F.prototype._addXmpMetadata=function(){var t,e;this._xmpMetadata&&!this._xmpMetadata._isUpdated&&(this._xmpMetadata._serializeToStream(),t=this._xmpMetadata._xmpStream)&&(t.dictionary||((e=new D(this._crossReference))._updated=!0,t.dictionary=e),t.dictionary.update("Type",R.get("Metadata")),t.dictionary.update("Subtype",R.get("XML")),t._isCompress=!1,e=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(e,t),this._catalog._catalogDictionary.update("Metadata",e),this._crossReference._allowCatalog=!0,this._xmpMetadata._isUpdated=!0)},F.prototype._renderDocumentTemplates=function(t){var e=void 0!==this._template&&null!==this._template;if(!e&&this._sections)for(var i=0,n=this._sections;i<n.length;i++)if(n[i].template){e=!0;break}if(e)for(var r=0;r<this.pageCount;r++){var s=this.getPage(r);this._renderPageTemplates(s,(r+1)%2==1,t)}},F.prototype._renderPageTemplates=function(t,e,i){this._templateRenderingStarted=!0;for(var n,r=t._getSectionIndex(),s=0,a=[M._TemplateSide.top,M._TemplateSide.bottom,M._TemplateSide.left,M._TemplateSide.right];s<a.length;s++){var o=a[s],h=!1,c=void 0!==t._g&&null!==t._g&&!t._needInitializeGraphics,_=0<=r&&r<this._sections.length?this._getSectionTemplateForSide(this._sections[r],o,e):null,d=this._getTemplateForSide(o,e),l=[];d&&d.template&&l.push(d),_&&_.template&&l.push(_);for(var u=0,p=l;u<p.length;u++){var f,g,y,m,b,w,v=p[u];v&&v.template&&(void 0!==(b=v.templateLayerMode)&&b===i||void 0===b&&void 0===i)&&(f=this._getTemplateAlignmentPosition(t,v.documentTemplate,v.alignment,o,e),(g=void 0)===v.alignment&&(g=this._templateSideToString(o)),w=c&&t._accessedBeforeTemplate&&!t._templatesRendered,b===M.PdfTemplateLayerMode.background?((y=this._backgroundLayers.get(t))||(y=this.layers.add("_background"),this.layers.move(0,y),this._backgroundLayers.set(t,y)),m=(y=y.createGraphics(t)).save(),y.setTransparency(.5),v.template._draw(y,f.x,f.y,f.width,f.height,g),y.restore(m)):b===M.PdfTemplateLayerMode.foreground?(t._contents&&0!==t._contents.length||(t.graphics.save(),t.graphics.restore()),this._drawForegroundTemplate(t,v.template._template,f)):w&&!h?(h=t._templatesRendered=!0,t._loadContents(),t._contents&&0<t._contents.length&&(y=new Sh([]),(m=new kr(t.size,y,this._crossReference,t))._initializeCoordinates(),w=[(b=t._pageSettings.margins).left,b.top,t.size.width-b.left-b.right,t.size.height-b.top-b.bottom],m._clipTranslateMargins(w),m.translateTransform({x:f.x,y:0}),v.template._draw(m,0,0,f.width,f.height,g),y._bytes=[32,113,32,10].concat(y._bytes,[32,81,32,10]),b=this._crossReference._getNextReference(),this._crossReference._cacheMap.set(b,y),w=t._contents.length-1,t._contents.splice(w,0,b),t._pageDictionary.set("Contents",t._contents),t._pageDictionary._updated=!0)):(n=n||t.graphics,v.template._draw(n,f.x,f.y,f.width,f.height,g)))}}},F.prototype._getSectionIndexByPage=function(t){if(this._sections&&0!==this._sections.length)for(var e=0;e<this._sections.length;e++){var i=this._sections[e];if(i&&i._reference===t)return e}return-1},F.prototype._drawForegroundTemplate=function(t,e,i){var n=new Sh([]),r=new Ar(n),s=(r._write("q"),new Rr),i=(s._translate(i.x,-(i.y+i.height)),s._scale(i.width/e._size.width,i.height/e._size.height),r._modifyCtm(s),t._pageDictionary.get("Resources")),s=(i||(i=new D(this._crossReference),t._pageDictionary.set("Resources",i)),n.dictionary.update("Resources",i),i.get("XObject")),i=(s||(s=new D(this._crossReference),i.set("XObject",s)),e._key||(e._key=ia()),R.get(e._key)),a=this._crossReference._getNextReference(),e=(this._crossReference._cacheMap.set(a,e._content),s.set(i.name,a),r._executeObject(i),r._write("Q"),t._loadContents(),this._crossReference._getNextReference());this._crossReference._cacheMap.set(e,n),t._contents.push(e)},F.prototype._getTemplateForSide=function(t,e,i){void 0===i&&(i=-1);var n=new Map([[M._TemplateSide.top,{odd:M._PdfDocumentTemplateKey.oddTop,even:M._PdfDocumentTemplateKey.evenTop,base:M._PdfDocumentTemplateKey.top}],[M._TemplateSide.bottom,{odd:M._PdfDocumentTemplateKey.oddBottom,even:M._PdfDocumentTemplateKey.evenBottom,base:M._PdfDocumentTemplateKey.bottom}],[M._TemplateSide.left,{odd:M._PdfDocumentTemplateKey.oddLeft,even:M._PdfDocumentTemplateKey.evenLeft,base:M._PdfDocumentTemplateKey.left}],[M._TemplateSide.right,{odd:M._PdfDocumentTemplateKey.oddRight,even:M._PdfDocumentTemplateKey.evenRight,base:M._PdfDocumentTemplateKey.right}]]).get(t);if(!n)return null;if(0<=i&&i<this._sections.length){i=this._sections[i],i=this._getSectionTemplateForSide(i,t,e);if(i)return i}t=e?n.odd:n.even,i=this._getTemplateByKey(t);return i&&i.template?{template:i.template,templateLayerMode:i.templateLayerMode,alignment:i.alignment,documentTemplate:this._template}:(e=this._getTemplateByKey(n.base))&&e.template?{template:e.template,templateLayerMode:e.templateLayerMode,alignment:e.alignment,documentTemplate:this._template}:null},F.prototype._getTemplateByKey=function(t){if(this._template)switch(t){case M._PdfDocumentTemplateKey.top:return this._template.top;case M._PdfDocumentTemplateKey.bottom:return this._template.bottom;case M._PdfDocumentTemplateKey.left:return this._template.left;case M._PdfDocumentTemplateKey.right:return this._template.right;case M._PdfDocumentTemplateKey.evenTop:return this._template.evenTop;case M._PdfDocumentTemplateKey.evenBottom:return this._template.evenBottom;case M._PdfDocumentTemplateKey.evenLeft:return this._template.evenLeft;case M._PdfDocumentTemplateKey.evenRight:return this._template.evenRight;case M._PdfDocumentTemplateKey.oddTop:return this._template.oddTop;case M._PdfDocumentTemplateKey.oddBottom:return this._template.oddBottom;case M._PdfDocumentTemplateKey.oddLeft:return this._template.oddLeft;case M._PdfDocumentTemplateKey.oddRight:return this._template.oddRight;default:return}},F.prototype._getSectionTemplateForSide=function(t,e,i){var n,r,s,a=t.template,e=new Map([[M._TemplateSide.top,"top"],[M._TemplateSide.bottom,"bottom"],[M._TemplateSide.left,"left"],[M._TemplateSide.right,"right"]]).get(e);return e&&(n="odd"+(r=e.charAt(0).toUpperCase()+e.slice(1)),r="even"+r,s=void 0,i&&a[n]?s=a[n]:!i&&a[r]&&(s=a[r]),s=!s&&a[e]?a[e]:s)&&s.template?{template:s.template,alignment:s.alignment,templateLayerMode:s.templateLayerMode,documentTemplate:t.template}:null},F.prototype._getTemplateAlignmentPosition=function(t,e,i,n,r){var s=this._templateSideToString(n),a=s.charAt(0).toUpperCase()+s.slice(1),o="odd"+a,a="even"+a,o=r&&e[o]?e[o]:!r&&e[a]?e[a]:e[s];return o?(r=o.template,void 0!==i&&i!==M.PdfTemplateVerticalAlignment.none&&i!==M.PdfTemplateHorizontalAlignment.none?this._getAlignmentBounds(n,r,t,i):(a=this._templateSideToString(n),this._getTemplateDockBounds(t,r,a))):{x:0,y:0,width:0,height:0}},F.prototype._getAlignmentBounds=function(t,e,i,n){n=this._mapTemplateAlignmentStyle(t,n);return this._getTemplateAlignmentBounds(e,i,n,t)},F.prototype._templateSideToString=function(t){switch(t){case M._TemplateSide.top:return"top";case M._TemplateSide.bottom:return"bottom";case M._TemplateSide.left:return"left";case M._TemplateSide.right:return"right";default:return"top"}},F.prototype._normalizeTemplateSide=function(t){if(t===M._TemplateSide.top||t===M._TemplateSide.bottom||t===M._TemplateSide.left||t===M._TemplateSide.right)return t;switch(t){case M._PdfDocumentTemplateKey.top:case M._PdfDocumentTemplateKey.evenTop:case M._PdfDocumentTemplateKey.oddTop:return M._TemplateSide.top;case M._PdfDocumentTemplateKey.bottom:case M._PdfDocumentTemplateKey.evenBottom:case M._PdfDocumentTemplateKey.oddBottom:return M._TemplateSide.bottom;case M._PdfDocumentTemplateKey.left:case M._PdfDocumentTemplateKey.evenLeft:case M._PdfDocumentTemplateKey.oddLeft:return M._TemplateSide.left;case M._PdfDocumentTemplateKey.right:case M._PdfDocumentTemplateKey.evenRight:case M._PdfDocumentTemplateKey.oddRight:default:return M._TemplateSide.right}},F.prototype._mapTemplateAlignmentStyle=function(t,e){t=this._normalizeTemplateSide(t);if(void 0===e||e===M.PdfTemplateHorizontalAlignment.none||e===M.PdfTemplateVerticalAlignment.none)switch(t){case M._TemplateSide.top:case M._TemplateSide.left:return M._PdfAlignmentStyle.topLeft;case M._TemplateSide.bottom:return M._PdfAlignmentStyle.bottomLeft;case M._TemplateSide.right:return M._PdfAlignmentStyle.topRight}if(t===M._TemplateSide.top||t===M._TemplateSide.bottom){var i=t===M._TemplateSide.top;switch(e){case M.PdfTemplateHorizontalAlignment.center:return i?M._PdfAlignmentStyle.topCenter:M._PdfAlignmentStyle.bottomCenter;case M.PdfTemplateHorizontalAlignment.right:return i?M._PdfAlignmentStyle.topRight:M._PdfAlignmentStyle.bottomRight;default:M.PdfTemplateHorizontalAlignment.left;return i?M._PdfAlignmentStyle.topLeft:M._PdfAlignmentStyle.bottomLeft}}if(t===M._TemplateSide.left||t===M._TemplateSide.right){var n=t===M._TemplateSide.left;switch(e){case M.PdfTemplateVerticalAlignment.middle:return n?M._PdfAlignmentStyle.middleLeft:M._PdfAlignmentStyle.middleRight;case M.PdfTemplateVerticalAlignment.bottom:return n?M._PdfAlignmentStyle.bottomLeft:M._PdfAlignmentStyle.bottomRight;default:M.PdfTemplateVerticalAlignment.top;return n?M._PdfAlignmentStyle.topLeft:M._PdfAlignmentStyle.topRight}}return M._PdfAlignmentStyle.topLeft},F.prototype._getTemplateAlignmentBounds=function(t,e,i,n){var r,s=t._bounds;if((r=e._isNew?e._getActualTemplateBounds(e._pageSettings):r)&&0<r.length){var a=t._bounds.x,o=t._bounds.y;switch(i){case M._PdfAlignmentStyle.topLeft:a=-r[0],o=n===M._TemplateSide.top?-r[1]:0;break;case M._PdfAlignmentStyle.topCenter:a=(r[2]-t._bounds.width)/2,o=-r[1];break;case M._PdfAlignmentStyle.topRight:a=r[2]+this._getRightIndentWidth(e,!1)-t._bounds.width,o=n===M._TemplateSide.top?-r[1]:0;break;case M._PdfAlignmentStyle.middleLeft:a=-r[0],o=(r[3]-t._bounds.height)/2;break;case M._PdfAlignmentStyle.middleCenter:a=(r[2]-t._bounds.width)/2,o=(r[3]-t._bounds.height)/2;break;case M._PdfAlignmentStyle.middleRight:a=r[2]+this._getRightIndentWidth(e,!1)-t._bounds.width,o=(r[3]-t._bounds.height)/2;break;case M._PdfAlignmentStyle.bottomLeft:a=-r[0],o=n===M._TemplateSide.bottom?r[3]+this._getBottomIndentHeight(e,!1)-t._bounds.height:r[3]-t._bounds.height;break;case M._PdfAlignmentStyle.bottomCenter:a=(r[2]-t._bounds.width)/2,o=r[3]+this._getBottomIndentHeight(e,!1)-t._bounds.height;break;case M._PdfAlignmentStyle.bottomRight:a=r[2]+this._getRightIndentWidth(e,!1)-t._bounds.width,o=n===M._TemplateSide.bottom?r[3]+this._getBottomIndentHeight(e,!1)-t._bounds.height:r[3]-t._bounds.height}s.x=a,s.y=o}return s},F.prototype._isNonReservingTemplate=function(t){return void 0!==t&&(t===M.PdfTemplateLayerMode.background||t===M.PdfTemplateLayerMode.foreground)},F.prototype._getLeftIndentWidth=function(t,e){var i,n=0,e=(e&&(n+=t._pageSettings.margins.left),t._crossReference._document.template);return e&&(t=((t._pageIndex||0)+1)%2==0,i=[],e.left&&!this._isNonReservingTemplate(e.left.templateLayerMode)&&i.push(e.left.template._bounds.width),t&&e.evenLeft&&!this._isNonReservingTemplate(e.evenLeft.templateLayerMode)&&i.push(e.evenLeft.template._bounds.width),t||!e.oddLeft||this._isNonReservingTemplate(e.oddLeft.templateLayerMode)||i.push(e.oddLeft.template._bounds.width),0<i.length)&&(n+=Math.max.apply(Math,i)),n},F.prototype._getTopIndentHeight=function(t,e){var i,n=0,e=(e&&(n+=t._pageSettings.margins.top),t._crossReference._document.template);return e&&(t=((t._pageIndex||0)+1)%2==0,i=[],e.top&&!this._isNonReservingTemplate(e.top.templateLayerMode)&&i.push(e.top.template._bounds.height),t&&e.evenTop&&!this._isNonReservingTemplate(e.evenTop.templateLayerMode)&&i.push(e.evenTop.template._bounds.height),t||!e.oddTop||this._isNonReservingTemplate(e.oddTop.templateLayerMode)||i.push(e.oddTop.template._bounds.height),0<i.length)&&(n+=Math.max.apply(Math,i)),n},F.prototype._getRightIndentWidth=function(t,e){var i,n=0,e=(e&&(n+=t._pageSettings.margins.right),t._crossReference._document.template);return e&&(t=((t._pageIndex||0)+1)%2==0,i=[],e.right&&!this._isNonReservingTemplate(e.right.templateLayerMode)&&i.push(e.right.template._bounds.width),t&&e.evenRight&&!this._isNonReservingTemplate(e.evenRight.templateLayerMode)&&i.push(e.evenRight.template._bounds.width),t||!e.oddRight||this._isNonReservingTemplate(e.oddRight.templateLayerMode)||i.push(e.oddRight.template._bounds.width),0<i.length)&&(n+=Math.max.apply(Math,i)),n},F.prototype._getBottomIndentHeight=function(t,e){var i,n=0,e=(e&&(n+=t._pageSettings.margins.bottom),t._crossReference._document.template);return e&&(t=((t._pageIndex||0)+1)%2==0,i=[],e.bottom&&!this._isNonReservingTemplate(e.bottom.templateLayerMode)&&i.push(e.bottom.template._bounds.height),t&&e.evenBottom&&!this._isNonReservingTemplate(e.evenBottom.templateLayerMode)&&i.push(e.evenBottom.template._bounds.height),t||!e.oddBottom||this._isNonReservingTemplate(e.oddBottom.templateLayerMode)||i.push(e.oddBottom.template._bounds.height),0<i.length)&&(n+=Math.max.apply(Math,i)),n},F.prototype._getTemplateDockBounds=function(t,e,i){var n,r,s=e._bounds;if(t._isNew&&(n=t._getActualTemplateBounds(t._pageSettings),r=t._pageSettings._getActualSize()),n&&0<n.length&&r&&0<r.length){var a=e._bounds.x,o=e._bounds.y,h=e._bounds.width,c=e._bounds.height,_=this._getTopIndentHeight(t,!1),d=this._getBottomIndentHeight(t,!1);switch(i){case"left":a=-n[0],o=0<_?_:0,h=e._bounds.width,c=n[3]-_-d;break;case"top":a=-n[0],o=-n[1],h=r[0],c=e._bounds.height,n[3]<0&&(o=-n[1]+r[1]);break;case"right":a=n[2]+this._getRightIndentWidth(t,!1)-e._bounds.width,o=0<_?_:0,h=e._bounds.width,c=n[3]-_-d;break;case"bottom":a=-n[0],o=n[3]+this._getBottomIndentHeight(t,!1)-e._bounds.height,h=r[0],c=e._bounds.height,n[3]<0&&(o-=r[1])}s={x:a,y:o,width:h,height:c}}return s},F.prototype._doPostProcessOnFormFields=function(t){var e;void 0===t&&(t=!1),this._catalog._catalogDictionary.has("AcroForm")&&(this.form._doPostProcess(t),this.form._requiresPostProcessing=!1,t&&(t=this._catalog._catalogDictionary.getRaw("AcroForm"),(e=new D(this._crossReference))._updated=!0,t instanceof m?this._crossReference._cacheMap.set(t,e):(this.form._dictionary=e,this._crossReference._allowCatalog=!0),this.form._clear()),this.form._isDefaultAppearance?this.form._dictionary.update("NeedAppearances",this.form._isDefaultAppearance):!this.form._isDefaultAppearance&&this.form._dictionary.has("NeedAppearances")&&this.form._isNeedAppearances?this.form._dictionary.update("NeedAppearances",!1):!this.form._isDefaultAppearance&&this.form._dictionary.has("NeedAppearances")&&this.form._dictionary.update("NeedAppearances",this.form.needAppearances))},F.prototype._doPostProcessOnAnnotations=function(t){void 0===t&&(t=!1);for(var e=0;e<this.pageCount;e++){var i=this.getPage(e);i.annotations._isExport=this._isExport,i.annotations._doPostProcess(t),t&&(i._pageDictionary.has("Annots")&&(delete i._pageDictionary._map.Annots,i._pageDictionary._updated=!0),i.annotations._clear())}},F.prototype._addWatermarkText=function(){for(var t=0;t<this.pageCount;t++)this._addLincenseWaterMark(this.getPage(t),0===t,t===this.pageCount-1)},F.prototype._addLincenseWaterMark=function(t,e,i){var n="Created with a trial version of Syncfusion PDF library.",r=new I(M.PdfTextAlignment.center,M.PdfVerticalAlignment.middle),s=14,a=t.graphics,o=a.clientSize,s=(t.size.width<400&&(s=.035*t.size.width),new E(M.PdfFontFamily.helvetica,s,M.PdfFontStyle.regular)),e=(e?this._drawWatermarkOnPage(t,s,a,!1):i&&this._drawWatermarkOnPage(t,s,a,!0),s.measureString(n,o.width)),i=o.width/2,h=o.height/2;if(a.save(),t._isNew||t.rotation!==M.PdfRotationAngle.angle90?a.translateTransform({x:i,y:h}):a.translateTransform({x:h,y:i}),a.setTransparency(.5),t._isNew)switch(t.rotation){case M.PdfRotationAngle.angle90:a.rotateTransform(-135);break;case M.PdfRotationAngle.angle180:a.rotateTransform(-225);break;case M.PdfRotationAngle.angle270:a.rotateTransform(-315);break;default:a.rotateTransform(-45)}else a.rotateTransform(-45);h=e.width/2,t=e.height/2,i-=h;a.drawString(n,s,{x:-h,y:-t/2,width:o.width-(i+i),height:e.height},new A({r:255,g:0,b:0}),r),a.restore(),a.restore()},F.prototype._drawWatermarkOnPage=function(e,t,i,n){function r(t){if(e._isNew){if(a===M.PdfRotationAngle.angle90)return{x:-(o.height-t.x),y:t.y,width:t.height-40,height:t.width};if(a===M.PdfRotationAngle.angle180)return{x:-(i.clientSize.width-t.x),y:-(o.height-t.y),width:t.width-40,height:t.height};if(a===M.PdfRotationAngle.angle270)return{x:t.x,y:-(o.width-t.y),width:t.height-40,height:t.width}}return t}var s="Created with a trial version of Syncfusion PDF library or registered the wrong key in your application. To obtain the valid key, Click",a=e.rotation,o=!e._isNew||a!==M.PdfRotationAngle.angle270&&a!==M.PdfRotationAngle.angle90?{width:i.clientSize.width-70,height:i.clientSize.height}:{width:i.clientSize.width,height:i.clientSize.height-70},h=(e._isNew||a!==M.PdfRotationAngle.angle270&&a!==M.PdfRotationAngle.angle90||(o={width:e.size.height-70,height:e.size.width}),new I),c=(h._wordWrap=M._PdfWordWrapType.word,new A({r:255,g:0,b:0})),_=new A({r:0,g:0,b:255}),d=t.measureString(s),l=t.measureString("here"),d=d.height,u=!e._isNew||a!==M.PdfRotationAngle.angle270&&a!==M.PdfRotationAngle.angle90?o.width:o.height,p=a===M.PdfRotationAngle.angle90&&e._isNew?-30:40,n=n?(!e._isNew||a!==M.PdfRotationAngle.angle270&&a!==M.PdfRotationAngle.angle90?o.height:o.width)-(e.orientation===M.PdfPageOrientation.landscape&&420===e.size.width||420===e.size.height?4*d:3*d)-10:10,d=(e._isNew&&e.rotation!==M.PdfRotationAngle.angle0&&(i.save(),a===M.PdfRotationAngle.angle90?i.rotateTransform(-90):a===M.PdfRotationAngle.angle180?i.rotateTransform(-180):a===M.PdfRotationAngle.angle270&&i.rotateTransform(-270)),r({x:p,y:n,width:o.width,height:o.height}));i.drawString(s,t,d,c,h);var f,c=(new vt)._layout(s,t,h,[d.width,d.height]),s=c._layoutLines,g=(p+=s[s.length-1]._width+5,2<=c._lineCount&&(n+=c._lineHeight*(c._lineCount-1)),p+l.width>u&&(p=40,n+=c._lineHeight),{x:p,y:n,width:l.width,height:l.height}),d=r(g);if(d.width+=70,i.drawString("here",t,d,_,h),d.width-=70,e._isNew)switch(a){case M.PdfRotationAngle.angle0:f=bp({},g);break;case M.PdfRotationAngle.angle90:f={x:g.y,y:o.height-g.x-g.width,width:g.height,height:g.width};break;case M.PdfRotationAngle.angle180:f={x:o.width-g.x+40,y:o.height-g.y-g.height,width:g.width,height:g.height};break;case M.PdfRotationAngle.angle270:f={x:o.width-g.y-g.height,y:g.x,width:g.height,height:g.width}}else switch(a){case M.PdfRotationAngle.angle0:f=bp({},g);break;case M.PdfRotationAngle.angle90:f={x:g.y,y:e.size.height-g.x-g.width,width:g.height,height:g.width};break;case M.PdfRotationAngle.angle180:f={x:e.size.width-g.x-g.width,y:e.size.height-g.y-g.height,width:g.width,height:g.height};break;case M.PdfRotationAngle.angle270:f={x:e.size.width-g.y-g.height,y:g.x,width:g.height,height:g.width}}s=new rn(f,"http://www.syncfusion.com");s.border.width=0,s.border.hRadius=0,s.border.vRadius=0,e.annotations.add(s),s._doPostProcess(),e.rotation!==M.PdfRotationAngle.angle0&&e._isNew?i.restore():i.save()},F.prototype.importPageRange=function(t,e,i,n){if(i<e||e>=t.pageCount)throw new Error("The start index is greater then the end index, which might indicate the error in the program.");this._importPages(t,e,i,n)},F.prototype._importPages=function(t,e,i,n){L.initializeTelemetryFeature("MergePDF","PDFLibrary");var r,s=0;if(void 0!==n&&"number"==typeof n.targetIndex){if(n.targetIndex>this.pageCount)throw new Error("The target index is out of range.");this._targetIndex=n.targetIndex}var a,o=new Map;if(!this._isDuplicatePage)for(var h=Math.max(0,e),c=Math.min(i,t.pageCount-1),_=h;_<=c;_++){var d=t.getPage(_);o.set(d._pageDictionary,null)}this._mergeHelperCache||(this._mergeHelperCache=new Map),t._uniqueID||(t._uniqueID=ia()),this._mergeHelperCache.has(t._uniqueID)?a=this._mergeHelperCache.get(t._uniqueID):(a=new Od(this._crossReference,this,t,o,n),this._mergeHelperCache.set(t._uniqueID,a));for(var l=!1,u=(t._catalog._catalogDictionary.has("OCProperties")&&(!this._isDuplicatePage||n&&!n.optimizeResources)&&(l=!0,h=t._catalog._catalogDictionary.get("OCProperties"),r=new D(this._crossReference),a._writeObject(t,r,h,h,"OCProperties",null,null),r._updated=!0),t.flatten),p=t._isSplitDocument,f=e;f<=i;f++){var g=t.getPage(f);t.form._doPostProcess(u,g),0<g.annotations.count&&(g.annotations._doPostProcess(u),u)&&(g._pageDictionary.has("Annots")&&(delete g._pageDictionary._map.Annots,g._pageDictionary._updated=!0),g.annotations._clear()),p?a._importPages(g,this._targetIndex,l,this._isDuplicatePage,n,p):a._importPages(g,this._targetIndex,l,this._isDuplicatePage,n),s++,"number"==typeof this._targetIndex&&++this._targetIndex}this._isDuplicatePage||a._fixDestinations(t),a._exportBookmarks(t,s),a._mergeFormFieldsWithDocument(),l&&(!this._isDuplicatePage||n&&!n.optimizeResources)&&a._importLayers(r,!0),a._objectDispose(),this._isDuplicatePage=!1},F.prototype.importPage=function(t,e,i){"number"==typeof t?(this._isDuplicatePage=!0,e instanceof Bd?this._importPages(this,t,t,e):this._importPages(this,t,t)):t instanceof br&&e instanceof F&&(t=t._pageIndex,this.importPageRange(e,t,t,i))},F.prototype.split=function(){this.splitByFixedNumber(1)},F.prototype.splitByFixedNumber=function(t){var e=this.pageCount;if(!(this.splitEvent&&t<=e&&0<t))throw new Error("Invalid split number. Split number should be greater than zero and less than or equal to page count.");for(var i=0,n=0;n<e;n+=t){var r=Math.min(n+t-1,e-1),r=this._importDocumentPages(n,r);this._invokeSplitEvent(i,r),i++}},F.prototype.splitByPageRanges=function(t){var i,n=this,r=this.pageCount;this.splitEvent&&(i=0,t.forEach(function(t){if(Array.isArray(t)&&t.length<2)throw new Error("Invalid page range. Start and end page indexes should be specified.");var e=t[0],t=t[1];if(e<0||t<0||r<=e||r<=t||t<e)throw new Error("Invalid page range: start ("+e+") and end ("+t+").");e=n._importDocumentPages(e,t);n._invokeSplitEvent(i,e),i++}))},F.prototype._importDocumentPages=function(t,e){this._isSplitDocument=!0;for(var i=new F,n=t;n<=e;n++){var r=this.getPage(n);i.importPage(r,this)}t=i.save();return i.destroy(),t},F.prototype._invokeSplitEvent=function(t,e){L.initializeTelemetryFeature("SplitPDF","PDFLibrary");t=new Ip(t,e);this.splitEvent(this,t)},F.prototype._getSignature=function(t,e){var i=new Ou;return i._initializeInternals(t,e),i},F.prototype._hasTemplateContent=function(){return!!this._template&&(null!==this._template.oddTop&&void 0!==this._template.oddTop||null!==this._template.evenTop&&void 0!==this._template.evenTop||null!==this._template.oddBottom&&void 0!==this._template.oddBottom||null!==this._template.evenBottom&&void 0!==this._template.evenBottom||null!==this._template.left&&void 0!==this._template.left||null!==this._template.oddLeft&&void 0!==this._template.oddLeft||null!==this._template.evenLeft&&void 0!==this._template.evenLeft||null!==this._template.right&&void 0!==this._template.right||null!==this._template.oddRight&&void 0!==this._template.oddRight||null!==this._template.evenRight&&void 0!==this._template.evenRight||null!==this._template.top&&void 0!==this._template.top||null!==this._template.bottom&&void 0!==this._template.bottom)},Object.defineProperty(F.prototype,"_hasTemplateContentValue",{get:function(){return this._hasTemplateContent()},enumerable:!0,configurable:!0}),F);function F(t,e){if(this._headerSignature=new Uint8Array([37,80,68,70,45]),this._startXrefSignature=new Uint8Array([115,116,97,114,116,120,114,101,102]),this._endObjSignature=new Uint8Array([101,110,100,111,98,106]),this._version="",this._permissions=M.PdfPermissionFlag.default,this._isEncrypted=!1,this._isUserPassword=!1,this._hasUserPasswordOnly=!1,this._encryptOnlyAttachment=!1,this._encryptMetaData=!1,this._isExport=!1,this._allowCustomData=!1,this._isDuplicatePage=!1,this._isSplitDocument=!1,this._optionalContentDictionaries=[],this._order=[],this._on=[],this._off=[],this._as=[],this._printLayer=[],this._isLoaded=!0,this._isFormImport=!1,this._sections=[],this._backgroundLayers=new Map,this._templateRenderingStarted=!1,L.initializeTelemetry("PDFLibrary"),this._fontCollection=new Map,t){this._stream=new g("string"==typeof t?Rs(t):t),this._fileStructure=new Id,this._crossReference=new nd(this,e),this._pages=new Map,this._checkHeader(),this._crossReference._setStartXRef(this._startXRef);try{this._parse(!1)}catch(t){if("XRefParseException"!==t.name)throw t;this._parse(!0)}this._crossReference._version=this._version}else{this._isLoaded=!1,this._stream=new g([]),this._version="1.4",this._fileStructure=new Id,this._fileStructure.isIncrementalUpdate=!1,this._crossReference=new nd(this),this._crossReference._version=this._version,this._crossReference._nextReferenceNumber=1;var t=new D(this._crossReference),e=(t.update("Type",R.get("Catalog")),this._crossReference._getNextReference()),i=(t.objId=e.objectNumber+" "+e.generationNumber,this._crossReference._cacheMap.set(e,t),new D),e=(i.update("Root",e),this._crossReference._trailer=i,this._crossReference._root=t,new D(this._crossReference)),i=(e.update("Type",R.get("Pages")),e.update("Kids",[]),e.update("Count",0),this._crossReference._getNextReference());this._crossReference._cacheMap.set(i,e),t.update("Pages",i),this._catalog=new Wh(this._crossReference),this._pages=new Map}}Object.defineProperty(xp.prototype,"dataFormat",{get:function(){return this._format},set:function(t){this._format=t},enumerable:!0,configurable:!0}),Object.defineProperty(xp.prototype,"exportAppearance",{get:function(){return this._exportAppearance},set:function(t){this._exportAppearance=t},enumerable:!0,configurable:!0});var Pp=xp;function xp(){this._format=M.DataFormat.xfdf,this._exportAppearance=!1}Object.defineProperty(Tp.prototype,"dataFormat",{get:function(){return this._format},set:function(t){this._format=t},enumerable:!0,configurable:!0}),Object.defineProperty(Tp.prototype,"exportName",{get:function(){return this._exportName},set:function(t){this._exportName=t},enumerable:!0,configurable:!0}),Object.defineProperty(Tp.prototype,"asPerSpecification",{get:function(){return this._asPerSpecification},set:function(t){this._asPerSpecification=t},enumerable:!0,configurable:!0});var Ap=Tp;function Tp(){this._format=M.DataFormat.xfdf,this._exportName="",this._asPerSpecification=!0}Object.defineProperty(kp.prototype,"orientation",{get:function(){return this._orientation},set:function(t){this._isOrientation=!0,this._orientation!==t&&(this._orientation=t,this._updateSize(t))},enumerable:!0,configurable:!0}),Object.defineProperty(kp.prototype,"size",{get:function(){return this._size},set:function(t){this._isOrientation?this._updateSize(t):(this._size=t,this._updateOrientation())},enumerable:!0,configurable:!0}),Object.defineProperty(kp.prototype,"margins",{get:function(){return this._margins},set:function(t){this._margins=t},enumerable:!0,configurable:!0}),Object.defineProperty(kp.prototype,"rotation",{get:function(){return this._rotation},set:function(t){4<=(this._rotation=t)&&(this._rotation=t%4)},enumerable:!0,configurable:!0}),kp.prototype._updateSize=function(t){var e,t="number"!=typeof t&&"width"in t&&"height"in t&&void 0!==t.width&&void 0!==t.height?(e=this.orientation,t):(e=t,this._size);e===M.PdfPageOrientation.portrait?this._size={width:Math.min(t.width,t.height),height:Math.max(t.width,t.height)}:this._size={width:Math.max(t.width,t.height),height:Math.min(t.width,t.height)}},kp.prototype._updateOrientation=function(){this._orientation=this._size.height>=this._size.width?M.PdfPageOrientation.portrait:M.PdfPageOrientation.landscape},kp.prototype._getActualSize=function(){return[this._size.width-(this._margins._left+this._margins._right),this._size.height-(this._margins._top+this._margins._bottom)]};var Cp=kp;function kp(t){this._size={width:595,height:842},this._isOrientation=!1,t&&"orientation"in t&&null!==t.orientation&&void 0!==t.orientation?this.orientation=t.orientation:this._orientation=M.PdfPageOrientation.portrait,t&&"size"in t&&null!==t.size&&void 0!==t.size?this.size=t.size:this._size={width:595,height:842},t&&"margins"in t&&null!==t.margins&&void 0!==t.margins?this.margins=t.margins:this._margins=new Rp,t&&"rotation"in t&&null!==t.rotation&&void 0!==t.rotation?this.rotation=t.rotation:this._rotation=M.PdfRotationAngle.angle0}Object.defineProperty(Fp.prototype,"left",{get:function(){return this._left},set:function(t){this._left=t},enumerable:!0,configurable:!0}),Object.defineProperty(Fp.prototype,"right",{get:function(){return this._right},set:function(t){this._right=t},enumerable:!0,configurable:!0}),Object.defineProperty(Fp.prototype,"top",{get:function(){return this._top},set:function(t){this._top=t},enumerable:!0,configurable:!0}),Object.defineProperty(Fp.prototype,"bottom",{get:function(){return this._bottom},set:function(t){this._bottom=t},enumerable:!0,configurable:!0});var Rp=Fp;function Fp(t){this._left=this._right=this._top=this._bottom=void 0===t?40:t}Object.defineProperty(Dp.prototype,"pdfData",{get:function(){return this._pdfData},enumerable:!0,configurable:!0}),Object.defineProperty(Dp.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0});var Ip=Dp;function Dp(t,e){this._index=t,this._pdfData=e}function Bp(t,e,i,n){this._left=0,this._right=0,this._top=0,void(this._bottom=0)===t?(this._left=.5,this._right=.5,this._top=.5,this._bottom=.5):(this._left=t,this._right=i,this._top=e,this._bottom=n)}Lp=function(t,e){return(Lp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Lp(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Ep,Op=Tr),Ep.prototype._initializeAsync=function(t){var e=new Uint8Array(t.length);null!=t&&"string"==typeof t?e=Rs(t,!1):t instanceof Uint8Array&&(e=t),this._decoder=_s(e),this.height=this._decoder._height,this.width=this._decoder._width,this._bitsPerComponent=this._decoder._bitsPerComponent},Ep.prototype._save=function(){var t;this._imageStatus=!0,this._imageStream=this._decoder._getImageDictionary(),this._decoder&&this._decoder instanceof es&&(t=this._decoder,this._maskStream=t._maskStream,t._isDecode)&&!t._colorSpace||this._setColorSpace()},Ep.prototype._setColorSpace=function(){var t,e=this._imageStream.dictionary,i=e.get("ColorSpace");switch("DeviceCMYK"===i.name?t=M._PdfColorSpace.cmyk:"DeviceGray"===i.name&&(t=M._PdfColorSpace.grayScale),t=this._decoder instanceof es&&null!=this._decoder._colorSpace?M._PdfColorSpace.indexed:t){case M._PdfColorSpace.cmyk:e.update("Decode",[1,0,1,0,1,0,1,0]),e.update("ColorSpace",R.get("DeviceCMYK"));break;case M._PdfColorSpace.grayScale:e.update("Decode",[0,1]),e.update("ColorSpace",R.get("DeviceGray"));break;case M._PdfColorSpace.rgb:e.update("Decode",[0,1,0,1,0,1]),e.update("ColorSpace",R.get("DeviceRGB"));break;case M._PdfColorSpace.indexed:e.update("ColorSpace",this._decoder._colorSpace)}};var Lp,Op,Mp=Ep;function Ep(t){var e=Op.call(this)||this;return e._imageStatus=!0,e._initializeAsync(t),e}Object.defineProperty(jp.prototype,"graphics",{get:function(){return this._template||(this._template=new P(this._bounds,this._page?this._page._crossReference:void 0)),this._template.graphics},enumerable:!0,configurable:!0}),jp.prototype._draw=function(t,e,i,n,r){this._template&&t.drawTemplate(this._template,{x:e,y:i,width:n,height:r})};var Np=jp;function jp(t){this._bounds={x:0,y:0,width:t.width,height:t.height}}zp.prototype.draw=function(t,e){this._draw(t,e)},zp.prototype._draw=function(t,e){this._bounds.x=e.x,this._bounds.y=e.y;var i=t.save();try{e&&t.translateTransform(e),this._drawInternal(t)}finally{t.restore(i)}};var Vp=zp;function zp(){}Up=function(t,e){return(Up=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Up(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(qp,Hp=Vp),qp.prototype._initializeBase=function(t,e,i){null!=t&&(this._font=t),null!=e&&(this._brush=e),null!=i&&(this._stringFormat=i)},qp.prototype._draw=function(t,e){this._performDraw(t,e)},qp.prototype._performDraw=function(t,e){var i,n;this._bounds&&0!==this._bounds.width&&0!==this._bounds.height||(t=this._getValue(t),n=this._obtainFont(),i=this._stringFormat||new I,n=n.measureString(t,i),this._size={width:n.width,height:n.height})},qp.prototype._obtainSize=function(){var t=0,e=0;return this._bounds&&void 0!==this._bounds.width?t=this._bounds.width:this._size&&void 0!==this._size.width&&(t=this._size.width),this._bounds&&void 0!==this._bounds.height?e=this._bounds.height:this._size&&void 0!==this._size.height&&(e=this._size.height),{width:t,height:e}},qp.prototype._drawInternal=function(t){var e=this._getValue(t),i=this._obtainFont(),n=this._obtainBrush(),r=this._obtainSize();t.drawString(e,i,{x:this._bounds.x,y:this._bounds.y,width:r.width,height:r.height},n)},qp.prototype._obtainBrush=function(){return this._brush||new A({r:0,g:0,b:0})},qp.prototype._obtainFont=function(){return this._font||new E(M.PdfFontFamily.helvetica,8)};var Up,Hp,Wp=qp;function qp(){return null!==Hp&&Hp.apply(this,arguments)||this}Gp=function(t,e){return(Gp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Gp(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Jp,Kp=Wp),Jp.prototype._initializeBase=function(t,e,i){Kp.prototype._initializeBase.call(this,t,e,i)},Jp.prototype._getPageFromGraphics=function(t){return t._page};var Gp,Kp,Xp=Jp;function Jp(){return null!==Kp&&Kp.apply(this,arguments)||this}Yp=function(t,e){return(Yp=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Yp(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})($p,Qp=Xp),$p.prototype._initializeBase=function(t,e,i){Qp.prototype._initializeBase.call(this,t,e,i)},$p.prototype._performDraw=function(t,e){Qp.prototype._performDraw.call(this,t,e);var i,n,r=this._getValue(t),s=this._templateValueMap.get(t),a=(s&&s.value===r||(a=this._obtainFont(),i=this._obtainBrush(),o=this._obtainSize(),n=new P({x:0,y:0,width:o.width,height:o.height}),r&&n.graphics.drawString(r,a,{x:0,y:0,width:o.width,height:o.height},i),this._templateValueMap.set(t,s={template:n,value:r})),this._obtainSize()),o={x:e.x,y:e.y,width:a.width,height:a.height};t.drawTemplate(s.template,o)},$p.prototype._getValue=function(t){return""};var Yp,Qp,Zp=$p;function $p(){var t=null!==Qp&&Qp.apply(this,arguments)||this;return t._templateValueMap=new Map,t}tf=function(t,e){return(tf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}tf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(rf,ef=Zp),Object.defineProperty(rf.prototype,"automaticFields",{get:function(){return this._automaticFields},set:function(t){this._automaticFields=t},enumerable:!0,configurable:!0}),Object.defineProperty(rf.prototype,"pattern",{get:function(){return this._pattern},set:function(t){this._pattern=t},enumerable:!0,configurable:!0}),rf.prototype._getValue=function(t){for(var e=[],i=0,n=this._automaticFields;i<n.length;i++){var r=n[i];e.push(r._getValue(t))}for(var s=this._pattern,a=0;a<e.length;a++)s=s.replace("{"+a+"}",e[a]);return s};var tf,ef,nf=rf;function rf(t){var e=ef.call(this)||this;return e._automaticFields=[],e._pattern="",t&&(e._initializeBase(t.font,t.brush,t.stringFormat),e._pattern=t.pattern||"",e._automaticFields=t.automaticFields||[]),e}sf=function(t,e){return(sf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}sf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(hf,af=Xp),hf.prototype._initializeBase=function(t,e,i){af.prototype._initializeBase.call(this,t,e,i)},hf.prototype._performDraw=function(t,e){af.prototype._performDraw.call(this,t,e);var i,n,r=this._getValue(t),s=this._getPageFromGraphics(t),s=s&&s._crossReference?s._crossReference._document:null,a=(this._template&&this._cachedValue===r&&this._cachedDocument===s||(a=this._obtainFont(),i=this._obtainBrush(),o=this._obtainSize(),(n=new P({x:0,y:0,width:o.width,height:o.height})).graphics.drawString(r,a,{x:0,y:0,width:o.width,height:o.height},i),this._template=n,this._cachedValue=r,this._cachedDocument=s),this._obtainSize()),o={x:e.x,y:e.y,width:a.width,height:a.height};t.drawTemplate(this._template,o)},hf.prototype._getValue=function(t){return""};var sf,af,of=hf;function hf(){return null!==af&&af.apply(this,arguments)||this}cf=function(t,e){return(cf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}cf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(lf,_f=of),Object.defineProperty(lf.prototype,"dateFormatString",{get:function(){return this._formatString},set:function(t){this._formatString=t},enumerable:!0,configurable:!0}),lf.prototype._getValue=function(t){t=this._getPageFromGraphics(t)._crossReference._document;if(t){var t=t.getDocumentInformation();if(t)return t=t.creationDate,this._formatDate(t,this._formatString)}return(new Date).toISOString()},lf.prototype._formatDate=function(t,e){var i=t.getFullYear(),n=Xo(String(t.getMonth()+1),2,"0"),r=Xo(String(t.getDate()),2,"0"),s=Xo(String(t.getHours()),2,"0"),a=Xo(String(t.getMinutes()),2,"0"),t=Xo(String(t.getSeconds()),2,"0");return e.replace("yyyy",String(i)).replace("MM",n).replace("dd",r).replace("HH",s).replace("mm",a).replace("ss",t)};var cf,_f,df=lf;function lf(t){var e=_f.call(this)||this;return e._formatString="yyyy/MM/dd HH:mm:ss",t&&(e._initializeBase(t.font,t.brush,t.stringFormat),t.dateFormat)&&(e._formatString=t.dateFormat),e}uf=function(t,e){return(uf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}uf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(gf,pf=Wp),gf.prototype._initializeBase=function(t,e,i){pf.prototype._initializeBase.call(this,t,e,i)},gf.prototype._performDraw=function(t,e){pf.prototype._performDraw.call(this,t,e),this._template||(s=this._getValue(t),a=this._obtainFont(),i=this._obtainBrush(),n=this._obtainSize(),(r=new P({x:0,y:0,width:n.width,height:n.height})).graphics.drawString(s,a,{x:0,y:0,width:n.width,height:n.height},i),this._template=r);var i,n,r,s=this._obtainSize(),a={x:e.x,y:e.y,width:s.width,height:s.height};t.drawTemplate(this._template,a)},gf.prototype._getValue=function(t){return""};var uf,pf,ff=gf;function gf(){var t=null!==pf&&pf.apply(this,arguments)||this;return t._hasRendered=!1,t}yf=function(t,e){return(yf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}yf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(wf,mf=ff),wf.prototype._getValue=function(t){return this._formatDate(this._date,this._formatString)},wf.prototype._formatDate=function(t,e){var i=t.getFullYear(),n=Xo(String(t.getMonth()+1),2,"0"),t=Xo(String(t.getDate()),2,"0");return e.replace("yyyy",String(i)).replace("MM",n).replace("dd",t)};var yf,mf,bf=wf;function wf(t){var e=mf.call(this)||this;return e._formatString="yyyy/MM/dd",t&&e._initializeBase(t.font,t.brush,t.stringFormat),e._date=new Date,e}vf=function(t,e){return(vf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}vf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(xf,Sf=Zp),xf.prototype._initializeBase=function(t,e,i){Sf.prototype._initializeBase.call(this,t,e,i)},Object.defineProperty(xf.prototype,"numberStyle",{get:function(){return this._numberStyle},set:function(t){this._numberStyle=t},enumerable:!0,configurable:!0}),xf.prototype._getValue=function(t){return""};var vf,Sf,Pf=xf;function xf(){var t=null!==Sf&&Sf.apply(this,arguments)||this;return t._numberStyle=M.PdfNumberStyle.numeric,t}Af=function(t,e){return(Af=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Af(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(kf,Tf=Pf),kf.prototype._getValue=function(t){if(t){t=this._getPageFromGraphics(t);if(t&&t._crossReference&&t._crossReference._document)return Yo(t._pageIndex+1,this._numberStyle)}return"1"},kf.prototype._internalLoadedGetValue=function(t){return t?Yo(t._pageIndex+1,this._numberStyle):"1"};var Af,Tf,Cf=kf;function kf(t){var e=Tf.call(this)||this;return t&&(e._initializeBase(t.font,t.brush,t.stringFormat),t.numberStyle)&&(e._numberStyle=t.numberStyle),e}Rf=function(t,e){return(Rf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Rf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Df,Ff=Cf),Object.defineProperty(Df.prototype,"page",{get:function(){return this._page},set:function(t){this._page=t},enumerable:!0,configurable:!0}),Df.prototype._getValue=function(t){return this._page?this._internalLoadedGetValue(this._page):"1"};var Rf,Ff,If=Df;function Df(t){var e=Ff.call(this,t)||this;return t&&t.page&&(e._page=t.page),e}Bf=function(t,e){return(Bf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Bf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Mf,Lf=of),Mf.prototype._getValue=function(t){t=this._getPageFromGraphics(t);if(t&&t._crossReference&&t._crossReference._document){t=t._crossReference._document.getDocumentInformation();if(t&&t.author)return t.author}return""};var Bf,Lf,Of=Mf;function Mf(t){var e=Lf.call(this)||this;return t&&e._initializeBase(t.font,t.brush,t.stringFormat),e}Ef=function(t,e){return(Ef=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Ef(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Vf,Nf=of),Object.defineProperty(Vf.prototype,"numberStyle",{get:function(){return this._numberStyle},set:function(t){this._numberStyle=t},enumerable:!0,configurable:!0}),Vf.prototype._getValue=function(t){if(t){t=this._getPageFromGraphics(t);if(t&&t._crossReference&&t._crossReference._document)return Yo(t._crossReference._document.pageCount,this._numberStyle)}return"1"};var Ef,Nf,jf=Vf;function Vf(t){var e=Nf.call(this)||this;return e._numberStyle=M.PdfNumberStyle.numeric,t&&(e._initializeBase(t.font,t.brush,t.stringFormat),t.numberStyle)&&(e._numberStyle=t.numberStyle),e}zf=function(t,e){return(zf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}zf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Wf,Uf=Pf),Wf.prototype._getValue=function(t){t=this._getPageFromGraphics(t);if(t&&t._pageDictionary){t=t._getSectionIndex();if(0<=t)return Yo(t+1,this._numberStyle)}return Yo(1,this._numberStyle)};var zf,Uf,Hf=Wf;function Wf(t){var e=Uf.call(this)||this;return t&&(e._initializeBase(t.font,t.brush,t.stringFormat),t.numberStyle)&&(e._numberStyle=t.numberStyle),e}qf=function(t,e){return(qf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}qf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Xf,Gf=Pf),Xf.prototype._getValue=function(t){if(t){t=this._getPageFromGraphics(t);if(!t)return Yo(1,this._numberStyle);var e=t._getSectionIndex();if(e<0)return Yo(1,this._numberStyle);t=t._crossReference._document._sections[e];if(t)return Yo(t._pageCount,this._numberStyle)}return Yo(1,this._numberStyle)};var qf,Gf,Kf=Xf;function Xf(t){var e=Gf.call(this)||this;return t&&(e._initializeBase(t.font,t.brush,t.stringFormat),t.numberStyle)&&(e._numberStyle=t.numberStyle),e}Jf=function(t,e){return(Jf=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};(function(t,e){function i(){this.constructor=t}Jf(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(Zf,Yf=Pf),Zf.prototype._getValue=function(t){if(t){t=this._getPageFromGraphics(t);if(!t||!t._pageDictionary)return Yo(1,this._numberStyle);var e=t._ref,i=t._pageDictionary.getRaw("Parent");if(!e||!i)return Yo(1,this._numberStyle);t=t._crossReference._fetch(i);if(!t||!t.has("Kids"))return Yo(1,this._numberStyle);var n=t.get("Kids");if(!Array.isArray(n))return Yo(1,this._numberStyle);for(var r=0;r<n.length;r++){var s=n[r];if(s&&s.objectNumber===e.objectNumber)return Yo(r+1,this._numberStyle)}}return Yo(1,this._numberStyle)};var Jf,Yf,Qf=Zf;function Zf(t){var e=Yf.call(this)||this;return t&&(e._initializeBase(t.font,t.brush,t.stringFormat),t.numberStyle)&&(e._numberStyle=t.numberStyle),e}Object.defineProperty(tg.prototype,"brush",{get:function(){return this._brush},set:function(t){this._brush=t},enumerable:!0,configurable:!0}),Object.defineProperty(tg.prototype,"pen",{get:function(){return this._pen},set:function(t){this._pen=t},enumerable:!0,configurable:!0}),Object.defineProperty(tg.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(tg.prototype,"stringFormat",{get:function(){return this._stringFormat},set:function(t){this._stringFormat=t},enumerable:!0,configurable:!0}),Object.defineProperty(tg.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t},enumerable:!0,configurable:!0}),Object.defineProperty(tg.prototype,"textIndent",{get:function(){return this._textIndent},set:function(t){this._textIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(tg.prototype,"subList",{get:function(){return this._subList},set:function(t){this._subList=t},enumerable:!0,configurable:!0});var $f=tg;function tg(t,e){if(this._textIndent=0,null==t)throw new Error("Text cannot be null or undenfied.");this._text=t,e&&(e.font&&(this._font=e.font),e.format&&(this._stringFormat=e.format),e.pen&&(this._pen=e.pen),e.brush)&&(this._brush=e.brush)}Object.defineProperty(ig.prototype,"count",{get:function(){return this._listItems.length},enumerable:!0,configurable:!0}),ig.prototype.add=function(t,e){if(!t)throw new Error("item should not be null");this._listItems.push(t),e&&(t.textIndent=e)},ig.prototype.at=function(t){if(null===t)throw new Error("index should not be null");return this._listItems[t]},ig.prototype.remove=function(t){if(!t)throw new Error("item should not be null");for(var e=!1,i=0;i<this._listItems.length;i++)if(this._listItems[i]===t){e=!0,this._listItems.splice(i,1);break}if(!e)throw new Error("item collection does not contain the given content")},ig.prototype.removeAt=function(t){if(t<0||t>=this._listItems.length)throw new Error("The index should be less than items count or equal to 0");this._listItems.splice(t,1)},ig.prototype.clear=function(){this._listItems=[]},ig.prototype.insert=function(t,e,i){if(t<0||t>this._listItems.length)throw new Error("Index should be within the range of items count (inclusive).");if(!e)throw new Error("Item cannot be null.");i&&(e.textIndent=i),this._listItems.splice(t,0,e)},ig.prototype.indexOf=function(t){if(t)return this._listItems.indexOf(t);throw new Error("Item should be defined.")};var eg=ig;function ig(t){var e=this;this._listItems||(this._listItems=[]),t&&t.forEach(function(t){e.add(new $f(t))})}ng=function(t,e){return(ng=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}))(t,e)};var ng,rg=function(t,e){function i(){this.constructor=t}ng(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},sg=(Object.defineProperty(ag.prototype,"brush",{get:function(){return this._brush},set:function(t){this._brush=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"pen",{get:function(){return this._pen},set:function(t){this._pen=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"font",{get:function(){return this._font},set:function(t){this._font=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"stringFormat",{get:function(){return this._stringFormat},set:function(t){this._stringFormat=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"indent",{get:function(){return this._indent},set:function(t){this._indent=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"textIndent",{get:function(){return this._textIndent},set:function(t){this._textIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"delimiter",{get:function(){return this._delimiter},set:function(t){this._delimiter=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"suffix",{get:function(){return this._suffix},set:function(t){this._suffix=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"enableHierarchy",{get:function(){return this._enableHierarchy},set:function(t){this._enableHierarchy=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"alignment",{get:function(){return this._alignment},set:function(t){this._alignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"items",{get:function(){return this._itemCollection},set:function(t){this._itemCollection=t},enumerable:!0,configurable:!0}),Object.defineProperty(ag.prototype,"_markerRightToLeft",{get:function(){return this._alignment===M.PdfListMarkerAlignment.right},enumerable:!0,configurable:!0}),ag.prototype.draw=function(t,e,i){if(t instanceof br){if(t._isNew)return"width"in e&&void 0!==e.width&&"height"in e&&void 0!==e.height?this._drawInternal(t,e.x,e.y,e.width,e.height,i):this._drawInternal(t,e.x,e.y,0,0,i);new ug(this).layout(t.graphics,[e.x,e.y,0,0])}else new ug(this).layout(t,[e.x,e.y,0,0])},ag.prototype._drawInternal=function(t,e,i,n,r,s){var a=new mr;return a._page=t,null==n?(a._bounds=[e,i,0,0],a._format=new ur):"number"==typeof n?(a._bounds=[e,i,n,r],a._format=s||new ur):n instanceof ur&&(a._bounds=[e,i,0,0],a._format=n),this._layout(a)},ag.prototype._layout=function(t){return new ug(this).layoutInternal(t)},ag);function ag(){this._textIndent=5,this._indent=10,this._alignment=M.PdfListMarkerAlignment.left,this._delimiter=".",this._suffix=".",this._enableHierarchy=!1,this._currentIndex=0,this._size=[0,0],this._defaultFont=new E(M.PdfFontFamily.helvetica,8)}rg(cg,og=sg),Object.defineProperty(cg.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t},enumerable:!0,configurable:!0}),Object.defineProperty(cg.prototype,"startNumber",{get:function(){return this._startNumber},set:function(t){if(t<=0)throw new Error("Start number should be greater than 0.");this._startNumber=t},enumerable:!0,configurable:!0}),cg.prototype._getNumber=function(){return co(this._startNumber+this._currentIndex,this._style)};var og,hg=cg;function cg(t,e){var i=og.call(this)||this;return i._startNumber=1,i._itemCollection=t||new eg,e?(e.font&&(i._font=e.font),e.format&&(i._stringFormat=e.format),e.pen&&(i._pen=e.pen),e.brush&&(i._brush=e.brush),e.style?i._style=e.style:i._style=M.PdfNumberStyle.numeric,e.indent&&(i._indent=e.indent),e.textIndent&&(i._textIndent=e.textIndent),e.alignment&&(i._alignment=e.alignment),e.delimiter&&(i._delimiter=e.delimiter),e.suffix&&(i._suffix=e.suffix)):i._style=M.PdfNumberStyle.numeric,i}rg(dg,_g=sg),Object.defineProperty(dg.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t},enumerable:!0,configurable:!0}),dg.prototype._getStyledText=function(){switch(this._style){case M.PdfUnorderedListStyle.disk:return"l";case M.PdfUnorderedListStyle.square:return"n";case M.PdfUnorderedListStyle.asterisk:return"]";case M.PdfUnorderedListStyle.circle:return"m";default:return""}},dg.prototype._draw=function(t,e,i,n,r){var s=new P([0,0,this._size[0],this._size[1]],t._crossReference),a={x:0,y:0,width:0,height:0};r&&(a.x=a.x+r._width,a.y=a.y+r._width),s.graphics.drawString(this._getStyledText(),this._unicodeFont,a,r,n),t.drawTemplate(s,{x:e,y:i,width:s.size.width,height:s.size.height})};var _g,rg=dg;function dg(t,e){var i=_g.call(this)||this;return i._itemCollection=t||new eg,e?(e.font&&(i._font=e.font),e.format&&(i._stringFormat=e.format),e.pen&&(i._pen=e.pen),e.brush&&(i._brush=e.brush),e.style?i._style=e.style:i._style=M.PdfUnorderedListStyle.disk,e.indent&&(i._indent=e.indent),e.textIndent&&(i._textIndent=e.textIndent),e.alignment&&(i._alignment=e.alignment),e.delimiter&&(i._delimiter=e.delimiter),e.suffix&&(i._suffix=e.suffix)):i._style=M.PdfUnorderedListStyle.disk,i}var lg=function(t,e,i){this._list=t,this._index=e,this._number=i},ug=(pg.prototype.layout=function(t,e){this._graphics=t;t=new mr;t._bounds=e,t._format=new ur,t._format.layout=M.PdfLayoutType.onePage,this.layoutInternal(t)},pg.prototype.layoutInternal=function(t){this._currentPage=t._page,this._bounds=t._bounds.slice(),this._currentPage&&(0===t._bounds[2]&&0===t._bounds[3]&&(this._currentPage.graphics._isLayouter=!0,e=this._currentPage.graphics.clientSize,this._bounds[2]=e.width-this._bounds[0],this._bounds[3]=e.height-this._bounds[1]),this._graphics=this._currentPage.graphics);for(var e,i,n=new yr,r=(n.broken=!1,n.y=this._bounds[1],this._curList=this._element,this._indent=this._curList.indent,this._setCurrentParameters(this._curList),this._curList.brush||(this._currentBrush=new A({r:0,g:0,b:0})),this._curList.font||(this._currentFont=this._curList._defaultFont),this._curList instanceof hg&&(this._markerMaxWidth=this._getMarkerMaxWidth(this._curList,this._information)),t._format.layout===M.PdfLayoutType.onePage);!this._finish&&(n.y=this._bounds[1],n=this._layoutOnPage(n),!r);)this._currentPage&&!this._finish&&(this._currentPage=this._getNextPage(this._currentPage)),this._graphics=this._currentPage.graphics,0===t._bounds[2]&&0===t._bounds[3]&&(this._currentPage.graphics._isLayouter=!0,e=this._currentPage.graphics.clientSize,this._bounds[2]=e.width-this._bounds[0],this._bounds[3]=e.height-this._bounds[1]),t._format&&t._format.usePaginateBounds&&this._usePaginateBounds&&(i=t._format._paginateBounds,this._bounds=[i.x,i.y,i.width,i.height]);this._information=[];var s={x:this._bounds[0],y:n.y,width:this._bounds[2],height:this._resultHeight},s=new fr(this._currentPage,s);return this._currentFormat&&(this._currentFormat._isList=!1),s},pg.prototype._layoutOnPage=function(t){var e=0,i=0,n=this._bounds[1],r=this._bounds[0];for(this._size=[this._bounds[2]-this._indent,this._bounds[3]];;){for(;this._index<this._curList.items.count;++this._index){var s,a=this._curList.items.at(this._index),o=this._drawItem(t,r,this._curList,this._index,this._indent,this._information,a,e,n);if(t=o.pageResult,e=o.height,n=o.y,i+=e,t.broken)return t;t.markerWrote=!1,a.subList&&0<a.subList.items.count&&(this._curList instanceof hg?((o=this._curList)._currentIndex=this._index,(s=new lg(this._curList,this._index,o._getNumber()))._brush=this._currentBrush,s._font=this._currentFont,s._format=this._currentFormat,s._pen=this._currentPen,s._markerWidth=this._markerMaxWidth):((s=new lg(this._curList,this._index))._brush=this._currentBrush,s._font=this._currentFont,s._format=this._currentFormat,s._pen=this._currentPen),this._information.push(s),this._curList=a.subList,this._curList instanceof hg&&(this._markerMaxWidth=this._getMarkerMaxWidth(this._curList,this._information)),this._index=-1,this._indent+=this._curList.indent,this._size[0]=this._size[0]-this._curList.indent,this._setCurrentParameters(a),this._setCurrentParameters(this._curList))}if(0===this._information.length){this._resultHeight=i,this._finish=!0;break}var h=this._information.pop();this._index=h._index+1,this._indent-=this._curList.indent,this._size[0]=this._size[0]+this._curList.indent,this._markerMaxWidth=h._markerWidth,this._currentBrush=h._brush,this._currentPen=h._pen,this._currentFont=h._font,this._currentFormat=h._format,this._curList=h._list}return t},pg.prototype._drawItem=function(t,e,i,n,r,s,a,o,h){var c,_=new vt,d=i.textIndent,l=o+h,u=r+e,e=0,p=this._size.slice(),f=a.text,g=this._currentBrush,y=0,m=(a.brush&&(g=a.brush),this._currentPen),b=(a.pen&&(m=a.pen),this._currentFont),w=(a.font&&(b=a.font),this._currentFormat);if(a.stringFormat&&(w=a.stringFormat),(this._size[0]<=0||this._size[0]<b.size)&&this._currentPage)throw new Error("There is not enough space to layout list.");this._size[1]=this._size[1]-o,t.broken&&(f=t.itemText,S=t.markerText);var v=!0,n=this._createMarkerResult(n,i,s,a);if(n?(i instanceof hg?(u+=this._markerMaxWidth,t.markerWidth=this._markerMaxWidth):(u+=n._actualSize.width,t.markerWidth=n._actualSize.width),y=n._actualSize.height,this._currentPage&&(v=y<this._size[1]),n._empty&&(v=!1)):(u+=i._size[0],t.markerWidth=i._size[0],y=i._size[1],this._currentPage&&(v=y<this._size[1])),S&&""!==S||(v=!0),f&&v){if((p=this._size.slice())[0]=p[0]-t.markerWidth,0===a.textIndent?p[0]=p[0]-d:p[0]=p[0]-a.textIndent,(p[0]<=0||p[0]<b.size)&&this._currentPage)throw new Error("Not enough space to layout the text. The marker is too long or there is not enough space to draw it.");var s=u,S=(i._markerRightToLeft?(s-=t.markerWidth,!w||w.alignment!==M.PdfTextAlignment.right&&w.alignment!==M.PdfTextAlignment.center||(s-=r)):0===a.textIndent?s+=d:s+=a.textIndent,!this._currentPage&&w&&((w=Object.assign({},w)).alignment=M.PdfTextAlignment.left),c=_._layout(f,b,w,p),[s,l,p[0],p[1]]);this._graphics._drawStringLayoutResult(c,b,m,g,S,w),h=l,e=c._actualSize.height}if(o=e<y?y:e,c&&c._remainder&&""!==c._remainder||n&&n._remainder&&""!==n._remainder||!v?(o=h=0,c?(t.itemText=c._remainder,c._remainder===a.text&&(v=!1)):t.itemText=v?void 0:a.text,t.markerText=n?n._remainder:void 0,t.broken=!0,t.y=0,this._bounds[1]=0):t.broken=!1,c){if(t.markerX=u,w)switch(w.alignment){case M.PdfTextAlignment.right:t.markerX=u+p[0]-c._actualSize.width;break;case M.PdfTextAlignment.center:t.markerX=u+p[0]/2-c._actualSize.width/2}i._markerRightToLeft&&(t.markerX+=c._actualSize.width,0===a.textIndent?t.markerX+=d:t.markerX+=a.textIndent,!w||w.alignment!==M.PdfTextAlignment.right&&w.alignment!==M.PdfTextAlignment.center||(t.markerX-=r))}return v&&!t.markerWrote&&(t.markerWrote=this._drawMarker(i,a,n,l,t.markerX),i instanceof hg?t.markerWidth=n._actualSize.width:t.markerWidth=i._size[0]),{pageResult:t,height:o,y:h}},pg.prototype._createMarkerResult=function(t,e,i,n){return e instanceof hg?this._createOrderedMarkerResult(e,n,t,i,!1):this._createUnorderedMarkerResult(e,n)},pg.prototype._drawMarker=function(t,e,i,n,r){return t instanceof hg?t.font&&i&&(t.font.size>i._actualSize.height&&(n+=t.font.size/2-i._actualSize.height/2,i._actualSize.height=i._actualSize.height+n),this._drawOrderedMarker(t,i,e,r,n)):(t.font&&i&&t.font.size>i._actualSize.height&&(n+=t.font.size/2-i._actualSize.height/2,i._actualSize.height=i._actualSize.height+n),this._drawUnorderedMarker(t,i,e,r,n)),!0},pg.prototype._drawUnorderedMarker=function(t,e,i,n,r){var s=this._getMarkerFont(t,i),a=this._getMarkerPen(t,i),i=this._getMarkerBrush(t,i);e?(t._size=[e._actualSize.width,e._actualSize.height],t._unicodeFont=new E(M.PdfFontFamily.zapfDingbats,s.size),t._draw(this._graphics,n-e._actualSize.width,r,i,a)):(t._size=[s.size,s.size],t._draw(this._graphics,n-s.size,r,i,a))},pg.prototype._drawOrderedMarker=function(t,e,i,n,r){var s=this._getMarkerFont(t,i),a=this._getMarkerPen(t,i),o=this._getMarkerBrush(t,i),n=[n-this._markerMaxWidth,r,this._markerMaxWidth,e._actualSize.height],r=this._setMarkerStringFormat(t,this._getMarkerFormat(t,i));this._graphics._drawStringLayoutResult(e,s,a,o,n,r)},pg.prototype._setCurrentParameters=function(t){t.brush&&(this._currentBrush=t.brush),t.pen&&(this._currentPen=t.pen),t.font&&(this._currentFont=t.font),t.stringFormat&&(this._currentFormat=t.stringFormat,t instanceof sg)&&(this._currentFormat._isList=!0)},pg.prototype._getMarkerMaxWidth=function(t,e){for(var i=-1,n=0;n<t.items.count;n++){var r=this._createOrderedMarkerResult(t,t.items.at(n),n+t.startNumber,e,!0);i<r._actualSize.width&&(i=r._actualSize.width)}return i},pg.prototype._createUnorderedMarkerResult=function(t,e){var e=this._getMarkerFont(t,e),i=new vt,e=new E(M.PdfFontFamily.zapfDingbats,e.size),i=i._layout(t._getStyledText(),e,null,this._size);return t._size=[i._actualSize.width,i._actualSize.height],t.pen&&(i._size={width:i._actualSize.width+2*t.pen._width,height:i._actualSize.height+2*t.pen._width}),i},pg.prototype._createOrderedMarkerResult=function(t,e,i,n,r){t._currentIndex=i;var s="";if(t.style!==M.PdfNumberStyle.none&&(s=t._getNumber()+t.suffix),t.enableHierarchy)for(var a=n.slice(),o=0;o<a.length;o++){var h=a[o],c=h._list;if(!(c&&c instanceof hg&&c.style!==M.PdfNumberStyle.none))break;if(s=h._number+c.delimiter+s,!c.enableHierarchy)break}var i=new vt,n=this._getMarkerFont(t,e),e=this._getMarkerFormat(t,e),_=[0,0];return r||(_[0]=this._markerMaxWidth,e=this._setMarkerStringFormat(t,e)),i._layout(s,n,e,_)},pg.prototype._setMarkerStringFormat=function(t,e){return e=e?Object.assign({},e):new I,t.stringFormat||(e.alignment=M.PdfTextAlignment.right,t._markerRightToLeft&&(e.alignment=M.PdfTextAlignment.left)),!this._currentPage&&e&&((e=Object.assign({},e)).alignment=M.PdfTextAlignment.left),e},pg.prototype._getMarkerFont=function(t,e){var i=(i=(i=t.font)||e.font)||this._currentFont;return t.font=i},pg.prototype._getMarkerFormat=function(t,e){t=t.stringFormat;return t=(t=t||e.stringFormat)||this._currentFormat},pg.prototype._getMarkerPen=function(t,e){t=t.pen;return t=(t=t||e.pen)||this._currentPen},pg.prototype._getMarkerBrush=function(t,e){t=t.brush;return t=(t=t||e.brush)||this._currentBrush},pg.prototype._getNextPage=function(t){var e=t._crossReference._document;return t._pageIndex<e.pageCount-1?e.getPage(t._pageIndex+1):e.addPage(t._pageSettings)},pg);function pg(t){this._indent=0,this._information=[],this._markerMaxWidth=0,this._finish=!1,this._usePaginateBounds=!0,this._resultHeight=0,this._size=[0,0],this._index=0,this._element=t}gg.prototype._toString=function(){return"CHARACTER STRING { identification "+this._identification._toString()+" dataValue "+Array.from(this._stringValue).map(function(t){return t.toString(16)}).join("")+" }"},gg.prototype._toJson=function(){return{identification:this._identification._toJson(),dataValue:Array.from(this._stringValue).map(function(t){return t.toString(16)}).join("")}};var fg=gg;function gg(t,e){this._identification=t,this._stringValue=e}mg.prototype._toString=function(){var t="DURATION { ";return void 0!==this._years&&null!==this._years&&(t+="years "+this._years+" "),void 0!==this._months&&null!==this._months&&(t+="months "+this._months+" "),void 0!==this._days&&null!==this._days&&(t+="days "+this._days+" "),void 0!==this._hours&&null!==this._hours&&(t+="hours "+this._hours+" "),void 0!==this._minutes&&null!==this._minutes&&(t+="minutes "+this._minutes+" "),void 0!==this._seconds&&null!==this._seconds&&(t+="seconds "+this._seconds+" "),t+="}"},mg.prototype._toJson=function(){return{years:this._years,months:this._months,weeks:this._weeks,days:this._days,hours:this._hours,minutes:this._minutes,seconds:this._seconds,fractionalPart:this._fractionalPart?{numberOfDigits:this._fractionalPart.numberOfDigits,fractionalValue:this._fractionalPart.fractionalValue}:void 0}};var yg=mg;function mg(t,e,i,n,r,s,a,o){if(null!=i&&(t||e||n||r||s||a))throw new Error("Duration equivalent may not combine week components and date-time components.");if(t&&dl("year",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",t),e&&dl("month",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",e),i&&dl("week",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",i),n&&dl("day",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",n),r&&dl("hour",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",r),s&&dl("minute",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",s),a&&dl("second",0,Number.MAX_SAFE_INTEGER)("Duration equivalent",a),o&&!Number.isSafeInteger(o.fractionalValue))throw new Error("The fractional part of the duration is incorrectly formatted");this._years=t,this._months=e,this._weeks=i,this._days=n,this._hours=r,this._minutes=s,this._seconds=a,this._fractionalPart=o}wg.prototype._toString=function(){return"EMBEDDED PDV { identification "+this._identification.toString()+" dataValue "+Array.from(this._dataValue).map(function(t){return t.toString(16)}).join("")+" }"},wg.prototype._toJson=function(){return{identification:this._identification._toJson(),dataValue:Array.from(this._dataValue).map(function(t){return t.toString(16)}).join("")}};var bg=wg;function wg(t,e){if(!(t&&e&&0<e.length))throw new Error("Invalid constructor arguments: identification and non-empty dataValue are required.");this._identification=t,this._dataValue=e}Sg.prototype._toString=function(){var t="EXTERNAL { ";return this._directReference&&(t+="directReference "+this._directReference.toString()+" "),this._indirectReference&&(t+="indirectReference "+this._indirectReference.toString()+" "),this._dataValueDescriptor&&(t+="dataValueDescriptor '"+this._dataValueDescriptor+"' "),this._encoding instanceof Uint8Array?t+="octet-aligned "+Array.from(this._encoding).map(function(t){return t.toString(16)}).join("")+" ":this._encoding instanceof Uint8ClampedArray?t+="arbitrary "+this._encoding.toString()+" ":t+="single-ASN1-type "+this._encoding.toString()+" ",t+="}"},Sg.prototype._toJson=function(){var t,e;return this._encoding instanceof Uint8Array?e=Array.from(this._encoding).map(function(t){return t.toString(16)}).join(""):this._encoding instanceof Uint8ClampedArray&&(e={length:(t=this._encoding).length,value:Array.from(hl(t)).map(function(t){return t.toString(16)}).join("")}),{directReference:this._directReference,indirectReference:this._indirectReference,dataValueDescriptor:this._dataValueDescriptor,encoding:e}};var vg=Sg;function Sg(t,e,i,n){if(!(n&&t&&i&&e))throw new Error("Invalid constructor arguments");this._directReference=t,this._indirectReference=e,this._dataValueDescriptor=i,this._encoding=n}M.BaseException=ja,M.Dictionary=_h,M.FormatError=S,M.ParserEndOfFileException=Ua,M.Pdf3DAnnotation=gn,M.PdfAction=Re,M.PdfAngleMeasurementAnnotation=qi,M.PdfAnnotation=bi,M.PdfAnnotationBorder=nr,M.PdfAnnotationCaption=Yn,M.PdfAnnotationCollection=cr,M.PdfAnnotationExportSettings=Pp,M.PdfAnnotationLineEndingStyle=Zn,M.PdfAppearance=Ae,M.PdfAttachmentAnnotation=un,M.PdfAutomaticField=Wp,M.PdfBasicJobTicketSchema=np,M.PdfBasicSchema=zu,M.PdfBitmap=Mp,M.PdfBookmark=vd,M.PdfBookmarkBase=md,M.PdfBorderEffect=sr,M.PdfBrush=A,M.PdfButtonField=qe,M.PdfCheckBoxField=Xe,M.PdfCircleAnnotation=Ci,M.PdfCjkStandardFont=pe,M.PdfComboBoxField=ni,M.PdfComment=vi,M.PdfCompositeField=nf,M.PdfCreationDateField=df,M.PdfCustomMetadata=yp,M.PdfCustomSchema=dp,M.PdfDateTimeField=bf,M.PdfDestination=vr,M.PdfDestinationPageNumberField=If,M.PdfDocument=Sp,M.PdfDocumentAuthorField=Of,M.PdfDocumentLinkAnnotation=on,M.PdfDocumentSplitEventArgs=Ip,M.PdfDublinCoreSchema=qu,M.PdfDynamicField=Xp,M.PdfEllipseAnnotation=Fi,M.PdfField=Ve,M.PdfFieldActions=Ee,M.PdfFileLinkAnnotation=tn,M.PdfFileStructure=Id,M.PdfFont=ce,M.PdfForm=dd,M.PdfFormFieldExportSettings=Ap,M.PdfFreeTextAnnotation=In,M.PdfGoToAction=Oe,M.PdfGraphics=kr,M.PdfGraphicsElement=Vp,M.PdfGraphicsState=Br,M.PdfImage=Tr,M.PdfInkAnnotation=Xi,M.PdfInteractiveBorder=tr,M.PdfJavaScriptAction=De,M.PdfLayer=jd,M.PdfLayerCollection=zd,M.PdfLayoutFormat=ur,M.PdfLayoutResult=fr,M.PdfLineAnnotation=xi,M.PdfList=sg,M.PdfListBoxField=ai,M.PdfListField=ti,M.PdfListFieldItem=Xn,M.PdfListItem=$f,M.PdfListItemCollection=eg,M.PdfMargins=Rp,M.PdfMultipleNumberValueField=Pf,M.PdfMultipleValueField=Zp,M.PdfNamedDestination=Pd,M.PdfOrderedList=hg,M.PdfPage=br,M.PdfPageCountField=jf,M.PdfPageImportOptions=Bd,M.PdfPageNumberField=Cf,M.PdfPageSettings=Cp,M.PdfPageTemplateElement=Np,M.PdfPagedTextSchema=$u,M.PdfPath=C,M.PdfPen=x,M.PdfPolyLineAnnotation=Ui,M.PdfPolygonAnnotation=ji,M.PdfPopupAnnotation=Qi,M.PdfPopupAnnotationCollection=dr,M.PdfPredictorStream=Xh,M.PdfRadioButtonListField=Qe,M.PdfRadioButtonListItem=qn,M.PdfRectangleAnnotation=Mi,M.PdfRedactionAnnotation=Bn,M.PdfRichMediaAnnotation=Mn,M.PdfRightsManagementSchema=op,M.PdfRubberStampAnnotation=An,M.PdfSchema=Ju,M.PdfSection=Hd,M.PdfSectionNumberField=Hf,M.PdfSectionPageCountField=Kf,M.PdfSectionPageNumberField=Qf,M.PdfSignature=Ou,M.PdfSignatureField=ci,M.PdfSingleValueField=of,M.PdfSoundAnnotation=kn,M.PdfSquareAnnotation=Bi,M.PdfStandardFont=E,M.PdfStateItem=Un,M.PdfStaticField=ff,M.PdfStringFormat=I,M.PdfTemplate=P,M.PdfTextBoxField=Ue,M.PdfTextMarkupAnnotation=bn,M.PdfTextWebLinkAnnotation=_n,M.PdfTrueTypeFont=ye,M.PdfUnorderedList=rg,M.PdfUriAnnotation=rn,M.PdfWatermarkAnnotation=Sn,M.PdfWidgetAnnotation=jn,M.PdfXmpMetadata=up,M.PdfXmpSchema=Eu,M._AdvancedEncryption=V_,M._AdvancedEncryption128Cipher=g_,M._AdvancedEncryption256Cipher=b_,M._AdvancedEncryptionBaseCipher=Zc,M._ArabicShape=ee,M._ArabicShapeRenderer=$t,M._BasicEncryption=E_,M._Bidirectional=ie,M._BigEndianWriter=Jt,M._Cipher=Jc,M._CipherTransform=t_,M._CipherTwo=Y_,M._CjkDifferentWidth=bt,M._CjkSameWidth=gt,M._CjkWidth=pt,M._CjkWidthTable=lt,M._ContentLexer=fi,M._ContentParser=ui,M._DataEncryptionStandardCipher=i_,M._DecompressedOutput=Hr,M._DeflateStream=Qr,M._EncryptionKey=L_,M._ExportHelper=X,M._FdfDocument=pd,M._FdfHelper=yd,M._FontStructure=Z,M._HuffmanTree=Kr,M._ImageDecoder=t,M._InBuffer=qr,M._Inflater=Jr,M._JpegDecoder=zr,M._JsonDocument=it,M._LineInfo=At,M._Linearization=__,M._MD5=l_,M._Matrix=Ir,M._Namespace=z,M._NistObjectIdentifiers=au,M._NormalCipherFour=W_,M._NullCipher=K_,M._PageLayoutResult=yr,M._PaintParameter=or,M._PdfAbstractSyntaxElement=bl,M._PdfAlgorithms=Sl,M._PdfArithmeticDecoder=Tc,M._PdfAscii85Stream=_c,M._PdfAsciiHexStream=pc,M._PdfBaseStream=y,M._PdfBasicEncodingElement=Fl,M._PdfBigInt=qd,M._PdfBitReader=kc,M._PdfCatalog=Wh,M._PdfCertificate=ru,M._PdfCertificateIdentifier=Kd,M._PdfCertificateTable=Jd,M._PdfCharacterString=fg,M._PdfCipherParameter=Il,M._PdfCjkFontDescriptorFactory=Se,M._PdfCjkStandardFontMetricsFactory=we,M._PdfCommand=nh,M._PdfContentStream=Sh,M._PdfContextCache=Fc,M._PdfCopier=Ed,M._PdfCrossReference=nd,M._PdfCryptographicEncoding=yu,M._PdfCryptographicMessageSyntaxSigner=Ru,M._PdfCryptographicObjectIdentifier=ou,M._PdfDecodeStream=d,M._PdfDecodingContext=Dc,M._PdfDecryptStream=Dh,M._PdfDefaultAppearance=di,M._PdfDestinationHelper=Pr,M._PdfDictionary=D,M._PdfDigestInformation=bu,M._PdfDigitalIdentifiers=hu,M._PdfDurationEquivalent=yg,M._PdfEmbeddedDataValue=bg,M._PdfEncryptor=Z_,M._PdfExternal=vg,M._PdfFaxDecoder=gc,M._PdfFaxStream=wc,M._PdfFlateStream=Uh,M._PdfFontMetrics=ht,M._PdfHuffmanLine=Mc,M._PdfHuffmanTable=jc,M._PdfHuffmanTreeNode=Ec,M._PdfJbig2Image=Hc,M._PdfJbig2Stream=Kc,M._PdfJpegStream=Zh,M._PdfJpxStream=ac,M._PdfLayoutParameters=mr,M._PdfLempelZivWelchStream=ic,M._PdfLexicalOperator=a_,M._PdfListInfo=lg,M._PdfListLayouter=ug,M._PdfMergeHelper=Od,M._PdfMessageDigestAlgorithms=du,M._PdfName=R,M._PdfNamedDestinationCollection=Ad,M._PdfNativeAccumulatorSink=v_,M._PdfNativeAlgorithmIdentifier=A_,M._PdfNativeHashInput=P_,M._PdfNull=uh,M._PdfNullStream=Ah,M._PdfObjectIdentifier=el,M._PdfPaddings=Bp,M._PdfParser=h_,M._PdfPublicKeyCryptographyCertificate=iu,M._PdfPublicKeyInformation=Tl,M._PdfReader=zc,M._PdfRecord=mi,M._PdfReference=m,M._PdfReferenceSet=ah,M._PdfReferenceSetCache=hh,M._PdfRmdSigner=vu,M._PdfRonCipherParameter=Ll,M._PdfRsaAlgorithm=fu,M._PdfRsaCoreAlgorithm=uu,M._PdfRunLengthStream=xc,M._PdfSignatureDictionary=Bu,M._PdfSignaturePrivateKey=Au,M._PdfSignedCertificate=Xl,M._PdfSignerUtilities=Pu,M._PdfSimpleSegmentVisitor=Lc,M._PdfStandardFontMetricsFactory=be,M._PdfStream=g,M._PdfStreamWriter=Ar,M._PdfStringLayoutResult=Pt,M._PdfStringLayouter=vt,M._PdfSubjectKeyIdentifier=$d,M._PdfTransformationMatrix=Rr,M._PdfUniqueBitString=xl,M._PdfUniqueEncodingElement=w,M._PdfUnitConvertor=Mr,M._PdfX509Certificate=Ul,M._PdfX509CertificateParser=Zl,M._PdfX509CertificateStructure=Yl,M._PdfX509Certificates=Wl,M._PdfX509Extension=Ml,M._PdfX509ExtensionBase=Mh,M._PdfX509Extensions=El,M._PdfX509Name=ql,M._PdfX509Time=Gl,M._PngDecoder=es,M._RaceEvaluationMessageDigest=cu,M._RtlCharacters=re,M._RtlRenderer=ae,M._Sha1=Qd,M._Sha256=C_,M._Sha384=I_,M._Sha512=R_,M._StandardWidthTable=ct,M._StringTokenizer=Tt,M._TripleDataEncryptionStandardCipher=tu,M._TrueTypeAppleCmapSubTable=Nt,M._TrueTypeCmapSubTable=Et,M._TrueTypeCmapTable=Mt,M._TrueTypeGlyph=qt,M._TrueTypeGlyphHeader=Xt,M._TrueTypeHeadTable=Ot,M._TrueTypeHorizontalHeaderTable=Lt,M._TrueTypeLocaTable=Kt,M._TrueTypeLongHorMetric=Wt,M._TrueTypeMetrics=Ut,M._TrueTypeMicrosoftCmapSubTable=Bt,M._TrueTypeNameRecord=zt,M._TrueTypeNameTable=Dt,M._TrueTypeOS2Table=Ft,M._TrueTypePostTable=It,M._TrueTypeReader=Vt,M._TrueTypeTableInfo=kt,M._TrueTypeTrimmedCmapSubTable=jt,M._UnicodeLine=xe,M._UnicodeTrueTypeFont=Qt,M._WidthTable=st,M._Word64=B,M._XfdfDocument=Q,M._XmlAttribute=q,M._XmlDocument=Rd,M._XmlElement=H,M._XmlReader=fp,M._XmlWriter=j,M._addProcSet=ea,M._annotationFlagsToString=us,M._appendChar=uo,M._arabicToLetter=lo,M._arabicToRoman=_o,M._areArrayEqual=gs,M._areNotEqual=bs,M._arePointsEqual=ys,M._arePointsNotEqual=ws,M._areUint8ArraysEqual=Io,M._bigIntToBytes=Oo,M._bufferToInteger=nl,M._byteArrayToHexString=As,M._bytesToBigInt=Lo,M._bytesToHex=Jo,M._bytesToString=vs,M._calculateBounds=Ls,M._checkComment=La,M._checkField=ca,M._checkInkPoints=io,M._checkReview=Ba,M._checkRotation=ds,M._checkType=cs,M._clearPrimitiveCaches=ph,M._compressStream=po,M._convertBytesToText=cl,M._convertDateToString=zo,M._convertNumber=co,M._convertNumberArraysToPoints=Us,M._convertNumberToPointArrays=zs,M._convertPointToNumberArray=Ws,M._convertPointsToNumberArrays=Hs,M._convertStringToDate=Uo,M._convertToColor=Ns,M._convertToHex=vo,M._convertToPoints=Vs,M._copyRange=hs,M._createFontMetrics=Ga,M._createFontStream=bo,M._createRandomInRange=Eo,M._decode=Rs,M._decodeFontFamily=So,M._decodeName=Ss,M._decodeSignedBigEndianInteger=function(t){var e=t.length;if(0===e)return 0;if(4<e)throw new Error("Number too long to decode.");var i=new Uint8Array(4),n=0!=(128&t[0]);return i.fill(n?255:0,0,4-e),i.set(t,4-e),new DataView(i.buffer).getInt32(0,!1)},M._decodeText=so,M._decodeUnicodeBytes=Ps,M._decodeUnsignedBigEndianInteger=function(t){var e=t.length;if(0===e)return 0;if(4<e)throw new Error("Number on "+e+" bytes is too long to decode.");var i=new Uint8Array(4);return i.set(t,4-e),new DataView(i.buffer).getUint32(0,!1)},M._decodeUtf16Bytes=ao,M._defaultToString=Wa,M._defineLazyProperty=ko,M._defineProperty=function(t,e,i,n){return void 0===n&&(n=!1),Object.defineProperty(t,e,{value:i,enumerable:!n,configurable:!0,writable:!1}),i},M._dissectFloat=sl,M._encode=Is,M._encodeBigEndianSignedInteger=al,M._encodeCodePointToUtf8=ra,M._encodeUnsignedBigEndianInteger=ol,M._encodeValue=function(t){for(var e="",i=0;i<t.length;i++){var n=255&t.charCodeAt(i),r=String.fromCharCode(n),s="";switch(r){case" ":case"%":case"(":case")":case"<":case">":case"[":case"]":case"{":case"}":case"/":case"#":e=(e+="#")+(1===(s=n.toString(16).toUpperCase()).length?"0"+s:s);break;default:126<n||n<37?e=(e+="#")+(1===(s=n.toString(16).toUpperCase()).length?"0"+s:s):e+=r}}return e},M._encodeX690BinaryRealNumber=function(t){if(0===t)return new Uint8Array(0);if(Number.isNaN(t))return new Uint8Array([M._RealValueType.notANumber]);if(t===1/0)return new Uint8Array([M._RealValueType.plusInfinity]);if(t===-1/0)return new Uint8Array([M._RealValueType.minusInfinity]);for(var e=sl(t);0!==e.mantissa&&e.mantissa%2==0;)e.mantissa=e.mantissa>>>1,e.exponent++;if(e.exponent<=-1020)throw new Error("Real number "+t+" (having exponent "+e.exponent+") is too precise to encode.");var t=128|(0<=t?0:64)|(e.exponent<=127&&-128<=e.exponent?0:1),i=al(e.exponent),n=ol(e.mantissa),r=new Uint8Array(1+i.length+n.length);return r[0]=t,r.set(i,1),r.set(n,1+i.length),r},M._escapePdfName=na,M._extractAttributes=Fo,M._findPage=ha,M._floatToString=ta,M._formatNumber=Yo,M._fromRectangle=Ms,M._getBezierArc=oa,M._getBigInt=jo,M._getBit=function(t,e){return 0<(t[t.length-(Math.floor(e/8)+1)]&1<<e%8)},M._getCenterX=pa,M._getCenterY=fa,M._getCjkDescendantFont=Wo,M._getCjkEncoding=Ho,M._getCjkSystemInfo=qo,M._getColorValue=la,M._getCommentsOrReview=function(t,e){return e?t.reviewHistory:t.comments},M._getDecoder=_s,M._getFontFamily=Xa,M._getFontFromDescriptor=eo,M._getFontSize=Ka,M._getFontStyle=Ja,M._getInheritableProperty=Ds,M._getItemValue=_a,M._getLatinCharacter=Da,M._getNewGuidString=ia,M._getPageIndex=ls,M._getSize=oo,M._getSpecialCharacter=Ia,M._getStateTemplate=da,M._getUpdatedBounds=Es,M._grayToRgba=function(t,e){if(Ro())for(var i=0,n=t.length;i<n;i++)e[i]=65793*t[i]|4278190080;else for(i=0,n=t.length;i<n;i++)e[i]=16843008*t[i]|255},M._handleExplicitConversion=No,M._hasSharedFontResource=$a,M._hasUnicodeCharacters=mo,M._hexStringToByteArray=Ts,M._hexStringToString=Cs,M._integerToBuffer=rl,M._isBasicEncodingElement=_l,M._isCommand=gh,M._isGeneralCharacter=ll,M._isGraphicCharacter=ul,M._isHexDigit=aa,M._isLittleEndian=Ro,M._isName=fh,M._isNullOrUndefined=k,M._isPointArray=js,M._isPrintableCharacter=pl,M._isRightToLeftCharacters=fo,M._isUnicode=wo,M._isWhiteSpace=ks,M._log2=Co,M._mapAnnotationIntent=Ra,M._mapAnnotationState=Aa,M._mapAnnotationStateModel=Ca,M._mapAttachmentIcon=ka,M._mapBlendMode=$s,M._mapBorderEffectStyle=Ks,M._mapBorderStyle=Gs,M._mapFont=Ya,M._mapGraphicsUnit=va,M._mapHighlightMode=Ys,M._mapLineEndingStyle=Js,M._mapMarkupAnnotationType=ba,M._mapMeasurementUnit=ma,M._mapPopupIcon=Pa,M._mapRubberStampIcon=Sa,M._mathClamp=function(t,e,i){return Math.min(Math.max(t,e),i)},M._modInverse=Bo,M._modPow=Do,M._numberToString=ms,M._obtainFontDetails=qa,M._packBits=hl,M._pad2=Vo,M._padStart=Xo,M._parseColor=qs,M._parseRectangle=Bs,M._randomBigInt=Mo,M._readInteger8=To,M._readUnsignedInteger16=xo,M._readUnsignedInteger32=Ao,M._removeDuplicateFromResources=Ma,M._removeDuplicateReference=T,M._removeReferences=Ea,M._resolveCjkFontFamily=Ko,M._resolveStandardFontFamily=Go,M._reverseMapAnnotationState=xa,M._reverseMapAnnotationStateModel=Ta,M._reverseMapBlendMode=Zs,M._reverseMapEndingStyle=Xs,M._reverseMapHighlightMode=Qs,M._reverseMapPdfFontStyle=Fa,M._reverseMarkupAnnotationType=wa,M._setBit=function(t,e,i){var n=t.length-(Math.floor(e/7)+1);i?t[n]|=1<<e%7:t[n]&=~(1<<e%7)},M._setBitInBase256=function(t,e,i){var n=t.length-(Math.floor(e/8)+1);i?t[n]|=1<<e%8:t[n]&=~(1<<e%8)},M._setMatrix=ua,M._setRotateAngle=function(t,e){e&&t!==e.rotate&&e._dictionary.update("Rotate",t=360<=(t=t<0?360+t:t)?360-t:t)},M._stringToAnnotationFlags=ps,M._stringToBigEndianBytes=ho,M._stringToBytes=v,M._stringToPdfString=fs,M._stringToStyle=ya,M._stringToUnicodeArray=xs,M._styleToString=ga,M._toAlpha=Zo,M._toHex2=sa,M._toRectangle=Os,M._toRoman=Qo,M._toSigned16=os,M._toUnsigned=as,M._trimTailIfMatches=ro,M._tryParseFontStream=to,M._unreachable=function(t){throw new Error(t)},M._updateBounds=no,M._updateDashedBorderStyle=Po,M._updatePageCount=go,M._updatePageSettings=yo,M._updateVisibility=Oa,M._validateDate=fl,M._validateDateTime=yl,M._validateDateTimeComponent=dl,M._validateTime=gl,M.isNumericString=ml,Object.defineProperty(M,"__esModule",{value:!0})});
//# sourceMappingURL=ej2-pdf.umd.min.js.map