1 line
774 KiB
Plaintext
1 line
774 KiB
Plaintext
{"version":3,"sources":["webpack://pdfjs-dist/build/pdf/webpack/universalModuleDefinition","webpack://pdfjs-dist/build/pdf/src/display/display_utils.js","webpack://pdfjs-dist/build/pdf/src/shared/util.js","webpack://pdfjs-dist/build/pdf/src/shared/compatibility.js","webpack://pdfjs-dist/build/pdf/src/shared/is_node.js","webpack://pdfjs-dist/build/pdf/src/display/api.js","webpack://pdfjs-dist/build/pdf/src/display/font_loader.js","webpack://pdfjs-dist/build/pdf/src/display/node_utils.js","webpack://pdfjs-dist/build/pdf/src/display/annotation_storage.js","webpack://pdfjs-dist/build/pdf/src/display/api_compatibility.js","webpack://pdfjs-dist/build/pdf/src/display/canvas.js","webpack://pdfjs-dist/build/pdf/src/display/pattern_helper.js","webpack://pdfjs-dist/build/pdf/src/display/worker_options.js","webpack://pdfjs-dist/build/pdf/src/shared/message_handler.js","webpack://pdfjs-dist/build/pdf/src/display/metadata.js","webpack://pdfjs-dist/build/pdf/src/display/optional_content_config.js","webpack://pdfjs-dist/build/pdf/src/display/transport_stream.js","webpack://pdfjs-dist/build/pdf/src/display/annotation_layer.js","webpack://pdfjs-dist/build/pdf/src/shared/scripting_utils.js","webpack://pdfjs-dist/build/pdf/src/display/text_layer.js","webpack://pdfjs-dist/build/pdf/src/display/svg.js","webpack://pdfjs-dist/build/pdf/src/display/xfa_layer.js","webpack://pdfjs-dist/build/pdf/src/display/node_stream.js","webpack://pdfjs-dist/build/pdf/src/display/network_utils.js","webpack://pdfjs-dist/build/pdf/src/display/content_disposition.js","webpack://pdfjs-dist/build/pdf/src/display/network.js","webpack://pdfjs-dist/build/pdf/src/display/fetch_stream.js","webpack://pdfjs-dist/build/pdf/webpack/bootstrap","webpack://pdfjs-dist/build/pdf/src/pdf.js"],"names":["DEFAULT_LINK_REL","SVG_NS","constructor","unreachable","create","reset","canvasAndContext","width","height","destroy","ownerDocument","globalThis","canvas","context","baseUrl","isCompressed","fetch","url","compressionType","CMapCompressionType","reason","_fetchData","isFetchSupported","isValidFetchUrl","document","response","cMapData","stringToBytes","request","XMLHttpRequest","resolve","reject","assert","svg","createElement","offsetX","offsetY","dontFlip","centerX","viewBox","centerY","rotation","rotateA","rotateB","rotateC","rotateD","offsetCanvasX","Math","offsetCanvasY","clone","scale","convertToViewportPoint","convertToViewportRectangle","topLeft","rect","bottomRight","convertToPdfPoint","LinkTarget","NONE","SELF","BLANK","PARENT","TOP","enabled","urlNullRemoved","removeNullCharacters","link","targetStr","ii","i","anchor","query","end","defaultFilename","isDataScheme","warn","reURI","reFilename","splitURI","suggestedFilename","decodeURIComponent","Object","time","name","Date","timeEnd","start","toString","outBuf","longest","duration","Response","protocol","removeScriptElement","script","console","toDateObject","isString","pdfDateStringRegex","matches","year","parseInt","month","day","hour","minute","second","universalTimeRelation","offsetHour","offsetMinute","IDENTITY_MATRIX","FONT_IDENTITY_MATRIX","PermissionFlag","PRINT","MODIFY_CONTENTS","COPY","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","COPY_FOR_ACCESSIBILITY","ASSEMBLE","PRINT_HIGH_QUALITY","TextRenderingMode","FILL","STROKE","FILL_STROKE","INVISIBLE","FILL_ADD_TO_PATH","STROKE_ADD_TO_PATH","FILL_STROKE_ADD_TO_PATH","ADD_TO_PATH","FILL_STROKE_MASK","ADD_TO_PATH_FLAG","ImageKind","GRAYSCALE_1BPP","RGB_24BPP","RGBA_32BPP","AnnotationType","TEXT","LINK","FREETEXT","LINE","SQUARE","CIRCLE","POLYGON","POLYLINE","HIGHLIGHT","UNDERLINE","SQUIGGLY","STRIKEOUT","STAMP","CARET","INK","POPUP","FILEATTACHMENT","SOUND","MOVIE","WIDGET","SCREEN","PRINTERMARK","TRAPNET","WATERMARK","THREED","REDACT","AnnotationStateModelType","MARKED","REVIEW","AnnotationMarkedState","UNMARKED","AnnotationReviewState","ACCEPTED","REJECTED","CANCELLED","COMPLETED","AnnotationReplyType","GROUP","REPLY","AnnotationFlag","HIDDEN","NOZOOM","NOROTATE","NOVIEW","READONLY","LOCKED","TOGGLENOVIEW","LOCKEDCONTENTS","AnnotationFieldFlag","REQUIRED","NOEXPORT","MULTILINE","PASSWORD","NOTOGGLETOOFF","RADIO","PUSHBUTTON","COMBO","EDIT","SORT","FILESELECT","MULTISELECT","DONOTSPELLCHECK","DONOTSCROLL","COMB","RICHTEXT","RADIOSINUNISON","COMMITONSELCHANGE","AnnotationBorderStyleType","SOLID","DASHED","BEVELED","INSET","AnnotationActionEventType","E","X","D","U","Fo","Bl","PO","PC","PV","PI","K","F","V","C","DocumentActionEventType","WC","WS","DS","WP","DP","PageActionEventType","O","StreamType","UNKNOWN","FLATE","LZW","DCT","JPX","JBIG","A85","AHX","CCF","RLX","FontType","TYPE1","TYPE1C","CIDFONTTYPE0","CIDFONTTYPE0C","TRUETYPE","CIDFONTTYPE2","TYPE3","OPENTYPE","TYPE0","MMTYPE1","VerbosityLevel","ERRORS","WARNINGS","INFOS","BINARY","STREAM","OPS","dependency","setLineWidth","setLineCap","setLineJoin","setMiterLimit","setDash","setRenderingIntent","setFlatness","setGState","save","restore","transform","moveTo","lineTo","curveTo","curveTo2","curveTo3","closePath","rectangle","stroke","closeStroke","fill","eoFill","fillStroke","eoFillStroke","closeFillStroke","closeEOFillStroke","endPath","clip","eoClip","beginText","endText","setCharSpacing","setWordSpacing","setHScale","setLeading","setFont","setTextRenderingMode","setTextRise","moveText","setLeadingMoveText","setTextMatrix","nextLine","showText","showSpacedText","nextLineShowText","nextLineSetSpacingShowText","setCharWidth","setCharWidthAndBounds","setStrokeColorSpace","setFillColorSpace","setStrokeColor","setStrokeColorN","setFillColor","setFillColorN","setStrokeGray","setFillGray","setStrokeRGBColor","setFillRGBColor","setStrokeCMYKColor","setFillCMYKColor","shadingFill","beginInlineImage","beginImageData","endInlineImage","paintXObject","markPoint","markPointProps","beginMarkedContent","beginMarkedContentProps","endMarkedContent","beginCompat","endCompat","paintFormXObjectBegin","paintFormXObjectEnd","beginGroup","endGroup","beginAnnotations","endAnnotations","beginAnnotation","endAnnotation","paintJpegXObject","paintImageMaskXObject","paintImageMaskXObjectGroup","paintImageXObject","paintInlineImageXObject","paintInlineImageXObjectGroup","paintImageXObjectRepeat","paintImageMaskXObjectRepeat","paintSolidColorImageMask","constructPath","UNSUPPORTED_FEATURES","unknown","forms","javaScript","signatures","smask","shadingPattern","font","errorTilingPattern","errorExtGState","errorXObject","errorFontLoadType3","errorFontState","errorFontMissing","errorFontTranslate","errorColorSpace","errorOperatorList","errorFontToUnicode","errorFontLoadNative","errorFontBuildPath","errorFontGetPath","errorMarkedContent","PasswordResponses","NEED_PASSWORD","INCORRECT_PASSWORD","verbosity","Number","base","other","absoluteUrl","_isValidProtocol","enumerable","configurable","writable","BaseException","NullCharactersRegExp","str","bytes","length","MAX_ARGUMENT_COUNT","String","strBuf","chunkEnd","chunk","arr","resultLength","arrayByteLength","pos","data","item","itemLength","value","obj","buffer8","view32","IsLittleEndianCached","shadow","isLittleEndian","IsEvalSupportedCached","isEvalSupported","hexNumbers","Array","n","makeHexColor","m1","m2","applyTransform","xt","p","m","yt","applyInverseTransform","d","getAxialAlignedBoundingBox","p1","Util","p2","r","p3","p4","inverseTransform","apply3dTransform","v","singularValueDecompose2dScale","transpose","a","b","c","first","sx","sy","normalizeRect","intersect","orderedX","rect1","rect2","orderedY","result","PDFStringTranslateTable","code","match","buf","char","escape","unescape","encodeURIComponent","arr1","arr2","date","buffer","capability","isSettled","get","contentType","forceDataSchema","URL","type","digits","b1","b2","b3","d1","d2","d3","d4","isNodeJS","process","DEFAULT_RANGE_CHUNK_SIZE","RENDERING_CANCELLED_TIMEOUT","DefaultCanvasFactory","DefaultCMapReaderFactory","createPDFNetworkStream","task","src","source","isArrayBuffer","range","params","rangeTransport","worker","window","isNaN","apiCompatibilityParams","setVerbosityLevel","workerParams","port","GlobalWorkerOptions","PDFWorker","docId","workerIdPromise","_fetchDocument","networkStreamPromise","networkStream","initialData","progressiveDone","contentDispositionFilename","disableRange","disableStream","httpHeaders","withCredentials","rangeChunkSize","messageHandler","transport","Promise","pdfDataRangeTransport","apiVersion","password","disableAutoFetch","maxImageSize","disableFontFace","postMessageTransfers","docBaseUrl","ignoreErrors","fontExtraProperties","enableXfa","PDFDocumentLoadingTask","nextDocumentId","promise","transportDestroyed","addRangeListener","addProgressListener","addProgressiveReadListener","addProgressiveDoneListener","onDataRange","listener","onDataProgress","onDataProgressiveRead","onDataProgressiveDone","transportReady","requestDataRange","abort","annotationStorage","numPages","fingerprint","isPureXfa","getPage","getPageIndex","getDestinations","getDestination","getPageLabels","getPageLayout","getPageMode","getViewerPreferences","getOpenAction","getAttachments","getJavaScript","getJSActions","getOutline","getOptionalContentConfig","getPermissions","getMetadata","getMarkInfo","getData","getDownloadInfo","getStats","cleanup","keepLoadedFonts","loadingParams","loadingTask","saveDocument","arguments","deprecated","getFieldObjects","hasJSActions","getCalculationOrderIds","pdfBug","pageNumber","rotate","ref","userUnit","view","getViewport","getAnnotations","intent","getXfa","render","renderInteractiveForms","imageLayer","canvasFactory","background","includeAnnotationStorage","optionalContentConfigPromise","renderingIntent","intentState","clearTimeout","canvasFactoryInstance","fnArray","argsArray","lastChunk","pageIndex","complete","error","internalRenderTask","callback","objs","commonObjs","operatorList","useRequestAnimationFrame","renderTask","getOperatorList","opListTask","streamTextContent","normalizeWhitespace","disableCombineTextItems","includeMarkedContent","TEXT_CONTENT_CHUNK_SIZE","combineTextItems","highWaterMark","size","textContent","getTextContent","readableStream","reader","pump","items","styles","getStructTree","_destroy","waitOn","force","resetStats","_tryCleanup","renderTasks","_startRenderPage","_renderPageChunk","operatorListChunk","_pumpOperatorList","args","_abortOperatorList","curIntentState","stats","postMessage","cloned","transfers","cloneValue","desc","event","addEventListener","removeEventListener","terminate","pdfWorkerPorts","isWorkerDisabled","nextFakeWorkerId","fallbackWorkerSrc","pdfjsFilePath","mainWorkerMessageHandler","fakeWorkerCapability","loader","getMainThreadWorkerMessageHandler","eval","getWorkerSrc","loadScript","wrapper","_initializeFromPort","_initialize","workerSrc","isSameOrigin","createCDNWrapper","terminateEarly","onWorkerError","sendTest","testObj","info","_setupFakeWorker","setupFakeWorkerGlobal","WorkerMessageHandler","id","workerHandler","fromPort","onUnsupportedFeature","page","terminated","setupMessageHandler","evt","loaded","total","sink","readyReason","headersCapability","fullReader","isStreamingSupported","isRangeSupported","contentLength","rangeReader","pdfInfo","ex","msg","exception","updatePassword","exportedError","exportedData","fontRegistry","registerFont","pageProxy","MAX_IMAGE_SIZE_TO_STORE","imageData","fetched","builtInCMap","_onUnsupportedFeature","pageInfo","filename","getDocJSActions","getPageJSActions","getPageXfa","results","metadata","startCleanup","cleanupSuccessful","_ensureObj","resolved","has","clear","cancel","InternalRenderTask","canvasInRendering","completed","initializeGraphics","transparency","operatorListChanged","_continue","_scheduleNext","_next","version","build","addNativeFontFace","insertRule","styleElement","styleSheet","bind","nativeFontFace","featureId","rule","_queueLoadingCallback","isFontLoadingAPISupported","isSyncFontLoadingSupported","_loadTestFont","_prepareFontLoadEvent","FontLoader","requests","nextRequestId","supported","navigator","otherRequest","setTimeout","done","getLoadTestFont","atob","offset","chunk1","s","chunk2","ctx","called","isFontReady","loadTestFontId","COMMENT_OFFSET","spliceString","CFF_CHECKSUM_OFFSET","XXXX_VALUE","checksum","int32","string32","btoa","names","div","span","translatedData","createNativeFontFace","css","weight","createFontFaceRule","bytesToString","getPathGenerator","cmds","jsBuf","current","NodeCanvasFactory","NodeCMapReaderFactory","Canvas","__non_webpack_require__","fs","getValue","setValue","modified","getAll","objectFromMap","_setModified","resetModified","serializable","compatibilityParams","MIN_FONT_SIZE","MAX_FONT_SIZE","MAX_GROUP_SIZE","COMPILE_TYPE3_GLYPHS","MAX_SIZE_TO_COMPILE","FULL_CHUNK_HEIGHT","LINEWIDTH_SCALE_FACTOR","set","ad_bc","bc_ad","old","prev","cosValue","sinValue","getCanvas","canvasEntry","addContextCurrentTransform","POINT_TO_PROCESS_LIMIT","POINT_TYPES","imgData","width1","points","lineSize","data0","elem","mask","count","j","j0","sum","steps","outlines","coords","p0","step","pp","drawOutline","k","kk","o","l","ll","setCurrentPoint","CanvasGraphics","EXECUTION_TIME","EXECUTION_STEPS","transferMaps","partialChunkHeight","fullChunks","totalChunks","chunkImgData","srcPos","dest","transferMapRed","transferMapGreen","transferMapBlue","transferMapGray","srcLength","dest32","dest32DataLength","fullSrcDiff","white","black","thisChunkHeight","destPos","srcDiff","kEnd","kEndUnrolled","srcByte","hasTransferMaps","elemsInThisChunk","properties","property","sourceCtx","destCtx","alpha","alpha_","r0","g0","b0","maskData","transferMap","layerData","y","hasBackdrop","backdrop","subtype","composeFn","PIXELS_TO_PROCESS","chunkSize","row","chunkHeight","maskCtx","layerCtx","composeSMaskBackdrop","genericComposeSMask","LINE_CAP_STYLES","LINE_JOIN_STYLES","NORMAL_CLIP","EO_CLIP","beginDrawing","transparentCanvas","resetCtxToDefault","viewport","executeOperatorList","executionStartIdx","argsArrayLen","chunkOperations","endTime","stepper","fnId","objsPool","depObjId","continueCallback","endDrawing","states","state","key","beginSMaskGroup","activeSMask","drawnWidth","drawnHeight","cacheId","scratchCanvas","currentCtx","currentTransform","groupCtx","copyCtxState","suspendSMaskGroup","composeSMask","deltaTransform","resumeSMaskGroup","endSMaskGroup","x","ops","xw","yh","consumePath","strokeColor","lineWidth","fillColor","isPatternFill","needRestore","paths","path","fontObj","bold","italic","typeface","browserFontSize","paintChar","textRenderingMode","fontSize","fillStrokeMode","isAddToPathSet","patternFill","addToPath","isFontSubpixelAAEnabled","fontSizeScale","charSpacing","wordSpacing","fontDirection","textHScale","glyphsLength","glyphs","vertical","spacingDir","defaultVMetrics","widthAdvanceScale","simpleFillText","pattern","patternTransform","resetLineWidthToOne","glyph","isNum","restoreNeeded","spacing","character","accent","vmetric","vx","vy","scaledX","scaledY","measuredWidth","characterScaleX","scaledAccentX","scaledAccentY","charWidth","showType3Text","fontMatrix","isTextInvisible","spacingLength","transformed","urx","ury","getColorN_Pattern","IR","color","baseTransform","canvasGraphicsFactory","createCanvasGraphics","getShadingPattern","inv","bl","br","ul","ur","x0","y0","x1","y1","matrix","bbox","group","bounds","canvasBounds","scaleX","scaleY","startTransformInverse","img","maskCanvas","putBinaryImageMask","skewX","skewY","positions","images","image","objId","map","w","h","widthScale","heightScale","imgToPaint","tmpCanvas","tmpCtx","putBinaryImageData","paintWidth","paintHeight","tmpCanvasId","newWidth","newHeight","position","left","top","entry","visible","tag","getSinglePixelWidth","absDet","sqNorm1","sqNorm2","pixelHeight","getCanvasPosition","isContentVisible","svgElement","region","getPattern","owner","applyBoundingBox","grad","colorStop","createMatrix","colors","rowSize","tmp","c1","c2","c3","x2","y2","x3","y3","c1r","c1g","c1b","c2r","c2g","c2b","c3r","c3g","c3b","minY","maxY","xa","car","cag","cab","xb","cbr","cbg","cbb","x1_","x2_","ps","figure","cs","verticesPerRow","rows","cols","q","drawTriangle","_createMeshCanvas","EXPECTED_SCALE","MAX_PATTERN_SIZE","BORDER_SIZE","boundsWidth","boundsHeight","combinedScale","paddedWidth","paddedHeight","cachedCanvases","backgroundColor","drawFigure","matrixScale","temporaryPatternCanvas","PaintType","COLORED","UNCOLORED","createPatternCanvas","xstep","ystep","paintType","tilingType","curMatrixScale","dimx","dimy","graphics","getSizeAndScale","maxSize","TilingPattern","clipBbox","bboxWidth","bboxHeight","setFillAndStrokeStyleToContext","cssColor","domMatrix","CallbackKind","DATA","ERROR","StreamKind","CANCEL","CANCEL_COMPLETE","CLOSE","ENQUEUE","PULL","PULL_COMPLETE","START_COMPLETE","callbackId","wrapReason","action","cbSourceName","cbTargetName","comObj","sourceName","targetName","on","ah","send","sendWithPromise","sendWithStream","streamId","controller","startCapability","startCall","pullCall","cancelCall","isClosed","desiredSize","pull","pullCapability","stream","cancelCapability","_createStreamSink","self","streamSink","enqueue","lastDesiredSize","close","sinkCapability","onPull","onCancel","isCancelled","ready","success","_processStreamMessage","_deleteStreamController","_postMessage","getRaw","_evaluateVisibilityExpression","array","operator","element","isVisible","setVisibility","getOrder","getGroups","getGroup","_onReceiveData","found","_progressiveDataLength","_onProgress","firstReader","_onProgressiveDone","_removeRangeReader","getFullReader","queuedChunks","getRangeReader","cancelAllRequests","isPdfFile","_enqueue","requestCapability","headersReady","read","requestsCapability","parameters","fieldType","isRenderable","ignoreBorder","createQuadrilaterals","_createContainer","container","horizontalRadius","verticalRadius","radius","_createQuadrilaterals","quadrilaterals","savedRect","quadPoint","_createPopup","trigger","popupElement","title","modificationDate","contents","hideWrapper","popup","_renderQuadrilaterals","quadrilateral","addLinkAttributes","target","linkService","rel","linkElement","index","_bindLink","destination","_bindNamedAction","_bindJSAction","jsName","detail","JSON","_getKeyModifier","_setEventListener","baseName","valueGetter","shift","modifier","_setEventListeners","eventName","_dispatchEventFromSandbox","setColor","ColorConverters","commonActions","display","hidden","print","focus","preventScroll","userName","readonly","required","bgColor","fgColor","textColor","borderColor","jsEvent","actions","setPropertyOnSiblings","storage","storedData","valueAsString","elementData","userValue","formattedValue","beforeInputSelectionRange","beforeInputValue","blurListener","selRange","selStart","selEnd","commitKey","willCommit","_blurListener","change","fieldWidth","combWidth","_setTextStyle","TEXT_ALIGNMENT","style","fontColor","checkbox","radio","pdfButtonValue","checked","radioId","selectElement","optionElement","option","isExport","options","getItems","displayValue","exportValue","values","multipleSelection","remove","insert","indices","editable","changeEx","keyDown","IGNORE_TYPES","selector","parentElements","popupLeft","popupTop","BACKGROUND_ENLIGHT","g","dateObject","PDFDateString","_formatContents","lines","line","_toggle","_show","pin","_hide","unpin","borderWidth","square","circle","coordinate","polyline","getFilenameFromUrl","stringToPDFString","_download","sortedAnnotations","popupAnnotations","layer","downloadManager","imageResourcesPath","svgFactory","enableScripting","mouseState","isDown","rendered","update","elements","CMYK_G","G_CMYK","G_RGB","G_HTML","G","makeColorComp","RGB_G","RGB_HTML","R","B","T_HTML","CMYK_RGB","CMYK_HTML","RGB_CMYK","MAX_TEXT_DIVS_TO_RENDER","DEFAULT_FONT_SIZE","DEFAULT_FONT_ASCENT","ascentCache","AllWhitespaceRegexp","cachedAscent","metrics","ascent","descent","ratio","pixels","textDiv","textDivProperties","angle","canvasWidth","hasText","geom","hasEOL","originalTransform","paddingBottom","paddingLeft","paddingRight","paddingTop","tx","fontHeight","fontAscent","getAscent","shouldScaleText","absScaleX","absScaleY","angleCos","angleSin","divWidth","divHeight","right","bottom","textDivs","textDivsLength","t","ts","expanded","expandBounds","divProperties","e","jj","boxScale","findPositiveMin","box","x1New","x2New","expandBoundsLTR","boxes","fakeBoundary","horizon","boundary","maxXNew","horizonPart","affectedBoundary","xNew","changedHorizon","lastBoundary","useBoundary","used","textContentItemsStr","_processItems","len","parent","appendText","_layoutText","fontFamily","_render","timeout","styleCache","textItems","textStyles","expandTextDivs","expandDivs","expand","transformBuf","paddingBuf","divProps","renderParameters","textContentStream","enhanceTextSelection","SVGGraphics","SVG_DEFAULTS","fontStyle","fontWeight","XML_NS","XLINK_NS","convertImgDataToPng","PNG_HEADER","CHUNK_WRAPPER_SIZE","crcTable","crc","body","crc32","deflateSyncUncompressed","input","Buffer","output","level","literals","maxBlockLength","deflateBlocks","idat","pi","adler","adler32","colorType","bitDepth","offsetLiterals","offsetBytes","kind","ihdr","deflateSync","pngLength","writePngChunk","createObjectURL","encode","opTree","opListElement","fn","pf","clipCount","maskCount","shadingCount","loadDependencies","transformMatrix","getSVG","convertOpList","operatorIdMapping","opList","opListToTree","executeOpTree","opTreeElement","lineWidthScale","textMatrix","pm","addFontStyle","details","setStrokeAlpha","setFillAlpha","_makeColorN_Pattern","_makeTilingPattern","tilingId","txstep","tystep","tiling","tx1","ty1","_makeShadingPattern","shadingId","colorStops","point0","point1","gradient","focalPoint","circlePoint","focalRadius","circleRadius","stop","op","clipId","clipPath","clipElement","_setStrokeAttributes","dashArray","imgSrc","cliprect","imgEl","definitions","rootGroup","_ensureClipGroup","clipGroup","_ensureTransformGroup","setupStorage","html","setAttributes","attributes","root","rootHtml","stack","rootDiv","coeffs","child","childHtml","http","https","fileUriRegex","parsedUrl","parseUrl","_error","_setReadableStream","auth","host","method","handleResponse","getResponseHeader","isHttp","suggestedLength","extractFilenameFromHeader","createRequestOptions","stat","returnValues","allowRangeRequests","contentEncoding","contentDisposition","getFilenameFromContentDispositionHeader","status","needsEncodingFixup","toParamRegExp","rfc2616unquote","rfc5987decode","rfc2047decode","fixupEncoding","rfc2231getparam","decoder","fatal","textdecode","iter","parts","part","quotindex","encodingend","extvalue","encoding","langvalue","text","OK_RESPONSE","PARTIAL_CONTENT_RESPONSE","xhr","requestRange","listeners","requestFull","xhrId","pendingRequest","onProgress","onStateChange","xhrStatus","ok_response_on_range_request","getArrayBuffer","rangeHeader","begin","getRequestXhr","isPendingRequest","abortRequest","_onRangeRequestReaderClosed","onHeadersReceived","onDone","onError","manager","_onHeadersReceived","fullRequestXhrId","fullRequestXhr","_onDone","_onError","createResponseStatusError","_close","signal","abortController","mode","credentials","redirect","headers","createHeaders","createFetchOptions","validateResponseStatus","pdfjsVersion","pdfjsBuild","require","PDFNodeStream","setPDFNetworkStreamFactory","PDFNetworkStream","PDFFetchStream"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;;;ACKA;;AAYA,MAAMA,mBA3BN,8BA2BA;;AACA,MAAMC,SA5BN,4BA4BA;;AAEA,wBAAwB;AACtBC,gBAAc;AACZ,QAAI,qBAAJ,mBAA4C;AAC1CC,6BAD0C,sCAC1CA;AAFU;AADQ;;AAOtBC,wBAAsB;AACpBD,2BADoB,kCACpBA;AARoB;;AAWtBE,yCAAuC;AACrC,QAAI,CAACC,iBAAL,QAA8B;AAC5B,YAAM,UADsB,yBACtB,CAAN;AAFmC;;AAIrC,QAAIC,cAAcC,UAAlB,GAA+B;AAC7B,YAAM,UADuB,qBACvB,CAAN;AALmC;;AAOrCF,oCAPqC,KAOrCA;AACAA,qCARqC,MAQrCA;AAnBoB;;AAsBtBG,4BAA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ModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"pdfjs-dist/build/pdf\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pdfjs-dist/build/pdf\"] = factory();\n\telse\n\t\troot[\"pdfjs-dist/build/pdf\"] = factory();\n})(this, function() {\nreturn ","/* Copyright 2015 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n assert,\n BaseException,\n CMapCompressionType,\n isString,\n removeNullCharacters,\n stringToBytes,\n unreachable,\n Util,\n warn,\n} from \"../shared/util.js\";\n\nconst DEFAULT_LINK_REL = \"noopener noreferrer nofollow\";\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nclass BaseCanvasFactory {\n constructor() {\n if (this.constructor === BaseCanvasFactory) {\n unreachable(\"Cannot initialize BaseCanvasFactory.\");\n }\n }\n\n create(width, height) {\n unreachable(\"Abstract method `create` called.\");\n }\n\n reset(canvasAndContext, width, height) {\n if (!canvasAndContext.canvas) {\n throw new Error(\"Canvas is not specified\");\n }\n if (width <= 0 || height <= 0) {\n throw new Error(\"Invalid canvas size\");\n }\n canvasAndContext.canvas.width = width;\n canvasAndContext.canvas.height = height;\n }\n\n destroy(canvasAndContext) {\n if (!canvasAndContext.canvas) {\n throw new Error(\"Canvas is not specified\");\n }\n // Zeroing the width and height cause Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n canvasAndContext.canvas.width = 0;\n canvasAndContext.canvas.height = 0;\n canvasAndContext.canvas = null;\n canvasAndContext.context = null;\n }\n}\n\nclass DOMCanvasFactory extends BaseCanvasFactory {\n constructor({ ownerDocument = globalThis.document } = {}) {\n super();\n this._document = ownerDocument;\n }\n\n create(width, height) {\n if (width <= 0 || height <= 0) {\n throw new Error(\"Invalid canvas size\");\n }\n const canvas = this._document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n canvas.width = width;\n canvas.height = height;\n return {\n canvas,\n context,\n };\n }\n}\n\nclass BaseCMapReaderFactory {\n constructor({ baseUrl = null, isCompressed = false }) {\n if (this.constructor === BaseCMapReaderFactory) {\n unreachable(\"Cannot initialize BaseCMapReaderFactory.\");\n }\n this.baseUrl = baseUrl;\n this.isCompressed = isCompressed;\n }\n\n async fetch({ name }) {\n if (!this.baseUrl) {\n throw new Error(\n 'The CMap \"baseUrl\" parameter must be specified, ensure that ' +\n 'the \"cMapUrl\" and \"cMapPacked\" API parameters are provided.'\n );\n }\n if (!name) {\n throw new Error(\"CMap name must be specified.\");\n }\n const url = this.baseUrl + name + (this.isCompressed ? \".bcmap\" : \"\");\n const compressionType = this.isCompressed\n ? CMapCompressionType.BINARY\n : CMapCompressionType.NONE;\n\n return this._fetchData(url, compressionType).catch(reason => {\n throw new Error(\n `Unable to load ${this.isCompressed ? \"binary \" : \"\"}CMap at: ${url}`\n );\n });\n }\n\n /**\n * @private\n */\n _fetchData(url, compressionType) {\n unreachable(\"Abstract method `_fetchData` called.\");\n }\n}\n\nclass DOMCMapReaderFactory extends BaseCMapReaderFactory {\n _fetchData(url, compressionType) {\n if (\n (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n (isFetchSupported() && isValidFetchUrl(url, document.baseURI))\n ) {\n return fetch(url).then(async response => {\n if (!response.ok) {\n throw new Error(response.statusText);\n }\n let cMapData;\n if (this.isCompressed) {\n cMapData = new Uint8Array(await response.arrayBuffer());\n } else {\n cMapData = stringToBytes(await response.text());\n }\n return { cMapData, compressionType };\n });\n }\n\n // The Fetch API is not supported.\n return new Promise((resolve, reject) => {\n const request = new XMLHttpRequest();\n request.open(\"GET\", url, true);\n\n if (this.isCompressed) {\n request.responseType = \"arraybuffer\";\n }\n request.onreadystatechange = () => {\n if (request.readyState !== XMLHttpRequest.DONE) {\n return;\n }\n if (request.status === 200 || request.status === 0) {\n let cMapData;\n if (this.isCompressed && request.response) {\n cMapData = new Uint8Array(request.response);\n } else if (!this.isCompressed && request.responseText) {\n cMapData = stringToBytes(request.responseText);\n }\n if (cMapData) {\n resolve({ cMapData, compressionType });\n return;\n }\n }\n reject(new Error(request.statusText));\n };\n\n request.send(null);\n });\n }\n}\n\nclass DOMSVGFactory {\n create(width, height) {\n assert(width > 0 && height > 0, \"Invalid SVG dimensions\");\n\n const svg = document.createElementNS(SVG_NS, \"svg:svg\");\n svg.setAttribute(\"version\", \"1.1\");\n svg.setAttribute(\"width\", width + \"px\");\n svg.setAttribute(\"height\", height + \"px\");\n svg.setAttribute(\"preserveAspectRatio\", \"none\");\n svg.setAttribute(\"viewBox\", \"0 0 \" + width + \" \" + height);\n\n return svg;\n }\n\n createElement(type) {\n assert(typeof type === \"string\", \"Invalid SVG element type\");\n\n return document.createElementNS(SVG_NS, type);\n }\n}\n\n/**\n * @typedef {Object} PageViewportParameters\n * @property {Array<number>} viewBox - The xMin, yMin, xMax and\n * yMax coordinates.\n * @property {number} scale - The scale of the viewport.\n * @property {number} rotation - The rotation, in degrees, of the viewport.\n * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. The\n * default value is `0`.\n * @property {number} [offsetY] - The vertical, i.e. y-axis, offset. The\n * default value is `0`.\n * @property {boolean} [dontFlip] - If true, the y-axis will not be flipped.\n * The default value is `false`.\n */\n\n/**\n * @typedef {Object} PageViewportCloneParameters\n * @property {number} [scale] - The scale, overriding the one in the cloned\n * viewport. The default value is `this.scale`.\n * @property {number} [rotation] - The rotation, in degrees, overriding the one\n * in the cloned viewport. The default value is `this.rotation`.\n * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.\n * The default value is `this.offsetX`.\n * @property {number} [offsetY] - The vertical, i.e. y-axis, offset.\n * The default value is `this.offsetY`.\n * @property {boolean} [dontFlip] - If true, the x-axis will not be flipped.\n * The default value is `false`.\n */\n\n/**\n * PDF page viewport created based on scale, rotation and offset.\n */\nclass PageViewport {\n /**\n * @param {PageViewportParameters}\n */\n constructor({\n viewBox,\n scale,\n rotation,\n offsetX = 0,\n offsetY = 0,\n dontFlip = false,\n }) {\n this.viewBox = viewBox;\n this.scale = scale;\n this.rotation = rotation;\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n // creating transform to convert pdf coordinate system to the normal\n // canvas like coordinates taking in account scale and rotation\n const centerX = (viewBox[2] + viewBox[0]) / 2;\n const centerY = (viewBox[3] + viewBox[1]) / 2;\n let rotateA, rotateB, rotateC, rotateD;\n // Normalize the rotation, by clamping it to the [0, 360) range.\n rotation %= 360;\n if (rotation < 0) {\n rotation += 360;\n }\n switch (rotation) {\n case 180:\n rotateA = -1;\n rotateB = 0;\n rotateC = 0;\n rotateD = 1;\n break;\n case 90:\n rotateA = 0;\n rotateB = 1;\n rotateC = 1;\n rotateD = 0;\n break;\n case 270:\n rotateA = 0;\n rotateB = -1;\n rotateC = -1;\n rotateD = 0;\n break;\n case 0:\n rotateA = 1;\n rotateB = 0;\n rotateC = 0;\n rotateD = -1;\n break;\n default:\n throw new Error(\n \"PageViewport: Invalid rotation, must be a multiple of 90 degrees.\"\n );\n }\n\n if (dontFlip) {\n rotateC = -rotateC;\n rotateD = -rotateD;\n }\n\n let offsetCanvasX, offsetCanvasY;\n let width, height;\n if (rotateA === 0) {\n offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;\n offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;\n width = Math.abs(viewBox[3] - viewBox[1]) * scale;\n height = Math.abs(viewBox[2] - viewBox[0]) * scale;\n } else {\n offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;\n offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;\n width = Math.abs(viewBox[2] - viewBox[0]) * scale;\n height = Math.abs(viewBox[3] - viewBox[1]) * scale;\n }\n // creating transform for the following operations:\n // translate(-centerX, -centerY), rotate and flip vertically,\n // scale, and translate(offsetCanvasX, offsetCanvasY)\n this.transform = [\n rotateA * scale,\n rotateB * scale,\n rotateC * scale,\n rotateD * scale,\n offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,\n offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY,\n ];\n\n this.width = width;\n this.height = height;\n }\n\n /**\n * Clones viewport, with optional additional properties.\n * @param {PageViewportCloneParameters} [params]\n * @returns {PageViewport} Cloned viewport.\n */\n clone({\n scale = this.scale,\n rotation = this.rotation,\n offsetX = this.offsetX,\n offsetY = this.offsetY,\n dontFlip = false,\n } = {}) {\n return new PageViewport({\n viewBox: this.viewBox.slice(),\n scale,\n rotation,\n offsetX,\n offsetY,\n dontFlip,\n });\n }\n\n /**\n * Converts PDF point to the viewport coordinates. For examples, useful for\n * converting PDF location into canvas pixel coordinates.\n * @param {number} x - The x-coordinate.\n * @param {number} y - The y-coordinate.\n * @returns {Object} Object containing `x` and `y` properties of the\n * point in the viewport coordinate space.\n * @see {@link convertToPdfPoint}\n * @see {@link convertToViewportRectangle}\n */\n convertToViewportPoint(x, y) {\n return Util.applyTransform([x, y], this.transform);\n }\n\n /**\n * Converts PDF rectangle to the viewport coordinates.\n * @param {Array} rect - The xMin, yMin, xMax and yMax coordinates.\n * @returns {Array} Array containing corresponding coordinates of the\n * rectangle in the viewport coordinate space.\n * @see {@link convertToViewportPoint}\n */\n convertToViewportRectangle(rect) {\n const topLeft = Util.applyTransform([rect[0], rect[1]], this.transform);\n const bottomRight = Util.applyTransform([rect[2], rect[3]], this.transform);\n return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];\n }\n\n /**\n * Converts viewport coordinates to the PDF location. For examples, useful\n * for converting canvas pixel location into PDF one.\n * @param {number} x - The x-coordinate.\n * @param {number} y - The y-coordinate.\n * @returns {Object} Object containing `x` and `y` properties of the\n * point in the PDF coordinate space.\n * @see {@link convertToViewportPoint}\n */\n convertToPdfPoint(x, y) {\n return Util.applyInverseTransform([x, y], this.transform);\n }\n}\n\nclass RenderingCancelledException extends BaseException {\n constructor(msg, type) {\n super(msg);\n this.type = type;\n }\n}\n\nconst LinkTarget = {\n NONE: 0, // Default value.\n SELF: 1,\n BLANK: 2,\n PARENT: 3,\n TOP: 4,\n};\n\n/**\n * @typedef ExternalLinkParameters\n * @typedef {Object} ExternalLinkParameters\n * @property {string} url - An absolute URL.\n * @property {LinkTarget} [target] - The link target. The default value is\n * `LinkTarget.NONE`.\n * @property {string} [rel] - The link relationship. The default value is\n * `DEFAULT_LINK_REL`.\n * @property {boolean} [enabled] - Whether the link should be enabled. The\n * default value is true.\n */\n\n/**\n * Adds various attributes (href, title, target, rel) to hyperlinks.\n * @param {HTMLLinkElement} link - The link element.\n * @param {ExternalLinkParameters} params\n */\nfunction addLinkAttributes(link, { url, target, rel, enabled = true } = {}) {\n assert(\n url && typeof url === \"string\",\n 'addLinkAttributes: A valid \"url\" parameter must provided.'\n );\n\n const urlNullRemoved = removeNullCharacters(url);\n if (enabled) {\n link.href = link.title = urlNullRemoved;\n } else {\n link.href = \"\";\n link.title = `Disabled: ${urlNullRemoved}`;\n link.onclick = () => {\n return false;\n };\n }\n\n let targetStr = \"\"; // LinkTarget.NONE\n switch (target) {\n case LinkTarget.NONE:\n break;\n case LinkTarget.SELF:\n targetStr = \"_self\";\n break;\n case LinkTarget.BLANK:\n targetStr = \"_blank\";\n break;\n case LinkTarget.PARENT:\n targetStr = \"_parent\";\n break;\n case LinkTarget.TOP:\n targetStr = \"_top\";\n break;\n }\n link.target = targetStr;\n\n link.rel = typeof rel === \"string\" ? rel : DEFAULT_LINK_REL;\n}\n\nfunction isDataScheme(url) {\n const ii = url.length;\n let i = 0;\n while (i < ii && url[i].trim() === \"\") {\n i++;\n }\n return url.substring(i, i + 5).toLowerCase() === \"data:\";\n}\n\nfunction isPdfFile(filename) {\n return typeof filename === \"string\" && /\\.pdf$/i.test(filename);\n}\n\n/**\n * Gets the filename from a given URL.\n * @param {string} url\n * @returns {string}\n */\nfunction getFilenameFromUrl(url) {\n const anchor = url.indexOf(\"#\");\n const query = url.indexOf(\"?\");\n const end = Math.min(\n anchor > 0 ? anchor : url.length,\n query > 0 ? query : url.length\n );\n return url.substring(url.lastIndexOf(\"/\", end) + 1, end);\n}\n\n/**\n * Returns the filename or guessed filename from the url (see issue 3455).\n * @param {string} url - The original PDF location.\n * @param {string} defaultFilename - The value returned if the filename is\n * unknown, or the protocol is unsupported.\n * @returns {string} Guessed PDF filename.\n */\nfunction getPdfFilenameFromUrl(url, defaultFilename = \"document.pdf\") {\n if (typeof url !== \"string\") {\n return defaultFilename;\n }\n if (isDataScheme(url)) {\n warn('getPdfFilenameFromUrl: ignore \"data:\"-URL for performance reasons.');\n return defaultFilename;\n }\n const reURI = /^(?:(?:[^:]+:)?\\/\\/[^/]+)?([^?#]*)(\\?[^#]*)?(#.*)?$/;\n // SCHEME HOST 1.PATH 2.QUERY 3.REF\n // Pattern to get last matching NAME.pdf\n const reFilename = /[^/?#=]+\\.pdf\\b(?!.*\\.pdf\\b)/i;\n const splitURI = reURI.exec(url);\n let suggestedFilename =\n reFilename.exec(splitURI[1]) ||\n reFilename.exec(splitURI[2]) ||\n reFilename.exec(splitURI[3]);\n if (suggestedFilename) {\n suggestedFilename = suggestedFilename[0];\n if (suggestedFilename.includes(\"%\")) {\n // URL-encoded %2Fpath%2Fto%2Ffile.pdf should be file.pdf\n try {\n suggestedFilename = reFilename.exec(\n decodeURIComponent(suggestedFilename)\n )[0];\n } catch (ex) {\n // Possible (extremely rare) errors:\n // URIError \"Malformed URI\", e.g. for \"%AA.pdf\"\n // TypeError \"null has no properties\", e.g. for \"%2F.pdf\"\n }\n }\n }\n return suggestedFilename || defaultFilename;\n}\n\nclass StatTimer {\n constructor() {\n this.started = Object.create(null);\n this.times = [];\n }\n\n time(name) {\n if (name in this.started) {\n warn(`Timer is already running for ${name}`);\n }\n this.started[name] = Date.now();\n }\n\n timeEnd(name) {\n if (!(name in this.started)) {\n warn(`Timer has not been started for ${name}`);\n }\n this.times.push({\n name,\n start: this.started[name],\n end: Date.now(),\n });\n // Remove timer from started so it can be called again.\n delete this.started[name];\n }\n\n toString() {\n // Find the longest name for padding purposes.\n const outBuf = [];\n let longest = 0;\n for (const time of this.times) {\n const name = time.name;\n if (name.length > longest) {\n longest = name.length;\n }\n }\n for (const time of this.times) {\n const duration = time.end - time.start;\n outBuf.push(`${time.name.padEnd(longest)} ${duration}ms\\n`);\n }\n return outBuf.join(\"\");\n }\n}\n\nfunction isFetchSupported() {\n return (\n typeof fetch !== \"undefined\" &&\n typeof Response !== \"undefined\" &&\n \"body\" in Response.prototype &&\n typeof ReadableStream !== \"undefined\"\n );\n}\n\nfunction isValidFetchUrl(url, baseUrl) {\n try {\n const { protocol } = baseUrl ? new URL(url, baseUrl) : new URL(url);\n // The Fetch API only supports the http/https protocols, and not file/ftp.\n return protocol === \"http:\" || protocol === \"https:\";\n } catch (ex) {\n return false; // `new URL()` will throw on incorrect data.\n }\n}\n\n/**\n * @param {string} src\n * @param {boolean} [removeScriptElement]\n * @returns {Promise<void>}\n */\nfunction loadScript(src, removeScriptElement = false) {\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = src;\n\n script.onload = function (evt) {\n if (removeScriptElement) {\n script.remove();\n }\n resolve(evt);\n };\n script.onerror = function () {\n reject(new Error(`Cannot load script at: ${script.src}`));\n };\n (document.head || document.documentElement).appendChild(script);\n });\n}\n\n// Deprecated API function -- display regardless of the `verbosity` setting.\nfunction deprecated(details) {\n console.log(\"Deprecated API usage: \" + details);\n}\n\nlet pdfDateStringRegex;\n\nclass PDFDateString {\n /**\n * Convert a PDF date string to a JavaScript `Date` object.\n *\n * The PDF date string format is described in section 7.9.4 of the official\n * PDF 32000-1:2008 specification. However, in the PDF 1.7 reference (sixth\n * edition) Adobe describes the same format including a trailing apostrophe.\n * This syntax in incorrect, but Adobe Acrobat creates PDF files that contain\n * them. We ignore all apostrophes as they are not necessary for date parsing.\n *\n * Moreover, Adobe Acrobat doesn't handle changing the date to universal time\n * and doesn't use the user's time zone (effectively ignoring the HH' and mm'\n * parts of the date string).\n *\n * @param {string} input\n * @returns {Date|null}\n */\n static toDateObject(input) {\n if (!input || !isString(input)) {\n return null;\n }\n\n // Lazily initialize the regular expression.\n if (!pdfDateStringRegex) {\n pdfDateStringRegex = new RegExp(\n \"^D:\" + // Prefix (required)\n \"(\\\\d{4})\" + // Year (required)\n \"(\\\\d{2})?\" + // Month (optional)\n \"(\\\\d{2})?\" + // Day (optional)\n \"(\\\\d{2})?\" + // Hour (optional)\n \"(\\\\d{2})?\" + // Minute (optional)\n \"(\\\\d{2})?\" + // Second (optional)\n \"([Z|+|-])?\" + // Universal time relation (optional)\n \"(\\\\d{2})?\" + // Offset hour (optional)\n \"'?\" + // Splitting apostrophe (optional)\n \"(\\\\d{2})?\" + // Offset minute (optional)\n \"'?\" // Trailing apostrophe (optional)\n );\n }\n\n // Optional fields that don't satisfy the requirements from the regular\n // expression (such as incorrect digit counts or numbers that are out of\n // range) will fall back the defaults from the specification.\n const matches = pdfDateStringRegex.exec(input);\n if (!matches) {\n return null;\n }\n\n // JavaScript's `Date` object expects the month to be between 0 and 11\n // instead of 1 and 12, so we have to correct for that.\n const year = parseInt(matches[1], 10);\n let month = parseInt(matches[2], 10);\n month = month >= 1 && month <= 12 ? month - 1 : 0;\n let day = parseInt(matches[3], 10);\n day = day >= 1 && day <= 31 ? day : 1;\n let hour = parseInt(matches[4], 10);\n hour = hour >= 0 && hour <= 23 ? hour : 0;\n let minute = parseInt(matches[5], 10);\n minute = minute >= 0 && minute <= 59 ? minute : 0;\n let second = parseInt(matches[6], 10);\n second = second >= 0 && second <= 59 ? second : 0;\n const universalTimeRelation = matches[7] || \"Z\";\n let offsetHour = parseInt(matches[8], 10);\n offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;\n let offsetMinute = parseInt(matches[9], 10) || 0;\n offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;\n\n // Universal time relation 'Z' means that the local time is equal to the\n // universal time, whereas the relations '+'/'-' indicate that the local\n // time is later respectively earlier than the universal time. Every date\n // is normalized to universal time.\n if (universalTimeRelation === \"-\") {\n hour += offsetHour;\n minute += offsetMinute;\n } else if (universalTimeRelation === \"+\") {\n hour -= offsetHour;\n minute -= offsetMinute;\n }\n\n return new Date(Date.UTC(year, month, day, hour, minute, second));\n }\n}\n\nexport {\n addLinkAttributes,\n BaseCanvasFactory,\n BaseCMapReaderFactory,\n DEFAULT_LINK_REL,\n deprecated,\n DOMCanvasFactory,\n DOMCMapReaderFactory,\n DOMSVGFactory,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n isDataScheme,\n isFetchSupported,\n isPdfFile,\n isValidFetchUrl,\n LinkTarget,\n loadScript,\n PageViewport,\n PDFDateString,\n RenderingCancelledException,\n StatTimer,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport \"./compatibility.js\";\n\nconst IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];\nconst FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];\n\n// Permission flags from Table 22, Section 7.6.3.2 of the PDF specification.\nconst PermissionFlag = {\n PRINT: 0x04,\n MODIFY_CONTENTS: 0x08,\n COPY: 0x10,\n MODIFY_ANNOTATIONS: 0x20,\n FILL_INTERACTIVE_FORMS: 0x100,\n COPY_FOR_ACCESSIBILITY: 0x200,\n ASSEMBLE: 0x400,\n PRINT_HIGH_QUALITY: 0x800,\n};\n\nconst TextRenderingMode = {\n FILL: 0,\n STROKE: 1,\n FILL_STROKE: 2,\n INVISIBLE: 3,\n FILL_ADD_TO_PATH: 4,\n STROKE_ADD_TO_PATH: 5,\n FILL_STROKE_ADD_TO_PATH: 6,\n ADD_TO_PATH: 7,\n FILL_STROKE_MASK: 3,\n ADD_TO_PATH_FLAG: 4,\n};\n\nconst ImageKind = {\n GRAYSCALE_1BPP: 1,\n RGB_24BPP: 2,\n RGBA_32BPP: 3,\n};\n\nconst AnnotationType = {\n TEXT: 1,\n LINK: 2,\n FREETEXT: 3,\n LINE: 4,\n SQUARE: 5,\n CIRCLE: 6,\n POLYGON: 7,\n POLYLINE: 8,\n HIGHLIGHT: 9,\n UNDERLINE: 10,\n SQUIGGLY: 11,\n STRIKEOUT: 12,\n STAMP: 13,\n CARET: 14,\n INK: 15,\n POPUP: 16,\n FILEATTACHMENT: 17,\n SOUND: 18,\n MOVIE: 19,\n WIDGET: 20,\n SCREEN: 21,\n PRINTERMARK: 22,\n TRAPNET: 23,\n WATERMARK: 24,\n THREED: 25,\n REDACT: 26,\n};\n\nconst AnnotationStateModelType = {\n MARKED: \"Marked\",\n REVIEW: \"Review\",\n};\n\nconst AnnotationMarkedState = {\n MARKED: \"Marked\",\n UNMARKED: \"Unmarked\",\n};\n\nconst AnnotationReviewState = {\n ACCEPTED: \"Accepted\",\n REJECTED: \"Rejected\",\n CANCELLED: \"Cancelled\",\n COMPLETED: \"Completed\",\n NONE: \"None\",\n};\n\nconst AnnotationReplyType = {\n GROUP: \"Group\",\n REPLY: \"R\",\n};\n\nconst AnnotationFlag = {\n INVISIBLE: 0x01,\n HIDDEN: 0x02,\n PRINT: 0x04,\n NOZOOM: 0x08,\n NOROTATE: 0x10,\n NOVIEW: 0x20,\n READONLY: 0x40,\n LOCKED: 0x80,\n TOGGLENOVIEW: 0x100,\n LOCKEDCONTENTS: 0x200,\n};\n\nconst AnnotationFieldFlag = {\n READONLY: 0x0000001,\n REQUIRED: 0x0000002,\n NOEXPORT: 0x0000004,\n MULTILINE: 0x0001000,\n PASSWORD: 0x0002000,\n NOTOGGLETOOFF: 0x0004000,\n RADIO: 0x0008000,\n PUSHBUTTON: 0x0010000,\n COMBO: 0x0020000,\n EDIT: 0x0040000,\n SORT: 0x0080000,\n FILESELECT: 0x0100000,\n MULTISELECT: 0x0200000,\n DONOTSPELLCHECK: 0x0400000,\n DONOTSCROLL: 0x0800000,\n COMB: 0x1000000,\n RICHTEXT: 0x2000000,\n RADIOSINUNISON: 0x2000000,\n COMMITONSELCHANGE: 0x4000000,\n};\n\nconst AnnotationBorderStyleType = {\n SOLID: 1,\n DASHED: 2,\n BEVELED: 3,\n INSET: 4,\n UNDERLINE: 5,\n};\n\nconst AnnotationActionEventType = {\n E: \"Mouse Enter\",\n X: \"Mouse Exit\",\n D: \"Mouse Down\",\n U: \"Mouse Up\",\n Fo: \"Focus\",\n Bl: \"Blur\",\n PO: \"PageOpen\",\n PC: \"PageClose\",\n PV: \"PageVisible\",\n PI: \"PageInvisible\",\n K: \"Keystroke\",\n F: \"Format\",\n V: \"Validate\",\n C: \"Calculate\",\n};\n\nconst DocumentActionEventType = {\n WC: \"WillClose\",\n WS: \"WillSave\",\n DS: \"DidSave\",\n WP: \"WillPrint\",\n DP: \"DidPrint\",\n};\n\nconst PageActionEventType = {\n O: \"PageOpen\",\n C: \"PageClose\",\n};\n\nconst StreamType = {\n UNKNOWN: \"UNKNOWN\",\n FLATE: \"FLATE\",\n LZW: \"LZW\",\n DCT: \"DCT\",\n JPX: \"JPX\",\n JBIG: \"JBIG\",\n A85: \"A85\",\n AHX: \"AHX\",\n CCF: \"CCF\",\n RLX: \"RLX\", // PDF short name is 'RL', but telemetry requires three chars.\n};\n\nconst FontType = {\n UNKNOWN: \"UNKNOWN\",\n TYPE1: \"TYPE1\",\n TYPE1C: \"TYPE1C\",\n CIDFONTTYPE0: \"CIDFONTTYPE0\",\n CIDFONTTYPE0C: \"CIDFONTTYPE0C\",\n TRUETYPE: \"TRUETYPE\",\n CIDFONTTYPE2: \"CIDFONTTYPE2\",\n TYPE3: \"TYPE3\",\n OPENTYPE: \"OPENTYPE\",\n TYPE0: \"TYPE0\",\n MMTYPE1: \"MMTYPE1\",\n};\n\nconst VerbosityLevel = {\n ERRORS: 0,\n WARNINGS: 1,\n INFOS: 5,\n};\n\nconst CMapCompressionType = {\n NONE: 0,\n BINARY: 1,\n STREAM: 2,\n};\n\n// All the possible operations for an operator list.\nconst OPS = {\n // Intentionally start from 1 so it is easy to spot bad operators that will be\n // 0's.\n dependency: 1,\n setLineWidth: 2,\n setLineCap: 3,\n setLineJoin: 4,\n setMiterLimit: 5,\n setDash: 6,\n setRenderingIntent: 7,\n setFlatness: 8,\n setGState: 9,\n save: 10,\n restore: 11,\n transform: 12,\n moveTo: 13,\n lineTo: 14,\n curveTo: 15,\n curveTo2: 16,\n curveTo3: 17,\n closePath: 18,\n rectangle: 19,\n stroke: 20,\n closeStroke: 21,\n fill: 22,\n eoFill: 23,\n fillStroke: 24,\n eoFillStroke: 25,\n closeFillStroke: 26,\n closeEOFillStroke: 27,\n endPath: 28,\n clip: 29,\n eoClip: 30,\n beginText: 31,\n endText: 32,\n setCharSpacing: 33,\n setWordSpacing: 34,\n setHScale: 35,\n setLeading: 36,\n setFont: 37,\n setTextRenderingMode: 38,\n setTextRise: 39,\n moveText: 40,\n setLeadingMoveText: 41,\n setTextMatrix: 42,\n nextLine: 43,\n showText: 44,\n showSpacedText: 45,\n nextLineShowText: 46,\n nextLineSetSpacingShowText: 47,\n setCharWidth: 48,\n setCharWidthAndBounds: 49,\n setStrokeColorSpace: 50,\n setFillColorSpace: 51,\n setStrokeColor: 52,\n setStrokeColorN: 53,\n setFillColor: 54,\n setFillColorN: 55,\n setStrokeGray: 56,\n setFillGray: 57,\n setStrokeRGBColor: 58,\n setFillRGBColor: 59,\n setStrokeCMYKColor: 60,\n setFillCMYKColor: 61,\n shadingFill: 62,\n beginInlineImage: 63,\n beginImageData: 64,\n endInlineImage: 65,\n paintXObject: 66,\n markPoint: 67,\n markPointProps: 68,\n beginMarkedContent: 69,\n beginMarkedContentProps: 70,\n endMarkedContent: 71,\n beginCompat: 72,\n endCompat: 73,\n paintFormXObjectBegin: 74,\n paintFormXObjectEnd: 75,\n beginGroup: 76,\n endGroup: 77,\n beginAnnotations: 78,\n endAnnotations: 79,\n beginAnnotation: 80,\n endAnnotation: 81,\n paintJpegXObject: 82,\n paintImageMaskXObject: 83,\n paintImageMaskXObjectGroup: 84,\n paintImageXObject: 85,\n paintInlineImageXObject: 86,\n paintInlineImageXObjectGroup: 87,\n paintImageXObjectRepeat: 88,\n paintImageMaskXObjectRepeat: 89,\n paintSolidColorImageMask: 90,\n constructPath: 91,\n};\n\nconst UNSUPPORTED_FEATURES = {\n /** @deprecated unused */\n unknown: \"unknown\",\n forms: \"forms\",\n javaScript: \"javaScript\",\n signatures: \"signatures\",\n smask: \"smask\",\n shadingPattern: \"shadingPattern\",\n /** @deprecated unused */\n font: \"font\",\n errorTilingPattern: \"errorTilingPattern\",\n errorExtGState: \"errorExtGState\",\n errorXObject: \"errorXObject\",\n errorFontLoadType3: \"errorFontLoadType3\",\n errorFontState: \"errorFontState\",\n errorFontMissing: \"errorFontMissing\",\n errorFontTranslate: \"errorFontTranslate\",\n errorColorSpace: \"errorColorSpace\",\n errorOperatorList: \"errorOperatorList\",\n errorFontToUnicode: \"errorFontToUnicode\",\n errorFontLoadNative: \"errorFontLoadNative\",\n errorFontBuildPath: \"errorFontBuildPath\",\n errorFontGetPath: \"errorFontGetPath\",\n errorMarkedContent: \"errorMarkedContent\",\n};\n\nconst PasswordResponses = {\n NEED_PASSWORD: 1,\n INCORRECT_PASSWORD: 2,\n};\n\nlet verbosity = VerbosityLevel.WARNINGS;\n\nfunction setVerbosityLevel(level) {\n if (Number.isInteger(level)) {\n verbosity = level;\n }\n}\n\nfunction getVerbosityLevel() {\n return verbosity;\n}\n\n// A notice for devs. These are good for things that are helpful to devs, such\n// as warning that Workers were disabled, which is important to devs but not\n// end users.\nfunction info(msg) {\n if (verbosity >= VerbosityLevel.INFOS) {\n console.log(`Info: ${msg}`);\n }\n}\n\n// Non-fatal warnings.\nfunction warn(msg) {\n if (verbosity >= VerbosityLevel.WARNINGS) {\n console.log(`Warning: ${msg}`);\n }\n}\n\nfunction unreachable(msg) {\n throw new Error(msg);\n}\n\nfunction assert(cond, msg) {\n if (!cond) {\n unreachable(msg);\n }\n}\n\n// Checks if URLs have the same origin. For non-HTTP based URLs, returns false.\nfunction isSameOrigin(baseUrl, otherUrl) {\n let base;\n try {\n base = new URL(baseUrl);\n if (!base.origin || base.origin === \"null\") {\n return false; // non-HTTP url\n }\n } catch (e) {\n return false;\n }\n\n const other = new URL(otherUrl, base);\n return base.origin === other.origin;\n}\n\n// Checks if URLs use one of the allowed protocols, e.g. to avoid XSS.\nfunction _isValidProtocol(url) {\n if (!url) {\n return false;\n }\n switch (url.protocol) {\n case \"http:\":\n case \"https:\":\n case \"ftp:\":\n case \"mailto:\":\n case \"tel:\":\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Attempts to create a valid absolute URL.\n *\n * @param {URL|string} url - An absolute, or relative, URL.\n * @param {URL|string} baseUrl - An absolute URL.\n * @returns Either a valid {URL}, or `null` otherwise.\n */\nfunction createValidAbsoluteUrl(url, baseUrl) {\n if (!url) {\n return null;\n }\n try {\n const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);\n if (_isValidProtocol(absoluteUrl)) {\n return absoluteUrl;\n }\n } catch (ex) {\n /* `new URL()` will throw on incorrect data. */\n }\n return null;\n}\n\nfunction shadow(obj, prop, value) {\n Object.defineProperty(obj, prop, {\n value,\n enumerable: true,\n configurable: true,\n writable: false,\n });\n return value;\n}\n\n/**\n * @type {any}\n */\nconst BaseException = (function BaseExceptionClosure() {\n // eslint-disable-next-line no-shadow\n function BaseException(message) {\n if (this.constructor === BaseException) {\n unreachable(\"Cannot initialize BaseException.\");\n }\n this.message = message;\n this.name = this.constructor.name;\n }\n BaseException.prototype = new Error();\n BaseException.constructor = BaseException;\n\n return BaseException;\n})();\n\nclass PasswordException extends BaseException {\n constructor(msg, code) {\n super(msg);\n this.code = code;\n }\n}\n\nclass UnknownErrorException extends BaseException {\n constructor(msg, details) {\n super(msg);\n this.details = details;\n }\n}\n\nclass InvalidPDFException extends BaseException {}\n\nclass MissingPDFException extends BaseException {}\n\nclass UnexpectedResponseException extends BaseException {\n constructor(msg, status) {\n super(msg);\n this.status = status;\n }\n}\n\n/**\n * Error caused during parsing PDF data.\n */\nclass FormatError extends BaseException {}\n\n/**\n * Error used to indicate task cancellation.\n */\nclass AbortException extends BaseException {}\n\nconst NullCharactersRegExp = /\\x00/g;\n\n/**\n * @param {string} str\n */\nfunction removeNullCharacters(str) {\n if (typeof str !== \"string\") {\n warn(\"The argument for removeNullCharacters must be a string.\");\n return str;\n }\n return str.replace(NullCharactersRegExp, \"\");\n}\n\nfunction bytesToString(bytes) {\n assert(\n bytes !== null && typeof bytes === \"object\" && bytes.length !== undefined,\n \"Invalid argument for bytesToString\"\n );\n const length = bytes.length;\n const MAX_ARGUMENT_COUNT = 8192;\n if (length < MAX_ARGUMENT_COUNT) {\n return String.fromCharCode.apply(null, bytes);\n }\n const strBuf = [];\n for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {\n const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);\n const chunk = bytes.subarray(i, chunkEnd);\n strBuf.push(String.fromCharCode.apply(null, chunk));\n }\n return strBuf.join(\"\");\n}\n\nfunction stringToBytes(str) {\n assert(typeof str === \"string\", \"Invalid argument for stringToBytes\");\n const length = str.length;\n const bytes = new Uint8Array(length);\n for (let i = 0; i < length; ++i) {\n bytes[i] = str.charCodeAt(i) & 0xff;\n }\n return bytes;\n}\n\n/**\n * Gets length of the array (Array, Uint8Array, or string) in bytes.\n * @param {Array<any>|Uint8Array|string} arr\n * @returns {number}\n */\nfunction arrayByteLength(arr) {\n if (arr.length !== undefined) {\n return arr.length;\n }\n assert(arr.byteLength !== undefined, \"arrayByteLength - invalid argument.\");\n return arr.byteLength;\n}\n\n/**\n * Combines array items (arrays) into single Uint8Array object.\n * @param {Array<Array<any>|Uint8Array|string>} arr - the array of the arrays\n * (Array, Uint8Array, or string).\n * @returns {Uint8Array}\n */\nfunction arraysToBytes(arr) {\n const length = arr.length;\n // Shortcut: if first and only item is Uint8Array, return it.\n if (length === 1 && arr[0] instanceof Uint8Array) {\n return arr[0];\n }\n let resultLength = 0;\n for (let i = 0; i < length; i++) {\n resultLength += arrayByteLength(arr[i]);\n }\n let pos = 0;\n const data = new Uint8Array(resultLength);\n for (let i = 0; i < length; i++) {\n let item = arr[i];\n if (!(item instanceof Uint8Array)) {\n if (typeof item === \"string\") {\n item = stringToBytes(item);\n } else {\n item = new Uint8Array(item);\n }\n }\n const itemLength = item.byteLength;\n data.set(item, pos);\n pos += itemLength;\n }\n return data;\n}\n\nfunction string32(value) {\n return String.fromCharCode(\n (value >> 24) & 0xff,\n (value >> 16) & 0xff,\n (value >> 8) & 0xff,\n value & 0xff\n );\n}\n\nfunction objectSize(obj) {\n return Object.keys(obj).length;\n}\n\n// Ensure that the returned Object has a `null` prototype; hence why\n// `Object.fromEntries(...)` is not used.\nfunction objectFromMap(map) {\n const obj = Object.create(null);\n for (const [key, value] of map) {\n obj[key] = value;\n }\n return obj;\n}\n\n// Checks the endianness of the platform.\nfunction isLittleEndian() {\n const buffer8 = new Uint8Array(4);\n buffer8[0] = 1;\n const view32 = new Uint32Array(buffer8.buffer, 0, 1);\n return view32[0] === 1;\n}\nconst IsLittleEndianCached = {\n get value() {\n return shadow(this, \"value\", isLittleEndian());\n },\n};\n\n// Checks if it's possible to eval JS expressions.\nfunction isEvalSupported() {\n try {\n new Function(\"\"); // eslint-disable-line no-new, no-new-func\n return true;\n } catch (e) {\n return false;\n }\n}\nconst IsEvalSupportedCached = {\n get value() {\n return shadow(this, \"value\", isEvalSupported());\n },\n};\n\nconst hexNumbers = [...Array(256).keys()].map(n =>\n n.toString(16).padStart(2, \"0\")\n);\n\nclass Util {\n static makeHexColor(r, g, b) {\n return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;\n }\n\n // Concatenates two transformation matrices together and returns the result.\n static transform(m1, m2) {\n return [\n m1[0] * m2[0] + m1[2] * m2[1],\n m1[1] * m2[0] + m1[3] * m2[1],\n m1[0] * m2[2] + m1[2] * m2[3],\n m1[1] * m2[2] + m1[3] * m2[3],\n m1[0] * m2[4] + m1[2] * m2[5] + m1[4],\n m1[1] * m2[4] + m1[3] * m2[5] + m1[5],\n ];\n }\n\n // For 2d affine transforms\n static applyTransform(p, m) {\n const xt = p[0] * m[0] + p[1] * m[2] + m[4];\n const yt = p[0] * m[1] + p[1] * m[3] + m[5];\n return [xt, yt];\n }\n\n static applyInverseTransform(p, m) {\n const d = m[0] * m[3] - m[1] * m[2];\n const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;\n const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;\n return [xt, yt];\n }\n\n // Applies the transform to the rectangle and finds the minimum axially\n // aligned bounding box.\n static getAxialAlignedBoundingBox(r, m) {\n const p1 = Util.applyTransform(r, m);\n const p2 = Util.applyTransform(r.slice(2, 4), m);\n const p3 = Util.applyTransform([r[0], r[3]], m);\n const p4 = Util.applyTransform([r[2], r[1]], m);\n return [\n Math.min(p1[0], p2[0], p3[0], p4[0]),\n Math.min(p1[1], p2[1], p3[1], p4[1]),\n Math.max(p1[0], p2[0], p3[0], p4[0]),\n Math.max(p1[1], p2[1], p3[1], p4[1]),\n ];\n }\n\n static inverseTransform(m) {\n const d = m[0] * m[3] - m[1] * m[2];\n return [\n m[3] / d,\n -m[1] / d,\n -m[2] / d,\n m[0] / d,\n (m[2] * m[5] - m[4] * m[3]) / d,\n (m[4] * m[1] - m[5] * m[0]) / d,\n ];\n }\n\n // Apply a generic 3d matrix M on a 3-vector v:\n // | a b c | | X |\n // | d e f | x | Y |\n // | g h i | | Z |\n // M is assumed to be serialized as [a,b,c,d,e,f,g,h,i],\n // with v as [X,Y,Z]\n static apply3dTransform(m, v) {\n return [\n m[0] * v[0] + m[1] * v[1] + m[2] * v[2],\n m[3] * v[0] + m[4] * v[1] + m[5] * v[2],\n m[6] * v[0] + m[7] * v[1] + m[8] * v[2],\n ];\n }\n\n // This calculation uses Singular Value Decomposition.\n // The SVD can be represented with formula A = USV. We are interested in the\n // matrix S here because it represents the scale values.\n static singularValueDecompose2dScale(m) {\n const transpose = [m[0], m[2], m[1], m[3]];\n\n // Multiply matrix m with its transpose.\n const a = m[0] * transpose[0] + m[1] * transpose[2];\n const b = m[0] * transpose[1] + m[1] * transpose[3];\n const c = m[2] * transpose[0] + m[3] * transpose[2];\n const d = m[2] * transpose[1] + m[3] * transpose[3];\n\n // Solve the second degree polynomial to get roots.\n const first = (a + d) / 2;\n const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;\n const sx = first + second || 1;\n const sy = first - second || 1;\n\n // Scale values are the square roots of the eigenvalues.\n return [Math.sqrt(sx), Math.sqrt(sy)];\n }\n\n // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)\n // For coordinate systems whose origin lies in the bottom-left, this\n // means normalization to (BL,TR) ordering. For systems with origin in the\n // top-left, this means (TL,BR) ordering.\n static normalizeRect(rect) {\n const r = rect.slice(0); // clone rect\n if (rect[0] > rect[2]) {\n r[0] = rect[2];\n r[2] = rect[0];\n }\n if (rect[1] > rect[3]) {\n r[1] = rect[3];\n r[3] = rect[1];\n }\n return r;\n }\n\n // Returns a rectangle [x1, y1, x2, y2] corresponding to the\n // intersection of rect1 and rect2. If no intersection, returns 'false'\n // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]\n static intersect(rect1, rect2) {\n function compare(a, b) {\n return a - b;\n }\n\n // Order points along the axes\n const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);\n const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);\n const result = [];\n\n rect1 = Util.normalizeRect(rect1);\n rect2 = Util.normalizeRect(rect2);\n\n // X: first and second points belong to different rectangles?\n if (\n (orderedX[0] === rect1[0] && orderedX[1] === rect2[0]) ||\n (orderedX[0] === rect2[0] && orderedX[1] === rect1[0])\n ) {\n // Intersection must be between second and third points\n result[0] = orderedX[1];\n result[2] = orderedX[2];\n } else {\n return null;\n }\n\n // Y: first and second points belong to different rectangles?\n if (\n (orderedY[0] === rect1[1] && orderedY[1] === rect2[1]) ||\n (orderedY[0] === rect2[1] && orderedY[1] === rect1[1])\n ) {\n // Intersection must be between second and third points\n result[1] = orderedY[1];\n result[3] = orderedY[2];\n } else {\n return null;\n }\n\n return result;\n }\n}\n\nconst PDFStringTranslateTable = [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8,\n 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192,\n 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018,\n 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d,\n 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac,\n];\n\nfunction stringToPDFString(str) {\n const length = str.length,\n strBuf = [];\n if (str[0] === \"\\xFE\" && str[1] === \"\\xFF\") {\n // UTF16BE BOM\n for (let i = 2; i < length; i += 2) {\n strBuf.push(\n String.fromCharCode((str.charCodeAt(i) << 8) | str.charCodeAt(i + 1))\n );\n }\n } else if (str[0] === \"\\xFF\" && str[1] === \"\\xFE\") {\n // UTF16LE BOM\n for (let i = 2; i < length; i += 2) {\n strBuf.push(\n String.fromCharCode((str.charCodeAt(i + 1) << 8) | str.charCodeAt(i))\n );\n }\n } else {\n for (let i = 0; i < length; ++i) {\n const code = PDFStringTranslateTable[str.charCodeAt(i)];\n strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));\n }\n }\n return strBuf.join(\"\");\n}\n\nfunction escapeString(str) {\n // replace \"(\", \")\", \"\\n\", \"\\r\" and \"\\\"\n // by \"\\(\", \"\\)\", \"\\\\n\", \"\\\\r\" and \"\\\\\"\n // in order to write it in a PDF file.\n return str.replace(/([()\\\\\\n\\r])/g, match => {\n if (match === \"\\n\") {\n return \"\\\\n\";\n } else if (match === \"\\r\") {\n return \"\\\\r\";\n }\n return `\\\\${match}`;\n });\n}\n\nfunction isAscii(str) {\n return /^[\\x00-\\x7F]*$/.test(str);\n}\n\nfunction stringToUTF16BEString(str) {\n const buf = [\"\\xFE\\xFF\"];\n for (let i = 0, ii = str.length; i < ii; i++) {\n const char = str.charCodeAt(i);\n buf.push(\n String.fromCharCode((char >> 8) & 0xff),\n String.fromCharCode(char & 0xff)\n );\n }\n return buf.join(\"\");\n}\n\nfunction stringToUTF8String(str) {\n return decodeURIComponent(escape(str));\n}\n\nfunction utf8StringToString(str) {\n return unescape(encodeURIComponent(str));\n}\n\nfunction isBool(v) {\n return typeof v === \"boolean\";\n}\n\nfunction isNum(v) {\n return typeof v === \"number\";\n}\n\nfunction isString(v) {\n return typeof v === \"string\";\n}\n\nfunction isArrayBuffer(v) {\n return typeof v === \"object\" && v !== null && v.byteLength !== undefined;\n}\n\nfunction isArrayEqual(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false;\n }\n for (let i = 0, ii = arr1.length; i < ii; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction getModificationDate(date = new Date()) {\n const buffer = [\n date.getUTCFullYear().toString(),\n (date.getUTCMonth() + 1).toString().padStart(2, \"0\"),\n date.getUTCDate().toString().padStart(2, \"0\"),\n date.getUTCHours().toString().padStart(2, \"0\"),\n date.getUTCMinutes().toString().padStart(2, \"0\"),\n date.getUTCSeconds().toString().padStart(2, \"0\"),\n ];\n\n return buffer.join(\"\");\n}\n\n/**\n * Promise Capability object.\n *\n * @typedef {Object} PromiseCapability\n * @property {Promise<any>} promise - A Promise object.\n * @property {boolean} settled - If the Promise has been fulfilled/rejected.\n * @property {function} resolve - Fulfills the Promise.\n * @property {function} reject - Rejects the Promise.\n */\n\n/**\n * Creates a promise capability object.\n * @alias createPromiseCapability\n *\n * @returns {PromiseCapability}\n */\nfunction createPromiseCapability() {\n const capability = Object.create(null);\n let isSettled = false;\n\n Object.defineProperty(capability, \"settled\", {\n get() {\n return isSettled;\n },\n });\n capability.promise = new Promise(function (resolve, reject) {\n capability.resolve = function (data) {\n isSettled = true;\n resolve(data);\n };\n capability.reject = function (reason) {\n isSettled = true;\n reject(reason);\n };\n });\n return capability;\n}\n\nfunction createObjectURL(data, contentType = \"\", forceDataSchema = false) {\n if (URL.createObjectURL && !forceDataSchema) {\n return URL.createObjectURL(new Blob([data], { type: contentType }));\n }\n // Blob/createObjectURL is not available, falling back to data schema.\n const digits =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let buffer = `data:${contentType};base64,`;\n for (let i = 0, ii = data.length; i < ii; i += 3) {\n const b1 = data[i] & 0xff;\n const b2 = data[i + 1] & 0xff;\n const b3 = data[i + 2] & 0xff;\n const d1 = b1 >> 2,\n d2 = ((b1 & 3) << 4) | (b2 >> 4);\n const d3 = i + 1 < ii ? ((b2 & 0xf) << 2) | (b3 >> 6) : 64;\n const d4 = i + 2 < ii ? b3 & 0x3f : 64;\n buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];\n }\n return buffer;\n}\n\nexport {\n AbortException,\n AnnotationActionEventType,\n AnnotationBorderStyleType,\n AnnotationFieldFlag,\n AnnotationFlag,\n AnnotationMarkedState,\n AnnotationReplyType,\n AnnotationReviewState,\n AnnotationStateModelType,\n AnnotationType,\n arrayByteLength,\n arraysToBytes,\n assert,\n BaseException,\n bytesToString,\n CMapCompressionType,\n createObjectURL,\n createPromiseCapability,\n createValidAbsoluteUrl,\n DocumentActionEventType,\n escapeString,\n FONT_IDENTITY_MATRIX,\n FontType,\n FormatError,\n getModificationDate,\n getVerbosityLevel,\n IDENTITY_MATRIX,\n ImageKind,\n info,\n InvalidPDFException,\n isArrayBuffer,\n isArrayEqual,\n isAscii,\n isBool,\n IsEvalSupportedCached,\n IsLittleEndianCached,\n isNum,\n isSameOrigin,\n isString,\n MissingPDFException,\n objectFromMap,\n objectSize,\n OPS,\n PageActionEventType,\n PasswordException,\n PasswordResponses,\n PermissionFlag,\n removeNullCharacters,\n setVerbosityLevel,\n shadow,\n StreamType,\n string32,\n stringToBytes,\n stringToPDFString,\n stringToUTF16BEString,\n stringToUTF8String,\n TextRenderingMode,\n UnexpectedResponseException,\n UnknownErrorException,\n unreachable,\n UNSUPPORTED_FEATURES,\n utf8StringToString,\n Util,\n VerbosityLevel,\n warn,\n};\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isNodeJS } from \"./is_node.js\";\n\n// Skip compatibility checks for modern builds and if we already ran the module.\nif (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"SKIP_BABEL\")) &&\n (typeof globalThis === \"undefined\" || !globalThis._pdfjsCompatibilityChecked)\n) {\n // Provides support for globalThis in legacy browsers.\n // Support: Firefox<65, Chrome<71, Safari<12.1\n if (typeof globalThis === \"undefined\" || globalThis.Math !== Math) {\n // eslint-disable-next-line no-global-assign\n globalThis = require(\"core-js/es/global-this\");\n }\n globalThis._pdfjsCompatibilityChecked = true;\n\n // Support: Node.js\n (function checkNodeBtoa() {\n if (globalThis.btoa || !isNodeJS) {\n return;\n }\n globalThis.btoa = function (chars) {\n // eslint-disable-next-line no-undef\n return Buffer.from(chars, \"binary\").toString(\"base64\");\n };\n })();\n\n // Support: Node.js\n (function checkNodeAtob() {\n if (globalThis.atob || !isNodeJS) {\n return;\n }\n globalThis.atob = function (input) {\n // eslint-disable-next-line no-undef\n return Buffer.from(input, \"base64\").toString(\"binary\");\n };\n })();\n\n // Provides support for Object.fromEntries in legacy browsers.\n // Support: Firefox<63, Chrome<73, Safari<12.1, Node.js<12.0.0\n (function checkObjectFromEntries() {\n if (Object.fromEntries) {\n return;\n }\n require(\"core-js/es/object/from-entries.js\");\n })();\n\n // Provides support for *recent* additions to the Promise specification,\n // however basic Promise support is assumed to be available natively.\n // Support: Firefox<71, Chrome<76, Safari<13, Node.js<12.9.0\n (function checkPromise() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"IMAGE_DECODERS\")) {\n // The current image decoders are synchronous, hence `Promise` shouldn't\n // need to be polyfilled for the IMAGE_DECODERS build target.\n return;\n }\n if (globalThis.Promise.allSettled) {\n return;\n }\n globalThis.Promise = require(\"core-js/es/promise/index.js\");\n })();\n\n // Support: Node.js\n (function checkReadableStream() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"IMAGE_DECODERS\")) {\n // The current image decoders are synchronous, hence `ReadableStream`\n // shouldn't need to be polyfilled for the IMAGE_DECODERS build target.\n return;\n }\n let isReadableStreamSupported = false;\n\n if (typeof ReadableStream !== \"undefined\") {\n // MS Edge may say it has ReadableStream but they are not up to spec yet.\n try {\n // eslint-disable-next-line no-new\n new ReadableStream({\n start(controller) {\n controller.close();\n },\n });\n isReadableStreamSupported = true;\n } catch (e) {\n // The ReadableStream constructor cannot be used.\n }\n }\n if (isReadableStreamSupported) {\n return;\n }\n globalThis.ReadableStream =\n require(\"web-streams-polyfill/dist/ponyfill.js\").ReadableStream;\n })();\n}\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals process */\n\n// NW.js / Electron is a browser context, but copies some Node.js objects; see\n// http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context\n// https://www.electronjs.org/docs/api/process#processversionselectron-readonly\n// https://www.electronjs.org/docs/api/process#processtype-readonly\nconst isNodeJS =\n typeof process === \"object\" &&\n process + \"\" === \"[object process]\" &&\n !process.versions.nw &&\n !(process.versions.electron && process.type && process.type !== \"browser\");\n\nexport { isNodeJS };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @module pdfjsLib\n */\n\nimport {\n AbortException,\n assert,\n createPromiseCapability,\n getVerbosityLevel,\n info,\n InvalidPDFException,\n isArrayBuffer,\n isSameOrigin,\n MissingPDFException,\n PasswordException,\n setVerbosityLevel,\n shadow,\n stringToBytes,\n UnexpectedResponseException,\n UnknownErrorException,\n unreachable,\n warn,\n} from \"../shared/util.js\";\nimport {\n deprecated,\n DOMCanvasFactory,\n DOMCMapReaderFactory,\n isDataScheme,\n loadScript,\n PageViewport,\n RenderingCancelledException,\n StatTimer,\n} from \"./display_utils.js\";\nimport { FontFaceObject, FontLoader } from \"./font_loader.js\";\nimport { NodeCanvasFactory, NodeCMapReaderFactory } from \"./node_utils.js\";\nimport { AnnotationStorage } from \"./annotation_storage.js\";\nimport { apiCompatibilityParams } from \"./api_compatibility.js\";\nimport { CanvasGraphics } from \"./canvas.js\";\nimport { GlobalWorkerOptions } from \"./worker_options.js\";\nimport { isNodeJS } from \"../shared/is_node.js\";\nimport { MessageHandler } from \"../shared/message_handler.js\";\nimport { Metadata } from \"./metadata.js\";\nimport { OptionalContentConfig } from \"./optional_content_config.js\";\nimport { PDFDataTransportStream } from \"./transport_stream.js\";\n\nconst DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536\nconst RENDERING_CANCELLED_TIMEOUT = 100; // ms\n\nconst DefaultCanvasFactory =\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) && isNodeJS\n ? NodeCanvasFactory\n : DOMCanvasFactory;\nconst DefaultCMapReaderFactory =\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) && isNodeJS\n ? NodeCMapReaderFactory\n : DOMCMapReaderFactory;\n\n/**\n * @typedef {function} IPDFStreamFactory\n * @param {DocumentInitParameters} params - The document initialization\n * parameters. The \"url\" key is always present.\n * @returns {Promise} A promise, which is resolved with an instance of\n * {IPDFStream}.\n * @ignore\n */\n\n/**\n * @type IPDFStreamFactory\n * @private\n */\nlet createPDFNetworkStream;\n\n/**\n * Sets the function that instantiates an {IPDFStream} as an alternative PDF\n * data transport.\n *\n * @param {IPDFStreamFactory} pdfNetworkStreamFactory - The factory function\n * that takes document initialization parameters (including a \"url\") and\n * returns a promise which is resolved with an instance of {IPDFStream}.\n * @ignore\n */\nfunction setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {\n createPDFNetworkStream = pdfNetworkStreamFactory;\n}\n\n/**\n * @typedef { Int8Array | Uint8Array | Uint8ClampedArray |\n * Int16Array | Uint16Array |\n * Int32Array | Uint32Array | Float32Array |\n * Float64Array\n * } TypedArray\n */\n\n/**\n * Document initialization / loading parameters object.\n *\n * @typedef {Object} DocumentInitParameters\n * @property {string|URL} [url] - The URL of the PDF.\n * @property {TypedArray|Array<number>|string} [data] - Binary PDF data. Use\n * typed arrays (Uint8Array) to improve the memory usage. If PDF data is\n * BASE64-encoded, use `atob()` to convert it to a binary string first.\n * @property {Object} [httpHeaders] - Basic authentication headers.\n * @property {boolean} [withCredentials] - Indicates whether or not\n * cross-site Access-Control requests should be made using credentials such\n * as cookies or authorization headers. The default is `false`.\n * @property {string} [password] - For decrypting password-protected PDFs.\n * @property {TypedArray} [initialData] - A typed array with the first portion\n * or all of the pdf data. Used by the extension since some data is already\n * loaded before the switch to range requests.\n * @property {number} [length] - The PDF file length. It's used for progress\n * reports and range requests operations.\n * @property {PDFDataRangeTransport} [range] - Allows for using a custom range\n * transport implementation.\n * @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched\n * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.\n * @property {PDFWorker} [worker] - The worker that will be used for loading and\n * parsing the PDF data.\n * @property {number} [verbosity] - Controls the logging level; the constants\n * from {@link VerbosityLevel} should be used.\n * @property {string} [docBaseUrl] - The base URL of the document, used when\n * attempting to recover valid absolute URLs for annotations, and outline\n * items, that (incorrectly) only specify relative URLs.\n * @property {string} [cMapUrl] - The URL where the predefined Adobe CMaps are\n * located. Include the trailing slash.\n * @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary\n * packed or not.\n * @property {Object} [CMapReaderFactory] - The factory that will be used when\n * reading built-in CMap files. Providing a custom factory is useful for\n * environments without Fetch API or `XMLHttpRequest` support, such as\n * Node.js. The default value is {DOMCMapReaderFactory}.\n * @property {boolean} [stopAtErrors] - Reject certain promises, e.g.\n * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated\n * PDF data cannot be successfully parsed, instead of attempting to recover\n * whatever possible of the data. The default value is `false`.\n * @property {number} [maxImageSize] - The maximum allowed image size in total\n * pixels, i.e. width * height. Images above this value will not be rendered.\n * Use -1 for no limit, which is also the default value.\n * @property {boolean} [isEvalSupported] - Determines if we can evaluate strings\n * as JavaScript. Primarily used to improve performance of font rendering, and\n * when parsing PDF functions. The default value is `true`.\n * @property {boolean} [disableFontFace] - By default fonts are converted to\n * OpenType fonts and loaded via `@font-face` rules. If disabled, fonts will\n * be rendered using a built-in font renderer that constructs the glyphs with\n * primitive path commands. The default value is `false`.\n * @property {boolean} [fontExtraProperties] - Include additional properties,\n * which are unused during rendering of PDF documents, when exporting the\n * parsed font data from the worker-thread. This may be useful for debugging\n * purposes (and backwards compatibility), but note that it will lead to\n * increased memory usage. The default value is `false`.\n * @property {boolean} [enableXfa] - Render Xfa forms if any.\n * The default value is `false`.\n * @property {HTMLDocument} [ownerDocument] - Specify an explicit document\n * context to create elements with and to load resources, such as fonts,\n * into. Defaults to the current document.\n * @property {boolean} [disableRange] - Disable range request loading of PDF\n * files. When enabled, and if the server supports partial content requests,\n * then the PDF will be fetched in chunks. The default value is `false`.\n * @property {boolean} [disableStream] - Disable streaming of PDF file data.\n * By default PDF.js attempts to load PDF files in chunks. The default value\n * is `false`.\n * @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF file\n * data. When range requests are enabled PDF.js will automatically keep\n * fetching more data even if it isn't needed to display the current page.\n * The default value is `false`.\n *\n * NOTE: It is also necessary to disable streaming, see above, in order for\n * disabling of pre-fetching to work correctly.\n * @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js\n * (see `web/debugger.js`). The default value is `false`.\n */\n\n/**\n * This is the main entry point for loading a PDF and interacting with it.\n *\n * NOTE: If a URL is used to fetch the PDF data a standard Fetch API call (or\n * XHR as fallback) is used, which means it must follow same origin rules,\n * e.g. no cross-domain requests without CORS.\n *\n * @param {string|URL|TypedArray|PDFDataRangeTransport|DocumentInitParameters}\n * src - Can be a URL where a PDF file is located, a typed array (Uint8Array)\n * already populated with data, or a parameter object.\n * @returns {PDFDocumentLoadingTask}\n */\nfunction getDocument(src) {\n const task = new PDFDocumentLoadingTask();\n\n let source;\n if (typeof src === \"string\" || src instanceof URL) {\n source = { url: src };\n } else if (isArrayBuffer(src)) {\n source = { data: src };\n } else if (src instanceof PDFDataRangeTransport) {\n source = { range: src };\n } else {\n if (typeof src !== \"object\") {\n throw new Error(\n \"Invalid parameter in getDocument, \" +\n \"need either string, URL, Uint8Array, or parameter object.\"\n );\n }\n if (!src.url && !src.data && !src.range) {\n throw new Error(\n \"Invalid parameter object: need either .data, .range or .url\"\n );\n }\n source = src;\n }\n const params = Object.create(null);\n let rangeTransport = null,\n worker = null;\n\n for (const key in source) {\n const value = source[key];\n\n switch (key) {\n case \"url\":\n if (typeof window !== \"undefined\") {\n try {\n // The full path is required in the 'url' field.\n params[key] = new URL(value, window.location).href;\n continue;\n } catch (ex) {\n warn(`Cannot create valid URL: \"${ex}\".`);\n }\n } else if (typeof value === \"string\" || value instanceof URL) {\n params[key] = value.toString(); // Support Node.js environments.\n continue;\n }\n throw new Error(\n \"Invalid PDF url data: \" +\n \"either string or URL-object is expected in the url property.\"\n );\n case \"range\":\n rangeTransport = value;\n continue;\n case \"worker\":\n worker = value;\n continue;\n case \"data\":\n // Converting string or array-like data to Uint8Array.\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"GENERIC\") &&\n isNodeJS &&\n typeof Buffer !== \"undefined\" && // eslint-disable-line no-undef\n value instanceof Buffer // eslint-disable-line no-undef\n ) {\n params[key] = new Uint8Array(value);\n } else if (value instanceof Uint8Array) {\n break; // Use the data as-is when it's already a Uint8Array.\n } else if (typeof value === \"string\") {\n params[key] = stringToBytes(value);\n } else if (\n typeof value === \"object\" &&\n value !== null &&\n !isNaN(value.length)\n ) {\n params[key] = new Uint8Array(value);\n } else if (isArrayBuffer(value)) {\n params[key] = new Uint8Array(value);\n } else {\n throw new Error(\n \"Invalid PDF binary data: either typed array, \" +\n \"string, or array-like object is expected in the data property.\"\n );\n }\n continue;\n }\n params[key] = value;\n }\n\n params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;\n params.CMapReaderFactory =\n params.CMapReaderFactory || DefaultCMapReaderFactory;\n params.ignoreErrors = params.stopAtErrors !== true;\n params.fontExtraProperties = params.fontExtraProperties === true;\n params.pdfBug = params.pdfBug === true;\n params.enableXfa = params.enableXfa === true;\n\n if (\n typeof params.docBaseUrl !== \"string\" ||\n isDataScheme(params.docBaseUrl)\n ) {\n // Ignore \"data:\"-URLs, since they can't be used to recover valid absolute\n // URLs anyway. We want to avoid sending them to the worker-thread, since\n // they contain the *entire* PDF document and can thus be arbitrarily long.\n params.docBaseUrl = null;\n }\n if (!Number.isInteger(params.maxImageSize)) {\n params.maxImageSize = -1;\n }\n if (typeof params.isEvalSupported !== \"boolean\") {\n params.isEvalSupported = true;\n }\n if (typeof params.disableFontFace !== \"boolean\") {\n params.disableFontFace = apiCompatibilityParams.disableFontFace || false;\n }\n if (typeof params.ownerDocument === \"undefined\") {\n params.ownerDocument = globalThis.document;\n }\n\n if (typeof params.disableRange !== \"boolean\") {\n params.disableRange = false;\n }\n if (typeof params.disableStream !== \"boolean\") {\n params.disableStream = false;\n }\n if (typeof params.disableAutoFetch !== \"boolean\") {\n params.disableAutoFetch = false;\n }\n\n // Set the main-thread verbosity level.\n setVerbosityLevel(params.verbosity);\n\n if (!worker) {\n const workerParams = {\n verbosity: params.verbosity,\n port: GlobalWorkerOptions.workerPort,\n };\n // Worker was not provided -- creating and owning our own. If message port\n // is specified in global worker options, using it.\n worker = workerParams.port\n ? PDFWorker.fromPort(workerParams)\n : new PDFWorker(workerParams);\n task._worker = worker;\n }\n const docId = task.docId;\n worker.promise\n .then(function () {\n if (task.destroyed) {\n throw new Error(\"Loading aborted\");\n }\n\n const workerIdPromise = _fetchDocument(\n worker,\n params,\n rangeTransport,\n docId\n );\n const networkStreamPromise = new Promise(function (resolve) {\n let networkStream;\n if (rangeTransport) {\n networkStream = new PDFDataTransportStream(\n {\n length: params.length,\n initialData: params.initialData,\n progressiveDone: params.progressiveDone,\n contentDispositionFilename: params.contentDispositionFilename,\n disableRange: params.disableRange,\n disableStream: params.disableStream,\n },\n rangeTransport\n );\n } else if (!params.data) {\n networkStream = createPDFNetworkStream({\n url: params.url,\n length: params.length,\n httpHeaders: params.httpHeaders,\n withCredentials: params.withCredentials,\n rangeChunkSize: params.rangeChunkSize,\n disableRange: params.disableRange,\n disableStream: params.disableStream,\n });\n }\n resolve(networkStream);\n });\n\n return Promise.all([workerIdPromise, networkStreamPromise]).then(\n function ([workerId, networkStream]) {\n if (task.destroyed) {\n throw new Error(\"Loading aborted\");\n }\n\n const messageHandler = new MessageHandler(\n docId,\n workerId,\n worker.port\n );\n messageHandler.postMessageTransfers = worker.postMessageTransfers;\n const transport = new WorkerTransport(\n messageHandler,\n task,\n networkStream,\n params\n );\n task._transport = transport;\n messageHandler.send(\"Ready\", null);\n }\n );\n })\n .catch(task._capability.reject);\n\n return task;\n}\n\n/**\n * Starts fetching of specified PDF document/data.\n *\n * @param {PDFWorker} worker\n * @param {Object} source\n * @param {PDFDataRangeTransport} pdfDataRangeTransport\n * @param {string} docId - Unique document ID, used in `MessageHandler`.\n * @returns {Promise} A promise that is resolved when the worker ID of the\n * `MessageHandler` is known.\n * @private\n */\nfunction _fetchDocument(worker, source, pdfDataRangeTransport, docId) {\n if (worker.destroyed) {\n return Promise.reject(new Error(\"Worker was destroyed\"));\n }\n\n if (pdfDataRangeTransport) {\n source.length = pdfDataRangeTransport.length;\n source.initialData = pdfDataRangeTransport.initialData;\n source.progressiveDone = pdfDataRangeTransport.progressiveDone;\n source.contentDispositionFilename =\n pdfDataRangeTransport.contentDispositionFilename;\n }\n return worker.messageHandler\n .sendWithPromise(\"GetDocRequest\", {\n docId,\n apiVersion:\n typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"TESTING\")\n ? PDFJSDev.eval(\"BUNDLE_VERSION\")\n : null,\n // Only send the required properties, and *not* the entire object.\n source: {\n data: source.data,\n url: source.url,\n password: source.password,\n disableAutoFetch: source.disableAutoFetch,\n rangeChunkSize: source.rangeChunkSize,\n length: source.length,\n },\n maxImageSize: source.maxImageSize,\n disableFontFace: source.disableFontFace,\n postMessageTransfers: worker.postMessageTransfers,\n docBaseUrl: source.docBaseUrl,\n ignoreErrors: source.ignoreErrors,\n isEvalSupported: source.isEvalSupported,\n fontExtraProperties: source.fontExtraProperties,\n enableXfa: source.enableXfa,\n })\n .then(function (workerId) {\n if (worker.destroyed) {\n throw new Error(\"Worker was destroyed\");\n }\n return workerId;\n });\n}\n\n/**\n * The loading task controls the operations required to load a PDF document\n * (such as network requests) and provides a way to listen for completion,\n * after which individual pages can be rendered.\n *\n * @typedef {Object} PDFDocumentLoadingTask\n * @property {string} docId - Unique identifier for the document loading task.\n * @property {boolean} destroyed - Whether the loading task is destroyed or not.\n * @property {function} [onPassword] - Callback to request a password if a wrong\n * or no password was provided. The callback receives two parameters: a\n * function that should be called with the new password, and a reason (see\n * {@link PasswordResponses}).\n * @property {function} [onProgress] - Callback to be able to monitor the\n * loading progress of the PDF file (necessary to implement e.g. a loading\n * bar). The callback receives an {Object} with the properties `loaded`\n * ({number}) and `total` ({number}) that indicate how many bytes are loaded.\n * @property {function} [onUnsupportedFeature] - Callback for when an\n * unsupported feature is used in the PDF document. The callback receives an\n * {@link UNSUPPORTED_FEATURES} argument.\n * @property {Promise<PDFDocumentProxy>} promise - Promise for document loading\n * task completion.\n * @property {function} destroy - Abort all network requests and destroy\n * the worker. Returns a promise that is resolved when destruction is\n * completed.\n */\n\n/**\n * @type {any}\n * @ignore\n */\nconst PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {\n let nextDocumentId = 0;\n\n /**\n * The loading task controls the operations required to load a PDF document\n * (such as network requests) and provides a way to listen for completion,\n * after which individual pages can be rendered.\n */\n // eslint-disable-next-line no-shadow\n class PDFDocumentLoadingTask {\n constructor() {\n this._capability = createPromiseCapability();\n this._transport = null;\n this._worker = null;\n\n /**\n * Unique identifier for the document loading task.\n * @type {string}\n */\n this.docId = \"d\" + nextDocumentId++;\n\n /**\n * Whether the loading task is destroyed or not.\n * @type {boolean}\n */\n this.destroyed = false;\n\n /**\n * Callback to request a password if a wrong or no password was provided.\n * The callback receives two parameters: a function that should be called\n * with the new password, and a reason (see {@link PasswordResponses}).\n * @type {function}\n */\n this.onPassword = null;\n\n /**\n * Callback to be able to monitor the loading progress of the PDF file\n * (necessary to implement e.g. a loading bar). The callback receives\n * an {Object} with the properties `loaded` ({number}) and `total`\n * ({number}) that indicate how many bytes are loaded.\n * @type {function}\n */\n this.onProgress = null;\n\n /**\n * Callback for when an unsupported feature is used in the PDF document.\n * The callback receives an {@link UNSUPPORTED_FEATURES} argument.\n * @type {function}\n */\n this.onUnsupportedFeature = null;\n }\n\n /**\n * Promise for document loading task completion.\n * @type {Promise<PDFDocumentProxy>}\n */\n get promise() {\n return this._capability.promise;\n }\n\n /**\n * @returns {Promise<void>} A promise that is resolved when destruction is\n * completed.\n */\n destroy() {\n this.destroyed = true;\n\n const transportDestroyed = !this._transport\n ? Promise.resolve()\n : this._transport.destroy();\n return transportDestroyed.then(() => {\n this._transport = null;\n if (this._worker) {\n this._worker.destroy();\n this._worker = null;\n }\n });\n }\n }\n return PDFDocumentLoadingTask;\n})();\n\n/**\n * Abstract class to support range requests file loading.\n */\nclass PDFDataRangeTransport {\n /**\n * @param {number} length\n * @param {Uint8Array} initialData\n * @param {boolean} [progressiveDone]\n * @param {string} [contentDispositionFilename]\n */\n constructor(\n length,\n initialData,\n progressiveDone = false,\n contentDispositionFilename = null\n ) {\n this.length = length;\n this.initialData = initialData;\n this.progressiveDone = progressiveDone;\n this.contentDispositionFilename = contentDispositionFilename;\n\n this._rangeListeners = [];\n this._progressListeners = [];\n this._progressiveReadListeners = [];\n this._progressiveDoneListeners = [];\n this._readyCapability = createPromiseCapability();\n }\n\n addRangeListener(listener) {\n this._rangeListeners.push(listener);\n }\n\n addProgressListener(listener) {\n this._progressListeners.push(listener);\n }\n\n addProgressiveReadListener(listener) {\n this._progressiveReadListeners.push(listener);\n }\n\n addProgressiveDoneListener(listener) {\n this._progressiveDoneListeners.push(listener);\n }\n\n onDataRange(begin, chunk) {\n for (const listener of this._rangeListeners) {\n listener(begin, chunk);\n }\n }\n\n onDataProgress(loaded, total) {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressListeners) {\n listener(loaded, total);\n }\n });\n }\n\n onDataProgressiveRead(chunk) {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressiveReadListeners) {\n listener(chunk);\n }\n });\n }\n\n onDataProgressiveDone() {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressiveDoneListeners) {\n listener();\n }\n });\n }\n\n transportReady() {\n this._readyCapability.resolve();\n }\n\n requestDataRange(begin, end) {\n unreachable(\"Abstract method PDFDataRangeTransport.requestDataRange\");\n }\n\n abort() {}\n}\n\n/**\n * Proxy to a `PDFDocument` in the worker thread.\n */\nclass PDFDocumentProxy {\n constructor(pdfInfo, transport) {\n this._pdfInfo = pdfInfo;\n this._transport = transport;\n }\n\n /**\n * @type {AnnotationStorage} Storage for annotation data in forms.\n */\n get annotationStorage() {\n return this._transport.annotationStorage;\n }\n\n /**\n * @type {number} Total number of pages in the PDF file.\n */\n get numPages() {\n return this._pdfInfo.numPages;\n }\n\n /**\n * @type {string} A (not guaranteed to be) unique ID to identify a PDF.\n */\n get fingerprint() {\n return this._pdfInfo.fingerprint;\n }\n\n /**\n * @type {boolean} True if only XFA form.\n */\n get isPureXfa() {\n return this._pdfInfo.isPureXfa;\n }\n\n /**\n * @param {number} pageNumber - The page number to get. The first page is 1.\n * @returns {Promise<PDFPageProxy>} A promise that is resolved with\n * a {@link PDFPageProxy} object.\n */\n getPage(pageNumber) {\n return this._transport.getPage(pageNumber);\n }\n\n /**\n * @typedef {Object} RefProxy\n * @property {number} num\n * @property {number} gen\n */\n\n /**\n * @param {RefProxy} ref - The page reference.\n * @returns {Promise<number>} A promise that is resolved with the page index,\n * starting from zero, that is associated with the reference.\n */\n getPageIndex(ref) {\n return this._transport.getPageIndex(ref);\n }\n\n /**\n * @returns {Promise<Object<string, Array<any>>>} A promise that is resolved\n * with a mapping from named destinations to references.\n *\n * This can be slow for large documents. Use `getDestination` instead.\n */\n getDestinations() {\n return this._transport.getDestinations();\n }\n\n /**\n * @param {string} id - The named destination to get.\n * @returns {Promise<Array<any> | null>} A promise that is resolved with all\n * information of the given named destination, or `null` when the named\n * destination is not present in the PDF file.\n */\n getDestination(id) {\n return this._transport.getDestination(id);\n }\n\n /**\n * @returns {Promise<Array<string> | null>} A promise that is resolved with\n * an {Array} containing the page labels that correspond to the page\n * indexes, or `null` when no page labels are present in the PDF file.\n */\n getPageLabels() {\n return this._transport.getPageLabels();\n }\n\n /**\n * @returns {Promise<string>} A promise that is resolved with a {string}\n * containing the page layout name.\n */\n getPageLayout() {\n return this._transport.getPageLayout();\n }\n\n /**\n * @returns {Promise<string>} A promise that is resolved with a {string}\n * containing the page mode name.\n */\n getPageMode() {\n return this._transport.getPageMode();\n }\n\n /**\n * @returns {Promise<Object | null>} A promise that is resolved with an\n * {Object} containing the viewer preferences, or `null` when no viewer\n * preferences are present in the PDF file.\n */\n getViewerPreferences() {\n return this._transport.getViewerPreferences();\n }\n\n /**\n * @returns {Promise<any | null>} A promise that is resolved with an {Array}\n * containing the destination, or `null` when no open action is present\n * in the PDF.\n */\n getOpenAction() {\n return this._transport.getOpenAction();\n }\n\n /**\n * @returns {Promise<any>} A promise that is resolved with a lookup table\n * for mapping named attachments to their content.\n */\n getAttachments() {\n return this._transport.getAttachments();\n }\n\n /**\n * @returns {Promise<Array<string> | null>} A promise that is resolved with\n * an {Array} of all the JavaScript strings in the name tree, or `null`\n * if no JavaScript exists.\n */\n getJavaScript() {\n return this._transport.getJavaScript();\n }\n\n /**\n * @returns {Promise<Object | null>} A promise that is resolved with\n * an {Object} with the JavaScript actions:\n * - from the name tree (like getJavaScript);\n * - from A or AA entries in the catalog dictionary.\n * , or `null` if no JavaScript exists.\n */\n getJSActions() {\n return this._transport.getDocJSActions();\n }\n\n /**\n * @typedef {Object} OutlineNode\n * @property {string} title\n * @property {boolean} bold\n * @property {boolean} italic\n * @property {Uint8ClampedArray} color - The color in RGB format to use for\n * display purposes.\n * @property {string | Array<any> | null} dest\n * @property {string | null} url\n * @property {string | undefined} unsafeUrl\n * @property {boolean | undefined} newWindow\n * @property {number | undefined} count\n * @property {Array<OutlineNode>} items\n */\n\n /**\n * @returns {Promise<Array<OutlineNode>>} A promise that is resolved with an\n * {Array} that is a tree outline (if it has one) of the PDF file.\n */\n getOutline() {\n return this._transport.getOutline();\n }\n\n /**\n * @returns {Promise<OptionalContentConfig>} A promise that is resolved with\n * an {@link OptionalContentConfig} that contains all the optional content\n * groups (assuming that the document has any).\n */\n getOptionalContentConfig() {\n return this._transport.getOptionalContentConfig();\n }\n\n /**\n * @returns {Promise<Array<number> | null>} A promise that is resolved with\n * an {Array} that contains the permission flags for the PDF document, or\n * `null` when no permissions are present in the PDF file.\n */\n getPermissions() {\n return this._transport.getPermissions();\n }\n\n /**\n * @returns {Promise<{ info: Object, metadata: Metadata }>} A promise that is\n * resolved with an {Object} that has `info` and `metadata` properties.\n * `info` is an {Object} filled with anything available in the information\n * dictionary and similarly `metadata` is a {Metadata} object with\n * information from the metadata section of the PDF.\n */\n getMetadata() {\n return this._transport.getMetadata();\n }\n\n /**\n * @typedef {Object} MarkInfo\n * Properties correspond to Table 321 of the PDF 32000-1:2008 spec.\n * @property {boolean} Marked\n * @property {boolean} UserProperties\n * @property {boolean} Suspects\n */\n\n /**\n * @returns {Promise<MarkInfo | null>} A promise that is resolved with\n * a {MarkInfo} object that contains the MarkInfo flags for the PDF\n * document, or `null` when no MarkInfo values are present in the PDF file.\n */\n getMarkInfo() {\n return this._transport.getMarkInfo();\n }\n\n /**\n * @returns {Promise<TypedArray>} A promise that is resolved with a\n * {TypedArray} that has the raw data from the PDF.\n */\n getData() {\n return this._transport.getData();\n }\n\n /**\n * @returns {Promise<{ length: number }>} A promise that is resolved when the\n * document's data is loaded. It is resolved with an {Object} that contains\n * the `length` property that indicates size of the PDF data in bytes.\n */\n getDownloadInfo() {\n return this._transport.downloadInfoCapability.promise;\n }\n\n /**\n * @typedef {Object} PDFDocumentStats\n * @property {Object<string, boolean>} streamTypes - Used stream types in the\n * document (an item is set to true if specific stream ID was used in the\n * document).\n * @property {Object<string, boolean>} fontTypes - Used font types in the\n * document (an item is set to true if specific font ID was used in the\n * document).\n */\n\n /**\n * @returns {Promise<PDFDocumentStats>} A promise this is resolved with\n * current statistics about document structures (see\n * {@link PDFDocumentStats}).\n */\n getStats() {\n return this._transport.getStats();\n }\n\n /**\n * Cleans up resources allocated by the document on both the main and worker\n * threads.\n *\n * NOTE: Do not, under any circumstances, call this method when rendering is\n * currently ongoing since that may lead to rendering errors.\n *\n * @param {boolean} [keepLoadedFonts] - Let fonts remain attached to the DOM.\n * NOTE: This will increase persistent memory usage, hence don't use this\n * option unless absolutely necessary. The default value is `false`.\n * @returns {Promise} A promise that is resolved when clean-up has finished.\n */\n cleanup(keepLoadedFonts = false) {\n return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa);\n }\n\n /**\n * Destroys the current document instance and terminates the worker.\n */\n destroy() {\n return this.loadingTask.destroy();\n }\n\n /**\n * @type {DocumentInitParameters} A subset of the current\n * {DocumentInitParameters}, which are either needed in the viewer and/or\n * whose default values may be affected by the `apiCompatibilityParams`.\n */\n get loadingParams() {\n return this._transport.loadingParams;\n }\n\n /**\n * @type {PDFDocumentLoadingTask} The loadingTask for the current document.\n */\n get loadingTask() {\n return this._transport.loadingTask;\n }\n\n /**\n * @returns {Promise<Uint8Array>} A promise that is resolved with a\n * {Uint8Array} containing the full data of the saved document.\n */\n saveDocument() {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n arguments.length > 0\n ) {\n deprecated(\"saveDocument no longer accepts any options.\");\n }\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this._transport.annotationStorage.size <= 0\n ) {\n deprecated(\n \"saveDocument called while `annotationStorage` is empty, \" +\n \"please use the getData-method instead.\"\n );\n }\n return this._transport.saveDocument();\n }\n\n /**\n * @returns {Promise<Array<Object> | null>} A promise that is resolved with an\n * {Array<Object>} containing /AcroForm field data for the JS sandbox,\n * or `null` when no field data is present in the PDF file.\n */\n getFieldObjects() {\n return this._transport.getFieldObjects();\n }\n\n /**\n * @returns {Promise<boolean>} A promise that is resolved with `true`\n * if some /AcroForm fields have JavaScript actions.\n */\n hasJSActions() {\n return this._transport.hasJSActions();\n }\n\n /**\n * @returns {Promise<Array<string> | null>} A promise that is resolved with an\n * {Array<string>} containing IDs of annotations that have a calculation\n * action, or `null` when no such annotations are present in the PDF file.\n */\n getCalculationOrderIds() {\n return this._transport.getCalculationOrderIds();\n }\n}\n\n/**\n * Page getViewport parameters.\n *\n * @typedef {Object} GetViewportParameters\n * @property {number} scale - The desired scale of the viewport.\n * @property {number} [rotation] - The desired rotation, in degrees, of\n * the viewport. If omitted it defaults to the page rotation.\n * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.\n * The default value is `0`.\n * @property {number} [offsetY] - The vertical, i.e. y-axis, offset.\n * The default value is `0`.\n * @property {boolean} [dontFlip] - If true, the y-axis will not be\n * flipped. The default value is `false`.\n */\n\n/**\n * Page getTextContent parameters.\n *\n * @typedef {Object} getTextContentParameters\n * @property {boolean} normalizeWhitespace - Replaces all occurrences of\n * whitespace with standard spaces (0x20). The default value is `false`.\n * @property {boolean} disableCombineTextItems - Do not attempt to combine\n * same line {@link TextItem}'s. The default value is `false`.\n * @property {boolean} [includeMarkedContent] - When true include marked\n * content items in the items array of TextContent. The default is `false`.\n */\n\n/**\n * Page text content.\n *\n * @typedef {Object} TextContent\n * @property {Array<TextItem | TextMarkedContent>} items - Array of\n * {@link TextItem} and {@link TextMarkedContent} objects. TextMarkedContent\n * items are included when includeMarkedContent is true.\n * @property {Object<string, TextStyle>} styles - {@link TextStyle} objects,\n * indexed by font name.\n */\n\n/**\n * Page text content part.\n *\n * @typedef {Object} TextItem\n * @property {string} str - Text content.\n * @property {string} dir - Text direction: 'ttb', 'ltr' or 'rtl'.\n * @property {Array<any>} transform - Transformation matrix.\n * @property {number} width - Width in device space.\n * @property {number} height - Height in device space.\n * @property {string} fontName - Font name used by PDF.js for converted font.\n *\n */\n\n/**\n * Page text marked content part.\n *\n * @typedef {Object} TextMarkedContent\n * @property {string} type - Either 'beginMarkedContent',\n * 'beginMarkedContentProps', or 'endMarkedContent'.\n * @property {string} id - The marked content identifier. Only used for type\n * 'beginMarkedContentProps'.\n */\n\n/**\n * Text style.\n *\n * @typedef {Object} TextStyle\n * @property {number} ascent - Font ascent.\n * @property {number} descent - Font descent.\n * @property {boolean} vertical - Whether or not the text is in vertical mode.\n * @property {string} fontFamily - The possible font family.\n */\n\n/**\n * Page annotation parameters.\n *\n * @typedef {Object} GetAnnotationsParameters\n * @property {string} intent - Determines the annotations that will be fetched,\n * can be either 'display' (viewable annotations) or 'print' (printable\n * annotations). If the parameter is omitted, all annotations are fetched.\n */\n\n/**\n * Page render parameters.\n *\n * @typedef {Object} RenderParameters\n * @property {Object} canvasContext - A 2D context of a DOM Canvas object.\n * @property {PageViewport} viewport - Rendering viewport obtained by calling\n * the `PDFPageProxy.getViewport` method.\n * @property {string} [intent] - Rendering intent, can be 'display' or 'print'.\n * The default value is 'display'.\n * @property {boolean} [renderInteractiveForms] - Whether or not interactive\n * form elements are rendered in the display layer. If so, we do not render\n * them on the canvas as well. The default value is `false`.\n * @property {Array<any>} [transform] - Additional transform, applied just\n * before viewport transform.\n * @property {Object} [imageLayer] - An object that has `beginLayout`,\n * `endLayout` and `appendImage` functions.\n * @property {Object} [canvasFactory] - The factory instance that will be used\n * when creating canvases. The default value is {new DOMCanvasFactory()}.\n * @property {Object | string} [background] - Background to use for the canvas.\n * Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS\n * <color> value, a `CanvasGradient` object (a linear or radial gradient) or\n * a `CanvasPattern` object (a repetitive image). The default value is\n * 'rgb(255,255,255)'.\n * @property {boolean} [includeAnnotationStorage] - Render stored interactive\n * form element data, from the {@link AnnotationStorage}-instance, onto the\n * canvas itself; useful e.g. for printing. The default value is `false`.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -\n * A promise that should resolve with an {@link OptionalContentConfig}\n * created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,\n * the configuration will be fetched automatically with the default visibility\n * states set.\n */\n\n/**\n * Structure tree node. The root node will have a role \"Root\".\n *\n * @typedef {Object} StructTreeNode\n * @property {Array<StructTreeNode | StructTreeContent>} children - Array of\n * {@link StructTreeNode} and {@link StructTreeContent} objects.\n * @property {string} role - element's role, already mapped if a role map exists\n * in the PDF.\n */\n\n/**\n * Structure tree content.\n *\n * @typedef {Object} StructTreeContent\n * @property {string} type - either \"content\" for page and stream structure\n * elements or \"object\" for object references.\n * @property {string} id - unique id that will map to the text layer.\n */\n\n/**\n * PDF page operator list.\n *\n * @typedef {Object} PDFOperatorList\n * @property {Array<number>} fnArray - Array containing the operator functions.\n * @property {Array<any>} argsArray - Array containing the arguments of the\n * functions.\n */\n\n/**\n * Proxy to a `PDFPage` in the worker thread.\n */\nclass PDFPageProxy {\n constructor(pageIndex, pageInfo, transport, ownerDocument, pdfBug = false) {\n this._pageIndex = pageIndex;\n this._pageInfo = pageInfo;\n this._ownerDocument = ownerDocument;\n this._transport = transport;\n this._stats = pdfBug ? new StatTimer() : null;\n this._pdfBug = pdfBug;\n this.commonObjs = transport.commonObjs;\n this.objs = new PDFObjects();\n\n this.cleanupAfterRender = false;\n this.pendingCleanup = false;\n this._intentStates = new Map();\n this.destroyed = false;\n }\n\n /**\n * @type {number} Page number of the page. First page is 1.\n */\n get pageNumber() {\n return this._pageIndex + 1;\n }\n\n /**\n * @type {number} The number of degrees the page is rotated clockwise.\n */\n get rotate() {\n return this._pageInfo.rotate;\n }\n\n /**\n * @type {Object} The reference that points to this page. It has `num` and\n * `gen` properties.\n */\n get ref() {\n return this._pageInfo.ref;\n }\n\n /**\n * @type {number} The default size of units in 1/72nds of an inch.\n */\n get userUnit() {\n return this._pageInfo.userUnit;\n }\n\n /**\n * @type {Array<number>} An array of the visible portion of the PDF page in\n * user space units [x1, y1, x2, y2].\n */\n get view() {\n return this._pageInfo.view;\n }\n\n /**\n * @param {GetViewportParameters} params - Viewport parameters.\n * @returns {PageViewport} Contains 'width' and 'height' properties\n * along with transforms required for rendering.\n */\n getViewport({\n scale,\n rotation = this.rotate,\n offsetX = 0,\n offsetY = 0,\n dontFlip = false,\n } = {}) {\n return new PageViewport({\n viewBox: this.view,\n scale,\n rotation,\n offsetX,\n offsetY,\n dontFlip,\n });\n }\n\n /**\n * @param {GetAnnotationsParameters} params - Annotation parameters.\n * @returns {Promise<Array<any>>} A promise that is resolved with an\n * {Array} of the annotation objects.\n */\n getAnnotations({ intent = null } = {}) {\n if (!this._annotationsPromise || this._annotationsIntent !== intent) {\n this._annotationsPromise = this._transport.getAnnotations(\n this._pageIndex,\n intent\n );\n this._annotationsIntent = intent;\n }\n return this._annotationsPromise;\n }\n\n /**\n * @returns {Promise<Object>} A promise that is resolved with an\n * {Object} with JS actions.\n */\n getJSActions() {\n return (this._jsActionsPromise ||= this._transport.getPageJSActions(\n this._pageIndex\n ));\n }\n\n /**\n * @returns {Promise<Object | null>} A promise that is resolved with\n * an {Object} with a fake DOM object (a tree structure where elements\n * are {Object} with a name, attributes (class, style, ...), value and\n * children, very similar to a HTML DOM tree), or `null` if no XFA exists.\n */\n getXfa() {\n return (this._xfaPromise ||= this._transport.getPageXfa(this._pageIndex));\n }\n\n /**\n * Begins the process of rendering a page to the desired context.\n *\n * @param {RenderParameters} params Page render parameters.\n * @returns {RenderTask} An object that contains a promise that is\n * resolved when the page finishes rendering.\n */\n render({\n canvasContext,\n viewport,\n intent = \"display\",\n renderInteractiveForms = false,\n transform = null,\n imageLayer = null,\n canvasFactory = null,\n background = null,\n includeAnnotationStorage = false,\n optionalContentConfigPromise = null,\n }) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n arguments[0]?.annotationStorage !== undefined\n ) {\n deprecated(\n \"render no longer accepts an `annotationStorage` option, \" +\n \"please use the `includeAnnotationStorage`-boolean instead.\"\n );\n includeAnnotationStorage ||= !!arguments[0].annotationStorage;\n }\n if (this._stats) {\n this._stats.time(\"Overall\");\n }\n\n const renderingIntent = intent === \"print\" ? \"print\" : \"display\";\n // If there was a pending destroy, cancel it so no cleanup happens during\n // this call to render.\n this.pendingCleanup = false;\n\n if (!optionalContentConfigPromise) {\n optionalContentConfigPromise = this._transport.getOptionalContentConfig();\n }\n\n let intentState = this._intentStates.get(renderingIntent);\n if (!intentState) {\n intentState = Object.create(null);\n this._intentStates.set(renderingIntent, intentState);\n }\n\n // Ensure that a pending `streamReader` cancel timeout is always aborted.\n if (intentState.streamReaderCancelTimeout) {\n clearTimeout(intentState.streamReaderCancelTimeout);\n intentState.streamReaderCancelTimeout = null;\n }\n\n const canvasFactoryInstance =\n canvasFactory ||\n new DefaultCanvasFactory({ ownerDocument: this._ownerDocument });\n const annotationStorage = includeAnnotationStorage\n ? this._transport.annotationStorage.serializable\n : null;\n\n // If there's no displayReadyCapability yet, then the operatorList\n // was never requested before. Make the request and create the promise.\n if (!intentState.displayReadyCapability) {\n intentState.displayReadyCapability = createPromiseCapability();\n intentState.operatorList = {\n fnArray: [],\n argsArray: [],\n lastChunk: false,\n };\n\n if (this._stats) {\n this._stats.time(\"Page Request\");\n }\n this._pumpOperatorList({\n pageIndex: this._pageIndex,\n intent: renderingIntent,\n renderInteractiveForms: renderInteractiveForms === true,\n annotationStorage,\n });\n }\n\n const complete = error => {\n intentState.renderTasks.delete(internalRenderTask);\n\n // Attempt to reduce memory usage during *printing*, by always running\n // cleanup once rendering has finished (regardless of cleanupAfterRender).\n if (this.cleanupAfterRender || renderingIntent === \"print\") {\n this.pendingCleanup = true;\n }\n this._tryCleanup();\n\n if (error) {\n internalRenderTask.capability.reject(error);\n\n this._abortOperatorList({\n intentState,\n reason: error,\n });\n } else {\n internalRenderTask.capability.resolve();\n }\n if (this._stats) {\n this._stats.timeEnd(\"Rendering\");\n this._stats.timeEnd(\"Overall\");\n }\n };\n\n const internalRenderTask = new InternalRenderTask({\n callback: complete,\n // Only include the required properties, and *not* the entire object.\n params: {\n canvasContext,\n viewport,\n transform,\n imageLayer,\n background,\n },\n objs: this.objs,\n commonObjs: this.commonObjs,\n operatorList: intentState.operatorList,\n pageIndex: this._pageIndex,\n canvasFactory: canvasFactoryInstance,\n useRequestAnimationFrame: renderingIntent !== \"print\",\n pdfBug: this._pdfBug,\n });\n\n (intentState.renderTasks ||= new Set()).add(internalRenderTask);\n const renderTask = internalRenderTask.task;\n\n Promise.all([\n intentState.displayReadyCapability.promise,\n optionalContentConfigPromise,\n ])\n .then(([transparency, optionalContentConfig]) => {\n if (this.pendingCleanup) {\n complete();\n return;\n }\n if (this._stats) {\n this._stats.time(\"Rendering\");\n }\n internalRenderTask.initializeGraphics({\n transparency,\n optionalContentConfig,\n });\n internalRenderTask.operatorListChanged();\n })\n .catch(complete);\n\n return renderTask;\n }\n\n /**\n * @returns {Promise<PDFOperatorList>} A promise resolved with an\n * {@link PDFOperatorList} object that represents page's operator list.\n */\n getOperatorList() {\n function operatorListChanged() {\n if (intentState.operatorList.lastChunk) {\n intentState.opListReadCapability.resolve(intentState.operatorList);\n\n intentState.renderTasks.delete(opListTask);\n }\n }\n\n const renderingIntent = \"oplist\";\n let intentState = this._intentStates.get(renderingIntent);\n if (!intentState) {\n intentState = Object.create(null);\n this._intentStates.set(renderingIntent, intentState);\n }\n let opListTask;\n\n if (!intentState.opListReadCapability) {\n opListTask = Object.create(null);\n opListTask.operatorListChanged = operatorListChanged;\n intentState.opListReadCapability = createPromiseCapability();\n (intentState.renderTasks ||= new Set()).add(opListTask);\n intentState.operatorList = {\n fnArray: [],\n argsArray: [],\n lastChunk: false,\n };\n\n if (this._stats) {\n this._stats.time(\"Page Request\");\n }\n this._pumpOperatorList({\n pageIndex: this._pageIndex,\n intent: renderingIntent,\n });\n }\n return intentState.opListReadCapability.promise;\n }\n\n /**\n * @param {getTextContentParameters} params - getTextContent parameters.\n * @returns {ReadableStream} Stream for reading text content chunks.\n */\n streamTextContent({\n normalizeWhitespace = false,\n disableCombineTextItems = false,\n includeMarkedContent = false,\n } = {}) {\n const TEXT_CONTENT_CHUNK_SIZE = 100;\n\n return this._transport.messageHandler.sendWithStream(\n \"GetTextContent\",\n {\n pageIndex: this._pageIndex,\n normalizeWhitespace: normalizeWhitespace === true,\n combineTextItems: disableCombineTextItems !== true,\n includeMarkedContent: includeMarkedContent === true,\n },\n {\n highWaterMark: TEXT_CONTENT_CHUNK_SIZE,\n size(textContent) {\n return textContent.items.length;\n },\n }\n );\n }\n\n /**\n * @param {getTextContentParameters} params - getTextContent parameters.\n * @returns {Promise<TextContent>} A promise that is resolved with a\n * {@link TextContent} object that represents the page's text content.\n */\n getTextContent(params = {}) {\n const readableStream = this.streamTextContent(params);\n\n return new Promise(function (resolve, reject) {\n function pump() {\n reader.read().then(function ({ value, done }) {\n if (done) {\n resolve(textContent);\n return;\n }\n Object.assign(textContent.styles, value.styles);\n textContent.items.push(...value.items);\n pump();\n }, reject);\n }\n\n const reader = readableStream.getReader();\n const textContent = {\n items: [],\n styles: Object.create(null),\n };\n pump();\n });\n }\n\n /**\n * @returns {Promise<StructTreeNode>} A promise that is resolved with a\n * {@link StructTreeNode} object that represents the page's structure tree,\n * or `null` when no structure tree is present for the current page.\n */\n getStructTree() {\n return (this._structTreePromise ||= this._transport.getStructTree(\n this._pageIndex\n ));\n }\n\n /**\n * Destroys the page object.\n * @private\n */\n _destroy() {\n this.destroyed = true;\n this._transport.pageCache[this._pageIndex] = null;\n\n const waitOn = [];\n for (const [intent, intentState] of this._intentStates) {\n this._abortOperatorList({\n intentState,\n reason: new Error(\"Page was destroyed.\"),\n force: true,\n });\n\n if (intent === \"oplist\") {\n // Avoid errors below, since the renderTasks are just stubs.\n continue;\n }\n for (const internalRenderTask of intentState.renderTasks) {\n waitOn.push(internalRenderTask.completed);\n internalRenderTask.cancel();\n }\n }\n this.objs.clear();\n this._annotationsPromise = null;\n this._jsActionsPromise = null;\n this._xfaPromise = null;\n this._structTreePromise = null;\n this.pendingCleanup = false;\n return Promise.all(waitOn);\n }\n\n /**\n * Cleans up resources allocated by the page.\n *\n * @param {boolean} [resetStats] - Reset page stats, if enabled.\n * The default value is `false`.\n * @returns {boolean} Indicates if clean-up was successfully run.\n */\n cleanup(resetStats = false) {\n this.pendingCleanup = true;\n return this._tryCleanup(resetStats);\n }\n\n /**\n * Attempts to clean up if rendering is in a state where that's possible.\n * @private\n */\n _tryCleanup(resetStats = false) {\n if (!this.pendingCleanup) {\n return false;\n }\n for (const { renderTasks, operatorList } of this._intentStates.values()) {\n if (renderTasks.size > 0 || !operatorList.lastChunk) {\n return false;\n }\n }\n\n this._intentStates.clear();\n this.objs.clear();\n this._annotationsPromise = null;\n this._jsActionsPromise = null;\n this._xfaPromise = null;\n this._structTreePromise = null;\n if (resetStats && this._stats) {\n this._stats = new StatTimer();\n }\n this.pendingCleanup = false;\n return true;\n }\n\n /**\n * @private\n */\n _startRenderPage(transparency, intent) {\n const intentState = this._intentStates.get(intent);\n if (!intentState) {\n return; // Rendering was cancelled.\n }\n if (this._stats) {\n this._stats.timeEnd(\"Page Request\");\n }\n // TODO Refactor RenderPageRequest to separate rendering\n // and operator list logic\n if (intentState.displayReadyCapability) {\n intentState.displayReadyCapability.resolve(transparency);\n }\n }\n\n /**\n * @private\n */\n _renderPageChunk(operatorListChunk, intentState) {\n // Add the new chunk to the current operator list.\n for (let i = 0, ii = operatorListChunk.length; i < ii; i++) {\n intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);\n intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);\n }\n intentState.operatorList.lastChunk = operatorListChunk.lastChunk;\n\n // Notify all the rendering tasks there are more operators to be consumed.\n for (const internalRenderTask of intentState.renderTasks) {\n internalRenderTask.operatorListChanged();\n }\n\n if (operatorListChunk.lastChunk) {\n this._tryCleanup();\n }\n }\n\n /**\n * @private\n */\n _pumpOperatorList(args) {\n assert(\n args.intent,\n 'PDFPageProxy._pumpOperatorList: Expected \"intent\" argument.'\n );\n\n const readableStream = this._transport.messageHandler.sendWithStream(\n \"GetOperatorList\",\n args\n );\n const reader = readableStream.getReader();\n\n const intentState = this._intentStates.get(args.intent);\n intentState.streamReader = reader;\n\n const pump = () => {\n reader.read().then(\n ({ value, done }) => {\n if (done) {\n intentState.streamReader = null;\n return;\n }\n if (this._transport.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n this._renderPageChunk(value, intentState);\n pump();\n },\n reason => {\n intentState.streamReader = null;\n\n if (this._transport.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n if (intentState.operatorList) {\n // Mark operator list as complete.\n intentState.operatorList.lastChunk = true;\n\n for (const internalRenderTask of intentState.renderTasks) {\n internalRenderTask.operatorListChanged();\n }\n this._tryCleanup();\n }\n\n if (intentState.displayReadyCapability) {\n intentState.displayReadyCapability.reject(reason);\n } else if (intentState.opListReadCapability) {\n intentState.opListReadCapability.reject(reason);\n } else {\n throw reason;\n }\n }\n );\n };\n pump();\n }\n\n /**\n * @private\n */\n _abortOperatorList({ intentState, reason, force = false }) {\n assert(\n reason instanceof Error ||\n (typeof reason === \"object\" && reason !== null),\n 'PDFPageProxy._abortOperatorList: Expected \"reason\" argument.'\n );\n\n if (!intentState.streamReader) {\n return;\n }\n if (!force) {\n // Ensure that an Error occurring in *only* one `InternalRenderTask`, e.g.\n // multiple render() calls on the same canvas, won't break all rendering.\n if (intentState.renderTasks.size > 0) {\n return;\n }\n // Don't immediately abort parsing on the worker-thread when rendering is\n // cancelled, since that will unnecessarily delay re-rendering when (for\n // partially parsed pages) e.g. zooming/rotation occurs in the viewer.\n if (reason instanceof RenderingCancelledException) {\n intentState.streamReaderCancelTimeout = setTimeout(() => {\n this._abortOperatorList({ intentState, reason, force: true });\n intentState.streamReaderCancelTimeout = null;\n }, RENDERING_CANCELLED_TIMEOUT);\n return;\n }\n }\n intentState.streamReader.cancel(new AbortException(reason?.message));\n intentState.streamReader = null;\n\n if (this._transport.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n // Remove the current `intentState`, since a cancelled `getOperatorList`\n // call on the worker-thread cannot be re-started...\n for (const [intent, curIntentState] of this._intentStates) {\n if (curIntentState === intentState) {\n this._intentStates.delete(intent);\n break;\n }\n }\n // ... and force clean-up to ensure that any old state is always removed.\n this.cleanup();\n }\n\n /**\n * @type {Object} Returns page stats, if enabled; returns `null` otherwise.\n */\n get stats() {\n return this._stats;\n }\n}\n\nclass LoopbackPort {\n constructor() {\n this._listeners = [];\n this._deferred = Promise.resolve(undefined);\n }\n\n postMessage(obj, transfers) {\n function cloneValue(value) {\n // Trying to perform a structured clone close to the spec, including\n // transfers.\n if (typeof value !== \"object\" || value === null) {\n return value;\n }\n if (cloned.has(value)) {\n // already cloned the object\n return cloned.get(value);\n }\n let buffer, result;\n if ((buffer = value.buffer) && isArrayBuffer(buffer)) {\n // We found object with ArrayBuffer (typed array).\n if (transfers?.includes(buffer)) {\n result = new value.constructor(\n buffer,\n value.byteOffset,\n value.byteLength\n );\n } else {\n result = new value.constructor(value);\n }\n cloned.set(value, result);\n return result;\n }\n if (value instanceof Map) {\n result = new Map();\n cloned.set(value, result); // Adding to cache now for cyclic references.\n for (const [key, val] of value) {\n result.set(key, cloneValue(val));\n }\n return result;\n }\n if (value instanceof Set) {\n result = new Set();\n cloned.set(value, result); // Adding to cache now for cyclic references.\n for (const val of value) {\n result.add(cloneValue(val));\n }\n return result;\n }\n if (value instanceof URL) {\n throw new Error(`LoopbackPort.postMessage - cannot clone: ${value}`);\n }\n result = Array.isArray(value) ? [] : Object.create(null);\n cloned.set(value, result); // Adding to cache now for cyclic references.\n // Cloning all value and object properties, however ignoring properties\n // defined via getter.\n for (const i in value) {\n let desc,\n p = value;\n while (!(desc = Object.getOwnPropertyDescriptor(p, i))) {\n p = Object.getPrototypeOf(p);\n }\n if (typeof desc.value === \"undefined\") {\n continue;\n }\n if (typeof desc.value === \"function\") {\n if (value.hasOwnProperty?.(i)) {\n throw new Error(\n `LoopbackPort.postMessage - cannot clone: ${value[i]}`\n );\n }\n continue;\n }\n result[i] = cloneValue(desc.value);\n }\n return result;\n }\n\n const cloned = new WeakMap();\n const event = { data: cloneValue(obj) };\n\n this._deferred.then(() => {\n for (const listener of this._listeners) {\n listener.call(this, event);\n }\n });\n }\n\n addEventListener(name, listener) {\n this._listeners.push(listener);\n }\n\n removeEventListener(name, listener) {\n const i = this._listeners.indexOf(listener);\n this._listeners.splice(i, 1);\n }\n\n terminate() {\n this._listeners.length = 0;\n }\n}\n\n/**\n * @typedef {Object} PDFWorkerParameters\n * @property {string} [name] - The name of the worker.\n * @property {Object} [port] - The `workerPort` object.\n * @property {number} [verbosity] - Controls the logging level; the\n * constants from {@link VerbosityLevel} should be used.\n */\n\n/** @type {any} */\nconst PDFWorker = (function PDFWorkerClosure() {\n const pdfWorkerPorts = new WeakMap();\n let isWorkerDisabled = false;\n let fallbackWorkerSrc;\n let nextFakeWorkerId = 0;\n let fakeWorkerCapability;\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\")) {\n // eslint-disable-next-line no-undef\n if (isNodeJS && typeof __non_webpack_require__ === \"function\") {\n // Workers aren't supported in Node.js, force-disabling them there.\n isWorkerDisabled = true;\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"LIB\")) {\n fallbackWorkerSrc = \"../pdf.worker.js\";\n } else {\n fallbackWorkerSrc = \"./pdf.worker.js\";\n }\n } else if (typeof document === \"object\" && \"currentScript\" in document) {\n const pdfjsFilePath = document.currentScript?.src;\n if (pdfjsFilePath) {\n fallbackWorkerSrc = pdfjsFilePath.replace(\n /(\\.(?:min\\.)?js)(\\?.*)?$/i,\n \".worker$1$2\"\n );\n }\n }\n }\n\n function getWorkerSrc() {\n if (GlobalWorkerOptions.workerSrc) {\n return GlobalWorkerOptions.workerSrc;\n }\n if (typeof fallbackWorkerSrc !== \"undefined\") {\n if (!isNodeJS) {\n deprecated('No \"GlobalWorkerOptions.workerSrc\" specified.');\n }\n return fallbackWorkerSrc;\n }\n throw new Error('No \"GlobalWorkerOptions.workerSrc\" specified.');\n }\n\n function getMainThreadWorkerMessageHandler() {\n let mainWorkerMessageHandler;\n try {\n mainWorkerMessageHandler = globalThis.pdfjsWorker?.WorkerMessageHandler;\n } catch (ex) {\n /* Ignore errors. */\n }\n return mainWorkerMessageHandler || null;\n }\n\n // Loads worker code into main thread.\n function setupFakeWorkerGlobal() {\n if (fakeWorkerCapability) {\n return fakeWorkerCapability.promise;\n }\n fakeWorkerCapability = createPromiseCapability();\n\n const loader = async function () {\n const mainWorkerMessageHandler = getMainThreadWorkerMessageHandler();\n\n if (mainWorkerMessageHandler) {\n // The worker was already loaded using e.g. a `<script>` tag.\n return mainWorkerMessageHandler;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n const worker = await import(\"pdfjs/core/worker.js\");\n return worker.WorkerMessageHandler;\n }\n if (\n PDFJSDev.test(\"GENERIC\") &&\n isNodeJS &&\n // eslint-disable-next-line no-undef\n typeof __non_webpack_require__ === \"function\"\n ) {\n // Since bundlers, such as Webpack, cannot be told to leave `require`\n // statements alone we are thus forced to jump through hoops in order\n // to prevent `Critical dependency: ...` warnings in third-party\n // deployments of the built `pdf.js`/`pdf.worker.js` files; see\n // https://github.com/webpack/webpack/issues/8826\n //\n // The following hack is based on the assumption that code running in\n // Node.js won't ever be affected by e.g. Content Security Policies that\n // prevent the use of `eval`. If that ever occurs, we should revert this\n // to a normal `__non_webpack_require__` statement and simply document\n // the Webpack warnings instead (telling users to ignore them).\n //\n // eslint-disable-next-line no-eval\n const worker = eval(\"require\")(getWorkerSrc());\n return worker.WorkerMessageHandler;\n }\n await loadScript(getWorkerSrc());\n return window.pdfjsWorker.WorkerMessageHandler;\n };\n loader().then(fakeWorkerCapability.resolve, fakeWorkerCapability.reject);\n\n return fakeWorkerCapability.promise;\n }\n\n function createCDNWrapper(url) {\n // We will rely on blob URL's property to specify origin.\n // We want this function to fail in case if createObjectURL or Blob do not\n // exist or fail for some reason -- our Worker creation will fail anyway.\n const wrapper = \"importScripts('\" + url + \"');\";\n return URL.createObjectURL(new Blob([wrapper]));\n }\n\n /**\n * PDF.js web worker abstraction that controls the instantiation of PDF\n * documents. Message handlers are used to pass information from the main\n * thread to the worker thread and vice versa. If the creation of a web\n * worker is not possible, a \"fake\" worker will be used instead.\n */\n // eslint-disable-next-line no-shadow\n class PDFWorker {\n /**\n * @param {PDFWorkerParameters} params - Worker initialization parameters.\n */\n constructor({\n name = null,\n port = null,\n verbosity = getVerbosityLevel(),\n } = {}) {\n if (port && pdfWorkerPorts.has(port)) {\n throw new Error(\"Cannot use more than one PDFWorker per port\");\n }\n\n this.name = name;\n this.destroyed = false;\n this.postMessageTransfers = true;\n this.verbosity = verbosity;\n\n this._readyCapability = createPromiseCapability();\n this._port = null;\n this._webWorker = null;\n this._messageHandler = null;\n\n if (port) {\n pdfWorkerPorts.set(port, this);\n this._initializeFromPort(port);\n return;\n }\n this._initialize();\n }\n\n get promise() {\n return this._readyCapability.promise;\n }\n\n get port() {\n return this._port;\n }\n\n get messageHandler() {\n return this._messageHandler;\n }\n\n _initializeFromPort(port) {\n this._port = port;\n this._messageHandler = new MessageHandler(\"main\", \"worker\", port);\n this._messageHandler.on(\"ready\", function () {\n // Ignoring 'ready' event -- MessageHandler shall be already initialized\n // and ready to accept the messages.\n });\n this._readyCapability.resolve();\n }\n\n _initialize() {\n // If worker support isn't disabled explicit and the browser has worker\n // support, create a new web worker and test if it/the browser fulfills\n // all requirements to run parts of pdf.js in a web worker.\n // Right now, the requirement is, that an Uint8Array is still an\n // Uint8Array as it arrives on the worker. (Chrome added this with v.15.)\n if (\n typeof Worker !== \"undefined\" &&\n !isWorkerDisabled &&\n !getMainThreadWorkerMessageHandler()\n ) {\n let workerSrc = getWorkerSrc();\n\n try {\n // Wraps workerSrc path into blob URL, if the former does not belong\n // to the same origin.\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"GENERIC\") &&\n !isSameOrigin(window.location.href, workerSrc)\n ) {\n workerSrc = createCDNWrapper(\n new URL(workerSrc, window.location).href\n );\n }\n\n // Some versions of FF can't create a worker on localhost, see:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=683280\n const worker = new Worker(workerSrc);\n const messageHandler = new MessageHandler(\"main\", \"worker\", worker);\n const terminateEarly = () => {\n worker.removeEventListener(\"error\", onWorkerError);\n messageHandler.destroy();\n worker.terminate();\n if (this.destroyed) {\n this._readyCapability.reject(new Error(\"Worker was destroyed\"));\n } else {\n // Fall back to fake worker if the termination is caused by an\n // error (e.g. NetworkError / SecurityError).\n this._setupFakeWorker();\n }\n };\n\n const onWorkerError = () => {\n if (!this._webWorker) {\n // Worker failed to initialize due to an error. Clean up and fall\n // back to the fake worker.\n terminateEarly();\n }\n };\n worker.addEventListener(\"error\", onWorkerError);\n\n messageHandler.on(\"test\", data => {\n worker.removeEventListener(\"error\", onWorkerError);\n if (this.destroyed) {\n terminateEarly();\n return; // worker was destroyed\n }\n if (data) {\n // supportTypedArray\n this._messageHandler = messageHandler;\n this._port = worker;\n this._webWorker = worker;\n if (!data.supportTransfers) {\n this.postMessageTransfers = false;\n }\n this._readyCapability.resolve();\n // Send global setting, e.g. verbosity level.\n messageHandler.send(\"configure\", {\n verbosity: this.verbosity,\n });\n } else {\n this._setupFakeWorker();\n messageHandler.destroy();\n worker.terminate();\n }\n });\n\n messageHandler.on(\"ready\", data => {\n worker.removeEventListener(\"error\", onWorkerError);\n if (this.destroyed) {\n terminateEarly();\n return; // worker was destroyed\n }\n try {\n sendTest();\n } catch (e) {\n // We need fallback to a faked worker.\n this._setupFakeWorker();\n }\n });\n\n const sendTest = () => {\n const testObj = new Uint8Array([\n this.postMessageTransfers ? 255 : 0,\n ]);\n // Some versions of Opera throw a DATA_CLONE_ERR on serializing the\n // typed array. Also, checking if we can use transfers.\n try {\n messageHandler.send(\"test\", testObj, [testObj.buffer]);\n } catch (ex) {\n warn(\"Cannot use postMessage transfers.\");\n testObj[0] = 0;\n messageHandler.send(\"test\", testObj);\n }\n };\n\n // It might take time for worker to initialize (especially when AMD\n // loader is used). We will try to send test immediately, and then\n // when 'ready' message will arrive. The worker shall process only\n // first received 'test'.\n sendTest();\n return;\n } catch (e) {\n info(\"The worker has been disabled.\");\n }\n }\n // Either workers are disabled, not supported or have thrown an exception.\n // Thus, we fallback to a faked worker.\n this._setupFakeWorker();\n }\n\n _setupFakeWorker() {\n if (!isWorkerDisabled) {\n warn(\"Setting up fake worker.\");\n isWorkerDisabled = true;\n }\n\n setupFakeWorkerGlobal()\n .then(WorkerMessageHandler => {\n if (this.destroyed) {\n this._readyCapability.reject(new Error(\"Worker was destroyed\"));\n return;\n }\n const port = new LoopbackPort();\n this._port = port;\n\n // All fake workers use the same port, making id unique.\n const id = \"fake\" + nextFakeWorkerId++;\n\n // If the main thread is our worker, setup the handling for the\n // messages -- the main thread sends to it self.\n const workerHandler = new MessageHandler(id + \"_worker\", id, port);\n WorkerMessageHandler.setup(workerHandler, port);\n\n const messageHandler = new MessageHandler(id, id + \"_worker\", port);\n this._messageHandler = messageHandler;\n this._readyCapability.resolve();\n // Send global setting, e.g. verbosity level.\n messageHandler.send(\"configure\", {\n verbosity: this.verbosity,\n });\n })\n .catch(reason => {\n this._readyCapability.reject(\n new Error(`Setting up fake worker failed: \"${reason.message}\".`)\n );\n });\n }\n\n /**\n * Destroys the worker instance.\n */\n destroy() {\n this.destroyed = true;\n if (this._webWorker) {\n // We need to terminate only web worker created resource.\n this._webWorker.terminate();\n this._webWorker = null;\n }\n pdfWorkerPorts.delete(this._port);\n this._port = null;\n if (this._messageHandler) {\n this._messageHandler.destroy();\n this._messageHandler = null;\n }\n }\n\n /**\n * @param {PDFWorkerParameters} params - The worker initialization\n * parameters.\n */\n static fromPort(params) {\n if (!params || !params.port) {\n throw new Error(\"PDFWorker.fromPort - invalid method signature.\");\n }\n if (pdfWorkerPorts.has(params.port)) {\n return pdfWorkerPorts.get(params.port);\n }\n return new PDFWorker(params);\n }\n\n static getWorkerSrc() {\n return getWorkerSrc();\n }\n }\n return PDFWorker;\n})();\n\n/**\n * For internal use only.\n * @ignore\n */\nclass WorkerTransport {\n constructor(messageHandler, loadingTask, networkStream, params) {\n this.messageHandler = messageHandler;\n this.loadingTask = loadingTask;\n this.commonObjs = new PDFObjects();\n this.fontLoader = new FontLoader({\n docId: loadingTask.docId,\n onUnsupportedFeature: this._onUnsupportedFeature.bind(this),\n ownerDocument: params.ownerDocument,\n });\n this._params = params;\n this.CMapReaderFactory = new params.CMapReaderFactory({\n baseUrl: params.cMapUrl,\n isCompressed: params.cMapPacked,\n });\n\n this.destroyed = false;\n this.destroyCapability = null;\n this._passwordCapability = null;\n\n this._networkStream = networkStream;\n this._fullReader = null;\n this._lastProgress = null;\n\n this.pageCache = [];\n this.pagePromises = [];\n this.downloadInfoCapability = createPromiseCapability();\n\n this.setupMessageHandler();\n }\n\n get annotationStorage() {\n return shadow(this, \"annotationStorage\", new AnnotationStorage());\n }\n\n destroy() {\n if (this.destroyCapability) {\n return this.destroyCapability.promise;\n }\n\n this.destroyed = true;\n this.destroyCapability = createPromiseCapability();\n\n if (this._passwordCapability) {\n this._passwordCapability.reject(\n new Error(\"Worker was destroyed during onPassword callback\")\n );\n }\n\n const waitOn = [];\n // We need to wait for all renderings to be completed, e.g.\n // timeout/rAF can take a long time.\n for (const page of this.pageCache) {\n if (page) {\n waitOn.push(page._destroy());\n }\n }\n this.pageCache.length = 0;\n this.pagePromises.length = 0;\n // Allow `AnnotationStorage`-related clean-up when destroying the document.\n if (this.hasOwnProperty(\"annotationStorage\")) {\n this.annotationStorage.resetModified();\n }\n // We also need to wait for the worker to finish its long running tasks.\n const terminated = this.messageHandler.sendWithPromise(\"Terminate\", null);\n waitOn.push(terminated);\n\n Promise.all(waitOn).then(() => {\n this.commonObjs.clear();\n this.fontLoader.clear();\n this._hasJSActionsPromise = null;\n\n if (this._networkStream) {\n this._networkStream.cancelAllRequests(\n new AbortException(\"Worker was terminated.\")\n );\n }\n\n if (this.messageHandler) {\n this.messageHandler.destroy();\n this.messageHandler = null;\n }\n this.destroyCapability.resolve();\n }, this.destroyCapability.reject);\n return this.destroyCapability.promise;\n }\n\n setupMessageHandler() {\n const { messageHandler, loadingTask } = this;\n\n messageHandler.on(\"GetReader\", (data, sink) => {\n assert(\n this._networkStream,\n \"GetReader - no `IPDFStream` instance available.\"\n );\n this._fullReader = this._networkStream.getFullReader();\n this._fullReader.onProgress = evt => {\n this._lastProgress = {\n loaded: evt.loaded,\n total: evt.total,\n };\n };\n sink.onPull = () => {\n this._fullReader\n .read()\n .then(function ({ value, done }) {\n if (done) {\n sink.close();\n return;\n }\n assert(\n isArrayBuffer(value),\n \"GetReader - expected an ArrayBuffer.\"\n );\n // Enqueue data chunk into sink, and transfer it\n // to other side as `Transferable` object.\n sink.enqueue(new Uint8Array(value), 1, [value]);\n })\n .catch(reason => {\n sink.error(reason);\n });\n };\n\n sink.onCancel = reason => {\n this._fullReader.cancel(reason);\n\n sink.ready.catch(readyReason => {\n if (this.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n throw readyReason;\n });\n };\n });\n\n messageHandler.on(\"ReaderHeadersReady\", data => {\n const headersCapability = createPromiseCapability();\n const fullReader = this._fullReader;\n fullReader.headersReady.then(() => {\n // If stream or range are disabled, it's our only way to report\n // loading progress.\n if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) {\n if (this._lastProgress && loadingTask.onProgress) {\n loadingTask.onProgress(this._lastProgress);\n }\n fullReader.onProgress = evt => {\n if (loadingTask.onProgress) {\n loadingTask.onProgress({\n loaded: evt.loaded,\n total: evt.total,\n });\n }\n };\n }\n\n headersCapability.resolve({\n isStreamingSupported: fullReader.isStreamingSupported,\n isRangeSupported: fullReader.isRangeSupported,\n contentLength: fullReader.contentLength,\n });\n }, headersCapability.reject);\n\n return headersCapability.promise;\n });\n\n messageHandler.on(\"GetRangeReader\", (data, sink) => {\n assert(\n this._networkStream,\n \"GetRangeReader - no `IPDFStream` instance available.\"\n );\n const rangeReader = this._networkStream.getRangeReader(\n data.begin,\n data.end\n );\n\n // When streaming is enabled, it's possible that the data requested here\n // has already been fetched via the `_fullRequestReader` implementation.\n // However, given that the PDF data is loaded asynchronously on the\n // main-thread and then sent via `postMessage` to the worker-thread,\n // it may not have been available during parsing (hence the attempt to\n // use range requests here).\n //\n // To avoid wasting time and resources here, we'll thus *not* dispatch\n // range requests if the data was already loaded but has not been sent to\n // the worker-thread yet (which will happen via the `_fullRequestReader`).\n if (!rangeReader) {\n sink.close();\n return;\n }\n\n sink.onPull = () => {\n rangeReader\n .read()\n .then(function ({ value, done }) {\n if (done) {\n sink.close();\n return;\n }\n assert(\n isArrayBuffer(value),\n \"GetRangeReader - expected an ArrayBuffer.\"\n );\n sink.enqueue(new Uint8Array(value), 1, [value]);\n })\n .catch(reason => {\n sink.error(reason);\n });\n };\n\n sink.onCancel = reason => {\n rangeReader.cancel(reason);\n\n sink.ready.catch(readyReason => {\n if (this.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n throw readyReason;\n });\n };\n });\n\n messageHandler.on(\"GetDoc\", ({ pdfInfo }) => {\n this._numPages = pdfInfo.numPages;\n loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));\n });\n\n messageHandler.on(\"DocException\", function (ex) {\n let reason;\n switch (ex.name) {\n case \"PasswordException\":\n reason = new PasswordException(ex.message, ex.code);\n break;\n case \"InvalidPDFException\":\n reason = new InvalidPDFException(ex.message);\n break;\n case \"MissingPDFException\":\n reason = new MissingPDFException(ex.message);\n break;\n case \"UnexpectedResponseException\":\n reason = new UnexpectedResponseException(ex.message, ex.status);\n break;\n case \"UnknownErrorException\":\n reason = new UnknownErrorException(ex.message, ex.details);\n break;\n }\n if (!(reason instanceof Error)) {\n const msg = \"DocException - expected a valid Error.\";\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || TESTING\")\n ) {\n unreachable(msg);\n } else {\n warn(msg);\n }\n }\n loadingTask._capability.reject(reason);\n });\n\n messageHandler.on(\"PasswordRequest\", exception => {\n this._passwordCapability = createPromiseCapability();\n\n if (loadingTask.onPassword) {\n const updatePassword = password => {\n this._passwordCapability.resolve({\n password,\n });\n };\n try {\n loadingTask.onPassword(updatePassword, exception.code);\n } catch (ex) {\n this._passwordCapability.reject(ex);\n }\n } else {\n this._passwordCapability.reject(\n new PasswordException(exception.message, exception.code)\n );\n }\n return this._passwordCapability.promise;\n });\n\n messageHandler.on(\"DataLoaded\", data => {\n // For consistency: Ensure that progress is always reported when the\n // entire PDF file has been loaded, regardless of how it was fetched.\n if (loadingTask.onProgress) {\n loadingTask.onProgress({\n loaded: data.length,\n total: data.length,\n });\n }\n this.downloadInfoCapability.resolve(data);\n });\n\n messageHandler.on(\"StartRenderPage\", data => {\n if (this.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n\n const page = this.pageCache[data.pageIndex];\n page._startRenderPage(data.transparency, data.intent);\n });\n\n messageHandler.on(\"commonobj\", data => {\n if (this.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n\n const [id, type, exportedData] = data;\n if (this.commonObjs.has(id)) {\n return;\n }\n\n switch (type) {\n case \"Font\":\n const params = this._params;\n\n if (\"error\" in exportedData) {\n const exportedError = exportedData.error;\n warn(`Error during font loading: ${exportedError}`);\n this.commonObjs.resolve(id, exportedError);\n break;\n }\n\n let fontRegistry = null;\n if (params.pdfBug && globalThis.FontInspector?.enabled) {\n fontRegistry = {\n registerFont(font, url) {\n globalThis.FontInspector.fontAdded(font, url);\n },\n };\n }\n const font = new FontFaceObject(exportedData, {\n isEvalSupported: params.isEvalSupported,\n disableFontFace: params.disableFontFace,\n ignoreErrors: params.ignoreErrors,\n onUnsupportedFeature: this._onUnsupportedFeature.bind(this),\n fontRegistry,\n });\n\n this.fontLoader\n .bind(font)\n .catch(reason => {\n return messageHandler.sendWithPromise(\"FontFallback\", { id });\n })\n .finally(() => {\n if (!params.fontExtraProperties && font.data) {\n // Immediately release the `font.data` property once the font\n // has been attached to the DOM, since it's no longer needed,\n // rather than waiting for a `PDFDocumentProxy.cleanup` call.\n // Since `font.data` could be very large, e.g. in some cases\n // multiple megabytes, this will help reduce memory usage.\n font.data = null;\n }\n this.commonObjs.resolve(id, font);\n });\n break;\n case \"FontPath\":\n case \"Image\":\n this.commonObjs.resolve(id, exportedData);\n break;\n default:\n throw new Error(`Got unknown common object type ${type}`);\n }\n });\n\n messageHandler.on(\"obj\", data => {\n if (this.destroyed) {\n // Ignore any pending requests if the worker was terminated.\n return undefined;\n }\n\n const [id, pageIndex, type, imageData] = data;\n const pageProxy = this.pageCache[pageIndex];\n if (pageProxy.objs.has(id)) {\n return undefined;\n }\n\n switch (type) {\n case \"Image\":\n pageProxy.objs.resolve(id, imageData);\n\n // Heuristic that will allow us not to store large data.\n const MAX_IMAGE_SIZE_TO_STORE = 8000000;\n if (imageData?.data?.length > MAX_IMAGE_SIZE_TO_STORE) {\n pageProxy.cleanupAfterRender = true;\n }\n break;\n default:\n throw new Error(`Got unknown object type ${type}`);\n }\n return undefined;\n });\n\n messageHandler.on(\"DocProgress\", data => {\n if (this.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n\n if (loadingTask.onProgress) {\n loadingTask.onProgress({\n loaded: data.loaded,\n total: data.total,\n });\n }\n });\n\n messageHandler.on(\n \"UnsupportedFeature\",\n this._onUnsupportedFeature.bind(this)\n );\n\n messageHandler.on(\"FetchBuiltInCMap\", (data, sink) => {\n if (this.destroyed) {\n sink.error(new Error(\"Worker was destroyed\"));\n return;\n }\n let fetched = false;\n\n sink.onPull = () => {\n if (fetched) {\n sink.close();\n return;\n }\n fetched = true;\n\n this.CMapReaderFactory.fetch(data)\n .then(function (builtInCMap) {\n sink.enqueue(builtInCMap, 1, [builtInCMap.cMapData.buffer]);\n })\n .catch(function (reason) {\n sink.error(reason);\n });\n };\n });\n }\n\n _onUnsupportedFeature({ featureId }) {\n if (this.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n if (this.loadingTask.onUnsupportedFeature) {\n this.loadingTask.onUnsupportedFeature(featureId);\n }\n }\n\n getData() {\n return this.messageHandler.sendWithPromise(\"GetData\", null);\n }\n\n getPage(pageNumber) {\n if (\n !Number.isInteger(pageNumber) ||\n pageNumber <= 0 ||\n pageNumber > this._numPages\n ) {\n return Promise.reject(new Error(\"Invalid page request\"));\n }\n\n const pageIndex = pageNumber - 1;\n if (pageIndex in this.pagePromises) {\n return this.pagePromises[pageIndex];\n }\n const promise = this.messageHandler\n .sendWithPromise(\"GetPage\", {\n pageIndex,\n })\n .then(pageInfo => {\n if (this.destroyed) {\n throw new Error(\"Transport destroyed\");\n }\n const page = new PDFPageProxy(\n pageIndex,\n pageInfo,\n this,\n this._params.ownerDocument,\n this._params.pdfBug\n );\n this.pageCache[pageIndex] = page;\n return page;\n });\n this.pagePromises[pageIndex] = promise;\n return promise;\n }\n\n getPageIndex(ref) {\n return this.messageHandler\n .sendWithPromise(\"GetPageIndex\", {\n ref,\n })\n .catch(function (reason) {\n return Promise.reject(new Error(reason));\n });\n }\n\n getAnnotations(pageIndex, intent) {\n return this.messageHandler.sendWithPromise(\"GetAnnotations\", {\n pageIndex,\n intent,\n });\n }\n\n saveDocument() {\n return this.messageHandler\n .sendWithPromise(\"SaveDocument\", {\n numPages: this._numPages,\n annotationStorage: this.annotationStorage.serializable,\n filename: this._fullReader?.filename ?? null,\n })\n .finally(() => {\n this.annotationStorage.resetModified();\n });\n }\n\n getFieldObjects() {\n return this.messageHandler.sendWithPromise(\"GetFieldObjects\", null);\n }\n\n hasJSActions() {\n return (this._hasJSActionsPromise ||= this.messageHandler.sendWithPromise(\n \"HasJSActions\",\n null\n ));\n }\n\n getCalculationOrderIds() {\n return this.messageHandler.sendWithPromise(\"GetCalculationOrderIds\", null);\n }\n\n getDestinations() {\n return this.messageHandler.sendWithPromise(\"GetDestinations\", null);\n }\n\n getDestination(id) {\n if (typeof id !== \"string\") {\n return Promise.reject(new Error(\"Invalid destination request.\"));\n }\n return this.messageHandler.sendWithPromise(\"GetDestination\", {\n id,\n });\n }\n\n getPageLabels() {\n return this.messageHandler.sendWithPromise(\"GetPageLabels\", null);\n }\n\n getPageLayout() {\n return this.messageHandler.sendWithPromise(\"GetPageLayout\", null);\n }\n\n getPageMode() {\n return this.messageHandler.sendWithPromise(\"GetPageMode\", null);\n }\n\n getViewerPreferences() {\n return this.messageHandler.sendWithPromise(\"GetViewerPreferences\", null);\n }\n\n getOpenAction() {\n return this.messageHandler.sendWithPromise(\"GetOpenAction\", null);\n }\n\n getAttachments() {\n return this.messageHandler.sendWithPromise(\"GetAttachments\", null);\n }\n\n getJavaScript() {\n return this.messageHandler.sendWithPromise(\"GetJavaScript\", null);\n }\n\n getDocJSActions() {\n return this.messageHandler.sendWithPromise(\"GetDocJSActions\", null);\n }\n\n getPageJSActions(pageIndex) {\n return this.messageHandler.sendWithPromise(\"GetPageJSActions\", {\n pageIndex,\n });\n }\n\n getPageXfa(pageIndex) {\n return this.messageHandler.sendWithPromise(\"GetPageXfa\", {\n pageIndex,\n });\n }\n\n getStructTree(pageIndex) {\n return this.messageHandler.sendWithPromise(\"GetStructTree\", {\n pageIndex,\n });\n }\n\n getOutline() {\n return this.messageHandler.sendWithPromise(\"GetOutline\", null);\n }\n\n getOptionalContentConfig() {\n return this.messageHandler\n .sendWithPromise(\"GetOptionalContentConfig\", null)\n .then(results => {\n return new OptionalContentConfig(results);\n });\n }\n\n getPermissions() {\n return this.messageHandler.sendWithPromise(\"GetPermissions\", null);\n }\n\n getMetadata() {\n return this.messageHandler\n .sendWithPromise(\"GetMetadata\", null)\n .then(results => {\n return {\n info: results[0],\n metadata: results[1] ? new Metadata(results[1]) : null,\n contentDispositionFilename: this._fullReader?.filename ?? null,\n contentLength: this._fullReader?.contentLength ?? null,\n };\n });\n }\n\n getMarkInfo() {\n return this.messageHandler.sendWithPromise(\"GetMarkInfo\", null);\n }\n\n getStats() {\n return this.messageHandler.sendWithPromise(\"GetStats\", null);\n }\n\n async startCleanup(keepLoadedFonts = false) {\n await this.messageHandler.sendWithPromise(\"Cleanup\", null);\n\n if (this.destroyed) {\n return; // No need to manually clean-up when destruction has started.\n }\n for (let i = 0, ii = this.pageCache.length; i < ii; i++) {\n const page = this.pageCache[i];\n if (!page) {\n continue;\n }\n const cleanupSuccessful = page.cleanup();\n\n if (!cleanupSuccessful) {\n throw new Error(`startCleanup: Page ${i + 1} is currently rendering.`);\n }\n }\n this.commonObjs.clear();\n if (!keepLoadedFonts) {\n this.fontLoader.clear();\n }\n this._hasJSActionsPromise = null;\n }\n\n get loadingParams() {\n const params = this._params;\n return shadow(this, \"loadingParams\", {\n disableAutoFetch: params.disableAutoFetch,\n disableFontFace: params.disableFontFace,\n });\n }\n}\n\n/**\n * A PDF document and page is built of many objects. E.g. there are objects for\n * fonts, images, rendering code, etc. These objects may get processed inside of\n * a worker. This class implements some basic methods to manage these objects.\n * @ignore\n */\nclass PDFObjects {\n constructor() {\n this._objs = Object.create(null);\n }\n\n /**\n * Ensures there is an object defined for `objId`.\n * @private\n */\n _ensureObj(objId) {\n if (this._objs[objId]) {\n return this._objs[objId];\n }\n return (this._objs[objId] = {\n capability: createPromiseCapability(),\n data: null,\n resolved: false,\n });\n }\n\n /**\n * If called *without* callback, this returns the data of `objId` but the\n * object needs to be resolved. If it isn't, this method throws.\n *\n * If called *with* a callback, the callback is called with the data of the\n * object once the object is resolved. That means, if you call this method\n * and the object is already resolved, the callback gets called right away.\n */\n get(objId, callback = null) {\n // If there is a callback, then the get can be async and the object is\n // not required to be resolved right now.\n if (callback) {\n this._ensureObj(objId).capability.promise.then(callback);\n return null;\n }\n // If there isn't a callback, the user expects to get the resolved data\n // directly.\n const obj = this._objs[objId];\n // If there isn't an object yet or the object isn't resolved, then the\n // data isn't ready yet!\n if (!obj || !obj.resolved) {\n throw new Error(`Requesting object that isn't resolved yet ${objId}.`);\n }\n return obj.data;\n }\n\n has(objId) {\n const obj = this._objs[objId];\n return obj?.resolved || false;\n }\n\n /**\n * Resolves the object `objId` with optional `data`.\n */\n resolve(objId, data) {\n const obj = this._ensureObj(objId);\n\n obj.resolved = true;\n obj.data = data;\n obj.capability.resolve(data);\n }\n\n clear() {\n this._objs = Object.create(null);\n }\n}\n\n/**\n * Allows controlling of the rendering tasks.\n */\nclass RenderTask {\n constructor(internalRenderTask) {\n this._internalRenderTask = internalRenderTask;\n\n /**\n * Callback for incremental rendering -- a function that will be called\n * each time the rendering is paused. To continue rendering call the\n * function that is the first argument to the callback.\n * @type {function}\n */\n this.onContinue = null;\n }\n\n /**\n * Promise for rendering task completion.\n * @type {Promise<void>}\n */\n get promise() {\n return this._internalRenderTask.capability.promise;\n }\n\n /**\n * Cancels the rendering task. If the task is currently rendering it will\n * not be cancelled until graphics pauses with a timeout. The promise that\n * this object extends will be rejected when cancelled.\n */\n cancel() {\n this._internalRenderTask.cancel();\n }\n}\n\n/**\n * For internal use only.\n * @ignore\n */\nconst InternalRenderTask = (function InternalRenderTaskClosure() {\n const canvasInRendering = new WeakSet();\n\n // eslint-disable-next-line no-shadow\n class InternalRenderTask {\n constructor({\n callback,\n params,\n objs,\n commonObjs,\n operatorList,\n pageIndex,\n canvasFactory,\n useRequestAnimationFrame = false,\n pdfBug = false,\n }) {\n this.callback = callback;\n this.params = params;\n this.objs = objs;\n this.commonObjs = commonObjs;\n this.operatorListIdx = null;\n this.operatorList = operatorList;\n this._pageIndex = pageIndex;\n this.canvasFactory = canvasFactory;\n this._pdfBug = pdfBug;\n\n this.running = false;\n this.graphicsReadyCallback = null;\n this.graphicsReady = false;\n this._useRequestAnimationFrame =\n useRequestAnimationFrame === true && typeof window !== \"undefined\";\n this.cancelled = false;\n this.capability = createPromiseCapability();\n this.task = new RenderTask(this);\n // caching this-bound methods\n this._cancelBound = this.cancel.bind(this);\n this._continueBound = this._continue.bind(this);\n this._scheduleNextBound = this._scheduleNext.bind(this);\n this._nextBound = this._next.bind(this);\n this._canvas = params.canvasContext.canvas;\n }\n\n get completed() {\n return this.capability.promise.catch(function () {\n // Ignoring errors, since we only want to know when rendering is\n // no longer pending.\n });\n }\n\n initializeGraphics({ transparency = false, optionalContentConfig }) {\n if (this.cancelled) {\n return;\n }\n if (this._canvas) {\n if (canvasInRendering.has(this._canvas)) {\n throw new Error(\n \"Cannot use the same canvas during multiple render() operations. \" +\n \"Use different canvas or ensure previous operations were \" +\n \"cancelled or completed.\"\n );\n }\n canvasInRendering.add(this._canvas);\n }\n\n if (this._pdfBug && globalThis.StepperManager?.enabled) {\n this.stepper = globalThis.StepperManager.create(this._pageIndex);\n this.stepper.init(this.operatorList);\n this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();\n }\n const { canvasContext, viewport, transform, imageLayer, background } =\n this.params;\n\n this.gfx = new CanvasGraphics(\n canvasContext,\n this.commonObjs,\n this.objs,\n this.canvasFactory,\n imageLayer,\n optionalContentConfig\n );\n this.gfx.beginDrawing({\n transform,\n viewport,\n transparency,\n background,\n });\n this.operatorListIdx = 0;\n this.graphicsReady = true;\n if (this.graphicsReadyCallback) {\n this.graphicsReadyCallback();\n }\n }\n\n cancel(error = null) {\n this.running = false;\n this.cancelled = true;\n if (this.gfx) {\n this.gfx.endDrawing();\n }\n if (this._canvas) {\n canvasInRendering.delete(this._canvas);\n }\n this.callback(\n error ||\n new RenderingCancelledException(\n `Rendering cancelled, page ${this._pageIndex + 1}`,\n \"canvas\"\n )\n );\n }\n\n operatorListChanged() {\n if (!this.graphicsReady) {\n if (!this.graphicsReadyCallback) {\n this.graphicsReadyCallback = this._continueBound;\n }\n return;\n }\n\n if (this.stepper) {\n this.stepper.updateOperatorList(this.operatorList);\n }\n\n if (this.running) {\n return;\n }\n this._continue();\n }\n\n _continue() {\n this.running = true;\n if (this.cancelled) {\n return;\n }\n if (this.task.onContinue) {\n this.task.onContinue(this._scheduleNextBound);\n } else {\n this._scheduleNext();\n }\n }\n\n _scheduleNext() {\n if (this._useRequestAnimationFrame) {\n window.requestAnimationFrame(() => {\n this._nextBound().catch(this._cancelBound);\n });\n } else {\n Promise.resolve().then(this._nextBound).catch(this._cancelBound);\n }\n }\n\n async _next() {\n if (this.cancelled) {\n return;\n }\n this.operatorListIdx = this.gfx.executeOperatorList(\n this.operatorList,\n this.operatorListIdx,\n this._continueBound,\n this.stepper\n );\n if (this.operatorListIdx === this.operatorList.argsArray.length) {\n this.running = false;\n if (this.operatorList.lastChunk) {\n this.gfx.endDrawing();\n if (this._canvas) {\n canvasInRendering.delete(this._canvas);\n }\n this.callback();\n }\n }\n }\n }\n return InternalRenderTask;\n})();\n\n/** @type {string} */\nconst version =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : null;\n/** @type {string} */\nconst build =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_BUILD\") : null;\n\nexport {\n build,\n DefaultCanvasFactory,\n DefaultCMapReaderFactory,\n getDocument,\n LoopbackPort,\n PDFDataRangeTransport,\n PDFDocumentProxy,\n PDFPageProxy,\n PDFWorker,\n setPDFNetworkStreamFactory,\n version,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n assert,\n bytesToString,\n IsEvalSupportedCached,\n shadow,\n string32,\n unreachable,\n UNSUPPORTED_FEATURES,\n warn,\n} from \"../shared/util.js\";\n\nclass BaseFontLoader {\n constructor({\n docId,\n onUnsupportedFeature,\n ownerDocument = globalThis.document,\n }) {\n if (this.constructor === BaseFontLoader) {\n unreachable(\"Cannot initialize BaseFontLoader.\");\n }\n this.docId = docId;\n this._onUnsupportedFeature = onUnsupportedFeature;\n this._document = ownerDocument;\n\n this.nativeFontFaces = [];\n this.styleElement = null;\n }\n\n addNativeFontFace(nativeFontFace) {\n this.nativeFontFaces.push(nativeFontFace);\n this._document.fonts.add(nativeFontFace);\n }\n\n insertRule(rule) {\n let styleElement = this.styleElement;\n if (!styleElement) {\n styleElement = this.styleElement = this._document.createElement(\"style\");\n styleElement.id = `PDFJS_FONT_STYLE_TAG_${this.docId}`;\n this._document.documentElement\n .getElementsByTagName(\"head\")[0]\n .appendChild(styleElement);\n }\n\n const styleSheet = styleElement.sheet;\n styleSheet.insertRule(rule, styleSheet.cssRules.length);\n }\n\n clear() {\n for (const nativeFontFace of this.nativeFontFaces) {\n this._document.fonts.delete(nativeFontFace);\n }\n this.nativeFontFaces.length = 0;\n\n if (this.styleElement) {\n // Note: ChildNode.remove doesn't throw if the parentNode is undefined.\n this.styleElement.remove();\n this.styleElement = null;\n }\n }\n\n async bind(font) {\n // Add the font to the DOM only once; skip if the font is already loaded.\n if (font.attached || font.missingFile) {\n return;\n }\n font.attached = true;\n\n if (this.isFontLoadingAPISupported) {\n const nativeFontFace = font.createNativeFontFace();\n if (nativeFontFace) {\n this.addNativeFontFace(nativeFontFace);\n try {\n await nativeFontFace.loaded;\n } catch (ex) {\n this._onUnsupportedFeature({\n featureId: UNSUPPORTED_FEATURES.errorFontLoadNative,\n });\n warn(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);\n\n // When font loading failed, fall back to the built-in font renderer.\n font.disableFontFace = true;\n throw ex;\n }\n }\n return; // The font was, asynchronously, loaded.\n }\n\n // !this.isFontLoadingAPISupported\n const rule = font.createFontFaceRule();\n if (rule) {\n this.insertRule(rule);\n\n if (this.isSyncFontLoadingSupported) {\n return; // The font was, synchronously, loaded.\n }\n await new Promise(resolve => {\n const request = this._queueLoadingCallback(resolve);\n this._prepareFontLoadEvent([rule], [font], request);\n });\n // The font was, asynchronously, loaded.\n }\n }\n\n _queueLoadingCallback(callback) {\n unreachable(\"Abstract method `_queueLoadingCallback`.\");\n }\n\n get isFontLoadingAPISupported() {\n return shadow(this, \"isFontLoadingAPISupported\", !!this._document?.fonts);\n }\n\n // eslint-disable-next-line getter-return\n get isSyncFontLoadingSupported() {\n unreachable(\"Abstract method `isSyncFontLoadingSupported`.\");\n }\n\n // eslint-disable-next-line getter-return\n get _loadTestFont() {\n unreachable(\"Abstract method `_loadTestFont`.\");\n }\n\n _prepareFontLoadEvent(rules, fontsToLoad, request) {\n unreachable(\"Abstract method `_prepareFontLoadEvent`.\");\n }\n}\n\nlet FontLoader;\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n FontLoader = class MozcentralFontLoader extends BaseFontLoader {\n get isSyncFontLoadingSupported() {\n return shadow(this, \"isSyncFontLoadingSupported\", true);\n }\n };\n} else {\n // PDFJSDev.test('CHROME || GENERIC')\n\n FontLoader = class GenericFontLoader extends BaseFontLoader {\n constructor(params) {\n super(params);\n this.loadingContext = {\n requests: [],\n nextRequestId: 0,\n };\n this.loadTestFontId = 0;\n }\n\n get isSyncFontLoadingSupported() {\n let supported = false;\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"CHROME\")) {\n if (typeof navigator === \"undefined\") {\n // Node.js - we can pretend that sync font loading is supported.\n supported = true;\n } else {\n // User agent string sniffing is bad, but there is no reliable way to\n // tell if the font is fully loaded and ready to be used with canvas.\n const m = /Mozilla\\/5.0.*?rv:(\\d+).*? Gecko/.exec(\n navigator.userAgent\n );\n if (m?.[1] >= 14) {\n supported = true;\n }\n // TODO - other browsers...\n }\n }\n return shadow(this, \"isSyncFontLoadingSupported\", supported);\n }\n\n _queueLoadingCallback(callback) {\n function completeRequest() {\n assert(!request.done, \"completeRequest() cannot be called twice.\");\n request.done = true;\n\n // Sending all completed requests in order of how they were queued.\n while (context.requests.length > 0 && context.requests[0].done) {\n const otherRequest = context.requests.shift();\n setTimeout(otherRequest.callback, 0);\n }\n }\n\n const context = this.loadingContext;\n const request = {\n id: `pdfjs-font-loading-${context.nextRequestId++}`,\n done: false,\n complete: completeRequest,\n callback,\n };\n context.requests.push(request);\n return request;\n }\n\n get _loadTestFont() {\n const getLoadTestFont = function () {\n // This is a CFF font with 1 glyph for '.' that fills its entire width\n // and height.\n return atob(\n \"T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA\" +\n \"FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA\" +\n \"ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA\" +\n \"AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAE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AAAAAAAAAA\" +\n \"AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC\" +\n \"AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3\" +\n \"Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj\" +\n \"FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==\"\n );\n };\n return shadow(this, \"_loadTestFont\", getLoadTestFont());\n }\n\n _prepareFontLoadEvent(rules, fonts, request) {\n /** Hack begin */\n // There's currently no event when a font has finished downloading so the\n // following code is a dirty hack to 'guess' when a font is ready.\n // It's assumed fonts are loaded in order, so add a known test font after\n // the desired fonts and then test for the loading of that test font.\n\n function int32(data, offset) {\n return (\n (data.charCodeAt(offset) << 24) |\n (data.charCodeAt(offset + 1) << 16) |\n (data.charCodeAt(offset + 2) << 8) |\n (data.charCodeAt(offset + 3) & 0xff)\n );\n }\n function spliceString(s, offset, remove, insert) {\n const chunk1 = s.substring(0, offset);\n const chunk2 = s.substring(offset + remove);\n return chunk1 + insert + chunk2;\n }\n let i, ii;\n\n // The temporary canvas is used to determine if fonts are loaded.\n const canvas = this._document.createElement(\"canvas\");\n canvas.width = 1;\n canvas.height = 1;\n const ctx = canvas.getContext(\"2d\");\n\n let called = 0;\n function isFontReady(name, callback) {\n called++;\n // With setTimeout clamping this gives the font ~100ms to load.\n if (called > 30) {\n warn(\"Load test font never loaded.\");\n callback();\n return;\n }\n ctx.font = \"30px \" + name;\n ctx.fillText(\".\", 0, 20);\n const imageData = ctx.getImageData(0, 0, 1, 1);\n if (imageData.data[3] > 0) {\n callback();\n return;\n }\n setTimeout(isFontReady.bind(null, name, callback));\n }\n\n const loadTestFontId = `lt${Date.now()}${this.loadTestFontId++}`;\n // Chromium seems to cache fonts based on a hash of the actual font data,\n // so the font must be modified for each load test else it will appear to\n // be loaded already.\n // TODO: This could maybe be made faster by avoiding the btoa of the full\n // font by splitting it in chunks before hand and padding the font id.\n let data = this._loadTestFont;\n const COMMENT_OFFSET = 976; // has to be on 4 byte boundary (for checksum)\n data = spliceString(\n data,\n COMMENT_OFFSET,\n loadTestFontId.length,\n loadTestFontId\n );\n // CFF checksum is important for IE, adjusting it\n const CFF_CHECKSUM_OFFSET = 16;\n const XXXX_VALUE = 0x58585858; // the \"comment\" filled with 'X'\n let checksum = int32(data, CFF_CHECKSUM_OFFSET);\n for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {\n checksum = (checksum - XXXX_VALUE + int32(loadTestFontId, i)) | 0;\n }\n if (i < loadTestFontId.length) {\n // align to 4 bytes boundary\n checksum =\n (checksum - XXXX_VALUE + int32(loadTestFontId + \"XXX\", i)) | 0;\n }\n data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, string32(checksum));\n\n const url = `url(data:font/opentype;base64,${btoa(data)});`;\n const rule = `@font-face {font-family:\"${loadTestFontId}\";src:${url}}`;\n this.insertRule(rule);\n\n const names = [];\n for (const font of fonts) {\n names.push(font.loadedName);\n }\n names.push(loadTestFontId);\n\n const div = this._document.createElement(\"div\");\n div.style.visibility = \"hidden\";\n div.style.width = div.style.height = \"10px\";\n div.style.position = \"absolute\";\n div.style.top = div.style.left = \"0px\";\n\n for (const name of names) {\n const span = this._document.createElement(\"span\");\n span.textContent = \"Hi\";\n span.style.fontFamily = name;\n div.appendChild(span);\n }\n this._document.body.appendChild(div);\n\n isFontReady(loadTestFontId, () => {\n this._document.body.removeChild(div);\n request.complete();\n });\n /** Hack end */\n }\n };\n} // End of PDFJSDev.test('CHROME || GENERIC')\n\nclass FontFaceObject {\n constructor(\n translatedData,\n {\n isEvalSupported = true,\n disableFontFace = false,\n ignoreErrors = false,\n onUnsupportedFeature,\n fontRegistry = null,\n }\n ) {\n this.compiledGlyphs = Object.create(null);\n // importing translated data\n for (const i in translatedData) {\n this[i] = translatedData[i];\n }\n this.isEvalSupported = isEvalSupported !== false;\n this.disableFontFace = disableFontFace === true;\n this.ignoreErrors = ignoreErrors === true;\n this._onUnsupportedFeature = onUnsupportedFeature;\n this.fontRegistry = fontRegistry;\n }\n\n createNativeFontFace() {\n if (!this.data || this.disableFontFace) {\n return null;\n }\n let nativeFontFace;\n if (!this.cssFontInfo) {\n nativeFontFace = new FontFace(this.loadedName, this.data, {});\n } else {\n const css = {\n weight: this.cssFontInfo.fontWeight,\n };\n if (this.cssFontInfo.italicAngle) {\n css.style = `oblique ${this.cssFontInfo.italicAngle}deg`;\n }\n nativeFontFace = new FontFace(\n this.cssFontInfo.fontFamily,\n this.data,\n css\n );\n }\n\n if (this.fontRegistry) {\n this.fontRegistry.registerFont(this);\n }\n return nativeFontFace;\n }\n\n createFontFaceRule() {\n if (!this.data || this.disableFontFace) {\n return null;\n }\n const data = bytesToString(this.data);\n // Add the @font-face rule to the document.\n const url = `url(data:${this.mimetype};base64,${btoa(data)});`;\n let rule;\n if (!this.cssFontInfo) {\n rule = `@font-face {font-family:\"${this.loadedName}\";src:${url}}`;\n } else {\n let css = `font-weight: ${this.cssFontInfo.fontWeight};`;\n if (this.cssFontInfo.italicAngle) {\n css += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`;\n }\n rule = `@font-face {font-family:\"${this.cssFontInfo.fontFamily}\";${css}src:${url}}`;\n }\n\n if (this.fontRegistry) {\n this.fontRegistry.registerFont(this, url);\n }\n return rule;\n }\n\n getPathGenerator(objs, character) {\n if (this.compiledGlyphs[character] !== undefined) {\n return this.compiledGlyphs[character];\n }\n\n let cmds;\n try {\n cmds = objs.get(this.loadedName + \"_path_\" + character);\n } catch (ex) {\n if (!this.ignoreErrors) {\n throw ex;\n }\n this._onUnsupportedFeature({\n featureId: UNSUPPORTED_FEATURES.errorFontGetPath,\n });\n warn(`getPathGenerator - ignoring character: \"${ex}\".`);\n\n return (this.compiledGlyphs[character] = function (c, size) {\n // No-op function, to allow rendering to continue.\n });\n }\n\n // If we can, compile cmds into JS for MAXIMUM SPEED...\n if (this.isEvalSupported && IsEvalSupportedCached.value) {\n const jsBuf = [];\n for (const current of cmds) {\n const args = current.args !== undefined ? current.args.join(\",\") : \"\";\n jsBuf.push(\"c.\", current.cmd, \"(\", args, \");\\n\");\n }\n // eslint-disable-next-line no-new-func\n return (this.compiledGlyphs[character] = new Function(\n \"c\",\n \"size\",\n jsBuf.join(\"\")\n ));\n }\n // ... but fall back on using Function.prototype.apply() if we're\n // blocked from using eval() for whatever reason (like CSP policies).\n return (this.compiledGlyphs[character] = function (c, size) {\n for (const current of cmds) {\n if (current.cmd === \"scale\") {\n current.args = [size, -size];\n }\n c[current.cmd].apply(c, current.args);\n }\n });\n }\n}\n\nexport { FontFaceObject, FontLoader };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals __non_webpack_require__ */\n\nimport { BaseCanvasFactory, BaseCMapReaderFactory } from \"./display_utils.js\";\nimport { isNodeJS } from \"../shared/is_node.js\";\nimport { unreachable } from \"../shared/util.js\";\n\nlet NodeCanvasFactory = class {\n constructor() {\n unreachable(\"Not implemented: NodeCanvasFactory\");\n }\n};\n\nlet NodeCMapReaderFactory = class {\n constructor() {\n unreachable(\"Not implemented: NodeCMapReaderFactory\");\n }\n};\n\nif ((typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) && isNodeJS) {\n NodeCanvasFactory = class extends BaseCanvasFactory {\n create(width, height) {\n if (width <= 0 || height <= 0) {\n throw new Error(\"Invalid canvas size\");\n }\n const Canvas = __non_webpack_require__(\"canvas\");\n const canvas = Canvas.createCanvas(width, height);\n return {\n canvas,\n context: canvas.getContext(\"2d\"),\n };\n }\n };\n\n NodeCMapReaderFactory = class extends BaseCMapReaderFactory {\n _fetchData(url, compressionType) {\n return new Promise((resolve, reject) => {\n const fs = __non_webpack_require__(\"fs\");\n fs.readFile(url, (error, data) => {\n if (error || !data) {\n reject(new Error(error));\n return;\n }\n resolve({ cMapData: new Uint8Array(data), compressionType });\n });\n });\n }\n };\n}\n\nexport { NodeCanvasFactory, NodeCMapReaderFactory };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { objectFromMap } from \"../shared/util.js\";\n\n/**\n * Key/value storage for annotation data in forms.\n */\nclass AnnotationStorage {\n constructor() {\n this._storage = new Map();\n this._modified = false;\n\n // Callbacks to signal when the modification state is set or reset.\n // This is used by the viewer to only bind on `beforeunload` if forms\n // are actually edited to prevent doing so unconditionally since that\n // can have undesirable effects.\n this.onSetModified = null;\n this.onResetModified = null;\n }\n\n /**\n * Get the value for a given key if it exists, or return the default value.\n *\n * @public\n * @memberof AnnotationStorage\n * @param {string} key\n * @param {Object} defaultValue\n * @returns {Object}\n */\n getValue(key, defaultValue) {\n const obj = this._storage.get(key);\n return obj !== undefined ? obj : defaultValue;\n }\n\n /**\n * Set the value for a given key\n *\n * @public\n * @memberof AnnotationStorage\n * @param {string} key\n * @param {Object} value\n */\n setValue(key, value) {\n const obj = this._storage.get(key);\n let modified = false;\n if (obj !== undefined) {\n for (const [entry, val] of Object.entries(value)) {\n if (obj[entry] !== val) {\n modified = true;\n obj[entry] = val;\n }\n }\n } else {\n this._storage.set(key, value);\n modified = true;\n }\n if (modified) {\n this._setModified();\n }\n }\n\n getAll() {\n return this._storage.size > 0 ? objectFromMap(this._storage) : null;\n }\n\n get size() {\n return this._storage.size;\n }\n\n /**\n * @private\n */\n _setModified() {\n if (!this._modified) {\n this._modified = true;\n if (typeof this.onSetModified === \"function\") {\n this.onSetModified();\n }\n }\n }\n\n resetModified() {\n if (this._modified) {\n this._modified = false;\n if (typeof this.onResetModified === \"function\") {\n this.onResetModified();\n }\n }\n }\n\n /**\n * PLEASE NOTE: Only intended for usage within the API itself.\n * @ignore\n */\n get serializable() {\n return this._storage.size > 0 ? this._storage : null;\n }\n}\n\nexport { AnnotationStorage };\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isNodeJS } from \"../shared/is_node.js\";\n\nconst compatibilityParams = Object.create(null);\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // Support: Node.js\n (function checkFontFace() {\n // Node.js is missing native support for `@font-face`.\n if (isNodeJS) {\n compatibilityParams.disableFontFace = true;\n }\n })();\n}\nconst apiCompatibilityParams = Object.freeze(compatibilityParams);\n\nexport { apiCompatibilityParams };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FONT_IDENTITY_MATRIX,\n IDENTITY_MATRIX,\n ImageKind,\n info,\n IsLittleEndianCached,\n isNum,\n OPS,\n shadow,\n TextRenderingMode,\n unreachable,\n Util,\n warn,\n} from \"../shared/util.js\";\nimport { getShadingPattern, TilingPattern } from \"./pattern_helper.js\";\n\n// <canvas> contexts store most of the state we need natively.\n// However, PDF needs a bit more state, which we store here.\n// Minimal font size that would be used during canvas fillText operations.\nconst MIN_FONT_SIZE = 16;\n// Maximum font size that would be used during canvas fillText operations.\nconst MAX_FONT_SIZE = 100;\nconst MAX_GROUP_SIZE = 4096;\n\nconst COMPILE_TYPE3_GLYPHS = true;\nconst MAX_SIZE_TO_COMPILE = 1000;\n\nconst FULL_CHUNK_HEIGHT = 16;\n\n// Because of https://bugs.chromium.org/p/chromium/issues/detail?id=1170396\n// some curves aren't rendered correctly.\n// Multiplying lineWidth by this factor should help to have \"correct\"\n// rendering with no artifacts.\n// Once the bug is fixed upstream, we can remove this constant and its use.\nconst LINEWIDTH_SCALE_FACTOR = 1.000001;\n\nfunction addContextCurrentTransform(ctx) {\n // If the context doesn't expose a `mozCurrentTransform`, add a JS based one.\n if (ctx.mozCurrentTransform) {\n return;\n }\n ctx._originalSave = ctx.save;\n ctx._originalRestore = ctx.restore;\n ctx._originalRotate = ctx.rotate;\n ctx._originalScale = ctx.scale;\n ctx._originalTranslate = ctx.translate;\n ctx._originalTransform = ctx.transform;\n ctx._originalSetTransform = ctx.setTransform;\n ctx._originalResetTransform = ctx.resetTransform;\n\n ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0];\n ctx._transformStack = [];\n\n try {\n // The call to getOwnPropertyDescriptor throws an exception in Node.js:\n // \"TypeError: Method lineWidth called on incompatible receiver\n // #<CanvasRenderingContext2D>\".\n const desc = Object.getOwnPropertyDescriptor(\n Object.getPrototypeOf(ctx),\n \"lineWidth\"\n );\n\n ctx._setLineWidth = desc.set;\n ctx._getLineWidth = desc.get;\n\n Object.defineProperty(ctx, \"lineWidth\", {\n set: function setLineWidth(width) {\n this._setLineWidth(width * LINEWIDTH_SCALE_FACTOR);\n },\n get: function getLineWidth() {\n return this._getLineWidth();\n },\n });\n } catch (_) {}\n\n Object.defineProperty(ctx, \"mozCurrentTransform\", {\n get: function getCurrentTransform() {\n return this._transformMatrix;\n },\n });\n\n Object.defineProperty(ctx, \"mozCurrentTransformInverse\", {\n get: function getCurrentTransformInverse() {\n // Calculation done using WolframAlpha:\n // http://www.wolframalpha.com/input/?\n // i=Inverse+{{a%2C+c%2C+e}%2C+{b%2C+d%2C+f}%2C+{0%2C+0%2C+1}}\n\n const [a, b, c, d, e, f] = this._transformMatrix;\n const ad_bc = a * d - b * c;\n const bc_ad = b * c - a * d;\n\n return [\n d / ad_bc,\n b / bc_ad,\n c / bc_ad,\n a / ad_bc,\n (d * e - c * f) / bc_ad,\n (b * e - a * f) / ad_bc,\n ];\n },\n });\n\n ctx.save = function ctxSave() {\n const old = this._transformMatrix;\n this._transformStack.push(old);\n this._transformMatrix = old.slice(0, 6);\n\n this._originalSave();\n };\n\n ctx.restore = function ctxRestore() {\n const prev = this._transformStack.pop();\n if (prev) {\n this._transformMatrix = prev;\n this._originalRestore();\n }\n };\n\n ctx.translate = function ctxTranslate(x, y) {\n const m = this._transformMatrix;\n m[4] = m[0] * x + m[2] * y + m[4];\n m[5] = m[1] * x + m[3] * y + m[5];\n\n this._originalTranslate(x, y);\n };\n\n ctx.scale = function ctxScale(x, y) {\n const m = this._transformMatrix;\n m[0] = m[0] * x;\n m[1] = m[1] * x;\n m[2] = m[2] * y;\n m[3] = m[3] * y;\n\n this._originalScale(x, y);\n };\n\n ctx.transform = function ctxTransform(a, b, c, d, e, f) {\n const m = this._transformMatrix;\n this._transformMatrix = [\n m[0] * a + m[2] * b,\n m[1] * a + m[3] * b,\n m[0] * c + m[2] * d,\n m[1] * c + m[3] * d,\n m[0] * e + m[2] * f + m[4],\n m[1] * e + m[3] * f + m[5],\n ];\n\n ctx._originalTransform(a, b, c, d, e, f);\n };\n\n ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {\n this._transformMatrix = [a, b, c, d, e, f];\n\n ctx._originalSetTransform(a, b, c, d, e, f);\n };\n\n ctx.resetTransform = function ctxResetTransform() {\n this._transformMatrix = [1, 0, 0, 1, 0, 0];\n\n ctx._originalResetTransform();\n };\n\n ctx.rotate = function ctxRotate(angle) {\n const cosValue = Math.cos(angle);\n const sinValue = Math.sin(angle);\n\n const m = this._transformMatrix;\n this._transformMatrix = [\n m[0] * cosValue + m[2] * sinValue,\n m[1] * cosValue + m[3] * sinValue,\n m[0] * -sinValue + m[2] * cosValue,\n m[1] * -sinValue + m[3] * cosValue,\n m[4],\n m[5],\n ];\n\n this._originalRotate(angle);\n };\n}\n\nclass CachedCanvases {\n constructor(canvasFactory) {\n this.canvasFactory = canvasFactory;\n this.cache = Object.create(null);\n }\n\n getCanvas(id, width, height, trackTransform) {\n let canvasEntry;\n if (this.cache[id] !== undefined) {\n canvasEntry = this.cache[id];\n this.canvasFactory.reset(canvasEntry, width, height);\n // reset canvas transform for emulated mozCurrentTransform, if needed\n canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0);\n } else {\n canvasEntry = this.canvasFactory.create(width, height);\n this.cache[id] = canvasEntry;\n }\n if (trackTransform) {\n addContextCurrentTransform(canvasEntry.context);\n }\n return canvasEntry;\n }\n\n clear() {\n for (const id in this.cache) {\n const canvasEntry = this.cache[id];\n this.canvasFactory.destroy(canvasEntry);\n delete this.cache[id];\n }\n }\n}\n\nfunction compileType3Glyph(imgData) {\n const POINT_TO_PROCESS_LIMIT = 1000;\n const POINT_TYPES = new Uint8Array([\n 0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0,\n ]);\n\n const width = imgData.width,\n height = imgData.height,\n width1 = width + 1;\n let i, ii, j, j0;\n const points = new Uint8Array(width1 * (height + 1));\n\n // decodes bit-packed mask data\n const lineSize = (width + 7) & ~7,\n data0 = imgData.data;\n const data = new Uint8Array(lineSize * height);\n let pos = 0;\n for (i = 0, ii = data0.length; i < ii; i++) {\n const elem = data0[i];\n let mask = 128;\n while (mask > 0) {\n data[pos++] = elem & mask ? 0 : 255;\n mask >>= 1;\n }\n }\n\n // finding interesting points: every point is located between mask pixels,\n // so there will be points of the (width + 1)x(height + 1) grid. Every point\n // will have flags assigned based on neighboring mask pixels:\n // 4 | 8\n // --P--\n // 2 | 1\n // We are interested only in points with the flags:\n // - outside corners: 1, 2, 4, 8;\n // - inside corners: 7, 11, 13, 14;\n // - and, intersections: 5, 10.\n let count = 0;\n pos = 0;\n if (data[pos] !== 0) {\n points[0] = 1;\n ++count;\n }\n for (j = 1; j < width; j++) {\n if (data[pos] !== data[pos + 1]) {\n points[j] = data[pos] ? 2 : 1;\n ++count;\n }\n pos++;\n }\n if (data[pos] !== 0) {\n points[j] = 2;\n ++count;\n }\n for (i = 1; i < height; i++) {\n pos = i * lineSize;\n j0 = i * width1;\n if (data[pos - lineSize] !== data[pos]) {\n points[j0] = data[pos] ? 1 : 8;\n ++count;\n }\n // 'sum' is the position of the current pixel configuration in the 'TYPES'\n // array (in order 8-1-2-4, so we can use '>>2' to shift the column).\n let sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0);\n for (j = 1; j < width; j++) {\n sum =\n (sum >> 2) +\n (data[pos + 1] ? 4 : 0) +\n (data[pos - lineSize + 1] ? 8 : 0);\n if (POINT_TYPES[sum]) {\n points[j0 + j] = POINT_TYPES[sum];\n ++count;\n }\n pos++;\n }\n if (data[pos - lineSize] !== data[pos]) {\n points[j0 + j] = data[pos] ? 2 : 4;\n ++count;\n }\n\n if (count > POINT_TO_PROCESS_LIMIT) {\n return null;\n }\n }\n\n pos = lineSize * (height - 1);\n j0 = i * width1;\n if (data[pos] !== 0) {\n points[j0] = 8;\n ++count;\n }\n for (j = 1; j < width; j++) {\n if (data[pos] !== data[pos + 1]) {\n points[j0 + j] = data[pos] ? 4 : 8;\n ++count;\n }\n pos++;\n }\n if (data[pos] !== 0) {\n points[j0 + j] = 4;\n ++count;\n }\n if (count > POINT_TO_PROCESS_LIMIT) {\n return null;\n }\n\n // building outlines\n const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);\n const outlines = [];\n for (i = 0; count && i <= height; i++) {\n let p = i * width1;\n const end = p + width;\n while (p < end && !points[p]) {\n p++;\n }\n if (p === end) {\n continue;\n }\n const coords = [p % width1, i];\n\n const p0 = p;\n let type = points[p];\n do {\n const step = steps[type];\n do {\n p += step;\n } while (!points[p]);\n\n const pp = points[p];\n if (pp !== 5 && pp !== 10) {\n // set new direction\n type = pp;\n // delete mark\n points[p] = 0;\n } else {\n // type is 5 or 10, ie, a crossing\n // set new direction\n type = pp & ((0x33 * type) >> 4);\n // set new type for \"future hit\"\n points[p] &= (type >> 2) | (type << 2);\n }\n\n coords.push(p % width1, (p / width1) | 0);\n\n if (!points[p]) {\n --count;\n }\n } while (p0 !== p);\n outlines.push(coords);\n --i;\n }\n\n const drawOutline = function (c) {\n c.save();\n // the path shall be painted in [0..1]x[0..1] space\n c.scale(1 / width, -1 / height);\n c.translate(0, -height);\n c.beginPath();\n for (let k = 0, kk = outlines.length; k < kk; k++) {\n const o = outlines[k];\n c.moveTo(o[0], o[1]);\n for (let l = 2, ll = o.length; l < ll; l += 2) {\n c.lineTo(o[l], o[l + 1]);\n }\n }\n c.fill();\n c.beginPath();\n c.restore();\n };\n\n return drawOutline;\n}\n\nclass CanvasExtraState {\n constructor() {\n // Are soft masks and alpha values shapes or opacities?\n this.alphaIsShape = false;\n this.fontSize = 0;\n this.fontSizeScale = 1;\n this.textMatrix = IDENTITY_MATRIX;\n this.textMatrixScale = 1;\n this.fontMatrix = FONT_IDENTITY_MATRIX;\n this.leading = 0;\n // Current point (in user coordinates)\n this.x = 0;\n this.y = 0;\n // Start of text line (in text coordinates)\n this.lineX = 0;\n this.lineY = 0;\n // Character and word spacing\n this.charSpacing = 0;\n this.wordSpacing = 0;\n this.textHScale = 1;\n this.textRenderingMode = TextRenderingMode.FILL;\n this.textRise = 0;\n // Default fore and background colors\n this.fillColor = \"#000000\";\n this.strokeColor = \"#000000\";\n this.patternFill = false;\n // Note: fill alpha applies to all non-stroking operations\n this.fillAlpha = 1;\n this.strokeAlpha = 1;\n this.lineWidth = 1;\n this.activeSMask = null;\n this.resumeSMaskCtx = null; // nonclonable field (see the save method below)\n this.transferMaps = null;\n }\n\n clone() {\n return Object.create(this);\n }\n\n setCurrentPoint(x, y) {\n this.x = x;\n this.y = y;\n }\n}\n\n/**\n * @type {any}\n */\nconst CanvasGraphics = (function CanvasGraphicsClosure() {\n // Defines the time the executeOperatorList is going to be executing\n // before it stops and shedules a continue of execution.\n const EXECUTION_TIME = 15;\n // Defines the number of steps before checking the execution time\n const EXECUTION_STEPS = 10;\n\n function putBinaryImageData(ctx, imgData, transferMaps = null) {\n if (typeof ImageData !== \"undefined\" && imgData instanceof ImageData) {\n ctx.putImageData(imgData, 0, 0);\n return;\n }\n\n // Put the image data to the canvas in chunks, rather than putting the\n // whole image at once. This saves JS memory, because the ImageData object\n // is smaller. It also possibly saves C++ memory within the implementation\n // of putImageData(). (E.g. in Firefox we make two short-lived copies of\n // the data passed to putImageData()). |n| shouldn't be too small, however,\n // because too many putImageData() calls will slow things down.\n //\n // Note: as written, if the last chunk is partial, the putImageData() call\n // will (conceptually) put pixels past the bounds of the canvas. But\n // that's ok; any such pixels are ignored.\n\n const height = imgData.height,\n width = imgData.width;\n const partialChunkHeight = height % FULL_CHUNK_HEIGHT;\n const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;\n const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;\n\n const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);\n let srcPos = 0,\n destPos;\n const src = imgData.data;\n const dest = chunkImgData.data;\n let i, j, thisChunkHeight, elemsInThisChunk;\n\n let transferMapRed, transferMapGreen, transferMapBlue, transferMapGray;\n if (transferMaps) {\n switch (transferMaps.length) {\n case 1:\n transferMapRed = transferMaps[0];\n transferMapGreen = transferMaps[0];\n transferMapBlue = transferMaps[0];\n transferMapGray = transferMaps[0];\n break;\n case 4:\n transferMapRed = transferMaps[0];\n transferMapGreen = transferMaps[1];\n transferMapBlue = transferMaps[2];\n transferMapGray = transferMaps[3];\n break;\n }\n }\n\n // There are multiple forms in which the pixel data can be passed, and\n // imgData.kind tells us which one this is.\n if (imgData.kind === ImageKind.GRAYSCALE_1BPP) {\n // Grayscale, 1 bit per pixel (i.e. black-and-white).\n const srcLength = src.byteLength;\n const dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);\n const dest32DataLength = dest32.length;\n const fullSrcDiff = (width + 7) >> 3;\n let white = 0xffffffff;\n let black = IsLittleEndianCached.value ? 0xff000000 : 0x000000ff;\n\n if (transferMapGray) {\n if (transferMapGray[0] === 0xff && transferMapGray[0xff] === 0) {\n [white, black] = [black, white];\n }\n }\n\n for (i = 0; i < totalChunks; i++) {\n thisChunkHeight =\n i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;\n destPos = 0;\n for (j = 0; j < thisChunkHeight; j++) {\n const srcDiff = srcLength - srcPos;\n let k = 0;\n const kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7;\n const kEndUnrolled = kEnd & ~7;\n let mask = 0;\n let srcByte = 0;\n for (; k < kEndUnrolled; k += 8) {\n srcByte = src[srcPos++];\n dest32[destPos++] = srcByte & 128 ? white : black;\n dest32[destPos++] = srcByte & 64 ? white : black;\n dest32[destPos++] = srcByte & 32 ? white : black;\n dest32[destPos++] = srcByte & 16 ? white : black;\n dest32[destPos++] = srcByte & 8 ? white : black;\n dest32[destPos++] = srcByte & 4 ? white : black;\n dest32[destPos++] = srcByte & 2 ? white : black;\n dest32[destPos++] = srcByte & 1 ? white : black;\n }\n for (; k < kEnd; k++) {\n if (mask === 0) {\n srcByte = src[srcPos++];\n mask = 128;\n }\n\n dest32[destPos++] = srcByte & mask ? white : black;\n mask >>= 1;\n }\n }\n // We ran out of input. Make all remaining pixels transparent.\n while (destPos < dest32DataLength) {\n dest32[destPos++] = 0;\n }\n\n ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);\n }\n } else if (imgData.kind === ImageKind.RGBA_32BPP) {\n // RGBA, 32-bits per pixel.\n const hasTransferMaps = !!(\n transferMapRed ||\n transferMapGreen ||\n transferMapBlue\n );\n\n j = 0;\n elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;\n for (i = 0; i < fullChunks; i++) {\n dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));\n srcPos += elemsInThisChunk;\n\n if (hasTransferMaps) {\n for (let k = 0; k < elemsInThisChunk; k += 4) {\n if (transferMapRed) {\n dest[k + 0] = transferMapRed[dest[k + 0]];\n }\n if (transferMapGreen) {\n dest[k + 1] = transferMapGreen[dest[k + 1]];\n }\n if (transferMapBlue) {\n dest[k + 2] = transferMapBlue[dest[k + 2]];\n }\n }\n }\n\n ctx.putImageData(chunkImgData, 0, j);\n j += FULL_CHUNK_HEIGHT;\n }\n if (i < totalChunks) {\n elemsInThisChunk = width * partialChunkHeight * 4;\n dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));\n\n if (hasTransferMaps) {\n for (let k = 0; k < elemsInThisChunk; k += 4) {\n if (transferMapRed) {\n dest[k + 0] = transferMapRed[dest[k + 0]];\n }\n if (transferMapGreen) {\n dest[k + 1] = transferMapGreen[dest[k + 1]];\n }\n if (transferMapBlue) {\n dest[k + 2] = transferMapBlue[dest[k + 2]];\n }\n }\n }\n\n ctx.putImageData(chunkImgData, 0, j);\n }\n } else if (imgData.kind === ImageKind.RGB_24BPP) {\n // RGB, 24-bits per pixel.\n const hasTransferMaps = !!(\n transferMapRed ||\n transferMapGreen ||\n transferMapBlue\n );\n\n thisChunkHeight = FULL_CHUNK_HEIGHT;\n elemsInThisChunk = width * thisChunkHeight;\n for (i = 0; i < totalChunks; i++) {\n if (i >= fullChunks) {\n thisChunkHeight = partialChunkHeight;\n elemsInThisChunk = width * thisChunkHeight;\n }\n\n destPos = 0;\n for (j = elemsInThisChunk; j--; ) {\n dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++];\n dest[destPos++] = src[srcPos++];\n dest[destPos++] = 255;\n }\n\n if (hasTransferMaps) {\n for (let k = 0; k < destPos; k += 4) {\n if (transferMapRed) {\n dest[k + 0] = transferMapRed[dest[k + 0]];\n }\n if (transferMapGreen) {\n dest[k + 1] = transferMapGreen[dest[k + 1]];\n }\n if (transferMapBlue) {\n dest[k + 2] = transferMapBlue[dest[k + 2]];\n }\n }\n }\n\n ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);\n }\n } else {\n throw new Error(`bad image kind: ${imgData.kind}`);\n }\n }\n\n function putBinaryImageMask(ctx, imgData) {\n const height = imgData.height,\n width = imgData.width;\n const partialChunkHeight = height % FULL_CHUNK_HEIGHT;\n const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;\n const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;\n\n const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);\n let srcPos = 0;\n const src = imgData.data;\n const dest = chunkImgData.data;\n\n for (let i = 0; i < totalChunks; i++) {\n const thisChunkHeight =\n i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;\n\n // Expand the mask so it can be used by the canvas. Any required\n // inversion has already been handled.\n let destPos = 3; // alpha component offset\n for (let j = 0; j < thisChunkHeight; j++) {\n let elem,\n mask = 0;\n for (let k = 0; k < width; k++) {\n if (!mask) {\n elem = src[srcPos++];\n mask = 128;\n }\n dest[destPos] = elem & mask ? 0 : 255;\n destPos += 4;\n mask >>= 1;\n }\n }\n ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);\n }\n }\n\n function copyCtxState(sourceCtx, destCtx) {\n const properties = [\n \"strokeStyle\",\n \"fillStyle\",\n \"fillRule\",\n \"globalAlpha\",\n \"lineWidth\",\n \"lineCap\",\n \"lineJoin\",\n \"miterLimit\",\n \"globalCompositeOperation\",\n \"font\",\n ];\n for (let i = 0, ii = properties.length; i < ii; i++) {\n const property = properties[i];\n if (sourceCtx[property] !== undefined) {\n destCtx[property] = sourceCtx[property];\n }\n }\n if (sourceCtx.setLineDash !== undefined) {\n destCtx.setLineDash(sourceCtx.getLineDash());\n destCtx.lineDashOffset = sourceCtx.lineDashOffset;\n }\n }\n\n function resetCtxToDefault(ctx) {\n ctx.strokeStyle = \"#000000\";\n ctx.fillStyle = \"#000000\";\n ctx.fillRule = \"nonzero\";\n ctx.globalAlpha = 1;\n ctx.lineWidth = 1;\n ctx.lineCap = \"butt\";\n ctx.lineJoin = \"miter\";\n ctx.miterLimit = 10;\n ctx.globalCompositeOperation = \"source-over\";\n ctx.font = \"10px sans-serif\";\n if (ctx.setLineDash !== undefined) {\n ctx.setLineDash([]);\n ctx.lineDashOffset = 0;\n }\n }\n\n function composeSMaskBackdrop(bytes, r0, g0, b0) {\n const length = bytes.length;\n for (let i = 3; i < length; i += 4) {\n const alpha = bytes[i];\n if (alpha === 0) {\n bytes[i - 3] = r0;\n bytes[i - 2] = g0;\n bytes[i - 1] = b0;\n } else if (alpha < 255) {\n const alpha_ = 255 - alpha;\n bytes[i - 3] = (bytes[i - 3] * alpha + r0 * alpha_) >> 8;\n bytes[i - 2] = (bytes[i - 2] * alpha + g0 * alpha_) >> 8;\n bytes[i - 1] = (bytes[i - 1] * alpha + b0 * alpha_) >> 8;\n }\n }\n }\n\n function composeSMaskAlpha(maskData, layerData, transferMap) {\n const length = maskData.length;\n const scale = 1 / 255;\n for (let i = 3; i < length; i += 4) {\n const alpha = transferMap ? transferMap[maskData[i]] : maskData[i];\n layerData[i] = (layerData[i] * alpha * scale) | 0;\n }\n }\n\n function composeSMaskLuminosity(maskData, layerData, transferMap) {\n const length = maskData.length;\n for (let i = 3; i < length; i += 4) {\n const y =\n maskData[i - 3] * 77 + // * 0.3 / 255 * 0x10000\n maskData[i - 2] * 152 + // * 0.59 ....\n maskData[i - 1] * 28; // * 0.11 ....\n layerData[i] = transferMap\n ? (layerData[i] * transferMap[y >> 8]) >> 8\n : (layerData[i] * y) >> 16;\n }\n }\n\n function genericComposeSMask(\n maskCtx,\n layerCtx,\n width,\n height,\n subtype,\n backdrop,\n transferMap\n ) {\n const hasBackdrop = !!backdrop;\n const r0 = hasBackdrop ? backdrop[0] : 0;\n const g0 = hasBackdrop ? backdrop[1] : 0;\n const b0 = hasBackdrop ? backdrop[2] : 0;\n\n let composeFn;\n if (subtype === \"Luminosity\") {\n composeFn = composeSMaskLuminosity;\n } else {\n composeFn = composeSMaskAlpha;\n }\n\n // processing image in chunks to save memory\n const PIXELS_TO_PROCESS = 1048576;\n const chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));\n for (let row = 0; row < height; row += chunkSize) {\n const chunkHeight = Math.min(chunkSize, height - row);\n const maskData = maskCtx.getImageData(0, row, width, chunkHeight);\n const layerData = layerCtx.getImageData(0, row, width, chunkHeight);\n\n if (hasBackdrop) {\n composeSMaskBackdrop(maskData.data, r0, g0, b0);\n }\n composeFn(maskData.data, layerData.data, transferMap);\n\n maskCtx.putImageData(layerData, 0, row);\n }\n }\n\n function composeSMask(ctx, smask, layerCtx) {\n const mask = smask.canvas;\n const maskCtx = smask.context;\n\n ctx.setTransform(\n smask.scaleX,\n 0,\n 0,\n smask.scaleY,\n smask.offsetX,\n smask.offsetY\n );\n\n genericComposeSMask(\n maskCtx,\n layerCtx,\n mask.width,\n mask.height,\n smask.subtype,\n smask.backdrop,\n smask.transferMap\n );\n ctx.drawImage(mask, 0, 0);\n }\n\n const LINE_CAP_STYLES = [\"butt\", \"round\", \"square\"];\n const LINE_JOIN_STYLES = [\"miter\", \"round\", \"bevel\"];\n const NORMAL_CLIP = {};\n const EO_CLIP = {};\n\n // eslint-disable-next-line no-shadow\n class CanvasGraphics {\n constructor(\n canvasCtx,\n commonObjs,\n objs,\n canvasFactory,\n imageLayer,\n optionalContentConfig\n ) {\n this.ctx = canvasCtx;\n this.current = new CanvasExtraState();\n this.stateStack = [];\n this.pendingClip = null;\n this.pendingEOFill = false;\n this.res = null;\n this.xobjs = null;\n this.commonObjs = commonObjs;\n this.objs = objs;\n this.canvasFactory = canvasFactory;\n this.imageLayer = imageLayer;\n this.groupStack = [];\n this.processingType3 = null;\n // Patterns are painted relative to the initial page/form transform, see\n // PDF spec 8.7.2 NOTE 1.\n this.baseTransform = null;\n this.baseTransformStack = [];\n this.groupLevel = 0;\n this.smaskStack = [];\n this.smaskCounter = 0;\n this.tempSMask = null;\n this.contentVisible = true;\n this.markedContentStack = [];\n this.optionalContentConfig = optionalContentConfig;\n this.cachedCanvases = new CachedCanvases(this.canvasFactory);\n if (canvasCtx) {\n // NOTE: if mozCurrentTransform is polyfilled, then the current state of\n // the transformation must already be set in canvasCtx._transformMatrix.\n addContextCurrentTransform(canvasCtx);\n }\n this._cachedGetSinglePixelWidth = null;\n }\n\n beginDrawing({\n transform,\n viewport,\n transparency = false,\n background = null,\n }) {\n // For pdfs that use blend modes we have to clear the canvas else certain\n // blend modes can look wrong since we'd be blending with a white\n // backdrop. The problem with a transparent backdrop though is we then\n // don't get sub pixel anti aliasing on text, creating temporary\n // transparent canvas when we have blend modes.\n const width = this.ctx.canvas.width;\n const height = this.ctx.canvas.height;\n\n this.ctx.save();\n this.ctx.fillStyle = background || \"rgb(255, 255, 255)\";\n this.ctx.fillRect(0, 0, width, height);\n this.ctx.restore();\n\n if (transparency) {\n const transparentCanvas = this.cachedCanvases.getCanvas(\n \"transparent\",\n width,\n height,\n true\n );\n this.compositeCtx = this.ctx;\n this.transparentCanvas = transparentCanvas.canvas;\n this.ctx = transparentCanvas.context;\n this.ctx.save();\n // The transform can be applied before rendering, transferring it to\n // the new canvas.\n this.ctx.transform.apply(\n this.ctx,\n this.compositeCtx.mozCurrentTransform\n );\n }\n\n this.ctx.save();\n resetCtxToDefault(this.ctx);\n if (transform) {\n this.ctx.transform.apply(this.ctx, transform);\n }\n this.ctx.transform.apply(this.ctx, viewport.transform);\n\n this.baseTransform = this.ctx.mozCurrentTransform.slice();\n this._combinedScaleFactor = Math.hypot(\n this.baseTransform[0],\n this.baseTransform[2]\n );\n\n if (this.imageLayer) {\n this.imageLayer.beginLayout();\n }\n }\n\n executeOperatorList(\n operatorList,\n executionStartIdx,\n continueCallback,\n stepper\n ) {\n const argsArray = operatorList.argsArray;\n const fnArray = operatorList.fnArray;\n let i = executionStartIdx || 0;\n const argsArrayLen = argsArray.length;\n\n // Sometimes the OperatorList to execute is empty.\n if (argsArrayLen === i) {\n return i;\n }\n\n const chunkOperations =\n argsArrayLen - i > EXECUTION_STEPS &&\n typeof continueCallback === \"function\";\n const endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;\n let steps = 0;\n\n const commonObjs = this.commonObjs;\n const objs = this.objs;\n let fnId;\n\n while (true) {\n if (stepper !== undefined && i === stepper.nextBreakPoint) {\n stepper.breakIt(i, continueCallback);\n return i;\n }\n\n fnId = fnArray[i];\n\n if (fnId !== OPS.dependency) {\n this[fnId].apply(this, argsArray[i]);\n } else {\n for (const depObjId of argsArray[i]) {\n const objsPool = depObjId.startsWith(\"g_\") ? commonObjs : objs;\n\n // If the promise isn't resolved yet, add the continueCallback\n // to the promise and bail out.\n if (!objsPool.has(depObjId)) {\n objsPool.get(depObjId, continueCallback);\n return i;\n }\n }\n }\n\n i++;\n\n // If the entire operatorList was executed, stop as were done.\n if (i === argsArrayLen) {\n return i;\n }\n\n // If the execution took longer then a certain amount of time and\n // `continueCallback` is specified, interrupt the execution.\n if (chunkOperations && ++steps > EXECUTION_STEPS) {\n if (Date.now() > endTime) {\n continueCallback();\n return i;\n }\n steps = 0;\n }\n\n // If the operatorList isn't executed completely yet OR the execution\n // time was short enough, do another execution round.\n }\n }\n\n endDrawing() {\n // Finishing all opened operations such as SMask group painting.\n while (this.stateStack.length || this.current.activeSMask !== null) {\n this.restore();\n }\n\n this.ctx.restore();\n\n if (this.transparentCanvas) {\n this.ctx = this.compositeCtx;\n this.ctx.save();\n this.ctx.setTransform(1, 0, 0, 1, 0, 0); // Avoid apply transform twice\n this.ctx.drawImage(this.transparentCanvas, 0, 0);\n this.ctx.restore();\n this.transparentCanvas = null;\n }\n\n this.cachedCanvases.clear();\n\n if (this.imageLayer) {\n this.imageLayer.endLayout();\n }\n }\n\n // Graphics state\n setLineWidth(width) {\n this.current.lineWidth = width;\n this.ctx.lineWidth = width;\n }\n\n setLineCap(style) {\n this.ctx.lineCap = LINE_CAP_STYLES[style];\n }\n\n setLineJoin(style) {\n this.ctx.lineJoin = LINE_JOIN_STYLES[style];\n }\n\n setMiterLimit(limit) {\n this.ctx.miterLimit = limit;\n }\n\n setDash(dashArray, dashPhase) {\n const ctx = this.ctx;\n if (ctx.setLineDash !== undefined) {\n ctx.setLineDash(dashArray);\n ctx.lineDashOffset = dashPhase;\n }\n }\n\n setRenderingIntent(intent) {\n // This operation is ignored since we haven't found a use case for it yet.\n }\n\n setFlatness(flatness) {\n // This operation is ignored since we haven't found a use case for it yet.\n }\n\n setGState(states) {\n for (let i = 0, ii = states.length; i < ii; i++) {\n const state = states[i];\n const key = state[0];\n const value = state[1];\n\n switch (key) {\n case \"LW\":\n this.setLineWidth(value);\n break;\n case \"LC\":\n this.setLineCap(value);\n break;\n case \"LJ\":\n this.setLineJoin(value);\n break;\n case \"ML\":\n this.setMiterLimit(value);\n break;\n case \"D\":\n this.setDash(value[0], value[1]);\n break;\n case \"RI\":\n this.setRenderingIntent(value);\n break;\n case \"FL\":\n this.setFlatness(value);\n break;\n case \"Font\":\n this.setFont(value[0], value[1]);\n break;\n case \"CA\":\n this.current.strokeAlpha = state[1];\n break;\n case \"ca\":\n this.current.fillAlpha = state[1];\n this.ctx.globalAlpha = state[1];\n break;\n case \"BM\":\n this.ctx.globalCompositeOperation = value;\n break;\n case \"SMask\":\n if (this.current.activeSMask) {\n // If SMask is currrenly used, it needs to be suspended or\n // finished. Suspend only makes sense when at least one save()\n // was performed and state needs to be reverted on restore().\n if (\n this.stateStack.length > 0 &&\n this.stateStack[this.stateStack.length - 1].activeSMask ===\n this.current.activeSMask\n ) {\n this.suspendSMaskGroup();\n } else {\n this.endSMaskGroup();\n }\n }\n this.current.activeSMask = value ? this.tempSMask : null;\n if (this.current.activeSMask) {\n this.beginSMaskGroup();\n }\n this.tempSMask = null;\n break;\n case \"TR\":\n this.current.transferMaps = value;\n }\n }\n }\n\n beginSMaskGroup() {\n const activeSMask = this.current.activeSMask;\n const drawnWidth = activeSMask.canvas.width;\n const drawnHeight = activeSMask.canvas.height;\n const cacheId = \"smaskGroupAt\" + this.groupLevel;\n const scratchCanvas = this.cachedCanvases.getCanvas(\n cacheId,\n drawnWidth,\n drawnHeight,\n true\n );\n\n const currentCtx = this.ctx;\n const currentTransform = currentCtx.mozCurrentTransform;\n this.ctx.save();\n\n const groupCtx = scratchCanvas.context;\n groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY);\n groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY);\n groupCtx.transform.apply(groupCtx, currentTransform);\n\n activeSMask.startTransformInverse = groupCtx.mozCurrentTransformInverse;\n\n copyCtxState(currentCtx, groupCtx);\n this.ctx = groupCtx;\n this.setGState([\n [\"BM\", \"source-over\"],\n [\"ca\", 1],\n [\"CA\", 1],\n ]);\n this.groupStack.push(currentCtx);\n this.groupLevel++;\n }\n\n suspendSMaskGroup() {\n // Similar to endSMaskGroup, the intermediate canvas has to be composed\n // and future ctx state restored.\n const groupCtx = this.ctx;\n this.groupLevel--;\n this.ctx = this.groupStack.pop();\n\n composeSMask(this.ctx, this.current.activeSMask, groupCtx);\n this.ctx.restore();\n this.ctx.save(); // save is needed since SMask will be resumed.\n copyCtxState(groupCtx, this.ctx);\n\n // Saving state for resuming.\n this.current.resumeSMaskCtx = groupCtx;\n // Transform was changed in the SMask canvas, reflecting this change on\n // this.ctx.\n const deltaTransform = Util.transform(\n this.current.activeSMask.startTransformInverse,\n groupCtx.mozCurrentTransform\n );\n this.ctx.transform.apply(this.ctx, deltaTransform);\n\n // SMask was composed, the results at the groupCtx can be cleared.\n groupCtx.save();\n groupCtx.setTransform(1, 0, 0, 1, 0, 0);\n groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height);\n groupCtx.restore();\n }\n\n resumeSMaskGroup() {\n // Resuming state saved by suspendSMaskGroup. We don't need to restore\n // any groupCtx state since restore() command (the only caller) will do\n // that for us. See also beginSMaskGroup.\n const groupCtx = this.current.resumeSMaskCtx;\n const currentCtx = this.ctx;\n this.ctx = groupCtx;\n this.groupStack.push(currentCtx);\n this.groupLevel++;\n }\n\n endSMaskGroup() {\n const groupCtx = this.ctx;\n this.groupLevel--;\n this.ctx = this.groupStack.pop();\n\n composeSMask(this.ctx, this.current.activeSMask, groupCtx);\n this.ctx.restore();\n copyCtxState(groupCtx, this.ctx);\n // Transform was changed in the SMask canvas, reflecting this change on\n // this.ctx.\n const deltaTransform = Util.transform(\n this.current.activeSMask.startTransformInverse,\n groupCtx.mozCurrentTransform\n );\n this.ctx.transform.apply(this.ctx, deltaTransform);\n }\n\n save() {\n this.ctx.save();\n const old = this.current;\n this.stateStack.push(old);\n this.current = old.clone();\n this.current.resumeSMaskCtx = null;\n }\n\n restore() {\n // SMask was suspended, we just need to resume it.\n if (this.current.resumeSMaskCtx) {\n this.resumeSMaskGroup();\n }\n // SMask has to be finished once there is no states that are using the\n // same SMask.\n if (\n this.current.activeSMask !== null &&\n (this.stateStack.length === 0 ||\n this.stateStack[this.stateStack.length - 1].activeSMask !==\n this.current.activeSMask)\n ) {\n this.endSMaskGroup();\n }\n\n if (this.stateStack.length !== 0) {\n this.current = this.stateStack.pop();\n this.ctx.restore();\n\n // Ensure that the clipping path is reset (fixes issue6413.pdf).\n this.pendingClip = null;\n\n this._cachedGetSinglePixelWidth = null;\n } else {\n // We've finished all the SMask groups, reflect that in our state.\n this.current.activeSMask = null;\n }\n }\n\n transform(a, b, c, d, e, f) {\n this.ctx.transform(a, b, c, d, e, f);\n\n this._cachedGetSinglePixelWidth = null;\n }\n\n // Path\n constructPath(ops, args) {\n const ctx = this.ctx;\n const current = this.current;\n let x = current.x,\n y = current.y;\n for (let i = 0, j = 0, ii = ops.length; i < ii; i++) {\n switch (ops[i] | 0) {\n case OPS.rectangle:\n x = args[j++];\n y = args[j++];\n const width = args[j++];\n const height = args[j++];\n\n const xw = x + width;\n const yh = y + height;\n ctx.moveTo(x, y);\n if (width === 0 || height === 0) {\n ctx.lineTo(xw, yh);\n } else {\n ctx.lineTo(xw, y);\n ctx.lineTo(xw, yh);\n ctx.lineTo(x, yh);\n }\n\n ctx.closePath();\n break;\n case OPS.moveTo:\n x = args[j++];\n y = args[j++];\n ctx.moveTo(x, y);\n break;\n case OPS.lineTo:\n x = args[j++];\n y = args[j++];\n ctx.lineTo(x, y);\n break;\n case OPS.curveTo:\n x = args[j + 4];\n y = args[j + 5];\n ctx.bezierCurveTo(\n args[j],\n args[j + 1],\n args[j + 2],\n args[j + 3],\n x,\n y\n );\n j += 6;\n break;\n case OPS.curveTo2:\n ctx.bezierCurveTo(\n x,\n y,\n args[j],\n args[j + 1],\n args[j + 2],\n args[j + 3]\n );\n x = args[j + 2];\n y = args[j + 3];\n j += 4;\n break;\n case OPS.curveTo3:\n x = args[j + 2];\n y = args[j + 3];\n ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);\n j += 4;\n break;\n case OPS.closePath:\n ctx.closePath();\n break;\n }\n }\n current.setCurrentPoint(x, y);\n }\n\n closePath() {\n this.ctx.closePath();\n }\n\n stroke(consumePath) {\n consumePath = typeof consumePath !== \"undefined\" ? consumePath : true;\n const ctx = this.ctx;\n const strokeColor = this.current.strokeColor;\n // For stroke we want to temporarily change the global alpha to the\n // stroking alpha.\n ctx.globalAlpha = this.current.strokeAlpha;\n if (this.contentVisible) {\n if (typeof strokeColor === \"object\" && strokeColor?.getPattern) {\n const lineWidth = this.getSinglePixelWidth();\n ctx.save();\n ctx.strokeStyle = strokeColor.getPattern(ctx, this);\n // Prevent drawing too thin lines by enforcing a minimum line width.\n ctx.lineWidth = Math.max(lineWidth, this.current.lineWidth);\n ctx.stroke();\n ctx.restore();\n } else {\n const lineWidth = this.getSinglePixelWidth();\n if (lineWidth < 0 && -lineWidth >= this.current.lineWidth) {\n // The current transform will transform a square pixel into a\n // parallelogram where both heights are lower than 1 and not equal.\n ctx.save();\n ctx.resetTransform();\n ctx.lineWidth = Math.round(this._combinedScaleFactor);\n ctx.stroke();\n ctx.restore();\n } else {\n // Prevent drawing too thin lines by enforcing a minimum line width.\n ctx.lineWidth = Math.max(lineWidth, this.current.lineWidth);\n ctx.stroke();\n }\n }\n }\n if (consumePath) {\n this.consumePath();\n }\n // Restore the global alpha to the fill alpha\n ctx.globalAlpha = this.current.fillAlpha;\n }\n\n closeStroke() {\n this.closePath();\n this.stroke();\n }\n\n fill(consumePath) {\n consumePath = typeof consumePath !== \"undefined\" ? consumePath : true;\n const ctx = this.ctx;\n const fillColor = this.current.fillColor;\n const isPatternFill = this.current.patternFill;\n let needRestore = false;\n\n if (isPatternFill) {\n ctx.save();\n ctx.fillStyle = fillColor.getPattern(ctx, this);\n needRestore = true;\n }\n\n if (this.contentVisible) {\n if (this.pendingEOFill) {\n ctx.fill(\"evenodd\");\n this.pendingEOFill = false;\n } else {\n ctx.fill();\n }\n }\n\n if (needRestore) {\n ctx.restore();\n }\n if (consumePath) {\n this.consumePath();\n }\n }\n\n eoFill() {\n this.pendingEOFill = true;\n this.fill();\n }\n\n fillStroke() {\n this.fill(false);\n this.stroke(false);\n\n this.consumePath();\n }\n\n eoFillStroke() {\n this.pendingEOFill = true;\n this.fillStroke();\n }\n\n closeFillStroke() {\n this.closePath();\n this.fillStroke();\n }\n\n closeEOFillStroke() {\n this.pendingEOFill = true;\n this.closePath();\n this.fillStroke();\n }\n\n endPath() {\n this.consumePath();\n }\n\n // Clipping\n clip() {\n this.pendingClip = NORMAL_CLIP;\n }\n\n eoClip() {\n this.pendingClip = EO_CLIP;\n }\n\n // Text\n beginText() {\n this.current.textMatrix = IDENTITY_MATRIX;\n this.current.textMatrixScale = 1;\n this.current.x = this.current.lineX = 0;\n this.current.y = this.current.lineY = 0;\n }\n\n endText() {\n const paths = this.pendingTextPaths;\n const ctx = this.ctx;\n if (paths === undefined) {\n ctx.beginPath();\n return;\n }\n\n ctx.save();\n ctx.beginPath();\n for (let i = 0; i < paths.length; i++) {\n const path = paths[i];\n ctx.setTransform.apply(ctx, path.transform);\n ctx.translate(path.x, path.y);\n path.addToPath(ctx, path.fontSize);\n }\n ctx.restore();\n ctx.clip();\n ctx.beginPath();\n delete this.pendingTextPaths;\n }\n\n setCharSpacing(spacing) {\n this.current.charSpacing = spacing;\n }\n\n setWordSpacing(spacing) {\n this.current.wordSpacing = spacing;\n }\n\n setHScale(scale) {\n this.current.textHScale = scale / 100;\n }\n\n setLeading(leading) {\n this.current.leading = -leading;\n }\n\n setFont(fontRefName, size) {\n const fontObj = this.commonObjs.get(fontRefName);\n const current = this.current;\n\n if (!fontObj) {\n throw new Error(`Can't find font for ${fontRefName}`);\n }\n current.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;\n\n // A valid matrix needs all main diagonal elements to be non-zero\n // This also ensures we bypass FF bugzilla bug #719844.\n if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) {\n warn(\"Invalid font matrix for font \" + fontRefName);\n }\n\n // The spec for Tf (setFont) says that 'size' specifies the font 'scale',\n // and in some docs this can be negative (inverted x-y axes).\n if (size < 0) {\n size = -size;\n current.fontDirection = -1;\n } else {\n current.fontDirection = 1;\n }\n\n this.current.font = fontObj;\n this.current.fontSize = size;\n\n if (fontObj.isType3Font) {\n return; // we don't need ctx.font for Type3 fonts\n }\n\n const name = fontObj.loadedName || \"sans-serif\";\n\n let bold = \"normal\";\n if (fontObj.black) {\n bold = \"900\";\n } else if (fontObj.bold) {\n bold = \"bold\";\n }\n const italic = fontObj.italic ? \"italic\" : \"normal\";\n const typeface = `\"${name}\", ${fontObj.fallbackName}`;\n\n // Some font backends cannot handle fonts below certain size.\n // Keeping the font at minimal size and using the fontSizeScale to change\n // the current transformation matrix before the fillText/strokeText.\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=726227\n let browserFontSize = size;\n if (size < MIN_FONT_SIZE) {\n browserFontSize = MIN_FONT_SIZE;\n } else if (size > MAX_FONT_SIZE) {\n browserFontSize = MAX_FONT_SIZE;\n }\n this.current.fontSizeScale = size / browserFontSize;\n\n this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;\n }\n\n setTextRenderingMode(mode) {\n this.current.textRenderingMode = mode;\n }\n\n setTextRise(rise) {\n this.current.textRise = rise;\n }\n\n moveText(x, y) {\n this.current.x = this.current.lineX += x;\n this.current.y = this.current.lineY += y;\n }\n\n setLeadingMoveText(x, y) {\n this.setLeading(-y);\n this.moveText(x, y);\n }\n\n setTextMatrix(a, b, c, d, e, f) {\n this.current.textMatrix = [a, b, c, d, e, f];\n this.current.textMatrixScale = Math.hypot(a, b);\n\n this.current.x = this.current.lineX = 0;\n this.current.y = this.current.lineY = 0;\n }\n\n nextLine() {\n this.moveText(0, this.current.leading);\n }\n\n paintChar(character, x, y, patternTransform, resetLineWidthToOne) {\n const ctx = this.ctx;\n const current = this.current;\n const font = current.font;\n const textRenderingMode = current.textRenderingMode;\n const fontSize = current.fontSize / current.fontSizeScale;\n const fillStrokeMode =\n textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;\n const isAddToPathSet = !!(\n textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG\n );\n const patternFill = current.patternFill && !font.missingFile;\n\n let addToPath;\n if (font.disableFontFace || isAddToPathSet || patternFill) {\n addToPath = font.getPathGenerator(this.commonObjs, character);\n }\n\n if (font.disableFontFace || patternFill) {\n ctx.save();\n ctx.translate(x, y);\n ctx.beginPath();\n addToPath(ctx, fontSize);\n if (patternTransform) {\n ctx.setTransform.apply(ctx, patternTransform);\n }\n if (\n fillStrokeMode === TextRenderingMode.FILL ||\n fillStrokeMode === TextRenderingMode.FILL_STROKE\n ) {\n ctx.fill();\n }\n if (\n fillStrokeMode === TextRenderingMode.STROKE ||\n fillStrokeMode === TextRenderingMode.FILL_STROKE\n ) {\n if (resetLineWidthToOne) {\n ctx.resetTransform();\n ctx.lineWidth = Math.round(this._combinedScaleFactor);\n }\n ctx.stroke();\n }\n ctx.restore();\n } else {\n if (\n fillStrokeMode === TextRenderingMode.FILL ||\n fillStrokeMode === TextRenderingMode.FILL_STROKE\n ) {\n ctx.fillText(character, x, y);\n }\n if (\n fillStrokeMode === TextRenderingMode.STROKE ||\n fillStrokeMode === TextRenderingMode.FILL_STROKE\n ) {\n if (resetLineWidthToOne) {\n ctx.save();\n ctx.moveTo(x, y);\n ctx.resetTransform();\n ctx.lineWidth = Math.round(this._combinedScaleFactor);\n ctx.strokeText(character, 0, 0);\n ctx.restore();\n } else {\n ctx.strokeText(character, x, y);\n }\n }\n }\n\n if (isAddToPathSet) {\n const paths = this.pendingTextPaths || (this.pendingTextPaths = []);\n paths.push({\n transform: ctx.mozCurrentTransform,\n x,\n y,\n fontSize,\n addToPath,\n });\n }\n }\n\n get isFontSubpixelAAEnabled() {\n // Checks if anti-aliasing is enabled when scaled text is painted.\n // On Windows GDI scaled fonts looks bad.\n const { context: ctx } = this.cachedCanvases.getCanvas(\n \"isFontSubpixelAAEnabled\",\n 10,\n 10\n );\n ctx.scale(1.5, 1);\n ctx.fillText(\"I\", 0, 10);\n const data = ctx.getImageData(0, 0, 10, 10).data;\n let enabled = false;\n for (let i = 3; i < data.length; i += 4) {\n if (data[i] > 0 && data[i] < 255) {\n enabled = true;\n break;\n }\n }\n return shadow(this, \"isFontSubpixelAAEnabled\", enabled);\n }\n\n showText(glyphs) {\n const current = this.current;\n const font = current.font;\n if (font.isType3Font) {\n return this.showType3Text(glyphs);\n }\n\n const fontSize = current.fontSize;\n if (fontSize === 0) {\n return undefined;\n }\n\n const ctx = this.ctx;\n const fontSizeScale = current.fontSizeScale;\n const charSpacing = current.charSpacing;\n const wordSpacing = current.wordSpacing;\n const fontDirection = current.fontDirection;\n const textHScale = current.textHScale * fontDirection;\n const glyphsLength = glyphs.length;\n const vertical = font.vertical;\n const spacingDir = vertical ? 1 : -1;\n const defaultVMetrics = font.defaultVMetrics;\n const widthAdvanceScale = fontSize * current.fontMatrix[0];\n\n const simpleFillText =\n current.textRenderingMode === TextRenderingMode.FILL &&\n !font.disableFontFace &&\n !current.patternFill;\n\n ctx.save();\n let patternTransform;\n if (current.patternFill) {\n // TODO: Patterns are not applied correctly to text if a non-embedded\n // font is used. E.g. issue 8111 and ShowText-ShadingPattern.pdf.\n ctx.save();\n const pattern = current.fillColor.getPattern(ctx, this);\n patternTransform = ctx.mozCurrentTransform;\n ctx.restore();\n ctx.fillStyle = pattern;\n }\n ctx.transform.apply(ctx, current.textMatrix);\n ctx.translate(current.x, current.y + current.textRise);\n\n if (fontDirection > 0) {\n ctx.scale(textHScale, -1);\n } else {\n ctx.scale(textHScale, 1);\n }\n\n let lineWidth = current.lineWidth;\n let resetLineWidthToOne = false;\n const scale = current.textMatrixScale;\n if (scale === 0 || lineWidth === 0) {\n const fillStrokeMode =\n current.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;\n if (\n fillStrokeMode === TextRenderingMode.STROKE ||\n fillStrokeMode === TextRenderingMode.FILL_STROKE\n ) {\n this._cachedGetSinglePixelWidth = null;\n lineWidth = this.getSinglePixelWidth();\n resetLineWidthToOne = lineWidth < 0;\n }\n } else {\n lineWidth /= scale;\n }\n\n if (fontSizeScale !== 1.0) {\n ctx.scale(fontSizeScale, fontSizeScale);\n lineWidth /= fontSizeScale;\n }\n\n ctx.lineWidth = lineWidth;\n\n let x = 0,\n i;\n for (i = 0; i < glyphsLength; ++i) {\n const glyph = glyphs[i];\n if (isNum(glyph)) {\n x += (spacingDir * glyph * fontSize) / 1000;\n continue;\n }\n\n let restoreNeeded = false;\n const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;\n const character = glyph.fontChar;\n const accent = glyph.accent;\n let scaledX, scaledY;\n let width = glyph.width;\n if (vertical) {\n const vmetric = glyph.vmetric || defaultVMetrics;\n const vx =\n -(glyph.vmetric ? vmetric[1] : width * 0.5) * widthAdvanceScale;\n const vy = vmetric[2] * widthAdvanceScale;\n\n width = vmetric ? -vmetric[0] : width;\n scaledX = vx / fontSizeScale;\n scaledY = (x + vy) / fontSizeScale;\n } else {\n scaledX = x / fontSizeScale;\n scaledY = 0;\n }\n\n if (font.remeasure && width > 0) {\n // Some standard fonts may not have the exact width: rescale per\n // character if measured width is greater than expected glyph width\n // and subpixel-aa is enabled, otherwise just center the glyph.\n const measuredWidth =\n ((ctx.measureText(character).width * 1000) / fontSize) *\n fontSizeScale;\n if (width < measuredWidth && this.isFontSubpixelAAEnabled) {\n const characterScaleX = width / measuredWidth;\n restoreNeeded = true;\n ctx.save();\n ctx.scale(characterScaleX, 1);\n scaledX /= characterScaleX;\n } else if (width !== measuredWidth) {\n scaledX +=\n (((width - measuredWidth) / 2000) * fontSize) / fontSizeScale;\n }\n }\n\n // Only attempt to draw the glyph if it is actually in the embedded font\n // file or if there isn't a font file so the fallback font is shown.\n if (this.contentVisible && (glyph.isInFont || font.missingFile)) {\n if (simpleFillText && !accent) {\n // common case\n ctx.fillText(character, scaledX, scaledY);\n } else {\n this.paintChar(\n character,\n scaledX,\n scaledY,\n patternTransform,\n resetLineWidthToOne\n );\n if (accent) {\n const scaledAccentX =\n scaledX + (fontSize * accent.offset.x) / fontSizeScale;\n const scaledAccentY =\n scaledY - (fontSize * accent.offset.y) / fontSizeScale;\n this.paintChar(\n accent.fontChar,\n scaledAccentX,\n scaledAccentY,\n patternTransform,\n resetLineWidthToOne\n );\n }\n }\n }\n\n let charWidth;\n if (vertical) {\n charWidth = width * widthAdvanceScale - spacing * fontDirection;\n } else {\n charWidth = width * widthAdvanceScale + spacing * fontDirection;\n }\n x += charWidth;\n\n if (restoreNeeded) {\n ctx.restore();\n }\n }\n if (vertical) {\n current.y -= x;\n } else {\n current.x += x * textHScale;\n }\n ctx.restore();\n return undefined;\n }\n\n showType3Text(glyphs) {\n // Type3 fonts - each glyph is a \"mini-PDF\"\n const ctx = this.ctx;\n const current = this.current;\n const font = current.font;\n const fontSize = current.fontSize;\n const fontDirection = current.fontDirection;\n const spacingDir = font.vertical ? 1 : -1;\n const charSpacing = current.charSpacing;\n const wordSpacing = current.wordSpacing;\n const textHScale = current.textHScale * fontDirection;\n const fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX;\n const glyphsLength = glyphs.length;\n const isTextInvisible =\n current.textRenderingMode === TextRenderingMode.INVISIBLE;\n let i, glyph, width, spacingLength;\n\n if (isTextInvisible || fontSize === 0) {\n return;\n }\n this._cachedGetSinglePixelWidth = null;\n\n ctx.save();\n ctx.transform.apply(ctx, current.textMatrix);\n ctx.translate(current.x, current.y);\n\n ctx.scale(textHScale, fontDirection);\n\n for (i = 0; i < glyphsLength; ++i) {\n glyph = glyphs[i];\n if (isNum(glyph)) {\n spacingLength = (spacingDir * glyph * fontSize) / 1000;\n this.ctx.translate(spacingLength, 0);\n current.x += spacingLength * textHScale;\n continue;\n }\n\n const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;\n const operatorList = font.charProcOperatorList[glyph.operatorListId];\n if (!operatorList) {\n warn(`Type3 character \"${glyph.operatorListId}\" is not available.`);\n continue;\n }\n if (this.contentVisible) {\n this.processingType3 = glyph;\n this.save();\n ctx.scale(fontSize, fontSize);\n ctx.transform.apply(ctx, fontMatrix);\n this.executeOperatorList(operatorList);\n this.restore();\n }\n\n const transformed = Util.applyTransform([glyph.width, 0], fontMatrix);\n width = transformed[0] * fontSize + spacing;\n\n ctx.translate(width, 0);\n current.x += width * textHScale;\n }\n ctx.restore();\n this.processingType3 = null;\n }\n\n // Type3 fonts\n setCharWidth(xWidth, yWidth) {\n // We can safely ignore this since the width should be the same\n // as the width in the Widths array.\n }\n\n setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {\n // TODO According to the spec we're also suppose to ignore any operators\n // that set color or include images while processing this type3 font.\n this.ctx.rect(llx, lly, urx - llx, ury - lly);\n this.clip();\n this.endPath();\n }\n\n // Color\n getColorN_Pattern(IR) {\n let pattern;\n if (IR[0] === \"TilingPattern\") {\n const color = IR[1];\n const baseTransform =\n this.baseTransform || this.ctx.mozCurrentTransform.slice();\n const canvasGraphicsFactory = {\n createCanvasGraphics: ctx => {\n return new CanvasGraphics(\n ctx,\n this.commonObjs,\n this.objs,\n this.canvasFactory\n );\n },\n };\n pattern = new TilingPattern(\n IR,\n color,\n this.ctx,\n canvasGraphicsFactory,\n baseTransform\n );\n } else {\n pattern = getShadingPattern(IR);\n }\n return pattern;\n }\n\n setStrokeColorN() {\n this.current.strokeColor = this.getColorN_Pattern(arguments);\n }\n\n setFillColorN() {\n this.current.fillColor = this.getColorN_Pattern(arguments);\n this.current.patternFill = true;\n }\n\n setStrokeRGBColor(r, g, b) {\n const color = Util.makeHexColor(r, g, b);\n this.ctx.strokeStyle = color;\n this.current.strokeColor = color;\n }\n\n setFillRGBColor(r, g, b) {\n const color = Util.makeHexColor(r, g, b);\n this.ctx.fillStyle = color;\n this.current.fillColor = color;\n this.current.patternFill = false;\n }\n\n shadingFill(patternIR) {\n if (!this.contentVisible) {\n return;\n }\n const ctx = this.ctx;\n\n this.save();\n const pattern = getShadingPattern(patternIR);\n ctx.fillStyle = pattern.getPattern(ctx, this, true);\n\n const inv = ctx.mozCurrentTransformInverse;\n if (inv) {\n const canvas = ctx.canvas;\n const width = canvas.width;\n const height = canvas.height;\n\n const bl = Util.applyTransform([0, 0], inv);\n const br = Util.applyTransform([0, height], inv);\n const ul = Util.applyTransform([width, 0], inv);\n const ur = Util.applyTransform([width, height], inv);\n\n const x0 = Math.min(bl[0], br[0], ul[0], ur[0]);\n const y0 = Math.min(bl[1], br[1], ul[1], ur[1]);\n const x1 = Math.max(bl[0], br[0], ul[0], ur[0]);\n const y1 = Math.max(bl[1], br[1], ul[1], ur[1]);\n\n this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);\n } else {\n // HACK to draw the gradient onto an infinite rectangle.\n // PDF gradients are drawn across the entire image while\n // Canvas only allows gradients to be drawn in a rectangle\n // The following bug should allow us to remove this.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=664884\n\n this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);\n }\n\n this.restore();\n }\n\n // Images\n beginInlineImage() {\n unreachable(\"Should not call beginInlineImage\");\n }\n\n beginImageData() {\n unreachable(\"Should not call beginImageData\");\n }\n\n paintFormXObjectBegin(matrix, bbox) {\n if (!this.contentVisible) {\n return;\n }\n this.save();\n this.baseTransformStack.push(this.baseTransform);\n\n if (Array.isArray(matrix) && matrix.length === 6) {\n this.transform.apply(this, matrix);\n }\n\n this.baseTransform = this.ctx.mozCurrentTransform;\n\n if (bbox) {\n const width = bbox[2] - bbox[0];\n const height = bbox[3] - bbox[1];\n this.ctx.rect(bbox[0], bbox[1], width, height);\n this.clip();\n this.endPath();\n }\n }\n\n paintFormXObjectEnd() {\n if (!this.contentVisible) {\n return;\n }\n this.restore();\n this.baseTransform = this.baseTransformStack.pop();\n }\n\n beginGroup(group) {\n if (!this.contentVisible) {\n return;\n }\n\n this.save();\n const currentCtx = this.ctx;\n // TODO non-isolated groups - according to Rik at adobe non-isolated\n // group results aren't usually that different and they even have tools\n // that ignore this setting. Notes from Rik on implementing:\n // - When you encounter an transparency group, create a new canvas with\n // the dimensions of the bbox\n // - copy the content from the previous canvas to the new canvas\n // - draw as usual\n // - remove the backdrop alpha:\n // alphaNew = 1 - (1 - alpha)/(1 - alphaBackdrop) with 'alpha' the alpha\n // value of your transparency group and 'alphaBackdrop' the alpha of the\n // backdrop\n // - remove background color:\n // colorNew = color - alphaNew *colorBackdrop /(1 - alphaNew)\n if (!group.isolated) {\n info(\"TODO: Support non-isolated groups.\");\n }\n\n // TODO knockout - supposedly possible with the clever use of compositing\n // modes.\n if (group.knockout) {\n warn(\"Knockout groups not supported.\");\n }\n\n const currentTransform = currentCtx.mozCurrentTransform;\n if (group.matrix) {\n currentCtx.transform.apply(currentCtx, group.matrix);\n }\n if (!group.bbox) {\n throw new Error(\"Bounding box is required.\");\n }\n\n // Based on the current transform figure out how big the bounding box\n // will actually be.\n let bounds = Util.getAxialAlignedBoundingBox(\n group.bbox,\n currentCtx.mozCurrentTransform\n );\n // Clip the bounding box to the current canvas.\n const canvasBounds = [\n 0,\n 0,\n currentCtx.canvas.width,\n currentCtx.canvas.height,\n ];\n bounds = Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];\n // Use ceil in case we're between sizes so we don't create canvas that is\n // too small and make the canvas at least 1x1 pixels.\n const offsetX = Math.floor(bounds[0]);\n const offsetY = Math.floor(bounds[1]);\n let drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);\n let drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);\n let scaleX = 1,\n scaleY = 1;\n if (drawnWidth > MAX_GROUP_SIZE) {\n scaleX = drawnWidth / MAX_GROUP_SIZE;\n drawnWidth = MAX_GROUP_SIZE;\n }\n if (drawnHeight > MAX_GROUP_SIZE) {\n scaleY = drawnHeight / MAX_GROUP_SIZE;\n drawnHeight = MAX_GROUP_SIZE;\n }\n\n let cacheId = \"groupAt\" + this.groupLevel;\n if (group.smask) {\n // Using two cache entries is case if masks are used one after another.\n cacheId += \"_smask_\" + (this.smaskCounter++ % 2);\n }\n const scratchCanvas = this.cachedCanvases.getCanvas(\n cacheId,\n drawnWidth,\n drawnHeight,\n true\n );\n const groupCtx = scratchCanvas.context;\n\n // Since we created a new canvas that is just the size of the bounding box\n // we have to translate the group ctx.\n groupCtx.scale(1 / scaleX, 1 / scaleY);\n groupCtx.translate(-offsetX, -offsetY);\n groupCtx.transform.apply(groupCtx, currentTransform);\n\n if (group.smask) {\n // Saving state and cached mask to be used in setGState.\n this.smaskStack.push({\n canvas: scratchCanvas.canvas,\n context: groupCtx,\n offsetX,\n offsetY,\n scaleX,\n scaleY,\n subtype: group.smask.subtype,\n backdrop: group.smask.backdrop,\n transferMap: group.smask.transferMap || null,\n startTransformInverse: null, // used during suspend operation\n });\n } else {\n // Setup the current ctx so when the group is popped we draw it at the\n // right location.\n currentCtx.setTransform(1, 0, 0, 1, 0, 0);\n currentCtx.translate(offsetX, offsetY);\n currentCtx.scale(scaleX, scaleY);\n }\n // The transparency group inherits all off the current graphics state\n // except the blend mode, soft mask, and alpha constants.\n copyCtxState(currentCtx, groupCtx);\n this.ctx = groupCtx;\n this.setGState([\n [\"BM\", \"source-over\"],\n [\"ca\", 1],\n [\"CA\", 1],\n ]);\n this.groupStack.push(currentCtx);\n this.groupLevel++;\n\n // Resetting mask state, masks will be applied on restore of the group.\n this.current.activeSMask = null;\n }\n\n endGroup(group) {\n if (!this.contentVisible) {\n return;\n }\n this.groupLevel--;\n const groupCtx = this.ctx;\n this.ctx = this.groupStack.pop();\n // Turn off image smoothing to avoid sub pixel interpolation which can\n // look kind of blurry for some pdfs.\n if (this.ctx.imageSmoothingEnabled !== undefined) {\n this.ctx.imageSmoothingEnabled = false;\n } else {\n this.ctx.mozImageSmoothingEnabled = false;\n }\n if (group.smask) {\n this.tempSMask = this.smaskStack.pop();\n } else {\n this.ctx.drawImage(groupCtx.canvas, 0, 0);\n }\n this.restore();\n }\n\n beginAnnotations() {\n this.save();\n if (this.baseTransform) {\n this.ctx.setTransform.apply(this.ctx, this.baseTransform);\n }\n }\n\n endAnnotations() {\n this.restore();\n }\n\n beginAnnotation(rect, transform, matrix) {\n this.save();\n resetCtxToDefault(this.ctx);\n this.current = new CanvasExtraState();\n\n if (Array.isArray(rect) && rect.length === 4) {\n const width = rect[2] - rect[0];\n const height = rect[3] - rect[1];\n this.ctx.rect(rect[0], rect[1], width, height);\n this.clip();\n this.endPath();\n }\n\n this.transform.apply(this, transform);\n this.transform.apply(this, matrix);\n }\n\n endAnnotation() {\n this.restore();\n }\n\n paintImageMaskXObject(img) {\n if (!this.contentVisible) {\n return;\n }\n const ctx = this.ctx;\n const width = img.width,\n height = img.height;\n const fillColor = this.current.fillColor;\n const isPatternFill = this.current.patternFill;\n\n const glyph = this.processingType3;\n\n if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) {\n if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) {\n glyph.compiled = compileType3Glyph({ data: img.data, width, height });\n } else {\n glyph.compiled = null;\n }\n }\n\n if (glyph?.compiled) {\n glyph.compiled(ctx);\n return;\n }\n\n const maskCanvas = this.cachedCanvases.getCanvas(\n \"maskCanvas\",\n width,\n height\n );\n const maskCtx = maskCanvas.context;\n maskCtx.save();\n\n putBinaryImageMask(maskCtx, img);\n\n maskCtx.globalCompositeOperation = \"source-in\";\n\n maskCtx.fillStyle = isPatternFill\n ? fillColor.getPattern(maskCtx, this)\n : fillColor;\n maskCtx.fillRect(0, 0, width, height);\n\n maskCtx.restore();\n\n this.paintInlineImageXObject(maskCanvas.canvas);\n }\n\n paintImageMaskXObjectRepeat(\n imgData,\n scaleX,\n skewX = 0,\n skewY = 0,\n scaleY,\n positions\n ) {\n if (!this.contentVisible) {\n return;\n }\n const width = imgData.width;\n const height = imgData.height;\n const fillColor = this.current.fillColor;\n const isPatternFill = this.current.patternFill;\n\n const maskCanvas = this.cachedCanvases.getCanvas(\n \"maskCanvas\",\n width,\n height\n );\n const maskCtx = maskCanvas.context;\n maskCtx.save();\n\n putBinaryImageMask(maskCtx, imgData);\n\n maskCtx.globalCompositeOperation = \"source-in\";\n\n maskCtx.fillStyle = isPatternFill\n ? fillColor.getPattern(maskCtx, this)\n : fillColor;\n maskCtx.fillRect(0, 0, width, height);\n\n maskCtx.restore();\n\n const ctx = this.ctx;\n for (let i = 0, ii = positions.length; i < ii; i += 2) {\n ctx.save();\n ctx.transform(\n scaleX,\n skewX,\n skewY,\n scaleY,\n positions[i],\n positions[i + 1]\n );\n ctx.scale(1, -1);\n ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);\n ctx.restore();\n }\n }\n\n paintImageMaskXObjectGroup(images) {\n if (!this.contentVisible) {\n return;\n }\n const ctx = this.ctx;\n\n const fillColor = this.current.fillColor;\n const isPatternFill = this.current.patternFill;\n for (let i = 0, ii = images.length; i < ii; i++) {\n const image = images[i];\n const width = image.width,\n height = image.height;\n\n const maskCanvas = this.cachedCanvases.getCanvas(\n \"maskCanvas\",\n width,\n height\n );\n const maskCtx = maskCanvas.context;\n maskCtx.save();\n\n putBinaryImageMask(maskCtx, image);\n\n maskCtx.globalCompositeOperation = \"source-in\";\n\n maskCtx.fillStyle = isPatternFill\n ? fillColor.getPattern(maskCtx, this)\n : fillColor;\n maskCtx.fillRect(0, 0, width, height);\n\n maskCtx.restore();\n\n ctx.save();\n ctx.transform.apply(ctx, image.transform);\n ctx.scale(1, -1);\n ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);\n ctx.restore();\n }\n }\n\n paintImageXObject(objId) {\n if (!this.contentVisible) {\n return;\n }\n const imgData = objId.startsWith(\"g_\")\n ? this.commonObjs.get(objId)\n : this.objs.get(objId);\n if (!imgData) {\n warn(\"Dependent image isn't ready yet\");\n return;\n }\n\n this.paintInlineImageXObject(imgData);\n }\n\n paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {\n if (!this.contentVisible) {\n return;\n }\n const imgData = objId.startsWith(\"g_\")\n ? this.commonObjs.get(objId)\n : this.objs.get(objId);\n if (!imgData) {\n warn(\"Dependent image isn't ready yet\");\n return;\n }\n\n const width = imgData.width;\n const height = imgData.height;\n const map = [];\n for (let i = 0, ii = positions.length; i < ii; i += 2) {\n map.push({\n transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],\n x: 0,\n y: 0,\n w: width,\n h: height,\n });\n }\n this.paintInlineImageXObjectGroup(imgData, map);\n }\n\n paintInlineImageXObject(imgData) {\n if (!this.contentVisible) {\n return;\n }\n const width = imgData.width;\n const height = imgData.height;\n const ctx = this.ctx;\n\n this.save();\n // scale the image to the unit square\n ctx.scale(1 / width, -1 / height);\n\n const currentTransform = ctx.mozCurrentTransformInverse;\n let widthScale = Math.max(\n Math.hypot(currentTransform[0], currentTransform[1]),\n 1\n );\n let heightScale = Math.max(\n Math.hypot(currentTransform[2], currentTransform[3]),\n 1\n );\n\n let imgToPaint, tmpCanvas, tmpCtx;\n // typeof check is needed due to node.js support, see issue #8489\n if (\n (typeof HTMLElement === \"function\" && imgData instanceof HTMLElement) ||\n !imgData.data\n ) {\n imgToPaint = imgData;\n } else {\n tmpCanvas = this.cachedCanvases.getCanvas(\"inlineImage\", width, height);\n tmpCtx = tmpCanvas.context;\n putBinaryImageData(tmpCtx, imgData, this.current.transferMaps);\n imgToPaint = tmpCanvas.canvas;\n }\n\n let paintWidth = width,\n paintHeight = height;\n let tmpCanvasId = \"prescale1\";\n // Vertical or horizontal scaling shall not be more than 2 to not lose the\n // pixels during drawImage operation, painting on the temporary canvas(es)\n // that are twice smaller in size.\n while (\n (widthScale > 2 && paintWidth > 1) ||\n (heightScale > 2 && paintHeight > 1)\n ) {\n let newWidth = paintWidth,\n newHeight = paintHeight;\n if (widthScale > 2 && paintWidth > 1) {\n newWidth = Math.ceil(paintWidth / 2);\n widthScale /= paintWidth / newWidth;\n }\n if (heightScale > 2 && paintHeight > 1) {\n newHeight = Math.ceil(paintHeight / 2);\n heightScale /= paintHeight / newHeight;\n }\n tmpCanvas = this.cachedCanvases.getCanvas(\n tmpCanvasId,\n newWidth,\n newHeight\n );\n tmpCtx = tmpCanvas.context;\n tmpCtx.clearRect(0, 0, newWidth, newHeight);\n tmpCtx.drawImage(\n imgToPaint,\n 0,\n 0,\n paintWidth,\n paintHeight,\n 0,\n 0,\n newWidth,\n newHeight\n );\n imgToPaint = tmpCanvas.canvas;\n paintWidth = newWidth;\n paintHeight = newHeight;\n tmpCanvasId = tmpCanvasId === \"prescale1\" ? \"prescale2\" : \"prescale1\";\n }\n ctx.drawImage(\n imgToPaint,\n 0,\n 0,\n paintWidth,\n paintHeight,\n 0,\n -height,\n width,\n height\n );\n\n if (this.imageLayer) {\n const position = this.getCanvasPosition(0, -height);\n this.imageLayer.appendImage({\n imgData,\n left: position[0],\n top: position[1],\n width: width / currentTransform[0],\n height: height / currentTransform[3],\n });\n }\n this.restore();\n }\n\n paintInlineImageXObjectGroup(imgData, map) {\n if (!this.contentVisible) {\n return;\n }\n const ctx = this.ctx;\n const w = imgData.width;\n const h = imgData.height;\n\n const tmpCanvas = this.cachedCanvases.getCanvas(\"inlineImage\", w, h);\n const tmpCtx = tmpCanvas.context;\n putBinaryImageData(tmpCtx, imgData, this.current.transferMaps);\n\n for (let i = 0, ii = map.length; i < ii; i++) {\n const entry = map[i];\n ctx.save();\n ctx.transform.apply(ctx, entry.transform);\n ctx.scale(1, -1);\n ctx.drawImage(\n tmpCanvas.canvas,\n entry.x,\n entry.y,\n entry.w,\n entry.h,\n 0,\n -1,\n 1,\n 1\n );\n if (this.imageLayer) {\n const position = this.getCanvasPosition(entry.x, entry.y);\n this.imageLayer.appendImage({\n imgData,\n left: position[0],\n top: position[1],\n width: w,\n height: h,\n });\n }\n ctx.restore();\n }\n }\n\n paintSolidColorImageMask() {\n if (!this.contentVisible) {\n return;\n }\n this.ctx.fillRect(0, 0, 1, 1);\n }\n\n // Marked content\n\n markPoint(tag) {\n // TODO Marked content.\n }\n\n markPointProps(tag, properties) {\n // TODO Marked content.\n }\n\n beginMarkedContent(tag) {\n this.markedContentStack.push({\n visible: true,\n });\n }\n\n beginMarkedContentProps(tag, properties) {\n if (tag === \"OC\") {\n this.markedContentStack.push({\n visible: this.optionalContentConfig.isVisible(properties),\n });\n } else {\n this.markedContentStack.push({\n visible: true,\n });\n }\n this.contentVisible = this.isContentVisible();\n }\n\n endMarkedContent() {\n this.markedContentStack.pop();\n this.contentVisible = this.isContentVisible();\n }\n\n // Compatibility\n\n beginCompat() {\n // TODO ignore undefined operators (should we do that anyway?)\n }\n\n endCompat() {\n // TODO stop ignoring undefined operators\n }\n\n // Helper functions\n\n consumePath() {\n const ctx = this.ctx;\n if (this.pendingClip) {\n if (this.pendingClip === EO_CLIP) {\n ctx.clip(\"evenodd\");\n } else {\n ctx.clip();\n }\n this.pendingClip = null;\n }\n ctx.beginPath();\n }\n\n getSinglePixelWidth() {\n if (this._cachedGetSinglePixelWidth === null) {\n // If transform is [a b] then a pixel (square) is transformed\n // [c d]\n // into a parallelogram: its area is the abs value of the determinant.\n // This parallelogram has 2 heights:\n // - Area / |col_1|;\n // - Area / |col_2|.\n // so in order to get a height of at least 1, pixel height\n // must be computed as followed:\n // h = max(sqrt(a² + c²) / |det(M)|, sqrt(b² + d²) / |det(M)|).\n // This is equivalent to:\n // h = max(|line_1_inv(M)|, |line_2_inv(M)|)\n const m = this.ctx.mozCurrentTransform;\n\n const absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);\n const sqNorm1 = m[0] ** 2 + m[2] ** 2;\n const sqNorm2 = m[1] ** 2 + m[3] ** 2;\n const pixelHeight = Math.sqrt(Math.max(sqNorm1, sqNorm2)) / absDet;\n if (\n sqNorm1 !== sqNorm2 &&\n this._combinedScaleFactor * pixelHeight > 1\n ) {\n // The parallelogram isn't a square and at least one height\n // is lower than 1 so the resulting line width must be 1\n // but it cannot be achieved with one scale: when scaling a pixel\n // we'll get a rectangle (see issue #12295).\n // For example with matrix [0.001 0, 0, 100], a pixel is transformed\n // in a rectangle 0.001x100. If we just scale by 1000 (to have a 1)\n // then we'll get a rectangle 1x1e5 which is wrong.\n // In this case, we must reset the transform, set linewidth to 1\n // and then stroke.\n this._cachedGetSinglePixelWidth = -(\n this._combinedScaleFactor * pixelHeight\n );\n } else if (absDet > Number.EPSILON) {\n this._cachedGetSinglePixelWidth = pixelHeight;\n } else {\n // Matrix is non-invertible.\n this._cachedGetSinglePixelWidth = 1;\n }\n }\n\n return this._cachedGetSinglePixelWidth;\n }\n\n getCanvasPosition(x, y) {\n const transform = this.ctx.mozCurrentTransform;\n return [\n transform[0] * x + transform[2] * y + transform[4],\n transform[1] * x + transform[3] * y + transform[5],\n ];\n }\n\n isContentVisible() {\n for (let i = this.markedContentStack.length - 1; i >= 0; i--) {\n if (!this.markedContentStack[i].visible) {\n return false;\n }\n }\n return true;\n }\n }\n\n for (const op in OPS) {\n CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op];\n }\n\n return CanvasGraphics;\n})();\n\nexport { CanvasGraphics };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n FormatError,\n info,\n shadow,\n unreachable,\n Util,\n} from \"../shared/util.js\";\n\nlet svgElement;\n\n// TODO: remove this when Firefox ESR supports DOMMatrix.\nfunction createMatrix(matrix) {\n if (typeof DOMMatrix !== \"undefined\") {\n return new DOMMatrix(matrix);\n }\n if (!svgElement) {\n svgElement = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n }\n return svgElement.createSVGMatrix(matrix);\n}\n\nfunction applyBoundingBox(ctx, bbox) {\n if (!bbox || typeof Path2D === \"undefined\") {\n return;\n }\n const width = bbox[2] - bbox[0];\n const height = bbox[3] - bbox[1];\n const region = new Path2D();\n region.rect(bbox[0], bbox[1], width, height);\n ctx.clip(region);\n}\n\nclass BaseShadingPattern {\n constructor() {\n if (this.constructor === BaseShadingPattern) {\n unreachable(\"Cannot initialize BaseShadingPattern.\");\n }\n }\n\n getPattern() {\n unreachable(\"Abstract method `getPattern` called.\");\n }\n}\n\nclass RadialAxialShadingPattern extends BaseShadingPattern {\n constructor(IR) {\n super();\n this._type = IR[1];\n this._bbox = IR[2];\n this._colorStops = IR[3];\n this._p0 = IR[4];\n this._p1 = IR[5];\n this._r0 = IR[6];\n this._r1 = IR[7];\n this._matrix = IR[8];\n }\n\n getPattern(ctx, owner, shadingFill) {\n const tmpCanvas = owner.cachedCanvases.getCanvas(\n \"pattern\",\n ctx.canvas.width,\n ctx.canvas.height,\n true\n );\n\n const tmpCtx = tmpCanvas.context;\n tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);\n tmpCtx.beginPath();\n tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);\n\n if (!shadingFill) {\n tmpCtx.setTransform.apply(tmpCtx, owner.baseTransform);\n if (this._matrix) {\n tmpCtx.transform.apply(tmpCtx, this._matrix);\n }\n } else {\n tmpCtx.setTransform.apply(tmpCtx, ctx.mozCurrentTransform);\n }\n applyBoundingBox(tmpCtx, this._bbox);\n\n let grad;\n if (this._type === \"axial\") {\n grad = tmpCtx.createLinearGradient(\n this._p0[0],\n this._p0[1],\n this._p1[0],\n this._p1[1]\n );\n } else if (this._type === \"radial\") {\n grad = tmpCtx.createRadialGradient(\n this._p0[0],\n this._p0[1],\n this._r0,\n this._p1[0],\n this._p1[1],\n this._r1\n );\n }\n\n for (const colorStop of this._colorStops) {\n grad.addColorStop(colorStop[0], colorStop[1]);\n }\n tmpCtx.fillStyle = grad;\n tmpCtx.fill();\n\n const pattern = ctx.createPattern(tmpCanvas.canvas, \"repeat\");\n pattern.setTransform(createMatrix(ctx.mozCurrentTransformInverse));\n return pattern;\n }\n}\n\nfunction drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {\n // Very basic Gouraud-shaded triangle rasterization algorithm.\n const coords = context.coords,\n colors = context.colors;\n const bytes = data.data,\n rowSize = data.width * 4;\n let tmp;\n if (coords[p1 + 1] > coords[p2 + 1]) {\n tmp = p1;\n p1 = p2;\n p2 = tmp;\n tmp = c1;\n c1 = c2;\n c2 = tmp;\n }\n if (coords[p2 + 1] > coords[p3 + 1]) {\n tmp = p2;\n p2 = p3;\n p3 = tmp;\n tmp = c2;\n c2 = c3;\n c3 = tmp;\n }\n if (coords[p1 + 1] > coords[p2 + 1]) {\n tmp = p1;\n p1 = p2;\n p2 = tmp;\n tmp = c1;\n c1 = c2;\n c2 = tmp;\n }\n const x1 = (coords[p1] + context.offsetX) * context.scaleX;\n const y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;\n const x2 = (coords[p2] + context.offsetX) * context.scaleX;\n const y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;\n const x3 = (coords[p3] + context.offsetX) * context.scaleX;\n const y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;\n if (y1 >= y3) {\n return;\n }\n const c1r = colors[c1],\n c1g = colors[c1 + 1],\n c1b = colors[c1 + 2];\n const c2r = colors[c2],\n c2g = colors[c2 + 1],\n c2b = colors[c2 + 2];\n const c3r = colors[c3],\n c3g = colors[c3 + 1],\n c3b = colors[c3 + 2];\n\n const minY = Math.round(y1),\n maxY = Math.round(y3);\n let xa, car, cag, cab;\n let xb, cbr, cbg, cbb;\n for (let y = minY; y <= maxY; y++) {\n if (y < y2) {\n let k;\n if (y < y1) {\n k = 0;\n } else if (y1 === y2) {\n k = 1;\n } else {\n k = (y1 - y) / (y1 - y2);\n }\n xa = x1 - (x1 - x2) * k;\n car = c1r - (c1r - c2r) * k;\n cag = c1g - (c1g - c2g) * k;\n cab = c1b - (c1b - c2b) * k;\n } else {\n let k;\n if (y > y3) {\n k = 1;\n } else if (y2 === y3) {\n k = 0;\n } else {\n k = (y2 - y) / (y2 - y3);\n }\n xa = x2 - (x2 - x3) * k;\n car = c2r - (c2r - c3r) * k;\n cag = c2g - (c2g - c3g) * k;\n cab = c2b - (c2b - c3b) * k;\n }\n\n let k;\n if (y < y1) {\n k = 0;\n } else if (y > y3) {\n k = 1;\n } else {\n k = (y1 - y) / (y1 - y3);\n }\n xb = x1 - (x1 - x3) * k;\n cbr = c1r - (c1r - c3r) * k;\n cbg = c1g - (c1g - c3g) * k;\n cbb = c1b - (c1b - c3b) * k;\n const x1_ = Math.round(Math.min(xa, xb));\n const x2_ = Math.round(Math.max(xa, xb));\n let j = rowSize * y + x1_ * 4;\n for (let x = x1_; x <= x2_; x++) {\n k = (xa - x) / (xa - xb);\n if (k < 0) {\n k = 0;\n } else if (k > 1) {\n k = 1;\n }\n bytes[j++] = (car - (car - cbr) * k) | 0;\n bytes[j++] = (cag - (cag - cbg) * k) | 0;\n bytes[j++] = (cab - (cab - cbb) * k) | 0;\n bytes[j++] = 255;\n }\n }\n}\n\nfunction drawFigure(data, figure, context) {\n const ps = figure.coords;\n const cs = figure.colors;\n let i, ii;\n switch (figure.type) {\n case \"lattice\":\n const verticesPerRow = figure.verticesPerRow;\n const rows = Math.floor(ps.length / verticesPerRow) - 1;\n const cols = verticesPerRow - 1;\n for (i = 0; i < rows; i++) {\n let q = i * verticesPerRow;\n for (let j = 0; j < cols; j++, q++) {\n drawTriangle(\n data,\n context,\n ps[q],\n ps[q + 1],\n ps[q + verticesPerRow],\n cs[q],\n cs[q + 1],\n cs[q + verticesPerRow]\n );\n drawTriangle(\n data,\n context,\n ps[q + verticesPerRow + 1],\n ps[q + 1],\n ps[q + verticesPerRow],\n cs[q + verticesPerRow + 1],\n cs[q + 1],\n cs[q + verticesPerRow]\n );\n }\n }\n break;\n case \"triangles\":\n for (i = 0, ii = ps.length; i < ii; i += 3) {\n drawTriangle(\n data,\n context,\n ps[i],\n ps[i + 1],\n ps[i + 2],\n cs[i],\n cs[i + 1],\n cs[i + 2]\n );\n }\n break;\n default:\n throw new Error(\"illegal figure\");\n }\n}\n\nclass MeshShadingPattern extends BaseShadingPattern {\n constructor(IR) {\n super();\n this._coords = IR[2];\n this._colors = IR[3];\n this._figures = IR[4];\n this._bounds = IR[5];\n this._matrix = IR[6];\n this._bbox = IR[7];\n this._background = IR[8];\n }\n\n _createMeshCanvas(combinedScale, backgroundColor, cachedCanvases) {\n // we will increase scale on some weird factor to let antialiasing take\n // care of \"rough\" edges\n const EXPECTED_SCALE = 1.1;\n // MAX_PATTERN_SIZE is used to avoid OOM situation.\n const MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough\n // We need to keep transparent border around our pattern for fill():\n // createPattern with 'no-repeat' will bleed edges across entire area.\n const BORDER_SIZE = 2;\n\n const offsetX = Math.floor(this._bounds[0]);\n const offsetY = Math.floor(this._bounds[1]);\n const boundsWidth = Math.ceil(this._bounds[2]) - offsetX;\n const boundsHeight = Math.ceil(this._bounds[3]) - offsetY;\n\n const width = Math.min(\n Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)),\n MAX_PATTERN_SIZE\n );\n const height = Math.min(\n Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)),\n MAX_PATTERN_SIZE\n );\n const scaleX = boundsWidth / width;\n const scaleY = boundsHeight / height;\n\n const context = {\n coords: this._coords,\n colors: this._colors,\n offsetX: -offsetX,\n offsetY: -offsetY,\n scaleX: 1 / scaleX,\n scaleY: 1 / scaleY,\n };\n\n const paddedWidth = width + BORDER_SIZE * 2;\n const paddedHeight = height + BORDER_SIZE * 2;\n\n const tmpCanvas = cachedCanvases.getCanvas(\n \"mesh\",\n paddedWidth,\n paddedHeight,\n false\n );\n const tmpCtx = tmpCanvas.context;\n\n const data = tmpCtx.createImageData(width, height);\n if (backgroundColor) {\n const bytes = data.data;\n for (let i = 0, ii = bytes.length; i < ii; i += 4) {\n bytes[i] = backgroundColor[0];\n bytes[i + 1] = backgroundColor[1];\n bytes[i + 2] = backgroundColor[2];\n bytes[i + 3] = 255;\n }\n }\n for (const figure of this._figures) {\n drawFigure(data, figure, context);\n }\n tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);\n const canvas = tmpCanvas.canvas;\n\n return {\n canvas,\n offsetX: offsetX - BORDER_SIZE * scaleX,\n offsetY: offsetY - BORDER_SIZE * scaleY,\n scaleX,\n scaleY,\n };\n }\n\n getPattern(ctx, owner, shadingFill) {\n applyBoundingBox(ctx, this._bbox);\n let scale;\n if (shadingFill) {\n scale = Util.singularValueDecompose2dScale(ctx.mozCurrentTransform);\n } else {\n // Obtain scale from matrix and current transformation matrix.\n scale = Util.singularValueDecompose2dScale(owner.baseTransform);\n if (this._matrix) {\n const matrixScale = Util.singularValueDecompose2dScale(this._matrix);\n scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]];\n }\n }\n\n // Rasterizing on the main thread since sending/queue large canvases\n // might cause OOM.\n const temporaryPatternCanvas = this._createMeshCanvas(\n scale,\n shadingFill ? null : this._background,\n owner.cachedCanvases\n );\n\n if (!shadingFill) {\n ctx.setTransform.apply(ctx, owner.baseTransform);\n if (this._matrix) {\n ctx.transform.apply(ctx, this._matrix);\n }\n }\n\n ctx.translate(\n temporaryPatternCanvas.offsetX,\n temporaryPatternCanvas.offsetY\n );\n ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);\n\n return ctx.createPattern(temporaryPatternCanvas.canvas, \"no-repeat\");\n }\n}\n\nclass DummyShadingPattern extends BaseShadingPattern {\n getPattern() {\n return \"hotpink\";\n }\n}\n\nfunction getShadingPattern(IR) {\n switch (IR[0]) {\n case \"RadialAxial\":\n return new RadialAxialShadingPattern(IR);\n case \"Mesh\":\n return new MeshShadingPattern(IR);\n case \"Dummy\":\n return new DummyShadingPattern();\n }\n throw new Error(`Unknown IR type: ${IR[0]}`);\n}\n\nconst PaintType = {\n COLORED: 1,\n UNCOLORED: 2,\n};\n\nclass TilingPattern {\n // 10in @ 300dpi shall be enough.\n static get MAX_PATTERN_SIZE() {\n return shadow(this, \"MAX_PATTERN_SIZE\", 3000);\n }\n\n constructor(IR, color, ctx, canvasGraphicsFactory, baseTransform) {\n this.operatorList = IR[2];\n this.matrix = IR[3] || [1, 0, 0, 1, 0, 0];\n this.bbox = IR[4];\n this.xstep = IR[5];\n this.ystep = IR[6];\n this.paintType = IR[7];\n this.tilingType = IR[8];\n this.color = color;\n this.ctx = ctx;\n this.canvasGraphicsFactory = canvasGraphicsFactory;\n this.baseTransform = baseTransform;\n }\n\n createPatternCanvas(owner) {\n const operatorList = this.operatorList;\n const bbox = this.bbox;\n const xstep = this.xstep;\n const ystep = this.ystep;\n const paintType = this.paintType;\n const tilingType = this.tilingType;\n const color = this.color;\n const canvasGraphicsFactory = this.canvasGraphicsFactory;\n\n info(\"TilingType: \" + tilingType);\n\n // A tiling pattern as defined by PDF spec 8.7.2 is a cell whose size is\n // described by bbox, and may repeat regularly by shifting the cell by\n // xstep and ystep.\n // Because the HTML5 canvas API does not support pattern repetition with\n // gaps in between, we use the xstep/ystep instead of the bbox's size.\n //\n // This has the following consequences (similarly for ystep):\n //\n // - If xstep is the same as bbox, then there is no observable difference.\n //\n // - If xstep is larger than bbox, then the pattern canvas is partially\n // empty: the area bounded by bbox is painted, the outside area is void.\n //\n // - If xstep is smaller than bbox, then the pixels between xstep and the\n // bbox boundary will be missing. This is INCORRECT behavior.\n // \"Figures on adjacent tiles should not overlap\" (PDF spec 8.7.3.1),\n // but overlapping cells without common pixels are still valid.\n // TODO: Fix the implementation, to allow this scenario to be painted\n // correctly.\n\n const x0 = bbox[0],\n y0 = bbox[1],\n x1 = bbox[2],\n y1 = bbox[3];\n\n // Obtain scale from matrix and current transformation matrix.\n const matrixScale = Util.singularValueDecompose2dScale(this.matrix);\n const curMatrixScale = Util.singularValueDecompose2dScale(\n this.baseTransform\n );\n const combinedScale = [\n matrixScale[0] * curMatrixScale[0],\n matrixScale[1] * curMatrixScale[1],\n ];\n\n // Use width and height values that are as close as possible to the end\n // result when the pattern is used. Too low value makes the pattern look\n // blurry. Too large value makes it look too crispy.\n const dimx = this.getSizeAndScale(\n xstep,\n this.ctx.canvas.width,\n combinedScale[0]\n );\n const dimy = this.getSizeAndScale(\n ystep,\n this.ctx.canvas.height,\n combinedScale[1]\n );\n\n const tmpCanvas = owner.cachedCanvases.getCanvas(\n \"pattern\",\n dimx.size,\n dimy.size,\n true\n );\n const tmpCtx = tmpCanvas.context;\n const graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);\n graphics.groupLevel = owner.groupLevel;\n\n this.setFillAndStrokeStyleToContext(graphics, paintType, color);\n\n graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);\n\n this.clipBbox(graphics, bbox, x0, y0, x1, y1);\n\n graphics.baseTransform = graphics.ctx.mozCurrentTransform.slice();\n\n graphics.executeOperatorList(operatorList);\n\n graphics.endDrawing();\n\n return {\n canvas: tmpCanvas.canvas,\n scaleX: dimx.scale,\n scaleY: dimy.scale,\n };\n }\n\n getSizeAndScale(step, realOutputSize, scale) {\n // xstep / ystep may be negative -- normalize.\n step = Math.abs(step);\n // MAX_PATTERN_SIZE is used to avoid OOM situation.\n // Use the destination canvas's size if it is bigger than the hard-coded\n // limit of MAX_PATTERN_SIZE to avoid clipping patterns that cover the\n // whole canvas.\n const maxSize = Math.max(TilingPattern.MAX_PATTERN_SIZE, realOutputSize);\n let size = Math.ceil(step * scale);\n if (size >= maxSize) {\n size = maxSize;\n } else {\n scale = size / step;\n }\n return { scale, size };\n }\n\n clipBbox(graphics, bbox, x0, y0, x1, y1) {\n if (Array.isArray(bbox) && bbox.length === 4) {\n const bboxWidth = x1 - x0;\n const bboxHeight = y1 - y0;\n graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);\n graphics.clip();\n graphics.endPath();\n }\n }\n\n setFillAndStrokeStyleToContext(graphics, paintType, color) {\n const context = graphics.ctx,\n current = graphics.current;\n switch (paintType) {\n case PaintType.COLORED:\n const ctx = this.ctx;\n context.fillStyle = ctx.fillStyle;\n context.strokeStyle = ctx.strokeStyle;\n current.fillColor = ctx.fillStyle;\n current.strokeColor = ctx.strokeStyle;\n break;\n case PaintType.UNCOLORED:\n const cssColor = Util.makeHexColor(color[0], color[1], color[2]);\n context.fillStyle = cssColor;\n context.strokeStyle = cssColor;\n // Set color needed by image masks (fixes issues 3226 and 8741).\n current.fillColor = cssColor;\n current.strokeColor = cssColor;\n break;\n default:\n throw new FormatError(`Unsupported paint type: ${paintType}`);\n }\n }\n\n getPattern(ctx, owner, shadingFill) {\n ctx = this.ctx;\n // PDF spec 8.7.2 NOTE 1: pattern's matrix is relative to initial matrix.\n let matrix = ctx.mozCurrentTransformInverse;\n if (!shadingFill) {\n matrix = Util.transform(matrix, owner.baseTransform);\n if (this.matrix) {\n matrix = Util.transform(matrix, this.matrix);\n }\n }\n\n const temporaryPatternCanvas = this.createPatternCanvas(owner);\n\n let domMatrix = createMatrix(matrix);\n // Rescale and so that the ctx.createPattern call generates a pattern with\n // the desired size.\n domMatrix = domMatrix.scale(\n 1 / temporaryPatternCanvas.scaleX,\n 1 / temporaryPatternCanvas.scaleY\n );\n\n const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, \"repeat\");\n pattern.setTransform(domMatrix);\n\n return pattern;\n }\n}\n\nexport { getShadingPattern, TilingPattern };\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @typedef {Object} GlobalWorkerOptionsType\n * @property {Worker | null} workerPort - Defines global port for worker\n * process. Overrides the `workerSrc` option.\n * @property {string} workerSrc - A string containing the path and filename\n * of the worker file.\n *\n * NOTE: The `workerSrc` option should always be set, in order to prevent any\n * issues when using the PDF.js library.\n */\n\n/** @type {GlobalWorkerOptionsType} */\nconst GlobalWorkerOptions = Object.create(null);\n\nGlobalWorkerOptions.workerPort =\n GlobalWorkerOptions.workerPort === undefined\n ? null\n : GlobalWorkerOptions.workerPort;\n\nGlobalWorkerOptions.workerSrc =\n GlobalWorkerOptions.workerSrc === undefined\n ? \"\"\n : GlobalWorkerOptions.workerSrc;\n\nexport { GlobalWorkerOptions };\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AbortException,\n assert,\n createPromiseCapability,\n MissingPDFException,\n UnexpectedResponseException,\n UnknownErrorException,\n} from \"./util.js\";\n\nconst CallbackKind = {\n UNKNOWN: 0,\n DATA: 1,\n ERROR: 2,\n};\n\nconst StreamKind = {\n UNKNOWN: 0,\n CANCEL: 1,\n CANCEL_COMPLETE: 2,\n CLOSE: 3,\n ENQUEUE: 4,\n ERROR: 5,\n PULL: 6,\n PULL_COMPLETE: 7,\n START_COMPLETE: 8,\n};\n\nfunction wrapReason(reason) {\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || TESTING\")\n ) {\n assert(\n reason instanceof Error ||\n (typeof reason === \"object\" && reason !== null),\n 'wrapReason: Expected \"reason\" to be a (possibly cloned) Error.'\n );\n } else {\n if (typeof reason !== \"object\" || reason === null) {\n return reason;\n }\n }\n switch (reason.name) {\n case \"AbortException\":\n return new AbortException(reason.message);\n case \"MissingPDFException\":\n return new MissingPDFException(reason.message);\n case \"UnexpectedResponseException\":\n return new UnexpectedResponseException(reason.message, reason.status);\n case \"UnknownErrorException\":\n return new UnknownErrorException(reason.message, reason.details);\n default:\n return new UnknownErrorException(reason.message, reason.toString());\n }\n}\n\nclass MessageHandler {\n constructor(sourceName, targetName, comObj) {\n this.sourceName = sourceName;\n this.targetName = targetName;\n this.comObj = comObj;\n this.callbackId = 1;\n this.streamId = 1;\n this.postMessageTransfers = true;\n this.streamSinks = Object.create(null);\n this.streamControllers = Object.create(null);\n this.callbackCapabilities = Object.create(null);\n this.actionHandler = Object.create(null);\n\n this._onComObjOnMessage = event => {\n const data = event.data;\n if (data.targetName !== this.sourceName) {\n return;\n }\n if (data.stream) {\n this._processStreamMessage(data);\n return;\n }\n if (data.callback) {\n const callbackId = data.callbackId;\n const capability = this.callbackCapabilities[callbackId];\n if (!capability) {\n throw new Error(`Cannot resolve callback ${callbackId}`);\n }\n delete this.callbackCapabilities[callbackId];\n\n if (data.callback === CallbackKind.DATA) {\n capability.resolve(data.data);\n } else if (data.callback === CallbackKind.ERROR) {\n capability.reject(wrapReason(data.reason));\n } else {\n throw new Error(\"Unexpected callback case\");\n }\n return;\n }\n const action = this.actionHandler[data.action];\n if (!action) {\n throw new Error(`Unknown action from worker: ${data.action}`);\n }\n if (data.callbackId) {\n const cbSourceName = this.sourceName;\n const cbTargetName = data.sourceName;\n new Promise(function (resolve) {\n resolve(action(data.data));\n }).then(\n function (result) {\n comObj.postMessage({\n sourceName: cbSourceName,\n targetName: cbTargetName,\n callback: CallbackKind.DATA,\n callbackId: data.callbackId,\n data: result,\n });\n },\n function (reason) {\n comObj.postMessage({\n sourceName: cbSourceName,\n targetName: cbTargetName,\n callback: CallbackKind.ERROR,\n callbackId: data.callbackId,\n reason: wrapReason(reason),\n });\n }\n );\n return;\n }\n if (data.streamId) {\n this._createStreamSink(data);\n return;\n }\n action(data.data);\n };\n comObj.addEventListener(\"message\", this._onComObjOnMessage);\n }\n\n on(actionName, handler) {\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || TESTING\")\n ) {\n assert(\n typeof handler === \"function\",\n 'MessageHandler.on: Expected \"handler\" to be a function.'\n );\n }\n const ah = this.actionHandler;\n if (ah[actionName]) {\n throw new Error(`There is already an actionName called \"${actionName}\"`);\n }\n ah[actionName] = handler;\n }\n\n /**\n * Sends a message to the comObj to invoke the action with the supplied data.\n * @param {string} actionName - Action to call.\n * @param {JSON} data - JSON data to send.\n * @param {Array} [transfers] - List of transfers/ArrayBuffers.\n */\n send(actionName, data, transfers) {\n this._postMessage(\n {\n sourceName: this.sourceName,\n targetName: this.targetName,\n action: actionName,\n data,\n },\n transfers\n );\n }\n\n /**\n * Sends a message to the comObj to invoke the action with the supplied data.\n * Expects that the other side will callback with the response.\n * @param {string} actionName - Action to call.\n * @param {JSON} data - JSON data to send.\n * @param {Array} [transfers] - List of transfers/ArrayBuffers.\n * @returns {Promise} Promise to be resolved with response data.\n */\n sendWithPromise(actionName, data, transfers) {\n const callbackId = this.callbackId++;\n const capability = createPromiseCapability();\n this.callbackCapabilities[callbackId] = capability;\n try {\n this._postMessage(\n {\n sourceName: this.sourceName,\n targetName: this.targetName,\n action: actionName,\n callbackId,\n data,\n },\n transfers\n );\n } catch (ex) {\n capability.reject(ex);\n }\n return capability.promise;\n }\n\n /**\n * Sends a message to the comObj to invoke the action with the supplied data.\n * Expect that the other side will callback to signal 'start_complete'.\n * @param {string} actionName - Action to call.\n * @param {JSON} data - JSON data to send.\n * @param {Object} queueingStrategy - Strategy to signal backpressure based on\n * internal queue.\n * @param {Array} [transfers] - List of transfers/ArrayBuffers.\n * @returns {ReadableStream} ReadableStream to read data in chunks.\n */\n sendWithStream(actionName, data, queueingStrategy, transfers) {\n const streamId = this.streamId++;\n const sourceName = this.sourceName;\n const targetName = this.targetName;\n const comObj = this.comObj;\n\n return new ReadableStream(\n {\n start: controller => {\n const startCapability = createPromiseCapability();\n this.streamControllers[streamId] = {\n controller,\n startCall: startCapability,\n pullCall: null,\n cancelCall: null,\n isClosed: false,\n };\n this._postMessage(\n {\n sourceName,\n targetName,\n action: actionName,\n streamId,\n data,\n desiredSize: controller.desiredSize,\n },\n transfers\n );\n // Return Promise for Async process, to signal success/failure.\n return startCapability.promise;\n },\n\n pull: controller => {\n const pullCapability = createPromiseCapability();\n this.streamControllers[streamId].pullCall = pullCapability;\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.PULL,\n streamId,\n desiredSize: controller.desiredSize,\n });\n // Returning Promise will not call \"pull\"\n // again until current pull is resolved.\n return pullCapability.promise;\n },\n\n cancel: reason => {\n assert(reason instanceof Error, \"cancel must have a valid reason\");\n const cancelCapability = createPromiseCapability();\n this.streamControllers[streamId].cancelCall = cancelCapability;\n this.streamControllers[streamId].isClosed = true;\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.CANCEL,\n streamId,\n reason: wrapReason(reason),\n });\n // Return Promise to signal success or failure.\n return cancelCapability.promise;\n },\n },\n queueingStrategy\n );\n }\n\n /**\n * @private\n */\n _createStreamSink(data) {\n const self = this;\n const action = this.actionHandler[data.action];\n const streamId = data.streamId;\n const sourceName = this.sourceName;\n const targetName = data.sourceName;\n const comObj = this.comObj;\n\n const streamSink = {\n enqueue(chunk, size = 1, transfers) {\n if (this.isCancelled) {\n return;\n }\n const lastDesiredSize = this.desiredSize;\n this.desiredSize -= size;\n // Enqueue decreases the desiredSize property of sink,\n // so when it changes from positive to negative,\n // set ready as unresolved promise.\n if (lastDesiredSize > 0 && this.desiredSize <= 0) {\n this.sinkCapability = createPromiseCapability();\n this.ready = this.sinkCapability.promise;\n }\n self._postMessage(\n {\n sourceName,\n targetName,\n stream: StreamKind.ENQUEUE,\n streamId,\n chunk,\n },\n transfers\n );\n },\n\n close() {\n if (this.isCancelled) {\n return;\n }\n this.isCancelled = true;\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.CLOSE,\n streamId,\n });\n delete self.streamSinks[streamId];\n },\n\n error(reason) {\n assert(reason instanceof Error, \"error must have a valid reason\");\n if (this.isCancelled) {\n return;\n }\n this.isCancelled = true;\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.ERROR,\n streamId,\n reason: wrapReason(reason),\n });\n },\n\n sinkCapability: createPromiseCapability(),\n onPull: null,\n onCancel: null,\n isCancelled: false,\n desiredSize: data.desiredSize,\n ready: null,\n };\n\n streamSink.sinkCapability.resolve();\n streamSink.ready = streamSink.sinkCapability.promise;\n this.streamSinks[streamId] = streamSink;\n new Promise(function (resolve) {\n resolve(action(data.data, streamSink));\n }).then(\n function () {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.START_COMPLETE,\n streamId,\n success: true,\n });\n },\n function (reason) {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.START_COMPLETE,\n streamId,\n reason: wrapReason(reason),\n });\n }\n );\n }\n\n /**\n * @private\n */\n _processStreamMessage(data) {\n const streamId = data.streamId;\n const sourceName = this.sourceName;\n const targetName = data.sourceName;\n const comObj = this.comObj;\n\n switch (data.stream) {\n case StreamKind.START_COMPLETE:\n if (data.success) {\n this.streamControllers[streamId].startCall.resolve();\n } else {\n this.streamControllers[streamId].startCall.reject(\n wrapReason(data.reason)\n );\n }\n break;\n case StreamKind.PULL_COMPLETE:\n if (data.success) {\n this.streamControllers[streamId].pullCall.resolve();\n } else {\n this.streamControllers[streamId].pullCall.reject(\n wrapReason(data.reason)\n );\n }\n break;\n case StreamKind.PULL:\n // Ignore any pull after close is called.\n if (!this.streamSinks[streamId]) {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.PULL_COMPLETE,\n streamId,\n success: true,\n });\n break;\n }\n // Pull increases the desiredSize property of sink,\n // so when it changes from negative to positive,\n // set ready property as resolved promise.\n if (\n this.streamSinks[streamId].desiredSize <= 0 &&\n data.desiredSize > 0\n ) {\n this.streamSinks[streamId].sinkCapability.resolve();\n }\n // Reset desiredSize property of sink on every pull.\n this.streamSinks[streamId].desiredSize = data.desiredSize;\n const { onPull } = this.streamSinks[data.streamId];\n new Promise(function (resolve) {\n resolve(onPull && onPull());\n }).then(\n function () {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.PULL_COMPLETE,\n streamId,\n success: true,\n });\n },\n function (reason) {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.PULL_COMPLETE,\n streamId,\n reason: wrapReason(reason),\n });\n }\n );\n break;\n case StreamKind.ENQUEUE:\n assert(\n this.streamControllers[streamId],\n \"enqueue should have stream controller\"\n );\n if (this.streamControllers[streamId].isClosed) {\n break;\n }\n this.streamControllers[streamId].controller.enqueue(data.chunk);\n break;\n case StreamKind.CLOSE:\n assert(\n this.streamControllers[streamId],\n \"close should have stream controller\"\n );\n if (this.streamControllers[streamId].isClosed) {\n break;\n }\n this.streamControllers[streamId].isClosed = true;\n this.streamControllers[streamId].controller.close();\n this._deleteStreamController(streamId);\n break;\n case StreamKind.ERROR:\n assert(\n this.streamControllers[streamId],\n \"error should have stream controller\"\n );\n this.streamControllers[streamId].controller.error(\n wrapReason(data.reason)\n );\n this._deleteStreamController(streamId);\n break;\n case StreamKind.CANCEL_COMPLETE:\n if (data.success) {\n this.streamControllers[streamId].cancelCall.resolve();\n } else {\n this.streamControllers[streamId].cancelCall.reject(\n wrapReason(data.reason)\n );\n }\n this._deleteStreamController(streamId);\n break;\n case StreamKind.CANCEL:\n if (!this.streamSinks[streamId]) {\n break;\n }\n const { onCancel } = this.streamSinks[data.streamId];\n new Promise(function (resolve) {\n resolve(onCancel && onCancel(wrapReason(data.reason)));\n }).then(\n function () {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.CANCEL_COMPLETE,\n streamId,\n success: true,\n });\n },\n function (reason) {\n comObj.postMessage({\n sourceName,\n targetName,\n stream: StreamKind.CANCEL_COMPLETE,\n streamId,\n reason: wrapReason(reason),\n });\n }\n );\n this.streamSinks[streamId].sinkCapability.reject(\n wrapReason(data.reason)\n );\n this.streamSinks[streamId].isCancelled = true;\n delete this.streamSinks[streamId];\n break;\n default:\n throw new Error(\"Unexpected stream case\");\n }\n }\n\n /**\n * @private\n */\n async _deleteStreamController(streamId) {\n // Delete the `streamController` only when the start, pull, and cancel\n // capabilities have settled, to prevent `TypeError`s.\n await Promise.allSettled(\n [\n this.streamControllers[streamId].startCall,\n this.streamControllers[streamId].pullCall,\n this.streamControllers[streamId].cancelCall,\n ].map(function (capability) {\n return capability && capability.promise;\n })\n );\n delete this.streamControllers[streamId];\n }\n\n /**\n * Sends raw message to the comObj.\n * @param {Object} message - Raw message.\n * @param transfers List of transfers/ArrayBuffers, or undefined.\n * @private\n */\n _postMessage(message, transfers) {\n if (transfers && this.postMessageTransfers) {\n this.comObj.postMessage(message, transfers);\n } else {\n this.comObj.postMessage(message);\n }\n }\n\n destroy() {\n this.comObj.removeEventListener(\"message\", this._onComObjOnMessage);\n }\n}\n\nexport { MessageHandler };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { objectFromMap } from \"../shared/util.js\";\n\nclass Metadata {\n constructor({ parsedData, rawData }) {\n this._metadataMap = parsedData;\n this._data = rawData;\n }\n\n getRaw() {\n return this._data;\n }\n\n get(name) {\n return this._metadataMap.get(name) ?? null;\n }\n\n getAll() {\n return objectFromMap(this._metadataMap);\n }\n\n has(name) {\n return this._metadataMap.has(name);\n }\n}\n\nexport { Metadata };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { objectFromMap, warn } from \"../shared/util.js\";\n\nclass OptionalContentGroup {\n constructor(name, intent) {\n this.visible = true;\n this.name = name;\n this.intent = intent;\n }\n}\n\nclass OptionalContentConfig {\n constructor(data) {\n this.name = null;\n this.creator = null;\n this._order = null;\n this._groups = new Map();\n\n if (data === null) {\n return;\n }\n this.name = data.name;\n this.creator = data.creator;\n this._order = data.order;\n for (const group of data.groups) {\n this._groups.set(\n group.id,\n new OptionalContentGroup(group.name, group.intent)\n );\n }\n\n if (data.baseState === \"OFF\") {\n for (const group of this._groups) {\n group.visible = false;\n }\n }\n\n for (const on of data.on) {\n this._groups.get(on).visible = true;\n }\n\n for (const off of data.off) {\n this._groups.get(off).visible = false;\n }\n }\n\n _evaluateVisibilityExpression(array) {\n const length = array.length;\n if (length < 2) {\n return true;\n }\n const operator = array[0];\n for (let i = 1; i < length; i++) {\n const element = array[i];\n let state;\n if (Array.isArray(element)) {\n state = this._evaluateVisibilityExpression(element);\n } else if (this._groups.has(element)) {\n state = this._groups.get(element).visible;\n } else {\n warn(`Optional content group not found: ${element}`);\n return true;\n }\n switch (operator) {\n case \"And\":\n if (!state) {\n return false;\n }\n break;\n case \"Or\":\n if (state) {\n return true;\n }\n break;\n case \"Not\":\n return !state;\n default:\n return true;\n }\n }\n return operator === \"And\";\n }\n\n isVisible(group) {\n if (group.type === \"OCG\") {\n if (!this._groups.has(group.id)) {\n warn(`Optional content group not found: ${group.id}`);\n return true;\n }\n return this._groups.get(group.id).visible;\n } else if (group.type === \"OCMD\") {\n // Per the spec, the expression should be preferred if available.\n if (group.expression) {\n return this._evaluateVisibilityExpression(group.expression);\n }\n if (!group.policy || group.policy === \"AnyOn\") {\n // Default\n for (const id of group.ids) {\n if (!this._groups.has(id)) {\n warn(`Optional content group not found: ${id}`);\n return true;\n }\n if (this._groups.get(id).visible) {\n return true;\n }\n }\n return false;\n } else if (group.policy === \"AllOn\") {\n for (const id of group.ids) {\n if (!this._groups.has(id)) {\n warn(`Optional content group not found: ${id}`);\n return true;\n }\n if (!this._groups.get(id).visible) {\n return false;\n }\n }\n return true;\n } else if (group.policy === \"AnyOff\") {\n for (const id of group.ids) {\n if (!this._groups.has(id)) {\n warn(`Optional content group not found: ${id}`);\n return true;\n }\n if (!this._groups.get(id).visible) {\n return true;\n }\n }\n return false;\n } else if (group.policy === \"AllOff\") {\n for (const id of group.ids) {\n if (!this._groups.has(id)) {\n warn(`Optional content group not found: ${id}`);\n return true;\n }\n if (this._groups.get(id).visible) {\n return false;\n }\n }\n return true;\n }\n warn(`Unknown optional content policy ${group.policy}.`);\n return true;\n }\n warn(`Unknown group type ${group.type}.`);\n return true;\n }\n\n setVisibility(id, visible = true) {\n if (!this._groups.has(id)) {\n warn(`Optional content group not found: ${id}`);\n return;\n }\n this._groups.get(id).visible = !!visible;\n }\n\n getOrder() {\n if (!this._groups.size) {\n return null;\n }\n if (this._order) {\n return this._order.slice();\n }\n return Array.from(this._groups.keys());\n }\n\n getGroups() {\n return this._groups.size > 0 ? objectFromMap(this._groups) : null;\n }\n\n getGroup(id) {\n return this._groups.get(id) || null;\n }\n}\n\nexport { OptionalContentConfig };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { assert, createPromiseCapability } from \"../shared/util.js\";\nimport { isPdfFile } from \"./display_utils.js\";\n\n/** @implements {IPDFStream} */\nclass PDFDataTransportStream {\n constructor(params, pdfDataRangeTransport) {\n assert(\n pdfDataRangeTransport,\n 'PDFDataTransportStream - missing required \"pdfDataRangeTransport\" argument.'\n );\n\n this._queuedChunks = [];\n this._progressiveDone = params.progressiveDone || false;\n this._contentDispositionFilename =\n params.contentDispositionFilename || null;\n\n const initialData = params.initialData;\n if (initialData?.length > 0) {\n const buffer = new Uint8Array(initialData).buffer;\n this._queuedChunks.push(buffer);\n }\n\n this._pdfDataRangeTransport = pdfDataRangeTransport;\n this._isStreamingSupported = !params.disableStream;\n this._isRangeSupported = !params.disableRange;\n this._contentLength = params.length;\n\n this._fullRequestReader = null;\n this._rangeReaders = [];\n\n this._pdfDataRangeTransport.addRangeListener((begin, chunk) => {\n this._onReceiveData({ begin, chunk });\n });\n\n this._pdfDataRangeTransport.addProgressListener((loaded, total) => {\n this._onProgress({ loaded, total });\n });\n\n this._pdfDataRangeTransport.addProgressiveReadListener(chunk => {\n this._onReceiveData({ chunk });\n });\n\n this._pdfDataRangeTransport.addProgressiveDoneListener(() => {\n this._onProgressiveDone();\n });\n\n this._pdfDataRangeTransport.transportReady();\n }\n\n _onReceiveData(args) {\n const buffer = new Uint8Array(args.chunk).buffer;\n if (args.begin === undefined) {\n if (this._fullRequestReader) {\n this._fullRequestReader._enqueue(buffer);\n } else {\n this._queuedChunks.push(buffer);\n }\n } else {\n const found = this._rangeReaders.some(function (rangeReader) {\n if (rangeReader._begin !== args.begin) {\n return false;\n }\n rangeReader._enqueue(buffer);\n return true;\n });\n assert(\n found,\n \"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.\"\n );\n }\n }\n\n get _progressiveDataLength() {\n return this._fullRequestReader?._loaded ?? 0;\n }\n\n _onProgress(evt) {\n if (evt.total === undefined) {\n // Reporting to first range reader, if it exists.\n const firstReader = this._rangeReaders[0];\n if (firstReader?.onProgress) {\n firstReader.onProgress({ loaded: evt.loaded });\n }\n } else {\n const fullReader = this._fullRequestReader;\n if (fullReader?.onProgress) {\n fullReader.onProgress({ loaded: evt.loaded, total: evt.total });\n }\n }\n }\n\n _onProgressiveDone() {\n if (this._fullRequestReader) {\n this._fullRequestReader.progressiveDone();\n }\n this._progressiveDone = true;\n }\n\n _removeRangeReader(reader) {\n const i = this._rangeReaders.indexOf(reader);\n if (i >= 0) {\n this._rangeReaders.splice(i, 1);\n }\n }\n\n getFullReader() {\n assert(\n !this._fullRequestReader,\n \"PDFDataTransportStream.getFullReader can only be called once.\"\n );\n const queuedChunks = this._queuedChunks;\n this._queuedChunks = null;\n return new PDFDataTransportStreamReader(\n this,\n queuedChunks,\n this._progressiveDone,\n this._contentDispositionFilename\n );\n }\n\n getRangeReader(begin, end) {\n if (end <= this._progressiveDataLength) {\n return null;\n }\n const reader = new PDFDataTransportStreamRangeReader(this, begin, end);\n this._pdfDataRangeTransport.requestDataRange(begin, end);\n this._rangeReaders.push(reader);\n return reader;\n }\n\n cancelAllRequests(reason) {\n if (this._fullRequestReader) {\n this._fullRequestReader.cancel(reason);\n }\n for (const reader of this._rangeReaders.slice(0)) {\n reader.cancel(reason);\n }\n this._pdfDataRangeTransport.abort();\n }\n}\n\n/** @implements {IPDFStreamReader} */\nclass PDFDataTransportStreamReader {\n constructor(\n stream,\n queuedChunks,\n progressiveDone = false,\n contentDispositionFilename = null\n ) {\n this._stream = stream;\n this._done = progressiveDone || false;\n this._filename = isPdfFile(contentDispositionFilename)\n ? contentDispositionFilename\n : null;\n this._queuedChunks = queuedChunks || [];\n this._loaded = 0;\n for (const chunk of this._queuedChunks) {\n this._loaded += chunk.byteLength;\n }\n this._requests = [];\n this._headersReady = Promise.resolve();\n stream._fullRequestReader = this;\n\n this.onProgress = null;\n }\n\n _enqueue(chunk) {\n if (this._done) {\n return; // Ignore new data.\n }\n if (this._requests.length > 0) {\n const requestCapability = this._requests.shift();\n requestCapability.resolve({ value: chunk, done: false });\n } else {\n this._queuedChunks.push(chunk);\n }\n this._loaded += chunk.byteLength;\n }\n\n get headersReady() {\n return this._headersReady;\n }\n\n get filename() {\n return this._filename;\n }\n\n get isRangeSupported() {\n return this._stream._isRangeSupported;\n }\n\n get isStreamingSupported() {\n return this._stream._isStreamingSupported;\n }\n\n get contentLength() {\n return this._stream._contentLength;\n }\n\n async read() {\n if (this._queuedChunks.length > 0) {\n const chunk = this._queuedChunks.shift();\n return { value: chunk, done: false };\n }\n if (this._done) {\n return { value: undefined, done: true };\n }\n const requestCapability = createPromiseCapability();\n this._requests.push(requestCapability);\n return requestCapability.promise;\n }\n\n cancel(reason) {\n this._done = true;\n for (const requestCapability of this._requests) {\n requestCapability.resolve({ value: undefined, done: true });\n }\n this._requests.length = 0;\n }\n\n progressiveDone() {\n if (this._done) {\n return;\n }\n this._done = true;\n }\n}\n\n/** @implements {IPDFStreamRangeReader} */\nclass PDFDataTransportStreamRangeReader {\n constructor(stream, begin, end) {\n this._stream = stream;\n this._begin = begin;\n this._end = end;\n this._queuedChunk = null;\n this._requests = [];\n this._done = false;\n\n this.onProgress = null;\n }\n\n _enqueue(chunk) {\n if (this._done) {\n return; // ignore new data\n }\n if (this._requests.length === 0) {\n this._queuedChunk = chunk;\n } else {\n const requestsCapability = this._requests.shift();\n requestsCapability.resolve({ value: chunk, done: false });\n for (const requestCapability of this._requests) {\n requestCapability.resolve({ value: undefined, done: true });\n }\n this._requests.length = 0;\n }\n this._done = true;\n this._stream._removeRangeReader(this);\n }\n\n get isStreamingSupported() {\n return false;\n }\n\n async read() {\n if (this._queuedChunk) {\n const chunk = this._queuedChunk;\n this._queuedChunk = null;\n return { value: chunk, done: false };\n }\n if (this._done) {\n return { value: undefined, done: true };\n }\n const requestCapability = createPromiseCapability();\n this._requests.push(requestCapability);\n return requestCapability.promise;\n }\n\n cancel(reason) {\n this._done = true;\n for (const requestCapability of this._requests) {\n requestCapability.resolve({ value: undefined, done: true });\n }\n this._requests.length = 0;\n this._stream._removeRangeReader(this);\n }\n}\n\nexport { PDFDataTransportStream };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n addLinkAttributes,\n DOMSVGFactory,\n getFilenameFromUrl,\n LinkTarget,\n PDFDateString,\n} from \"./display_utils.js\";\nimport {\n AnnotationBorderStyleType,\n AnnotationType,\n assert,\n stringToPDFString,\n unreachable,\n Util,\n warn,\n} from \"../shared/util.js\";\nimport { AnnotationStorage } from \"./annotation_storage.js\";\nimport { ColorConverters } from \"../shared/scripting_utils.js\";\n\n/**\n * @typedef {Object} AnnotationElementParameters\n * @property {Object} data\n * @property {HTMLDivElement} layer\n * @property {PDFPage} page\n * @property {PageViewport} viewport\n * @property {IPDFLinkService} linkService\n * @property {DownloadManager} downloadManager\n * @property {AnnotationStorage} [annotationStorage]\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @property {boolean} renderInteractiveForms\n * @property {Object} svgFactory\n * @property {boolean} [enableScripting]\n * @property {boolean} [hasJSActions]\n * @property {Object} [mouseState]\n */\n\nclass AnnotationElementFactory {\n /**\n * @param {AnnotationElementParameters} parameters\n * @returns {AnnotationElement}\n */\n static create(parameters) {\n const subtype = parameters.data.annotationType;\n\n switch (subtype) {\n case AnnotationType.LINK:\n return new LinkAnnotationElement(parameters);\n\n case AnnotationType.TEXT:\n return new TextAnnotationElement(parameters);\n\n case AnnotationType.WIDGET:\n const fieldType = parameters.data.fieldType;\n\n switch (fieldType) {\n case \"Tx\":\n return new TextWidgetAnnotationElement(parameters);\n case \"Btn\":\n if (parameters.data.radioButton) {\n return new RadioButtonWidgetAnnotationElement(parameters);\n } else if (parameters.data.checkBox) {\n return new CheckboxWidgetAnnotationElement(parameters);\n }\n return new PushButtonWidgetAnnotationElement(parameters);\n case \"Ch\":\n return new ChoiceWidgetAnnotationElement(parameters);\n }\n return new WidgetAnnotationElement(parameters);\n\n case AnnotationType.POPUP:\n return new PopupAnnotationElement(parameters);\n\n case AnnotationType.FREETEXT:\n return new FreeTextAnnotationElement(parameters);\n\n case AnnotationType.LINE:\n return new LineAnnotationElement(parameters);\n\n case AnnotationType.SQUARE:\n return new SquareAnnotationElement(parameters);\n\n case AnnotationType.CIRCLE:\n return new CircleAnnotationElement(parameters);\n\n case AnnotationType.POLYLINE:\n return new PolylineAnnotationElement(parameters);\n\n case AnnotationType.CARET:\n return new CaretAnnotationElement(parameters);\n\n case AnnotationType.INK:\n return new InkAnnotationElement(parameters);\n\n case AnnotationType.POLYGON:\n return new PolygonAnnotationElement(parameters);\n\n case AnnotationType.HIGHLIGHT:\n return new HighlightAnnotationElement(parameters);\n\n case AnnotationType.UNDERLINE:\n return new UnderlineAnnotationElement(parameters);\n\n case AnnotationType.SQUIGGLY:\n return new SquigglyAnnotationElement(parameters);\n\n case AnnotationType.STRIKEOUT:\n return new StrikeOutAnnotationElement(parameters);\n\n case AnnotationType.STAMP:\n return new StampAnnotationElement(parameters);\n\n case AnnotationType.FILEATTACHMENT:\n return new FileAttachmentAnnotationElement(parameters);\n\n default:\n return new AnnotationElement(parameters);\n }\n }\n}\n\nclass AnnotationElement {\n constructor(\n parameters,\n {\n isRenderable = false,\n ignoreBorder = false,\n createQuadrilaterals = false,\n } = {}\n ) {\n this.isRenderable = isRenderable;\n this.data = parameters.data;\n this.layer = parameters.layer;\n this.page = parameters.page;\n this.viewport = parameters.viewport;\n this.linkService = parameters.linkService;\n this.downloadManager = parameters.downloadManager;\n this.imageResourcesPath = parameters.imageResourcesPath;\n this.renderInteractiveForms = parameters.renderInteractiveForms;\n this.svgFactory = parameters.svgFactory;\n this.annotationStorage = parameters.annotationStorage;\n this.enableScripting = parameters.enableScripting;\n this.hasJSActions = parameters.hasJSActions;\n this._mouseState = parameters.mouseState;\n\n if (isRenderable) {\n this.container = this._createContainer(ignoreBorder);\n }\n if (createQuadrilaterals) {\n this.quadrilaterals = this._createQuadrilaterals(ignoreBorder);\n }\n }\n\n /**\n * Create an empty container for the annotation's HTML element.\n *\n * @private\n * @param {boolean} ignoreBorder\n * @memberof AnnotationElement\n * @returns {HTMLSectionElement}\n */\n _createContainer(ignoreBorder = false) {\n const data = this.data,\n page = this.page,\n viewport = this.viewport;\n const container = document.createElement(\"section\");\n let width = data.rect[2] - data.rect[0];\n let height = data.rect[3] - data.rect[1];\n\n container.setAttribute(\"data-annotation-id\", data.id);\n\n // Do *not* modify `data.rect`, since that will corrupt the annotation\n // position on subsequent calls to `_createContainer` (see issue 6804).\n const rect = Util.normalizeRect([\n data.rect[0],\n page.view[3] - data.rect[1] + page.view[1],\n data.rect[2],\n page.view[3] - data.rect[3] + page.view[1],\n ]);\n\n container.style.transform = `matrix(${viewport.transform.join(\",\")})`;\n container.style.transformOrigin = `${-rect[0]}px ${-rect[1]}px`;\n\n if (!ignoreBorder && data.borderStyle.width > 0) {\n container.style.borderWidth = `${data.borderStyle.width}px`;\n if (data.borderStyle.style !== AnnotationBorderStyleType.UNDERLINE) {\n // Underline styles only have a bottom border, so we do not need\n // to adjust for all borders. This yields a similar result as\n // Adobe Acrobat/Reader.\n width = width - 2 * data.borderStyle.width;\n height = height - 2 * data.borderStyle.width;\n }\n\n const horizontalRadius = data.borderStyle.horizontalCornerRadius;\n const verticalRadius = data.borderStyle.verticalCornerRadius;\n if (horizontalRadius > 0 || verticalRadius > 0) {\n const radius = `${horizontalRadius}px / ${verticalRadius}px`;\n container.style.borderRadius = radius;\n }\n\n switch (data.borderStyle.style) {\n case AnnotationBorderStyleType.SOLID:\n container.style.borderStyle = \"solid\";\n break;\n\n case AnnotationBorderStyleType.DASHED:\n container.style.borderStyle = \"dashed\";\n break;\n\n case AnnotationBorderStyleType.BEVELED:\n warn(\"Unimplemented border style: beveled\");\n break;\n\n case AnnotationBorderStyleType.INSET:\n warn(\"Unimplemented border style: inset\");\n break;\n\n case AnnotationBorderStyleType.UNDERLINE:\n container.style.borderBottomStyle = \"solid\";\n break;\n\n default:\n break;\n }\n\n if (data.color) {\n container.style.borderColor = Util.makeHexColor(\n data.color[0] | 0,\n data.color[1] | 0,\n data.color[2] | 0\n );\n } else {\n // Transparent (invisible) border, so do not draw it at all.\n container.style.borderWidth = 0;\n }\n }\n\n container.style.left = `${rect[0]}px`;\n container.style.top = `${rect[1]}px`;\n container.style.width = `${width}px`;\n container.style.height = `${height}px`;\n return container;\n }\n\n /**\n * Create quadrilaterals from the annotation's quadpoints.\n *\n * @private\n * @param {boolean} ignoreBorder\n * @memberof AnnotationElement\n * @returns {Array<HTMLSectionElement>}\n */\n _createQuadrilaterals(ignoreBorder = false) {\n if (!this.data.quadPoints) {\n return null;\n }\n\n const quadrilaterals = [];\n const savedRect = this.data.rect;\n for (const quadPoint of this.data.quadPoints) {\n this.data.rect = [\n quadPoint[2].x,\n quadPoint[2].y,\n quadPoint[1].x,\n quadPoint[1].y,\n ];\n quadrilaterals.push(this._createContainer(ignoreBorder));\n }\n this.data.rect = savedRect;\n return quadrilaterals;\n }\n\n /**\n * Create a popup for the annotation's HTML element. This is used for\n * annotations that do not have a Popup entry in the dictionary, but\n * are of a type that works with popups (such as Highlight annotations).\n *\n * @private\n * @param {HTMLDivElement|HTMLImageElement|null} trigger\n * @param {Object} data\n * @memberof AnnotationElement\n */\n _createPopup(trigger, data) {\n let container = this.container;\n if (this.quadrilaterals) {\n trigger = trigger || this.quadrilaterals;\n container = this.quadrilaterals[0];\n }\n\n // If no trigger element is specified, create it.\n if (!trigger) {\n trigger = document.createElement(\"div\");\n trigger.style.height = container.style.height;\n trigger.style.width = container.style.width;\n container.appendChild(trigger);\n }\n\n const popupElement = new PopupElement({\n container,\n trigger,\n color: data.color,\n title: data.title,\n modificationDate: data.modificationDate,\n contents: data.contents,\n hideWrapper: true,\n });\n const popup = popupElement.render();\n\n // Position the popup next to the annotation's container.\n popup.style.left = container.style.width;\n\n container.appendChild(popup);\n }\n\n /**\n * Render the quadrilaterals of the annotation.\n *\n * @private\n * @param {string} className\n * @memberof AnnotationElement\n * @returns {Array<HTMLSectionElement>}\n */\n _renderQuadrilaterals(className) {\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || TESTING\")\n ) {\n assert(this.quadrilaterals, \"Missing quadrilaterals during rendering\");\n }\n\n for (const quadrilateral of this.quadrilaterals) {\n quadrilateral.className = className;\n }\n return this.quadrilaterals;\n }\n\n /**\n * Render the annotation's HTML element(s).\n *\n * @public\n * @memberof AnnotationElement\n * @returns {HTMLSectionElement|Array<HTMLSectionElement>}\n */\n render() {\n unreachable(\"Abstract method `AnnotationElement.render` called\");\n }\n}\n\nclass LinkAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.url ||\n parameters.data.dest ||\n parameters.data.action ||\n parameters.data.isTooltipOnly ||\n (parameters.data.actions &&\n (parameters.data.actions.Action ||\n parameters.data.actions[\"Mouse Up\"] ||\n parameters.data.actions[\"Mouse Down\"]))\n );\n super(parameters, { isRenderable, createQuadrilaterals: true });\n }\n\n render() {\n const { data, linkService } = this;\n const link = document.createElement(\"a\");\n\n if (data.url) {\n addLinkAttributes(link, {\n url: data.url,\n target: data.newWindow\n ? LinkTarget.BLANK\n : linkService.externalLinkTarget,\n rel: linkService.externalLinkRel,\n enabled: linkService.externalLinkEnabled,\n });\n } else if (data.action) {\n this._bindNamedAction(link, data.action);\n } else if (data.dest) {\n this._bindLink(link, data.dest);\n } else if (\n data.actions &&\n (data.actions.Action ||\n data.actions[\"Mouse Up\"] ||\n data.actions[\"Mouse Down\"]) &&\n this.enableScripting &&\n this.hasJSActions\n ) {\n this._bindJSAction(link, data);\n } else {\n this._bindLink(link, \"\");\n }\n\n if (this.quadrilaterals) {\n return this._renderQuadrilaterals(\"linkAnnotation\").map(\n (quadrilateral, index) => {\n const linkElement = index === 0 ? link : link.cloneNode();\n quadrilateral.appendChild(linkElement);\n return quadrilateral;\n }\n );\n }\n\n this.container.className = \"linkAnnotation\";\n this.container.appendChild(link);\n return this.container;\n }\n\n /**\n * Bind internal links to the link element.\n *\n * @private\n * @param {Object} link\n * @param {Object} destination\n * @memberof LinkAnnotationElement\n */\n _bindLink(link, destination) {\n link.href = this.linkService.getDestinationHash(destination);\n link.onclick = () => {\n if (destination) {\n this.linkService.goToDestination(destination);\n }\n return false;\n };\n if (destination || destination === /* isTooltipOnly = */ \"\") {\n link.className = \"internalLink\";\n }\n }\n\n /**\n * Bind named actions to the link element.\n *\n * @private\n * @param {Object} link\n * @param {Object} action\n * @memberof LinkAnnotationElement\n */\n _bindNamedAction(link, action) {\n link.href = this.linkService.getAnchorUrl(\"\");\n link.onclick = () => {\n this.linkService.executeNamedAction(action);\n return false;\n };\n link.className = \"internalLink\";\n }\n\n /**\n * Bind JS actions to the link element.\n *\n * @private\n * @param {Object} link\n * @param {Object} data\n * @memberof LinkAnnotationElement\n */\n _bindJSAction(link, data) {\n link.href = this.linkService.getAnchorUrl(\"\");\n const map = new Map([\n [\"Action\", \"onclick\"],\n [\"Mouse Up\", \"onmouseup\"],\n [\"Mouse Down\", \"onmousedown\"],\n ]);\n for (const name of Object.keys(data.actions)) {\n const jsName = map.get(name);\n if (!jsName) {\n continue;\n }\n link[jsName] = () => {\n this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n source: this,\n detail: {\n id: data.id,\n name,\n },\n });\n return false;\n };\n }\n link.className = \"internalLink\";\n }\n}\n\nclass TextAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, { isRenderable });\n }\n\n render() {\n this.container.className = \"textAnnotation\";\n\n const image = document.createElement(\"img\");\n image.style.height = this.container.style.height;\n image.style.width = this.container.style.width;\n image.src =\n this.imageResourcesPath +\n \"annotation-\" +\n this.data.name.toLowerCase() +\n \".svg\";\n image.alt = \"[{{type}} Annotation]\";\n image.dataset.l10nId = \"text_annotation_type\";\n image.dataset.l10nArgs = JSON.stringify({ type: this.data.name });\n\n if (!this.data.hasPopup) {\n this._createPopup(image, this.data);\n }\n\n this.container.appendChild(image);\n return this.container;\n }\n}\n\nclass WidgetAnnotationElement extends AnnotationElement {\n render() {\n // Show only the container for unsupported field types.\n if (this.data.alternativeText) {\n this.container.title = this.data.alternativeText;\n }\n\n return this.container;\n }\n\n _getKeyModifier(event) {\n return (\n (navigator.platform.includes(\"Win\") && event.ctrlKey) ||\n (navigator.platform.includes(\"Mac\") && event.metaKey)\n );\n }\n\n _setEventListener(element, baseName, eventName, valueGetter) {\n if (baseName.includes(\"mouse\")) {\n // Mouse events\n element.addEventListener(baseName, event => {\n this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n source: this,\n detail: {\n id: this.data.id,\n name: eventName,\n value: valueGetter(event),\n shift: event.shiftKey,\n modifier: this._getKeyModifier(event),\n },\n });\n });\n } else {\n // Non mouse event\n element.addEventListener(baseName, event => {\n this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n source: this,\n detail: {\n id: this.data.id,\n name: eventName,\n value: event.target.checked,\n },\n });\n });\n }\n }\n\n _setEventListeners(element, names, getter) {\n for (const [baseName, eventName] of names) {\n if (eventName === \"Action\" || this.data.actions?.[eventName]) {\n this._setEventListener(element, baseName, eventName, getter);\n }\n }\n }\n\n _dispatchEventFromSandbox(actions, jsEvent) {\n const setColor = (jsName, styleName, event) => {\n const color = event.detail[jsName];\n event.target.style[styleName] = ColorConverters[`${color[0]}_HTML`](\n color.slice(1)\n );\n };\n\n const commonActions = {\n display: event => {\n const hidden = event.detail.display % 2 === 1;\n event.target.style.visibility = hidden ? \"hidden\" : \"visible\";\n this.annotationStorage.setValue(this.data.id, {\n hidden,\n print: event.detail.display === 0 || event.detail.display === 3,\n });\n },\n print: event => {\n this.annotationStorage.setValue(this.data.id, {\n print: event.detail.print,\n });\n },\n hidden: event => {\n event.target.style.visibility = event.detail.hidden\n ? \"hidden\"\n : \"visible\";\n this.annotationStorage.setValue(this.data.id, {\n hidden: event.detail.hidden,\n });\n },\n focus: event => {\n setTimeout(() => event.target.focus({ preventScroll: false }), 0);\n },\n userName: event => {\n // tooltip\n event.target.title = event.detail.userName;\n },\n readonly: event => {\n if (event.detail.readonly) {\n event.target.setAttribute(\"readonly\", \"\");\n } else {\n event.target.removeAttribute(\"readonly\");\n }\n },\n required: event => {\n if (event.detail.required) {\n event.target.setAttribute(\"required\", \"\");\n } else {\n event.target.removeAttribute(\"required\");\n }\n },\n bgColor: event => {\n setColor(\"bgColor\", \"backgroundColor\", event);\n },\n fillColor: event => {\n setColor(\"fillColor\", \"backgroundColor\", event);\n },\n fgColor: event => {\n setColor(\"fgColor\", \"color\", event);\n },\n textColor: event => {\n setColor(\"textColor\", \"color\", event);\n },\n borderColor: event => {\n setColor(\"borderColor\", \"borderColor\", event);\n },\n strokeColor: event => {\n setColor(\"strokeColor\", \"borderColor\", event);\n },\n };\n\n for (const name of Object.keys(jsEvent.detail)) {\n const action = actions[name] || commonActions[name];\n if (action) {\n action(jsEvent);\n }\n }\n }\n}\n\nclass TextWidgetAnnotationElement extends WidgetAnnotationElement {\n constructor(parameters) {\n const isRenderable =\n parameters.renderInteractiveForms ||\n (!parameters.data.hasAppearance && !!parameters.data.fieldValue);\n super(parameters, { isRenderable });\n }\n\n setPropertyOnSiblings(base, key, value, keyInStorage) {\n const storage = this.annotationStorage;\n for (const element of document.getElementsByName(base.name)) {\n if (element !== base) {\n element[key] = value;\n const data = Object.create(null);\n data[keyInStorage] = value;\n storage.setValue(element.getAttribute(\"id\"), data);\n }\n }\n }\n\n render() {\n const storage = this.annotationStorage;\n const id = this.data.id;\n\n this.container.className = \"textWidgetAnnotation\";\n\n let element = null;\n if (this.renderInteractiveForms) {\n // NOTE: We cannot set the values using `element.value` below, since it\n // prevents the AnnotationLayer rasterizer in `test/driver.js`\n // from parsing the elements correctly for the reference tests.\n const storedData = storage.getValue(id, {\n value: this.data.fieldValue,\n valueAsString: this.data.fieldValue,\n });\n const textContent = storedData.valueAsString || storedData.value || \"\";\n const elementData = {\n userValue: null,\n formattedValue: null,\n beforeInputSelectionRange: null,\n beforeInputValue: null,\n };\n\n if (this.data.multiLine) {\n element = document.createElement(\"textarea\");\n element.textContent = textContent;\n } else {\n element = document.createElement(\"input\");\n element.type = \"text\";\n element.setAttribute(\"value\", textContent);\n }\n\n elementData.userValue = textContent;\n element.setAttribute(\"id\", id);\n\n element.addEventListener(\"input\", event => {\n storage.setValue(id, { value: event.target.value });\n this.setPropertyOnSiblings(\n element,\n \"value\",\n event.target.value,\n \"value\"\n );\n });\n\n let blurListener = event => {\n if (elementData.formattedValue) {\n event.target.value = elementData.formattedValue;\n }\n // Reset the cursor position to the start of the field (issue 12359).\n event.target.scrollLeft = 0;\n elementData.beforeInputSelectionRange = null;\n };\n\n if (this.enableScripting && this.hasJSActions) {\n element.addEventListener(\"focus\", event => {\n if (elementData.userValue) {\n event.target.value = elementData.userValue;\n }\n });\n\n element.addEventListener(\"updatefromsandbox\", jsEvent => {\n const actions = {\n value(event) {\n elementData.userValue = event.detail.value || \"\";\n storage.setValue(id, { value: elementData.userValue.toString() });\n if (!elementData.formattedValue) {\n event.target.value = elementData.userValue;\n }\n },\n valueAsString(event) {\n elementData.formattedValue = event.detail.valueAsString || \"\";\n if (event.target !== document.activeElement) {\n // Input hasn't the focus so display formatted string\n event.target.value = elementData.formattedValue;\n }\n storage.setValue(id, {\n formattedValue: elementData.formattedValue,\n });\n },\n selRange(event) {\n const [selStart, selEnd] = event.detail.selRange;\n if (selStart >= 0 && selEnd < event.target.value.length) {\n event.target.setSelectionRange(selStart, selEnd);\n }\n },\n };\n this._dispatchEventFromSandbox(actions, jsEvent);\n });\n\n // Even if the field hasn't any actions\n // leaving it can still trigger some actions with Calculate\n element.addEventListener(\"keydown\", event => {\n elementData.beforeInputValue = event.target.value;\n // if the key is one of Escape, Enter or Tab\n // then the data are committed\n let commitKey = -1;\n if (event.key === \"Escape\") {\n commitKey = 0;\n } else if (event.key === \"Enter\") {\n commitKey = 2;\n } else if (event.key === \"Tab\") {\n commitKey = 3;\n }\n if (commitKey === -1) {\n return;\n }\n // Save the entered value\n elementData.userValue = event.target.value;\n this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n source: this,\n detail: {\n id,\n name: \"Keystroke\",\n value: event.target.value,\n willCommit: true,\n commitKey,\n selStart: event.target.selectionStart,\n selEnd: event.target.selectionEnd,\n },\n });\n });\n const _blurListener = blurListener;\n blurListener = null;\n element.addEventListener(\"blur\", event => {\n if (this._mouseState.isDown) {\n // Focus out using the mouse: data are committed\n elementData.userValue = event.target.value;\n this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n source: this,\n detail: {\n id,\n name: \"Keystroke\",\n value: event.target.value,\n willCommit: true,\n commitKey: 1,\n selStart: event.target.selectionStart,\n selEnd: event.target.selectionEnd,\n },\n });\n }\n _blurListener(event);\n });\n element.addEventListener(\"mousedown\", event => {\n elementData.beforeInputValue = event.target.value;\n elementData.beforeInputSelectionRange = null;\n });\n element.addEventListener(\"keyup\", event => {\n // keyup is triggered after input\n if (event.target.selectionStart === event.target.selectionEnd) {\n elementData.beforeInputSelectionRange = null;\n }\n });\n element.addEventListener(\"select\", event => {\n elementData.beforeInputSelectionRange = [\n event.target.selectionStart,\n event.target.selectionEnd,\n ];\n });\n\n if (this.data.actions?.Keystroke) {\n // We should use beforeinput but this\n // event isn't available in Firefox\n element.addEventListener(\"input\", event => {\n let selStart = -1;\n let selEnd = -1;\n if (elementData.beforeInputSelectionRange) {\n [selStart, selEnd] = elementData.beforeInputSelectionRange;\n }\n this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n source: this,\n detail: {\n id,\n name: \"Keystroke\",\n value: elementData.beforeInputValue,\n change: event.data,\n willCommit: false,\n selStart,\n selEnd,\n },\n });\n });\n }\n\n this._setEventListeners(\n element,\n [\n [\"focus\", \"Focus\"],\n [\"blur\", \"Blur\"],\n [\"mousedown\", \"Mouse Down\"],\n [\"mouseenter\", \"Mouse Enter\"],\n [\"mouseleave\", \"Mouse Exit\"],\n [\"mouseup\", \"Mouse Up\"],\n ],\n event => event.target.value\n );\n }\n\n if (blurListener) {\n element.addEventListener(\"blur\", blurListener);\n }\n\n element.disabled = this.data.readOnly;\n element.name = this.data.fieldName;\n\n if (this.data.maxLen !== null) {\n element.maxLength = this.data.maxLen;\n }\n\n if (this.data.comb) {\n const fieldWidth = this.data.rect[2] - this.data.rect[0];\n const combWidth = fieldWidth / this.data.maxLen;\n\n element.classList.add(\"comb\");\n element.style.letterSpacing = `calc(${combWidth}px - 1ch)`;\n }\n } else {\n element = document.createElement(\"div\");\n element.textContent = this.data.fieldValue;\n element.style.verticalAlign = \"middle\";\n element.style.display = \"table-cell\";\n }\n\n this._setTextStyle(element);\n\n this.container.appendChild(element);\n return this.container;\n }\n\n /**\n * Apply text styles to the text in the element.\n *\n * @private\n * @param {HTMLDivElement} element\n * @memberof TextWidgetAnnotationElement\n */\n _setTextStyle(element) {\n const TEXT_ALIGNMENT = [\"left\", \"center\", \"right\"];\n const { fontSize, fontColor } = this.data.defaultAppearanceData;\n const style = element.style;\n\n // TODO: If the font-size is zero, calculate it based on the height and\n // width of the element.\n // Not setting `style.fontSize` will use the default font-size for now.\n if (fontSize) {\n style.fontSize = `${fontSize}px`;\n }\n\n style.color = Util.makeHexColor(fontColor[0], fontColor[1], fontColor[2]);\n\n if (this.data.textAlignment !== null) {\n style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];\n }\n }\n}\n\nclass CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {\n constructor(parameters) {\n super(parameters, { isRenderable: parameters.renderInteractiveForms });\n }\n\n render() {\n const storage = this.annotationStorage;\n const data = this.data;\n const id = data.id;\n let value = storage.getValue(id, {\n value:\n data.fieldValue &&\n ((data.exportValue && data.exportValue === data.fieldValue) ||\n (!data.exportValue && data.fieldValue !== \"Off\")),\n }).value;\n if (typeof value === \"string\") {\n // The value has been changed through js and set in annotationStorage.\n value = value !== \"Off\";\n storage.setValue(id, { value });\n }\n\n this.container.className = \"buttonWidgetAnnotation checkBox\";\n\n const element = document.createElement(\"input\");\n element.disabled = data.readOnly;\n element.type = \"checkbox\";\n element.name = this.data.fieldName;\n if (value) {\n element.setAttribute(\"checked\", true);\n }\n element.setAttribute(\"id\", id);\n\n element.addEventListener(\"change\", function (event) {\n const name = event.target.name;\n for (const checkbox of document.getElementsByName(name)) {\n if (checkbox !== event.target) {\n checkbox.checked = false;\n storage.setValue(\n checkbox.parentNode.getAttribute(\"data-annotation-id\"),\n { value: false }\n );\n }\n }\n storage.setValue(id, { value: event.target.checked });\n });\n\n if (this.enableScripting && this.hasJSActions) {\n element.addEventListener(\"updatefromsandbox\", jsEvent => {\n const actions = {\n value(event) {\n event.target.checked = event.detail.value !== \"Off\";\n storage.setValue(id, { value: event.target.checked });\n },\n };\n this._dispatchEventFromSandbox(actions, jsEvent);\n });\n\n this._setEventListeners(\n element,\n [\n [\"change\", \"Validate\"],\n [\"change\", \"Action\"],\n [\"focus\", \"Focus\"],\n [\"blur\", \"Blur\"],\n [\"mousedown\", \"Mouse Down\"],\n [\"mouseenter\", \"Mouse Enter\"],\n [\"mouseleave\", \"Mouse Exit\"],\n [\"mouseup\", \"Mouse Up\"],\n ],\n event => event.target.checked\n );\n }\n\n this.container.appendChild(element);\n return this.container;\n }\n}\n\nclass RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {\n constructor(parameters) {\n super(parameters, { isRenderable: parameters.renderInteractiveForms });\n }\n\n render() {\n this.container.className = \"buttonWidgetAnnotation radioButton\";\n const storage = this.annotationStorage;\n const data = this.data;\n const id = data.id;\n let value = storage.getValue(id, {\n value: data.fieldValue === data.buttonValue,\n }).value;\n if (typeof value === \"string\") {\n // The value has been changed through js and set in annotationStorage.\n value = value !== data.buttonValue;\n storage.setValue(id, { value });\n }\n\n const element = document.createElement(\"input\");\n element.disabled = data.readOnly;\n element.type = \"radio\";\n element.name = data.fieldName;\n if (value) {\n element.setAttribute(\"checked\", true);\n }\n element.setAttribute(\"id\", id);\n\n element.addEventListener(\"change\", function (event) {\n const { target } = event;\n for (const radio of document.getElementsByName(target.name)) {\n if (radio !== target) {\n storage.setValue(radio.getAttribute(\"id\"), { value: false });\n }\n }\n storage.setValue(id, { value: target.checked });\n });\n\n if (this.enableScripting && this.hasJSActions) {\n const pdfButtonValue = data.buttonValue;\n element.addEventListener(\"updatefromsandbox\", jsEvent => {\n const actions = {\n value(event) {\n const checked = pdfButtonValue === event.detail.value;\n for (const radio of document.getElementsByName(event.target.name)) {\n const radioId = radio.getAttribute(\"id\");\n radio.checked = radioId === id && checked;\n storage.setValue(radioId, { value: radio.checked });\n }\n },\n };\n this._dispatchEventFromSandbox(actions, jsEvent);\n });\n\n this._setEventListeners(\n element,\n [\n [\"change\", \"Validate\"],\n [\"change\", \"Action\"],\n [\"focus\", \"Focus\"],\n [\"blur\", \"Blur\"],\n [\"mousedown\", \"Mouse Down\"],\n [\"mouseenter\", \"Mouse Enter\"],\n [\"mouseleave\", \"Mouse Exit\"],\n [\"mouseup\", \"Mouse Up\"],\n ],\n event => event.target.checked\n );\n }\n\n this.container.appendChild(element);\n return this.container;\n }\n}\n\nclass PushButtonWidgetAnnotationElement extends LinkAnnotationElement {\n render() {\n // The rendering and functionality of a push button widget annotation is\n // equal to that of a link annotation, but may have more functionality, such\n // as performing actions on form fields (resetting, submitting, et cetera).\n const container = super.render();\n container.className = \"buttonWidgetAnnotation pushButton\";\n\n if (this.data.alternativeText) {\n container.title = this.data.alternativeText;\n }\n\n return container;\n }\n}\n\nclass ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {\n constructor(parameters) {\n super(parameters, { isRenderable: parameters.renderInteractiveForms });\n }\n\n render() {\n this.container.className = \"choiceWidgetAnnotation\";\n const storage = this.annotationStorage;\n const id = this.data.id;\n\n // For printing/saving we currently only support choice widgets with one\n // option selection. Therefore, listboxes (#12189) and comboboxes (#12224)\n // are not properly printed/saved yet, so we only store the first item in\n // the field value array instead of the entire array. Once support for those\n // two field types is implemented, we should use the same pattern as the\n // other interactive widgets where the return value of `getValue`\n // is used and the full array of field values is stored.\n storage.getValue(id, {\n value:\n this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : undefined,\n });\n\n const selectElement = document.createElement(\"select\");\n selectElement.disabled = this.data.readOnly;\n selectElement.name = this.data.fieldName;\n selectElement.setAttribute(\"id\", id);\n\n if (!this.data.combo) {\n // List boxes have a size and (optionally) multiple selection.\n selectElement.size = this.data.options.length;\n if (this.data.multiSelect) {\n selectElement.multiple = true;\n }\n }\n\n // Insert the options into the choice field.\n for (const option of this.data.options) {\n const optionElement = document.createElement(\"option\");\n optionElement.textContent = option.displayValue;\n optionElement.value = option.exportValue;\n if (this.data.fieldValue.includes(option.exportValue)) {\n optionElement.setAttribute(\"selected\", true);\n }\n selectElement.appendChild(optionElement);\n }\n\n const getValue = (event, isExport) => {\n const name = isExport ? \"value\" : \"textContent\";\n const options = event.target.options;\n if (!event.target.multiple) {\n return options.selectedIndex === -1\n ? null\n : options[options.selectedIndex][name];\n }\n return Array.prototype.filter\n .call(options, option => option.selected)\n .map(option => option[name]);\n };\n\n const getItems = event => {\n const options = event.target.options;\n return Array.prototype.map.call(options, option => {\n return { displayValue: option.textContent, exportValue: option.value };\n });\n };\n\n if (this.enableScripting && this.hasJSActions) {\n selectElement.addEventListener(\"updatefromsandbox\", jsEvent => {\n const actions = {\n value(event) {\n const options = selectElement.options;\n const value = event.detail.value;\n const values = new Set(Array.isArray(value) ? value : [value]);\n Array.prototype.forEach.call(options, option => {\n option.selected = values.has(option.value);\n });\n storage.setValue(id, {\n value: getValue(event, /* isExport */ true),\n });\n },\n multipleSelection(event) {\n selectElement.multiple = true;\n },\n remove(event) {\n const options = selectElement.options;\n const index = event.detail.remove;\n options[index].selected = false;\n selectElement.remove(index);\n if (options.length > 0) {\n const i = Array.prototype.findIndex.call(\n options,\n option => option.selected\n );\n if (i === -1) {\n options[0].selected = true;\n }\n }\n storage.setValue(id, {\n value: getValue(event, /* isExport */ true),\n items: getItems(event),\n });\n },\n clear(event) {\n while (selectElement.length !== 0) {\n selectElement.remove(0);\n }\n storage.setValue(id, { value: null, items: [] });\n },\n insert(event) {\n const { index, displayValue, exportValue } = event.detail.insert;\n const optionElement = document.createElement(\"option\");\n optionElement.textContent = displayValue;\n optionElement.value = exportValue;\n selectElement.insertBefore(\n optionElement,\n selectElement.children[index]\n );\n storage.setValue(id, {\n value: getValue(event, /* isExport */ true),\n items: getItems(event),\n });\n },\n items(event) {\n const { items } = event.detail;\n while (selectElement.length !== 0) {\n selectElement.remove(0);\n }\n for (const item of items) {\n const { displayValue, exportValue } = item;\n const optionElement = document.createElement(\"option\");\n optionElement.textContent = displayValue;\n optionElement.value = exportValue;\n selectElement.appendChild(optionElement);\n }\n if (selectElement.options.length > 0) {\n selectElement.options[0].selected = true;\n }\n storage.setValue(id, {\n value: getValue(event, /* isExport */ true),\n items: getItems(event),\n });\n },\n indices(event) {\n const indices = new Set(event.detail.indices);\n const options = event.target.options;\n Array.prototype.forEach.call(options, (option, i) => {\n option.selected = indices.has(i);\n });\n storage.setValue(id, {\n value: getValue(event, /* isExport */ true),\n });\n },\n editable(event) {\n event.target.disabled = !event.detail.editable;\n },\n };\n this._dispatchEventFromSandbox(actions, jsEvent);\n });\n\n selectElement.addEventListener(\"input\", event => {\n const exportValue = getValue(event, /* isExport */ true);\n const value = getValue(event, /* isExport */ false);\n storage.setValue(id, { value: exportValue });\n\n this.linkService.eventBus?.dispatch(\"dispatcheventinsandbox\", {\n source: this,\n detail: {\n id,\n name: \"Keystroke\",\n value,\n changeEx: exportValue,\n willCommit: true,\n commitKey: 1,\n keyDown: false,\n },\n });\n });\n\n this._setEventListeners(\n selectElement,\n [\n [\"focus\", \"Focus\"],\n [\"blur\", \"Blur\"],\n [\"mousedown\", \"Mouse Down\"],\n [\"mouseenter\", \"Mouse Enter\"],\n [\"mouseleave\", \"Mouse Exit\"],\n [\"mouseup\", \"Mouse Up\"],\n [\"input\", \"Action\"],\n ],\n event => event.target.checked\n );\n } else {\n selectElement.addEventListener(\"input\", function (event) {\n storage.setValue(id, { value: getValue(event) });\n });\n }\n\n this.container.appendChild(selectElement);\n return this.container;\n }\n}\n\nclass PopupAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(parameters.data.title || parameters.data.contents);\n super(parameters, { isRenderable });\n }\n\n render() {\n // Do not render popup annotations for parent elements with these types as\n // they create the popups themselves (because of custom trigger divs).\n const IGNORE_TYPES = [\n \"Line\",\n \"Square\",\n \"Circle\",\n \"PolyLine\",\n \"Polygon\",\n \"Ink\",\n ];\n\n this.container.className = \"popupAnnotation\";\n\n if (IGNORE_TYPES.includes(this.data.parentType)) {\n return this.container;\n }\n\n const selector = `[data-annotation-id=\"${this.data.parentId}\"]`;\n const parentElements = this.layer.querySelectorAll(selector);\n if (parentElements.length === 0) {\n return this.container;\n }\n\n const popup = new PopupElement({\n container: this.container,\n trigger: Array.from(parentElements),\n color: this.data.color,\n title: this.data.title,\n modificationDate: this.data.modificationDate,\n contents: this.data.contents,\n });\n\n // Position the popup next to the parent annotation's container.\n // PDF viewers ignore a popup annotation's rectangle.\n const page = this.page;\n const rect = Util.normalizeRect([\n this.data.parentRect[0],\n page.view[3] - this.data.parentRect[1] + page.view[1],\n this.data.parentRect[2],\n page.view[3] - this.data.parentRect[3] + page.view[1],\n ]);\n const popupLeft =\n rect[0] + this.data.parentRect[2] - this.data.parentRect[0];\n const popupTop = rect[1];\n\n this.container.style.transformOrigin = `${-popupLeft}px ${-popupTop}px`;\n this.container.style.left = `${popupLeft}px`;\n this.container.style.top = `${popupTop}px`;\n\n this.container.appendChild(popup.render());\n return this.container;\n }\n}\n\nclass PopupElement {\n constructor(parameters) {\n this.container = parameters.container;\n this.trigger = parameters.trigger;\n this.color = parameters.color;\n this.title = parameters.title;\n this.modificationDate = parameters.modificationDate;\n this.contents = parameters.contents;\n this.hideWrapper = parameters.hideWrapper || false;\n\n this.pinned = false;\n }\n\n render() {\n const BACKGROUND_ENLIGHT = 0.7;\n\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"popupWrapper\";\n\n // For Popup annotations we hide the entire section because it contains\n // only the popup. However, for Text annotations without a separate Popup\n // annotation, we cannot hide the entire container as the image would\n // disappear too. In that special case, hiding the wrapper suffices.\n this.hideElement = this.hideWrapper ? wrapper : this.container;\n this.hideElement.hidden = true;\n\n const popup = document.createElement(\"div\");\n popup.className = \"popup\";\n\n const color = this.color;\n if (color) {\n // Enlighten the color.\n const r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];\n const g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];\n const b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];\n popup.style.backgroundColor = Util.makeHexColor(r | 0, g | 0, b | 0);\n }\n\n const title = document.createElement(\"h1\");\n title.textContent = this.title;\n popup.appendChild(title);\n\n // The modification date is shown in the popup instead of the creation\n // date if it is available and can be parsed correctly, which is\n // consistent with other viewers such as Adobe Acrobat.\n const dateObject = PDFDateString.toDateObject(this.modificationDate);\n if (dateObject) {\n const modificationDate = document.createElement(\"span\");\n modificationDate.textContent = \"{{date}}, {{time}}\";\n modificationDate.dataset.l10nId = \"annotation_date_string\";\n modificationDate.dataset.l10nArgs = JSON.stringify({\n date: dateObject.toLocaleDateString(),\n time: dateObject.toLocaleTimeString(),\n });\n popup.appendChild(modificationDate);\n }\n\n const contents = this._formatContents(this.contents);\n popup.appendChild(contents);\n\n if (!Array.isArray(this.trigger)) {\n this.trigger = [this.trigger];\n }\n\n // Attach the event listeners to the trigger element.\n for (const element of this.trigger) {\n element.addEventListener(\"click\", this._toggle.bind(this));\n element.addEventListener(\"mouseover\", this._show.bind(this, false));\n element.addEventListener(\"mouseout\", this._hide.bind(this, false));\n }\n popup.addEventListener(\"click\", this._hide.bind(this, true));\n\n wrapper.appendChild(popup);\n return wrapper;\n }\n\n /**\n * Format the contents of the popup by adding newlines where necessary.\n *\n * @private\n * @param {string} contents\n * @memberof PopupElement\n * @returns {HTMLParagraphElement}\n */\n _formatContents(contents) {\n const p = document.createElement(\"p\");\n const lines = contents.split(/(?:\\r\\n?|\\n)/);\n for (let i = 0, ii = lines.length; i < ii; ++i) {\n const line = lines[i];\n p.appendChild(document.createTextNode(line));\n if (i < ii - 1) {\n p.appendChild(document.createElement(\"br\"));\n }\n }\n return p;\n }\n\n /**\n * Toggle the visibility of the popup.\n *\n * @private\n * @memberof PopupElement\n */\n _toggle() {\n if (this.pinned) {\n this._hide(true);\n } else {\n this._show(true);\n }\n }\n\n /**\n * Show the popup.\n *\n * @private\n * @param {boolean} pin\n * @memberof PopupElement\n */\n _show(pin = false) {\n if (pin) {\n this.pinned = true;\n }\n if (this.hideElement.hidden) {\n this.hideElement.hidden = false;\n this.container.style.zIndex += 1;\n }\n }\n\n /**\n * Hide the popup.\n *\n * @private\n * @param {boolean} unpin\n * @memberof PopupElement\n */\n _hide(unpin = true) {\n if (unpin) {\n this.pinned = false;\n }\n if (!this.hideElement.hidden && !this.pinned) {\n this.hideElement.hidden = true;\n this.container.style.zIndex -= 1;\n }\n }\n}\n\nclass FreeTextAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, { isRenderable, ignoreBorder: true });\n }\n\n render() {\n this.container.className = \"freeTextAnnotation\";\n\n if (!this.data.hasPopup) {\n this._createPopup(null, this.data);\n }\n return this.container;\n }\n}\n\nclass LineAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, { isRenderable, ignoreBorder: true });\n }\n\n render() {\n this.container.className = \"lineAnnotation\";\n\n // Create an invisible line with the same starting and ending coordinates\n // that acts as the trigger for the popup. Only the line itself should\n // trigger the popup, not the entire container.\n const data = this.data;\n const width = data.rect[2] - data.rect[0];\n const height = data.rect[3] - data.rect[1];\n const svg = this.svgFactory.create(width, height);\n\n // PDF coordinates are calculated from a bottom left origin, so transform\n // the line coordinates to a top left origin for the SVG element.\n const line = this.svgFactory.createElement(\"svg:line\");\n line.setAttribute(\"x1\", data.rect[2] - data.lineCoordinates[0]);\n line.setAttribute(\"y1\", data.rect[3] - data.lineCoordinates[1]);\n line.setAttribute(\"x2\", data.rect[2] - data.lineCoordinates[2]);\n line.setAttribute(\"y2\", data.rect[3] - data.lineCoordinates[3]);\n // Ensure that the 'stroke-width' is always non-zero, since otherwise it\n // won't be possible to open/close the popup (note e.g. issue 11122).\n line.setAttribute(\"stroke-width\", data.borderStyle.width || 1);\n line.setAttribute(\"stroke\", \"transparent\");\n\n svg.appendChild(line);\n this.container.append(svg);\n\n // Create the popup ourselves so that we can bind it to the line instead\n // of to the entire container (which is the default).\n this._createPopup(line, data);\n\n return this.container;\n }\n}\n\nclass SquareAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, { isRenderable, ignoreBorder: true });\n }\n\n render() {\n this.container.className = \"squareAnnotation\";\n\n // Create an invisible square with the same rectangle that acts as the\n // trigger for the popup. Only the square itself should trigger the\n // popup, not the entire container.\n const data = this.data;\n const width = data.rect[2] - data.rect[0];\n const height = data.rect[3] - data.rect[1];\n const svg = this.svgFactory.create(width, height);\n\n // The browser draws half of the borders inside the square and half of\n // the borders outside the square by default. This behavior cannot be\n // changed programmatically, so correct for that here.\n const borderWidth = data.borderStyle.width;\n const square = this.svgFactory.createElement(\"svg:rect\");\n square.setAttribute(\"x\", borderWidth / 2);\n square.setAttribute(\"y\", borderWidth / 2);\n square.setAttribute(\"width\", width - borderWidth);\n square.setAttribute(\"height\", height - borderWidth);\n // Ensure that the 'stroke-width' is always non-zero, since otherwise it\n // won't be possible to open/close the popup (note e.g. issue 11122).\n square.setAttribute(\"stroke-width\", borderWidth || 1);\n square.setAttribute(\"stroke\", \"transparent\");\n square.setAttribute(\"fill\", \"none\");\n\n svg.appendChild(square);\n this.container.append(svg);\n\n // Create the popup ourselves so that we can bind it to the square instead\n // of to the entire container (which is the default).\n this._createPopup(square, data);\n\n return this.container;\n }\n}\n\nclass CircleAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, { isRenderable, ignoreBorder: true });\n }\n\n render() {\n this.container.className = \"circleAnnotation\";\n\n // Create an invisible circle with the same ellipse that acts as the\n // trigger for the popup. Only the circle itself should trigger the\n // popup, not the entire container.\n const data = this.data;\n const width = data.rect[2] - data.rect[0];\n const height = data.rect[3] - data.rect[1];\n const svg = this.svgFactory.create(width, height);\n\n // The browser draws half of the borders inside the circle and half of\n // the borders outside the circle by default. This behavior cannot be\n // changed programmatically, so correct for that here.\n const borderWidth = data.borderStyle.width;\n const circle = this.svgFactory.createElement(\"svg:ellipse\");\n circle.setAttribute(\"cx\", width / 2);\n circle.setAttribute(\"cy\", height / 2);\n circle.setAttribute(\"rx\", width / 2 - borderWidth / 2);\n circle.setAttribute(\"ry\", height / 2 - borderWidth / 2);\n // Ensure that the 'stroke-width' is always non-zero, since otherwise it\n // won't be possible to open/close the popup (note e.g. issue 11122).\n circle.setAttribute(\"stroke-width\", borderWidth || 1);\n circle.setAttribute(\"stroke\", \"transparent\");\n circle.setAttribute(\"fill\", \"none\");\n\n svg.appendChild(circle);\n this.container.append(svg);\n\n // Create the popup ourselves so that we can bind it to the circle instead\n // of to the entire container (which is the default).\n this._createPopup(circle, data);\n\n return this.container;\n }\n}\n\nclass PolylineAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, { isRenderable, ignoreBorder: true });\n\n this.containerClassName = \"polylineAnnotation\";\n this.svgElementName = \"svg:polyline\";\n }\n\n render() {\n this.container.className = this.containerClassName;\n\n // Create an invisible polyline with the same points that acts as the\n // trigger for the popup. Only the polyline itself should trigger the\n // popup, not the entire container.\n const data = this.data;\n const width = data.rect[2] - data.rect[0];\n const height = data.rect[3] - data.rect[1];\n const svg = this.svgFactory.create(width, height);\n\n // Convert the vertices array to a single points string that the SVG\n // polyline element expects (\"x1,y1 x2,y2 ...\"). PDF coordinates are\n // calculated from a bottom left origin, so transform the polyline\n // coordinates to a top left origin for the SVG element.\n let points = [];\n for (const coordinate of data.vertices) {\n const x = coordinate.x - data.rect[0];\n const y = data.rect[3] - coordinate.y;\n points.push(x + \",\" + y);\n }\n points = points.join(\" \");\n\n const polyline = this.svgFactory.createElement(this.svgElementName);\n polyline.setAttribute(\"points\", points);\n // Ensure that the 'stroke-width' is always non-zero, since otherwise it\n // won't be possible to open/close the popup (note e.g. issue 11122).\n polyline.setAttribute(\"stroke-width\", data.borderStyle.width || 1);\n polyline.setAttribute(\"stroke\", \"transparent\");\n polyline.setAttribute(\"fill\", \"none\");\n\n svg.appendChild(polyline);\n this.container.append(svg);\n\n // Create the popup ourselves so that we can bind it to the polyline\n // instead of to the entire container (which is the default).\n this._createPopup(polyline, data);\n\n return this.container;\n }\n}\n\nclass PolygonAnnotationElement extends PolylineAnnotationElement {\n constructor(parameters) {\n // Polygons are specific forms of polylines, so reuse their logic.\n super(parameters);\n\n this.containerClassName = \"polygonAnnotation\";\n this.svgElementName = \"svg:polygon\";\n }\n}\n\nclass CaretAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, { isRenderable, ignoreBorder: true });\n }\n\n render() {\n this.container.className = \"caretAnnotation\";\n\n if (!this.data.hasPopup) {\n this._createPopup(null, this.data);\n }\n return this.container;\n }\n}\n\nclass InkAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, { isRenderable, ignoreBorder: true });\n\n this.containerClassName = \"inkAnnotation\";\n\n // Use the polyline SVG element since it allows us to use coordinates\n // directly and to draw both straight lines and curves.\n this.svgElementName = \"svg:polyline\";\n }\n\n render() {\n this.container.className = this.containerClassName;\n\n // Create an invisible polyline with the same points that acts as the\n // trigger for the popup.\n const data = this.data;\n const width = data.rect[2] - data.rect[0];\n const height = data.rect[3] - data.rect[1];\n const svg = this.svgFactory.create(width, height);\n\n for (const inkList of data.inkLists) {\n // Convert the ink list to a single points string that the SVG\n // polyline element expects (\"x1,y1 x2,y2 ...\"). PDF coordinates are\n // calculated from a bottom left origin, so transform the polyline\n // coordinates to a top left origin for the SVG element.\n let points = [];\n for (const coordinate of inkList) {\n const x = coordinate.x - data.rect[0];\n const y = data.rect[3] - coordinate.y;\n points.push(`${x},${y}`);\n }\n points = points.join(\" \");\n\n const polyline = this.svgFactory.createElement(this.svgElementName);\n polyline.setAttribute(\"points\", points);\n // Ensure that the 'stroke-width' is always non-zero, since otherwise it\n // won't be possible to open/close the popup (note e.g. issue 11122).\n polyline.setAttribute(\"stroke-width\", data.borderStyle.width || 1);\n polyline.setAttribute(\"stroke\", \"transparent\");\n polyline.setAttribute(\"fill\", \"none\");\n\n // Create the popup ourselves so that we can bind it to the polyline\n // instead of to the entire container (which is the default).\n this._createPopup(polyline, data);\n\n svg.appendChild(polyline);\n }\n\n this.container.append(svg);\n return this.container;\n }\n}\n\nclass HighlightAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, {\n isRenderable,\n ignoreBorder: true,\n createQuadrilaterals: true,\n });\n }\n\n render() {\n if (!this.data.hasPopup) {\n this._createPopup(null, this.data);\n }\n\n if (this.quadrilaterals) {\n return this._renderQuadrilaterals(\"highlightAnnotation\");\n }\n\n this.container.className = \"highlightAnnotation\";\n return this.container;\n }\n}\n\nclass UnderlineAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, {\n isRenderable,\n ignoreBorder: true,\n createQuadrilaterals: true,\n });\n }\n\n render() {\n if (!this.data.hasPopup) {\n this._createPopup(null, this.data);\n }\n\n if (this.quadrilaterals) {\n return this._renderQuadrilaterals(\"underlineAnnotation\");\n }\n\n this.container.className = \"underlineAnnotation\";\n return this.container;\n }\n}\n\nclass SquigglyAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, {\n isRenderable,\n ignoreBorder: true,\n createQuadrilaterals: true,\n });\n }\n\n render() {\n if (!this.data.hasPopup) {\n this._createPopup(null, this.data);\n }\n\n if (this.quadrilaterals) {\n return this._renderQuadrilaterals(\"squigglyAnnotation\");\n }\n\n this.container.className = \"squigglyAnnotation\";\n return this.container;\n }\n}\n\nclass StrikeOutAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, {\n isRenderable,\n ignoreBorder: true,\n createQuadrilaterals: true,\n });\n }\n\n render() {\n if (!this.data.hasPopup) {\n this._createPopup(null, this.data);\n }\n\n if (this.quadrilaterals) {\n return this._renderQuadrilaterals(\"strikeoutAnnotation\");\n }\n\n this.container.className = \"strikeoutAnnotation\";\n return this.container;\n }\n}\n\nclass StampAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n const isRenderable = !!(\n parameters.data.hasPopup ||\n parameters.data.title ||\n parameters.data.contents\n );\n super(parameters, { isRenderable, ignoreBorder: true });\n }\n\n render() {\n this.container.className = \"stampAnnotation\";\n\n if (!this.data.hasPopup) {\n this._createPopup(null, this.data);\n }\n return this.container;\n }\n}\n\nclass FileAttachmentAnnotationElement extends AnnotationElement {\n constructor(parameters) {\n super(parameters, { isRenderable: true });\n\n const { filename, content } = this.data.file;\n this.filename = getFilenameFromUrl(filename);\n this.content = content;\n\n this.linkService.eventBus?.dispatch(\"fileattachmentannotation\", {\n source: this,\n id: stringToPDFString(filename),\n filename,\n content,\n });\n }\n\n render() {\n this.container.className = \"fileAttachmentAnnotation\";\n\n const trigger = document.createElement(\"div\");\n trigger.style.height = this.container.style.height;\n trigger.style.width = this.container.style.width;\n trigger.addEventListener(\"dblclick\", this._download.bind(this));\n\n if (!this.data.hasPopup && (this.data.title || this.data.contents)) {\n this._createPopup(trigger, this.data);\n }\n\n this.container.appendChild(trigger);\n return this.container;\n }\n\n /**\n * Download the file attachment associated with this annotation.\n *\n * @private\n * @memberof FileAttachmentAnnotationElement\n */\n _download() {\n this.downloadManager?.openOrDownloadData(\n this.container,\n this.content,\n this.filename\n );\n }\n}\n\n/**\n * @typedef {Object} AnnotationLayerParameters\n * @property {PageViewport} viewport\n * @property {HTMLDivElement} div\n * @property {Array} annotations\n * @property {PDFPage} page\n * @property {IPDFLinkService} linkService\n * @property {DownloadManager} downloadManager\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @property {boolean} renderInteractiveForms\n * @property {boolean} [enableScripting] - Enable embedded script execution.\n * @property {boolean} [hasJSActions] - Some fields have JS actions.\n * The default value is `false`.\n */\n\nclass AnnotationLayer {\n /**\n * Render a new annotation layer with all annotation elements.\n *\n * @public\n * @param {AnnotationLayerParameters} parameters\n * @memberof AnnotationLayer\n */\n static render(parameters) {\n const sortedAnnotations = [],\n popupAnnotations = [];\n // Ensure that Popup annotations are handled last, since they're dependant\n // upon the parent annotation having already been rendered (please refer to\n // the `PopupAnnotationElement.render` method); fixes issue 11362.\n for (const data of parameters.annotations) {\n if (!data) {\n continue;\n }\n if (data.annotationType === AnnotationType.POPUP) {\n popupAnnotations.push(data);\n continue;\n }\n sortedAnnotations.push(data);\n }\n if (popupAnnotations.length) {\n sortedAnnotations.push(...popupAnnotations);\n }\n\n for (const data of sortedAnnotations) {\n const element = AnnotationElementFactory.create({\n data,\n layer: parameters.div,\n page: parameters.page,\n viewport: parameters.viewport,\n linkService: parameters.linkService,\n downloadManager: parameters.downloadManager,\n imageResourcesPath: parameters.imageResourcesPath || \"\",\n renderInteractiveForms: parameters.renderInteractiveForms !== false,\n svgFactory: new DOMSVGFactory(),\n annotationStorage:\n parameters.annotationStorage || new AnnotationStorage(),\n enableScripting: parameters.enableScripting,\n hasJSActions: parameters.hasJSActions,\n mouseState: parameters.mouseState || { isDown: false },\n });\n if (element.isRenderable) {\n const rendered = element.render();\n if (data.hidden) {\n rendered.style.visibility = \"hidden\";\n }\n if (Array.isArray(rendered)) {\n for (const renderedElement of rendered) {\n parameters.div.appendChild(renderedElement);\n }\n } else {\n if (element instanceof PopupAnnotationElement) {\n // Popup annotation elements should not be on top of other\n // annotation elements to prevent interfering with mouse events.\n parameters.div.prepend(rendered);\n } else {\n parameters.div.appendChild(rendered);\n }\n }\n }\n }\n }\n\n /**\n * Update the annotation elements on existing annotation layer.\n *\n * @public\n * @param {AnnotationLayerParameters} parameters\n * @memberof AnnotationLayer\n */\n static update(parameters) {\n const transform = `matrix(${parameters.viewport.transform.join(\",\")})`;\n for (const data of parameters.annotations) {\n const elements = parameters.div.querySelectorAll(\n `[data-annotation-id=\"${data.id}\"]`\n );\n if (elements) {\n for (const element of elements) {\n element.style.transform = transform;\n }\n }\n }\n parameters.div.hidden = false;\n }\n}\n\nexport { AnnotationLayer };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * PLEASE NOTE: This file is currently imported in both the `../display/` and\n * `../scripting_api/` folders, hence be EXTREMELY careful about\n * introducing any dependencies here since that can lead to an\n * unexpected/unnecessary size increase of the *built* files.\n */\n\nfunction makeColorComp(n) {\n return Math.floor(Math.max(0, Math.min(1, n)) * 255)\n .toString(16)\n .padStart(2, \"0\");\n}\n\n// PDF specifications section 10.3\nclass ColorConverters {\n static CMYK_G([c, y, m, k]) {\n return [\"G\", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];\n }\n\n static G_CMYK([g]) {\n return [\"CMYK\", 0, 0, 0, 1 - g];\n }\n\n static G_RGB([g]) {\n return [\"RGB\", g, g, g];\n }\n\n static G_HTML([g]) {\n const G = makeColorComp(g);\n return `#${G}${G}${G}`;\n }\n\n static RGB_G([r, g, b]) {\n return [\"G\", 0.3 * r + 0.59 * g + 0.11 * b];\n }\n\n static RGB_HTML([r, g, b]) {\n const R = makeColorComp(r);\n const G = makeColorComp(g);\n const B = makeColorComp(b);\n return `#${R}${G}${B}`;\n }\n\n static T_HTML() {\n return \"#00000000\";\n }\n\n static CMYK_RGB([c, y, m, k]) {\n return [\n \"RGB\",\n 1 - Math.min(1, c + k),\n 1 - Math.min(1, m + k),\n 1 - Math.min(1, y + k),\n ];\n }\n\n static CMYK_HTML(components) {\n return this.RGB_HTML(this.CMYK_RGB(components));\n }\n\n static RGB_CMYK([r, g, b]) {\n const c = 1 - r;\n const m = 1 - g;\n const y = 1 - b;\n const k = Math.min(c, m, y);\n return [\"CMYK\", c, m, y, k];\n }\n}\n\nexport { ColorConverters };\n","/* Copyright 2015 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AbortException,\n createPromiseCapability,\n Util,\n} from \"../shared/util.js\";\n\n/**\n * Text layer render parameters.\n *\n * @typedef {Object} TextLayerRenderParameters\n * @property {import(\"./api\").TextContent} [textContent] - Text content to\n * render (the object is returned by the page's `getTextContent` method).\n * @property {ReadableStream} [textContentStream] - Text content stream to\n * render (the stream is returned by the page's `streamTextContent` method).\n * @property {HTMLElement} container - HTML element that will contain text runs.\n * @property {import(\"./display_utils\").PageViewport} viewport - The target\n * viewport to properly layout the text runs.\n * @property {Array<HTMLElement>} [textDivs] - HTML elements that are correspond\n * to the text items of the textContent input. This is output and shall be\n * initially be set to empty array.\n * @property {Array<string>} [textContentItemsStr] - Strings that correspond to\n * the `str` property of the text items of textContent input. This is output\n * and shall be initially be set to empty array.\n * @property {number} [timeout] - Delay in milliseconds before rendering of the\n * text runs occurs.\n * @property {boolean} [enhanceTextSelection] - Whether to turn on the text\n * selection enhancement.\n */\n\nconst MAX_TEXT_DIVS_TO_RENDER = 100000;\nconst DEFAULT_FONT_SIZE = 30;\nconst DEFAULT_FONT_ASCENT = 0.8;\nconst ascentCache = new Map();\nconst AllWhitespaceRegexp = /^\\s+$/g;\n\nfunction getAscent(fontFamily, ctx) {\n const cachedAscent = ascentCache.get(fontFamily);\n if (cachedAscent) {\n return cachedAscent;\n }\n\n ctx.save();\n ctx.font = `${DEFAULT_FONT_SIZE}px ${fontFamily}`;\n const metrics = ctx.measureText(\"\");\n\n // Both properties aren't available by default in Firefox.\n let ascent = metrics.fontBoundingBoxAscent;\n let descent = Math.abs(metrics.fontBoundingBoxDescent);\n if (ascent) {\n ctx.restore();\n const ratio = ascent / (ascent + descent);\n ascentCache.set(fontFamily, ratio);\n return ratio;\n }\n\n // Try basic heuristic to guess ascent/descent.\n // Draw a g with baseline at 0,0 and then get the line\n // number where a pixel has non-null red component (starting\n // from bottom).\n ctx.strokeStyle = \"red\";\n ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);\n ctx.strokeText(\"g\", 0, 0);\n let pixels = ctx.getImageData(\n 0,\n 0,\n DEFAULT_FONT_SIZE,\n DEFAULT_FONT_SIZE\n ).data;\n descent = 0;\n for (let i = pixels.length - 1 - 3; i >= 0; i -= 4) {\n if (pixels[i] > 0) {\n descent = Math.ceil(i / 4 / DEFAULT_FONT_SIZE);\n break;\n }\n }\n\n // Draw an A with baseline at 0,DEFAULT_FONT_SIZE and then get the line\n // number where a pixel has non-null red component (starting\n // from top).\n ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);\n ctx.strokeText(\"A\", 0, DEFAULT_FONT_SIZE);\n pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;\n ascent = 0;\n for (let i = 0, ii = pixels.length; i < ii; i += 4) {\n if (pixels[i] > 0) {\n ascent = DEFAULT_FONT_SIZE - Math.floor(i / 4 / DEFAULT_FONT_SIZE);\n break;\n }\n }\n\n ctx.restore();\n\n if (ascent) {\n const ratio = ascent / (ascent + descent);\n ascentCache.set(fontFamily, ratio);\n return ratio;\n }\n\n ascentCache.set(fontFamily, DEFAULT_FONT_ASCENT);\n return DEFAULT_FONT_ASCENT;\n}\n\nfunction appendText(task, geom, styles, ctx) {\n // Initialize all used properties to keep the caches monomorphic.\n const textDiv = document.createElement(\"span\");\n const textDivProperties = {\n angle: 0,\n canvasWidth: 0,\n hasText: geom.str !== \"\",\n hasEOL: geom.hasEOL,\n originalTransform: null,\n paddingBottom: 0,\n paddingLeft: 0,\n paddingRight: 0,\n paddingTop: 0,\n scale: 1,\n };\n\n task._textDivs.push(textDiv);\n\n const tx = Util.transform(task._viewport.transform, geom.transform);\n let angle = Math.atan2(tx[1], tx[0]);\n const style = styles[geom.fontName];\n if (style.vertical) {\n angle += Math.PI / 2;\n }\n const fontHeight = Math.hypot(tx[2], tx[3]);\n const fontAscent = fontHeight * getAscent(style.fontFamily, ctx);\n\n let left, top;\n if (angle === 0) {\n left = tx[4];\n top = tx[5] - fontAscent;\n } else {\n left = tx[4] + fontAscent * Math.sin(angle);\n top = tx[5] - fontAscent * Math.cos(angle);\n }\n // Setting the style properties individually, rather than all at once,\n // should be OK since the `textDiv` isn't appended to the document yet.\n textDiv.style.left = `${left}px`;\n textDiv.style.top = `${top}px`;\n textDiv.style.fontSize = `${fontHeight}px`;\n textDiv.style.fontFamily = style.fontFamily;\n\n // Keeps screen readers from pausing on every new text span.\n textDiv.setAttribute(\"role\", \"presentation\");\n\n textDiv.textContent = geom.str;\n // geom.dir may be 'ttb' for vertical texts.\n textDiv.dir = geom.dir;\n\n // `fontName` is only used by the FontInspector, and we only use `dataset`\n // here to make the font name available in the debugger.\n if (task._fontInspectorEnabled) {\n textDiv.dataset.fontName = geom.fontName;\n }\n if (angle !== 0) {\n textDivProperties.angle = angle * (180 / Math.PI);\n }\n // We don't bother scaling single-char text divs, because it has very\n // little effect on text highlighting. This makes scrolling on docs with\n // lots of such divs a lot faster.\n let shouldScaleText = false;\n if (\n geom.str.length > 1 ||\n (task._enhanceTextSelection && AllWhitespaceRegexp.test(geom.str))\n ) {\n shouldScaleText = true;\n } else if (geom.transform[0] !== geom.transform[3]) {\n const absScaleX = Math.abs(geom.transform[0]),\n absScaleY = Math.abs(geom.transform[3]);\n // When the horizontal/vertical scaling differs significantly, also scale\n // even single-char text to improve highlighting (fixes issue11713.pdf).\n if (\n absScaleX !== absScaleY &&\n Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5\n ) {\n shouldScaleText = true;\n }\n }\n if (shouldScaleText) {\n if (style.vertical) {\n textDivProperties.canvasWidth = geom.height * task._viewport.scale;\n } else {\n textDivProperties.canvasWidth = geom.width * task._viewport.scale;\n }\n }\n task._textDivProperties.set(textDiv, textDivProperties);\n if (task._textContentStream) {\n task._layoutText(textDiv);\n }\n\n if (task._enhanceTextSelection && textDivProperties.hasText) {\n let angleCos = 1,\n angleSin = 0;\n if (angle !== 0) {\n angleCos = Math.cos(angle);\n angleSin = Math.sin(angle);\n }\n const divWidth =\n (style.vertical ? geom.height : geom.width) * task._viewport.scale;\n const divHeight = fontHeight;\n\n let m, b;\n if (angle !== 0) {\n m = [angleCos, angleSin, -angleSin, angleCos, left, top];\n b = Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m);\n } else {\n b = [left, top, left + divWidth, top + divHeight];\n }\n\n task._bounds.push({\n left: b[0],\n top: b[1],\n right: b[2],\n bottom: b[3],\n div: textDiv,\n size: [divWidth, divHeight],\n m,\n });\n }\n}\n\nfunction render(task) {\n if (task._canceled) {\n return;\n }\n const textDivs = task._textDivs;\n const capability = task._capability;\n const textDivsLength = textDivs.length;\n\n // No point in rendering many divs as it would make the browser\n // unusable even after the divs are rendered.\n if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) {\n task._renderingDone = true;\n capability.resolve();\n return;\n }\n\n if (!task._textContentStream) {\n for (let i = 0; i < textDivsLength; i++) {\n task._layoutText(textDivs[i]);\n }\n }\n\n task._renderingDone = true;\n capability.resolve();\n}\n\nfunction findPositiveMin(ts, offset, count) {\n let result = 0;\n for (let i = 0; i < count; i++) {\n const t = ts[offset++];\n if (t > 0) {\n result = result ? Math.min(t, result) : t;\n }\n }\n return result;\n}\n\nfunction expand(task) {\n const bounds = task._bounds;\n const viewport = task._viewport;\n\n const expanded = expandBounds(viewport.width, viewport.height, bounds);\n for (let i = 0; i < expanded.length; i++) {\n const div = bounds[i].div;\n const divProperties = task._textDivProperties.get(div);\n if (divProperties.angle === 0) {\n divProperties.paddingLeft = bounds[i].left - expanded[i].left;\n divProperties.paddingTop = bounds[i].top - expanded[i].top;\n divProperties.paddingRight = expanded[i].right - bounds[i].right;\n divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom;\n task._textDivProperties.set(div, divProperties);\n continue;\n }\n // Box is rotated -- trying to find padding so rotated div will not\n // exceed its expanded bounds.\n const e = expanded[i],\n b = bounds[i];\n const m = b.m,\n c = m[0],\n s = m[1];\n // Finding intersections with expanded box.\n const points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size];\n const ts = new Float64Array(64);\n for (let j = 0, jj = points.length; j < jj; j++) {\n const t = Util.applyTransform(points[j], m);\n ts[j + 0] = c && (e.left - t[0]) / c;\n ts[j + 4] = s && (e.top - t[1]) / s;\n ts[j + 8] = c && (e.right - t[0]) / c;\n ts[j + 12] = s && (e.bottom - t[1]) / s;\n\n ts[j + 16] = s && (e.left - t[0]) / -s;\n ts[j + 20] = c && (e.top - t[1]) / c;\n ts[j + 24] = s && (e.right - t[0]) / -s;\n ts[j + 28] = c && (e.bottom - t[1]) / c;\n\n ts[j + 32] = c && (e.left - t[0]) / -c;\n ts[j + 36] = s && (e.top - t[1]) / -s;\n ts[j + 40] = c && (e.right - t[0]) / -c;\n ts[j + 44] = s && (e.bottom - t[1]) / -s;\n\n ts[j + 48] = s && (e.left - t[0]) / s;\n ts[j + 52] = c && (e.top - t[1]) / -c;\n ts[j + 56] = s && (e.right - t[0]) / s;\n ts[j + 60] = c && (e.bottom - t[1]) / -c;\n }\n // Not based on math, but to simplify calculations, using cos and sin\n // absolute values to not exceed the box (it can but insignificantly).\n const boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));\n divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale;\n divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale;\n divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale;\n divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale;\n task._textDivProperties.set(div, divProperties);\n }\n}\n\nfunction expandBounds(width, height, boxes) {\n const bounds = boxes.map(function (box, i) {\n return {\n x1: box.left,\n y1: box.top,\n x2: box.right,\n y2: box.bottom,\n index: i,\n x1New: undefined,\n x2New: undefined,\n };\n });\n expandBoundsLTR(width, bounds);\n\n const expanded = new Array(boxes.length);\n for (const b of bounds) {\n const i = b.index;\n expanded[i] = {\n left: b.x1New,\n top: 0,\n right: b.x2New,\n bottom: 0,\n };\n }\n\n // Rotating on 90 degrees and extending extended boxes. Reusing the bounds\n // array and objects.\n boxes.map(function (box, i) {\n const e = expanded[i],\n b = bounds[i];\n b.x1 = box.top;\n b.y1 = width - e.right;\n b.x2 = box.bottom;\n b.y2 = width - e.left;\n b.index = i;\n b.x1New = undefined;\n b.x2New = undefined;\n });\n expandBoundsLTR(height, bounds);\n\n for (const b of bounds) {\n const i = b.index;\n expanded[i].top = b.x1New;\n expanded[i].bottom = b.x2New;\n }\n return expanded;\n}\n\nfunction expandBoundsLTR(width, bounds) {\n // Sorting by x1 coordinate and walk by the bounds in the same order.\n bounds.sort(function (a, b) {\n return a.x1 - b.x1 || a.index - b.index;\n });\n\n // First we see on the horizon is a fake boundary.\n const fakeBoundary = {\n x1: -Infinity,\n y1: -Infinity,\n x2: 0,\n y2: Infinity,\n index: -1,\n x1New: 0,\n x2New: 0,\n };\n const horizon = [\n {\n start: -Infinity,\n end: Infinity,\n boundary: fakeBoundary,\n },\n ];\n\n for (const boundary of bounds) {\n // Searching for the affected part of horizon.\n // TODO red-black tree or simple binary search\n let i = 0;\n while (i < horizon.length && horizon[i].end <= boundary.y1) {\n i++;\n }\n let j = horizon.length - 1;\n while (j >= 0 && horizon[j].start >= boundary.y2) {\n j--;\n }\n\n let horizonPart, affectedBoundary;\n let q,\n k,\n maxXNew = -Infinity;\n for (q = i; q <= j; q++) {\n horizonPart = horizon[q];\n affectedBoundary = horizonPart.boundary;\n let xNew;\n if (affectedBoundary.x2 > boundary.x1) {\n // In the middle of the previous element, new x shall be at the\n // boundary start. Extending if further if the affected boundary\n // placed on top of the current one.\n xNew =\n affectedBoundary.index > boundary.index\n ? affectedBoundary.x1New\n : boundary.x1;\n } else if (affectedBoundary.x2New === undefined) {\n // We have some space in between, new x in middle will be a fair\n // choice.\n xNew = (affectedBoundary.x2 + boundary.x1) / 2;\n } else {\n // Affected boundary has x2new set, using it as new x.\n xNew = affectedBoundary.x2New;\n }\n if (xNew > maxXNew) {\n maxXNew = xNew;\n }\n }\n\n // Set new x1 for current boundary.\n boundary.x1New = maxXNew;\n\n // Adjusts new x2 for the affected boundaries.\n for (q = i; q <= j; q++) {\n horizonPart = horizon[q];\n affectedBoundary = horizonPart.boundary;\n if (affectedBoundary.x2New === undefined) {\n // Was not set yet, choosing new x if possible.\n if (affectedBoundary.x2 > boundary.x1) {\n // Current and affected boundaries intersect. If affected boundary\n // is placed on top of the current, shrinking the affected.\n if (affectedBoundary.index > boundary.index) {\n affectedBoundary.x2New = affectedBoundary.x2;\n }\n } else {\n affectedBoundary.x2New = maxXNew;\n }\n } else if (affectedBoundary.x2New > maxXNew) {\n // Affected boundary is touching new x, pushing it back.\n affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2);\n }\n }\n\n // Fixing the horizon.\n const changedHorizon = [];\n let lastBoundary = null;\n for (q = i; q <= j; q++) {\n horizonPart = horizon[q];\n affectedBoundary = horizonPart.boundary;\n // Checking which boundary will be visible.\n const useBoundary =\n affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary;\n if (lastBoundary === useBoundary) {\n // Merging with previous.\n changedHorizon[changedHorizon.length - 1].end = horizonPart.end;\n } else {\n changedHorizon.push({\n start: horizonPart.start,\n end: horizonPart.end,\n boundary: useBoundary,\n });\n lastBoundary = useBoundary;\n }\n }\n if (horizon[i].start < boundary.y1) {\n changedHorizon[0].start = boundary.y1;\n changedHorizon.unshift({\n start: horizon[i].start,\n end: boundary.y1,\n boundary: horizon[i].boundary,\n });\n }\n if (boundary.y2 < horizon[j].end) {\n changedHorizon[changedHorizon.length - 1].end = boundary.y2;\n changedHorizon.push({\n start: boundary.y2,\n end: horizon[j].end,\n boundary: horizon[j].boundary,\n });\n }\n\n // Set x2 new of boundary that is no longer visible (see overlapping case\n // above).\n // TODO more efficient, e.g. via reference counting.\n for (q = i; q <= j; q++) {\n horizonPart = horizon[q];\n affectedBoundary = horizonPart.boundary;\n if (affectedBoundary.x2New !== undefined) {\n continue;\n }\n let used = false;\n for (\n k = i - 1;\n !used && k >= 0 && horizon[k].start >= affectedBoundary.y1;\n k--\n ) {\n used = horizon[k].boundary === affectedBoundary;\n }\n for (\n k = j + 1;\n !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2;\n k++\n ) {\n used = horizon[k].boundary === affectedBoundary;\n }\n for (k = 0; !used && k < changedHorizon.length; k++) {\n used = changedHorizon[k].boundary === affectedBoundary;\n }\n if (!used) {\n affectedBoundary.x2New = maxXNew;\n }\n }\n\n Array.prototype.splice.apply(\n horizon,\n [i, j - i + 1].concat(changedHorizon)\n );\n }\n\n // Set new x2 for all unset boundaries.\n for (const horizonPart of horizon) {\n const affectedBoundary = horizonPart.boundary;\n if (affectedBoundary.x2New === undefined) {\n affectedBoundary.x2New = Math.max(width, affectedBoundary.x2);\n }\n }\n}\n\nclass TextLayerRenderTask {\n constructor({\n textContent,\n textContentStream,\n container,\n viewport,\n textDivs,\n textContentItemsStr,\n enhanceTextSelection,\n }) {\n this._textContent = textContent;\n this._textContentStream = textContentStream;\n this._container = container;\n this._document = container.ownerDocument;\n this._viewport = viewport;\n this._textDivs = textDivs || [];\n this._textContentItemsStr = textContentItemsStr || [];\n this._enhanceTextSelection = !!enhanceTextSelection;\n this._fontInspectorEnabled = !!globalThis.FontInspector?.enabled;\n\n this._reader = null;\n this._layoutTextLastFontSize = null;\n this._layoutTextLastFontFamily = null;\n this._layoutTextCtx = null;\n this._textDivProperties = new WeakMap();\n this._renderingDone = false;\n this._canceled = false;\n this._capability = createPromiseCapability();\n this._renderTimer = null;\n this._bounds = [];\n\n // Always clean-up the temporary canvas once rendering is no longer pending.\n this._capability.promise\n .finally(() => {\n if (this._layoutTextCtx) {\n // Zeroing the width and height cause Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n this._layoutTextCtx.canvas.width = 0;\n this._layoutTextCtx.canvas.height = 0;\n this._layoutTextCtx = null;\n }\n })\n .catch(() => {\n /* Avoid \"Uncaught promise\" messages in the console. */\n });\n }\n\n /**\n * Promise for textLayer rendering task completion.\n * @type {Promise<void>}\n */\n get promise() {\n return this._capability.promise;\n }\n\n /**\n * Cancel rendering of the textLayer.\n */\n cancel() {\n this._canceled = true;\n if (this._reader) {\n this._reader.cancel(new AbortException(\"TextLayer task cancelled.\"));\n this._reader = null;\n }\n if (this._renderTimer !== null) {\n clearTimeout(this._renderTimer);\n this._renderTimer = null;\n }\n this._capability.reject(new Error(\"TextLayer task cancelled.\"));\n }\n\n /**\n * @private\n */\n _processItems(items, styleCache) {\n for (let i = 0, len = items.length; i < len; i++) {\n if (items[i].str === undefined) {\n if (\n items[i].type === \"beginMarkedContentProps\" ||\n items[i].type === \"beginMarkedContent\"\n ) {\n const parent = this._container;\n this._container = document.createElement(\"span\");\n this._container.classList.add(\"markedContent\");\n if (items[i].id !== null) {\n this._container.setAttribute(\"id\", `${items[i].id}`);\n }\n parent.appendChild(this._container);\n } else if (items[i].type === \"endMarkedContent\") {\n this._container = this._container.parentNode;\n }\n continue;\n }\n this._textContentItemsStr.push(items[i].str);\n appendText(this, items[i], styleCache, this._layoutTextCtx);\n }\n }\n\n /**\n * @private\n */\n _layoutText(textDiv) {\n const textDivProperties = this._textDivProperties.get(textDiv);\n\n let transform = \"\";\n if (textDivProperties.canvasWidth !== 0 && textDivProperties.hasText) {\n const { fontSize, fontFamily } = textDiv.style;\n\n // Only build font string and set to context if different from last.\n if (\n fontSize !== this._layoutTextLastFontSize ||\n fontFamily !== this._layoutTextLastFontFamily\n ) {\n this._layoutTextCtx.font = `${fontSize} ${fontFamily}`;\n this._layoutTextLastFontSize = fontSize;\n this._layoutTextLastFontFamily = fontFamily;\n }\n // Only measure the width for multi-char text divs, see `appendText`.\n const { width } = this._layoutTextCtx.measureText(textDiv.textContent);\n\n if (width > 0) {\n textDivProperties.scale = textDivProperties.canvasWidth / width;\n transform = `scaleX(${textDivProperties.scale})`;\n }\n }\n if (textDivProperties.angle !== 0) {\n transform = `rotate(${textDivProperties.angle}deg) ${transform}`;\n }\n if (transform.length > 0) {\n if (this._enhanceTextSelection) {\n textDivProperties.originalTransform = transform;\n }\n textDiv.style.transform = transform;\n }\n\n if (textDivProperties.hasText) {\n this._container.appendChild(textDiv);\n }\n if (textDivProperties.hasEOL) {\n const br = document.createElement(\"br\");\n br.setAttribute(\"role\", \"presentation\");\n this._container.appendChild(br);\n }\n }\n\n /**\n * @private\n */\n _render(timeout = 0) {\n const capability = createPromiseCapability();\n let styleCache = Object.create(null);\n\n // The temporary canvas is used to measure text length in the DOM.\n const canvas = this._document.createElement(\"canvas\");\n canvas.height = canvas.width = DEFAULT_FONT_SIZE;\n\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"MOZCENTRAL || GENERIC\")\n ) {\n canvas.mozOpaque = true;\n }\n this._layoutTextCtx = canvas.getContext(\"2d\", { alpha: false });\n\n if (this._textContent) {\n const textItems = this._textContent.items;\n const textStyles = this._textContent.styles;\n this._processItems(textItems, textStyles);\n capability.resolve();\n } else if (this._textContentStream) {\n const pump = () => {\n this._reader.read().then(({ value, done }) => {\n if (done) {\n capability.resolve();\n return;\n }\n\n Object.assign(styleCache, value.styles);\n this._processItems(value.items, styleCache);\n pump();\n }, capability.reject);\n };\n\n this._reader = this._textContentStream.getReader();\n pump();\n } else {\n throw new Error(\n 'Neither \"textContent\" nor \"textContentStream\"' +\n \" parameters specified.\"\n );\n }\n\n capability.promise.then(() => {\n styleCache = null;\n if (!timeout) {\n // Render right away\n render(this);\n } else {\n // Schedule\n this._renderTimer = setTimeout(() => {\n render(this);\n this._renderTimer = null;\n }, timeout);\n }\n }, this._capability.reject);\n }\n\n /**\n * @param {boolean} [expandDivs]\n */\n expandTextDivs(expandDivs = false) {\n if (!this._enhanceTextSelection || !this._renderingDone) {\n return;\n }\n if (this._bounds !== null) {\n expand(this);\n this._bounds = null;\n }\n const transformBuf = [],\n paddingBuf = [];\n\n for (let i = 0, ii = this._textDivs.length; i < ii; i++) {\n const div = this._textDivs[i];\n const divProps = this._textDivProperties.get(div);\n\n if (!divProps.hasText) {\n continue;\n }\n if (expandDivs) {\n transformBuf.length = 0;\n paddingBuf.length = 0;\n\n if (divProps.originalTransform) {\n transformBuf.push(divProps.originalTransform);\n }\n if (divProps.paddingTop > 0) {\n paddingBuf.push(`${divProps.paddingTop}px`);\n transformBuf.push(`translateY(${-divProps.paddingTop}px)`);\n } else {\n paddingBuf.push(0);\n }\n if (divProps.paddingRight > 0) {\n paddingBuf.push(`${divProps.paddingRight / divProps.scale}px`);\n } else {\n paddingBuf.push(0);\n }\n if (divProps.paddingBottom > 0) {\n paddingBuf.push(`${divProps.paddingBottom}px`);\n } else {\n paddingBuf.push(0);\n }\n if (divProps.paddingLeft > 0) {\n paddingBuf.push(`${divProps.paddingLeft / divProps.scale}px`);\n transformBuf.push(\n `translateX(${-divProps.paddingLeft / divProps.scale}px)`\n );\n } else {\n paddingBuf.push(0);\n }\n\n div.style.padding = paddingBuf.join(\" \");\n if (transformBuf.length) {\n div.style.transform = transformBuf.join(\" \");\n }\n } else {\n div.style.padding = null;\n div.style.transform = divProps.originalTransform;\n }\n }\n }\n}\n\n/**\n * @param {TextLayerRenderParameters} renderParameters\n * @returns {TextLayerRenderTask}\n */\nfunction renderTextLayer(renderParameters) {\n const task = new TextLayerRenderTask({\n textContent: renderParameters.textContent,\n textContentStream: renderParameters.textContentStream,\n container: renderParameters.container,\n viewport: renderParameters.viewport,\n textDivs: renderParameters.textDivs,\n textContentItemsStr: renderParameters.textContentItemsStr,\n enhanceTextSelection: renderParameters.enhanceTextSelection,\n });\n task._render(renderParameters.timeout);\n return task;\n}\n\nexport { renderTextLayer };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals __non_webpack_require__ */\n\nimport {\n createObjectURL,\n FONT_IDENTITY_MATRIX,\n IDENTITY_MATRIX,\n ImageKind,\n isNum,\n OPS,\n TextRenderingMode,\n unreachable,\n Util,\n warn,\n} from \"../shared/util.js\";\nimport { DOMSVGFactory } from \"./display_utils.js\";\nimport { isNodeJS } from \"../shared/is_node.js\";\n\n/** @type {any} */\nlet SVGGraphics = class {\n constructor() {\n unreachable(\"Not implemented: SVGGraphics\");\n }\n};\n\nif (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n) {\n const SVG_DEFAULTS = {\n fontStyle: \"normal\",\n fontWeight: \"normal\",\n fillColor: \"#000000\",\n };\n const XML_NS = \"http://www.w3.org/XML/1998/namespace\";\n const XLINK_NS = \"http://www.w3.org/1999/xlink\";\n const LINE_CAP_STYLES = [\"butt\", \"round\", \"square\"];\n const LINE_JOIN_STYLES = [\"miter\", \"round\", \"bevel\"];\n\n const convertImgDataToPng = (function () {\n const PNG_HEADER = new Uint8Array([\n 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,\n ]);\n const CHUNK_WRAPPER_SIZE = 12;\n\n const crcTable = new Int32Array(256);\n for (let i = 0; i < 256; i++) {\n let c = i;\n for (let h = 0; h < 8; h++) {\n if (c & 1) {\n c = 0xedb88320 ^ ((c >> 1) & 0x7fffffff);\n } else {\n c = (c >> 1) & 0x7fffffff;\n }\n }\n crcTable[i] = c;\n }\n\n function crc32(data, start, end) {\n let crc = -1;\n for (let i = start; i < end; i++) {\n const a = (crc ^ data[i]) & 0xff;\n const b = crcTable[a];\n crc = (crc >>> 8) ^ b;\n }\n return crc ^ -1;\n }\n\n function writePngChunk(type, body, data, offset) {\n let p = offset;\n const len = body.length;\n\n data[p] = (len >> 24) & 0xff;\n data[p + 1] = (len >> 16) & 0xff;\n data[p + 2] = (len >> 8) & 0xff;\n data[p + 3] = len & 0xff;\n p += 4;\n\n data[p] = type.charCodeAt(0) & 0xff;\n data[p + 1] = type.charCodeAt(1) & 0xff;\n data[p + 2] = type.charCodeAt(2) & 0xff;\n data[p + 3] = type.charCodeAt(3) & 0xff;\n p += 4;\n\n data.set(body, p);\n p += body.length;\n\n const crc = crc32(data, offset + 4, p);\n data[p] = (crc >> 24) & 0xff;\n data[p + 1] = (crc >> 16) & 0xff;\n data[p + 2] = (crc >> 8) & 0xff;\n data[p + 3] = crc & 0xff;\n }\n\n function adler32(data, start, end) {\n let a = 1;\n let b = 0;\n for (let i = start; i < end; ++i) {\n a = (a + (data[i] & 0xff)) % 65521;\n b = (b + a) % 65521;\n }\n return (b << 16) | a;\n }\n\n /**\n * @param {Uint8Array} literals The input data.\n * @returns {Uint8Array} The DEFLATE-compressed data stream in zlib format.\n * This is the required format for compressed streams in the PNG format:\n * http://www.libpng.org/pub/png/spec/1.2/PNG-Compression.html\n */\n function deflateSync(literals) {\n if (!isNodeJS) {\n // zlib is certainly not available outside of Node.js. We can either use\n // the pako library for client-side DEFLATE compression, or use the\n // canvas API of the browser to obtain a more optimal PNG file.\n return deflateSyncUncompressed(literals);\n }\n try {\n // NOTE: This implementation is far from perfect, but already way better\n // than not applying any compression.\n //\n // A better algorithm will try to choose a good predictor/filter and\n // then choose a suitable zlib compression strategy (e.g. 3,Z_RLE).\n //\n // Node v0.11.12 zlib.deflateSync is introduced (and returns a Buffer).\n // Node v3.0.0 Buffer inherits from Uint8Array.\n // Node v8.0.0 zlib.deflateSync accepts Uint8Array as input.\n let input;\n // eslint-disable-next-line no-undef\n if (parseInt(process.versions.node) >= 8) {\n input = literals;\n } else {\n // eslint-disable-next-line no-undef\n input = Buffer.from(literals);\n }\n const output = __non_webpack_require__(\"zlib\").deflateSync(input, {\n level: 9,\n });\n return output instanceof Uint8Array ? output : new Uint8Array(output);\n } catch (e) {\n warn(\n \"Not compressing PNG because zlib.deflateSync is unavailable: \" + e\n );\n }\n\n return deflateSyncUncompressed(literals);\n }\n\n // An implementation of DEFLATE with compression level 0 (Z_NO_COMPRESSION).\n function deflateSyncUncompressed(literals) {\n let len = literals.length;\n const maxBlockLength = 0xffff;\n\n const deflateBlocks = Math.ceil(len / maxBlockLength);\n const idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4);\n let pi = 0;\n idat[pi++] = 0x78; // compression method and flags\n idat[pi++] = 0x9c; // flags\n\n let pos = 0;\n while (len > maxBlockLength) {\n // writing non-final DEFLATE blocks type 0 and length of 65535\n idat[pi++] = 0x00;\n idat[pi++] = 0xff;\n idat[pi++] = 0xff;\n idat[pi++] = 0x00;\n idat[pi++] = 0x00;\n idat.set(literals.subarray(pos, pos + maxBlockLength), pi);\n pi += maxBlockLength;\n pos += maxBlockLength;\n len -= maxBlockLength;\n }\n\n // writing non-final DEFLATE blocks type 0\n idat[pi++] = 0x01;\n idat[pi++] = len & 0xff;\n idat[pi++] = (len >> 8) & 0xff;\n idat[pi++] = ~len & 0xffff & 0xff;\n idat[pi++] = ((~len & 0xffff) >> 8) & 0xff;\n idat.set(literals.subarray(pos), pi);\n pi += literals.length - pos;\n\n const adler = adler32(literals, 0, literals.length); // checksum\n idat[pi++] = (adler >> 24) & 0xff;\n idat[pi++] = (adler >> 16) & 0xff;\n idat[pi++] = (adler >> 8) & 0xff;\n idat[pi++] = adler & 0xff;\n return idat;\n }\n\n function encode(imgData, kind, forceDataSchema, isMask) {\n const width = imgData.width;\n const height = imgData.height;\n let bitDepth, colorType, lineSize;\n const bytes = imgData.data;\n\n switch (kind) {\n case ImageKind.GRAYSCALE_1BPP:\n colorType = 0;\n bitDepth = 1;\n lineSize = (width + 7) >> 3;\n break;\n case ImageKind.RGB_24BPP:\n colorType = 2;\n bitDepth = 8;\n lineSize = width * 3;\n break;\n case ImageKind.RGBA_32BPP:\n colorType = 6;\n bitDepth = 8;\n lineSize = width * 4;\n break;\n default:\n throw new Error(\"invalid format\");\n }\n\n // prefix every row with predictor 0\n const literals = new Uint8Array((1 + lineSize) * height);\n let offsetLiterals = 0,\n offsetBytes = 0;\n for (let y = 0; y < height; ++y) {\n literals[offsetLiterals++] = 0; // no prediction\n literals.set(\n bytes.subarray(offsetBytes, offsetBytes + lineSize),\n offsetLiterals\n );\n offsetBytes += lineSize;\n offsetLiterals += lineSize;\n }\n\n if (kind === ImageKind.GRAYSCALE_1BPP && isMask) {\n // inverting for image masks\n offsetLiterals = 0;\n for (let y = 0; y < height; y++) {\n offsetLiterals++; // skipping predictor\n for (let i = 0; i < lineSize; i++) {\n literals[offsetLiterals++] ^= 0xff;\n }\n }\n }\n\n const ihdr = new Uint8Array([\n (width >> 24) & 0xff,\n (width >> 16) & 0xff,\n (width >> 8) & 0xff,\n width & 0xff,\n (height >> 24) & 0xff,\n (height >> 16) & 0xff,\n (height >> 8) & 0xff,\n height & 0xff,\n bitDepth, // bit depth\n colorType, // color type\n 0x00, // compression method\n 0x00, // filter method\n 0x00, // interlace method\n ]);\n const idat = deflateSync(literals);\n\n // PNG consists of: header, IHDR+data, IDAT+data, and IEND.\n const pngLength =\n PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length;\n const data = new Uint8Array(pngLength);\n let offset = 0;\n data.set(PNG_HEADER, offset);\n offset += PNG_HEADER.length;\n writePngChunk(\"IHDR\", ihdr, data, offset);\n offset += CHUNK_WRAPPER_SIZE + ihdr.length;\n writePngChunk(\"IDATA\", idat, data, offset);\n offset += CHUNK_WRAPPER_SIZE + idat.length;\n writePngChunk(\"IEND\", new Uint8Array(0), data, offset);\n\n return createObjectURL(data, \"image/png\", forceDataSchema);\n }\n\n // eslint-disable-next-line no-shadow\n return function convertImgDataToPng(imgData, forceDataSchema, isMask) {\n const kind =\n imgData.kind === undefined ? ImageKind.GRAYSCALE_1BPP : imgData.kind;\n return encode(imgData, kind, forceDataSchema, isMask);\n };\n })();\n\n class SVGExtraState {\n constructor() {\n this.fontSizeScale = 1;\n this.fontWeight = SVG_DEFAULTS.fontWeight;\n this.fontSize = 0;\n\n this.textMatrix = IDENTITY_MATRIX;\n this.fontMatrix = FONT_IDENTITY_MATRIX;\n this.leading = 0;\n this.textRenderingMode = TextRenderingMode.FILL;\n this.textMatrixScale = 1;\n\n // Current point (in user coordinates)\n this.x = 0;\n this.y = 0;\n\n // Start of text line (in text coordinates)\n this.lineX = 0;\n this.lineY = 0;\n\n // Character and word spacing\n this.charSpacing = 0;\n this.wordSpacing = 0;\n this.textHScale = 1;\n this.textRise = 0;\n\n // Default foreground and background colors\n this.fillColor = SVG_DEFAULTS.fillColor;\n this.strokeColor = \"#000000\";\n\n this.fillAlpha = 1;\n this.strokeAlpha = 1;\n this.lineWidth = 1;\n this.lineJoin = \"\";\n this.lineCap = \"\";\n this.miterLimit = 0;\n\n this.dashArray = [];\n this.dashPhase = 0;\n\n this.dependencies = [];\n\n // Clipping\n this.activeClipUrl = null;\n this.clipGroup = null;\n\n this.maskId = \"\";\n }\n\n clone() {\n return Object.create(this);\n }\n\n setCurrentPoint(x, y) {\n this.x = x;\n this.y = y;\n }\n }\n\n // eslint-disable-next-line no-inner-declarations\n function opListToTree(opList) {\n let opTree = [];\n const tmp = [];\n\n for (const opListElement of opList) {\n if (opListElement.fn === \"save\") {\n opTree.push({ fnId: 92, fn: \"group\", items: [] });\n tmp.push(opTree);\n opTree = opTree[opTree.length - 1].items;\n continue;\n }\n\n if (opListElement.fn === \"restore\") {\n opTree = tmp.pop();\n } else {\n opTree.push(opListElement);\n }\n }\n return opTree;\n }\n\n /**\n * Format a float number as a string.\n *\n * @param value {number} - The float number to format.\n * @returns {string}\n */\n // eslint-disable-next-line no-inner-declarations\n function pf(value) {\n if (Number.isInteger(value)) {\n return value.toString();\n }\n const s = value.toFixed(10);\n let i = s.length - 1;\n if (s[i] !== \"0\") {\n return s;\n }\n\n // Remove trailing zeros.\n do {\n i--;\n } while (s[i] === \"0\");\n return s.substring(0, s[i] === \".\" ? i : i + 1);\n }\n\n /**\n * Format a transform matrix as a string. The standard rotation, scale and\n * translation matrices are replaced by their shorter forms, and for\n * identity matrices an empty string is returned to save memory.\n *\n * @param m {Array} - The transform matrix to format.\n * @returns {string}\n */\n // eslint-disable-next-line no-inner-declarations\n function pm(m) {\n if (m[4] === 0 && m[5] === 0) {\n if (m[1] === 0 && m[2] === 0) {\n if (m[0] === 1 && m[3] === 1) {\n return \"\";\n }\n return `scale(${pf(m[0])} ${pf(m[3])})`;\n }\n if (m[0] === m[3] && m[1] === -m[2]) {\n const a = (Math.acos(m[0]) * 180) / Math.PI;\n return `rotate(${pf(a)})`;\n }\n } else {\n if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) {\n return `translate(${pf(m[4])} ${pf(m[5])})`;\n }\n }\n return (\n `matrix(${pf(m[0])} ${pf(m[1])} ${pf(m[2])} ${pf(m[3])} ${pf(m[4])} ` +\n `${pf(m[5])})`\n );\n }\n\n // The counts below are relevant for all pages, so they have to be global\n // instead of being members of `SVGGraphics` (which is recreated for\n // each page).\n let clipCount = 0;\n let maskCount = 0;\n let shadingCount = 0;\n\n SVGGraphics = class {\n constructor(commonObjs, objs, forceDataSchema = false) {\n this.svgFactory = new DOMSVGFactory();\n\n this.current = new SVGExtraState();\n this.transformMatrix = IDENTITY_MATRIX; // Graphics state matrix\n this.transformStack = [];\n this.extraStack = [];\n this.commonObjs = commonObjs;\n this.objs = objs;\n this.pendingClip = null;\n this.pendingEOFill = false;\n\n this.embedFonts = false;\n this.embeddedFonts = Object.create(null);\n this.cssStyle = null;\n this.forceDataSchema = !!forceDataSchema;\n\n // In `src/shared/util.js` the operator names are mapped to IDs.\n // The list below represents the reverse of that, i.e., it maps IDs\n // to operator names.\n this._operatorIdMapping = [];\n for (const op in OPS) {\n this._operatorIdMapping[OPS[op]] = op;\n }\n }\n\n save() {\n this.transformStack.push(this.transformMatrix);\n const old = this.current;\n this.extraStack.push(old);\n this.current = old.clone();\n }\n\n restore() {\n this.transformMatrix = this.transformStack.pop();\n this.current = this.extraStack.pop();\n this.pendingClip = null;\n this.tgrp = null;\n }\n\n group(items) {\n this.save();\n this.executeOpTree(items);\n this.restore();\n }\n\n loadDependencies(operatorList) {\n const fnArray = operatorList.fnArray;\n const argsArray = operatorList.argsArray;\n\n for (let i = 0, ii = fnArray.length; i < ii; i++) {\n if (fnArray[i] !== OPS.dependency) {\n continue;\n }\n\n for (const obj of argsArray[i]) {\n const objsPool = obj.startsWith(\"g_\") ? this.commonObjs : this.objs;\n const promise = new Promise(resolve => {\n objsPool.get(obj, resolve);\n });\n this.current.dependencies.push(promise);\n }\n }\n return Promise.all(this.current.dependencies);\n }\n\n transform(a, b, c, d, e, f) {\n const transformMatrix = [a, b, c, d, e, f];\n this.transformMatrix = Util.transform(\n this.transformMatrix,\n transformMatrix\n );\n this.tgrp = null;\n }\n\n getSVG(operatorList, viewport) {\n this.viewport = viewport;\n\n const svgElement = this._initialize(viewport);\n return this.loadDependencies(operatorList).then(() => {\n this.transformMatrix = IDENTITY_MATRIX;\n this.executeOpTree(this.convertOpList(operatorList));\n return svgElement;\n });\n }\n\n convertOpList(operatorList) {\n const operatorIdMapping = this._operatorIdMapping;\n const argsArray = operatorList.argsArray;\n const fnArray = operatorList.fnArray;\n const opList = [];\n for (let i = 0, ii = fnArray.length; i < ii; i++) {\n const fnId = fnArray[i];\n opList.push({\n fnId,\n fn: operatorIdMapping[fnId],\n args: argsArray[i],\n });\n }\n return opListToTree(opList);\n }\n\n executeOpTree(opTree) {\n for (const opTreeElement of opTree) {\n const fn = opTreeElement.fn;\n const fnId = opTreeElement.fnId;\n const args = opTreeElement.args;\n\n switch (fnId | 0) {\n case OPS.beginText:\n this.beginText();\n break;\n case OPS.dependency:\n // Handled in `loadDependencies`, so no warning should be shown.\n break;\n case OPS.setLeading:\n this.setLeading(args);\n break;\n case OPS.setLeadingMoveText:\n this.setLeadingMoveText(args[0], args[1]);\n break;\n case OPS.setFont:\n this.setFont(args);\n break;\n case OPS.showText:\n this.showText(args[0]);\n break;\n case OPS.showSpacedText:\n this.showText(args[0]);\n break;\n case OPS.endText:\n this.endText();\n break;\n case OPS.moveText:\n this.moveText(args[0], args[1]);\n break;\n case OPS.setCharSpacing:\n this.setCharSpacing(args[0]);\n break;\n case OPS.setWordSpacing:\n this.setWordSpacing(args[0]);\n break;\n case OPS.setHScale:\n this.setHScale(args[0]);\n break;\n case OPS.setTextMatrix:\n this.setTextMatrix(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4],\n args[5]\n );\n break;\n case OPS.setTextRise:\n this.setTextRise(args[0]);\n break;\n case OPS.setTextRenderingMode:\n this.setTextRenderingMode(args[0]);\n break;\n case OPS.setLineWidth:\n this.setLineWidth(args[0]);\n break;\n case OPS.setLineJoin:\n this.setLineJoin(args[0]);\n break;\n case OPS.setLineCap:\n this.setLineCap(args[0]);\n break;\n case OPS.setMiterLimit:\n this.setMiterLimit(args[0]);\n break;\n case OPS.setFillRGBColor:\n this.setFillRGBColor(args[0], args[1], args[2]);\n break;\n case OPS.setStrokeRGBColor:\n this.setStrokeRGBColor(args[0], args[1], args[2]);\n break;\n case OPS.setStrokeColorN:\n this.setStrokeColorN(args);\n break;\n case OPS.setFillColorN:\n this.setFillColorN(args);\n break;\n case OPS.shadingFill:\n this.shadingFill(args[0]);\n break;\n case OPS.setDash:\n this.setDash(args[0], args[1]);\n break;\n case OPS.setRenderingIntent:\n this.setRenderingIntent(args[0]);\n break;\n case OPS.setFlatness:\n this.setFlatness(args[0]);\n break;\n case OPS.setGState:\n this.setGState(args[0]);\n break;\n case OPS.fill:\n this.fill();\n break;\n case OPS.eoFill:\n this.eoFill();\n break;\n case OPS.stroke:\n this.stroke();\n break;\n case OPS.fillStroke:\n this.fillStroke();\n break;\n case OPS.eoFillStroke:\n this.eoFillStroke();\n break;\n case OPS.clip:\n this.clip(\"nonzero\");\n break;\n case OPS.eoClip:\n this.clip(\"evenodd\");\n break;\n case OPS.paintSolidColorImageMask:\n this.paintSolidColorImageMask();\n break;\n case OPS.paintImageXObject:\n this.paintImageXObject(args[0]);\n break;\n case OPS.paintInlineImageXObject:\n this.paintInlineImageXObject(args[0]);\n break;\n case OPS.paintImageMaskXObject:\n this.paintImageMaskXObject(args[0]);\n break;\n case OPS.paintFormXObjectBegin:\n this.paintFormXObjectBegin(args[0], args[1]);\n break;\n case OPS.paintFormXObjectEnd:\n this.paintFormXObjectEnd();\n break;\n case OPS.closePath:\n this.closePath();\n break;\n case OPS.closeStroke:\n this.closeStroke();\n break;\n case OPS.closeFillStroke:\n this.closeFillStroke();\n break;\n case OPS.closeEOFillStroke:\n this.closeEOFillStroke();\n break;\n case OPS.nextLine:\n this.nextLine();\n break;\n case OPS.transform:\n this.transform(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4],\n args[5]\n );\n break;\n case OPS.constructPath:\n this.constructPath(args[0], args[1]);\n break;\n case OPS.endPath:\n this.endPath();\n break;\n case 92:\n this.group(opTreeElement.items);\n break;\n default:\n warn(`Unimplemented operator ${fn}`);\n break;\n }\n }\n }\n\n setWordSpacing(wordSpacing) {\n this.current.wordSpacing = wordSpacing;\n }\n\n setCharSpacing(charSpacing) {\n this.current.charSpacing = charSpacing;\n }\n\n nextLine() {\n this.moveText(0, this.current.leading);\n }\n\n setTextMatrix(a, b, c, d, e, f) {\n const current = this.current;\n current.textMatrix = current.lineMatrix = [a, b, c, d, e, f];\n current.textMatrixScale = Math.hypot(a, b);\n\n current.x = current.lineX = 0;\n current.y = current.lineY = 0;\n\n current.xcoords = [];\n current.ycoords = [];\n current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n current.tspan.setAttributeNS(null, \"font-family\", current.fontFamily);\n current.tspan.setAttributeNS(\n null,\n \"font-size\",\n `${pf(current.fontSize)}px`\n );\n current.tspan.setAttributeNS(null, \"y\", pf(-current.y));\n\n current.txtElement = this.svgFactory.createElement(\"svg:text\");\n current.txtElement.appendChild(current.tspan);\n }\n\n beginText() {\n const current = this.current;\n current.x = current.lineX = 0;\n current.y = current.lineY = 0;\n current.textMatrix = IDENTITY_MATRIX;\n current.lineMatrix = IDENTITY_MATRIX;\n current.textMatrixScale = 1;\n current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n current.txtElement = this.svgFactory.createElement(\"svg:text\");\n current.txtgrp = this.svgFactory.createElement(\"svg:g\");\n current.xcoords = [];\n current.ycoords = [];\n }\n\n moveText(x, y) {\n const current = this.current;\n current.x = current.lineX += x;\n current.y = current.lineY += y;\n\n current.xcoords = [];\n current.ycoords = [];\n current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n current.tspan.setAttributeNS(null, \"font-family\", current.fontFamily);\n current.tspan.setAttributeNS(\n null,\n \"font-size\",\n `${pf(current.fontSize)}px`\n );\n current.tspan.setAttributeNS(null, \"y\", pf(-current.y));\n }\n\n showText(glyphs) {\n const current = this.current;\n const font = current.font;\n const fontSize = current.fontSize;\n if (fontSize === 0) {\n return;\n }\n\n const fontSizeScale = current.fontSizeScale;\n const charSpacing = current.charSpacing;\n const wordSpacing = current.wordSpacing;\n const fontDirection = current.fontDirection;\n const textHScale = current.textHScale * fontDirection;\n const vertical = font.vertical;\n const spacingDir = vertical ? 1 : -1;\n const defaultVMetrics = font.defaultVMetrics;\n const widthAdvanceScale = fontSize * current.fontMatrix[0];\n\n let x = 0;\n for (const glyph of glyphs) {\n if (glyph === null) {\n // Word break\n x += fontDirection * wordSpacing;\n continue;\n } else if (isNum(glyph)) {\n x += (spacingDir * glyph * fontSize) / 1000;\n continue;\n }\n\n const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;\n const character = glyph.fontChar;\n let scaledX, scaledY;\n let width = glyph.width;\n if (vertical) {\n let vx;\n const vmetric = glyph.vmetric || defaultVMetrics;\n vx = glyph.vmetric ? vmetric[1] : width * 0.5;\n vx = -vx * widthAdvanceScale;\n const vy = vmetric[2] * widthAdvanceScale;\n\n width = vmetric ? -vmetric[0] : width;\n scaledX = vx / fontSizeScale;\n scaledY = (x + vy) / fontSizeScale;\n } else {\n scaledX = x / fontSizeScale;\n scaledY = 0;\n }\n\n if (glyph.isInFont || font.missingFile) {\n current.xcoords.push(current.x + scaledX);\n if (vertical) {\n current.ycoords.push(-current.y + scaledY);\n }\n current.tspan.textContent += character;\n } else {\n // TODO: To assist with text selection, we should replace the missing\n // character with a space character if charWidth is not zero.\n // But we cannot just do \"character = ' '\", because the ' ' character\n // might actually map to a different glyph.\n }\n\n let charWidth;\n if (vertical) {\n charWidth = width * widthAdvanceScale - spacing * fontDirection;\n } else {\n charWidth = width * widthAdvanceScale + spacing * fontDirection;\n }\n\n x += charWidth;\n }\n current.tspan.setAttributeNS(\n null,\n \"x\",\n current.xcoords.map(pf).join(\" \")\n );\n if (vertical) {\n current.tspan.setAttributeNS(\n null,\n \"y\",\n current.ycoords.map(pf).join(\" \")\n );\n } else {\n current.tspan.setAttributeNS(null, \"y\", pf(-current.y));\n }\n\n if (vertical) {\n current.y -= x;\n } else {\n current.x += x * textHScale;\n }\n\n current.tspan.setAttributeNS(null, \"font-family\", current.fontFamily);\n current.tspan.setAttributeNS(\n null,\n \"font-size\",\n `${pf(current.fontSize)}px`\n );\n if (current.fontStyle !== SVG_DEFAULTS.fontStyle) {\n current.tspan.setAttributeNS(null, \"font-style\", current.fontStyle);\n }\n if (current.fontWeight !== SVG_DEFAULTS.fontWeight) {\n current.tspan.setAttributeNS(null, \"font-weight\", current.fontWeight);\n }\n\n const fillStrokeMode =\n current.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;\n if (\n fillStrokeMode === TextRenderingMode.FILL ||\n fillStrokeMode === TextRenderingMode.FILL_STROKE\n ) {\n if (current.fillColor !== SVG_DEFAULTS.fillColor) {\n current.tspan.setAttributeNS(null, \"fill\", current.fillColor);\n }\n if (current.fillAlpha < 1) {\n current.tspan.setAttributeNS(null, \"fill-opacity\", current.fillAlpha);\n }\n } else if (current.textRenderingMode === TextRenderingMode.ADD_TO_PATH) {\n // Workaround for Firefox: We must set fill=\"transparent\" because\n // fill=\"none\" would generate an empty clipping path.\n current.tspan.setAttributeNS(null, \"fill\", \"transparent\");\n } else {\n current.tspan.setAttributeNS(null, \"fill\", \"none\");\n }\n\n if (\n fillStrokeMode === TextRenderingMode.STROKE ||\n fillStrokeMode === TextRenderingMode.FILL_STROKE\n ) {\n const lineWidthScale = 1 / (current.textMatrixScale || 1);\n this._setStrokeAttributes(current.tspan, lineWidthScale);\n }\n\n // Include the text rise in the text matrix since the `pm` function\n // creates the SVG element's `translate` entry (work on a copy to avoid\n // altering the original text matrix).\n let textMatrix = current.textMatrix;\n if (current.textRise !== 0) {\n textMatrix = textMatrix.slice();\n textMatrix[5] += current.textRise;\n }\n\n current.txtElement.setAttributeNS(\n null,\n \"transform\",\n `${pm(textMatrix)} scale(${pf(textHScale)}, -1)`\n );\n current.txtElement.setAttributeNS(XML_NS, \"xml:space\", \"preserve\");\n current.txtElement.appendChild(current.tspan);\n current.txtgrp.appendChild(current.txtElement);\n\n this._ensureTransformGroup().appendChild(current.txtElement);\n }\n\n setLeadingMoveText(x, y) {\n this.setLeading(-y);\n this.moveText(x, y);\n }\n\n addFontStyle(fontObj) {\n if (!fontObj.data) {\n throw new Error(\n \"addFontStyle: No font data available, \" +\n 'ensure that the \"fontExtraProperties\" API parameter is set.'\n );\n }\n if (!this.cssStyle) {\n this.cssStyle = this.svgFactory.createElement(\"svg:style\");\n this.cssStyle.setAttributeNS(null, \"type\", \"text/css\");\n this.defs.appendChild(this.cssStyle);\n }\n\n const url = createObjectURL(\n fontObj.data,\n fontObj.mimetype,\n this.forceDataSchema\n );\n this.cssStyle.textContent +=\n `@font-face { font-family: \"${fontObj.loadedName}\";` +\n ` src: url(${url}); }\\n`;\n }\n\n setFont(details) {\n const current = this.current;\n const fontObj = this.commonObjs.get(details[0]);\n let size = details[1];\n current.font = fontObj;\n\n if (\n this.embedFonts &&\n !fontObj.missingFile &&\n !this.embeddedFonts[fontObj.loadedName]\n ) {\n this.addFontStyle(fontObj);\n this.embeddedFonts[fontObj.loadedName] = fontObj;\n }\n current.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;\n\n let bold = \"normal\";\n if (fontObj.black) {\n bold = \"900\";\n } else if (fontObj.bold) {\n bold = \"bold\";\n }\n const italic = fontObj.italic ? \"italic\" : \"normal\";\n\n if (size < 0) {\n size = -size;\n current.fontDirection = -1;\n } else {\n current.fontDirection = 1;\n }\n current.fontSize = size;\n current.fontFamily = fontObj.loadedName;\n current.fontWeight = bold;\n current.fontStyle = italic;\n\n current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n current.tspan.setAttributeNS(null, \"y\", pf(-current.y));\n current.xcoords = [];\n current.ycoords = [];\n }\n\n endText() {\n const current = this.current;\n if (\n current.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG &&\n current.txtElement?.hasChildNodes()\n ) {\n // If no glyphs are shown (i.e. no child nodes), no clipping occurs.\n current.element = current.txtElement;\n this.clip(\"nonzero\");\n this.endPath();\n }\n }\n\n // Path properties\n setLineWidth(width) {\n if (width > 0) {\n this.current.lineWidth = width;\n }\n }\n\n setLineCap(style) {\n this.current.lineCap = LINE_CAP_STYLES[style];\n }\n\n setLineJoin(style) {\n this.current.lineJoin = LINE_JOIN_STYLES[style];\n }\n\n setMiterLimit(limit) {\n this.current.miterLimit = limit;\n }\n\n setStrokeAlpha(strokeAlpha) {\n this.current.strokeAlpha = strokeAlpha;\n }\n\n setStrokeRGBColor(r, g, b) {\n this.current.strokeColor = Util.makeHexColor(r, g, b);\n }\n\n setFillAlpha(fillAlpha) {\n this.current.fillAlpha = fillAlpha;\n }\n\n setFillRGBColor(r, g, b) {\n this.current.fillColor = Util.makeHexColor(r, g, b);\n this.current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n this.current.xcoords = [];\n this.current.ycoords = [];\n }\n\n setStrokeColorN(args) {\n this.current.strokeColor = this._makeColorN_Pattern(args);\n }\n\n setFillColorN(args) {\n this.current.fillColor = this._makeColorN_Pattern(args);\n }\n\n shadingFill(args) {\n const width = this.viewport.width;\n const height = this.viewport.height;\n const inv = Util.inverseTransform(this.transformMatrix);\n const bl = Util.applyTransform([0, 0], inv);\n const br = Util.applyTransform([0, height], inv);\n const ul = Util.applyTransform([width, 0], inv);\n const ur = Util.applyTransform([width, height], inv);\n const x0 = Math.min(bl[0], br[0], ul[0], ur[0]);\n const y0 = Math.min(bl[1], br[1], ul[1], ur[1]);\n const x1 = Math.max(bl[0], br[0], ul[0], ur[0]);\n const y1 = Math.max(bl[1], br[1], ul[1], ur[1]);\n\n const rect = this.svgFactory.createElement(\"svg:rect\");\n rect.setAttributeNS(null, \"x\", x0);\n rect.setAttributeNS(null, \"y\", y0);\n rect.setAttributeNS(null, \"width\", x1 - x0);\n rect.setAttributeNS(null, \"height\", y1 - y0);\n rect.setAttributeNS(null, \"fill\", this._makeShadingPattern(args));\n if (this.current.fillAlpha < 1) {\n rect.setAttributeNS(null, \"fill-opacity\", this.current.fillAlpha);\n }\n this._ensureTransformGroup().appendChild(rect);\n }\n\n /**\n * @private\n */\n _makeColorN_Pattern(args) {\n if (args[0] === \"TilingPattern\") {\n return this._makeTilingPattern(args);\n }\n return this._makeShadingPattern(args);\n }\n\n /**\n * @private\n */\n _makeTilingPattern(args) {\n const color = args[1];\n const operatorList = args[2];\n const matrix = args[3] || IDENTITY_MATRIX;\n const [x0, y0, x1, y1] = args[4];\n const xstep = args[5];\n const ystep = args[6];\n const paintType = args[7];\n\n const tilingId = `shading${shadingCount++}`;\n const [tx0, ty0] = Util.applyTransform([x0, y0], matrix);\n const [tx1, ty1] = Util.applyTransform([x1, y1], matrix);\n const [xscale, yscale] = Util.singularValueDecompose2dScale(matrix);\n const txstep = xstep * xscale;\n const tystep = ystep * yscale;\n\n const tiling = this.svgFactory.createElement(\"svg:pattern\");\n tiling.setAttributeNS(null, \"id\", tilingId);\n tiling.setAttributeNS(null, \"patternUnits\", \"userSpaceOnUse\");\n tiling.setAttributeNS(null, \"width\", txstep);\n tiling.setAttributeNS(null, \"height\", tystep);\n tiling.setAttributeNS(null, \"x\", `${tx0}`);\n tiling.setAttributeNS(null, \"y\", `${ty0}`);\n\n // Save current state.\n const svg = this.svg;\n const transformMatrix = this.transformMatrix;\n const fillColor = this.current.fillColor;\n const strokeColor = this.current.strokeColor;\n\n const bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0);\n this.svg = bbox;\n this.transformMatrix = matrix;\n if (paintType === 2) {\n const cssColor = Util.makeHexColor(...color);\n this.current.fillColor = cssColor;\n this.current.strokeColor = cssColor;\n }\n this.executeOpTree(this.convertOpList(operatorList));\n\n // Restore saved state.\n this.svg = svg;\n this.transformMatrix = transformMatrix;\n this.current.fillColor = fillColor;\n this.current.strokeColor = strokeColor;\n\n tiling.appendChild(bbox.childNodes[0]);\n this.defs.appendChild(tiling);\n return `url(#${tilingId})`;\n }\n\n /**\n * @private\n */\n _makeShadingPattern(args) {\n switch (args[0]) {\n case \"RadialAxial\":\n const shadingId = `shading${shadingCount++}`;\n const colorStops = args[3];\n let gradient;\n\n switch (args[1]) {\n case \"axial\":\n const point0 = args[4];\n const point1 = args[5];\n gradient = this.svgFactory.createElement(\"svg:linearGradient\");\n gradient.setAttributeNS(null, \"id\", shadingId);\n gradient.setAttributeNS(null, \"gradientUnits\", \"userSpaceOnUse\");\n gradient.setAttributeNS(null, \"x1\", point0[0]);\n gradient.setAttributeNS(null, \"y1\", point0[1]);\n gradient.setAttributeNS(null, \"x2\", point1[0]);\n gradient.setAttributeNS(null, \"y2\", point1[1]);\n break;\n case \"radial\":\n const focalPoint = args[4];\n const circlePoint = args[5];\n const focalRadius = args[6];\n const circleRadius = args[7];\n gradient = this.svgFactory.createElement(\"svg:radialGradient\");\n gradient.setAttributeNS(null, \"id\", shadingId);\n gradient.setAttributeNS(null, \"gradientUnits\", \"userSpaceOnUse\");\n gradient.setAttributeNS(null, \"cx\", circlePoint[0]);\n gradient.setAttributeNS(null, \"cy\", circlePoint[1]);\n gradient.setAttributeNS(null, \"r\", circleRadius);\n gradient.setAttributeNS(null, \"fx\", focalPoint[0]);\n gradient.setAttributeNS(null, \"fy\", focalPoint[1]);\n gradient.setAttributeNS(null, \"fr\", focalRadius);\n break;\n default:\n throw new Error(`Unknown RadialAxial type: ${args[1]}`);\n }\n for (const colorStop of colorStops) {\n const stop = this.svgFactory.createElement(\"svg:stop\");\n stop.setAttributeNS(null, \"offset\", colorStop[0]);\n stop.setAttributeNS(null, \"stop-color\", colorStop[1]);\n gradient.appendChild(stop);\n }\n this.defs.appendChild(gradient);\n return `url(#${shadingId})`;\n case \"Mesh\":\n warn(\"Unimplemented pattern Mesh\");\n return null;\n case \"Dummy\":\n return \"hotpink\";\n default:\n throw new Error(`Unknown IR type: ${args[0]}`);\n }\n }\n\n setDash(dashArray, dashPhase) {\n this.current.dashArray = dashArray;\n this.current.dashPhase = dashPhase;\n }\n\n constructPath(ops, args) {\n const current = this.current;\n let x = current.x,\n y = current.y;\n let d = [];\n let j = 0;\n\n for (const op of ops) {\n switch (op | 0) {\n case OPS.rectangle:\n x = args[j++];\n y = args[j++];\n const width = args[j++];\n const height = args[j++];\n const xw = x + width;\n const yh = y + height;\n d.push(\n \"M\",\n pf(x),\n pf(y),\n \"L\",\n pf(xw),\n pf(y),\n \"L\",\n pf(xw),\n pf(yh),\n \"L\",\n pf(x),\n pf(yh),\n \"Z\"\n );\n break;\n case OPS.moveTo:\n x = args[j++];\n y = args[j++];\n d.push(\"M\", pf(x), pf(y));\n break;\n case OPS.lineTo:\n x = args[j++];\n y = args[j++];\n d.push(\"L\", pf(x), pf(y));\n break;\n case OPS.curveTo:\n x = args[j + 4];\n y = args[j + 5];\n d.push(\n \"C\",\n pf(args[j]),\n pf(args[j + 1]),\n pf(args[j + 2]),\n pf(args[j + 3]),\n pf(x),\n pf(y)\n );\n j += 6;\n break;\n case OPS.curveTo2:\n d.push(\n \"C\",\n pf(x),\n pf(y),\n pf(args[j]),\n pf(args[j + 1]),\n pf(args[j + 2]),\n pf(args[j + 3])\n );\n x = args[j + 2];\n y = args[j + 3];\n j += 4;\n break;\n case OPS.curveTo3:\n x = args[j + 2];\n y = args[j + 3];\n d.push(\n \"C\",\n pf(args[j]),\n pf(args[j + 1]),\n pf(x),\n pf(y),\n pf(x),\n pf(y)\n );\n j += 4;\n break;\n case OPS.closePath:\n d.push(\"Z\");\n break;\n }\n }\n\n d = d.join(\" \");\n\n if (\n current.path &&\n ops.length > 0 &&\n ops[0] !== OPS.rectangle &&\n ops[0] !== OPS.moveTo\n ) {\n // If a path does not start with an OPS.rectangle or OPS.moveTo, it has\n // probably been divided into two OPS.constructPath operators by\n // OperatorList. Append the commands to the previous path element.\n d = current.path.getAttributeNS(null, \"d\") + d;\n } else {\n current.path = this.svgFactory.createElement(\"svg:path\");\n this._ensureTransformGroup().appendChild(current.path);\n }\n\n current.path.setAttributeNS(null, \"d\", d);\n current.path.setAttributeNS(null, \"fill\", \"none\");\n\n // Saving a reference in current.element so that it can be addressed\n // in 'fill' and 'stroke'\n current.element = current.path;\n current.setCurrentPoint(x, y);\n }\n\n endPath() {\n const current = this.current;\n\n // Painting operators end a path.\n current.path = null;\n\n if (!this.pendingClip) {\n return;\n }\n if (!current.element) {\n this.pendingClip = null;\n return;\n }\n\n // Add the current path to a clipping path.\n const clipId = `clippath${clipCount++}`;\n const clipPath = this.svgFactory.createElement(\"svg:clipPath\");\n clipPath.setAttributeNS(null, \"id\", clipId);\n clipPath.setAttributeNS(null, \"transform\", pm(this.transformMatrix));\n\n // A deep clone is needed when text is used as a clipping path.\n const clipElement = current.element.cloneNode(true);\n if (this.pendingClip === \"evenodd\") {\n clipElement.setAttributeNS(null, \"clip-rule\", \"evenodd\");\n } else {\n clipElement.setAttributeNS(null, \"clip-rule\", \"nonzero\");\n }\n this.pendingClip = null;\n clipPath.appendChild(clipElement);\n this.defs.appendChild(clipPath);\n\n if (current.activeClipUrl) {\n // The previous clipping group content can go out of order -- resetting\n // cached clipGroups.\n current.clipGroup = null;\n for (const prev of this.extraStack) {\n prev.clipGroup = null;\n }\n // Intersect with the previous clipping path.\n clipPath.setAttributeNS(null, \"clip-path\", current.activeClipUrl);\n }\n current.activeClipUrl = `url(#${clipId})`;\n\n this.tgrp = null;\n }\n\n clip(type) {\n this.pendingClip = type;\n }\n\n closePath() {\n const current = this.current;\n if (current.path) {\n const d = `${current.path.getAttributeNS(null, \"d\")}Z`;\n current.path.setAttributeNS(null, \"d\", d);\n }\n }\n\n setLeading(leading) {\n this.current.leading = -leading;\n }\n\n setTextRise(textRise) {\n this.current.textRise = textRise;\n }\n\n setTextRenderingMode(textRenderingMode) {\n this.current.textRenderingMode = textRenderingMode;\n }\n\n setHScale(scale) {\n this.current.textHScale = scale / 100;\n }\n\n setRenderingIntent(intent) {\n // This operation is ignored since we haven't found a use case for it yet.\n }\n\n setFlatness(flatness) {\n // This operation is ignored since we haven't found a use case for it yet.\n }\n\n setGState(states) {\n for (const [key, value] of states) {\n switch (key) {\n case \"LW\":\n this.setLineWidth(value);\n break;\n case \"LC\":\n this.setLineCap(value);\n break;\n case \"LJ\":\n this.setLineJoin(value);\n break;\n case \"ML\":\n this.setMiterLimit(value);\n break;\n case \"D\":\n this.setDash(value[0], value[1]);\n break;\n case \"RI\":\n this.setRenderingIntent(value);\n break;\n case \"FL\":\n this.setFlatness(value);\n break;\n case \"Font\":\n this.setFont(value);\n break;\n case \"CA\":\n this.setStrokeAlpha(value);\n break;\n case \"ca\":\n this.setFillAlpha(value);\n break;\n default:\n warn(`Unimplemented graphic state operator ${key}`);\n break;\n }\n }\n }\n\n fill() {\n const current = this.current;\n if (current.element) {\n current.element.setAttributeNS(null, \"fill\", current.fillColor);\n current.element.setAttributeNS(null, \"fill-opacity\", current.fillAlpha);\n this.endPath();\n }\n }\n\n stroke() {\n const current = this.current;\n if (current.element) {\n this._setStrokeAttributes(current.element);\n current.element.setAttributeNS(null, \"fill\", \"none\");\n this.endPath();\n }\n }\n\n /**\n * @private\n */\n _setStrokeAttributes(element, lineWidthScale = 1) {\n const current = this.current;\n let dashArray = current.dashArray;\n if (lineWidthScale !== 1 && dashArray.length > 0) {\n dashArray = dashArray.map(function (value) {\n return lineWidthScale * value;\n });\n }\n element.setAttributeNS(null, \"stroke\", current.strokeColor);\n element.setAttributeNS(null, \"stroke-opacity\", current.strokeAlpha);\n element.setAttributeNS(null, \"stroke-miterlimit\", pf(current.miterLimit));\n element.setAttributeNS(null, \"stroke-linecap\", current.lineCap);\n element.setAttributeNS(null, \"stroke-linejoin\", current.lineJoin);\n element.setAttributeNS(\n null,\n \"stroke-width\",\n pf(lineWidthScale * current.lineWidth) + \"px\"\n );\n element.setAttributeNS(\n null,\n \"stroke-dasharray\",\n dashArray.map(pf).join(\" \")\n );\n element.setAttributeNS(\n null,\n \"stroke-dashoffset\",\n pf(lineWidthScale * current.dashPhase) + \"px\"\n );\n }\n\n eoFill() {\n if (this.current.element) {\n this.current.element.setAttributeNS(null, \"fill-rule\", \"evenodd\");\n }\n this.fill();\n }\n\n fillStroke() {\n // Order is important since stroke wants fill to be none.\n // First stroke, then if fill needed, it will be overwritten.\n this.stroke();\n this.fill();\n }\n\n eoFillStroke() {\n if (this.current.element) {\n this.current.element.setAttributeNS(null, \"fill-rule\", \"evenodd\");\n }\n this.fillStroke();\n }\n\n closeStroke() {\n this.closePath();\n this.stroke();\n }\n\n closeFillStroke() {\n this.closePath();\n this.fillStroke();\n }\n\n closeEOFillStroke() {\n this.closePath();\n this.eoFillStroke();\n }\n\n paintSolidColorImageMask() {\n const rect = this.svgFactory.createElement(\"svg:rect\");\n rect.setAttributeNS(null, \"x\", \"0\");\n rect.setAttributeNS(null, \"y\", \"0\");\n rect.setAttributeNS(null, \"width\", \"1px\");\n rect.setAttributeNS(null, \"height\", \"1px\");\n rect.setAttributeNS(null, \"fill\", this.current.fillColor);\n\n this._ensureTransformGroup().appendChild(rect);\n }\n\n paintImageXObject(objId) {\n const imgData = objId.startsWith(\"g_\")\n ? this.commonObjs.get(objId)\n : this.objs.get(objId);\n if (!imgData) {\n warn(`Dependent image with object ID ${objId} is not ready yet`);\n return;\n }\n this.paintInlineImageXObject(imgData);\n }\n\n paintInlineImageXObject(imgData, mask) {\n const width = imgData.width;\n const height = imgData.height;\n\n const imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask);\n const cliprect = this.svgFactory.createElement(\"svg:rect\");\n cliprect.setAttributeNS(null, \"x\", \"0\");\n cliprect.setAttributeNS(null, \"y\", \"0\");\n cliprect.setAttributeNS(null, \"width\", pf(width));\n cliprect.setAttributeNS(null, \"height\", pf(height));\n this.current.element = cliprect;\n this.clip(\"nonzero\");\n\n const imgEl = this.svgFactory.createElement(\"svg:image\");\n imgEl.setAttributeNS(XLINK_NS, \"xlink:href\", imgSrc);\n imgEl.setAttributeNS(null, \"x\", \"0\");\n imgEl.setAttributeNS(null, \"y\", pf(-height));\n imgEl.setAttributeNS(null, \"width\", pf(width) + \"px\");\n imgEl.setAttributeNS(null, \"height\", pf(height) + \"px\");\n imgEl.setAttributeNS(\n null,\n \"transform\",\n `scale(${pf(1 / width)} ${pf(-1 / height)})`\n );\n if (mask) {\n mask.appendChild(imgEl);\n } else {\n this._ensureTransformGroup().appendChild(imgEl);\n }\n }\n\n paintImageMaskXObject(imgData) {\n const current = this.current;\n const width = imgData.width;\n const height = imgData.height;\n const fillColor = current.fillColor;\n\n current.maskId = `mask${maskCount++}`;\n const mask = this.svgFactory.createElement(\"svg:mask\");\n mask.setAttributeNS(null, \"id\", current.maskId);\n\n const rect = this.svgFactory.createElement(\"svg:rect\");\n rect.setAttributeNS(null, \"x\", \"0\");\n rect.setAttributeNS(null, \"y\", \"0\");\n rect.setAttributeNS(null, \"width\", pf(width));\n rect.setAttributeNS(null, \"height\", pf(height));\n rect.setAttributeNS(null, \"fill\", fillColor);\n rect.setAttributeNS(null, \"mask\", `url(#${current.maskId})`);\n\n this.defs.appendChild(mask);\n this._ensureTransformGroup().appendChild(rect);\n\n this.paintInlineImageXObject(imgData, mask);\n }\n\n paintFormXObjectBegin(matrix, bbox) {\n if (Array.isArray(matrix) && matrix.length === 6) {\n this.transform(\n matrix[0],\n matrix[1],\n matrix[2],\n matrix[3],\n matrix[4],\n matrix[5]\n );\n }\n\n if (bbox) {\n const width = bbox[2] - bbox[0];\n const height = bbox[3] - bbox[1];\n\n const cliprect = this.svgFactory.createElement(\"svg:rect\");\n cliprect.setAttributeNS(null, \"x\", bbox[0]);\n cliprect.setAttributeNS(null, \"y\", bbox[1]);\n cliprect.setAttributeNS(null, \"width\", pf(width));\n cliprect.setAttributeNS(null, \"height\", pf(height));\n this.current.element = cliprect;\n this.clip(\"nonzero\");\n this.endPath();\n }\n }\n\n paintFormXObjectEnd() {}\n\n /**\n * @private\n */\n _initialize(viewport) {\n const svg = this.svgFactory.create(viewport.width, viewport.height);\n\n // Create the definitions element.\n const definitions = this.svgFactory.createElement(\"svg:defs\");\n svg.appendChild(definitions);\n this.defs = definitions;\n\n // Create the root group element, which acts a container for all other\n // groups and applies the viewport transform.\n const rootGroup = this.svgFactory.createElement(\"svg:g\");\n rootGroup.setAttributeNS(null, \"transform\", pm(viewport.transform));\n svg.appendChild(rootGroup);\n\n // For the construction of the SVG image we are only interested in the\n // root group, so we expose it as the entry point of the SVG image for\n // the other code in this class.\n this.svg = rootGroup;\n\n return svg;\n }\n\n /**\n * @private\n */\n _ensureClipGroup() {\n if (!this.current.clipGroup) {\n const clipGroup = this.svgFactory.createElement(\"svg:g\");\n clipGroup.setAttributeNS(null, \"clip-path\", this.current.activeClipUrl);\n this.svg.appendChild(clipGroup);\n this.current.clipGroup = clipGroup;\n }\n return this.current.clipGroup;\n }\n\n /**\n * @private\n */\n _ensureTransformGroup() {\n if (!this.tgrp) {\n this.tgrp = this.svgFactory.createElement(\"svg:g\");\n this.tgrp.setAttributeNS(null, \"transform\", pm(this.transformMatrix));\n if (this.current.activeClipUrl) {\n this._ensureClipGroup().appendChild(this.tgrp);\n } else {\n this.svg.appendChild(this.tgrp);\n }\n }\n return this.tgrp;\n }\n };\n}\n\nexport { SVGGraphics };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass XfaLayer {\n static setupStorage(html, fieldId, element, storage) {\n const storedData = storage.getValue(fieldId, { value: null });\n switch (element.name) {\n case \"textarea\":\n html.textContent = storedData.value !== null ? storedData.value : \"\";\n html.addEventListener(\"input\", event => {\n storage.setValue(fieldId, { value: event.target.value });\n });\n break;\n case \"input\":\n if (storedData.value !== null) {\n html.setAttribute(\"value\", storedData.value);\n }\n if (element.attributes.type === \"radio\") {\n html.addEventListener(\"change\", event => {\n const { target } = event;\n for (const radio of document.getElementsByName(target.name)) {\n if (radio !== target) {\n const id = radio.id;\n storage.setValue(id.split(\"-\")[0], { value: false });\n }\n }\n storage.setValue(fieldId, { value: target.checked });\n });\n } else {\n html.addEventListener(\"input\", event => {\n storage.setValue(fieldId, { value: event.target.value });\n });\n }\n break;\n case \"select\":\n if (storedData.value !== null) {\n for (const option of element.children) {\n if (option.attributes.value === storedData.value) {\n option.attributes.selected = true;\n }\n }\n }\n html.addEventListener(\"input\", event => {\n const options = event.target.options;\n const value =\n options.selectedIndex === -1\n ? null\n : options[options.selectedIndex].value;\n storage.setValue(fieldId, { value });\n });\n break;\n }\n }\n\n static setAttributes(html, element, storage) {\n const { attributes } = element;\n for (const [key, value] of Object.entries(attributes)) {\n if (value === null || value === undefined || key === \"fieldId\") {\n continue;\n }\n\n if (key !== \"style\") {\n if (key === \"textContent\") {\n html.textContent = value;\n } else {\n html.setAttribute(key, value);\n }\n } else {\n Object.assign(html.style, value);\n }\n }\n\n // Set the value after the others to be sure overwrite\n // any other values.\n if (storage && attributes.fieldId !== undefined) {\n this.setupStorage(html, attributes.fieldId, element, storage);\n }\n }\n\n static render(parameters) {\n const storage = parameters.annotationStorage;\n const root = parameters.xfa;\n const rootHtml = document.createElement(root.name);\n if (root.attributes) {\n this.setAttributes(rootHtml, root);\n }\n const stack = [[root, -1, rootHtml]];\n\n const rootDiv = parameters.div;\n rootDiv.appendChild(rootHtml);\n const coeffs = parameters.viewport.transform.join(\",\");\n rootDiv.style.transform = `matrix(${coeffs})`;\n\n // Set defaults.\n rootDiv.setAttribute(\"class\", \"xfaLayer xfaFont\");\n\n while (stack.length > 0) {\n const [parent, i, html] = stack[stack.length - 1];\n if (i + 1 === parent.children.length) {\n stack.pop();\n continue;\n }\n\n const child = parent.children[++stack[stack.length - 1][1]];\n if (child === null) {\n continue;\n }\n\n const { name } = child;\n if (name === \"#text\") {\n html.appendChild(document.createTextNode(child.value));\n continue;\n }\n\n const childHtml = document.createElement(name);\n html.appendChild(childHtml);\n if (child.attributes) {\n this.setAttributes(childHtml, child, storage);\n }\n\n if (child.children && child.children.length > 0) {\n stack.push([child, -1, childHtml]);\n } else if (child.value) {\n childHtml.appendChild(document.createTextNode(child.value));\n }\n }\n }\n\n /**\n * Update the xfa layer.\n *\n * @public\n * @param {XfaLayerParameters} parameters\n * @memberof XfaLayer\n */\n static update(parameters) {\n const transform = `matrix(${parameters.viewport.transform.join(\",\")})`;\n parameters.div.style.transform = transform;\n parameters.div.hidden = false;\n }\n}\n\nexport { XfaLayer };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals __non_webpack_require__ */\n\nimport {\n AbortException,\n assert,\n createPromiseCapability,\n MissingPDFException,\n} from \"../shared/util.js\";\nimport {\n extractFilenameFromHeader,\n validateRangeRequestCapabilities,\n} from \"./network_utils.js\";\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\n 'Module \"./node_stream.js\" shall not be used with MOZCENTRAL builds.'\n );\n}\n\nconst fs = __non_webpack_require__(\"fs\");\nconst http = __non_webpack_require__(\"http\");\nconst https = __non_webpack_require__(\"https\");\nconst url = __non_webpack_require__(\"url\");\n\nconst fileUriRegex = /^file:\\/\\/\\/[a-zA-Z]:\\//;\n\nfunction parseUrl(sourceUrl) {\n const parsedUrl = url.parse(sourceUrl);\n if (parsedUrl.protocol === \"file:\" || parsedUrl.host) {\n return parsedUrl;\n }\n // Prepending 'file:///' to Windows absolute path.\n if (/^[a-z]:[/\\\\]/i.test(sourceUrl)) {\n return url.parse(`file:///${sourceUrl}`);\n }\n // Changes protocol to 'file:' if url refers to filesystem.\n if (!parsedUrl.host) {\n parsedUrl.protocol = \"file:\";\n }\n return parsedUrl;\n}\n\nclass PDFNodeStream {\n constructor(source) {\n this.source = source;\n this.url = parseUrl(source.url);\n this.isHttp =\n this.url.protocol === \"http:\" || this.url.protocol === \"https:\";\n // Check if url refers to filesystem.\n this.isFsUrl = this.url.protocol === \"file:\";\n this.httpHeaders = (this.isHttp && source.httpHeaders) || {};\n\n this._fullRequestReader = null;\n this._rangeRequestReaders = [];\n }\n\n get _progressiveDataLength() {\n return this._fullRequestReader?._loaded ?? 0;\n }\n\n getFullReader() {\n assert(\n !this._fullRequestReader,\n \"PDFNodeStream.getFullReader can only be called once.\"\n );\n this._fullRequestReader = this.isFsUrl\n ? new PDFNodeStreamFsFullReader(this)\n : new PDFNodeStreamFullReader(this);\n return this._fullRequestReader;\n }\n\n getRangeReader(start, end) {\n if (end <= this._progressiveDataLength) {\n return null;\n }\n const rangeReader = this.isFsUrl\n ? new PDFNodeStreamFsRangeReader(this, start, end)\n : new PDFNodeStreamRangeReader(this, start, end);\n this._rangeRequestReaders.push(rangeReader);\n return rangeReader;\n }\n\n cancelAllRequests(reason) {\n if (this._fullRequestReader) {\n this._fullRequestReader.cancel(reason);\n }\n for (const reader of this._rangeRequestReaders.slice(0)) {\n reader.cancel(reason);\n }\n }\n}\n\nclass BaseFullReader {\n constructor(stream) {\n this._url = stream.url;\n this._done = false;\n this._storedError = null;\n this.onProgress = null;\n const source = stream.source;\n this._contentLength = source.length; // optional\n this._loaded = 0;\n this._filename = null;\n\n this._disableRange = source.disableRange || false;\n this._rangeChunkSize = source.rangeChunkSize;\n if (!this._rangeChunkSize && !this._disableRange) {\n this._disableRange = true;\n }\n\n this._isStreamingSupported = !source.disableStream;\n this._isRangeSupported = !source.disableRange;\n\n this._readableStream = null;\n this._readCapability = createPromiseCapability();\n this._headersCapability = createPromiseCapability();\n }\n\n get headersReady() {\n return this._headersCapability.promise;\n }\n\n get filename() {\n return this._filename;\n }\n\n get contentLength() {\n return this._contentLength;\n }\n\n get isRangeSupported() {\n return this._isRangeSupported;\n }\n\n get isStreamingSupported() {\n return this._isStreamingSupported;\n }\n\n async read() {\n await this._readCapability.promise;\n if (this._done) {\n return { value: undefined, done: true };\n }\n if (this._storedError) {\n throw this._storedError;\n }\n\n const chunk = this._readableStream.read();\n if (chunk === null) {\n this._readCapability = createPromiseCapability();\n return this.read();\n }\n this._loaded += chunk.length;\n if (this.onProgress) {\n this.onProgress({\n loaded: this._loaded,\n total: this._contentLength,\n });\n }\n // Ensure that `read()` method returns ArrayBuffer.\n const buffer = new Uint8Array(chunk).buffer;\n return { value: buffer, done: false };\n }\n\n cancel(reason) {\n // Call `this._error()` method when cancel is called\n // before _readableStream is set.\n if (!this._readableStream) {\n this._error(reason);\n return;\n }\n this._readableStream.destroy(reason);\n }\n\n _error(reason) {\n this._storedError = reason;\n this._readCapability.resolve();\n }\n\n _setReadableStream(readableStream) {\n this._readableStream = readableStream;\n readableStream.on(\"readable\", () => {\n this._readCapability.resolve();\n });\n\n readableStream.on(\"end\", () => {\n // Destroy readable to minimize resource usage.\n readableStream.destroy();\n this._done = true;\n this._readCapability.resolve();\n });\n\n readableStream.on(\"error\", reason => {\n this._error(reason);\n });\n\n // We need to stop reading when range is supported and streaming is\n // disabled.\n if (!this._isStreamingSupported && this._isRangeSupported) {\n this._error(new AbortException(\"streaming is disabled\"));\n }\n\n // Destroy ReadableStream if already in errored state.\n if (this._storedError) {\n this._readableStream.destroy(this._storedError);\n }\n }\n}\n\nclass BaseRangeReader {\n constructor(stream) {\n this._url = stream.url;\n this._done = false;\n this._storedError = null;\n this.onProgress = null;\n this._loaded = 0;\n this._readableStream = null;\n this._readCapability = createPromiseCapability();\n const source = stream.source;\n this._isStreamingSupported = !source.disableStream;\n }\n\n get isStreamingSupported() {\n return this._isStreamingSupported;\n }\n\n async read() {\n await this._readCapability.promise;\n if (this._done) {\n return { value: undefined, done: true };\n }\n if (this._storedError) {\n throw this._storedError;\n }\n\n const chunk = this._readableStream.read();\n if (chunk === null) {\n this._readCapability = createPromiseCapability();\n return this.read();\n }\n this._loaded += chunk.length;\n if (this.onProgress) {\n this.onProgress({ loaded: this._loaded });\n }\n // Ensure that `read()` method returns ArrayBuffer.\n const buffer = new Uint8Array(chunk).buffer;\n return { value: buffer, done: false };\n }\n\n cancel(reason) {\n // Call `this._error()` method when cancel is called\n // before _readableStream is set.\n if (!this._readableStream) {\n this._error(reason);\n return;\n }\n this._readableStream.destroy(reason);\n }\n\n _error(reason) {\n this._storedError = reason;\n this._readCapability.resolve();\n }\n\n _setReadableStream(readableStream) {\n this._readableStream = readableStream;\n readableStream.on(\"readable\", () => {\n this._readCapability.resolve();\n });\n\n readableStream.on(\"end\", () => {\n // Destroy readableStream to minimize resource usage.\n readableStream.destroy();\n this._done = true;\n this._readCapability.resolve();\n });\n\n readableStream.on(\"error\", reason => {\n this._error(reason);\n });\n\n // Destroy readableStream if already in errored state.\n if (this._storedError) {\n this._readableStream.destroy(this._storedError);\n }\n }\n}\n\nfunction createRequestOptions(parsedUrl, headers) {\n return {\n protocol: parsedUrl.protocol,\n auth: parsedUrl.auth,\n host: parsedUrl.hostname,\n port: parsedUrl.port,\n path: parsedUrl.path,\n method: \"GET\",\n headers,\n };\n}\n\nclass PDFNodeStreamFullReader extends BaseFullReader {\n constructor(stream) {\n super(stream);\n\n const handleResponse = response => {\n if (response.statusCode === 404) {\n const error = new MissingPDFException(`Missing PDF \"${this._url}\".`);\n this._storedError = error;\n this._headersCapability.reject(error);\n return;\n }\n this._headersCapability.resolve();\n this._setReadableStream(response);\n\n const getResponseHeader = name => {\n // Make sure that headers name are in lower case, as mentioned\n // here: https://nodejs.org/api/http.html#http_message_headers.\n return this._readableStream.headers[name.toLowerCase()];\n };\n const { allowRangeRequests, suggestedLength } =\n validateRangeRequestCapabilities({\n getResponseHeader,\n isHttp: stream.isHttp,\n rangeChunkSize: this._rangeChunkSize,\n disableRange: this._disableRange,\n });\n\n this._isRangeSupported = allowRangeRequests;\n // Setting right content length.\n this._contentLength = suggestedLength || this._contentLength;\n\n this._filename = extractFilenameFromHeader(getResponseHeader);\n };\n\n this._request = null;\n if (this._url.protocol === \"http:\") {\n this._request = http.request(\n createRequestOptions(this._url, stream.httpHeaders),\n handleResponse\n );\n } else {\n this._request = https.request(\n createRequestOptions(this._url, stream.httpHeaders),\n handleResponse\n );\n }\n\n this._request.on(\"error\", reason => {\n this._storedError = reason;\n this._headersCapability.reject(reason);\n });\n // Note: `request.end(data)` is used to write `data` to request body\n // and notify end of request. But one should always call `request.end()`\n // even if there is no data to write -- (to notify the end of request).\n this._request.end();\n }\n}\n\nclass PDFNodeStreamRangeReader extends BaseRangeReader {\n constructor(stream, start, end) {\n super(stream);\n\n this._httpHeaders = {};\n for (const property in stream.httpHeaders) {\n const value = stream.httpHeaders[property];\n if (typeof value === \"undefined\") {\n continue;\n }\n this._httpHeaders[property] = value;\n }\n this._httpHeaders.Range = `bytes=${start}-${end - 1}`;\n\n const handleResponse = response => {\n if (response.statusCode === 404) {\n const error = new MissingPDFException(`Missing PDF \"${this._url}\".`);\n this._storedError = error;\n return;\n }\n this._setReadableStream(response);\n };\n\n this._request = null;\n if (this._url.protocol === \"http:\") {\n this._request = http.request(\n createRequestOptions(this._url, this._httpHeaders),\n handleResponse\n );\n } else {\n this._request = https.request(\n createRequestOptions(this._url, this._httpHeaders),\n handleResponse\n );\n }\n\n this._request.on(\"error\", reason => {\n this._storedError = reason;\n });\n this._request.end();\n }\n}\n\nclass PDFNodeStreamFsFullReader extends BaseFullReader {\n constructor(stream) {\n super(stream);\n\n let path = decodeURIComponent(this._url.path);\n\n // Remove the extra slash to get right path from url like `file:///C:/`\n if (fileUriRegex.test(this._url.href)) {\n path = path.replace(/^\\//, \"\");\n }\n\n fs.lstat(path, (error, stat) => {\n if (error) {\n if (error.code === \"ENOENT\") {\n error = new MissingPDFException(`Missing PDF \"${path}\".`);\n }\n this._storedError = error;\n this._headersCapability.reject(error);\n return;\n }\n // Setting right content length.\n this._contentLength = stat.size;\n\n this._setReadableStream(fs.createReadStream(path));\n this._headersCapability.resolve();\n });\n }\n}\n\nclass PDFNodeStreamFsRangeReader extends BaseRangeReader {\n constructor(stream, start, end) {\n super(stream);\n\n let path = decodeURIComponent(this._url.path);\n\n // Remove the extra slash to get right path from url like `file:///C:/`\n if (fileUriRegex.test(this._url.href)) {\n path = path.replace(/^\\//, \"\");\n }\n\n this._setReadableStream(fs.createReadStream(path, { start, end: end - 1 }));\n }\n}\n\nexport { PDFNodeStream };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n assert,\n MissingPDFException,\n UnexpectedResponseException,\n} from \"../shared/util.js\";\nimport { getFilenameFromContentDispositionHeader } from \"./content_disposition.js\";\nimport { isPdfFile } from \"./display_utils.js\";\n\nfunction validateRangeRequestCapabilities({\n getResponseHeader,\n isHttp,\n rangeChunkSize,\n disableRange,\n}) {\n assert(rangeChunkSize > 0, \"Range chunk size must be larger than zero\");\n const returnValues = {\n allowRangeRequests: false,\n suggestedLength: undefined,\n };\n\n const length = parseInt(getResponseHeader(\"Content-Length\"), 10);\n if (!Number.isInteger(length)) {\n return returnValues;\n }\n\n returnValues.suggestedLength = length;\n\n if (length <= 2 * rangeChunkSize) {\n // The file size is smaller than the size of two chunks, so it does not\n // make any sense to abort the request and retry with a range request.\n return returnValues;\n }\n\n if (disableRange || !isHttp) {\n return returnValues;\n }\n if (getResponseHeader(\"Accept-Ranges\") !== \"bytes\") {\n return returnValues;\n }\n\n const contentEncoding = getResponseHeader(\"Content-Encoding\") || \"identity\";\n if (contentEncoding !== \"identity\") {\n return returnValues;\n }\n\n returnValues.allowRangeRequests = true;\n return returnValues;\n}\n\nfunction extractFilenameFromHeader(getResponseHeader) {\n const contentDisposition = getResponseHeader(\"Content-Disposition\");\n if (contentDisposition) {\n let filename = getFilenameFromContentDispositionHeader(contentDisposition);\n if (filename.includes(\"%\")) {\n try {\n filename = decodeURIComponent(filename);\n } catch (ex) {}\n }\n if (isPdfFile(filename)) {\n return filename;\n }\n }\n return null;\n}\n\nfunction createResponseStatusError(status, url) {\n if (status === 404 || (status === 0 && url.startsWith(\"file:\"))) {\n return new MissingPDFException('Missing PDF \"' + url + '\".');\n }\n return new UnexpectedResponseException(\n `Unexpected server response (${status}) while retrieving PDF \"${url}\".`,\n status\n );\n}\n\nfunction validateResponseStatus(status) {\n return status === 200 || status === 206;\n}\n\nexport {\n createResponseStatusError,\n extractFilenameFromHeader,\n validateRangeRequestCapabilities,\n validateResponseStatus,\n};\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { stringToBytes } from \"../shared/util.js\";\n\n// This getFilenameFromContentDispositionHeader function is adapted from\n// https://github.com/Rob--W/open-in-browser/blob/7e2e35a38b8b4e981b11da7b2f01df0149049e92/extension/content-disposition.js\n// with the following changes:\n// - Modified to conform to PDF.js's coding style.\n// - Support UTF-8 decoding when TextDecoder is unsupported.\n// - Move return to the end of the function to prevent Babel from dropping the\n// function declarations.\n\n/**\n * Extract file name from the Content-Disposition HTTP response header.\n *\n * @param {string} contentDisposition\n * @returns {string} Filename, if found in the Content-Disposition header.\n */\nfunction getFilenameFromContentDispositionHeader(contentDisposition) {\n let needsEncodingFixup = true;\n\n // filename*=ext-value (\"ext-value\" from RFC 5987, referenced by RFC 6266).\n let tmp = toParamRegExp(\"filename\\\\*\", \"i\").exec(contentDisposition);\n if (tmp) {\n tmp = tmp[1];\n let filename = rfc2616unquote(tmp);\n filename = unescape(filename);\n filename = rfc5987decode(filename);\n filename = rfc2047decode(filename);\n return fixupEncoding(filename);\n }\n\n // Continuations (RFC 2231 section 3, referenced by RFC 5987 section 3.1).\n // filename*n*=part\n // filename*n=part\n tmp = rfc2231getparam(contentDisposition);\n if (tmp) {\n // RFC 2047, section\n const filename = rfc2047decode(tmp);\n return fixupEncoding(filename);\n }\n\n // filename=value (RFC 5987, section 4.1).\n tmp = toParamRegExp(\"filename\", \"i\").exec(contentDisposition);\n if (tmp) {\n tmp = tmp[1];\n let filename = rfc2616unquote(tmp);\n filename = rfc2047decode(filename);\n return fixupEncoding(filename);\n }\n\n // After this line there are only function declarations. We cannot put\n // \"return\" here for readability because babel would then drop the function\n // declarations...\n function toParamRegExp(attributePattern, flags) {\n return new RegExp(\n \"(?:^|;)\\\\s*\" +\n attributePattern +\n \"\\\\s*=\\\\s*\" +\n // Captures: value = token | quoted-string\n // (RFC 2616, section 3.6 and referenced by RFC 6266 4.1)\n \"(\" +\n '[^\";\\\\s][^;\\\\s]*' +\n \"|\" +\n '\"(?:[^\"\\\\\\\\]|\\\\\\\\\"?)+\"?' +\n \")\",\n flags\n );\n }\n function textdecode(encoding, value) {\n if (encoding) {\n if (!/^[\\x00-\\xFF]+$/.test(value)) {\n return value;\n }\n try {\n const decoder = new TextDecoder(encoding, { fatal: true });\n const buffer = stringToBytes(value);\n value = decoder.decode(buffer);\n needsEncodingFixup = false;\n } catch (e) {\n // TextDecoder constructor threw - unrecognized encoding.\n // Or TextDecoder API is not available (in IE / Edge).\n if (/^utf-?8$/i.test(encoding)) {\n // UTF-8 is commonly used, try to support it in another way:\n try {\n value = decodeURIComponent(escape(value));\n needsEncodingFixup = false;\n } catch (err) {}\n }\n }\n }\n return value;\n }\n function fixupEncoding(value) {\n if (needsEncodingFixup && /[\\x80-\\xff]/.test(value)) {\n // Maybe multi-byte UTF-8.\n value = textdecode(\"utf-8\", value);\n if (needsEncodingFixup) {\n // Try iso-8859-1 encoding.\n value = textdecode(\"iso-8859-1\", value);\n }\n }\n return value;\n }\n function rfc2231getparam(contentDispositionStr) {\n const matches = [];\n let match;\n // Iterate over all filename*n= and filename*n*= with n being an integer\n // of at least zero. Any non-zero number must not start with '0'.\n const iter = toParamRegExp(\"filename\\\\*((?!0\\\\d)\\\\d+)(\\\\*?)\", \"ig\");\n while ((match = iter.exec(contentDispositionStr)) !== null) {\n let [, n, quot, part] = match; // eslint-disable-line prefer-const\n n = parseInt(n, 10);\n if (n in matches) {\n // Ignore anything after the invalid second filename*0.\n if (n === 0) {\n break;\n }\n continue;\n }\n matches[n] = [quot, part];\n }\n const parts = [];\n for (let n = 0; n < matches.length; ++n) {\n if (!(n in matches)) {\n // Numbers must be consecutive. Truncate when there is a hole.\n break;\n }\n let [quot, part] = matches[n]; // eslint-disable-line prefer-const\n part = rfc2616unquote(part);\n if (quot) {\n part = unescape(part);\n if (n === 0) {\n part = rfc5987decode(part);\n }\n }\n parts.push(part);\n }\n return parts.join(\"\");\n }\n function rfc2616unquote(value) {\n if (value.startsWith('\"')) {\n const parts = value.slice(1).split('\\\\\"');\n // Find the first unescaped \" and terminate there.\n for (let i = 0; i < parts.length; ++i) {\n const quotindex = parts[i].indexOf('\"');\n if (quotindex !== -1) {\n parts[i] = parts[i].slice(0, quotindex);\n parts.length = i + 1; // Truncates and stop the iteration.\n }\n parts[i] = parts[i].replace(/\\\\(.)/g, \"$1\");\n }\n value = parts.join('\"');\n }\n return value;\n }\n function rfc5987decode(extvalue) {\n // Decodes \"ext-value\" from RFC 5987.\n const encodingend = extvalue.indexOf(\"'\");\n if (encodingend === -1) {\n // Some servers send \"filename*=\" without encoding 'language' prefix,\n // e.g. in https://github.com/Rob--W/open-in-browser/issues/26\n // Let's accept the value like Firefox (57) (Chrome 62 rejects it).\n return extvalue;\n }\n const encoding = extvalue.slice(0, encodingend);\n const langvalue = extvalue.slice(encodingend + 1);\n // Ignore language (RFC 5987 section 3.2.1, and RFC 6266 section 4.1 ).\n const value = langvalue.replace(/^[^']*'/, \"\");\n return textdecode(encoding, value);\n }\n function rfc2047decode(value) {\n // RFC 2047-decode the result. Firefox tried to drop support for it, but\n // backed out because some servers use it - https://bugzil.la/875615\n // Firefox's condition for decoding is here: https://searchfox.org/mozilla-central/rev/4a590a5a15e35d88a3b23dd6ac3c471cf85b04a8/netwerk/mime/nsMIMEHeaderParamImpl.cpp#742-748\n\n // We are more strict and only recognize RFC 2047-encoding if the value\n // starts with \"=?\", since then it is likely that the full value is\n // RFC 2047-encoded.\n\n // Firefox also decodes words even where RFC 2047 section 5 states:\n // \"An 'encoded-word' MUST NOT appear within a 'quoted-string'.\"\n if (!value.startsWith(\"=?\") || /[\\x00-\\x19\\x80-\\xff]/.test(value)) {\n return value;\n }\n // RFC 2047, section 2.4\n // encoded-word = \"=?\" charset \"?\" encoding \"?\" encoded-text \"?=\"\n // charset = token (but let's restrict to characters that denote a\n // possibly valid encoding).\n // encoding = q or b\n // encoded-text = any printable ASCII character other than ? or space.\n // ... but Firefox permits ? and space.\n return value.replace(\n /=\\?([\\w-]*)\\?([QqBb])\\?((?:[^?]|\\?(?!=))*)\\?=/g,\n function (matches, charset, encoding, text) {\n if (encoding === \"q\" || encoding === \"Q\") {\n // RFC 2047 section 4.2.\n text = text.replace(/_/g, \" \");\n text = text.replace(/=([0-9a-fA-F]{2})/g, function (match, hex) {\n return String.fromCharCode(parseInt(hex, 16));\n });\n return textdecode(charset, text);\n } // else encoding is b or B - base64 (RFC 2047 section 4.1)\n try {\n text = atob(text);\n } catch (e) {}\n return textdecode(charset, text);\n }\n );\n }\n\n return \"\";\n}\n\nexport { getFilenameFromContentDispositionHeader };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n assert,\n createPromiseCapability,\n stringToBytes,\n} from \"../shared/util.js\";\nimport {\n createResponseStatusError,\n extractFilenameFromHeader,\n validateRangeRequestCapabilities,\n} from \"./network_utils.js\";\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\n 'Module \"./network.js\" shall not be used with MOZCENTRAL builds.'\n );\n}\n\nconst OK_RESPONSE = 200;\nconst PARTIAL_CONTENT_RESPONSE = 206;\n\nfunction getArrayBuffer(xhr) {\n const data = xhr.response;\n if (typeof data !== \"string\") {\n return data;\n }\n const array = stringToBytes(data);\n return array.buffer;\n}\n\nclass NetworkManager {\n constructor(url, args) {\n this.url = url;\n args = args || {};\n this.isHttp = /^https?:/i.test(url);\n this.httpHeaders = (this.isHttp && args.httpHeaders) || {};\n this.withCredentials = args.withCredentials || false;\n this.getXhr =\n args.getXhr ||\n function NetworkManager_getXhr() {\n return new XMLHttpRequest();\n };\n\n this.currXhrId = 0;\n this.pendingRequests = Object.create(null);\n }\n\n requestRange(begin, end, listeners) {\n const args = {\n begin,\n end,\n };\n for (const prop in listeners) {\n args[prop] = listeners[prop];\n }\n return this.request(args);\n }\n\n requestFull(listeners) {\n return this.request(listeners);\n }\n\n request(args) {\n const xhr = this.getXhr();\n const xhrId = this.currXhrId++;\n const pendingRequest = (this.pendingRequests[xhrId] = {\n xhr,\n });\n\n xhr.open(\"GET\", this.url);\n xhr.withCredentials = this.withCredentials;\n for (const property in this.httpHeaders) {\n const value = this.httpHeaders[property];\n if (typeof value === \"undefined\") {\n continue;\n }\n xhr.setRequestHeader(property, value);\n }\n if (this.isHttp && \"begin\" in args && \"end\" in args) {\n xhr.setRequestHeader(\"Range\", `bytes=${args.begin}-${args.end - 1}`);\n pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE;\n } else {\n pendingRequest.expectedStatus = OK_RESPONSE;\n }\n xhr.responseType = \"arraybuffer\";\n\n if (args.onError) {\n xhr.onerror = function (evt) {\n args.onError(xhr.status);\n };\n }\n xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);\n xhr.onprogress = this.onProgress.bind(this, xhrId);\n\n pendingRequest.onHeadersReceived = args.onHeadersReceived;\n pendingRequest.onDone = args.onDone;\n pendingRequest.onError = args.onError;\n pendingRequest.onProgress = args.onProgress;\n\n xhr.send(null);\n\n return xhrId;\n }\n\n onProgress(xhrId, evt) {\n const pendingRequest = this.pendingRequests[xhrId];\n if (!pendingRequest) {\n // Maybe abortRequest was called...\n return;\n }\n\n if (pendingRequest.onProgress) {\n pendingRequest.onProgress(evt);\n }\n }\n\n onStateChange(xhrId, evt) {\n const pendingRequest = this.pendingRequests[xhrId];\n if (!pendingRequest) {\n // Maybe abortRequest was called...\n return;\n }\n\n const xhr = pendingRequest.xhr;\n if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {\n pendingRequest.onHeadersReceived();\n delete pendingRequest.onHeadersReceived;\n }\n\n if (xhr.readyState !== 4) {\n return;\n }\n\n if (!(xhrId in this.pendingRequests)) {\n // The XHR request might have been aborted in onHeadersReceived()\n // callback, in which case we should abort request.\n return;\n }\n\n delete this.pendingRequests[xhrId];\n\n // Success status == 0 can be on ftp, file and other protocols.\n if (xhr.status === 0 && this.isHttp) {\n if (pendingRequest.onError) {\n pendingRequest.onError(xhr.status);\n }\n return;\n }\n const xhrStatus = xhr.status || OK_RESPONSE;\n\n // From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.2:\n // \"A server MAY ignore the Range header\". This means it's possible to\n // get a 200 rather than a 206 response from a range request.\n const ok_response_on_range_request =\n xhrStatus === OK_RESPONSE &&\n pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;\n\n if (\n !ok_response_on_range_request &&\n xhrStatus !== pendingRequest.expectedStatus\n ) {\n if (pendingRequest.onError) {\n pendingRequest.onError(xhr.status);\n }\n return;\n }\n\n const chunk = getArrayBuffer(xhr);\n if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {\n const rangeHeader = xhr.getResponseHeader(\"Content-Range\");\n const matches = /bytes (\\d+)-(\\d+)\\/(\\d+)/.exec(rangeHeader);\n pendingRequest.onDone({\n begin: parseInt(matches[1], 10),\n chunk,\n });\n } else if (chunk) {\n pendingRequest.onDone({\n begin: 0,\n chunk,\n });\n } else if (pendingRequest.onError) {\n pendingRequest.onError(xhr.status);\n }\n }\n\n getRequestXhr(xhrId) {\n return this.pendingRequests[xhrId].xhr;\n }\n\n isPendingRequest(xhrId) {\n return xhrId in this.pendingRequests;\n }\n\n abortRequest(xhrId) {\n const xhr = this.pendingRequests[xhrId].xhr;\n delete this.pendingRequests[xhrId];\n xhr.abort();\n }\n}\n\n/** @implements {IPDFStream} */\nclass PDFNetworkStream {\n constructor(source) {\n this._source = source;\n this._manager = new NetworkManager(source.url, {\n httpHeaders: source.httpHeaders,\n withCredentials: source.withCredentials,\n });\n this._rangeChunkSize = source.rangeChunkSize;\n this._fullRequestReader = null;\n this._rangeRequestReaders = [];\n }\n\n _onRangeRequestReaderClosed(reader) {\n const i = this._rangeRequestReaders.indexOf(reader);\n if (i >= 0) {\n this._rangeRequestReaders.splice(i, 1);\n }\n }\n\n getFullReader() {\n assert(\n !this._fullRequestReader,\n \"PDFNetworkStream.getFullReader can only be called once.\"\n );\n this._fullRequestReader = new PDFNetworkStreamFullRequestReader(\n this._manager,\n this._source\n );\n return this._fullRequestReader;\n }\n\n getRangeReader(begin, end) {\n const reader = new PDFNetworkStreamRangeRequestReader(\n this._manager,\n begin,\n end\n );\n reader.onClosed = this._onRangeRequestReaderClosed.bind(this);\n this._rangeRequestReaders.push(reader);\n return reader;\n }\n\n cancelAllRequests(reason) {\n if (this._fullRequestReader) {\n this._fullRequestReader.cancel(reason);\n }\n for (const reader of this._rangeRequestReaders.slice(0)) {\n reader.cancel(reason);\n }\n }\n}\n\n/** @implements {IPDFStreamReader} */\nclass PDFNetworkStreamFullRequestReader {\n constructor(manager, source) {\n this._manager = manager;\n\n const args = {\n onHeadersReceived: this._onHeadersReceived.bind(this),\n onDone: this._onDone.bind(this),\n onError: this._onError.bind(this),\n onProgress: this._onProgress.bind(this),\n };\n this._url = source.url;\n this._fullRequestId = manager.requestFull(args);\n this._headersReceivedCapability = createPromiseCapability();\n this._disableRange = source.disableRange || false;\n this._contentLength = source.length; // Optional\n this._rangeChunkSize = source.rangeChunkSize;\n if (!this._rangeChunkSize && !this._disableRange) {\n this._disableRange = true;\n }\n\n this._isStreamingSupported = false;\n this._isRangeSupported = false;\n\n this._cachedChunks = [];\n this._requests = [];\n this._done = false;\n this._storedError = undefined;\n this._filename = null;\n\n this.onProgress = null;\n }\n\n _onHeadersReceived() {\n const fullRequestXhrId = this._fullRequestId;\n const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);\n\n const getResponseHeader = name => {\n return fullRequestXhr.getResponseHeader(name);\n };\n const { allowRangeRequests, suggestedLength } =\n validateRangeRequestCapabilities({\n getResponseHeader,\n isHttp: this._manager.isHttp,\n rangeChunkSize: this._rangeChunkSize,\n disableRange: this._disableRange,\n });\n\n if (allowRangeRequests) {\n this._isRangeSupported = true;\n }\n // Setting right content length.\n this._contentLength = suggestedLength || this._contentLength;\n\n this._filename = extractFilenameFromHeader(getResponseHeader);\n\n if (this._isRangeSupported) {\n // NOTE: by cancelling the full request, and then issuing range\n // requests, there will be an issue for sites where you can only\n // request the pdf once. However, if this is the case, then the\n // server should not be returning that it can support range requests.\n this._manager.abortRequest(fullRequestXhrId);\n }\n\n this._headersReceivedCapability.resolve();\n }\n\n _onDone(args) {\n if (args) {\n if (this._requests.length > 0) {\n const requestCapability = this._requests.shift();\n requestCapability.resolve({ value: args.chunk, done: false });\n } else {\n this._cachedChunks.push(args.chunk);\n }\n }\n this._done = true;\n if (this._cachedChunks.length > 0) {\n return;\n }\n for (const requestCapability of this._requests) {\n requestCapability.resolve({ value: undefined, done: true });\n }\n this._requests.length = 0;\n }\n\n _onError(status) {\n const url = this._url;\n const exception = createResponseStatusError(status, url);\n this._storedError = exception;\n this._headersReceivedCapability.reject(exception);\n for (const requestCapability of this._requests) {\n requestCapability.reject(exception);\n }\n this._requests.length = 0;\n this._cachedChunks.length = 0;\n }\n\n _onProgress(data) {\n if (this.onProgress) {\n this.onProgress({\n loaded: data.loaded,\n total: data.lengthComputable ? data.total : this._contentLength,\n });\n }\n }\n\n get filename() {\n return this._filename;\n }\n\n get isRangeSupported() {\n return this._isRangeSupported;\n }\n\n get isStreamingSupported() {\n return this._isStreamingSupported;\n }\n\n get contentLength() {\n return this._contentLength;\n }\n\n get headersReady() {\n return this._headersReceivedCapability.promise;\n }\n\n async read() {\n if (this._storedError) {\n throw this._storedError;\n }\n if (this._cachedChunks.length > 0) {\n const chunk = this._cachedChunks.shift();\n return { value: chunk, done: false };\n }\n if (this._done) {\n return { value: undefined, done: true };\n }\n const requestCapability = createPromiseCapability();\n this._requests.push(requestCapability);\n return requestCapability.promise;\n }\n\n cancel(reason) {\n this._done = true;\n this._headersReceivedCapability.reject(reason);\n for (const requestCapability of this._requests) {\n requestCapability.resolve({ value: undefined, done: true });\n }\n this._requests.length = 0;\n if (this._manager.isPendingRequest(this._fullRequestId)) {\n this._manager.abortRequest(this._fullRequestId);\n }\n this._fullRequestReader = null;\n }\n}\n\n/** @implements {IPDFStreamRangeReader} */\nclass PDFNetworkStreamRangeRequestReader {\n constructor(manager, begin, end) {\n this._manager = manager;\n const args = {\n onDone: this._onDone.bind(this),\n onProgress: this._onProgress.bind(this),\n };\n this._requestId = manager.requestRange(begin, end, args);\n this._requests = [];\n this._queuedChunk = null;\n this._done = false;\n\n this.onProgress = null;\n this.onClosed = null;\n }\n\n _close() {\n if (this.onClosed) {\n this.onClosed(this);\n }\n }\n\n _onDone(data) {\n const chunk = data.chunk;\n if (this._requests.length > 0) {\n const requestCapability = this._requests.shift();\n requestCapability.resolve({ value: chunk, done: false });\n } else {\n this._queuedChunk = chunk;\n }\n this._done = true;\n for (const requestCapability of this._requests) {\n requestCapability.resolve({ value: undefined, done: true });\n }\n this._requests.length = 0;\n this._close();\n }\n\n _onProgress(evt) {\n if (!this.isStreamingSupported && this.onProgress) {\n this.onProgress({\n loaded: evt.loaded,\n });\n }\n }\n\n get isStreamingSupported() {\n return false;\n }\n\n async read() {\n if (this._queuedChunk !== null) {\n const chunk = this._queuedChunk;\n this._queuedChunk = null;\n return { value: chunk, done: false };\n }\n if (this._done) {\n return { value: undefined, done: true };\n }\n const requestCapability = createPromiseCapability();\n this._requests.push(requestCapability);\n return requestCapability.promise;\n }\n\n cancel(reason) {\n this._done = true;\n for (const requestCapability of this._requests) {\n requestCapability.resolve({ value: undefined, done: true });\n }\n this._requests.length = 0;\n if (this._manager.isPendingRequest(this._requestId)) {\n this._manager.abortRequest(this._requestId);\n }\n this._close();\n }\n}\n\nexport { PDFNetworkStream };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AbortException,\n assert,\n createPromiseCapability,\n} from \"../shared/util.js\";\nimport {\n createResponseStatusError,\n extractFilenameFromHeader,\n validateRangeRequestCapabilities,\n validateResponseStatus,\n} from \"./network_utils.js\";\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\n 'Module \"./fetch_stream.js\" shall not be used with MOZCENTRAL builds.'\n );\n}\n\nfunction createFetchOptions(headers, withCredentials, abortController) {\n return {\n method: \"GET\",\n headers,\n signal: abortController?.signal,\n mode: \"cors\",\n credentials: withCredentials ? \"include\" : \"same-origin\",\n redirect: \"follow\",\n };\n}\n\nfunction createHeaders(httpHeaders) {\n const headers = new Headers();\n for (const property in httpHeaders) {\n const value = httpHeaders[property];\n if (typeof value === \"undefined\") {\n continue;\n }\n headers.append(property, value);\n }\n return headers;\n}\n\n/** @implements {IPDFStream} */\nclass PDFFetchStream {\n constructor(source) {\n this.source = source;\n this.isHttp = /^https?:/i.test(source.url);\n this.httpHeaders = (this.isHttp && source.httpHeaders) || {};\n\n this._fullRequestReader = null;\n this._rangeRequestReaders = [];\n }\n\n get _progressiveDataLength() {\n return this._fullRequestReader?._loaded ?? 0;\n }\n\n getFullReader() {\n assert(\n !this._fullRequestReader,\n \"PDFFetchStream.getFullReader can only be called once.\"\n );\n this._fullRequestReader = new PDFFetchStreamReader(this);\n return this._fullRequestReader;\n }\n\n getRangeReader(begin, end) {\n if (end <= this._progressiveDataLength) {\n return null;\n }\n const reader = new PDFFetchStreamRangeReader(this, begin, end);\n this._rangeRequestReaders.push(reader);\n return reader;\n }\n\n cancelAllRequests(reason) {\n if (this._fullRequestReader) {\n this._fullRequestReader.cancel(reason);\n }\n for (const reader of this._rangeRequestReaders.slice(0)) {\n reader.cancel(reason);\n }\n }\n}\n\n/** @implements {IPDFStreamReader} */\nclass PDFFetchStreamReader {\n constructor(stream) {\n this._stream = stream;\n this._reader = null;\n this._loaded = 0;\n this._filename = null;\n const source = stream.source;\n this._withCredentials = source.withCredentials || false;\n this._contentLength = source.length;\n this._headersCapability = createPromiseCapability();\n this._disableRange = source.disableRange || false;\n this._rangeChunkSize = source.rangeChunkSize;\n if (!this._rangeChunkSize && !this._disableRange) {\n this._disableRange = true;\n }\n\n if (typeof AbortController !== \"undefined\") {\n this._abortController = new AbortController();\n }\n this._isStreamingSupported = !source.disableStream;\n this._isRangeSupported = !source.disableRange;\n\n this._headers = createHeaders(this._stream.httpHeaders);\n\n const url = source.url;\n fetch(\n url,\n createFetchOptions(\n this._headers,\n this._withCredentials,\n this._abortController\n )\n )\n .then(response => {\n if (!validateResponseStatus(response.status)) {\n throw createResponseStatusError(response.status, url);\n }\n this._reader = response.body.getReader();\n this._headersCapability.resolve();\n\n const getResponseHeader = name => {\n return response.headers.get(name);\n };\n const { allowRangeRequests, suggestedLength } =\n validateRangeRequestCapabilities({\n getResponseHeader,\n isHttp: this._stream.isHttp,\n rangeChunkSize: this._rangeChunkSize,\n disableRange: this._disableRange,\n });\n\n this._isRangeSupported = allowRangeRequests;\n // Setting right content length.\n this._contentLength = suggestedLength || this._contentLength;\n\n this._filename = extractFilenameFromHeader(getResponseHeader);\n\n // We need to stop reading when range is supported and streaming is\n // disabled.\n if (!this._isStreamingSupported && this._isRangeSupported) {\n this.cancel(new AbortException(\"Streaming is disabled.\"));\n }\n })\n .catch(this._headersCapability.reject);\n\n this.onProgress = null;\n }\n\n get headersReady() {\n return this._headersCapability.promise;\n }\n\n get filename() {\n return this._filename;\n }\n\n get contentLength() {\n return this._contentLength;\n }\n\n get isRangeSupported() {\n return this._isRangeSupported;\n }\n\n get isStreamingSupported() {\n return this._isStreamingSupported;\n }\n\n async read() {\n await this._headersCapability.promise;\n const { value, done } = await this._reader.read();\n if (done) {\n return { value, done };\n }\n this._loaded += value.byteLength;\n if (this.onProgress) {\n this.onProgress({\n loaded: this._loaded,\n total: this._contentLength,\n });\n }\n const buffer = new Uint8Array(value).buffer;\n return { value: buffer, done: false };\n }\n\n cancel(reason) {\n if (this._reader) {\n this._reader.cancel(reason);\n }\n if (this._abortController) {\n this._abortController.abort();\n }\n }\n}\n\n/** @implements {IPDFStreamRangeReader} */\nclass PDFFetchStreamRangeReader {\n constructor(stream, begin, end) {\n this._stream = stream;\n this._reader = null;\n this._loaded = 0;\n const source = stream.source;\n this._withCredentials = source.withCredentials || false;\n this._readCapability = createPromiseCapability();\n this._isStreamingSupported = !source.disableStream;\n\n if (typeof AbortController !== \"undefined\") {\n this._abortController = new AbortController();\n }\n\n this._headers = createHeaders(this._stream.httpHeaders);\n this._headers.append(\"Range\", `bytes=${begin}-${end - 1}`);\n\n const url = source.url;\n fetch(\n url,\n createFetchOptions(\n this._headers,\n this._withCredentials,\n this._abortController\n )\n )\n .then(response => {\n if (!validateResponseStatus(response.status)) {\n throw createResponseStatusError(response.status, url);\n }\n this._readCapability.resolve();\n this._reader = response.body.getReader();\n })\n .catch(reason => {\n if (reason?.name === \"AbortError\") {\n return;\n }\n throw reason;\n });\n\n this.onProgress = null;\n }\n\n get isStreamingSupported() {\n return this._isStreamingSupported;\n }\n\n async read() {\n await this._readCapability.promise;\n const { value, done } = await this._reader.read();\n if (done) {\n return { value, done };\n }\n this._loaded += value.byteLength;\n if (this.onProgress) {\n this.onProgress({ loaded: this._loaded });\n }\n const buffer = new Uint8Array(value).buffer;\n return { value: buffer, done: false };\n }\n\n cancel(reason) {\n if (this._reader) {\n this._reader.cancel(reason);\n }\n if (this._abortController) {\n this._abortController.abort();\n }\n }\n}\n\nexport { PDFFetchStream };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __w_pdfjs_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint-disable sort-exports/sort-exports */\n\nimport {\n addLinkAttributes,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n isFetchSupported,\n isPdfFile,\n isValidFetchUrl,\n LinkTarget,\n loadScript,\n PDFDateString,\n RenderingCancelledException,\n} from \"./display/display_utils.js\";\nimport {\n build,\n getDocument,\n LoopbackPort,\n PDFDataRangeTransport,\n PDFWorker,\n setPDFNetworkStreamFactory,\n version,\n} from \"./display/api.js\";\nimport {\n CMapCompressionType,\n createObjectURL,\n createPromiseCapability,\n createValidAbsoluteUrl,\n InvalidPDFException,\n MissingPDFException,\n OPS,\n PasswordResponses,\n PermissionFlag,\n removeNullCharacters,\n shadow,\n UnexpectedResponseException,\n UNSUPPORTED_FEATURES,\n Util,\n VerbosityLevel,\n} from \"./shared/util.js\";\nimport { AnnotationLayer } from \"./display/annotation_layer.js\";\nimport { apiCompatibilityParams } from \"./display/api_compatibility.js\";\nimport { GlobalWorkerOptions } from \"./display/worker_options.js\";\nimport { renderTextLayer } from \"./display/text_layer.js\";\nimport { SVGGraphics } from \"./display/svg.js\";\nimport { XfaLayer } from \"./display/xfa_layer.js\";\n\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : void 0;\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsBuild =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_BUILD\") : void 0;\n\nif (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n const streamsPromise = Promise.all([\n import(\"pdfjs/display/network.js\"),\n import(\"pdfjs/display/fetch_stream.js\"),\n ]);\n setPDFNetworkStreamFactory(params => {\n return streamsPromise.then(streams => {\n const [{ PDFNetworkStream }, { PDFFetchStream }] = streams;\n if (isFetchSupported() && isValidFetchUrl(params.url)) {\n return new PDFFetchStream(params);\n }\n return new PDFNetworkStream(params);\n });\n });\n} else if (PDFJSDev.test(\"GENERIC\")) {\n const { isNodeJS } = require(\"./shared/is_node.js\");\n if (isNodeJS) {\n const PDFNodeStream = require(\"./display/node_stream.js\").PDFNodeStream;\n setPDFNetworkStreamFactory(params => {\n return new PDFNodeStream(params);\n });\n } else {\n const PDFNetworkStream = require(\"./display/network.js\").PDFNetworkStream;\n let PDFFetchStream;\n if (isFetchSupported()) {\n PDFFetchStream = require(\"./display/fetch_stream.js\").PDFFetchStream;\n }\n setPDFNetworkStreamFactory(params => {\n if (PDFFetchStream && isValidFetchUrl(params.url)) {\n return new PDFFetchStream(params);\n }\n return new PDFNetworkStream(params);\n });\n }\n} else if (PDFJSDev.test(\"CHROME\")) {\n const PDFNetworkStream = require(\"./display/network.js\").PDFNetworkStream;\n let PDFFetchStream;\n const isChromeWithFetchCredentials = function () {\n // fetch does not include credentials until Chrome 61.0.3138.0 and later.\n // https://chromium.googlesource.com/chromium/src/+/2e231cf052ca5e68e22baf0008ac9e5e29121707\n try {\n // Indexed properties on window are read-only in Chrome 61.0.3151.0+\n // https://chromium.googlesource.com/chromium/src.git/+/58ab4a971b06dec13e4edf9de8382ca6847f6190\n window[999] = 123; // should throw. Note: JS strict mode MUST be enabled.\n delete window[999];\n return false;\n } catch (e) {\n return true;\n }\n };\n if (isFetchSupported() && isChromeWithFetchCredentials()) {\n PDFFetchStream = require(\"./display/fetch_stream.js\").PDFFetchStream;\n }\n setPDFNetworkStreamFactory(params => {\n if (PDFFetchStream && isValidFetchUrl(params.url)) {\n return new PDFFetchStream(params);\n }\n return new PDFNetworkStream(params);\n });\n}\n\nexport {\n // From \"./display/display_utils.js\":\n addLinkAttributes,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n isPdfFile,\n LinkTarget,\n loadScript,\n PDFDateString,\n RenderingCancelledException,\n // From \"./display/api.js\":\n build,\n getDocument,\n LoopbackPort,\n PDFDataRangeTransport,\n PDFWorker,\n version,\n // From \"./shared/util.js\":\n CMapCompressionType,\n createObjectURL,\n createPromiseCapability,\n createValidAbsoluteUrl,\n InvalidPDFException,\n MissingPDFException,\n OPS,\n PasswordResponses,\n PermissionFlag,\n removeNullCharacters,\n shadow,\n UnexpectedResponseException,\n UNSUPPORTED_FEATURES,\n Util,\n VerbosityLevel,\n // From \"./display/annotation_layer.js\":\n AnnotationLayer,\n // From \"./display/api_compatibility.js\":\n apiCompatibilityParams,\n // From \"./display/worker_options.js\":\n GlobalWorkerOptions,\n // From \"./display/text_layer.js\":\n renderTextLayer,\n // From \"./display/svg.js\":\n SVGGraphics,\n // From \"./display/xfa_layer.js\":\n XfaLayer,\n};\n"],"sourceRoot":""} |