@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
10 lines • 936 kB
JavaScript
/*!
* filename: ej2-pdf.umd.min.js
* version : 29.2.11
* Copyright Syncfusion Inc. 2001 - 2024. 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-compression"),require("@syncfusion/ej2-file-utils")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-compression","@syncfusion/ej2-file-utils"],e):e((t=t||self).ej={},t.ej2Compression,t.ej2FileUtils)}(this,function(x,M,N){"use strict";(e=x.PdfAnnotationFlag||(x.PdfAnnotationFlag={}))[e.default=0]="default",e[e.invisible=1]="invisible",e[e.hidden=2]="hidden",e[e.print=4]="print",e[e.noZoom=8]="noZoom",e[e.noRotate=16]="noRotate",e[e.noView=32]="noView",e[e.readOnly=64]="readOnly",e[e.locked=128]="locked",e[e.toggleNoView=256]="toggleNoView",(e=x.PdfLineEndingStyle||(x.PdfLineEndingStyle={}))[e.none=0]="none",e[e.openArrow=1]="openArrow",e[e.closedArrow=2]="closedArrow",e[e.rOpenArrow=3]="rOpenArrow",e[e.rClosedArrow=4]="rClosedArrow",e[e.butt=5]="butt",e[e.diamond=6]="diamond",e[e.circle=7]="circle",e[e.square=8]="square",e[e.slash=9]="slash",(e=x.PdfLineIntent||(x.PdfLineIntent={}))[e.lineArrow=0]="lineArrow",e[e.lineDimension=1]="lineDimension",(e=x.PathPointType||(x.PathPointType={}))[e.start=0]="start",e[e.line=1]="line",e[e.bezier=3]="bezier",e[e.pathTypeMask=7]="pathTypeMask",e[e.dashMode=16]="dashMode",e[e.pathMarker=32]="pathMarker",e[e.closePath=128]="closePath",(e=x.PdfLineCaptionType||(x.PdfLineCaptionType={}))[e.inline=0]="inline",e[e.top=1]="top",(e=x.PdfBorderStyle||(x.PdfBorderStyle={}))[e.solid=0]="solid",e[e.dashed=1]="dashed",e[e.beveled=2]="beveled",e[e.inset=3]="inset",e[e.underline=4]="underline",e[e.dot=5]="dot",(e=x.PdfBorderEffectStyle||(x.PdfBorderEffectStyle={}))[e.solid=0]="solid",e[e.cloudy=1]="cloudy",(e=x.PdfRotationAngle||(x.PdfRotationAngle={}))[e.angle0=0]="angle0",e[e.angle90=1]="angle90",e[e.angle180=2]="angle180",e[e.angle270=3]="angle270",(e=x.PdfCrossReferenceType||(x.PdfCrossReferenceType={}))[e.table=0]="table",e[e.stream=1]="stream",(e=x.PdfHighlightMode||(x.PdfHighlightMode={}))[e.noHighlighting=0]="noHighlighting",e[e.invert=1]="invert",e[e.outline=2]="outline",e[e.push=3]="push",(e=x.PdfTextAlignment||(x.PdfTextAlignment={}))[e.left=0]="left",e[e.center=1]="center",e[e.right=2]="right",e[e.justify=3]="justify",(e=x.PdfFormFieldVisibility||(x.PdfFormFieldVisibility={}))[e.visible=0]="visible",e[e.hidden=1]="hidden",e[e.visibleNotPrintable=2]="visibleNotPrintable",e[e.hiddenPrintable=3]="hiddenPrintable",(e=x.PdfMeasurementUnit||(x.PdfMeasurementUnit={}))[e.inch=0]="inch",e[e.pica=1]="pica",e[e.point=3]="point",e[e.centimeter=4]="centimeter",e[e.millimeter=6]="millimeter",(e=x.PdfCircleMeasurementType||(x.PdfCircleMeasurementType={}))[e.diameter=0]="diameter",e[e.radius=1]="radius",(e=x.PdfRubberStampAnnotationIcon||(x.PdfRubberStampAnnotationIcon={}))[e.approved=0]="approved",e[e.asIs=1]="asIs",e[e.confidential=2]="confidential",e[e.departmental=3]="departmental",e[e.draft=4]="draft",e[e.experimental=5]="experimental",e[e.expired=6]="expired",e[e.final=7]="final",e[e.forComment=8]="forComment",e[e.forPublicRelease=9]="forPublicRelease",e[e.notApproved=10]="notApproved",e[e.notForPublicRelease=11]="notForPublicRelease",e[e.sold=12]="sold",e[e.topSecret=13]="topSecret",e[e.completed=14]="completed",e[e.void=15]="void",e[e.informationOnly=16]="informationOnly",e[e.preliminaryResults=17]="preliminaryResults",(e=x.PdfCheckBoxStyle||(x.PdfCheckBoxStyle={}))[e.check=0]="check",e[e.circle=1]="circle",e[e.cross=2]="cross",e[e.diamond=3]="diamond",e[e.square=4]="square",e[e.star=5]="star",(e=x.PdfTextMarkupAnnotationType||(x.PdfTextMarkupAnnotationType={}))[e.highlight=0]="highlight",e[e.underline=1]="underline",e[e.squiggly=2]="squiggly",e[e.strikeOut=3]="strikeOut",(e=x.PdfPopupIcon||(x.PdfPopupIcon={}))[e.note=0]="note",e[e.comment=1]="comment",e[e.help=2]="help",e[e.insert=3]="insert",e[e.key=4]="key",e[e.newParagraph=5]="newParagraph",e[e.paragraph=6]="paragraph",(e=x.PdfAnnotationState||(x.PdfAnnotationState={}))[e.none=0]="none",e[e.accepted=1]="accepted",e[e.rejected=2]="rejected",e[e.cancel=3]="cancel",e[e.completed=4]="completed",e[e.marked=5]="marked",e[e.unmarked=6]="unmarked",e[e.unknown=7]="unknown",(e=x.PdfAnnotationStateModel||(x.PdfAnnotationStateModel={}))[e.none=0]="none",e[e.marked=1]="marked",e[e.review=2]="review",(e=x.PdfAttachmentIcon||(x.PdfAttachmentIcon={}))[e.pushPin=0]="pushPin",e[e.tag=1]="tag",e[e.graph=2]="graph",e[e.paperClip=3]="paperClip",(e=x.PdfAnnotationIntent||(x.PdfAnnotationIntent={}))[e.none=0]="none",e[e.freeTextCallout=1]="freeTextCallout",e[e.freeTextTypeWriter=2]="freeTextTypeWriter",(e=x.PdfDestinationMode||(x.PdfDestinationMode={}))[e.location=0]="location",e[e.fitToPage=1]="fitToPage",e[e.fitR=2]="fitR",e[e.fitH=3]="fitH",(e=x.DataFormat||(x.DataFormat={}))[e.fdf=0]="fdf",e[e.xfdf=1]="xfdf",e[e.json=2]="json",e[e.xml=3]="xml",(e=x.PdfFormFieldsTabOrder||(x.PdfFormFieldsTabOrder={}))[e.none=0]="none",e[e.row=1]="row",e[e.column=2]="column",e[e.structure=3]="structure",e[e.manual=4]="manual",e[e.widget=5]="widget",(e=x._PdfAnnotationType||(x._PdfAnnotationType={}))[e.highlight=0]="highlight",e[e.underline=1]="underline",e[e.strikeOut=2]="strikeOut",e[e.squiggly=3]="squiggly",e[e.redactionAnnotation=4]="redactionAnnotation",e[e.textAnnotation=5]="textAnnotation",e[e.linkAnnotation=6]="linkAnnotation",e[e.documentLinkAnnotation=7]="documentLinkAnnotation",e[e.uriAnnotation=8]="uriAnnotation",e[e.fileLinkAnnotation=9]="fileLinkAnnotation",e[e.freeTextAnnotation=10]="freeTextAnnotation",e[e.lineAnnotation=11]="lineAnnotation",e[e.circleAnnotation=12]="circleAnnotation",e[e.ellipseAnnotation=13]="ellipseAnnotation",e[e.squareAnnotation=14]="squareAnnotation",e[e.rectangleAnnotation=15]="rectangleAnnotation",e[e.polygonAnnotation=16]="polygonAnnotation",e[e.polyLineAnnotation=17]="polyLineAnnotation",e[e.textMarkupAnnotation=18]="textMarkupAnnotation",e[e.caretAnnotation=19]="caretAnnotation",e[e.rubberStampAnnotation=20]="rubberStampAnnotation",e[e.popupAnnotation=21]="popupAnnotation",e[e.fileAttachmentAnnotation=22]="fileAttachmentAnnotation",e[e.soundAnnotation=23]="soundAnnotation",e[e.movieAnnotation=24]="movieAnnotation",e[e.screenAnnotation=25]="screenAnnotation",e[e.widgetAnnotation=26]="widgetAnnotation",e[e.printerMarkAnnotation=27]="printerMarkAnnotation",e[e.trapNetworkAnnotation=28]="trapNetworkAnnotation",e[e.watermarkAnnotation=29]="watermarkAnnotation",e[e.textWebLinkAnnotation=30]="textWebLinkAnnotation",e[e.inkAnnotation=31]="inkAnnotation",e[e.richMediaAnnotation=32]="richMediaAnnotation",e[e.angleMeasurementAnnotation=33]="angleMeasurementAnnotation",e[e.null=34]="null",(e=x._PdfGraphicsUnit||(x._PdfGraphicsUnit={}))[e.centimeter=0]="centimeter",e[e.pica=1]="pica",e[e.pixel=2]="pixel",e[e.point=3]="point",e[e.inch=4]="inch",e[e.document=5]="document",e[e.millimeter=6]="millimeter",(e=x._FieldFlag||(x._FieldFlag={}))[e.default=0]="default",e[e.readOnly=1]="readOnly",e[e.required=2]="required",e[e.noExport=4]="noExport",e[e.multiLine=4096]="multiLine",e[e.password=8192]="password",e[e.fileSelect=1048576]="fileSelect",e[e.doNotSpellCheck=4194304]="doNotSpellCheck",e[e.doNotScroll=8388608]="doNotScroll",e[e.comb=16777216]="comb",e[e.richText=33554432]="richText",e[e.noToggleToOff=16384]="noToggleToOff",e[e.radio=32768]="radio",e[e.pushButton=65536]="pushButton",e[e.radiosInUnison=33554432]="radiosInUnison",e[e.combo=131072]="combo",e[e.edit=262144]="edit",e[e.sort=524288]="sort",e[e.multiSelect=2097152]="multiSelect",e[e.commitOnSelectChange=67108864]="commitOnSelectChange",(e=x._SignatureFlag||(x._SignatureFlag={}))[e.none=0]="none",e[e.signatureExists=1]="signatureExists",e[e.appendOnly=2]="appendOnly",(e=x._PdfCheckFieldState||(x._PdfCheckFieldState={}))[e.unchecked=0]="unchecked",e[e.checked=1]="checked",e[e.pressedUnchecked=2]="pressedUnchecked",e[e.pressedChecked=3]="pressedChecked",(e=x.PdfPermissionFlag||(x.PdfPermissionFlag={}))[e.default=0]="default",e[e.print=4]="print",e[e.editContent=8]="editContent",e[e.copyContent=16]="copyContent",e[e.editAnnotations=32]="editAnnotations",e[e.fillFields=256]="fillFields",e[e.accessibilityCopyContent=512]="accessibilityCopyContent",e[e.assembleDocument=1024]="assembleDocument",e[e.fullQualityPrint=2048]="fullQualityPrint",(e=x.PdfPageOrientation||(x.PdfPageOrientation={}))[e.portrait=0]="portrait",e[e.landscape=1]="landscape",(e=x.PdfTextDirection||(x.PdfTextDirection={}))[e.none=0]="none",e[e.leftToRight=1]="leftToRight",e[e.rightToLeft=2]="rightToLeft",(e=x.PdfSubSuperScript||(x.PdfSubSuperScript={}))[e.none=0]="none",e[e.superScript=1]="superScript",e[e.subScript=2]="subScript",(e=x.PdfBlendMode||(x.PdfBlendMode={}))[e.normal=0]="normal",e[e.multiply=1]="multiply",e[e.screen=2]="screen",e[e.overlay=3]="overlay",e[e.darken=4]="darken",e[e.lighten=5]="lighten",e[e.colorDodge=6]="colorDodge",e[e.colorBurn=7]="colorBurn",e[e.hardLight=8]="hardLight",e[e.softLight=9]="softLight",e[e.difference=10]="difference",e[e.exclusion=11]="exclusion",e[e.hue=12]="hue",e[e.saturation=13]="saturation",e[e.color=14]="color",e[e.luminosity=15]="luminosity",(e=x.PdfFillMode||(x.PdfFillMode={}))[e.winding=0]="winding",e[e.alternate=1]="alternate",(e=x.PdfDashStyle||(x.PdfDashStyle={}))[e.solid=0]="solid",e[e.dash=1]="dash",e[e.dot=2]="dot",e[e.dashDot=3]="dashDot",e[e.dashDotDot=4]="dashDotDot",e[e.custom=5]="custom",(e=x.PdfLineCap||(x.PdfLineCap={}))[e.flat=0]="flat",e[e.round=1]="round",e[e.square=2]="square",(e=x.PdfLineJoin||(x.PdfLineJoin={}))[e.miter=0]="miter",e[e.round=1]="round",e[e.bevel=2]="bevel",(e=x._PdfWordWrapType||(x._PdfWordWrapType={}))[e.none=0]="none",e[e.word=1]="word",e[e.wordOnly=2]="wordOnly",e[e.character=3]="character",(e=x._FontDescriptorFlag||(x._FontDescriptorFlag={}))[e.fixedPitch=1]="fixedPitch",e[e.serif=2]="serif",e[e.symbolic=4]="symbolic",e[e.script=8]="script",e[e.nonSymbolic=32]="nonSymbolic",e[e.italic=64]="italic",e[e.forceBold=262144]="forceBold",(e=x._TrueTypeCmapFormat||(x._TrueTypeCmapFormat={}))[e.apple=0]="apple",e[e.microsoft=4]="microsoft",e[e.trimmed=6]="trimmed",(e=x._TrueTypeCmapEncoding||(x._TrueTypeCmapEncoding={}))[e.unknown=0]="unknown",e[e.symbol=1]="symbol",e[e.unicode=2]="unicode",e[e.macintosh=3]="macintosh",(e=x._TrueTypePlatformID||(x._TrueTypePlatformID={}))[e.appleUnicode=0]="appleUnicode",e[e.macintosh=1]="macintosh",e[e.iSO=2]="iSO",e[e.microsoft=3]="microsoft",(e=x._TrueTypeMicrosoftEncodingID||(x._TrueTypeMicrosoftEncodingID={}))[e[void 0]=0]="undefined",e[e.unicode=1]="unicode",(e=x._TrueTypeMacintoshEncodingID||(x._TrueTypeMacintoshEncodingID={}))[e.roman=0]="roman",e[e.japanese=1]="japanese",e[e.chinese=2]="chinese",(e=x._TrueTypeCompositeGlyphFlag||(x._TrueTypeCompositeGlyphFlag={}))[e.Arg1And2AreWords=1]="Arg1And2AreWords",e[e.ArgsAreXyValues=2]="ArgsAreXyValues",e[e.RoundXyToGrid=4]="RoundXyToGrid",e[e.WeHaveScale=8]="WeHaveScale",e[e.Reserved=16]="Reserved",e[e.MoreComponents=32]="MoreComponents",e[e.WeHaveAnXyScale=64]="WeHaveAnXyScale",e[e.WeHaveTwoByTwo=128]="WeHaveTwoByTwo",e[e.WeHaveInstructions=256]="WeHaveInstructions",e[e.UseMyMetrics=512]="UseMyMetrics",(e=x._ImageFormat||(x._ImageFormat={}))[e.unknown=0]="unknown",e[e.bmp=1]="bmp",e[e.emf=2]="emf",e[e.gif=3]="gif",e[e.jpeg=4]="jpeg",e[e.png=5]="png",e[e.wmf=6]="wmf",e[e.icon=7]="icon",(e=x._TokenType||(x._TokenType={}))[e.none=0]="none",e[e.comment=1]="comment",e[e.number=2]="number",e[e.real=3]="real",e[e.string=4]="string",e[e.hexString=5]="hexString",e[e.unicodeString=6]="unicodeString",e[e.unicodeHexString=7]="unicodeHexString",e[e.name=8]="name",e[e.operator=9]="operator",e[e.beginArray=10]="beginArray",e[e.endArray=11]="endArray",e[e.eof=12]="eof",(e=x.PdfTextStyle||(x.PdfTextStyle={}))[e.regular=0]="regular",e[e.italic=1]="italic",e[e.bold=2]="bold",(e=x._PdfColorSpace||(x._PdfColorSpace={}))[e.rgb=0]="rgb",e[e.cmyk=1]="cmyk",e[e.grayScale=2]="grayScale",e[e.indexed=3]="indexed",(e=x.PdfNumberStyle||(x.PdfNumberStyle={}))[e.none=0]="none",e[e.numeric=1]="numeric",e[e.lowerLatin=2]="lowerLatin",e[e.lowerRoman=3]="lowerRoman",e[e.upperLatin=4]="upperLatin",e[e.upperRoman=5]="upperRoman",(e=x.PdfUnorderedListStyle||(x.PdfUnorderedListStyle={}))[e.none=0]="none",e[e.disk=1]="disk",e[e.square=2]="square",e[e.asterisk=3]="asterisk",e[e.circle=4]="circle",(e=x.PdfLayoutType||(x.PdfLayoutType={}))[e.paginate=0]="paginate",e[e.onePage=1]="onePage",(e=x.PdfLayoutBreakType||(x.PdfLayoutBreakType={}))[e.fitPage=0]="fitPage",e[e.fitElement=1]="fitElement",(e=x.PdfListMarkerAlignment||(x.PdfListMarkerAlignment={}))[e.left=0]="left",e[e.right=1]="right",(e=x.PdfPrintState||(x.PdfPrintState={}))[e.alwaysPrint=0]="alwaysPrint",e[e.neverPrint=1]="neverPrint",e[e.printWhenVisible=2]="printWhenVisible",Object.defineProperty(t.prototype,"buffer",{get:function(){return this._flush(),this._buffer},enumerable:!0,configurable:!0}),t.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('"?>')},t.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)},t.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)},t.prototype._writeElementString=function(t,e,i,n){this._writeStartElement(t,i,n),null!=e&&0!==e.length&&this._writeString(e),this._writeEndElement()},t.prototype._writeAttributeString=function(t,e,i,n){this._writeStartAttribute(t,e,i,n),this._writeStringInternal(e,!0),this._writeEndAttribute()},t.prototype._writeString=function(t){this._writeInternal(t,!1)},t.prototype._writeRaw=function(t){this._writeInternal(t,!0)},t.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)}},t.prototype._save=function(){for(;0<this._elementStack.length-1;)this._writeEndElement();return""!==this._bufferText&&this._flush(),this._buffer},t.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},t.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=""}},t.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)},t.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)},t.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)},t.prototype._writeEndAttribute=function(){this._currentState="StartElement",this._bufferText+='"'},t.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 z),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=[]},t.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+=" />")},t.prototype._writeStartAttributeInternal=function(t,e){this._bufferText+=" ",null!=t&&0<t.length&&(this._rawText(t),this._bufferText+=":"),this._rawText(e),this._bufferText+='="'},t.prototype._writeNamespaceDeclaration=function(t,e){this._skipNamespace||(this._writeStartNamespaceDeclaration(t),this._writeStringInternal(e,!0),this._bufferText+='"')},t.prototype._writeStartNamespaceDeclaration=function(t){null==t||0===t.length?this._rawText(' xmlns="'):(this._rawText(" xmlns:"),this._rawText(t),this._bufferText+="=",this._bufferText+='"')},t.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)},t.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},t.prototype._rawText=function(t){this._bufferText+=t},t.prototype._addNamespace=function(t,e,i){var n=this._namespaceStack.length;this._namespaceStack.push(new j),this._namespaceStack[n]._set(t,e,i)},t.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},t.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},t.prototype._lookupNamespaceIndex=function(t){for(var e=this._namespaceStack.length-1;0<=e;e--)if(this._namespaceStack[e]._prefix===t)return e;return-1},t.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)},t.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")},t.prototype._addAttribute=function(t,e,i){var n=this._attributeStack.length;this._attributeStack.push(new W),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")},t.prototype._skipPushAndWrite=function(t,e,i){this._addAttribute(t,e,i),this._writeStartAttributeInternal(t,e)},t.prototype._checkName=function(t){if(/[ !@#$%^&*()+\=\[\]{};':"\\|,<>\/?]/.test(t))throw new Error("InvalidArgumentException: invalid name character")};var E=t;function t(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 j),this._elementStack.push(new z),this._namespaceStack[0]._set("xmlns","http://www.w3.org/2000/xmlns/","Special"),this._namespaceStack.push(new j),this._namespaceStack[1]._set("xml","http://www.w3.org/XML/1998/namespace","Special"),this._namespaceStack.push(new j),this._namespaceStack[2]._set("","","Implied"),this._elementStack[0]._set("","","",this._namespaceStack.length-1)),this._attributeStack=[]}V.prototype._set=function(t,e,i){this._prefix=t,this._namespaceUri=e,this._kind=i},V.prototype._destroy=function(){this._prefix=void 0,this._namespaceUri=void 0,this._kind=void 0};var j=V;function V(){}U.prototype._set=function(t,e,i,n){this._previousTop=n,this._prefix=t,this._namespaceUri=i,this._localName=e},U.prototype._destroy=function(){this._previousTop=void 0,this._prefix=void 0,this._localName=void 0,this._namespaceUri=void 0};var z=U;function U(){}H.prototype._set=function(t,e,i){this._prefix=t,this._namespaceUri=i,this._localName=e},H.prototype._isDuplicate=function(t,e,i){return this._localName===e&&(this._prefix===t||this._namespaceUri===i)},H.prototype._destroy=function(){this._prefix=void 0,this._namespaceUri=void 0,this._localName=void 0};var W=H;function H(){}G=function(t,e){return(G=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 G,e=function(t,e){function i(){this.constructor=t}G(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},K=(X.prototype._exportFormFieldsData=function(t){var e="";if(null!=t&&t.export){var i=Ss(t._dictionary,"FT",!1,!0,"Parent");if(i&&null!==i.name&&void 0!==i.name){var n,r,s,a,o,h=this._getEncodedFontDictionary(t._dictionary),c=t.name,_=(null!=h&&(c=this._getEncodedValue(c,h)),void 0),d=void 0;switch(i.name){case"Tx":null!=(e=Ss(t._dictionary,"V",!1,!0,"Parent"))?(e=this._getEncodedValue(e,h),this._table.set(c,e)):this._exportEmptyFields&&this._table.set(c,e="");break;case"Ch":if(null!=(_=Ss(t._dictionary,"V",!0,!0,"Parent"))&&(d=this._getExportValue(_)),null!=(d=!_&&t._dictionary.has("I")&&(t instanceof ti||t instanceof Ye)?t._obtainSelectedValue():d)){if("string"==typeof d&&""!==d)e=d=this._getEncodedValue(d,h),this._table.set(c,e);else if(d instanceof Array&&0<d.length){for(var p=[],l=0;l<d.length;l++)p.push(this._getEncodedValue(d[l],h));return this._table.set(c,p),p}}else this._exportEmptyFields&&this._table.set(c,e="");break;case"Btn":null!=(_=Ss(t._dictionary,"V",!1,!0,"Parent"))?null!=(n=this._getExportValue(_,t))&&""!==n?(o=void 0,t instanceof Ge&&(o=t),(!t._dictionary.has("Opt")||null!=o&&-1===o.selectedIndex||t._dictionary.has("Opt")&&(r=t._dictionary.getArray("Opt"),null!=(s=Number(n))&&!Number.isNaN(s)||(s=0),null!=r)&&(a=void 0,null!=(n=null!=(a=o?r[o.selectedIndex]:r[s])?a:n))&&""!==n)&&(e=n=this._getEncodedValue(n,h),this._table.set(c,e))):(t instanceof Ge||t instanceof Ue)&&(e=this._exportEmptyFields?n:"Off",this._table.set(c,e)):t instanceof Ge?(e=(e=t._getAppearanceStateValue())||(this._exportEmptyFields?"":"Off"),this._table.set(c,e)):(o=void 0,(o=(t.itemAt(t._defaultIndex)||t)._dictionary)&&o.has("AS")?(e=o.get("AS").name,this._table.set(c,e)):this._exportEmptyFields&&this._table.set(c,e=""))}}}return e},X.prototype._exportFormFieldData=function(t){var e=Ss(t._dictionary,"FT",!1,!0,"Parent");if(e&&null!==e.name&&void 0!==e.name){var i,n,r,s,a,o=this._getEncodedFontDictionary(t._dictionary),h=t.name,c=(null!=o&&(h=this._getEncodedValue(h,o)),void 0),_=void 0;switch(e.name){case"Tx":c=Ss(t._dictionary,"V",!1,!0,"Parent"),this._asPerSpecification?t._dictionary.has("RV")?null!=(c=Ss(t._dictionary,"RV",!1,!0,"Parent"))&&(c+=this._key,this._formKey=this._key,this._table.set(h,c)):null!=c&&(a=c=this._getEncodedValue(c,o),t instanceof Me&&t.multiLine&&(c=a=(a=a.replace("\n","")).replace("\r","\r\n")),this._table.set(h,c)):null!=c?(c=this._getEncodedValue(c,o),this._table.set(h,c)):this._exportEmptyFields&&this._table.set(h,"");break;case"Ch":if(_=Ss(t._dictionary,"V",!0,!0,"Parent"),this._asPerSpecification){if(t instanceof qe)if(Array.isArray(_))this._table.set(h,_);else if("string"==typeof _)_=this._getEncodedValue(_,o),this._table.set(h,_);else if(null==_&&t._dictionary.has("I"))if(null!=(l=t._obtainSelectedValue()))if("string"==typeof l&&""!==l)l=this._getEncodedValue(l,o),this._table.set(h,c);else if(l instanceof Array&&0<l.length){for(var d=[],p=0;p<l.length;p++)d.push(this._getEncodedValue(l[p],o));this._table.set(h,d)}}else{var l=void 0;if(null!=_&&(l=this._getExportValue(_)),null!=(l=!_&&t._dictionary.has("I")&&(t instanceof ti||t instanceof Ye)?t._obtainSelectedValue():l))if("string"==typeof l&&""!==l)l=this._getEncodedValue(l,o),this._table.set(h,l);else if(l instanceof Array&&0<l.length){for(d=[],p=0;p<l.length;p++)d.push(this._getEncodedValue(l[p],o));this._table.set(h,d)}else this._exportEmptyFields&&this._table.set(h,"");else this._exportEmptyFields&&this._table.set(h,"")}break;case"Btn":null!=(_=Ss(t._dictionary,"V",!1,!0,"Parent"))?null!=(s=this._getExportValue(_,t))&&""!==s?(this._asPerSpecification&&"XML"!==this._format&&(s=ys(s)),a=void 0,t instanceof Ge&&(a=t),(!t._dictionary.has("Opt")||null!=a&&-1===a.selectedIndex||t._dictionary.has("Opt")&&(i=t._dictionary.getArray("Opt"),null!=(n=Number(s))&&!Number.isNaN(n)||(n=0),null!=i)&&(r=void 0,null!=(s=null!=(r=a?i[a.selectedIndex]:i[n])?r:s))&&""!==s)&&(s=this._getEncodedValue(s,o),this._table.set(h,s))):(t instanceof Ge||t instanceof Ue)&&(this._exportEmptyFields?this._table.set(h,s):this._table.set(h,"Off")):t instanceof Ge?(s=(s=t._getAppearanceStateValue())||(this._exportEmptyFields?"":"Off"),this._table.set(h,s)):(a=void 0,(a=(t.itemAt(t._defaultIndex)||t)._dictionary)&&a.has("AS")?this._table.set(h,a.get("AS").name):this._exportEmptyFields&&this._table.set(h,""))}}},X.prototype._getAnnotationType=function(t){var e="";return e=t&&t.has("Subtype")&&(t=t.get("Subtype"))?t.name:e},X.prototype._getValue=function(t,e){void 0===e&&(e=!1);var i="";if(null!=t)if(t instanceof B)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},X.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},X.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},X.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},X.prototype._getEncodedValue=function(t,e){var n,r=this,s=t;if(null!==this._encodeDictionary&&void 0!==this._encodeDictionary)return n=new J(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 O(this._crossReference),i=(a.set("Differences",i.get("Differences")),this._crossReference._getNextReference()),a=(this._crossReference._cacheMap.set(i,a),new O(this._crossReference));if(a.set("Subtype",B.get("Type1")),a.set("Encoding",i),null!=(n=new J(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 O?i=e:e instanceof m&&null!=(e=r._crossReference._fetch(e))&&e instanceof O&&(i=e),i&&(n=new J(i),o=r._replaceNotUsedCharacters(s,n),h=!0))}),!h)return o}return s},X.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},X.prototype._getExportValue=function(t,e){var i,n;if(null!=t)if(null!=e)t instanceof B?i=t.name:"string"==typeof t&&(i=t),null!=i&&""!==i&&e instanceof Ge&&-1!==e.selectedIndex&&null!=(e=e.itemAt(e.selectedIndex))&&e.value===i&&(i=e.value);else if(t instanceof B)i=t.name;else if("string"==typeof t)i=t;else if(Array.isArray(t))return n=[],t.forEach(function(t){t instanceof B?n.push(t.name):"string"==typeof t&&n.push(t)}),n;return i},X.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))},X.prototype._handlePopup=function(t,e,i,n){var r;i&&i.has("Popup")&&(r=i.getRaw("Popup"),i=i.get("Popup"))&&i instanceof O&&(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))},X.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))})},X.prototype._importFieldData=function(t,e){if(null!=e&&0<e.length&&null!=t&&!t.readOnly){var i=e[0];if(t instanceof Me)null!=i&&(t instanceof Me&&t.multiLine&&(i=(i=i.replace("\r\n","\r")).replace("\n","\r")),t.text=i);else if(t instanceof ti||t instanceof Ye){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 Ye)&&this._asPerSpecification&&t._dictionary.has("AP")&&(delete t._dictionary._map.AP,t._dictionary._updated=!0)}else if(t instanceof Ue){e=i.toLowerCase();this._containsExportValue(i,t)||"on"===e||"yes"===e?t.checked=!0:t.checked=!1}else if(t instanceof Ge){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)}}},X.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!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},X.prototype._checkSelected=function(t,e){if(t&&t.has("AP")){t=t.get("AP");if(t&&t instanceof O&&t.has("N")){t=t.get("N");if(t&&t instanceof O&&t.has(e)&&"off"!==e.toLocaleLowerCase()&&"no"!==e.toLocaleLowerCase())return!0}}return!1},X.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},X);function X(){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}e(i,q=K),i.prototype._exportAnnotations=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!0,this._save()},i.prototype._exportFormFields=function(t){return this._document=t,this._crossReference=t._crossReference,this._isAnnotationExport=!1,this._key=Vs(),this._save()},i.prototype._save=function(){var t=new E;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 Ui&&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},i.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()},i.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()})},i.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[t]),r=r[t]):e===n.length-1?r.set(t,i):(e=new Map,r.set(t,e),r=e)}):r.set(t,i)}),e},i.prototype._checkAnnotationType=function(t){return void 0!==t._type&&-1!==this._annotationTypes.indexOf(t._type)},i.prototype._exportAnnotationData=function(t,e,i){t._dictionary&&!(t instanceof Gi||t instanceof tn||t instanceof Yi||t instanceof qi||t instanceof on)&&this._writeAnnotationData(e,i,t)},i.prototype._writeAnnotationData=function(t,e,i){var n,r=!1,i=i instanceof _i?(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].toString()+","+a[1].toString()),t._writeAttributeString("end",a[2].toString()+","+a[3].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=[]}},i.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 O)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(vs(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=fs(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")&&(p=this._getValue(t.get("CreationDate")),s._writeAttributeString("creation",p)),t.has("ModificationDate")&&(p=this._getValue(t.get("ModificationDate")),s._writeAttributeString("modification",p)),t.has("Size")&&s._writeAttributeString("size",this._getValue(t.get("Size"))),t.has("CheckSum"))&&(t=fs(v(p=this._getValue(t.get("CheckSum")))),s._writeAttributeString("checksum",t)),o=fs(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 p="",l=0;l<d-1;l++)p+=this._getValue(_[l])+(l%2!=0?";":",");(p+=this._getValue(_[d-1]))&&""!==p&&s._writeRaw(p)}}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 u=n.getArray("InkList");if(u&&0<u.length){s._writeStartElement("inklist");for(var f=0;f<u.length;f++)s._writeElementString("gesture",this._getValue(u[f]));s._writeEndElement()}}n.has("RC")&&(p=n.get("RC"))&&""!==p&&(0<(o=p.indexOf("<body"))&&(p=p.substring(o)),this._writeRawData(s,"contents-richtext",p)),n.has("Contents")&&(p=n.get("Contents"))&&0<p.length&&(s._writeStartElement("contents"),s._writeString(p),s._writeEndElement())},i.prototype._getAppearanceString=function(t){var e=new E(!0),t=(e._writeStartElement("DICT"),e._writeAttributeString("KEY","AP"),this._writeAppearanceDictionary(e,t),e._writeEndElement(),e.buffer);return e._destroy(),t},i.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)})},i.prototype._writeObject=function(t,e,i,n,r){var s,a;null!=e&&(e instanceof B?(this._writePrefix(t,"NAME",n),t._writeAttributeString("VAL",e.name),t._writeEndElement()):Array.isArray(e)?(this._writePrefix(t,"ARRAY",n),i.has(n)?this._writeArray(t,i.getArray(n),i):this._writeArray(t,e,i),t._writeEndElement()):"string"==typeof e?(this._writePrefix(t,"STRING",n),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 O?(this._writePrefix(t,"DICT",n),this._writeAppearanceDictionary(t,e),t._writeEndElement()):null===e?(this._writePrefix(t,"NULL",n),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):Ea(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))},i.prototype._writePrefix=function(t,e,i){t._writeStartElement(e),i&&t._writeAttributeString("KEY",i)},i.prototype._writeArray=function(e,t,i){var n=this;t.forEach(function(t){n._writeObject(e,t,i)})},i.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(">",">")},i.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"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 B&&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=as(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(),fs(n));break;default:this._writeAttributeString(t,e.toLowerCase(),i)}},i.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))},i.prototype._writeRawData=function(t,e,i){i&&""!==i&&(t._writeStartElement(e),t._writeRaw(i),t._writeEndElement())},i.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))},i.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"