pdf.js.map 742 KB

1
  1. {"version":3,"sources":["webpack://pdfjs-dist/build/pdf/webpack/universalModuleDefinition","webpack://pdfjs-dist/build/pdf/webpack/bootstrap","webpack://pdfjs-dist/build/pdf/src/pdf.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/display/api.js","webpack://pdfjs-dist/build/pdf/src/display/display_utils.js","webpack://pdfjs-dist/build/pdf/src/display/font_loader.js","webpack://pdfjs-dist/build/pdf/src/display/api_compatibility.js","webpack://pdfjs-dist/build/pdf/src/shared/is_node.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/xml_parser.js","webpack://pdfjs-dist/build/pdf/src/display/transport_stream.js","webpack://pdfjs-dist/build/pdf/src/display/webgl.js","webpack://pdfjs-dist/build/pdf/src/display/text_layer.js","webpack://pdfjs-dist/build/pdf/src/display/annotation_layer.js","webpack://pdfjs-dist/build/pdf/src/display/svg.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"],"names":["pdfjsVersion","pdfjsBuild","pdfjsSharedUtil","require","pdfjsDisplayAPI","pdfjsDisplayTextLayer","pdfjsDisplayAnnotationLayer","pdfjsDisplayDisplayUtils","pdfjsDisplaySVG","pdfjsDisplayWorkerOptions","pdfjsDisplayAPICompatibility","PDFNodeStream","params","PDFNetworkStream","PDFFetchStream","exports","IDENTITY_MATRIX","FONT_IDENTITY_MATRIX","NativeImageDecoding","NONE","DECODE","DISPLAY","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","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","CMapCompressionType","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","smask","shadingPattern","font","PasswordResponses","NEED_PASSWORD","INCORRECT_PASSWORD","verbosity","Number","console","unreachable","base","other","url","absoluteUrl","baseUrl","_isValidProtocol","Object","enumerable","configurable","writable","BaseException","constructor","NullCharactersRegExp","warn","str","assert","bytes","length","MAX_ARGUMENT_COUNT","String","strBuf","i","chunkEnd","Math","chunk","arr","resultLength","arrayByteLength","pos","data","item","stringToBytes","itemLength","value","buffer8","view32","IsLittleEndianCached","shadow","isLittleEndian","IsEvalSupportedCached","isEvalSupported","rgbBuf","m1","m2","xt","p","m","yt","d","p1","Util","p2","r","p3","p4","v","transpose","a","b","c","first","second","sx","sy","rect","orderedX","rect1","rect2","orderedY","result","PDFStringTranslateTable","code","decodeURIComponent","escape","unescape","encodeURIComponent","arr1","arr2","element","capability","isSettled","get","resolve","reject","createObjectURL","digits","forceDataSchema","URL","blob","type","buffer","ii","b1","b2","b3","d1","d2","d3","d4","DEFAULT_RANGE_CHUNK_SIZE","RENDERING_CANCELLED_TIMEOUT","createPDFNetworkStream","task","source","isArrayBuffer","src","range","rangeTransport","worker","key","window","pdfBytes","isNaN","NativeImageDecoderValues","apiCompatibilityParams","setVerbosityLevel","workerParams","port","GlobalWorkerOptions","PDFWorker","docId","networkStream","initialData","progressiveDone","disableRange","disableStream","httpHeaders","withCredentials","rangeChunkSize","messageHandler","transport","Promise","pdfDataRangeTransport","apiVersion","password","disableAutoFetch","maxImageSize","disableFontFace","disableCreateObjectURL","postMessageTransfers","docBaseUrl","nativeImageDecoderSupport","ignoreErrors","PDFDocumentLoadingTask","nextDocumentId","destroy","transportDestroyed","then","addRangeListener","addProgressListener","addProgressiveReadListener","addProgressiveDoneListener","onDataRange","listener","onDataProgress","onDataProgressiveRead","onDataProgressiveDone","transportReady","requestDataRange","abort","getPage","getPageIndex","getDestinations","getDestination","getPageLabels","getPageLayout","getPageMode","getViewerPreferences","getOpenAction","getOpenActionDestination","deprecated","openAction","getAttachments","getJavaScript","getOutline","getPermissions","getMetadata","getData","getDownloadInfo","getStats","cleanup","pdfBug","getViewport","rotation","offsetX","offsetY","dontFlip","arguments","viewBox","getAnnotations","intent","render","enableWebGL","renderInteractiveForms","imageLayer","canvasFactory","background","renderingIntent","intentState","clearTimeout","canvasFactoryInstance","webGLContext","enable","fnArray","argsArray","lastChunk","pageIndex","complete","error","internalRenderTask","reason","callback","objs","commonObjs","operatorList","useRequestAnimationFrame","renderTask","transparency","getOperatorList","opListTask","streamTextContent","normalizeWhitespace","disableCombineTextItems","TEXT_CONTENT_CHUNK_SIZE","combineTextItems","highWaterMark","size","textContent","getTextContent","readableStream","reader","pump","items","styles","_destroy","waitOn","force","renderCompleted","resetStats","_tryCleanup","_startRenderPage","_renderPageChunk","operatorListChunk","_pumpOperatorList","args","_abortOperatorList","defer","postMessage","cloned","transferable","transfers","Array","desc","cloneValue","e","addEventListener","removeEventListener","terminate","pdfWorkerPorts","isWorkerDisabled","nextFakeWorkerId","isNodeJS","fallbackWorkerSrc","pdfjsFilePath","document","mainWorkerMessageHandler","globalThis","fakeWorkerCapability","loader","getMainThreadWorkerMessageHandler","eval","getWorkerSrc","loadScript","wrapper","name","_initializeFromPort","_initialize","workerSrc","isSameOrigin","createCDNWrapper","terminateEarly","onWorkerError","sendTest","testObj","info","_setupFakeWorker","setupFakeWorkerGlobal","WorkerMessageHandler","id","workerHandler","loadingTask","onUnsupportedFeature","isCompressed","page","terminated","setupMessageHandler","evt","loaded","total","sink","headersCapability","fullReader","isStreamingSupported","isRangeSupported","contentLength","rangeReader","pdfInfo","ex","exception","updatePassword","exportedError","exportedData","fontRegistry","registerFont","pageProxy","img","releaseImageResources","MAX_IMAGE_SIZE_TO_STORE","imageData","components","width","rgbaLength","buf","tmpCanvas","tmpCtx","j","fetched","builtInCMap","_onUnsupportedFeature","pageNumber","promise","pageInfo","results","metadata","contentDispositionFilename","startCleanup","cleanupSuccessful","_ensureObj","resolved","obj","has","clear","cancel","InternalRenderTask","canvasInRendering","initializeGraphics","operatorListChanged","_continue","_scheduleNext","version","build","DEFAULT_LINK_REL","SVG_NS","create","height","canvas","context","reset","canvasAndContext","compressionType","isFetchSupported","isValidFetchUrl","response","cMapData","request","XMLHttpRequest","svg","createElement","centerX","centerY","rotateA","rotateB","rotateC","rotateD","offsetCanvasX","offsetCanvasY","clone","scale","convertToViewportPoint","convertToViewportRectangle","topLeft","bottomRight","convertToPdfPoint","LinkTarget","SELF","BLANK","PARENT","TOP","enabled","urlNullRemoved","removeNullCharacters","link","targetStr","anchor","query","end","time","Date","timeEnd","start","toString","outBuf","longest","duration","Response","protocol","script","isString","pdfDateStringRegex","matches","year","parseInt","month","day","hour","minute","universalTimeRelation","offsetHour","offsetMinute","addNativeFontFace","insertRule","styleElement","styleSheet","nativeFontFace","featureId","rule","_queueLoadingCallback","supported","_prepareFontLoadEvent","FontLoader","requests","nextRequestId","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","fonts","div","span","translatedData","createNativeFontFace","createFontFaceRule","bytesToString","getPathGenerator","cmds","js","current","compatibilityParams","userAgent","isIE","isIOSChrome","process","MIN_FONT_SIZE","MAX_FONT_SIZE","MAX_GROUP_SIZE","MIN_WIDTH_FACTOR","COMPILE_TYPE3_GLYPHS","MAX_SIZE_TO_COMPILE","FULL_CHUNK_HEIGHT","f","ad_bc","bc_ad","old","prev","cosValue","sinValue","CachedCanvases","getCanvas","canvasEntry","addContextCurrentTransform","POINT_TO_PROCESS_LIMIT","imgData","width1","points","POINT_TYPES","lineSize","data0","mask","elem","count","j0","sum","steps","outlines","coords","p0","step","pp","drawOutline","o","jj","CanvasExtraState","setCurrentPoint","CanvasGraphics","EXECUTION_TIME","EXECUTION_STEPS","partialChunkHeight","fullChunks","totalChunks","chunkImgData","srcPos","dest","srcLength","dest32","dest32DataLength","fullSrcDiff","white","black","thisChunkHeight","destPos","srcDiff","k","kEnd","kEndUnrolled","srcByte","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","composed","layer","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","beginSMaskGroup","activeSMask","drawnWidth","drawnHeight","cacheId","scratchCanvas","currentCtx","currentTransform","groupCtx","copyCtxState","suspendSMaskGroup","composeSMask","deltaTransform","resumeSMaskGroup","endSMaskGroup","x","ops","xw","yh","consumePath","strokeColor","fillColor","isPatternFill","needRestore","paths","path","fontObj","bold","italic","typeface","browserFontSize","paintChar","textRenderingMode","fontSize","fillStrokeMode","isAddToPathSet","patternFill","addToPath","fontSizeScale","charSpacing","wordSpacing","fontDirection","textHScale","glyphsLength","glyphs","vertical","spacingDir","defaultVMetrics","widthAdvanceScale","simpleFillText","pattern","patternTransform","lineWidth","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","getShadingPatternFromIR","inv","bl","br","ul","ur","x0","y0","x1","y1","matrix","bbox","group","bounds","canvasBounds","scaleX","scaleY","startTransformInverse","domImage","position","left","top","w","h","maskCanvas","putBinaryImageMask","positions","images","image","map","widthScale","heightScale","imgToPaint","putBinaryImageData","paintWidth","paintHeight","tmpCanvasId","newWidth","newHeight","entry","getSinglePixelWidth","inverse","getCanvasPosition","ShadingIRs","region","fromIR","raw","colorStops","r1","getPattern","applyBoundingBox","grad","createMeshCanvas","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","EXPECTED_SCALE","MAX_PATTERN_SIZE","BORDER_SIZE","boundsWidth","boundsHeight","combinesScale","paddedWidth","paddedHeight","cachedCanvases","backgroundColor","figures","drawFigure","owner","matrixScale","temporaryPatternCanvas","shadingIR","TilingPattern","PaintType","COLORED","UNCOLORED","createPatternCanvas","xstep","ystep","paintType","tilingType","curMatrixScale","combinedScale","dimx","dimy","graphics","getSizeAndScale","maxSize","clipBbox","bboxWidth","bboxHeight","setFillAndStrokeStyleToContext","cssColor","CallbackKind","DATA","ERROR","StreamKind","CANCEL","CANCEL_COMPLETE","CLOSE","ENQUEUE","PULL","PULL_COMPLETE","START_COMPLETE","event","callbackId","wrapReason","action","sourceName","targetName","comObj","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","_postMessage","parser","xmlDocument","_repair","chars","_parse","rdf","nodeName","children","getAll","XMLParserErrorCode","NoError","EndOfDocument","UnterminatedCdat","UnterminatedXmlDeclaration","UnterminatedDoctypeDeclaration","UnterminatedComment","MalformedElement","OutOfMemory","UnterminatedAttributeValue","UnterminatedElement","ElementNeverBegun","ch","isWhitespace","_resolveEntities","entity","_parseContent","attributes","skipWs","attrName","attrValue","attrEndChar","attrEndIndex","parsed","_parseProcessingInstruction","attrStart","parseXml","ch2","pi","q2","complexDoctype","doctypeContent","content","text","onResolveEntity","onPi","onComment","onCdata","onDoctype","onText","onBeginElement","onEndElement","onError","childNodes","index","child","hasChildNodes","parseFromString","isWhitespaceString","node","lastElement","_onReceiveData","found","_onProgress","firstReader","_onProgressiveDone","_removeRangeReader","getFullReader","queuedChunks","getRangeReader","cancelAllRequests","readers","_enqueue","requestCapability","requestsCapability","WebGLUtils","drawFigures","shader","gl","compiled","errorMsg","loadShader","program","shaders","linked","texture","currentCanvas","currentGL","premultipliedalpha","smaskVertexShaderCode","smaskFragmentShaderCode","smaskCache","generateGL","vertexShader","createVertexShader","fragmentShader","createFragmentShader","cache","texCoordLocation","texLayerLocation","texMaskLocation","texCoordBuffer","initSmaskGL","createTexture","maskTexture","figuresVertexShaderCode","figuresFragmentShaderCode","figuresCache","initFiguresGL","coordsMap","colorsMap","pIndex","cIndex","col","coordsBuffer","colorsBuffer","tryInitGL","renderTextLayer","MAX_TEXT_DIVS_TO_RENDER","NonWhitespaceRegexp","textDiv","textDivProperties","angle","canvasWidth","originalTransform","paddingBottom","paddingLeft","paddingRight","paddingTop","isAllWhitespace","geom","tx","style","fontHeight","fontAscent","angleCos","angleSin","divWidth","divHeight","right","bottom","textDivs","textDivsLength","expanded","expandBounds","divProperties","ts","t","findPositiveMin","boxScale","box","x1New","x2New","expandBoundsLTR","boxes","fakeBoundary","horizon","boundary","maxXNew","horizonPart","affectedBoundary","xNew","changedHorizon","lastBoundary","useBoundary","used","textContentItemsStr","TextLayerRenderTask","_processItems","len","appendText","_layoutText","fontFamily","_render","styleCache","textItems","textStyles","expandTextDivs","expand","transformBuf","paddingBuf","divProps","renderParameters","textContentStream","container","enhanceTextSelection","parameters","fieldType","isRenderable","ignoreBorder","_createContainer","horizontalRadius","verticalRadius","radius","_createPopup","trigger","popupElement","title","modificationDate","contents","hideWrapper","popup","addLinkAttributes","target","linkService","rel","_bindLink","_bindNamedAction","JSON","TEXT_ALIGNMENT","fieldWidth","combWidth","_setTextStyle","fallbackName","selectElement","optionElement","option","IGNORE_TYPES","selector","parentElement","parentLeft","parseFloat","parentWidth","BACKGROUND_ENLIGHT","g","dateObject","PDFDateString","date","_formatContents","lines","line","_toggle","_show","pin","_hide","unpin","borderWidth","square","circle","coordinate","polyline","getFilenameFromUrl","stringToPDFString","_download","sortedAnnotations","popupAnnotations","downloadManager","imageResourcesPath","svgFactory","SVGGraphics","SVG_DEFAULTS","fontStyle","fontWeight","XML_NS","XLINK_NS","convertImgDataToPng","PNG_HEADER","CHUNK_WRAPPER_SIZE","crcTable","crc","body","crc32","deflateSyncUncompressed","input","Buffer","output","__non_webpack_require__","level","literals","maxBlockLength","deflateBlocks","idat","adler","adler32","colorType","bitDepth","offsetLiterals","offsetBytes","kind","ihdr","deflateSync","pngLength","writePngChunk","encode","opTree","opListElement","fn","pf","clipCount","maskCount","shadingCount","loadDependencies","transformMatrix","getSVG","svgElement","convertOpList","operatorIdMapping","opList","opListToTree","executeOpTree","opTreeElement","lineWidthScale","textMatrix","pm","addFontStyle","details","setStrokeAlpha","setFillAlpha","_makeColorN_Pattern","_makeTilingPattern","tilingId","txstep","tystep","tiling","tx1","ty1","_makeShadingPattern","shadingId","point0","point1","gradient","focalPoint","circlePoint","focalRadius","circleRadius","stop","colorStop","op","clipId","clipPath","clipElement","_setStrokeAttributes","dashArray","imgObj","imgEl","imgSrc","cliprect","definitions","rootGroup","_ensureClipGroup","clipGroup","_ensureTransformGroup","fs","http","https","fileUriRegex","parsedUrl","parseUrl","_error","_setReadableStream","auth","host","method","handleResponse","getResponseHeader","isHttp","suggestedLength","extractFilenameFromHeader","createRequestOptions","stat","returnValues","allowRangeRequests","contentEncoding","contentDisposition","filename","getFilenameFromContentDispositionHeader","status","needsEncodingFixup","toParamRegExp","rfc2616unquote","rfc5987decode","rfc2047decode","fixupEncoding","rfc2231getparam","decoder","fatal","textdecode","iter","n","parts","part","quotindex","encodingend","extvalue","encoding","langvalue","OK_RESPONSE","PARTIAL_CONTENT_RESPONSE","xhr","array","requestRange","listeners","requestFull","xhrId","pendingRequest","onProgress","onStateChange","xhrStatus","ok_response_on_range_request","getArrayBuffer","rangeHeader","begin","hasPendingRequests","getRequestXhr","isPendingRequest","abortAllRequests","abortRequest","_onRangeRequestReaderClosed","onHeadersReceived","onDone","manager","_onHeadersReceived","fullRequestXhrId","fullRequestXhr","_onDone","_onError","createResponseStatusError","_close","signal","abortController","mode","credentials","redirect","headers","createHeaders","fetch","createFetchOptions","validateResponseStatus"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;Q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AAO;AAAEzD,aAAF;AAAiBkZ,YAAjB;AAAA,KAAP;AAnD4B;;AAsD9B7F,iBAAe;AACb,QAAI,KAAJ,SAAkB;AAChB,0BADgB,MAChB;AAFW;;AAIb,QAAI,KAAJ,kBAA2B;AACzB,4BADyB,KACzB;AALW;AAtDe;;AAAA,C","file":"pdf.js","sourcesContent":["(function webpackUniversalModuleDefinition(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 "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __w_pdfjs_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__w_pdfjs_require__.m = modules;\n\n \t// expose the module cache\n \t__w_pdfjs_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__w_pdfjs_require__.d = function(exports, name, getter) {\n \t\tif(!__w_pdfjs_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__w_pdfjs_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__w_pdfjs_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __w_pdfjs_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__w_pdfjs_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__w_pdfjs_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__w_pdfjs_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__w_pdfjs_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __w_pdfjs_require__(__w_pdfjs_require__.s = 0);\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 no-unused-vars */\n\n\"use strict\";\n\nvar pdfjsVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : void 0;\nvar pdfjsBuild =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_BUILD\") : void 0;\n\nvar pdfjsSharedUtil = require(\"./shared/util.js\");\nvar pdfjsDisplayAPI = require(\"./display/api.js\");\nvar pdfjsDisplayTextLayer = require(\"./display/text_layer.js\");\nvar pdfjsDisplayAnnotationLayer = require(\"./display/annotation_layer.js\");\nvar pdfjsDisplayDisplayUtils = require(\"./display/display_utils.js\");\nvar pdfjsDisplaySVG = require(\"./display/svg.js\");\nconst pdfjsDisplayWorkerOptions = require(\"./display/worker_options.js\");\nconst pdfjsDisplayAPICompatibility = require(\"./display/api_compatibility.js\");\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const { isNodeJS } = require(\"./shared/is_node.js\");\n if (isNodeJS) {\n const PDFNodeStream = require(\"./display/node_stream.js\").PDFNodeStream;\n pdfjsDisplayAPI.setPDFNetworkStreamFactory(params => {\n return new PDFNodeStream(params);\n });\n } else {\n const PDFNetworkStream = require(\"./display/network.js\").PDFNetworkStream;\n let PDFFetchStream;\n if (pdfjsDisplayDisplayUtils.isFetchSupported()) {\n PDFFetchStream = require(\"./display/fetch_stream.js\").PDFFetchStream;\n }\n pdfjsDisplayAPI.setPDFNetworkStreamFactory(params => {\n if (\n PDFFetchStream &&\n pdfjsDisplayDisplayUtils.isValidFetchUrl(params.url)\n ) {\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 (\n pdfjsDisplayDisplayUtils.isFetchSupported() &&\n isChromeWithFetchCredentials()\n ) {\n PDFFetchStream = require(\"./display/fetch_stream.js\").PDFFetchStream;\n }\n pdfjsDisplayAPI.setPDFNetworkStreamFactory(params => {\n if (\n PDFFetchStream &&\n pdfjsDisplayDisplayUtils.isValidFetchUrl(params.url)\n ) {\n return new PDFFetchStream(params);\n }\n return new PDFNetworkStream(params);\n });\n}\n\nexports.build = pdfjsDisplayAPI.build;\nexports.version = pdfjsDisplayAPI.version;\nexports.getDocument = pdfjsDisplayAPI.getDocument;\nexports.LoopbackPort = pdfjsDisplayAPI.LoopbackPort;\nexports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport;\nexports.PDFWorker = pdfjsDisplayAPI.PDFWorker;\nexports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer;\nexports.AnnotationLayer = pdfjsDisplayAnnotationLayer.AnnotationLayer;\nexports.createPromiseCapability = pdfjsSharedUtil.createPromiseCapability;\nexports.PasswordResponses = pdfjsSharedUtil.PasswordResponses;\nexports.InvalidPDFException = pdfjsSharedUtil.InvalidPDFException;\nexports.MissingPDFException = pdfjsSharedUtil.MissingPDFException;\nexports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics;\nexports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding;\nexports.CMapCompressionType = pdfjsSharedUtil.CMapCompressionType;\nexports.PermissionFlag = pdfjsSharedUtil.PermissionFlag;\nexports.UnexpectedResponseException =\n pdfjsSharedUtil.UnexpectedResponseException;\nexports.OPS = pdfjsSharedUtil.OPS;\nexports.VerbosityLevel = pdfjsSharedUtil.VerbosityLevel;\nexports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES;\nexports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl;\nexports.createObjectURL = pdfjsSharedUtil.createObjectURL;\nexports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters;\nexports.shadow = pdfjsSharedUtil.shadow;\nexports.Util = pdfjsSharedUtil.Util;\nexports.RenderingCancelledException =\n pdfjsDisplayDisplayUtils.RenderingCancelledException;\nexports.getFilenameFromUrl = pdfjsDisplayDisplayUtils.getFilenameFromUrl;\nexports.LinkTarget = pdfjsDisplayDisplayUtils.LinkTarget;\nexports.addLinkAttributes = pdfjsDisplayDisplayUtils.addLinkAttributes;\nexports.loadScript = pdfjsDisplayDisplayUtils.loadScript;\nexports.PDFDateString = pdfjsDisplayDisplayUtils.PDFDateString;\nexports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions;\nexports.apiCompatibilityParams =\n pdfjsDisplayAPICompatibility.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/* eslint no-var: error */\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\nconst NativeImageDecoding = {\n NONE: \"none\",\n DECODE: \"decode\",\n DISPLAY: \"display\",\n};\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 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 unknown: \"unknown\",\n forms: \"forms\",\n javaScript: \"javaScript\",\n smask: \"smask\",\n shadingPattern: \"shadingPattern\",\n font: \"font\",\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 whitelisted 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\nconst BaseException = (function BaseExceptionClosure() {\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\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|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);\n return arr.byteLength;\n}\n\n/**\n * Combines array items (arrays) into single Uint8Array object.\n * @param {Array} arr - the array of the arrays (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\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 rgbBuf = [\"rgb(\", 0, \",\", 0, \",\", 0, \")\"];\n\nclass Util {\n // makeCssRgb() can be called thousands of times. Using ´rgbBuf` avoids\n // creating many intermediate strings.\n static makeCssRgb(r, g, b) {\n rgbBuf[1] = r;\n rgbBuf[3] = g;\n rgbBuf[5] = b;\n return rgbBuf.join(\"\");\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) * (a + d) - 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\n// prettier-ignore\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,\n 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 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, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014,\n 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C,\n 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160,\n 0x178, 0x17D, 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 stringToUTF8String(str) {\n return decodeURIComponent(escape(str));\n}\n\nfunction utf8StringToString(str) {\n return unescape(encodeURIComponent(str));\n}\n\nfunction isEmptyObj(obj) {\n for (const key in obj) {\n return false;\n }\n return true;\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 return arr1.every(function(element, index) {\n return element === arr2[index];\n });\n}\n\n/**\n * Promise Capability object.\n *\n * @typedef {Object} PromiseCapability\n * @property {Promise} 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\nconst createObjectURL = (function createObjectURLClosure() {\n // Blob/createObjectURL is not available, falling back to data schema.\n const digits =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n return function createObjectURL(data, contentType, forceDataSchema = false) {\n if (!forceDataSchema && URL.createObjectURL) {\n const blob = new Blob([data], { type: contentType });\n return URL.createObjectURL(blob);\n }\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})();\n\nexport {\n BaseException,\n FONT_IDENTITY_MATRIX,\n IDENTITY_MATRIX,\n OPS,\n VerbosityLevel,\n UNSUPPORTED_FEATURES,\n AnnotationBorderStyleType,\n AnnotationFieldFlag,\n AnnotationFlag,\n AnnotationMarkedState,\n AnnotationReplyType,\n AnnotationReviewState,\n AnnotationStateModelType,\n AnnotationType,\n FontType,\n ImageKind,\n CMapCompressionType,\n AbortException,\n InvalidPDFException,\n MissingPDFException,\n NativeImageDecoding,\n PasswordException,\n PasswordResponses,\n PermissionFlag,\n StreamType,\n TextRenderingMode,\n UnexpectedResponseException,\n UnknownErrorException,\n Util,\n FormatError,\n arrayByteLength,\n arraysToBytes,\n assert,\n bytesToString,\n createPromiseCapability,\n createObjectURL,\n getVerbosityLevel,\n info,\n isArrayBuffer,\n isArrayEqual,\n isBool,\n isEmptyObj,\n isNum,\n isString,\n isSameOrigin,\n createValidAbsoluteUrl,\n IsLittleEndianCached,\n IsEvalSupportedCached,\n removeNullCharacters,\n setVerbosityLevel,\n shadow,\n string32,\n stringToBytes,\n stringToPDFString,\n stringToUTF8String,\n utf8StringToString,\n warn,\n unreachable,\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/* eslint no-var: error */\n\n// Skip compatibility checks for modern builds (unless we're running the\n// unit-tests in Node.js/Travis) and if we already ran the module.\nif (\n (typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!SKIP_BABEL || (LIB && TESTING)\")) &&\n (typeof globalThis === \"undefined\" || !globalThis._pdfjsCompatibilityChecked)\n) {\n // Provides support for globalThis in legacy browsers.\n // Support: IE11/Edge, Opera\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 const { isNodeJS } = require(\"./is_node.js\");\n\n const hasDOM = typeof window === \"object\" && typeof document === \"object\";\n const userAgent =\n (typeof navigator !== \"undefined\" && navigator.userAgent) || \"\";\n const isIE = /Trident/.test(userAgent);\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 ChildNode.remove in legacy browsers.\n // Support: IE.\n (function checkChildNodeRemove() {\n if (!hasDOM) {\n return;\n }\n if (typeof Element.prototype.remove !== \"undefined\") {\n return;\n }\n Element.prototype.remove = function() {\n if (this.parentNode) {\n // eslint-disable-next-line mozilla/avoid-removeChild\n this.parentNode.removeChild(this);\n }\n };\n })();\n\n // Provides support for DOMTokenList.prototype.{add, remove}, with more than\n // one parameter, in legacy browsers.\n // Support: IE\n (function checkDOMTokenListAddRemove() {\n if (!hasDOM || isNodeJS) {\n return;\n }\n const div = document.createElement(\"div\");\n div.classList.add(\"testOne\", \"testTwo\");\n\n if (\n div.classList.contains(\"testOne\") === true &&\n div.classList.contains(\"testTwo\") === true\n ) {\n return;\n }\n const OriginalDOMTokenListAdd = DOMTokenList.prototype.add;\n const OriginalDOMTokenListRemove = DOMTokenList.prototype.remove;\n\n DOMTokenList.prototype.add = function(...tokens) {\n for (const token of tokens) {\n OriginalDOMTokenListAdd.call(this, token);\n }\n };\n DOMTokenList.prototype.remove = function(...tokens) {\n for (const token of tokens) {\n OriginalDOMTokenListRemove.call(this, token);\n }\n };\n })();\n\n // Provides support for DOMTokenList.prototype.toggle, with the optional\n // \"force\" parameter, in legacy browsers.\n // Support: IE\n (function checkDOMTokenListToggle() {\n if (!hasDOM || isNodeJS) {\n return;\n }\n const div = document.createElement(\"div\");\n if (div.classList.toggle(\"test\", 0) === false) {\n return;\n }\n\n DOMTokenList.prototype.toggle = function(token) {\n const force =\n arguments.length > 1 ? !!arguments[1] : !this.contains(token);\n return this[force ? \"add\" : \"remove\"](token), force;\n };\n })();\n\n // Provides support for window.history.{pushState, replaceState}, with the\n // `url` parameter set to `undefined`, without breaking the document URL.\n // Support: IE\n (function checkWindowHistoryPushStateReplaceState() {\n if (!hasDOM || !isIE) {\n return;\n }\n const OriginalPushState = window.history.pushState;\n const OriginalReplaceState = window.history.replaceState;\n\n window.history.pushState = function(state, title, url) {\n const args = url === undefined ? [state, title] : [state, title, url];\n OriginalPushState.apply(this, args);\n };\n window.history.replaceState = function(state, title, url) {\n const args = url === undefined ? [state, title] : [state, title, url];\n OriginalReplaceState.apply(this, args);\n };\n })();\n\n // Provides support for String.prototype.startsWith in legacy browsers.\n // Support: IE, Chrome<41\n (function checkStringStartsWith() {\n if (String.prototype.startsWith) {\n return;\n }\n require(\"core-js/es/string/starts-with.js\");\n })();\n\n // Provides support for String.prototype.endsWith in legacy browsers.\n // Support: IE, Chrome<41\n (function checkStringEndsWith() {\n if (String.prototype.endsWith) {\n return;\n }\n require(\"core-js/es/string/ends-with.js\");\n })();\n\n // Provides support for String.prototype.includes in legacy browsers.\n // Support: IE, Chrome<41\n (function checkStringIncludes() {\n if (String.prototype.includes) {\n return;\n }\n require(\"core-js/es/string/includes.js\");\n })();\n\n // Provides support for Array.prototype.includes in legacy browsers.\n // Support: IE, Chrome<47\n (function checkArrayIncludes() {\n if (Array.prototype.includes) {\n return;\n }\n require(\"core-js/es/array/includes.js\");\n })();\n\n // Provides support for Array.from in legacy browsers.\n // Support: IE\n (function checkArrayFrom() {\n if (Array.from) {\n return;\n }\n require(\"core-js/es/array/from.js\");\n })();\n\n // Provides support for Object.assign in legacy browsers.\n // Support: IE\n (function checkObjectAssign() {\n if (Object.assign) {\n return;\n }\n require(\"core-js/es/object/assign.js\");\n })();\n\n // Provides support for Math.log2 in legacy browsers.\n // Support: IE, Chrome<38\n (function checkMathLog2() {\n if (Math.log2) {\n return;\n }\n Math.log2 = require(\"core-js/es/math/log2.js\");\n })();\n\n // Provides support for Number.isNaN in legacy browsers.\n // Support: IE.\n (function checkNumberIsNaN() {\n if (Number.isNaN) {\n return;\n }\n Number.isNaN = require(\"core-js/es/number/is-nan.js\");\n })();\n\n // Provides support for Number.isInteger in legacy browsers.\n // Support: IE, Chrome<34\n (function checkNumberIsInteger() {\n if (Number.isInteger) {\n return;\n }\n Number.isInteger = require(\"core-js/es/number/is-integer.js\");\n })();\n\n // Support: IE, Safari<11, Chrome<63\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 && globalThis.Promise.allSettled) {\n return;\n }\n globalThis.Promise = require(\"core-js/es/promise/index.js\");\n })();\n\n // Support: IE\n (function checkURL() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"IMAGE_DECODERS\")) {\n // The current image decoders don't use the `URL` constructor, so it\n // doesn't need to be polyfilled for the IMAGE_DECODERS build target.\n return;\n }\n if (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"GENERIC\")) {\n // The `URL` constructor is assumed to be available in the extension\n // builds.\n return;\n }\n globalThis.URL = require(\"core-js/web/url.js\");\n })();\n\n // Support: IE, 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 = require(\"web-streams-polyfill/dist/ponyfill.js\").ReadableStream;\n })();\n\n // We want to support Map iteration, but it doesn't seem possible to easily\n // test for that specifically; hence using a similarly unsupported property.\n // Support: IE11\n (function checkMapEntries() {\n if (globalThis.Map && globalThis.Map.prototype.entries) {\n return;\n }\n globalThis.Map = require(\"core-js/es/map/index.js\");\n })();\n\n // We want to support Set iteration, but it doesn't seem possible to easily\n // test for that specifically; hence using a similarly unsupported property.\n // Support: IE11\n (function checkSetEntries() {\n if (globalThis.Set && globalThis.Set.prototype.entries) {\n return;\n }\n globalThis.Set = require(\"core-js/es/set/index.js\");\n })();\n\n // Support: IE<11, Safari<8, Chrome<36\n (function checkWeakMap() {\n if (globalThis.WeakMap) {\n return;\n }\n globalThis.WeakMap = require(\"core-js/es/weak-map/index.js\");\n })();\n\n // Support: IE11\n (function checkWeakSet() {\n if (globalThis.WeakSet) {\n return;\n }\n globalThis.WeakSet = require(\"core-js/es/weak-set/index.js\");\n })();\n\n // Provides support for String.codePointAt in legacy browsers.\n // Support: IE11.\n (function checkStringCodePointAt() {\n if (String.prototype.codePointAt) {\n return;\n }\n require(\"core-js/es/string/code-point-at.js\");\n })();\n\n // Provides support for String.fromCodePoint in legacy browsers.\n // Support: IE11.\n (function checkStringFromCodePoint() {\n if (String.fromCodePoint) {\n return;\n }\n String.fromCodePoint = require(\"core-js/es/string/from-code-point.js\");\n })();\n\n // Support: IE\n (function checkSymbol() {\n if (globalThis.Symbol) {\n return;\n }\n require(\"core-js/es/symbol/index.js\");\n })();\n\n // Provides support for String.prototype.padStart in legacy browsers.\n // Support: IE, Chrome<57\n (function checkStringPadStart() {\n if (String.prototype.padStart) {\n return;\n }\n require(\"core-js/es/string/pad-start.js\");\n })();\n\n // Provides support for String.prototype.padEnd in legacy browsers.\n // Support: IE, Chrome<57\n (function checkStringPadEnd() {\n if (String.prototype.padEnd) {\n return;\n }\n require(\"core-js/es/string/pad-end.js\");\n })();\n\n // Provides support for Object.values in legacy browsers.\n // Support: IE, Chrome<54\n (function checkObjectValues() {\n if (Object.values) {\n return;\n }\n Object.values = require(\"core-js/es/object/values.js\");\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 no-var: error */\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 NativeImageDecoding,\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 loadScript,\n PageViewport,\n releaseImageResources,\n RenderingCancelledException,\n StatTimer,\n} from \"./display_utils.js\";\nimport { FontFaceObject, FontLoader } from \"./font_loader.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 { PDFDataTransportStream } from \"./transport_stream.js\";\nimport { WebGLContext } from \"./webgl.js\";\n\nconst DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536\nconst RENDERING_CANCELLED_TIMEOUT = 100; // ms\n\n/**\n * @typedef {function} IPDFStreamFactory\n * @param {DocumentInitParameters} params The document initialization\n * parameters. The \"url\" key is always present.\n * @returns {IPDFStream}\n */\n\n/** @type IPDFStreamFactory */\nlet createPDFNetworkStream;\n\n/**\n * Sets the function that instantiates a IPDFStream as an alternative PDF data\n * transport.\n * @param {IPDFStreamFactory} pdfNetworkStreamFactory - the factory function\n * that takes document initialization parameters (including a \"url\") and returns\n * an instance of IPDFStream.\n */\nfunction setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {\n createPDFNetworkStream = pdfNetworkStreamFactory;\n}\n\n/**\n * Document initialization / loading parameters object.\n *\n * @typedef {Object} DocumentInitParameters\n * @property {string} [url] - The URL of the PDF.\n * @property {TypedArray|Array|string} [data] - Binary PDF data. Use typed\n * 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\n * progress reports and range requests operations.\n * @property {PDFDataRangeTransport} [range]\n * @property {number} [rangeChunkSize] - Specify maximum number of bytes\n * fetched per range request. The default value is 2^16 = 65536.\n * @property {PDFWorker} [worker] - The worker that will be used for\n * the loading and parsing of the PDF data.\n * @property {number} [verbosity] - Controls the logging level; the\n * constants from {VerbosityLevel} should be used.\n * @property {string} [docBaseUrl] - The base URL of the document,\n * used when attempting to recover valid absolute URLs for annotations, and\n * outline items, that (incorrectly) only specify relative URLs.\n * @property {string} [nativeImageDecoderSupport] - Strategy for\n * decoding certain (simple) JPEG images in the browser. This is useful for\n * environments without DOM image and canvas support, such as e.g. Node.js.\n * Valid values are 'decode', 'display' or 'none'; where 'decode' is intended\n * for browsers with full image/canvas support, 'display' for environments\n * with limited image support through stubs (useful for SVG conversion),\n * and 'none' where JPEG images will be decoded entirely by PDF.js.\n * The default value is 'decode'.\n * @property {string} [cMapUrl] - The URL where the predefined\n * Adobe CMaps are located. Include trailing slash.\n * @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are\n * binary packed.\n * @property {Object} [CMapReaderFactory] - The factory that will be\n * used when reading built-in CMap files. Providing a custom factory is useful\n * for environments without `XMLHttpRequest` support, such as e.g. Node.js.\n * 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\n * in total pixels, i.e. width * height. Images above this value will not be\n * rendered. Use -1 for no limit, which is also the default value.\n * @property {boolean} [isEvalSupported] - Determines if we can eval\n * strings as JS. Primarily used to improve performance of font rendering,\n * and when parsing PDF functions. The default value is `true`.\n * @property {boolean} [disableFontFace] - By default fonts are\n * converted to OpenType fonts and loaded via font face rules. If disabled,\n * fonts will be rendered using a built-in font renderer that constructs the\n * glyphs with primitive path commands. The default value is `false`.\n * @property {boolean} [disableRange] - Disable range request loading\n * of PDF files. When enabled, and if the server supports partial content\n * requests, then the PDF will be fetched in chunks.\n * The default value is `false`.\n * @property {boolean} [disableStream] - Disable streaming of PDF file\n * data. By default PDF.js attempts to load PDFs in chunks.\n * The default value is `false`.\n * @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF\n * file 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 * NOTE: It is also necessary to disable streaming, see above,\n * in order for disabling of pre-fetching to work correctly.\n * @property {boolean} [disableCreateObjectURL] - Disable the use of\n * `URL.createObjectURL`, for compatibility with older browsers.\n * The default value is `false`.\n * @property {boolean} [pdfBug] - Enables special hooks for debugging\n * PDF.js (see `web/debugger.js`). The default value is `false`.\n */\n\n/**\n * @typedef {Object} PDFDocumentStats\n * @property {Object} streamTypes - Used stream types in the document (an item\n * is set to true if specific stream ID was used in the document).\n * @property {Object} fontTypes - Used font types in the document (an item\n * is set to true if specific font ID was used in the document).\n */\n\n/**\n * This is the main entry point for loading a PDF and interacting with it.\n * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR)\n * is used, which means it must follow the same origin rules that any XHR does\n * e.g. No cross domain requests without CORS.\n *\n * @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src\n * Can be a url to where a PDF is located, a typed array (Uint8Array)\n * already populated with data or parameter object.\n * @returns {PDFDocumentLoadingTask}\n */\nfunction getDocument(src) {\n const task = new PDFDocumentLoadingTask();\n\n let source;\n if (typeof src === \"string\") {\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 Uint8Array, string or a 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 if (key === \"url\" && typeof window !== \"undefined\") {\n // The full path is required in the 'url' field.\n params[key] = new URL(source[key], window.location).href;\n continue;\n } else if (key === \"range\") {\n rangeTransport = source[key];\n continue;\n } else if (key === \"worker\") {\n worker = source[key];\n continue;\n } else if (key === \"data\" && !(source[key] instanceof Uint8Array)) {\n // Converting string or array-like data to Uint8Array.\n const pdfBytes = source[key];\n if (typeof pdfBytes === \"string\") {\n params[key] = stringToBytes(pdfBytes);\n } else if (\n typeof pdfBytes === \"object\" &&\n pdfBytes !== null &&\n !isNaN(pdfBytes.length)\n ) {\n params[key] = new Uint8Array(pdfBytes);\n } else if (isArrayBuffer(pdfBytes)) {\n params[key] = new Uint8Array(pdfBytes);\n } else {\n throw new Error(\n \"Invalid PDF binary data: either typed array, \" +\n \"string or array-like object is expected in the \" +\n \"data property.\"\n );\n }\n continue;\n }\n params[key] = source[key];\n }\n\n params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;\n params.CMapReaderFactory = params.CMapReaderFactory || DOMCMapReaderFactory;\n params.ignoreErrors = params.stopAtErrors !== true;\n params.pdfBug = params.pdfBug === true;\n\n const NativeImageDecoderValues = Object.values(NativeImageDecoding);\n if (\n params.nativeImageDecoderSupport === undefined ||\n !NativeImageDecoderValues.includes(params.nativeImageDecoderSupport)\n ) {\n params.nativeImageDecoderSupport =\n apiCompatibilityParams.nativeImageDecoderSupport ||\n NativeImageDecoding.DECODE;\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\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 if (typeof params.disableCreateObjectURL !== \"boolean\") {\n params.disableCreateObjectURL =\n apiCompatibilityParams.disableCreateObjectURL || 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 return _fetchDocument(worker, params, rangeTransport, docId).then(\n function(workerId) {\n if (task.destroyed) {\n throw new Error(\"Loading aborted\");\n }\n\n let networkStream;\n if (rangeTransport) {\n networkStream = new PDFDataTransportStream(\n {\n length: params.length,\n initialData: params.initialData,\n progressiveDone: params.progressiveDone,\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\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 * @param {PDFWorker} worker\n * @param {Object} source\n * @param {PDFDataRangeTransport} pdfDataRangeTransport\n * @param {string} docId Unique document id, used as MessageHandler id.\n * @returns {Promise} The promise, which is resolved when worker id of\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 }\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 disableCreateObjectURL: source.disableCreateObjectURL,\n postMessageTransfers: worker.postMessageTransfers,\n docBaseUrl: source.docBaseUrl,\n nativeImageDecoderSupport: source.nativeImageDecoderSupport,\n ignoreErrors: source.ignoreErrors,\n isEvalSupported: source.isEvalSupported,\n })\n .then(function(workerId) {\n if (worker.destroyed) {\n throw new Error(\"Worker was destroyed\");\n }\n return workerId;\n });\n}\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 class PDFDocumentLoadingTask {\n constructor() {\n this._capability = createPromiseCapability();\n this._transport = null;\n this._worker = null;\n\n /**\n * Unique document loading task id -- used in MessageHandlers.\n * @type {string}\n */\n this.docId = \"d\" + nextDocumentId++;\n\n /**\n * Shows if loading task is destroyed.\n * @type {boolean}\n */\n this.destroyed = false;\n\n /**\n * Callback to request a password if wrong or no password was provided.\n * The callback receives two parameters: function that needs to be called\n * with new password and reason (see {PasswordResponses}).\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: {number} loaded and {number} total.\n */\n this.onProgress = null;\n\n /**\n * Callback to when unsupported feature is used. The callback receives\n * an {UNSUPPORTED_FEATURES} argument.\n */\n this.onUnsupportedFeature = null;\n }\n\n /**\n * Promise for document loading task completion.\n * @type {Promise}\n */\n get promise() {\n return this._capability.promise;\n }\n\n /**\n * Aborts all network requests and destroys worker.\n * @returns {Promise} A promise that is resolved after destruction activity\n * is 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 /**\n * Registers callbacks to indicate the document loading completion.\n * @ignore\n */\n then(onFulfilled, onRejected) {\n throw new Error(\n \"Removed API method: \" +\n \"PDFDocumentLoadingTask.then, use the `promise` getter instead.\"\n );\n }\n }\n return PDFDocumentLoadingTask;\n})();\n\n/**\n * Abstract class to support range requests file loading.\n * @param {number} length\n * @param {Uint8Array} initialData\n * @param {boolean} progressiveDone\n */\nclass PDFDataRangeTransport {\n constructor(length, initialData, progressiveDone = false) {\n this.length = length;\n this.initialData = initialData;\n this.progressiveDone = progressiveDone;\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. Also, contains commonly used\n * properties that can be read synchronously.\n */\nclass PDFDocumentProxy {\n constructor(pdfInfo, transport) {\n this._pdfInfo = pdfInfo;\n this._transport = transport;\n }\n\n /**\n * @type {number} Total number of pages the PDF contains.\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 * @param {number} pageNumber - The page number to get. The first page is 1.\n * @returns {Promise} A promise that is resolved with a {@link PDFPageProxy}\n * object.\n */\n getPage(pageNumber) {\n return this._transport.getPage(pageNumber);\n }\n\n /**\n * @param {{num: number, gen: number}} ref - The page reference. Must have\n * the `num` and `gen` properties.\n * @returns {Promise} A promise that is resolved with the page index (starting\n * from zero) that is associated with the reference.\n */\n getPageIndex(ref) {\n return this._transport.getPageIndex(ref);\n }\n\n /**\n * @returns {Promise} A promise that is resolved with a lookup table for\n * mapping named destinations to reference numbers.\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} A promise that is resolved with all information\n * of the given named destination.\n */\n getDestination(id) {\n return this._transport.getDestination(id);\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Array} containing\n * the page labels that correspond to the page indexes, or `null` when\n * no page labels are present in the PDF file.\n */\n getPageLabels() {\n return this._transport.getPageLabels();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with a {string} containing\n * the page layout name.\n */\n getPageLayout() {\n return this._transport.getPageLayout();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with a {string} containing\n * the page mode name.\n */\n getPageMode() {\n return this._transport.getPageMode();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Object} containing\n * the viewer preferences.\n */\n getViewerPreferences() {\n return this._transport.getViewerPreferences();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Object} containing\n * the currently supported actions, or `null` when no OpenAction exists.\n */\n getOpenAction() {\n return this._transport.getOpenAction();\n }\n\n getOpenActionDestination() {\n deprecated(\"getOpenActionDestination, use getOpenAction instead.\");\n return this.getOpenAction().then(function(openAction) {\n return openAction && openAction.dest ? openAction.dest : null;\n });\n }\n\n /**\n * @returns {Promise} A promise that is resolved with a lookup table for\n * mapping named attachments to their content.\n */\n getAttachments() {\n return this._transport.getAttachments();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Array} of all the\n * JavaScript strings in the name tree, or `null` if no JavaScript exists.\n */\n getJavaScript() {\n return this._transport.getJavaScript();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Array} that is a\n * tree outline (if it has one) of the PDF. The tree is in the format of:\n * [\n * {\n * title: string,\n * bold: boolean,\n * italic: boolean,\n * color: rgb Uint8ClampedArray,\n * count: integer or undefined,\n * dest: dest obj,\n * url: string,\n * items: array of more items like this\n * },\n * ...\n * ]\n */\n getOutline() {\n return this._transport.getOutline();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Array} that contains\n * the permission flags for the PDF document, or `null` when\n * no permissions are present in the PDF file.\n */\n getPermissions() {\n return this._transport.getPermissions();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Object} that has\n * `info` and `metadata` properties. `info` is an {Object} filled with\n * anything available in the information dictionary and similarly\n * `metadata` is a {Metadata} object with information from the metadata\n * section of the PDF.\n */\n getMetadata() {\n return this._transport.getMetadata();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with a {TypedArray} that has\n * the raw data from the PDF.\n */\n getData() {\n return this._transport.getData();\n }\n\n /**\n * @returns {Promise} A promise that is resolved when the document's data\n * is loaded. It is resolved with an {Object} that contains the `length`\n * property that indicates size of the PDF data in bytes.\n */\n getDownloadInfo() {\n return this._transport.downloadInfoCapability.promise;\n }\n\n /**\n * @returns {Promise} A promise this is resolved with current statistics about\n * document structures (see {@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\n * worker-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 * @returns {Promise} A promise that is resolved when clean-up has finished.\n */\n cleanup() {\n return this._transport.startCleanup();\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 {Object} A subset of the current {DocumentInitParameters}, which are\n * either needed in the viewer and/or whose default values may be affected\n * 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/**\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 */\n\n/**\n * Page text content.\n *\n * @typedef {Object} TextContent\n * @property {array} items - array of {@link TextItem}\n * @property {Object} styles - {@link TextStyle} objects, 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} 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 * Text style.\n *\n * @typedef {Object} TextStyle\n * @property {number} ascent - font ascent.\n * @property {number} descent - font descent.\n * @property {boolean} vertical - text is in vertical mode.\n * @property {string} fontFamily - 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'\n * (printable annotations).\n * 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\n * calling the `PDFPageProxy.getViewport` method.\n * @property {string} [intent] - Rendering intent, can be 'display' or 'print'\n * (default value is 'display').\n * @property {boolean} [enableWebGL] - Enables WebGL accelerated rendering\n * for some operations. The default value is `false`.\n * @property {boolean} [renderInteractiveForms] - Whether or not\n * interactive form elements are rendered in the display\n * layer. If so, we do not render them on canvas as well.\n * @property {Array} [transform] - Additional transform, applied\n * just before viewport transform.\n * @property {Object} [imageLayer] - An object that has beginLayout,\n * endLayout and appendImage functions.\n * @property {Object} [canvasFactory] - The factory that will be used\n * when creating canvases. The default value is\n * {DOMCanvasFactory}.\n * @property {Object} [background] - Background to use for the canvas.\n * Can use any valid canvas.fillStyle: A DOMString parsed as\n * CSS <color> value, a CanvasGradient object (a linear or\n * radial gradient) or a CanvasPattern object (a repetitive\n * image). The default value is 'rgb(255,255,255)'.\n */\n\n/**\n * PDF page operator list.\n *\n * @typedef {Object} PDFOperatorList\n * @property {Array} fnArray - Array containing the operator functions.\n * @property {Array} argsArray - Array containing the arguments of the\n * functions.\n */\n\n/**\n * Proxy to a PDFPage in the worker thread.\n * @alias PDFPageProxy\n */\nclass PDFPageProxy {\n constructor(pageIndex, pageInfo, transport, pdfBug = false) {\n this._pageIndex = pageIndex;\n this._pageInfo = pageInfo;\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 = Object.create(null);\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} An array of the visible portion of the PDF page in user\n * 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 if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"GENERIC\") &&\n (arguments.length > 1 || typeof arguments[0] === \"number\")\n ) {\n throw new Error(\n \"PDFPageProxy.getViewport is called with obsolete arguments.\"\n );\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} A promise that is resolved with an {Array} of the\n * 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 * Begins the process of rendering a page to the desired context.\n * @param {RenderParameters} params Page render parameters.\n * @returns {RenderTask} An object that contains the promise, which\n * is resolved when the page finishes rendering.\n */\n render({\n canvasContext,\n viewport,\n intent = \"display\",\n enableWebGL = false,\n renderInteractiveForms = false,\n transform = null,\n imageLayer = null,\n canvasFactory = null,\n background = null,\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 (!this.intentStates[renderingIntent]) {\n this.intentStates[renderingIntent] = Object.create(null);\n }\n const intentState = this.intentStates[renderingIntent];\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 = canvasFactory || new DOMCanvasFactory();\n const webGLContext = new WebGLContext({\n enable: enableWebGL,\n });\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 });\n }\n\n const complete = error => {\n const i = intentState.renderTasks.indexOf(internalRenderTask);\n if (i >= 0) {\n intentState.renderTasks.splice(i, 1);\n }\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 webGLContext,\n useRequestAnimationFrame: renderingIntent !== \"print\",\n pdfBug: this._pdfBug,\n });\n\n if (!intentState.renderTasks) {\n intentState.renderTasks = [];\n }\n intentState.renderTasks.push(internalRenderTask);\n const renderTask = internalRenderTask.task;\n\n intentState.displayReadyCapability.promise\n .then(transparency => {\n if (this.pendingCleanup) {\n complete();\n return;\n }\n if (this._stats) {\n this._stats.time(\"Rendering\");\n }\n internalRenderTask.initializeGraphics(transparency);\n internalRenderTask.operatorListChanged();\n })\n .catch(complete);\n\n return renderTask;\n }\n\n /**\n * @returns {Promise} A promise resolved with an {@link PDFOperatorList}\n * 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 const i = intentState.renderTasks.indexOf(opListTask);\n if (i >= 0) {\n intentState.renderTasks.splice(i, 1);\n }\n }\n }\n\n const renderingIntent = \"oplist\";\n if (!this.intentStates[renderingIntent]) {\n this.intentStates[renderingIntent] = Object.create(null);\n }\n const intentState = this.intentStates[renderingIntent];\n let opListTask;\n\n if (!intentState.opListReadCapability) {\n opListTask = {};\n opListTask.operatorListChanged = operatorListChanged;\n intentState.opListReadCapability = createPromiseCapability();\n intentState.renderTasks = [];\n intentState.renderTasks.push(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} ReadableStream to read textContent chunks.\n */\n streamTextContent({\n normalizeWhitespace = false,\n disableCombineTextItems = 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 },\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} That is resolved a {@link TextContent}\n * object that represent the page 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 * 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 Object.keys(this.intentStates).forEach(intent => {\n const intentState = this.intentStates[intent];\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 return;\n }\n intentState.renderTasks.forEach(function(renderTask) {\n const renderCompleted = renderTask.capability.promise.catch(\n function() {}\n ); // ignoring failures\n waitOn.push(renderCompleted);\n renderTask.cancel();\n });\n });\n this.objs.clear();\n this.annotationsPromise = null;\n this.pendingCleanup = false;\n return Promise.all(waitOn);\n }\n\n /**\n * Cleans up resources allocated by the page.\n * @param {boolean} [resetStats] - Reset page stats, if enabled.\n * The default value is `false`.\n * @returns {boolean} Indicating 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 (\n !this.pendingCleanup ||\n Object.keys(this.intentStates).some(intent => {\n const intentState = this.intentStates[intent];\n return (\n intentState.renderTasks.length !== 0 ||\n !intentState.operatorList.lastChunk\n );\n })\n ) {\n return false;\n }\n\n Object.keys(this.intentStates).forEach(intent => {\n delete this.intentStates[intent];\n });\n this.objs.clear();\n this.annotationsPromise = 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[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 (let i = 0; i < intentState.renderTasks.length; i++) {\n intentState.renderTasks[i].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[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 (let i = 0; i < intentState.renderTasks.length; i++) {\n intentState.renderTasks[i].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.length !== 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(\n new AbortException(reason && reason.message)\n );\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 Object.keys(this.intentStates).some(intent => {\n if (this.intentStates[intent] === intentState) {\n delete this.intentStates[intent];\n return true;\n }\n return false;\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(defer = true) {\n this._listeners = [];\n this._defer = defer;\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 const transferable = transfers && transfers.includes(buffer);\n if (transferable) {\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 result = Array.isArray(value) ? [] : {};\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 && 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 if (!this._defer) {\n this._listeners.forEach(listener => {\n listener.call(this, { data: obj });\n });\n return;\n }\n\n const cloned = new WeakMap();\n const e = { data: cloneValue(obj) };\n this._deferred.then(() => {\n this._listeners.forEach(listener => {\n listener.call(this, e);\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`.\n * @property {number} [verbosity] - Controls the logging level; the\n * constants from {VerbosityLevel} should be used.\n */\n\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 =\n document.currentScript && 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 =\n globalThis.pdfjsWorker && 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 if (typeof SystemJS !== \"object\") {\n throw new Error(\"SystemJS must be used to load fake worker.\");\n }\n const worker = await SystemJS.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, which 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 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 });\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 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 this.pageCache.forEach(function(page) {\n if (page) {\n waitOn.push(page._destroy());\n }\n });\n this.pageCache.length = 0;\n this.pagePromises.length = 0;\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 Promise.all(waitOn).then(() => {\n this.fontLoader.clear();\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(this._networkStream);\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(isArrayBuffer(value));\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 });\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(this._networkStream);\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(isArrayBuffer(value));\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 });\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 (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || TESTING\")\n ) {\n assert(reason instanceof Error, \"DocException: expected an Error.\");\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 (\n params.pdfBug &&\n globalThis.FontInspector &&\n globalThis.FontInspector.enabled\n ) {\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.bind(font).then(\n () => {\n this.commonObjs.resolve(id, font);\n },\n reason => {\n messageHandler\n .sendWithPromise(\"FontFallback\", {\n id,\n })\n .finally(() => {\n this.commonObjs.resolve(id, font);\n });\n }\n );\n break;\n case \"FontPath\":\n case \"FontType3Res\":\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 \"JpegStream\":\n return new Promise((resolve, reject) => {\n const img = new Image();\n img.onload = function() {\n resolve(img);\n };\n img.onerror = function() {\n // Note that when the browser image loading/decoding fails,\n // we'll fallback to the built-in PDF.js JPEG decoder; see\n // `PartialEvaluator.buildPaintImageXObject` in the\n // `src/core/evaluator.js` file.\n reject(new Error(\"Error during JPEG image loading\"));\n\n // Always remember to release the image data if errors occurred.\n releaseImageResources(img);\n };\n img.src = imageData;\n }).then(img => {\n pageProxy.objs.resolve(id, img);\n });\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 (\n imageData &&\n \"data\" in imageData &&\n imageData.data.length > MAX_IMAGE_SIZE_TO_STORE\n ) {\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(\"JpegDecode\", data => {\n if (this.destroyed) {\n return Promise.reject(new Error(\"Worker was destroyed\"));\n }\n\n if (typeof document === \"undefined\") {\n // Make sure that this code is not executing in node.js, as\n // it's using DOM image, and there is no library to support that.\n return Promise.reject(new Error('\"document\" is not defined.'));\n }\n\n const [imageUrl, components] = data;\n if (components !== 3 && components !== 1) {\n return Promise.reject(\n new Error(\"Only 3 components or 1 component can be returned\")\n );\n }\n\n return new Promise(function(resolve, reject) {\n const img = new Image();\n img.onload = function() {\n const { width, height } = img;\n const size = width * height;\n const rgbaLength = size * 4;\n const buf = new Uint8ClampedArray(size * components);\n let tmpCanvas = document.createElement(\"canvas\");\n tmpCanvas.width = width;\n tmpCanvas.height = height;\n let tmpCtx = tmpCanvas.getContext(\"2d\");\n tmpCtx.drawImage(img, 0, 0);\n const data = tmpCtx.getImageData(0, 0, width, height).data;\n\n if (components === 3) {\n for (let i = 0, j = 0; i < rgbaLength; i += 4, j += 3) {\n buf[j] = data[i];\n buf[j + 1] = data[i + 1];\n buf[j + 2] = data[i + 2];\n }\n } else if (components === 1) {\n for (let i = 0, j = 0; i < rgbaLength; i += 4, j++) {\n buf[j] = data[i];\n }\n }\n resolve({ data: buf, width, height });\n\n // Immediately release the image data once decoding has finished.\n releaseImageResources(img);\n // Zeroing the width and height cause Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n tmpCanvas.width = 0;\n tmpCanvas.height = 0;\n tmpCanvas = null;\n tmpCtx = null;\n };\n img.onerror = function() {\n reject(new Error(\"JpegDecode failed to load image\"));\n\n // Always remember to release the image data if errors occurred.\n releaseImageResources(img);\n };\n img.src = imageUrl;\n });\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.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 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 getOutline() {\n return this.messageHandler.sendWithPromise(\"GetOutline\", null);\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\n ? this._fullReader.filename\n : null,\n };\n });\n }\n\n getStats() {\n return this.messageHandler.sendWithPromise(\"GetStats\", null);\n }\n\n startCleanup() {\n return this.messageHandler.sendWithPromise(\"Cleanup\", null).then(() => {\n for (let i = 0, ii = this.pageCache.length; i < ii; i++) {\n const page = this.pageCache[i];\n if (page) {\n const cleanupSuccessful = page.cleanup();\n\n if (!cleanupSuccessful) {\n throw new Error(\n `startCleanup: Page ${i + 1} is currently rendering.`\n );\n }\n }\n }\n this.commonObjs.clear();\n this.fontLoader.clear();\n });\n }\n\n get loadingParams() {\n const params = this._params;\n return shadow(this, \"loadingParams\", {\n disableAutoFetch: params.disableAutoFetch,\n disableCreateObjectURL: params.disableCreateObjectURL,\n disableFontFace: params.disableFontFace,\n nativeImageDecoderSupport: params.nativeImageDecoderSupport,\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 ? 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 for (const objId in this._objs) {\n const { data } = this._objs[objId];\n\n if (typeof Image !== \"undefined\" && data instanceof Image) {\n // Always release the image data when clearing out the cached objects.\n releaseImageResources(data);\n }\n }\n this._objs = Object.create(null);\n }\n}\n\n/**\n * Allows controlling of the rendering tasks.\n * @alias RenderTask\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}\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 * Registers callbacks to indicate the rendering task completion.\n * @ignore\n */\n then(onFulfilled, onRejected) {\n throw new Error(\n \"Removed API method: \" +\n \"RenderTask.then, use the `promise` getter instead.\"\n );\n }\n}\n\n/**\n * For internal use only.\n * @ignore\n */\nconst InternalRenderTask = (function InternalRenderTaskClosure() {\n const canvasInRendering = new WeakSet();\n\n class InternalRenderTask {\n constructor({\n callback,\n params,\n objs,\n commonObjs,\n operatorList,\n pageIndex,\n canvasFactory,\n webGLContext,\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.webGLContext = webGLContext;\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._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 initializeGraphics(transparency = false) {\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 (\n this._pdfBug &&\n globalThis.StepperManager &&\n globalThis.StepperManager.enabled\n ) {\n this.stepper = globalThis.StepperManager.create(this._pageIndex);\n this.stepper.init(this.operatorList);\n this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();\n }\n const {\n canvasContext,\n viewport,\n transform,\n imageLayer,\n background,\n } = this.params;\n\n this.gfx = new CanvasGraphics(\n canvasContext,\n this.commonObjs,\n this.objs,\n this.canvasFactory,\n this.webGLContext,\n imageLayer\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.cancel.bind(this));\n });\n } else {\n Promise.resolve()\n .then(this._nextBound)\n .catch(this.cancel.bind(this));\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\nconst version =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : null;\nconst build =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_BUILD\") : null;\n\nexport {\n getDocument,\n LoopbackPort,\n PDFDataRangeTransport,\n PDFWorker,\n PDFDocumentProxy,\n PDFPageProxy,\n setPDFNetworkStreamFactory,\n version,\n build,\n};\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/* eslint no-var: error */\n\nimport {\n assert,\n BaseException,\n CMapCompressionType,\n isString,\n removeNullCharacters,\n stringToBytes,\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 DOMCanvasFactory {\n create(width, height) {\n if (width <= 0 || height <= 0) {\n throw new Error(\"Invalid canvas size\");\n }\n const canvas = 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 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 DOMCMapReaderFactory {\n constructor({ baseUrl = null, isCompressed = false }) {\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 if (\n (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n (isFetchSupported() && isValidFetchUrl(url, document.baseURI))\n ) {\n return fetch(url)\n .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 .catch(reason => {\n throw new Error(\n `Unable to load ${this.isCompressed ? \"binary \" : \"\"}` +\n `CMap at: ${url}`\n );\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 }).catch(reason => {\n throw new Error(\n `Unable to load ${this.isCompressed ? \"binary \" : \"\"}` +\n `CMap at: ${url}`\n );\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} viewBox - The xMin, yMin, xMax and 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 rotation = rotation % 360;\n rotation = rotation < 0 ? rotation + 360 : rotation;\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 default:\n rotateA = 1;\n rotateB = 0;\n rotateC = 0;\n rotateD = -1;\n break;\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\n// Gets the file name from a given URL.\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\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\nfunction loadScript(src) {\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = src;\n\n script.onload = resolve;\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\nfunction releaseImageResources(img) {\n assert(img instanceof Image, \"Invalid `img` parameter.\");\n\n const url = img.src;\n if (\n typeof url === \"string\" &&\n url.startsWith(\"blob:\") &&\n URL.revokeObjectURL\n ) {\n URL.revokeObjectURL(url);\n }\n img.removeAttribute(\"src\");\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 PageViewport,\n RenderingCancelledException,\n addLinkAttributes,\n getFilenameFromUrl,\n LinkTarget,\n DEFAULT_LINK_REL,\n DOMCanvasFactory,\n DOMCMapReaderFactory,\n DOMSVGFactory,\n StatTimer,\n isFetchSupported,\n isValidFetchUrl,\n loadScript,\n deprecated,\n releaseImageResources,\n PDFDateString,\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({ docId, onUnsupportedFeature }) {\n if (this.constructor === BaseFontLoader) {\n unreachable(\"Cannot initialize BaseFontLoader.\");\n }\n this.docId = docId;\n this._onUnsupportedFeature = onUnsupportedFeature;\n\n this.nativeFontFaces = [];\n this.styleElement = null;\n }\n\n addNativeFontFace(nativeFontFace) {\n this.nativeFontFaces.push(nativeFontFace);\n document.fonts.add(nativeFontFace);\n }\n\n insertRule(rule) {\n let styleElement = this.styleElement;\n if (!styleElement) {\n styleElement = this.styleElement = document.createElement(\"style\");\n styleElement.id = `PDFJS_FONT_STYLE_TAG_${this.docId}`;\n 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 this.nativeFontFaces.forEach(function(nativeFontFace) {\n 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({ featureId: UNSUPPORTED_FEATURES.font });\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 const supported = typeof document !== \"undefined\" && !!document.fonts;\n return shadow(this, \"isFontLoadingAPISupported\", supported);\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(docId) {\n super(docId);\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 && 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 \"ALwAAAA2aGhlYQd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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" +\n \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA\" +\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 = 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 (i = 0, ii = fonts.length; i < ii; i++) {\n names.push(fonts[i].loadedName);\n }\n names.push(loadTestFontId);\n\n const div = 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 (i = 0, ii = names.length; i < ii; ++i) {\n const span = document.createElement(\"span\");\n span.textContent = \"Hi\";\n span.style.fontFamily = names[i];\n div.appendChild(span);\n }\n document.body.appendChild(div);\n\n isFontReady(loadTestFontId, function() {\n 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 = null,\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 const nativeFontFace = new FontFace(this.loadedName, this.data, {});\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(new Uint8Array(this.data));\n // Add the @font-face rule to the document.\n const url = `url(data:${this.mimetype};base64,${btoa(data)});`;\n const rule = `@font-face {font-family:\"${this.loadedName}\";src:${url}}`;\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, current;\n try {\n cmds = objs.get(this.loadedName + \"_path_\" + character);\n } catch (ex) {\n if (!this.ignoreErrors) {\n throw ex;\n }\n if (this._onUnsupportedFeature) {\n this._onUnsupportedFeature({ featureId: UNSUPPORTED_FEATURES.font });\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 let args,\n js = \"\";\n for (let i = 0, ii = cmds.length; i < ii; i++) {\n current = cmds[i];\n\n if (current.args !== undefined) {\n args = current.args.join(\",\");\n } else {\n args = \"\";\n }\n js += \"c.\" + current.cmd + \"(\" + args + \");\\n\";\n }\n // eslint-disable-next-line no-new-func\n return (this.compiledGlyphs[character] = new Function(\"c\", \"size\", js));\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 (let i = 0, ii = cmds.length; i < ii; i++) {\n current = cmds[i];\n\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 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\nconst compatibilityParams = Object.create(null);\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const { isNodeJS } = require(\"../shared/is_node.js\");\n\n const userAgent =\n (typeof navigator !== \"undefined\" && navigator.userAgent) || \"\";\n const isIE = /Trident/.test(userAgent);\n const isIOSChrome = /CriOS/.test(userAgent);\n\n // Checks if possible to use URL.createObjectURL()\n // Support: IE, Chrome on iOS\n (function checkOnBlobSupport() {\n // Sometimes IE and Chrome on iOS losing the data created with\n // createObjectURL(), see issues #3977 and #8081.\n if (isIE || isIOSChrome) {\n compatibilityParams.disableCreateObjectURL = true;\n }\n })();\n\n // Support: Node.js\n (function checkFontFaceAndImage() {\n // Node.js is missing native support for `@font-face` and `Image`.\n if (isNodeJS) {\n compatibilityParams.disableFontFace = true;\n compatibilityParams.nativeImageDecoderSupport = \"none\";\n }\n })();\n}\n\nexports.apiCompatibilityParams = Object.freeze(compatibilityParams);\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://electronjs.org/docs/api/process#processversionselectron\nconst isNodeJS =\n typeof process === \"object\" &&\n process + \"\" === \"[object process]\" &&\n !process.versions[\"nw\"] &&\n !process.versions[\"electron\"];\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\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 { getShadingPatternFromIR, 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\n// Minimal font size that would be used during canvas fillText operations.\nvar MIN_FONT_SIZE = 16;\n// Maximum font size that would be used during canvas fillText operations.\nvar MAX_FONT_SIZE = 100;\nvar MAX_GROUP_SIZE = 4096;\n\n// Heuristic value used when enforcing minimum line widths.\nvar MIN_WIDTH_FACTOR = 0.65;\n\nvar COMPILE_TYPE3_GLYPHS = true;\nvar MAX_SIZE_TO_COMPILE = 1000;\n\nvar FULL_CHUNK_HEIGHT = 16;\n\nfunction addContextCurrentTransform(ctx) {\n // If the context doesn't expose a `mozCurrentTransform`, add a JS based one.\n if (!ctx.mozCurrentTransform) {\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\n ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0];\n ctx._transformStack = [];\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 var m = this._transformMatrix;\n var a = m[0],\n b = m[1],\n c = m[2],\n d = m[3],\n e = m[4],\n f = m[5];\n\n var ad_bc = a * d - b * c;\n var 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 var 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 var 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 var 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 var 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 var 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.rotate = function ctxRotate(angle) {\n var cosValue = Math.cos(angle);\n var sinValue = Math.sin(angle);\n\n var 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}\n\nvar CachedCanvases = (function CachedCanvasesClosure() {\n function CachedCanvases(canvasFactory) {\n this.canvasFactory = canvasFactory;\n this.cache = Object.create(null);\n }\n CachedCanvases.prototype = {\n getCanvas: function CachedCanvases_getCanvas(\n id,\n width,\n height,\n trackTransform\n ) {\n var 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 clear() {\n for (var id in this.cache) {\n var canvasEntry = this.cache[id];\n this.canvasFactory.destroy(canvasEntry);\n delete this.cache[id];\n }\n },\n };\n return CachedCanvases;\n})();\n\nfunction compileType3Glyph(imgData) {\n var POINT_TO_PROCESS_LIMIT = 1000;\n\n var width = imgData.width,\n height = imgData.height;\n var i,\n j,\n j0,\n width1 = width + 1;\n var points = new Uint8Array(width1 * (height + 1));\n // prettier-ignore\n var POINT_TYPES =\n new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);\n\n // decodes bit-packed mask data\n var lineSize = (width + 7) & ~7,\n data0 = imgData.data;\n var data = new Uint8Array(lineSize * height),\n pos = 0,\n ii;\n for (i = 0, ii = data0.length; i < ii; i++) {\n var mask = 128,\n elem = data0[i];\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 var 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 var 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 var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);\n var outlines = [];\n for (i = 0; count && i <= height; i++) {\n var p = i * width1;\n var end = p + width;\n while (p < end && !points[p]) {\n p++;\n }\n if (p === end) {\n continue;\n }\n var coords = [p % width1, i];\n\n var type = points[p],\n p0 = p,\n pp;\n do {\n var step = steps[type];\n do {\n p += step;\n } while (!points[p]);\n\n 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);\n coords.push((p / width1) | 0);\n\n if (!points[p]) {\n --count;\n }\n } while (p0 !== p);\n outlines.push(coords);\n --i;\n }\n\n var 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 (var i = 0, ii = outlines.length; i < ii; i++) {\n var o = outlines[i];\n c.moveTo(o[0], o[1]);\n for (var j = 2, jj = o.length; j < jj; j += 2) {\n c.lineTo(o[j], o[j + 1]);\n }\n }\n c.fill();\n c.beginPath();\n c.restore();\n };\n\n return drawOutline;\n}\n\nvar CanvasExtraState = (function CanvasExtraStateClosure() {\n function CanvasExtraState() {\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 }\n\n CanvasExtraState.prototype = {\n clone: function CanvasExtraState_clone() {\n return Object.create(this);\n },\n setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) {\n this.x = x;\n this.y = y;\n },\n };\n return CanvasExtraState;\n})();\n\nvar 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 var EXECUTION_TIME = 15;\n // Defines the number of steps before checking the execution time\n var EXECUTION_STEPS = 10;\n\n function CanvasGraphics(\n canvasCtx,\n commonObjs,\n objs,\n canvasFactory,\n webGLContext,\n imageLayer\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.webGLContext = webGLContext;\n this.imageLayer = imageLayer;\n this.groupStack = [];\n this.processingType3 = null;\n // Patterns are painted relative to the initial page/form transform, see pdf\n // 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.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 function putBinaryImageData(ctx, imgData) {\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 var height = imgData.height,\n width = imgData.width;\n var partialChunkHeight = height % FULL_CHUNK_HEIGHT;\n var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;\n var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;\n\n var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);\n var srcPos = 0,\n destPos;\n var src = imgData.data;\n var dest = chunkImgData.data;\n var i, j, thisChunkHeight, elemsInThisChunk;\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 var srcLength = src.byteLength;\n var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);\n var dest32DataLength = dest32.length;\n var fullSrcDiff = (width + 7) >> 3;\n var white = 0xffffffff;\n var black = IsLittleEndianCached.value ? 0xff000000 : 0x000000ff;\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 var srcDiff = srcLength - srcPos;\n var k = 0;\n var kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7;\n var kEndUnrolled = kEnd & ~7;\n var mask = 0;\n var 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\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 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 ctx.putImageData(chunkImgData, 0, j);\n }\n } else if (imgData.kind === ImageKind.RGB_24BPP) {\n // RGB, 24-bits per pixel.\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 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 var height = imgData.height,\n width = imgData.width;\n var partialChunkHeight = height % FULL_CHUNK_HEIGHT;\n var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;\n var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;\n\n var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);\n var srcPos = 0;\n var src = imgData.data;\n var dest = chunkImgData.data;\n\n for (var i = 0; i < totalChunks; i++) {\n var 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 var destPos = 3; // alpha component offset\n for (var j = 0; j < thisChunkHeight; j++) {\n var mask = 0;\n for (var k = 0; k < width; k++) {\n if (!mask) {\n var 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 var properties = [\n \"strokeStyle\",\n \"fillStyle\",\n \"fillRule\",\n \"globalAlpha\",\n \"lineWidth\",\n \"lineCap\",\n \"lineJoin\",\n \"miterLimit\",\n \"globalCompositeOperation\",\n \"font\",\n ];\n for (var i = 0, ii = properties.length; i < ii; i++) {\n var 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 var length = bytes.length;\n for (var i = 3; i < length; i += 4) {\n var 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 var 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 var length = maskData.length;\n var scale = 1 / 255;\n for (var i = 3; i < length; i += 4) {\n var 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 var length = maskData.length;\n for (var i = 3; i < length; i += 4) {\n var 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 var hasBackdrop = !!backdrop;\n var r0 = hasBackdrop ? backdrop[0] : 0;\n var g0 = hasBackdrop ? backdrop[1] : 0;\n var b0 = hasBackdrop ? backdrop[2] : 0;\n\n var composeFn;\n if (subtype === \"Luminosity\") {\n composeFn = composeSMaskLuminosity;\n } else {\n composeFn = composeSMaskAlpha;\n }\n\n // processing image in chunks to save memory\n var PIXELS_TO_PROCESS = 1048576;\n var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));\n for (var row = 0; row < height; row += chunkSize) {\n var chunkHeight = Math.min(chunkSize, height - row);\n var maskData = maskCtx.getImageData(0, row, width, chunkHeight);\n var 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, webGLContext) {\n var mask = smask.canvas;\n var 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 var backdrop = smask.backdrop || null;\n if (!smask.transferMap && webGLContext.isEnabled) {\n const composed = webGLContext.composeSMask({\n layer: layerCtx.canvas,\n mask,\n properties: {\n subtype: smask.subtype,\n backdrop,\n },\n });\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.drawImage(composed, smask.offsetX, smask.offsetY);\n return;\n }\n genericComposeSMask(\n maskCtx,\n layerCtx,\n mask.width,\n mask.height,\n smask.subtype,\n backdrop,\n smask.transferMap\n );\n ctx.drawImage(mask, 0, 0);\n }\n\n var LINE_CAP_STYLES = [\"butt\", \"round\", \"square\"];\n var LINE_JOIN_STYLES = [\"miter\", \"round\", \"bevel\"];\n var NORMAL_CLIP = {};\n var EO_CLIP = {};\n\n CanvasGraphics.prototype = {\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 var width = this.ctx.canvas.width;\n var 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 var 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\n if (this.imageLayer) {\n this.imageLayer.beginLayout();\n }\n },\n\n executeOperatorList: function CanvasGraphics_executeOperatorList(\n operatorList,\n executionStartIdx,\n continueCallback,\n stepper\n ) {\n var argsArray = operatorList.argsArray;\n var fnArray = operatorList.fnArray;\n var i = executionStartIdx || 0;\n var argsArrayLen = argsArray.length;\n\n // Sometimes the OperatorList to execute is empty.\n if (argsArrayLen === i) {\n return i;\n }\n\n var chunkOperations =\n argsArrayLen - i > EXECUTION_STEPS &&\n typeof continueCallback === \"function\";\n var endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;\n var steps = 0;\n\n var commonObjs = this.commonObjs;\n var objs = this.objs;\n var 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: function CanvasGraphics_endDrawing() {\n // Finishing all opened operations such as SMask group painting.\n if (this.current.activeSMask !== null) {\n this.endSMaskGroup();\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 this.webGLContext.clear();\n\n if (this.imageLayer) {\n this.imageLayer.endLayout();\n }\n },\n\n // Graphics state\n setLineWidth: function CanvasGraphics_setLineWidth(width) {\n this.current.lineWidth = width;\n this.ctx.lineWidth = width;\n },\n setLineCap: function CanvasGraphics_setLineCap(style) {\n this.ctx.lineCap = LINE_CAP_STYLES[style];\n },\n setLineJoin: function CanvasGraphics_setLineJoin(style) {\n this.ctx.lineJoin = LINE_JOIN_STYLES[style];\n },\n setMiterLimit: function CanvasGraphics_setMiterLimit(limit) {\n this.ctx.miterLimit = limit;\n },\n setDash: function CanvasGraphics_setDash(dashArray, dashPhase) {\n var ctx = this.ctx;\n if (ctx.setLineDash !== undefined) {\n ctx.setLineDash(dashArray);\n ctx.lineDashOffset = dashPhase;\n }\n },\n setRenderingIntent(intent) {\n // This operation is ignored since we haven't found a use case for it yet.\n },\n setFlatness(flatness) {\n // This operation is ignored since we haven't found a use case for it yet.\n },\n setGState: function CanvasGraphics_setGState(states) {\n for (var i = 0, ii = states.length; i < ii; i++) {\n var state = states[i];\n var key = state[0];\n var 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 }\n }\n },\n beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() {\n var activeSMask = this.current.activeSMask;\n var drawnWidth = activeSMask.canvas.width;\n var drawnHeight = activeSMask.canvas.height;\n var cacheId = \"smaskGroupAt\" + this.groupLevel;\n var scratchCanvas = this.cachedCanvases.getCanvas(\n cacheId,\n drawnWidth,\n drawnHeight,\n true\n );\n\n var currentCtx = this.ctx;\n var currentTransform = currentCtx.mozCurrentTransform;\n this.ctx.save();\n\n var 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 suspendSMaskGroup: function CanvasGraphics_endSMaskGroup() {\n // Similar to endSMaskGroup, the intermediate canvas has to be composed\n // and future ctx state restored.\n var groupCtx = this.ctx;\n this.groupLevel--;\n this.ctx = this.groupStack.pop();\n\n composeSMask(\n this.ctx,\n this.current.activeSMask,\n groupCtx,\n this.webGLContext\n );\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 var 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 resumeSMaskGroup: function CanvasGraphics_endSMaskGroup() {\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 var groupCtx = this.current.resumeSMaskCtx;\n var currentCtx = this.ctx;\n this.ctx = groupCtx;\n this.groupStack.push(currentCtx);\n this.groupLevel++;\n },\n endSMaskGroup: function CanvasGraphics_endSMaskGroup() {\n var groupCtx = this.ctx;\n this.groupLevel--;\n this.ctx = this.groupStack.pop();\n\n composeSMask(\n this.ctx,\n this.current.activeSMask,\n groupCtx,\n this.webGLContext\n );\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 var deltaTransform = Util.transform(\n this.current.activeSMask.startTransformInverse,\n groupCtx.mozCurrentTransform\n );\n this.ctx.transform.apply(this.ctx, deltaTransform);\n },\n save: function CanvasGraphics_save() {\n this.ctx.save();\n var old = this.current;\n this.stateStack.push(old);\n this.current = old.clone();\n this.current.resumeSMaskCtx = null;\n },\n restore: function CanvasGraphics_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 }\n },\n transform: function CanvasGraphics_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: function CanvasGraphics_constructPath(ops, args) {\n var ctx = this.ctx;\n var current = this.current;\n var x = current.x,\n y = current.y;\n for (var 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 var width = args[j++];\n var height = args[j++];\n if (width === 0) {\n width = this.getSinglePixelWidth();\n }\n if (height === 0) {\n height = this.getSinglePixelWidth();\n }\n var xw = x + width;\n var yh = y + height;\n this.ctx.moveTo(x, y);\n this.ctx.lineTo(xw, y);\n this.ctx.lineTo(xw, yh);\n this.ctx.lineTo(x, yh);\n this.ctx.lineTo(x, y);\n this.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 closePath: function CanvasGraphics_closePath() {\n this.ctx.closePath();\n },\n stroke: function CanvasGraphics_stroke(consumePath) {\n consumePath = typeof consumePath !== \"undefined\" ? consumePath : true;\n var ctx = this.ctx;\n var 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 (\n strokeColor &&\n strokeColor.hasOwnProperty(\"type\") &&\n strokeColor.type === \"Pattern\"\n ) {\n // for patterns, we transform to pattern space, calculate\n // the pattern, call stroke, and restore to user space\n ctx.save();\n // The current transform will be replaced while building the pattern,\n // but the line width needs to be adjusted by the current transform, so\n // we must scale it. To properly fix this we should be using a pattern\n // transform instead (see #10955).\n const transform = ctx.mozCurrentTransform;\n const scale = Util.singularValueDecompose2dScale(transform)[0];\n ctx.strokeStyle = strokeColor.getPattern(ctx, this);\n ctx.lineWidth = Math.max(\n this.getSinglePixelWidth() * MIN_WIDTH_FACTOR,\n this.current.lineWidth * scale\n );\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(\n this.getSinglePixelWidth() * MIN_WIDTH_FACTOR,\n this.current.lineWidth\n );\n ctx.stroke();\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 closeStroke: function CanvasGraphics_closeStroke() {\n this.closePath();\n this.stroke();\n },\n fill: function CanvasGraphics_fill(consumePath) {\n consumePath = typeof consumePath !== \"undefined\" ? consumePath : true;\n var ctx = this.ctx;\n var fillColor = this.current.fillColor;\n var isPatternFill = this.current.patternFill;\n var needRestore = false;\n\n if (isPatternFill) {\n ctx.save();\n if (this.baseTransform) {\n ctx.setTransform.apply(ctx, this.baseTransform);\n }\n ctx.fillStyle = fillColor.getPattern(ctx, this);\n needRestore = true;\n }\n\n if (this.pendingEOFill) {\n ctx.fill(\"evenodd\");\n this.pendingEOFill = false;\n } else {\n ctx.fill();\n }\n\n if (needRestore) {\n ctx.restore();\n }\n if (consumePath) {\n this.consumePath();\n }\n },\n eoFill: function CanvasGraphics_eoFill() {\n this.pendingEOFill = true;\n this.fill();\n },\n fillStroke: function CanvasGraphics_fillStroke() {\n this.fill(false);\n this.stroke(false);\n\n this.consumePath();\n },\n eoFillStroke: function CanvasGraphics_eoFillStroke() {\n this.pendingEOFill = true;\n this.fillStroke();\n },\n closeFillStroke: function CanvasGraphics_closeFillStroke() {\n this.closePath();\n this.fillStroke();\n },\n closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() {\n this.pendingEOFill = true;\n this.closePath();\n this.fillStroke();\n },\n endPath: function CanvasGraphics_endPath() {\n this.consumePath();\n },\n\n // Clipping\n clip: function CanvasGraphics_clip() {\n this.pendingClip = NORMAL_CLIP;\n },\n eoClip: function CanvasGraphics_eoClip() {\n this.pendingClip = EO_CLIP;\n },\n\n // Text\n beginText: function CanvasGraphics_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 endText: function CanvasGraphics_endText() {\n var paths = this.pendingTextPaths;\n var ctx = this.ctx;\n if (paths === undefined) {\n ctx.beginPath();\n return;\n }\n\n ctx.save();\n ctx.beginPath();\n for (var i = 0; i < paths.length; i++) {\n var 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 setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) {\n this.current.charSpacing = spacing;\n },\n setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) {\n this.current.wordSpacing = spacing;\n },\n setHScale: function CanvasGraphics_setHScale(scale) {\n this.current.textHScale = scale / 100;\n },\n setLeading: function CanvasGraphics_setLeading(leading) {\n this.current.leading = -leading;\n },\n setFont: function CanvasGraphics_setFont(fontRefName, size) {\n var fontObj = this.commonObjs.get(fontRefName);\n var current = this.current;\n\n if (!fontObj) {\n throw new Error(`Can't find font for ${fontRefName}`);\n }\n\n current.fontMatrix = fontObj.fontMatrix\n ? fontObj.fontMatrix\n : 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 var 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 var italic = fontObj.italic ? \"italic\" : \"normal\";\n var 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 setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) {\n this.current.textRenderingMode = mode;\n },\n setTextRise: function CanvasGraphics_setTextRise(rise) {\n this.current.textRise = rise;\n },\n moveText: function CanvasGraphics_moveText(x, y) {\n this.current.x = this.current.lineX += x;\n this.current.y = this.current.lineY += y;\n },\n setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) {\n this.setLeading(-y);\n this.moveText(x, y);\n },\n setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) {\n this.current.textMatrix = [a, b, c, d, e, f];\n this.current.textMatrixScale = Math.sqrt(a * a + b * b);\n\n this.current.x = this.current.lineX = 0;\n this.current.y = this.current.lineY = 0;\n },\n nextLine: function CanvasGraphics_nextLine() {\n this.moveText(0, this.current.leading);\n },\n\n paintChar(character, x, y, patternTransform) {\n var ctx = this.ctx;\n var current = this.current;\n var font = current.font;\n var textRenderingMode = current.textRenderingMode;\n var fontSize = current.fontSize / current.fontSizeScale;\n var fillStrokeMode =\n textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;\n var isAddToPathSet = !!(\n textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG\n );\n const patternFill = current.patternFill && font.data;\n\n var 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 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 ctx.strokeText(character, x, y);\n }\n }\n\n if (isAddToPathSet) {\n var 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 var data = ctx.getImageData(0, 0, 10, 10).data;\n var enabled = false;\n for (var 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: function CanvasGraphics_showText(glyphs) {\n var current = this.current;\n var font = current.font;\n if (font.isType3Font) {\n return this.showType3Text(glyphs);\n }\n\n var fontSize = current.fontSize;\n if (fontSize === 0) {\n return undefined;\n }\n\n var ctx = this.ctx;\n var fontSizeScale = current.fontSizeScale;\n var charSpacing = current.charSpacing;\n var wordSpacing = current.wordSpacing;\n var fontDirection = current.fontDirection;\n var textHScale = current.textHScale * fontDirection;\n var glyphsLength = glyphs.length;\n var vertical = font.vertical;\n var spacingDir = vertical ? 1 : -1;\n var defaultVMetrics = font.defaultVMetrics;\n var widthAdvanceScale = fontSize * current.fontMatrix[0];\n\n var 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 var lineWidth = current.lineWidth;\n var scale = current.textMatrixScale;\n if (scale === 0 || lineWidth === 0) {\n var 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() * MIN_WIDTH_FACTOR;\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 var x = 0,\n i;\n for (i = 0; i < glyphsLength; ++i) {\n var glyph = glyphs[i];\n if (isNum(glyph)) {\n x += (spacingDir * glyph * fontSize) / 1000;\n continue;\n }\n\n var restoreNeeded = false;\n var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;\n var character = glyph.fontChar;\n var accent = glyph.accent;\n var scaledX, scaledY, scaledAccentX, scaledAccentY;\n var width = glyph.width;\n if (vertical) {\n var vmetric, vx, vy;\n vmetric = glyph.vmetric || defaultVMetrics;\n vx = glyph.vmetric ? vmetric[1] : width * 0.5;\n vx = -vx * widthAdvanceScale;\n 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 var measuredWidth =\n ((ctx.measureText(character).width * 1000) / fontSize) *\n fontSizeScale;\n if (width < measuredWidth && this.isFontSubpixelAAEnabled) {\n var 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 (glyph.isInFont || font.missingFile) {\n if (simpleFillText && !accent) {\n // common case\n ctx.fillText(character, scaledX, scaledY);\n } else {\n this.paintChar(character, scaledX, scaledY, patternTransform);\n if (accent) {\n scaledAccentX = scaledX + accent.offset.x / fontSizeScale;\n scaledAccentY = scaledY - accent.offset.y / fontSizeScale;\n this.paintChar(\n accent.fontChar,\n scaledAccentX,\n scaledAccentY,\n patternTransform\n );\n }\n }\n }\n\n var 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 },\n\n showType3Text: function CanvasGraphics_showType3Text(glyphs) {\n // Type3 fonts - each glyph is a \"mini-PDF\"\n var ctx = this.ctx;\n var current = this.current;\n var font = current.font;\n var fontSize = current.fontSize;\n var fontDirection = current.fontDirection;\n var spacingDir = font.vertical ? 1 : -1;\n var charSpacing = current.charSpacing;\n var wordSpacing = current.wordSpacing;\n var textHScale = current.textHScale * fontDirection;\n var fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX;\n var glyphsLength = glyphs.length;\n var isTextInvisible =\n current.textRenderingMode === TextRenderingMode.INVISIBLE;\n var 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 var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;\n var operatorList = font.charProcOperatorList[glyph.operatorListId];\n if (!operatorList) {\n warn(`Type3 character \"${glyph.operatorListId}\" is not available.`);\n continue;\n }\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 var 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: function CanvasGraphics_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 setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(\n xWidth,\n yWidth,\n llx,\n lly,\n urx,\n ury\n ) {\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: function CanvasGraphics_getColorN_Pattern(IR) {\n var pattern;\n if (IR[0] === \"TilingPattern\") {\n var color = IR[1];\n var baseTransform =\n this.baseTransform || this.ctx.mozCurrentTransform.slice();\n var canvasGraphicsFactory = {\n createCanvasGraphics: ctx => {\n return new CanvasGraphics(\n ctx,\n this.commonObjs,\n this.objs,\n this.canvasFactory,\n this.webGLContext\n );\n },\n };\n pattern = new TilingPattern(\n IR,\n color,\n this.ctx,\n canvasGraphicsFactory,\n baseTransform\n );\n } else {\n pattern = getShadingPatternFromIR(IR);\n }\n return pattern;\n },\n setStrokeColorN: function CanvasGraphics_setStrokeColorN() {\n this.current.strokeColor = this.getColorN_Pattern(arguments);\n },\n setFillColorN: function CanvasGraphics_setFillColorN() {\n this.current.fillColor = this.getColorN_Pattern(arguments);\n this.current.patternFill = true;\n },\n setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) {\n var color = Util.makeCssRgb(r, g, b);\n this.ctx.strokeStyle = color;\n this.current.strokeColor = color;\n },\n setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) {\n var color = Util.makeCssRgb(r, g, b);\n this.ctx.fillStyle = color;\n this.current.fillColor = color;\n this.current.patternFill = false;\n },\n\n shadingFill: function CanvasGraphics_shadingFill(patternIR) {\n var ctx = this.ctx;\n\n this.save();\n var pattern = getShadingPatternFromIR(patternIR);\n ctx.fillStyle = pattern.getPattern(ctx, this, true);\n\n var inv = ctx.mozCurrentTransformInverse;\n if (inv) {\n var canvas = ctx.canvas;\n var width = canvas.width;\n var height = canvas.height;\n\n var bl = Util.applyTransform([0, 0], inv);\n var br = Util.applyTransform([0, height], inv);\n var ul = Util.applyTransform([width, 0], inv);\n var ur = Util.applyTransform([width, height], inv);\n\n var x0 = Math.min(bl[0], br[0], ul[0], ur[0]);\n var y0 = Math.min(bl[1], br[1], ul[1], ur[1]);\n var x1 = Math.max(bl[0], br[0], ul[0], ur[0]);\n var 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: function CanvasGraphics_beginInlineImage() {\n unreachable(\"Should not call beginInlineImage\");\n },\n beginImageData: function CanvasGraphics_beginImageData() {\n unreachable(\"Should not call beginImageData\");\n },\n\n paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(\n matrix,\n bbox\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 var width = bbox[2] - bbox[0];\n var 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: function CanvasGraphics_paintFormXObjectEnd() {\n this.restore();\n this.baseTransform = this.baseTransformStack.pop();\n },\n\n beginGroup: function CanvasGraphics_beginGroup(group) {\n this.save();\n var 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 var 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 var bounds = Util.getAxialAlignedBoundingBox(\n group.bbox,\n currentCtx.mozCurrentTransform\n );\n // Clip the bounding box to the current canvas.\n var 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 var offsetX = Math.floor(bounds[0]);\n var offsetY = Math.floor(bounds[1]);\n var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);\n var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);\n var 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 var 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 var scratchCanvas = this.cachedCanvases.getCanvas(\n cacheId,\n drawnWidth,\n drawnHeight,\n true\n );\n var 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 // Reseting mask state, masks will be applied on restore of the group.\n this.current.activeSMask = null;\n },\n\n endGroup: function CanvasGraphics_endGroup(group) {\n this.groupLevel--;\n var 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: function CanvasGraphics_beginAnnotations() {\n this.save();\n if (this.baseTransform) {\n this.ctx.setTransform.apply(this.ctx, this.baseTransform);\n }\n },\n\n endAnnotations: function CanvasGraphics_endAnnotations() {\n this.restore();\n },\n\n beginAnnotation: function CanvasGraphics_beginAnnotation(\n rect,\n transform,\n matrix\n ) {\n this.save();\n resetCtxToDefault(this.ctx);\n this.current = new CanvasExtraState();\n\n if (Array.isArray(rect) && rect.length === 4) {\n var width = rect[2] - rect[0];\n var 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: function CanvasGraphics_endAnnotation() {\n this.restore();\n },\n\n paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) {\n const domImage = this.processingType3\n ? this.commonObjs.get(objId)\n : this.objs.get(objId);\n if (!domImage) {\n warn(\"Dependent image isn't ready yet\");\n return;\n }\n\n this.save();\n\n var ctx = this.ctx;\n // scale the image to the unit square\n ctx.scale(1 / w, -1 / h);\n\n ctx.drawImage(\n domImage,\n 0,\n 0,\n domImage.width,\n domImage.height,\n 0,\n -h,\n w,\n h\n );\n if (this.imageLayer) {\n var currentTransform = ctx.mozCurrentTransformInverse;\n var position = this.getCanvasPosition(0, 0);\n this.imageLayer.appendImage({\n objId,\n left: position[0],\n top: position[1],\n width: w / currentTransform[0],\n height: h / currentTransform[3],\n });\n }\n this.restore();\n },\n\n paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) {\n var ctx = this.ctx;\n var width = img.width,\n height = img.height;\n var fillColor = this.current.fillColor;\n var isPatternFill = this.current.patternFill;\n\n var 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 && glyph.compiled) {\n glyph.compiled(ctx);\n return;\n }\n\n var maskCanvas = this.cachedCanvases.getCanvas(\n \"maskCanvas\",\n width,\n height\n );\n var 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: function CanvasGraphics_paintImageMaskXObjectRepeat(\n imgData,\n scaleX,\n scaleY,\n positions\n ) {\n var width = imgData.width;\n var height = imgData.height;\n var fillColor = this.current.fillColor;\n var isPatternFill = this.current.patternFill;\n\n var maskCanvas = this.cachedCanvases.getCanvas(\n \"maskCanvas\",\n width,\n height\n );\n var 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 var ctx = this.ctx;\n for (var i = 0, ii = positions.length; i < ii; i += 2) {\n ctx.save();\n ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]);\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: function CanvasGraphics_paintImageMaskXObjectGroup(\n images\n ) {\n var ctx = this.ctx;\n\n var fillColor = this.current.fillColor;\n var isPatternFill = this.current.patternFill;\n for (var i = 0, ii = images.length; i < ii; i++) {\n var image = images[i];\n var width = image.width,\n height = image.height;\n\n var maskCanvas = this.cachedCanvases.getCanvas(\n \"maskCanvas\",\n width,\n height\n );\n var 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: function CanvasGraphics_paintImageXObject(objId) {\n const imgData = this.processingType3\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: function CanvasGraphics_paintImageXObjectRepeat(\n objId,\n scaleX,\n scaleY,\n positions\n ) {\n const imgData = this.processingType3\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 var width = imgData.width;\n var height = imgData.height;\n var map = [];\n for (var 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: function CanvasGraphics_paintInlineImageXObject(\n imgData\n ) {\n var width = imgData.width;\n var height = imgData.height;\n var ctx = this.ctx;\n\n this.save();\n // scale the image to the unit square\n ctx.scale(1 / width, -1 / height);\n\n var currentTransform = ctx.mozCurrentTransformInverse;\n var a = currentTransform[0],\n b = currentTransform[1];\n var widthScale = Math.max(Math.sqrt(a * a + b * b), 1);\n var c = currentTransform[2],\n d = currentTransform[3];\n var heightScale = Math.max(Math.sqrt(c * c + d * d), 1);\n\n var imgToPaint, tmpCanvas;\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 var tmpCtx = tmpCanvas.context;\n putBinaryImageData(tmpCtx, imgData);\n imgToPaint = tmpCanvas.canvas;\n }\n\n var paintWidth = width,\n paintHeight = height;\n var tmpCanvasId = \"prescale1\";\n // Vertial or horizontal scaling shall not be more than 2 to not loose 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 var 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 var 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: function CanvasGraphics_paintInlineImageXObjectGroup(\n imgData,\n map\n ) {\n var ctx = this.ctx;\n var w = imgData.width;\n var h = imgData.height;\n\n var tmpCanvas = this.cachedCanvases.getCanvas(\"inlineImage\", w, h);\n var tmpCtx = tmpCanvas.context;\n putBinaryImageData(tmpCtx, imgData);\n\n for (var i = 0, ii = map.length; i < ii; i++) {\n var 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 var 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: function CanvasGraphics_paintSolidColorImageMask() {\n this.ctx.fillRect(0, 0, 1, 1);\n },\n\n paintXObject: function CanvasGraphics_paintXObject() {\n warn(\"Unsupported 'paintXObject' command.\");\n },\n\n // Marked content\n\n markPoint: function CanvasGraphics_markPoint(tag) {\n // TODO Marked content.\n },\n markPointProps: function CanvasGraphics_markPointProps(tag, properties) {\n // TODO Marked content.\n },\n beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {\n // TODO Marked content.\n },\n beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(\n tag,\n properties\n ) {\n // TODO Marked content.\n },\n endMarkedContent: function CanvasGraphics_endMarkedContent() {\n // TODO Marked content.\n },\n\n // Compatibility\n\n beginCompat: function CanvasGraphics_beginCompat() {\n // TODO ignore undefined operators (should we do that anyway?)\n },\n endCompat: function CanvasGraphics_endCompat() {\n // TODO stop ignoring undefined operators\n },\n\n // Helper functions\n\n consumePath: function CanvasGraphics_consumePath() {\n var 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 getSinglePixelWidth(scale) {\n if (this._cachedGetSinglePixelWidth === null) {\n const inverse = this.ctx.mozCurrentTransformInverse;\n // max of the current horizontal and vertical scale\n this._cachedGetSinglePixelWidth = Math.sqrt(\n Math.max(\n inverse[0] * inverse[0] + inverse[1] * inverse[1],\n inverse[2] * inverse[2] + inverse[3] * inverse[3]\n )\n );\n }\n return this._cachedGetSinglePixelWidth;\n },\n getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) {\n var 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\n for (var 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 { FormatError, info, Util } from \"../shared/util.js\";\n\nvar ShadingIRs = {};\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\nShadingIRs.RadialAxial = {\n fromIR: function RadialAxial_fromIR(raw) {\n var type = raw[1];\n var bbox = raw[2];\n var colorStops = raw[3];\n var p0 = raw[4];\n var p1 = raw[5];\n var r0 = raw[6];\n var r1 = raw[7];\n return {\n type: \"Pattern\",\n getPattern: function RadialAxial_getPattern(ctx) {\n applyBoundingBox(ctx, bbox);\n var grad;\n if (type === \"axial\") {\n grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]);\n } else if (type === \"radial\") {\n grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1);\n }\n\n for (var i = 0, ii = colorStops.length; i < ii; ++i) {\n var c = colorStops[i];\n grad.addColorStop(c[0], c[1]);\n }\n return grad;\n },\n };\n },\n};\n\nvar createMeshCanvas = (function createMeshCanvasClosure() {\n function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {\n // Very basic Gouraud-shaded triangle rasterization algorithm.\n var coords = context.coords,\n colors = context.colors;\n var bytes = data.data,\n rowSize = data.width * 4;\n var 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 var x1 = (coords[p1] + context.offsetX) * context.scaleX;\n var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;\n var x2 = (coords[p2] + context.offsetX) * context.scaleX;\n var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;\n var x3 = (coords[p3] + context.offsetX) * context.scaleX;\n var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;\n if (y1 >= y3) {\n return;\n }\n var c1r = colors[c1],\n c1g = colors[c1 + 1],\n c1b = colors[c1 + 2];\n var c2r = colors[c2],\n c2g = colors[c2 + 1],\n c2b = colors[c2 + 2];\n var c3r = colors[c3],\n c3g = colors[c3 + 1],\n c3b = colors[c3 + 2];\n\n var minY = Math.round(y1),\n maxY = Math.round(y3);\n var xa, car, cag, cab;\n var xb, cbr, cbg, cbb;\n for (var 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 var x1_ = Math.round(Math.min(xa, xb));\n var x2_ = Math.round(Math.max(xa, xb));\n var j = rowSize * y + x1_ * 4;\n for (var x = x1_; x <= x2_; x++) {\n let 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\n function drawFigure(data, figure, context) {\n var ps = figure.coords;\n var cs = figure.colors;\n var i, ii;\n switch (figure.type) {\n case \"lattice\":\n var verticesPerRow = figure.verticesPerRow;\n var rows = Math.floor(ps.length / verticesPerRow) - 1;\n var cols = verticesPerRow - 1;\n for (i = 0; i < rows; i++) {\n var q = i * verticesPerRow;\n for (var 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\n function createMeshCanvas(\n bounds,\n combinesScale,\n coords,\n colors,\n figures,\n backgroundColor,\n cachedCanvases,\n webGLContext\n ) {\n // we will increase scale on some weird factor to let antialiasing take\n // care of \"rough\" edges\n var EXPECTED_SCALE = 1.1;\n // MAX_PATTERN_SIZE is used to avoid OOM situation.\n var 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 var BORDER_SIZE = 2;\n\n var offsetX = Math.floor(bounds[0]);\n var offsetY = Math.floor(bounds[1]);\n var boundsWidth = Math.ceil(bounds[2]) - offsetX;\n var boundsHeight = Math.ceil(bounds[3]) - offsetY;\n\n var width = Math.min(\n Math.ceil(Math.abs(boundsWidth * combinesScale[0] * EXPECTED_SCALE)),\n MAX_PATTERN_SIZE\n );\n var height = Math.min(\n Math.ceil(Math.abs(boundsHeight * combinesScale[1] * EXPECTED_SCALE)),\n MAX_PATTERN_SIZE\n );\n var scaleX = boundsWidth / width;\n var scaleY = boundsHeight / height;\n\n var context = {\n coords,\n colors,\n offsetX: -offsetX,\n offsetY: -offsetY,\n scaleX: 1 / scaleX,\n scaleY: 1 / scaleY,\n };\n\n var paddedWidth = width + BORDER_SIZE * 2;\n var paddedHeight = height + BORDER_SIZE * 2;\n\n var canvas, tmpCanvas, i, ii;\n if (webGLContext.isEnabled) {\n canvas = webGLContext.drawFigures({\n width,\n height,\n backgroundColor,\n figures,\n context,\n });\n // https://bugzilla.mozilla.org/show_bug.cgi?id=972126\n tmpCanvas = cachedCanvases.getCanvas(\n \"mesh\",\n paddedWidth,\n paddedHeight,\n false\n );\n tmpCanvas.context.drawImage(canvas, BORDER_SIZE, BORDER_SIZE);\n canvas = tmpCanvas.canvas;\n } else {\n tmpCanvas = cachedCanvases.getCanvas(\n \"mesh\",\n paddedWidth,\n paddedHeight,\n false\n );\n var tmpCtx = tmpCanvas.context;\n\n var data = tmpCtx.createImageData(width, height);\n if (backgroundColor) {\n var bytes = data.data;\n for (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 (i = 0; i < figures.length; i++) {\n drawFigure(data, figures[i], context);\n }\n tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);\n canvas = tmpCanvas.canvas;\n }\n\n return {\n canvas,\n offsetX: offsetX - BORDER_SIZE * scaleX,\n offsetY: offsetY - BORDER_SIZE * scaleY,\n scaleX,\n scaleY,\n };\n }\n return createMeshCanvas;\n})();\n\nShadingIRs.Mesh = {\n fromIR: function Mesh_fromIR(raw) {\n // var type = raw[1];\n var coords = raw[2];\n var colors = raw[3];\n var figures = raw[4];\n var bounds = raw[5];\n var matrix = raw[6];\n var bbox = raw[7];\n var background = raw[8];\n return {\n type: \"Pattern\",\n getPattern: function Mesh_getPattern(ctx, owner, shadingFill) {\n applyBoundingBox(ctx, bbox);\n var 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 (matrix) {\n var matrixScale = Util.singularValueDecompose2dScale(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 var temporaryPatternCanvas = createMeshCanvas(\n bounds,\n scale,\n coords,\n colors,\n figures,\n shadingFill ? null : background,\n owner.cachedCanvases,\n owner.webGLContext\n );\n\n if (!shadingFill) {\n ctx.setTransform.apply(ctx, owner.baseTransform);\n if (matrix) {\n ctx.transform.apply(ctx, 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 },\n};\n\nShadingIRs.Dummy = {\n fromIR: function Dummy_fromIR() {\n return {\n type: \"Pattern\",\n getPattern: function Dummy_fromIR_getPattern() {\n return \"hotpink\";\n },\n };\n },\n};\n\nfunction getShadingPatternFromIR(raw) {\n var shadingIR = ShadingIRs[raw[0]];\n if (!shadingIR) {\n throw new Error(`Unknown IR type: ${raw[0]}`);\n }\n return shadingIR.fromIR(raw);\n}\n\nvar TilingPattern = (function TilingPatternClosure() {\n var PaintType = {\n COLORED: 1,\n UNCOLORED: 2,\n };\n\n var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough\n\n function TilingPattern(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.canvasGraphicsFactory = canvasGraphicsFactory;\n this.baseTransform = baseTransform;\n this.type = \"Pattern\";\n this.ctx = ctx;\n }\n\n TilingPattern.prototype = {\n createPatternCanvas: function TilinPattern_createPatternCanvas(owner) {\n var operatorList = this.operatorList;\n var bbox = this.bbox;\n var xstep = this.xstep;\n var ystep = this.ystep;\n var paintType = this.paintType;\n var tilingType = this.tilingType;\n var color = this.color;\n var 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 var 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 var matrixScale = Util.singularValueDecompose2dScale(this.matrix);\n var curMatrixScale = Util.singularValueDecompose2dScale(\n this.baseTransform\n );\n var 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 var dimx = this.getSizeAndScale(\n xstep,\n this.ctx.canvas.width,\n combinedScale[0]\n );\n var dimy = this.getSizeAndScale(\n ystep,\n this.ctx.canvas.height,\n combinedScale[1]\n );\n\n var tmpCanvas = owner.cachedCanvases.getCanvas(\n \"pattern\",\n dimx.size,\n dimy.size,\n true\n );\n var tmpCtx = tmpCanvas.context;\n var 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 // transform coordinates to pattern space\n graphics.transform(1, 0, 0, 1, -x0, -y0);\n\n this.clipBbox(graphics, bbox, x0, y0, x1, y1);\n\n graphics.executeOperatorList(operatorList);\n\n this.ctx.transform(1, 0, 0, 1, x0, y0);\n\n // Rescale canvas so that the ctx.createPattern call generates a pattern\n // with the desired size.\n this.ctx.scale(1 / dimx.scale, 1 / dimy.scale);\n return tmpCanvas.canvas;\n },\n\n getSizeAndScale: function TilingPattern_getSizeAndScale(\n step,\n realOutputSize,\n scale\n ) {\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 var maxSize = Math.max(MAX_PATTERN_SIZE, realOutputSize);\n var 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: function clipBbox(graphics, bbox, x0, y0, x1, y1) {\n if (Array.isArray(bbox) && bbox.length === 4) {\n var bboxWidth = x1 - x0;\n var bboxHeight = y1 - y0;\n graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);\n graphics.clip();\n graphics.endPath();\n }\n },\n\n setFillAndStrokeStyleToContext: function setFillAndStrokeStyleToContext(\n graphics,\n paintType,\n color\n ) {\n const context = graphics.ctx,\n current = graphics.current;\n switch (paintType) {\n case PaintType.COLORED:\n var 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 var cssColor = Util.makeCssRgb(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: function TilingPattern_getPattern(ctx, owner) {\n ctx = this.ctx;\n // PDF spec 8.7.2 NOTE 1: pattern's matrix is relative to initial matrix.\n ctx.setTransform.apply(ctx, this.baseTransform);\n ctx.transform.apply(ctx, this.matrix);\n\n var temporaryPatternCanvas = this.createPatternCanvas(owner);\n\n return ctx.createPattern(temporaryPatternCanvas, \"repeat\");\n },\n };\n\n return TilingPattern;\n})();\n\nexport { getShadingPatternFromIR, 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\nconst GlobalWorkerOptions = Object.create(null);\n\n/**\n * Defines global port for worker process. Overrides the `workerSrc` option.\n * @var {Object}\n */\nGlobalWorkerOptions.workerPort =\n GlobalWorkerOptions.workerPort === undefined\n ? null\n : GlobalWorkerOptions.workerPort;\n\n/**\n * A string containing the path and filename 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 * @var {string}\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/* eslint no-var: error, prefer-const: error */\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 sourceName = this.sourceName;\n const targetName = data.sourceName;\n new Promise(function(resolve) {\n resolve(action(data.data));\n }).then(\n function(result) {\n comObj.postMessage({\n sourceName,\n targetName,\n callback: CallbackKind.DATA,\n callbackId: data.callbackId,\n data: result,\n });\n },\n function(reason) {\n comObj.postMessage({\n sourceName,\n targetName,\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 { assert } from \"../shared/util.js\";\nimport { SimpleXMLParser } from \"./xml_parser.js\";\n\nclass Metadata {\n constructor(data) {\n assert(typeof data === \"string\", \"Metadata: input is not a string\");\n\n // Ghostscript may produce invalid metadata, so try to repair that first.\n data = this._repair(data);\n\n // Convert the string to an XML document.\n const parser = new SimpleXMLParser();\n const xmlDocument = parser.parseFromString(data);\n\n this._metadataMap = new Map();\n\n if (xmlDocument) {\n this._parse(xmlDocument);\n }\n }\n\n _repair(data) {\n // Start by removing any \"junk\" before the first tag (see issue 10395).\n return data\n .replace(/^[^<]+/, \"\")\n .replace(/>\\\\376\\\\377([^<]+)/g, function(all, codes) {\n const bytes = codes\n .replace(/\\\\([0-3])([0-7])([0-7])/g, function(code, d1, d2, d3) {\n return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);\n })\n .replace(/&(amp|apos|gt|lt|quot);/g, function(str, name) {\n switch (name) {\n case \"amp\":\n return \"&\";\n case \"apos\":\n return \"'\";\n case \"gt\":\n return \">\";\n case \"lt\":\n return \"<\";\n case \"quot\":\n return '\"';\n }\n throw new Error(`_repair: ${name} isn't defined.`);\n });\n\n let chars = \"\";\n for (let i = 0, ii = bytes.length; i < ii; i += 2) {\n const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);\n if (\n code >= /* Space = */ 32 &&\n code < /* Delete = */ 127 &&\n code !== /* '<' = */ 60 &&\n code !== /* '>' = */ 62 &&\n code !== /* '&' = */ 38\n ) {\n chars += String.fromCharCode(code);\n } else {\n chars += \"&#x\" + (0x10000 + code).toString(16).substring(1) + \";\";\n }\n }\n\n return \">\" + chars;\n });\n }\n\n _parse(xmlDocument) {\n let rdf = xmlDocument.documentElement;\n\n if (rdf.nodeName.toLowerCase() !== \"rdf:rdf\") {\n // Wrapped in <xmpmeta>\n rdf = rdf.firstChild;\n while (rdf && rdf.nodeName.toLowerCase() !== \"rdf:rdf\") {\n rdf = rdf.nextSibling;\n }\n }\n\n const nodeName = rdf ? rdf.nodeName.toLowerCase() : null;\n if (!rdf || nodeName !== \"rdf:rdf\" || !rdf.hasChildNodes()) {\n return;\n }\n\n const children = rdf.childNodes;\n for (let i = 0, ii = children.length; i < ii; i++) {\n const desc = children[i];\n if (desc.nodeName.toLowerCase() !== \"rdf:description\") {\n continue;\n }\n\n for (let j = 0, jj = desc.childNodes.length; j < jj; j++) {\n if (desc.childNodes[j].nodeName.toLowerCase() !== \"#text\") {\n const entry = desc.childNodes[j];\n const name = entry.nodeName.toLowerCase();\n\n this._metadataMap.set(name, entry.textContent.trim());\n }\n }\n }\n }\n\n get(name) {\n return this._metadataMap.has(name) ? this._metadataMap.get(name) : null;\n }\n\n getAll() {\n const obj = Object.create(null);\n for (const [key, value] of this._metadataMap) {\n obj[key] = value;\n }\n return obj;\n }\n\n has(name) {\n return this._metadataMap.has(name);\n }\n}\n\nexport { Metadata };\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// The code for XMLParserBase copied from\n// https://github.com/mozilla/shumway/blob/16451d8836fa85f4b16eeda8b4bda2fa9e2b22b0/src/avm2/natives/xml.ts\n\nconst XMLParserErrorCode = {\n NoError: 0,\n EndOfDocument: -1,\n UnterminatedCdat: -2,\n UnterminatedXmlDeclaration: -3,\n UnterminatedDoctypeDeclaration: -4,\n UnterminatedComment: -5,\n MalformedElement: -6,\n OutOfMemory: -7,\n UnterminatedAttributeValue: -8,\n UnterminatedElement: -9,\n ElementNeverBegun: -10,\n};\n\nfunction isWhitespace(s, index) {\n const ch = s[index];\n return ch === \" \" || ch === \"\\n\" || ch === \"\\r\" || ch === \"\\t\";\n}\n\nfunction isWhitespaceString(s) {\n for (let i = 0, ii = s.length; i < ii; i++) {\n if (!isWhitespace(s, i)) {\n return false;\n }\n }\n return true;\n}\n\nclass XMLParserBase {\n _resolveEntities(s) {\n return s.replace(/&([^;]+);/g, (all, entity) => {\n if (entity.substring(0, 2) === \"#x\") {\n return String.fromCharCode(parseInt(entity.substring(2), 16));\n } else if (entity.substring(0, 1) === \"#\") {\n return String.fromCharCode(parseInt(entity.substring(1), 10));\n }\n switch (entity) {\n case \"lt\":\n return \"<\";\n case \"gt\":\n return \">\";\n case \"amp\":\n return \"&\";\n case \"quot\":\n return '\"';\n }\n return this.onResolveEntity(entity);\n });\n }\n\n _parseContent(s, start) {\n const attributes = [];\n let pos = start;\n\n function skipWs() {\n while (pos < s.length && isWhitespace(s, pos)) {\n ++pos;\n }\n }\n\n while (\n pos < s.length &&\n !isWhitespace(s, pos) &&\n s[pos] !== \">\" &&\n s[pos] !== \"/\"\n ) {\n ++pos;\n }\n const name = s.substring(start, pos);\n skipWs();\n while (\n pos < s.length &&\n s[pos] !== \">\" &&\n s[pos] !== \"/\" &&\n s[pos] !== \"?\"\n ) {\n skipWs();\n let attrName = \"\",\n attrValue = \"\";\n while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== \"=\") {\n attrName += s[pos];\n ++pos;\n }\n skipWs();\n if (s[pos] !== \"=\") {\n return null;\n }\n ++pos;\n skipWs();\n const attrEndChar = s[pos];\n if (attrEndChar !== '\"' && attrEndChar !== \"'\") {\n return null;\n }\n const attrEndIndex = s.indexOf(attrEndChar, ++pos);\n if (attrEndIndex < 0) {\n return null;\n }\n attrValue = s.substring(pos, attrEndIndex);\n attributes.push({\n name: attrName,\n value: this._resolveEntities(attrValue),\n });\n pos = attrEndIndex + 1;\n skipWs();\n }\n return {\n name,\n attributes,\n parsed: pos - start,\n };\n }\n\n _parseProcessingInstruction(s, start) {\n let pos = start;\n\n function skipWs() {\n while (pos < s.length && isWhitespace(s, pos)) {\n ++pos;\n }\n }\n\n while (\n pos < s.length &&\n !isWhitespace(s, pos) &&\n s[pos] !== \">\" &&\n s[pos] !== \"/\"\n ) {\n ++pos;\n }\n const name = s.substring(start, pos);\n skipWs();\n const attrStart = pos;\n while (pos < s.length && (s[pos] !== \"?\" || s[pos + 1] !== \">\")) {\n ++pos;\n }\n const value = s.substring(attrStart, pos);\n return {\n name,\n value,\n parsed: pos - start,\n };\n }\n\n parseXml(s) {\n let i = 0;\n while (i < s.length) {\n const ch = s[i];\n let j = i;\n if (ch === \"<\") {\n ++j;\n const ch2 = s[j];\n let q;\n switch (ch2) {\n case \"/\":\n ++j;\n q = s.indexOf(\">\", j);\n if (q < 0) {\n this.onError(XMLParserErrorCode.UnterminatedElement);\n return;\n }\n this.onEndElement(s.substring(j, q));\n j = q + 1;\n break;\n case \"?\":\n ++j;\n const pi = this._parseProcessingInstruction(s, j);\n if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== \"?>\") {\n this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);\n return;\n }\n this.onPi(pi.name, pi.value);\n j += pi.parsed + 2;\n break;\n case \"!\":\n if (s.substring(j + 1, j + 3) === \"--\") {\n q = s.indexOf(\"-->\", j + 3);\n if (q < 0) {\n this.onError(XMLParserErrorCode.UnterminatedComment);\n return;\n }\n this.onComment(s.substring(j + 3, q));\n j = q + 3;\n } else if (s.substring(j + 1, j + 8) === \"[CDATA[\") {\n q = s.indexOf(\"]]>\", j + 8);\n if (q < 0) {\n this.onError(XMLParserErrorCode.UnterminatedCdat);\n return;\n }\n this.onCdata(s.substring(j + 8, q));\n j = q + 3;\n } else if (s.substring(j + 1, j + 8) === \"DOCTYPE\") {\n const q2 = s.indexOf(\"[\", j + 8);\n let complexDoctype = false;\n q = s.indexOf(\">\", j + 8);\n if (q < 0) {\n this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);\n return;\n }\n if (q2 > 0 && q > q2) {\n q = s.indexOf(\"]>\", j + 8);\n if (q < 0) {\n this.onError(\n XMLParserErrorCode.UnterminatedDoctypeDeclaration\n );\n return;\n }\n complexDoctype = true;\n }\n const doctypeContent = s.substring(\n j + 8,\n q + (complexDoctype ? 1 : 0)\n );\n this.onDoctype(doctypeContent);\n j = q + (complexDoctype ? 2 : 1);\n } else {\n this.onError(XMLParserErrorCode.MalformedElement);\n return;\n }\n break;\n default:\n const content = this._parseContent(s, j);\n if (content === null) {\n this.onError(XMLParserErrorCode.MalformedElement);\n return;\n }\n let isClosed = false;\n if (\n s.substring(j + content.parsed, j + content.parsed + 2) === \"/>\"\n ) {\n isClosed = true;\n } else if (\n s.substring(j + content.parsed, j + content.parsed + 1) !== \">\"\n ) {\n this.onError(XMLParserErrorCode.UnterminatedElement);\n return;\n }\n this.onBeginElement(content.name, content.attributes, isClosed);\n j += content.parsed + (isClosed ? 2 : 1);\n break;\n }\n } else {\n while (j < s.length && s[j] !== \"<\") {\n j++;\n }\n const text = s.substring(i, j);\n this.onText(this._resolveEntities(text));\n }\n i = j;\n }\n }\n\n onResolveEntity(name) {\n return `&${name};`;\n }\n\n onPi(name, value) {}\n\n onComment(text) {}\n\n onCdata(text) {}\n\n onDoctype(doctypeContent) {}\n\n onText(text) {}\n\n onBeginElement(name, attributes, isEmpty) {}\n\n onEndElement(name) {}\n\n onError(code) {}\n}\n\nclass SimpleDOMNode {\n constructor(nodeName, nodeValue) {\n this.nodeName = nodeName;\n this.nodeValue = nodeValue;\n\n Object.defineProperty(this, \"parentNode\", { value: null, writable: true });\n }\n\n get firstChild() {\n return this.childNodes && this.childNodes[0];\n }\n\n get nextSibling() {\n const childNodes = this.parentNode.childNodes;\n if (!childNodes) {\n return undefined;\n }\n const index = childNodes.indexOf(this);\n if (index === -1) {\n return undefined;\n }\n return childNodes[index + 1];\n }\n\n get textContent() {\n if (!this.childNodes) {\n return this.nodeValue || \"\";\n }\n return this.childNodes\n .map(function(child) {\n return child.textContent;\n })\n .join(\"\");\n }\n\n hasChildNodes() {\n return this.childNodes && this.childNodes.length > 0;\n }\n}\n\nclass SimpleXMLParser extends XMLParserBase {\n constructor() {\n super();\n this._currentFragment = null;\n this._stack = null;\n this._errorCode = XMLParserErrorCode.NoError;\n }\n\n parseFromString(data) {\n this._currentFragment = [];\n this._stack = [];\n this._errorCode = XMLParserErrorCode.NoError;\n\n this.parseXml(data);\n\n if (this._errorCode !== XMLParserErrorCode.NoError) {\n return undefined; // return undefined on error\n }\n\n // We should only have one root.\n const [documentElement] = this._currentFragment;\n if (!documentElement) {\n return undefined; // Return undefined if no root was found.\n }\n return { documentElement };\n }\n\n onResolveEntity(name) {\n switch (name) {\n case \"apos\":\n return \"'\";\n }\n return super.onResolveEntity(name);\n }\n\n onText(text) {\n if (isWhitespaceString(text)) {\n return;\n }\n const node = new SimpleDOMNode(\"#text\", text);\n this._currentFragment.push(node);\n }\n\n onCdata(text) {\n const node = new SimpleDOMNode(\"#text\", text);\n this._currentFragment.push(node);\n }\n\n onBeginElement(name, attributes, isEmpty) {\n const node = new SimpleDOMNode(name);\n node.childNodes = [];\n this._currentFragment.push(node);\n if (isEmpty) {\n return;\n }\n this._stack.push(this._currentFragment);\n this._currentFragment = node.childNodes;\n }\n\n onEndElement(name) {\n this._currentFragment = this._stack.pop() || [];\n const lastElement = this._currentFragment[this._currentFragment.length - 1];\n if (!lastElement) {\n return;\n }\n for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {\n lastElement.childNodes[i].parentNode = lastElement;\n }\n }\n\n onError(code) {\n this._errorCode = code;\n }\n}\n\nexport { SimpleXMLParser };\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 no-var: error */\n\nimport { assert, createPromiseCapability } from \"../shared/util.js\";\n\n/** @implements {IPDFStream} */\nclass PDFDataTransportStream {\n constructor(params, pdfDataRangeTransport) {\n assert(pdfDataRangeTransport);\n\n this._queuedChunks = [];\n this._progressiveDone = params.progressiveDone || false;\n\n const initialData = params.initialData;\n if (initialData && 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(found);\n }\n }\n\n get _progressiveDataLength() {\n return this._fullRequestReader ? 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 && firstReader.onProgress) {\n firstReader.onProgress({ loaded: evt.loaded });\n }\n } else {\n const fullReader = this._fullRequestReader;\n if (fullReader && 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(!this._fullRequestReader);\n const queuedChunks = this._queuedChunks;\n this._queuedChunks = null;\n return new PDFDataTransportStreamReader(\n this,\n queuedChunks,\n this._progressiveDone\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 const readers = this._rangeReaders.slice(0);\n readers.forEach(function(rangeReader) {\n rangeReader.cancel(reason);\n });\n this._pdfDataRangeTransport.abort();\n }\n}\n\n/** @implements {IPDFStreamReader} */\nclass PDFDataTransportStreamReader {\n constructor(stream, queuedChunks, progressiveDone = false) {\n this._stream = stream;\n this._done = progressiveDone || false;\n this._filename = 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 this._requests.forEach(function(requestCapability) {\n requestCapability.resolve({ value: undefined, done: true });\n });\n this._requests = [];\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 this._requests.forEach(function(requestCapability) {\n requestCapability.resolve({ value: undefined, done: true });\n });\n this._requests = [];\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 this._requests.forEach(function(requestCapability) {\n requestCapability.resolve({ value: undefined, done: true });\n });\n this._requests = [];\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/* eslint-disable no-multi-str */\n\nimport { shadow } from \"../shared/util.js\";\n\nclass WebGLContext {\n constructor({ enable = false }) {\n this._enabled = enable === true;\n }\n\n get isEnabled() {\n let enabled = this._enabled;\n if (enabled) {\n enabled = WebGLUtils.tryInitGL();\n }\n return shadow(this, \"isEnabled\", enabled);\n }\n\n composeSMask({ layer, mask, properties }) {\n return WebGLUtils.composeSMask(layer, mask, properties);\n }\n\n drawFigures({ width, height, backgroundColor, figures, context }) {\n return WebGLUtils.drawFigures(\n width,\n height,\n backgroundColor,\n figures,\n context\n );\n }\n\n clear() {\n WebGLUtils.cleanup();\n }\n}\n\nvar WebGLUtils = (function WebGLUtilsClosure() {\n function loadShader(gl, code, shaderType) {\n var shader = gl.createShader(shaderType);\n gl.shaderSource(shader, code);\n gl.compileShader(shader);\n var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n if (!compiled) {\n var errorMsg = gl.getShaderInfoLog(shader);\n throw new Error(\"Error during shader compilation: \" + errorMsg);\n }\n return shader;\n }\n function createVertexShader(gl, code) {\n return loadShader(gl, code, gl.VERTEX_SHADER);\n }\n function createFragmentShader(gl, code) {\n return loadShader(gl, code, gl.FRAGMENT_SHADER);\n }\n function createProgram(gl, shaders) {\n var program = gl.createProgram();\n for (var i = 0, ii = shaders.length; i < ii; ++i) {\n gl.attachShader(program, shaders[i]);\n }\n gl.linkProgram(program);\n var linked = gl.getProgramParameter(program, gl.LINK_STATUS);\n if (!linked) {\n var errorMsg = gl.getProgramInfoLog(program);\n throw new Error(\"Error during program linking: \" + errorMsg);\n }\n return program;\n }\n function createTexture(gl, image, textureId) {\n gl.activeTexture(textureId);\n var texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n\n // Set the parameters so we can render any size image.\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n\n // Upload the image into the texture.\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);\n return texture;\n }\n\n var currentGL, currentCanvas;\n function generateGL() {\n if (currentGL) {\n return;\n }\n\n // The temporary canvas is used in the WebGL context.\n currentCanvas = document.createElement(\"canvas\");\n currentGL = currentCanvas.getContext(\"webgl\", {\n premultipliedalpha: false,\n });\n }\n\n var smaskVertexShaderCode =\n \"\\\n attribute vec2 a_position; \\\n attribute vec2 a_texCoord; \\\n \\\n uniform vec2 u_resolution; \\\n \\\n varying vec2 v_texCoord; \\\n \\\n void main() { \\\n vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \\\n gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \\\n \\\n v_texCoord = a_texCoord; \\\n } \";\n\n var smaskFragmentShaderCode =\n \"\\\n precision mediump float; \\\n \\\n uniform vec4 u_backdrop; \\\n uniform int u_subtype; \\\n uniform sampler2D u_image; \\\n uniform sampler2D u_mask; \\\n \\\n varying vec2 v_texCoord; \\\n \\\n void main() { \\\n vec4 imageColor = texture2D(u_image, v_texCoord); \\\n vec4 maskColor = texture2D(u_mask, v_texCoord); \\\n if (u_backdrop.a > 0.0) { \\\n maskColor.rgb = maskColor.rgb * maskColor.a + \\\n u_backdrop.rgb * (1.0 - maskColor.a); \\\n } \\\n float lum; \\\n if (u_subtype == 0) { \\\n lum = maskColor.a; \\\n } else { \\\n lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \\\n maskColor.b * 0.11; \\\n } \\\n imageColor.a *= lum; \\\n imageColor.rgb *= imageColor.a; \\\n gl_FragColor = imageColor; \\\n } \";\n\n var smaskCache = null;\n\n function initSmaskGL() {\n var canvas, gl;\n\n generateGL();\n canvas = currentCanvas;\n currentCanvas = null;\n gl = currentGL;\n currentGL = null;\n\n // setup a GLSL program\n var vertexShader = createVertexShader(gl, smaskVertexShaderCode);\n var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode);\n var program = createProgram(gl, [vertexShader, fragmentShader]);\n gl.useProgram(program);\n\n var cache = {};\n cache.gl = gl;\n cache.canvas = canvas;\n cache.resolutionLocation = gl.getUniformLocation(program, \"u_resolution\");\n cache.positionLocation = gl.getAttribLocation(program, \"a_position\");\n cache.backdropLocation = gl.getUniformLocation(program, \"u_backdrop\");\n cache.subtypeLocation = gl.getUniformLocation(program, \"u_subtype\");\n\n var texCoordLocation = gl.getAttribLocation(program, \"a_texCoord\");\n var texLayerLocation = gl.getUniformLocation(program, \"u_image\");\n var texMaskLocation = gl.getUniformLocation(program, \"u_mask\");\n\n // provide texture coordinates for the rectangle.\n var texCoordBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);\n // prettier-ignore\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([\n 0.0, 0.0,\n 1.0, 0.0,\n 0.0, 1.0,\n 0.0, 1.0,\n 1.0, 0.0,\n 1.0, 1.0]), gl.STATIC_DRAW);\n gl.enableVertexAttribArray(texCoordLocation);\n gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0);\n\n gl.uniform1i(texLayerLocation, 0);\n gl.uniform1i(texMaskLocation, 1);\n\n smaskCache = cache;\n }\n\n function composeSMask(layer, mask, properties) {\n var width = layer.width,\n height = layer.height;\n\n if (!smaskCache) {\n initSmaskGL();\n }\n var cache = smaskCache,\n canvas = cache.canvas,\n gl = cache.gl;\n canvas.width = width;\n canvas.height = height;\n gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);\n gl.uniform2f(cache.resolutionLocation, width, height);\n\n if (properties.backdrop) {\n gl.uniform4f(\n cache.resolutionLocation,\n properties.backdrop[0],\n properties.backdrop[1],\n properties.backdrop[2],\n 1\n );\n } else {\n gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0);\n }\n gl.uniform1i(\n cache.subtypeLocation,\n properties.subtype === \"Luminosity\" ? 1 : 0\n );\n\n // Create a textures\n var texture = createTexture(gl, layer, gl.TEXTURE0);\n var maskTexture = createTexture(gl, mask, gl.TEXTURE1);\n\n // Create a buffer and put a single clipspace rectangle in\n // it (2 triangles)\n var buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n // prettier-ignore\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([\n 0, 0,\n width, 0,\n 0, height,\n 0, height,\n width, 0,\n width, height]), gl.STATIC_DRAW);\n gl.enableVertexAttribArray(cache.positionLocation);\n gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0);\n\n // draw\n gl.clearColor(0, 0, 0, 0);\n gl.enable(gl.BLEND);\n gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n gl.clear(gl.COLOR_BUFFER_BIT);\n\n gl.drawArrays(gl.TRIANGLES, 0, 6);\n\n gl.flush();\n\n gl.deleteTexture(texture);\n gl.deleteTexture(maskTexture);\n gl.deleteBuffer(buffer);\n\n return canvas;\n }\n\n var figuresVertexShaderCode =\n \"\\\n attribute vec2 a_position; \\\n attribute vec3 a_color; \\\n \\\n uniform vec2 u_resolution; \\\n uniform vec2 u_scale; \\\n uniform vec2 u_offset; \\\n \\\n varying vec4 v_color; \\\n \\\n void main() { \\\n vec2 position = (a_position + u_offset) * u_scale; \\\n vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \\\n gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \\\n \\\n v_color = vec4(a_color / 255.0, 1.0); \\\n } \";\n\n var figuresFragmentShaderCode =\n \"\\\n precision mediump float; \\\n \\\n varying vec4 v_color; \\\n \\\n void main() { \\\n gl_FragColor = v_color; \\\n } \";\n\n var figuresCache = null;\n\n function initFiguresGL() {\n var canvas, gl;\n\n generateGL();\n canvas = currentCanvas;\n currentCanvas = null;\n gl = currentGL;\n currentGL = null;\n\n // setup a GLSL program\n var vertexShader = createVertexShader(gl, figuresVertexShaderCode);\n var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode);\n var program = createProgram(gl, [vertexShader, fragmentShader]);\n gl.useProgram(program);\n\n var cache = {};\n cache.gl = gl;\n cache.canvas = canvas;\n cache.resolutionLocation = gl.getUniformLocation(program, \"u_resolution\");\n cache.scaleLocation = gl.getUniformLocation(program, \"u_scale\");\n cache.offsetLocation = gl.getUniformLocation(program, \"u_offset\");\n cache.positionLocation = gl.getAttribLocation(program, \"a_position\");\n cache.colorLocation = gl.getAttribLocation(program, \"a_color\");\n\n figuresCache = cache;\n }\n\n function drawFigures(width, height, backgroundColor, figures, context) {\n if (!figuresCache) {\n initFiguresGL();\n }\n var cache = figuresCache,\n canvas = cache.canvas,\n gl = cache.gl;\n\n canvas.width = width;\n canvas.height = height;\n gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);\n gl.uniform2f(cache.resolutionLocation, width, height);\n\n // count triangle points\n var count = 0;\n var i, ii, rows;\n for (i = 0, ii = figures.length; i < ii; i++) {\n switch (figures[i].type) {\n case \"lattice\":\n rows = (figures[i].coords.length / figures[i].verticesPerRow) | 0;\n count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6;\n break;\n case \"triangles\":\n count += figures[i].coords.length;\n break;\n }\n }\n // transfer data\n var coords = new Float32Array(count * 2);\n var colors = new Uint8Array(count * 3);\n var coordsMap = context.coords,\n colorsMap = context.colors;\n var pIndex = 0,\n cIndex = 0;\n for (i = 0, ii = figures.length; i < ii; i++) {\n var figure = figures[i],\n ps = figure.coords,\n cs = figure.colors;\n switch (figure.type) {\n case \"lattice\":\n var cols = figure.verticesPerRow;\n rows = (ps.length / cols) | 0;\n for (var row = 1; row < rows; row++) {\n var offset = row * cols + 1;\n for (var col = 1; col < cols; col++, offset++) {\n coords[pIndex] = coordsMap[ps[offset - cols - 1]];\n coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1];\n coords[pIndex + 2] = coordsMap[ps[offset - cols]];\n coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1];\n coords[pIndex + 4] = coordsMap[ps[offset - 1]];\n coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1];\n colors[cIndex] = colorsMap[cs[offset - cols - 1]];\n colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1];\n colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2];\n colors[cIndex + 3] = colorsMap[cs[offset - cols]];\n colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1];\n colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2];\n colors[cIndex + 6] = colorsMap[cs[offset - 1]];\n colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1];\n colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2];\n\n coords[pIndex + 6] = coords[pIndex + 2];\n coords[pIndex + 7] = coords[pIndex + 3];\n coords[pIndex + 8] = coords[pIndex + 4];\n coords[pIndex + 9] = coords[pIndex + 5];\n coords[pIndex + 10] = coordsMap[ps[offset]];\n coords[pIndex + 11] = coordsMap[ps[offset] + 1];\n colors[cIndex + 9] = colors[cIndex + 3];\n colors[cIndex + 10] = colors[cIndex + 4];\n colors[cIndex + 11] = colors[cIndex + 5];\n colors[cIndex + 12] = colors[cIndex + 6];\n colors[cIndex + 13] = colors[cIndex + 7];\n colors[cIndex + 14] = colors[cIndex + 8];\n colors[cIndex + 15] = colorsMap[cs[offset]];\n colors[cIndex + 16] = colorsMap[cs[offset] + 1];\n colors[cIndex + 17] = colorsMap[cs[offset] + 2];\n pIndex += 12;\n cIndex += 18;\n }\n }\n break;\n case \"triangles\":\n for (var j = 0, jj = ps.length; j < jj; j++) {\n coords[pIndex] = coordsMap[ps[j]];\n coords[pIndex + 1] = coordsMap[ps[j] + 1];\n colors[cIndex] = colorsMap[cs[j]];\n colors[cIndex + 1] = colorsMap[cs[j] + 1];\n colors[cIndex + 2] = colorsMap[cs[j] + 2];\n pIndex += 2;\n cIndex += 3;\n }\n break;\n }\n }\n\n // draw\n if (backgroundColor) {\n gl.clearColor(\n backgroundColor[0] / 255,\n backgroundColor[1] / 255,\n backgroundColor[2] / 255,\n 1.0\n );\n } else {\n gl.clearColor(0, 0, 0, 0);\n }\n gl.clear(gl.COLOR_BUFFER_BIT);\n\n var coordsBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW);\n gl.enableVertexAttribArray(cache.positionLocation);\n gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0);\n\n var colorsBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW);\n gl.enableVertexAttribArray(cache.colorLocation);\n gl.vertexAttribPointer(\n cache.colorLocation,\n 3,\n gl.UNSIGNED_BYTE,\n false,\n 0,\n 0\n );\n\n gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY);\n gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY);\n\n gl.drawArrays(gl.TRIANGLES, 0, count);\n\n gl.flush();\n\n gl.deleteBuffer(coordsBuffer);\n gl.deleteBuffer(colorsBuffer);\n\n return canvas;\n }\n\n return {\n tryInitGL() {\n try {\n generateGL();\n return !!currentGL;\n } catch (ex) {}\n return false;\n },\n\n composeSMask,\n\n drawFigures,\n\n cleanup() {\n if (smaskCache && smaskCache.canvas) {\n smaskCache.canvas.width = 0;\n smaskCache.canvas.height = 0;\n }\n if (figuresCache && figuresCache.canvas) {\n figuresCache.canvas.width = 0;\n figuresCache.canvas.height = 0;\n }\n smaskCache = null;\n figuresCache = null;\n },\n };\n})();\n\nexport { WebGLContext };\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 {TextContent} [textContent] - Text content to render (the object\n * 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 {PageViewport} viewport - The target viewport to properly\n * layout the text runs.\n * @property {Array} [textDivs] - HTML elements that are correspond to the\n * text items of the textContent input. This is output and shall be\n * initially be set to empty array.\n * @property {Array} [textContentItemsStr] - Strings that correspond to the\n * `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 */\nvar renderTextLayer = (function renderTextLayerClosure() {\n var MAX_TEXT_DIVS_TO_RENDER = 100000;\n\n var NonWhitespaceRegexp = /\\S/;\n\n function isAllWhitespace(str) {\n return !NonWhitespaceRegexp.test(str);\n }\n\n function appendText(task, geom, styles) {\n // Initialize all used properties to keep the caches monomorphic.\n var textDiv = document.createElement(\"span\");\n var textDivProperties = {\n angle: 0,\n canvasWidth: 0,\n isWhitespace: false,\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 if (isAllWhitespace(geom.str)) {\n textDivProperties.isWhitespace = true;\n task._textDivProperties.set(textDiv, textDivProperties);\n return;\n }\n\n var tx = Util.transform(task._viewport.transform, geom.transform);\n var angle = Math.atan2(tx[1], tx[0]);\n var style = styles[geom.fontName];\n if (style.vertical) {\n angle += Math.PI / 2;\n }\n var fontHeight = Math.sqrt(tx[2] * tx[2] + tx[3] * tx[3]);\n var fontAscent = fontHeight;\n if (style.ascent) {\n fontAscent = style.ascent * fontAscent;\n } else if (style.descent) {\n fontAscent = (1 + style.descent) * fontAscent;\n }\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 textDiv.textContent = geom.str;\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 if (geom.str.length > 1) {\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) {\n var angleCos = 1,\n angleSin = 0;\n if (angle !== 0) {\n angleCos = Math.cos(angle);\n angleSin = Math.sin(angle);\n }\n var divWidth =\n (style.vertical ? geom.height : geom.width) * task._viewport.scale;\n var divHeight = fontHeight;\n\n var 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\n function render(task) {\n if (task._canceled) {\n return;\n }\n var textDivs = task._textDivs;\n var capability = task._capability;\n var 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 (var i = 0; i < textDivsLength; i++) {\n task._layoutText(textDivs[i]);\n }\n }\n\n task._renderingDone = true;\n capability.resolve();\n }\n\n function expand(task) {\n var bounds = task._bounds;\n var viewport = task._viewport;\n\n var expanded = expandBounds(viewport.width, viewport.height, bounds);\n for (var i = 0; i < expanded.length; i++) {\n var div = bounds[i].div;\n var 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 var e = expanded[i],\n b = bounds[i];\n var m = b.m,\n c = m[0],\n s = m[1];\n // Finding intersections with expanded box.\n var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size];\n var ts = new Float64Array(64);\n points.forEach(function(p, i) {\n var t = Util.applyTransform(p, m);\n ts[i + 0] = c && (e.left - t[0]) / c;\n ts[i + 4] = s && (e.top - t[1]) / s;\n ts[i + 8] = c && (e.right - t[0]) / c;\n ts[i + 12] = s && (e.bottom - t[1]) / s;\n\n ts[i + 16] = s && (e.left - t[0]) / -s;\n ts[i + 20] = c && (e.top - t[1]) / c;\n ts[i + 24] = s && (e.right - t[0]) / -s;\n ts[i + 28] = c && (e.bottom - t[1]) / c;\n\n ts[i + 32] = c && (e.left - t[0]) / -c;\n ts[i + 36] = s && (e.top - t[1]) / -s;\n ts[i + 40] = c && (e.right - t[0]) / -c;\n ts[i + 44] = s && (e.bottom - t[1]) / -s;\n\n ts[i + 48] = s && (e.left - t[0]) / s;\n ts[i + 52] = c && (e.top - t[1]) / -c;\n ts[i + 56] = s && (e.right - t[0]) / s;\n ts[i + 60] = c && (e.bottom - t[1]) / -c;\n });\n var findPositiveMin = function(ts, offset, count) {\n var result = 0;\n for (var i = 0; i < count; i++) {\n var t = ts[offset++];\n if (t > 0) {\n result = result ? Math.min(t, result) : t;\n }\n }\n return result;\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 var 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\n function expandBounds(width, height, boxes) {\n var 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 var expanded = new Array(boxes.length);\n bounds.forEach(function(b) {\n var 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 var 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 bounds.forEach(function(b) {\n var i = b.index;\n expanded[i].top = b.x1New;\n expanded[i].bottom = b.x2New;\n });\n return expanded;\n }\n\n function 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 var fakeBoundary = {\n x1: -Infinity,\n y1: -Infinity,\n x2: 0,\n y2: Infinity,\n index: -1,\n x1New: 0,\n x2New: 0,\n };\n var horizon = [\n {\n start: -Infinity,\n end: Infinity,\n boundary: fakeBoundary,\n },\n ];\n\n bounds.forEach(function(boundary) {\n // Searching for the affected part of horizon.\n // TODO red-black tree or simple binary search\n var i = 0;\n while (i < horizon.length && horizon[i].end <= boundary.y1) {\n i++;\n }\n var j = horizon.length - 1;\n while (j >= 0 && horizon[j].start >= boundary.y2) {\n j--;\n }\n\n var horizonPart, affectedBoundary;\n var q,\n k,\n maxXNew = -Infinity;\n for (q = i; q <= j; q++) {\n horizonPart = horizon[q];\n affectedBoundary = horizonPart.boundary;\n var 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 var changedHorizon = [],\n 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 var 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 var 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 horizon.forEach(function(horizonPart) {\n var affectedBoundary = horizonPart.boundary;\n if (affectedBoundary.x2New === undefined) {\n affectedBoundary.x2New = Math.max(width, affectedBoundary.x2);\n }\n });\n }\n\n /**\n * Text layer rendering task.\n *\n * @param {TextContent} textContent\n * @param {HTMLElement} container\n * @param {PageViewport} viewport\n * @param {Array} textDivs\n * @param {boolean} enhanceTextSelection\n * @private\n */\n function TextLayerRenderTask({\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._viewport = viewport;\n this._textDivs = textDivs || [];\n this._textContentItemsStr = textContentItemsStr || [];\n this._enhanceTextSelection = !!enhanceTextSelection;\n this._fontInspectorEnabled = !!(\n globalThis.FontInspector && globalThis.FontInspector.enabled\n );\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 TextLayerRenderTask.prototype = {\n get promise() {\n return this._capability.promise;\n },\n\n cancel: function TextLayer_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 _processItems(items, styleCache) {\n for (let i = 0, len = items.length; i < len; i++) {\n this._textContentItemsStr.push(items[i].str);\n appendText(this, items[i], styleCache);\n }\n },\n\n _layoutText(textDiv) {\n const textDivProperties = this._textDivProperties.get(textDiv);\n if (textDivProperties.isWhitespace) {\n return;\n }\n\n let transform = \"\";\n if (textDivProperties.canvasWidth !== 0) {\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 this._textDivProperties.set(textDiv, textDivProperties);\n this._container.appendChild(textDiv);\n },\n\n _render: function TextLayer_render(timeout) {\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 = document.createElement(\"canvas\");\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 expandTextDivs: function TextLayer_expandTextDivs(expandDivs) {\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 (var 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.isWhitespace) {\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 * Starts rendering of the text layer.\n *\n * @param {TextLayerRenderParameters} renderParameters\n * @returns {TextLayerRenderTask}\n */\n function renderTextLayer(renderParameters) {\n var 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\n return renderTextLayer;\n})();\n\nexport { renderTextLayer };\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/* eslint no-var: error */\n\nimport {\n addLinkAttributes,\n DOMSVGFactory,\n getFilenameFromUrl,\n LinkTarget,\n PDFDateString,\n} from \"./display_utils.js\";\nimport {\n AnnotationBorderStyleType,\n AnnotationType,\n stringToPDFString,\n unreachable,\n Util,\n warn,\n} from \"../shared/util.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 {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @property {boolean} renderInteractiveForms\n * @property {Object} svgFactory\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(parameters, isRenderable = false, ignoreBorder = false) {\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\n if (isRenderable) {\n this.container = this._createContainer(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.makeCssRgb(\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 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 {HTMLSectionElement} container\n * @param {HTMLDivElement|HTMLImageElement|null} trigger\n * @param {Object} data\n * @memberof AnnotationElement\n */\n _createPopup(container, trigger, data) {\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 annotation's HTML element in the empty container.\n *\n * @public\n * @memberof AnnotationElement\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 );\n super(parameters, isRenderable);\n }\n\n /**\n * Render the link annotation's HTML element in the empty container.\n *\n * @public\n * @memberof LinkAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"linkAnnotation\";\n\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 {\n this._bindLink(link, data.dest);\n }\n\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.navigateTo(destination);\n }\n return false;\n };\n if (destination) {\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\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 /**\n * Render the text annotation's HTML element in the empty container.\n *\n * @public\n * @memberof TextAnnotationElement\n * @returns {HTMLSectionElement}\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(this.container, image, this.data);\n }\n\n this.container.appendChild(image);\n return this.container;\n }\n}\n\nclass WidgetAnnotationElement extends AnnotationElement {\n /**\n * Render the widget annotation's HTML element in the empty container.\n *\n * @public\n * @memberof WidgetAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n // Show only the container for unsupported field types.\n return this.container;\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 /**\n * Render the text widget annotation's HTML element in the empty container.\n *\n * @public\n * @memberof TextWidgetAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n const TEXT_ALIGNMENT = [\"left\", \"center\", \"right\"];\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 if (this.data.multiLine) {\n element = document.createElement(\"textarea\");\n element.textContent = this.data.fieldValue;\n } else {\n element = document.createElement(\"input\");\n element.type = \"text\";\n element.setAttribute(\"value\", this.data.fieldValue);\n }\n\n element.disabled = this.data.readOnly;\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 let font = null;\n if (\n this.data.fontRefName &&\n this.page.commonObjs.has(this.data.fontRefName)\n ) {\n font = this.page.commonObjs.get(this.data.fontRefName);\n }\n this._setTextStyle(element, font);\n }\n\n if (this.data.textAlignment !== null) {\n element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];\n }\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 * @param {Object} font\n * @memberof TextWidgetAnnotationElement\n */\n _setTextStyle(element, font) {\n // TODO: This duplicates some of the logic in CanvasGraphics.setFont().\n const style = element.style;\n style.fontSize = `${this.data.fontSize}px`;\n style.direction = this.data.fontDirection < 0 ? \"rtl\" : \"ltr\";\n\n if (!font) {\n return;\n }\n\n let bold = \"normal\";\n if (font.black) {\n bold = \"900\";\n } else if (font.bold) {\n bold = \"bold\";\n }\n style.fontWeight = bold;\n style.fontStyle = font.italic ? \"italic\" : \"normal\";\n\n // Use a reasonable default font if the font doesn't specify a fallback.\n const fontFamily = font.loadedName ? `\"${font.loadedName}\", ` : \"\";\n const fallbackName = font.fallbackName || \"Helvetica, sans-serif\";\n style.fontFamily = fontFamily + fallbackName;\n }\n}\n\nclass CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {\n constructor(parameters) {\n super(parameters, parameters.renderInteractiveForms);\n }\n\n /**\n * Render the checkbox widget annotation's HTML element\n * in the empty container.\n *\n * @public\n * @memberof CheckboxWidgetAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"buttonWidgetAnnotation checkBox\";\n\n const element = document.createElement(\"input\");\n element.disabled = this.data.readOnly;\n element.type = \"checkbox\";\n if (this.data.fieldValue && this.data.fieldValue !== \"Off\") {\n element.setAttribute(\"checked\", true);\n }\n\n this.container.appendChild(element);\n return this.container;\n }\n}\n\nclass RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {\n constructor(parameters) {\n super(parameters, parameters.renderInteractiveForms);\n }\n\n /**\n * Render the radio button widget annotation's HTML element\n * in the empty container.\n *\n * @public\n * @memberof RadioButtonWidgetAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"buttonWidgetAnnotation radioButton\";\n\n const element = document.createElement(\"input\");\n element.disabled = this.data.readOnly;\n element.type = \"radio\";\n element.name = this.data.fieldName;\n if (this.data.fieldValue === this.data.buttonValue) {\n element.setAttribute(\"checked\", true);\n }\n\n this.container.appendChild(element);\n return this.container;\n }\n}\n\nclass PushButtonWidgetAnnotationElement extends LinkAnnotationElement {\n /**\n * Render the push button widget annotation's HTML element\n * in the empty container.\n *\n * @public\n * @memberof PushButtonWidgetAnnotationElement\n * @returns {HTMLSectionElement}\n */\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 return container;\n }\n}\n\nclass ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {\n constructor(parameters) {\n super(parameters, parameters.renderInteractiveForms);\n }\n\n /**\n * Render the choice widget annotation's HTML element in the empty\n * container.\n *\n * @public\n * @memberof ChoiceWidgetAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"choiceWidgetAnnotation\";\n\n const selectElement = document.createElement(\"select\");\n selectElement.disabled = this.data.readOnly;\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.displayValue)) {\n optionElement.setAttribute(\"selected\", true);\n }\n selectElement.appendChild(optionElement);\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 /**\n * Render the popup annotation's HTML element in the empty container.\n *\n * @public\n * @memberof PopupAnnotationElement\n * @returns {HTMLSectionElement}\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 parentElement = this.layer.querySelector(selector);\n if (!parentElement) {\n return this.container;\n }\n\n const popup = new PopupElement({\n container: this.container,\n trigger: parentElement,\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 parentLeft = parseFloat(parentElement.style.left);\n const parentWidth = parseFloat(parentElement.style.width);\n this.container.style.transformOrigin = `-${parentLeft + parentWidth}px -${\n parentElement.style.top\n }`;\n this.container.style.left = `${parentLeft + parentWidth}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 /**\n * Render the popup's HTML element.\n *\n * @public\n * @memberof PopupElement\n * @returns {HTMLSectionElement}\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.setAttribute(\"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.makeCssRgb(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 // Attach the event listeners to the trigger element.\n this.trigger.addEventListener(\"click\", this._toggle.bind(this));\n this.trigger.addEventListener(\"mouseover\", this._show.bind(this, false));\n this.trigger.addEventListener(\"mouseout\", this._hide.bind(this, false));\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.hasAttribute(\"hidden\")) {\n this.hideElement.removeAttribute(\"hidden\");\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.hasAttribute(\"hidden\") && !this.pinned) {\n this.hideElement.setAttribute(\"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 /**\n * Render the free text annotation's HTML element in the empty container.\n *\n * @public\n * @memberof FreeTextAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"freeTextAnnotation\";\n\n if (!this.data.hasPopup) {\n this._createPopup(this.container, 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 /**\n * Render the line annotation's HTML element in the empty container.\n *\n * @public\n * @memberof LineAnnotationElement\n * @returns {HTMLSectionElement}\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(this.container, 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 /**\n * Render the square annotation's HTML element in the empty container.\n *\n * @public\n * @memberof SquareAnnotationElement\n * @returns {HTMLSectionElement}\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(this.container, 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 /**\n * Render the circle annotation's HTML element in the empty container.\n *\n * @public\n * @memberof CircleAnnotationElement\n * @returns {HTMLSectionElement}\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(this.container, 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 /**\n * Render the polyline annotation's HTML element in the empty container.\n *\n * @public\n * @memberof PolylineAnnotationElement\n * @returns {HTMLSectionElement}\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(this.container, 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 /**\n * Render the caret annotation's HTML element in the empty container.\n *\n * @public\n * @memberof CaretAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"caretAnnotation\";\n\n if (!this.data.hasPopup) {\n this._createPopup(this.container, 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 /**\n * Render the ink annotation's HTML element in the empty container.\n *\n * @public\n * @memberof InkAnnotationElement\n * @returns {HTMLSectionElement}\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(this.container, 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, isRenderable, /* ignoreBorder = */ true);\n }\n\n /**\n * Render the highlight annotation's HTML element in the empty container.\n *\n * @public\n * @memberof HighlightAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"highlightAnnotation\";\n\n if (!this.data.hasPopup) {\n this._createPopup(this.container, null, this.data);\n }\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, isRenderable, /* ignoreBorder = */ true);\n }\n\n /**\n * Render the underline annotation's HTML element in the empty container.\n *\n * @public\n * @memberof UnderlineAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"underlineAnnotation\";\n\n if (!this.data.hasPopup) {\n this._createPopup(this.container, null, this.data);\n }\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, isRenderable, /* ignoreBorder = */ true);\n }\n\n /**\n * Render the squiggly annotation's HTML element in the empty container.\n *\n * @public\n * @memberof SquigglyAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"squigglyAnnotation\";\n\n if (!this.data.hasPopup) {\n this._createPopup(this.container, null, this.data);\n }\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, isRenderable, /* ignoreBorder = */ true);\n }\n\n /**\n * Render the strikeout annotation's HTML element in the empty container.\n *\n * @public\n * @memberof StrikeOutAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"strikeoutAnnotation\";\n\n if (!this.data.hasPopup) {\n this._createPopup(this.container, null, this.data);\n }\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 /**\n * Render the stamp annotation's HTML element in the empty container.\n *\n * @public\n * @memberof StampAnnotationElement\n * @returns {HTMLSectionElement}\n */\n render() {\n this.container.className = \"stampAnnotation\";\n\n if (!this.data.hasPopup) {\n this._createPopup(this.container, 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 if (this.linkService.eventBus) {\n this.linkService.eventBus.dispatch(\"fileattachmentannotation\", {\n source: this,\n id: stringToPDFString(filename),\n filename,\n content,\n });\n }\n }\n\n /**\n * Render the file attachment annotation's HTML element in the empty\n * container.\n *\n * @public\n * @memberof FileAttachmentAnnotationElement\n * @returns {HTMLSectionElement}\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(this.container, 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 if (!this.downloadManager) {\n warn(\"Download cannot be started due to unavailable download manager\");\n return;\n }\n this.downloadManager.downloadData(this.content, this.filename, \"\");\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 */\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 });\n if (element.isRenderable) {\n parameters.div.appendChild(element.render());\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 for (const data of parameters.annotations) {\n const element = parameters.div.querySelector(\n `[data-annotation-id=\"${data.id}\"]`\n );\n if (element) {\n element.style.transform = `matrix(${parameters.viewport.transform.join(\n \",\"\n )})`;\n }\n }\n parameters.div.removeAttribute(\"hidden\");\n }\n}\n\nexport { AnnotationLayer };\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/* eslint no-var: error */\n\nimport {\n createObjectURL,\n FONT_IDENTITY_MATRIX,\n IDENTITY_MATRIX,\n ImageKind,\n isNum,\n OPS,\n TextRenderingMode,\n Util,\n warn,\n} from \"../shared/util.js\";\nimport { DOMSVGFactory } from \"./display_utils.js\";\nimport { isNodeJS } from \"../shared/is_node.js\";\n\nlet SVGGraphics = function() {\n throw new Error(\"Not implemented: SVGGraphics\");\n};\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\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,\n 0x50,\n 0x4e,\n 0x47,\n 0x0d,\n 0x0a,\n 0x1a,\n 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 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 SVGGraphics {\n constructor(commonObjs, objs, forceDataSchema) {\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.paintJpegXObject:\n this.paintJpegXObject(args[0], args[1], args[2]);\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.sqrt(a * a + b * b);\n\n current.x = current.lineX = 0;\n current.y = current.lineY = 0;\n\n current.xcoords = [];\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 }\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.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 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 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 += -glyph * fontSize * 0.001;\n continue;\n }\n\n const width = glyph.width;\n const character = glyph.fontChar;\n const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;\n const charWidth = width * widthAdvanceScale + spacing * fontDirection;\n\n if (!glyph.isInFont && !font.missingFile) {\n x += charWidth;\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 continue;\n }\n current.xcoords.push(current.x + x);\n current.tspan.textContent += character;\n x += charWidth;\n }\n if (vertical) {\n current.y -= x * textHScale;\n } else {\n current.x += x * textHScale;\n }\n\n current.tspan.setAttributeNS(\n null,\n \"x\",\n current.xcoords.map(pf).join(\" \")\n );\n current.tspan.setAttributeNS(null, \"y\", pf(-current.y));\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 (!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.data &&\n !this.embeddedFonts[fontObj.loadedName]\n ) {\n this.addFontStyle(fontObj);\n this.embeddedFonts[fontObj.loadedName] = fontObj;\n }\n\n current.fontMatrix = fontObj.fontMatrix\n ? fontObj.fontMatrix\n : 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 }\n\n endText() {\n const current = this.current;\n if (\n current.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG &&\n current.txtElement &&\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.makeCssRgb(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.makeCssRgb(r, g, b);\n this.current.tspan = this.svgFactory.createElement(\"svg:tspan\");\n this.current.xcoords = [];\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 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.makeCssRgb(...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 this.extraStack.forEach(function(prev) {\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 paintJpegXObject(objId, w, h) {\n const imgObj = this.objs.get(objId);\n const imgEl = this.svgFactory.createElement(\"svg:image\");\n imgEl.setAttributeNS(XLINK_NS, \"xlink:href\", imgObj.src);\n imgEl.setAttributeNS(null, \"width\", pf(w));\n imgEl.setAttributeNS(null, \"height\", pf(h));\n imgEl.setAttributeNS(null, \"x\", \"0\");\n imgEl.setAttributeNS(null, \"y\", pf(-h));\n imgEl.setAttributeNS(\n null,\n \"transform\",\n `scale(${pf(1 / w)} ${pf(-1 / h)})`\n );\n\n this._ensureTransformGroup().appendChild(imgEl);\n }\n\n paintImageXObject(objId) {\n const imgData = 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 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\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\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\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 ? this._fullRequestReader._loaded : 0;\n }\n\n getFullReader() {\n assert(!this._fullRequestReader);\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\n const readers = this._rangeRequestReaders.slice(0);\n readers.forEach(function(reader) {\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(url, headers) {\n return {\n protocol: url.protocol,\n auth: url.auth,\n host: url.hostname,\n port: url.port,\n path: url.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 {\n allowRangeRequests,\n 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\";\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 (/\\.pdf$/i.test(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 (\" +\n status +\n ') while retrieving PDF \"' +\n url +\n '\".',\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\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 bytes = Array.from(value, function(ch) {\n return ch.charCodeAt(0) & 0xff;\n });\n value = decoder.decode(new Uint8Array(bytes));\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(contentDisposition) {\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(contentDisposition)) !== 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(_, 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(_, 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/* eslint no-var: error */\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 hasPendingRequests() {\n for (const xhrId in this.pendingRequests) {\n return true;\n }\n return false;\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 abortAllRequests() {\n for (const xhrId in this.pendingRequests) {\n this.abortRequest(xhrId | 0);\n }\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(!this._fullRequestReader);\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 const readers = this._rangeRequestReaders.slice(0);\n readers.forEach(function(reader) {\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 {\n allowRangeRequests,\n 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 this._requests.forEach(function(requestCapability) {\n requestCapability.resolve({ value: undefined, done: true });\n });\n this._requests = [];\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 this._requests.forEach(function(requestCapability) {\n requestCapability.reject(exception);\n });\n this._requests = [];\n this._cachedChunks = [];\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 this._requests.forEach(function(requestCapability) {\n requestCapability.resolve({ value: undefined, done: true });\n });\n this._requests = [];\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 this._requests.forEach(function(requestCapability) {\n requestCapability.resolve({ value: undefined, done: true });\n });\n this._requests = [];\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 this._requests.forEach(function(requestCapability) {\n requestCapability.resolve({ value: undefined, done: true });\n });\n this._requests = [];\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/* eslint no-var: error */\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\nfunction createFetchOptions(headers, withCredentials, abortController) {\n return {\n method: \"GET\",\n headers,\n signal: abortController && 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 ? this._fullRequestReader._loaded : 0;\n }\n\n getFullReader() {\n assert(!this._fullRequestReader);\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 const readers = this._rangeRequestReaders.slice(0);\n readers.forEach(function(reader) {\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 {\n allowRangeRequests,\n 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 ).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\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"],"sourceRoot":""}