1 line
No EOL
872 KiB
Text
1 line
No EOL
872 KiB
Text
{"version":3,"sources":["webpack://pdf.js/web/app_options.js","webpack://pdf.js/web/viewer_compatibility.js","webpack://pdf.js/web/app.js","webpack://pdf.js/node_modules/@babel/runtime/regenerator/index.js","webpack://pdf.js/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js","webpack://pdf.js/web/ui_utils.js","webpack://pdf.js/web/pdfjs.js","webpack://pdf.js/web/pdf_cursor_tools.js","webpack://pdf.js/web/grab_to_pan.js","webpack://pdf.js/web/pdf_rendering_queue.js","webpack://pdf.js/web/overlay_manager.js","webpack://pdf.js/web/password_prompt.js","webpack://pdf.js/web/pdf_attachment_viewer.js","webpack://pdf.js/web/base_tree_viewer.js","webpack://pdf.js/web/pdf_document_properties.js","webpack://pdf.js/web/pdf_find_bar.js","webpack://pdf.js/web/pdf_find_controller.js","webpack://pdf.js/web/pdf_find_utils.js","webpack://pdf.js/web/pdf_history.js","webpack://pdf.js/web/pdf_layer_viewer.js","webpack://pdf.js/web/pdf_link_service.js","webpack://pdf.js/web/pdf_outline_viewer.js","webpack://pdf.js/web/pdf_presentation_mode.js","webpack://pdf.js/web/pdf_scripting_manager.js","webpack://pdf.js/web/pdf_sidebar.js","webpack://pdf.js/web/pdf_sidebar_resizer.js","webpack://pdf.js/web/pdf_thumbnail_viewer.js","webpack://pdf.js/web/pdf_thumbnail_view.js","webpack://pdf.js/web/pdf_viewer.js","webpack://pdf.js/web/base_viewer.js","webpack://pdf.js/web/annotation_layer_builder.js","webpack://pdf.js/web/l10n_utils.js","webpack://pdf.js/web/pdf_page_view.js","webpack://pdf.js/web/struct_tree_layer_builder.js","webpack://pdf.js/web/text_layer_builder.js","webpack://pdf.js/web/xfa_layer_builder.js","webpack://pdf.js/web/secondary_toolbar.js","webpack://pdf.js/web/pdf_single_page_viewer.js","webpack://pdf.js/web/toolbar.js","webpack://pdf.js/web/view_history.js","webpack://pdf.js/web/genericcom.js","webpack://pdf.js/web/preferences.js","webpack://pdf.js/web/download_manager.js","webpack://pdf.js/web/genericl10n.js","webpack://pdf.js/external/webL10n/l10n.js","webpack://pdf.js/web/generic_scripting.js","webpack://pdf.js/web/pdf_print_service.js","webpack://pdf.js/web/print_utils.js","webpack://pdf.js/webpack/bootstrap","webpack://pdf.js/webpack/runtime/node module decorator","webpack://pdf.js/web/viewer.js"],"names":["OptionKind","VIEWER","API","WORKER","PREFERENCE","defaultOptions","cursorToolOnLoad","value","kind","defaultUrl","defaultZoomValue","disableHistory","disablePageLabels","enablePermissions","enablePrintAutoRotate","enableScripting","externalLinkRel","externalLinkTarget","historyUpdateUrl","ignoreDestinationZoom","imageResourcesPath","maxCanvasPixels","compatibility","viewerCompatibilityParams","pdfBugEnabled","printResolution","renderer","renderInteractiveForms","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","textLayerMode","useOnlyCssZoom","viewerCssTheme","viewOnLoad","cMapPacked","cMapUrl","disableAutoFetch","disableFontFace","disableRange","disableStream","docBaseUrl","enableXfa","fontExtraProperties","isEvalSupported","maxImageSize","pdfBug","standardFontDataUrl","verbosity","workerPort","workerSrc","navigator","userOptions","Object","constructor","userOption","defaultOption","options","valueType","Number","compatibilityParams","userAgent","platform","maxTouchPoints","isAndroid","isIOS","isIOSChrome","DEFAULT_SCALE_DELTA","DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT","FORCE_PAGES_LOADED_TIMEOUT","WHEEL_ZOOM_DISABLED_TIMEOUT","ENABLE_PERMISSIONS_CLASS","ViewOnLoad","UNKNOWN","PREVIOUS","INITIAL","ViewerCssTheme","AUTOMATIC","LIGHT","DARK","KNOWN_VERSIONS","KNOWN_GENERATORS","shadow","ctrlKey","metaKey","PDFViewerApplication","initialBookmark","document","_initializedCapability","_fellback","appConfig","pdfDocument","pdfLoadingTask","printService","pdfViewer","pdfThumbnailViewer","pdfRenderingQueue","pdfPresentationMode","pdfDocumentProperties","pdfLinkService","pdfHistory","pdfSidebar","pdfSidebarResizer","pdfOutlineViewer","pdfAttachmentViewer","pdfLayerViewer","pdfCursorTools","pdfScriptingManager","store","downloadManager","overlayManager","preferences","toolbar","secondaryToolbar","eventBus","l10n","isInitialViewSet","downloadComplete","isViewerEmbedded","window","url","baseUrl","externalServices","_boundEvents","documentInfo","metadata","_contentDispositionFilename","_contentLength","_saveInProgress","_wheelUnusedTicks","_idleCallbacks","AppOptions","LinkTarget","appContainer","source","console","reason","hash","hashParams","parseQueryString","waitOn","loadFakeWorker","TextLayerMode","viewer","enabled","loadAndEnablePDFBug","locale","dir","_forceCssTheme","cssTheme","styleSheet","cssRules","mediaMatcher","mediaRule","mediaRegex","i","ii","rule","darkRules","isInAutomation","findController","linkService","sandboxBundleSrc","scriptingFactory","docPropertiesLookup","container","renderingQueue","scriptingManager","elements","run","zoomIn","newScale","Math","zoomOut","zoomReset","PDFPrintServiceFactory","doc","support","bar","initPassiveLoading","setTitleUsingUrl","title","getPdfFilenameFromUrl","decodeURIComponent","getFilenameFromUrl","setTitle","_cancelIdleCallbacks","sourceEventType","promises","webViewerResetPermissions","PDFBug","Promise","workerParameters","GlobalWorkerOptions","parameters","file","apiParameters","key","args","loadingTask","getDocument","loaded","exception","msg","message","_ensureDownloadComplete","filename","data","blob","type","downloadOrSave","fallback","featureId","download","_documentError","moreInfo","_otherError","moreInfoText","version","build","stack","line","errorWrapperConfig","errorWrapper","errorMessage","closeButton","errorMoreInfo","moreInfoButton","lessInfoButton","parts","progress","percent","level","isNaN","clearTimeout","load","firstPagePromise","pageLayoutPromise","pageModePromise","openActionPromise","baseDocumentUrl","storedPromise","page","zoom","scrollLeft","scrollTop","rotation","sidebarView","SidebarView","scrollMode","ScrollMode","spreadMode","SpreadMode","pdfPage","fingerprint","initialDest","openAction","stored","parseInt","pageMode","apiPageModeToSidebarView","pageLayout","apiPageLayoutToSpreadMode","resolve","setTimeout","pagesPromise","onePageRendered","outline","attachments","optionalContentConfig","callback","timeout","once","baseURL","filesize","authors","numPages","URL","markInfo","tagged","triggerAutoPrint","javaScript","js","UNSUPPORTED_FEATURES","AutoPrintRegExp","info","pdfTitle","metadataTitle","contentDispositionFilename","versionId","generatorId","producer","generator","formType","labels","numLabels","_initializePdfHistory","resetHistory","updateUrl","JSON","explicitDest","pageNumber","permissions","PermissionFlag","_initializeAnnotationStorageCallbacks","annotationStorage","setInitialView","setRotation","angle","isValidRotation","setViewerModes","isValidScrollMode","isValidSpreadMode","_cleanup","RendererType","forceRendering","beforePrint","pagesOverview","printContainer","optionalContentConfigPromise","afterPrint","rotatePages","requestPresentationMode","triggerPrinting","bindEvents","bindWindowEvents","event","detail","passive","unbindEvents","unbindWindowEvents","accumulateWheelTicks","ticks","wholeTicks","_unblockDocumentLoadEvent","HOSTED_VIEWER_ORIGINS","validateFileURL","viewerOrigin","origin","protocol","ex","loadScript","PDFWorker","OPS","Stats","pageView","pageStats","queryString","params","fileInput","files","evt","webViewerOpenFileViaURL","thumbnailView","timestamp","stats","view","webViewerSave","location","href","currentPage","loading","RenderingStates","currentScaleValue","webViewerFileInputChange","originalUrl","fileReader","buffer","webViewerOpenFile","openFileInputName","query","phraseSearch","caseSensitive","entireWord","highlightAll","findPrevious","result","matchesCount","rawQuery","setZoomDisabledTimeout","zoomDisabledTimeout","supportedMouseWheelZoomModifierKeys","previousScale","delta","normalizeWheelEventDirection","WheelEvent","PIXELS_PER_LINE_SCALE","currentScale","scaleCorrectionFactor","rect","dx","dy","handled","ensureViewerFocused","cmd","isViewerInPresentationMode","findState","curElement","curElementTagName","turnPage","turnOnlyIfPageFit","CursorTool","instance","supportsPrinting","createPrintService","module","runtime","Op","hasOwn","$Symbol","iteratorSymbol","asyncIteratorSymbol","toStringTagSymbol","enumerable","configurable","writable","obj","define","protoGenerator","outerFn","context","tryLocsList","makeInvokeMethod","exports","arg","fn","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","IteratorPrototype","getProto","NativeIteratorPrototype","values","Gp","GeneratorFunctionPrototype","Generator","GeneratorFunction","ctor","genFun","__await","record","tryCatch","reject","invoke","previousPromise","callInvokeWithMethodAndArg","defineIteratorMethods","AsyncIterator","PromiseImpl","iter","wrap","state","method","doneResult","delegate","delegateResult","maybeInvokeDelegate","done","entry","tryLoc","locs","keys","next","iteratorMethod","iterable","Context","reset","name","stop","rootEntry","rootRecord","dispatchException","handle","hasCatch","hasFinally","abrupt","finallyEntry","complete","finish","resetTryEntry","thrown","delegateYield","iterator","resultName","nextLoc","regeneratorRuntime","globalThis","Function","CSS_UNITS","DEFAULT_SCALE_VALUE","DEFAULT_SCALE","MIN_SCALE","MAX_SCALE","UNKNOWN_SCALE","MAX_AUTO_SCALE","SCROLLBAR_PADDING","VERTICAL_PADDING","LOADINGBAR_END_OFFSET_VAR","PresentationModeState","NORMAL","CHANGING","FULLSCREEN","NONE","THUMBS","OUTLINE","ATTACHMENTS","LAYERS","CANVAS","SVG","DISABLE","ENABLE","ENABLE_ENHANCE","VERTICAL","HORIZONTAL","WRAPPED","ODD","EVEN","devicePixelRatio","backingStoreRatio","ctx","pixelRatio","sx","sy","scaled","scrollMatches","parent","element","offsetY","offsetX","getComputedStyle","spot","debounceScroll","rAF","currentX","viewAreaElement","lastX","currentY","lastY","right","down","_eventHandler","param","minIndex","maxIndex","items","condition","currentIndex","currentItem","xinv","limit","x_","x","a","b","c","d","p","q","r","changeOrientation","rotate","width","height","index","elt","views","pageTop","sortByVisibility","horizontal","rtl","top","scrollEl","bottom","left","elementBottom","elementLeft","elementRight","visible","numViews","firstVisibleElementInd","binarySearchFirstItem","backtrackBeforeAllVisibleElements","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","hiddenHeight","hiddenWidth","fractionHeight","fractionWidth","id","y","widthPercent","first","last","pc","MOUSE_DOM_DELTA_PIXEL_MODE","MOUSE_DOM_DELTA_LINE_MODE","MOUSE_PIXELS_PER_LINE","MOUSE_LINES_PER_PAGE","mode","size","WaitOnType","EVENT","TIMEOUT","delay","target","eventHandler","handler","timeoutHandler","animationStarted","on","external","off","dispatch","eventListeners","Array","listener","externalListeners","_on","_off","units","_updateBar","progressSize","clamp","setWidth","scrollbarWidth","hide","show","moved","len","arr","write","read","curRoot","curActiveOrFocused","pdfjsLib","__non_webpack_require__","SELECT","HAND","ZOOM","switchTool","tool","disableActiveTool","_dispatchEvent","_addEventListeners","previouslyActive","overlay","GrabToPan","CSS_CLASS_GRAB","activate","deactivate","toggle","ignoreTarget","node","_onmousedown","focusedElement","_onmousemove","isLeftMouseReleased","xDiff","yDiff","behavior","_endPan","chrome","isChrome15OrOpera15plus","isSafari6plus","CLEANUP_TIMEOUT","RUNNING","PAUSED","FINISHED","setViewer","setThumbnailViewer","isHighestPriority","renderHighestPriority","getHighestPriority","visibleViews","numVisible","nextPageIndex","previousPageIndex","isViewFinished","renderView","callerCloseMethod","canForceClose","_keyDown","_closeThroughCaller","e","passwordIncorrect","PasswordResponses","close","verify","password","setUpdateCallback","keepRenderedCapability","attachmentsCount","_bindLink","render","names","fragment","item","content","div","_appendAttachment","renderedPromise","TREEITEM_OFFSET_TOP","TREEITEM_SELECTED_CLASS","_normalizeTextContent","removeNullCharacters","_addToggleButton","hidden","toggler","shouldShowAll","_toggleTreeItem","root","_toggleAllTreeItems","_finishRendering","hasAnyNesting","_updateCurrentTreeItem","treeItem","_scrollToCurrentTreeItem","currentNode","DEFAULT_FIELD_CONTENT","NON_METRIC_LOCALES","US_PAGE_NAMES","METRIC_PAGE_NAMES","isPortrait","pageNames","freezeFieldData","currentPageNumber","pagesRotation","getPageSizeInches","fileName","fileSize","author","subject","keywords","creationDate","modificationDate","creator","pageCount","pageSize","linearized","_currentPageNumber","_pagesRotation","contentLength","setDocument","_reset","_updateUI","kb","mb","size_mb","size_kb","size_b","pageSizeInches","isPortraitOrientation","sizeInches","sizeMillimeters","rawName","getPageName","exactMillimeters","intMillimeters","unit","orientation","dateObject","PDFDateString","date","time","_parseLinearization","isLinearized","MATCHES_COUNT_LIMIT","dispatchEvent","updateUIState","findMsg","status","FindState","previous","updateResultsCount","current","total","matchCountMsg","open","_adjustWidth","findbarHeight","inputContainerHeight","FOUND","NOT_FOUND","PENDING","FIND_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","MATCH_SCROLL_OFFSET_LEFT","CHARACTERS_TO_NORMALIZE","normalizationRegex","replace","diffs","normalizedText","normalizedCh","diff","ch","totalDiff","matchIndex","executeCommand","findbarClosed","pendingTimeout","scrollMatchIntoView","selectedLeft","pageIndex","scrollIntoView","pageIdx","matchIdx","wrapped","normalize","_shouldDirtyMatch","_prepareMatches","currentElem","matchesWithLength","nextElem","prevElem","isSubTerm","matches","matchesLength","_isEntireWord","startIdx","getCharacterType","endIdx","_calculatePhraseMatch","queryLen","pageContent","originalMatchIdx","getOriginalIndex","matchEnd","originalQueryLen","_calculateWordMatch","queryArray","subquery","subqueryLen","match","matchLength","skipped","_calculateMatch","pageDiffs","pageMatchesCount","_extractText","promise","extractTextCapability","normalizeWhitespace","textContent","textItems","strBuf","j","jj","_updatePage","_updateAllPages","_nextMatch","currentPageIndex","offset","numPageMatches","_matchesReady","numMatches","_nextPageMatch","_advanceOffsetPage","_updateMatch","found","previousPage","_onFindBarClose","_requestMatchesCount","_updateUIResultsCount","_updateUIState","CharacterType","SPACE","ALPHA_LETTER","PUNCT","HAN_LETTER","KATAKANA_LETTER","HIRAGANA_LETTER","HALFWIDTH_KATAKANA_LETTER","THAI_LETTER","charCode","isAlphabeticalScript","isAscii","isAsciiSpace","isAsciiAlpha","isAsciiDigit","isThai","isHan","isKatakana","isHiragana","isHalfwidthKatakana","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","initialize","reInitialized","getCurrentHash","destination","push","namedDest","forceReplace","isDestArraysEqual","dest","pushPage","pushCurrentPosition","back","forward","_pushOrReplaceState","shouldReplace","newState","uid","newUrl","_tryPushCurrentPosition","temporary","position","_isValidPage","val","_isValidState","checkReload","performance","perfEntry","_updateInternalState","removeTemporary","_parseCurrentHash","checkNameddest","unescape","nameddest","_updateViewarea","_popState","newHash","hashChanged","waitOnEventOrTimeout","_pageHide","_bindEvents","updateViewarea","popState","pageHide","_unbindEvents","destHash","second","isEntryEqual","firstDest","secondDest","layersCount","setVisibility","input","groups","queue","levelData","itemsDiv","groupId","group","label","setHistory","_goToDestinationHelper","destRef","destArray","goToPage","getDestinationHash","escape","str","getAnchorUrl","setHash","zoomArgs","zoomArg","zoomArgNumber","parseFloat","allowNegativeOffset","isValidExplicitDestination","executeNamedAction","action","cachePageRef","refStr","pageRef","_cachedPageNumber","isPageVisible","isPageCached","destLength","allowNull","outlineCount","currentOutlineItemPromise","addLinkAttributes","newWindow","rel","_setStyles","count","totalCount","nestedCount","nestedItems","pageNumberToDestHash","linkElement","pageNumberNesting","nesting","currentNesting","DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS","DELAY_BEFORE_HIDING_CONTROLS","ACTIVE_SELECTOR","CONTROLS_SELECTOR","MOUSE_SCROLL_COOLDOWN_TIME","PAGE_SWITCH_THRESHOLD","SWIPE_MIN_DISTANCE_THRESHOLD","SWIPE_ANGLE_THRESHOLD","request","Element","_mouseWheel","normalizeWheelEventDelta","currentTime","Date","storedTime","totalDelta","success","_notifyStateChange","_setSwitchInProgress","_resetSwitchInProgress","_enter","_exit","_mouseDown","isInternalLink","_contextMenu","_showControls","_hideControls","_resetMouseScrollState","_touchSwipe","startX","startY","endX","endY","absAngle","_addWindowListeners","_removeWindowListeners","_fullscreenChange","_addFullscreenChangeListeners","_removeFullscreenChangeListeners","error","docProperties","objects","calculationOrder","appInfo","language","docInfo","actions","isInPresentationMode","ids","visitedPages","actionsPromise","_createScripting","UI_NOTIFICATION_CLASS","switchView","forceOpen","_switchView","isViewChanged","shouldForceRendering","_forceRendering","_updateThumbnailViewer","pagesCount","_showUINotification","_hideUINotification","onTreeLoaded","button","SIDEBAR_WIDTH_VAR","SIDEBAR_MIN_WIDTH","SIDEBAR_RESIZING_CLASS","_updateWidth","maxWidth","_mouseMove","_mouseUp","updated","THUMBNAIL_SCROLL_MARGIN","THUMBNAIL_SELECTED_CLASS","watchScroll","_scrollUpdated","getThumbnail","_getVisibleThumbs","scrollThumbnailIntoView","prevThumbnailView","visibleThumbs","numVisibleThumbs","shouldScroll","cleanup","TempImageFactory","_resetView","firstPdfPage","viewport","scale","checkSetImageDisabled","pageNum","thumbnail","defaultViewport","firstThumbnailView","_cancelRendering","setPageLabels","_ensurePdfPageLoaded","thumbView","DRAW_UPSCALE_FACTOR","MAX_NUM_SCALING_STEPS","THUMBNAIL_CANVAS_BORDER_WIDTH","THUMBNAIL_WIDTH","tempCanvasCache","getCanvas","tempCanvas","alpha","destroyCanvas","pageWidth","pageHeight","pageRatio","anchor","ring","borderAdjustment","setPdfPage","totalRotation","update","cancelRendering","_getPageDrawContext","upscaleFactor","canvas","outputScale","getOutputScale","transform","_convertCanvasToImage","reducedCanvas","image","draw","finishRenderTask","renderTask","drawViewport","renderContinueCallback","cont","renderContext","canvasContext","resultPromise","pageCached","setImage","_reduceImage","img","reducedWidth","reducedHeight","reducedImageCtx","setPageLabel","_scrollIntoView","pageSpot","pageDiv","_getVisiblePages","_updateHelper","currentId","stillFullyVisible","visiblePages","DEFAULT_CACHE_SIZE","pageIdsToKeep","iMax","pagesToKeep","moveToEndOfArray","viewerVersion","getPageView","_setCurrentPageNumber","resetCurrentPageView","pageLabel","_onePageRenderedOrForceFetch","isPureXfa","textLayerFactory","xfaLayerFactory","annotationLayerFactory","structTreeLayerFactory","firstPageView","getPagesLeft","_scrollUpdate","_setScaleUpdatePages","noScroll","preset","newValue","isSameScale","presetValue","_setScale","noPadding","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","_resetCurrentPageView","pageLabelToPageNumber","scrollPageIntoView","widthScale","heightScale","boundingRect","_updateLocation","normalizedScaleValue","firstPage","pdfOpenParams","currentPageView","topLeft","intLeft","intTop","numVisiblePages","newCacheSize","containsElement","focus","_getCurrentVisiblePage","currentlyVisiblePages","scrollAhead","createTextLayerBuilder","enhanceTextSelection","textLayerDiv","createAnnotationLayerBuilder","hasJSActionsPromise","mouseState","createXfaLayerBuilder","createStructTreeLayerBuilder","getPagesOverview","_updateScrollMode","_updateSpreadMode","pages","parity","spread","_getPageAdvance","yArray","expectedId","firstId","lastId","nextPage","advance","intent","hasJSActions","annotations","dontFlip","AnnotationLayer","cancel","DEFAULT_L10N_STRINGS","of_pages","page_of_pages","document_properties_kb","document_properties_mb","document_properties_date_string","document_properties_page_size_unit_inches","document_properties_page_size_unit_millimeters","document_properties_page_size_orientation_portrait","document_properties_page_size_orientation_landscape","document_properties_page_size_name_a3","document_properties_page_size_name_a4","document_properties_page_size_name_letter","document_properties_page_size_name_legal","document_properties_page_size_dimension_string","document_properties_page_size_dimension_name_string","document_properties_linearized_yes","document_properties_linearized_no","print_progress_percent","additional_layers","page_landmark","thumb_page_title","thumb_page_canvas","find_reached_top","find_reached_bottom","find_not_found","error_version_info","error_message","error_stack","error_file","error_line","rendering_error","page_scale_width","page_scale_fit","page_scale_auto","page_scale_actual","page_scale_percent","loading_error","invalid_file_error","missing_file_error","unexpected_response_error","printing_not_supported","printing_not_ready","web_fonts_disabled","PARTIAL_LANG_CODES","en","es","fy","ga","gu","hi","hy","nb","ne","nn","pa","pt","sv","zh","langCode","NullL10n","getL10nFallback","formatL10nValue","MAX_CANVAS_PIXELS","destroy","_resetZoomLayer","removeFromDOM","zoomLayerCanvas","keepZoomLayer","keepAnnotationLayer","keepXfaLayer","childNodes","zoomLayerNode","annotationLayerNode","xfaLayerNode","redrawAnnotationLayer","redrawXfaLayer","cssTransform","isScalingRestricted","relativeRotation","absRotation","scaleX","scaleY","textLayerViewport","textRelativeRotation","textAbsRotation","transX","transY","getPagePoint","canvasWrapper","textLayer","finishPaintTask","paintTask","readableStream","includeMarkedContent","tree","treeDom","paintOnCanvas","renderCapability","onRenderContinue","isCanvasHidden","showCanvas","actualSizeViewport","pixelsInViewport","maxScale","sfx","approximateFraction","sfy","roundToDivide","paintOnSvg","cancelled","ensureNotCancelled","opList","svgGfx","svg","wrapper","PDF_ROLE_TO_HTML_ROLE","Document","DocumentFragment","Part","Sect","Div","Aside","NonStruct","P","H","Title","FENote","Sub","Lbl","Span","Em","Strong","Link","Annot","Form","Ruby","RB","RT","RP","Warichu","WT","WP","L","LI","LBody","Table","TR","TH","TD","THead","TBody","TFoot","Caption","Figure","Formula","Artifact","HEADING_PATTERN","_setAttributes","structElement","htmlElement","_walk","role","EXPAND_DIVS_TIMEOUT","endOfContent","numTextDivs","textLayerFrag","textContentStream","textDivs","textContentItemsStr","setTextContentStream","setTextContent","_convertMatches","iIndex","end","m","mm","begin","divIdx","_renderMatches","isSelectedPage","selectedMatchIdx","prevEnd","infinity","appendTextToDiv","span","className","i0","i1","isSelected","highlightSuffix","beginText","n0","n1","_updateMatches","clearedUntilDivIdx","n","pageMatches","pageMatchesLength","_bindMouse","expandDivsTimer","adjustTop","divBounds","xfa","XfaLayer","xfaHtml","eventName","eventDetails","lastPage","pageRotateCw","pageRotateCcw","setPageNumber","setPagesCount","_bindClickListeners","details","_bindCursorToolsListener","buttons","_bindScrollModeListener","isScrollModeHorizontal","scrollModeChanged","_bindSpreadModeListener","spreadModeChanged","_setMaxHeight","_ensurePageViewVisible","previousPageView","viewerNodes","scrolledDown","PAGE_NUMBER_LOADING_INDICATOR","SCALE_SELECT_CONTAINER_WIDTH","SCALE_SELECT_WIDTH","scaleSelectContainer","scaleSelect","customScaleOption","setPageScale","_bindListeners","self","resetNumPages","pageScale","predefinedValueFound","option","updateLoadingIndicatorState","pageNumberInput","predefinedValuesPromise","overflow","DEFAULT_VIEW_HISTORY_CACHE_SIZE","cacheSize","databaseStr","database","branch","localStorage","properties","GenericCom","prefs","prefValue","defaultValue","defaultType","downloadUrl","createValidAbsoluteUrl","downloadData","blobUrl","createObjectURL","openOrDownloadData","isPdfData","isPdfFile","contentType","viewerUrl","encodeURIComponent","webL10n","fixupLangCode","gL10nData","gTextData","gTextProp","gLanguage","gMacros","gReadyState","gAsyncResourceLoading","script","l10nId","l10nArgs","onSuccess","onFailure","xhr","text","dictionary","reBlank","reComment","reSection","reImport","reSplit","entries","rawText","currentLang","genericLang","lang","skipLang","parsedRawLinesCallback","loadImport","tmp","evalString","nextEntry","xhrLoadText","parseRawLines","parsedPropertiesCallback","parseProperties","prop","successCallback","clear","langLinks","getL10nResourceLinks","langCount","dict","getL10nDictionary","defaultLocale","anyCaseLang","onResourceLoaded","gResourceCount","link","parseResource","resource","locales2rules","list","start","pluralRules","isBetween","getPluralRules","rv","substIndexes","substArguments","reIndex","reMatch","macroName","paramName","macro","reArgs","getL10nAttributes","getL10nData","getChildElementCount","children","l","textNode","getTranslatableChildren","elementCount","translateElement","get","getData","getText","getLanguage","setLanguage","loadLocale","getDirection","rtlList","shortCode","translate","getReadyState","ready","sandbox","activeService","scratchCanvas","PRINT_UNITS","includeAnnotationStorage","PDFPrintService","layout","body","hasEqualPageSizes","ensureOverlay","renderPages","getXfaHtmlForPrinting","renderNextPage","renderProgress","renderPage","useRenderedPage","performPrint","print","throwIfInactive","activeServiceOnEntry","abort","progressContainer","progressBar","progressPerc","stopPropagationIfNeeded","overlayPromise","factory","builder","getXfaPageViewport","pdfjsVersion","pdfjsBuild","require","mainContainer","viewerContainer","viewFind","openFile","presentationModeButton","viewBookmark","toggleButton","toolbarButtonContainer","openFileButton","printButton","downloadButton","viewBookmarkButton","firstPageButton","lastPageButton","pageRotateCwButton","pageRotateCcwButton","cursorSelectToolButton","cursorHandToolButton","scrollVerticalButton","scrollHorizontalButton","scrollWrappedButton","spreadNoneButton","spreadOddButton","spreadEvenButton","documentPropertiesButton","sidebar","outerContainer","thumbnailButton","outlineButton","attachmentsButton","layersButton","outlineView","attachmentsView","layersView","outlineOptionsContainer","currentOutlineItemButton","sidebarResizer","resizer","findBar","findField","highlightAllCheckbox","caseSensitiveCheckbox","entireWordCheckbox","findResultsCount","findPreviousButton","findNextButton","passwordOverlay","overlayName","submitButton","canc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ADJ;AAENyoB,kBAAUzoB,wBAFJ,eAEIA,CAFJ;AAGN8F,eAAO9F,wBAHD,YAGCA,CAHD;AAIN0oB,gBAAQ1oB,wBAJF,aAIEA,CAJF;AAKN2oB,iBAAS3oB,wBALH,cAKGA,CALH;AAMN4oB,kBAAU5oB,wBANJ,eAMIA,CANJ;AAON6oB,sBAAc7oB,wBAPR,mBAOQA,CAPR;AAQN8oB,0BAAkB9oB,wBARZ,uBAQYA,CARZ;AASN+oB,iBAAS/oB,wBATH,cASGA,CATH;AAUN4M,kBAAU5M,wBAVJ,eAUIA,CAVJ;AAWNmI,iBAASnI,wBAXH,cAWGA,CAXH;AAYNgpB,mBAAWhpB,wBAZL,gBAYKA,CAZL;AAaNipB,kBAAUjpB,wBAbJ,eAaIA,CAbJ;AAcNkpB,oBAAYlpB,wBAdN,iBAcMA;AAdN;AAJU,KA/Ff;AAoHLwI,gBApHK,EAoHLA,YApHK;AAqHL+F,oBAAgBvO,wBArHX,gBAqHWA,CArHX;AAsHL0R,uBAtHK;AAuHLgxC,wBAvHK;AAAA,GAAP;AA3EF;;AAsMA,yBAAyB;AACvB,MAAMC,SAASC,sBADQ,EACvB;AAiBI,MAAM7zC,QAAQ/O,qBAlBK,aAkBLA,CAAd;AACA+O,uDAAqD;AACnDhM,YApBiB;AAmBkC,GAArDgM;;AAGA,MAAI;AAIFyM,kCAJE,KAIFA;AAJF,IAKE,WAAW;AAGXxY,6CAHW,EAGXA;AACAhD,2BAJW,KAIXA;AA/BiB;;AAmCrBF,gCAnCqB,MAmCrBA;AAzOJ;;AA+OA,IAAIE,SAAJ,oBAAiC;AAC/BA,8BAD+B,IAC/BA;AAhPF;;AAmPA,IACEA,yCACAA,wBAFF,YAGE;AACA6iD,eADA;AAHF,OAKO;AACL7iD,+DADK,IACLA;AAzPF,C","file":"viewer.js","sourcesContent":["/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { viewerCompatibilityParams } from \"./viewer_compatibility.js\";\n\nconst OptionKind = {\n VIEWER: 0x02,\n API: 0x04,\n WORKER: 0x08,\n PREFERENCE: 0x80,\n};\n\n/**\n * PLEASE NOTE: To avoid introducing unnecessary dependencies, we specify the\n * values below *explicitly* rather than relying on imported types.\n */\nconst defaultOptions = {\n cursorToolOnLoad: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n defaultUrl: {\n /** @type {string} */\n value: \"compressed.tracemonkey-pldi-09.pdf\",\n kind: OptionKind.VIEWER,\n },\n defaultZoomValue: {\n /** @type {string} */\n value: \"\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n disableHistory: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER,\n },\n disablePageLabels: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enablePermissions: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enablePrintAutoRotate: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableScripting: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n externalLinkRel: {\n /** @type {string} */\n value: \"noopener noreferrer nofollow\",\n kind: OptionKind.VIEWER,\n },\n externalLinkTarget: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n historyUpdateUrl: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n ignoreDestinationZoom: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n imageResourcesPath: {\n /** @type {string} */\n value: \"./images/\",\n kind: OptionKind.VIEWER,\n },\n maxCanvasPixels: {\n /** @type {number} */\n value: 16777216,\n compatibility: viewerCompatibilityParams.maxCanvasPixels,\n kind: OptionKind.VIEWER,\n },\n pdfBugEnabled: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n printResolution: {\n /** @type {number} */\n value: 150,\n kind: OptionKind.VIEWER,\n },\n renderer: {\n /** @type {string} */\n value: \"canvas\",\n kind: OptionKind.VIEWER,\n },\n renderInteractiveForms: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n sidebarViewOnLoad: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n scrollModeOnLoad: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n spreadModeOnLoad: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n textLayerMode: {\n /** @type {number} */\n value: 1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n useOnlyCssZoom: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n viewerCssTheme: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n viewOnLoad: {\n /** @type {boolean} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n\n cMapPacked: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API,\n },\n cMapUrl: {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? \"../external/bcmaps/\"\n : \"../web/cmaps/\",\n kind: OptionKind.API,\n },\n disableAutoFetch: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n disableFontFace: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n disableRange: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n disableStream: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n docBaseUrl: {\n /** @type {string} */\n value: \"\",\n kind: OptionKind.API,\n },\n enableXfa: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\"),\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n fontExtraProperties: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API,\n },\n isEvalSupported: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API,\n },\n maxImageSize: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.API,\n },\n pdfBug: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API,\n },\n standardFontDataUrl: {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? \"../external/standard_fonts/\"\n : \"../web/standard_fonts/\",\n kind: OptionKind.API,\n },\n verbosity: {\n /** @type {number} */\n value: 1,\n kind: OptionKind.API,\n },\n\n workerPort: {\n /** @type {Object} */\n value: null,\n kind: OptionKind.WORKER,\n },\n workerSrc: {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? \"../src/worker_loader.js\"\n : \"../build/pdf.worker.js\",\n kind: OptionKind.WORKER,\n },\n};\nif (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n) {\n defaultOptions.disablePreferences = {\n /** @type {boolean} */\n value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER,\n };\n defaultOptions.locale = {\n /** @type {string} */\n value: typeof navigator !== \"undefined\" ? navigator.language : \"en-US\",\n kind: OptionKind.VIEWER,\n };\n defaultOptions.sandboxBundleSrc = {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? \"../build/dev-sandbox/pdf.sandbox.js\"\n : \"../build/pdf.sandbox.js\",\n kind: OptionKind.VIEWER,\n };\n\n defaultOptions.renderer.kind += OptionKind.PREFERENCE;\n} else if (PDFJSDev.test(\"CHROME\")) {\n defaultOptions.disableTelemetry = {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n };\n defaultOptions.sandboxBundleSrc = {\n /** @type {string} */\n value: \"../build/pdf.sandbox.js\",\n kind: OptionKind.VIEWER,\n };\n}\n\nconst userOptions = Object.create(null);\n\nclass AppOptions {\n constructor() {\n throw new Error(\"Cannot initialize AppOptions.\");\n }\n\n static get(name) {\n const userOption = userOptions[name];\n if (userOption !== undefined) {\n return userOption;\n }\n const defaultOption = defaultOptions[name];\n if (defaultOption !== undefined) {\n return defaultOption.compatibility ?? defaultOption.value;\n }\n return undefined;\n }\n\n static getAll(kind = null) {\n const options = Object.create(null);\n for (const name in defaultOptions) {\n const defaultOption = defaultOptions[name];\n if (kind) {\n if ((kind & defaultOption.kind) === 0) {\n continue;\n }\n if (kind === OptionKind.PREFERENCE) {\n const value = defaultOption.value,\n valueType = typeof value;\n\n if (\n valueType === \"boolean\" ||\n valueType === \"string\" ||\n (valueType === \"number\" && Number.isInteger(value))\n ) {\n options[name] = value;\n continue;\n }\n throw new Error(`Invalid type for preference: ${name}`);\n }\n }\n const userOption = userOptions[name];\n options[name] =\n userOption !== undefined\n ? userOption\n : defaultOption.compatibility ?? defaultOption.value;\n }\n return options;\n }\n\n static set(name, value) {\n userOptions[name] = value;\n }\n\n static setAll(options) {\n for (const name in options) {\n userOptions[name] = options[name];\n }\n }\n\n static remove(name) {\n delete userOptions[name];\n }\n}\n\nexport { AppOptions, OptionKind };\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 userAgent =\n (typeof navigator !== \"undefined\" && navigator.userAgent) || \"\";\n const platform =\n (typeof navigator !== \"undefined\" && navigator.platform) || \"\";\n const maxTouchPoints =\n (typeof navigator !== \"undefined\" && navigator.maxTouchPoints) || 1;\n\n const isAndroid = /Android/.test(userAgent);\n const isIOS =\n /\\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) ||\n (platform === \"MacIntel\" && maxTouchPoints > 1);\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 Chrome on iOS loses data created with createObjectURL(),\n // see issue #8081.\n if (isIOSChrome) {\n compatibilityParams.disableCreateObjectURL = true;\n }\n })();\n\n // Limit canvas size to 5 mega-pixels on mobile.\n // Support: Android, iOS\n (function checkCanvasSizeLimitation() {\n if (isIOS || isAndroid) {\n compatibilityParams.maxCanvasPixels = 5242880;\n }\n })();\n}\nconst viewerCompatibilityParams = Object.freeze(compatibilityParams);\n\nexport { viewerCompatibilityParams };\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 PDFBug, Stats */\n\nimport {\n animationStarted,\n apiPageLayoutToSpreadMode,\n apiPageModeToSidebarView,\n AutoPrintRegExp,\n DEFAULT_SCALE_VALUE,\n EventBus,\n getActiveOrFocusedElement,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n MAX_SCALE,\n MIN_SCALE,\n noContextMenuHandler,\n normalizeWheelEventDirection,\n parseQueryString,\n ProgressBar,\n RendererType,\n ScrollMode,\n SidebarView,\n SpreadMode,\n TextLayerMode,\n} from \"./ui_utils.js\";\nimport { AppOptions, OptionKind } from \"./app_options.js\";\nimport {\n build,\n createPromiseCapability,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n GlobalWorkerOptions,\n InvalidPDFException,\n isPdfFile,\n LinkTarget,\n loadScript,\n MissingPDFException,\n OPS,\n PDFWorker,\n PermissionFlag,\n shadow,\n UnexpectedResponseException,\n UNSUPPORTED_FEATURES,\n version,\n} from \"pdfjs-lib\";\nimport { CursorTool, PDFCursorTools } from \"./pdf_cursor_tools.js\";\nimport { PDFRenderingQueue, RenderingStates } from \"./pdf_rendering_queue.js\";\nimport { OverlayManager } from \"./overlay_manager.js\";\nimport { PasswordPrompt } from \"./password_prompt.js\";\nimport { PDFAttachmentViewer } from \"./pdf_attachment_viewer.js\";\nimport { PDFDocumentProperties } from \"./pdf_document_properties.js\";\nimport { PDFFindBar } from \"./pdf_find_bar.js\";\nimport { PDFFindController } from \"./pdf_find_controller.js\";\nimport { PDFHistory } from \"./pdf_history.js\";\nimport { PDFLayerViewer } from \"./pdf_layer_viewer.js\";\nimport { PDFLinkService } from \"./pdf_link_service.js\";\nimport { PDFOutlineViewer } from \"./pdf_outline_viewer.js\";\nimport { PDFPresentationMode } from \"./pdf_presentation_mode.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.js\";\nimport { PDFSidebar } from \"./pdf_sidebar.js\";\nimport { PDFSidebarResizer } from \"./pdf_sidebar_resizer.js\";\nimport { PDFThumbnailViewer } from \"./pdf_thumbnail_viewer.js\";\nimport { PDFViewer } from \"./pdf_viewer.js\";\nimport { SecondaryToolbar } from \"./secondary_toolbar.js\";\nimport { Toolbar } from \"./toolbar.js\";\nimport { viewerCompatibilityParams } from \"./viewer_compatibility.js\";\nimport { ViewHistory } from \"./view_history.js\";\n\nconst DEFAULT_SCALE_DELTA = 1.1;\nconst DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; // ms\nconst FORCE_PAGES_LOADED_TIMEOUT = 10000; // ms\nconst WHEEL_ZOOM_DISABLED_TIMEOUT = 1000; // ms\nconst ENABLE_PERMISSIONS_CLASS = \"enablePermissions\";\n\nconst ViewOnLoad = {\n UNKNOWN: -1,\n PREVIOUS: 0, // Default value.\n INITIAL: 1,\n};\n\nconst ViewerCssTheme = {\n AUTOMATIC: 0, // Default value.\n LIGHT: 1,\n DARK: 2,\n};\n\n// Keep these in sync with mozilla-central's Histograms.json.\nconst KNOWN_VERSIONS = [\n \"1.0\",\n \"1.1\",\n \"1.2\",\n \"1.3\",\n \"1.4\",\n \"1.5\",\n \"1.6\",\n \"1.7\",\n \"1.8\",\n \"1.9\",\n \"2.0\",\n \"2.1\",\n \"2.2\",\n \"2.3\",\n];\n// Keep these in sync with mozilla-central's Histograms.json.\nconst KNOWN_GENERATORS = [\n \"acrobat distiller\",\n \"acrobat pdfwriter\",\n \"adobe livecycle\",\n \"adobe pdf library\",\n \"adobe photoshop\",\n \"ghostscript\",\n \"tcpdf\",\n \"cairo\",\n \"dvipdfm\",\n \"dvips\",\n \"pdftex\",\n \"pdfkit\",\n \"itext\",\n \"prince\",\n \"quarkxpress\",\n \"mac os x\",\n \"microsoft\",\n \"openoffice\",\n \"oracle\",\n \"luradocument\",\n \"pdf-xchange\",\n \"antenna house\",\n \"aspose.cells\",\n \"fpdf\",\n];\n\nclass DefaultExternalServices {\n constructor() {\n throw new Error(\"Cannot initialize DefaultExternalServices.\");\n }\n\n static updateFindControlState(data) {}\n\n static updateFindMatchesCount(data) {}\n\n static initPassiveLoading(callbacks) {}\n\n static async fallback(data) {}\n\n static reportTelemetry(data) {}\n\n static createDownloadManager(options) {\n throw new Error(\"Not implemented: createDownloadManager\");\n }\n\n static createPreferences() {\n throw new Error(\"Not implemented: createPreferences\");\n }\n\n static createL10n(options) {\n throw new Error(\"Not implemented: createL10n\");\n }\n\n static createScripting(options) {\n throw new Error(\"Not implemented: createScripting\");\n }\n\n static get supportsIntegratedFind() {\n return shadow(this, \"supportsIntegratedFind\", false);\n }\n\n static get supportsDocumentFonts() {\n return shadow(this, \"supportsDocumentFonts\", true);\n }\n\n static get supportedMouseWheelZoomModifierKeys() {\n return shadow(this, \"supportedMouseWheelZoomModifierKeys\", {\n ctrlKey: true,\n metaKey: true,\n });\n }\n\n static get isInAutomation() {\n return shadow(this, \"isInAutomation\", false);\n }\n}\n\nconst PDFViewerApplication = {\n initialBookmark: document.location.hash.substring(1),\n _initializedCapability: createPromiseCapability(),\n _fellback: false,\n appConfig: null,\n pdfDocument: null,\n pdfLoadingTask: null,\n printService: null,\n /** @type {PDFViewer} */\n pdfViewer: null,\n /** @type {PDFThumbnailViewer} */\n pdfThumbnailViewer: null,\n /** @type {PDFRenderingQueue} */\n pdfRenderingQueue: null,\n /** @type {PDFPresentationMode} */\n pdfPresentationMode: null,\n /** @type {PDFDocumentProperties} */\n pdfDocumentProperties: null,\n /** @type {PDFLinkService} */\n pdfLinkService: null,\n /** @type {PDFHistory} */\n pdfHistory: null,\n /** @type {PDFSidebar} */\n pdfSidebar: null,\n /** @type {PDFSidebarResizer} */\n pdfSidebarResizer: null,\n /** @type {PDFOutlineViewer} */\n pdfOutlineViewer: null,\n /** @type {PDFAttachmentViewer} */\n pdfAttachmentViewer: null,\n /** @type {PDFLayerViewer} */\n pdfLayerViewer: null,\n /** @type {PDFCursorTools} */\n pdfCursorTools: null,\n /** @type {PDFScriptingManager} */\n pdfScriptingManager: null,\n /** @type {ViewHistory} */\n store: null,\n /** @type {DownloadManager} */\n downloadManager: null,\n /** @type {OverlayManager} */\n overlayManager: null,\n /** @type {Preferences} */\n preferences: null,\n /** @type {Toolbar} */\n toolbar: null,\n /** @type {SecondaryToolbar} */\n secondaryToolbar: null,\n /** @type {EventBus} */\n eventBus: null,\n /** @type {IL10n} */\n l10n: null,\n isInitialViewSet: false,\n downloadComplete: false,\n isViewerEmbedded: window.parent !== window,\n url: \"\",\n baseUrl: \"\",\n externalServices: DefaultExternalServices,\n _boundEvents: Object.create(null),\n documentInfo: null,\n metadata: null,\n _contentDispositionFilename: null,\n _contentLength: null,\n _saveInProgress: false,\n _wheelUnusedTicks: 0,\n _idleCallbacks: new Set(),\n\n // Called once when the document is loaded.\n async initialize(appConfig) {\n this.preferences = this.externalServices.createPreferences();\n this.appConfig = appConfig;\n\n await this._readPreferences();\n await this._parseHashParameters();\n this._forceCssTheme();\n await this._initializeL10n();\n\n if (\n this.isViewerEmbedded &&\n AppOptions.get(\"externalLinkTarget\") === LinkTarget.NONE\n ) {\n // Prevent external links from \"replacing\" the viewer,\n // when it's embedded in e.g. an <iframe> or an <object>.\n AppOptions.set(\"externalLinkTarget\", LinkTarget.TOP);\n }\n await this._initializeViewerComponents();\n\n // Bind the various event handlers *after* the viewer has been\n // initialized, to prevent errors if an event arrives too soon.\n this.bindEvents();\n this.bindWindowEvents();\n\n // We can start UI localization now.\n const appContainer = appConfig.appContainer || document.documentElement;\n this.l10n.translate(appContainer).then(() => {\n // Dispatch the 'localized' event on the `eventBus` once the viewer\n // has been fully initialized and translated.\n this.eventBus.dispatch(\"localized\", { source: this });\n });\n\n this._initializedCapability.resolve();\n },\n\n /**\n * @private\n */\n async _readPreferences() {\n if (\n (typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n AppOptions.get(\"disablePreferences\")\n ) {\n // Give custom implementations of the default viewer a simpler way to\n // opt-out of having the `Preferences` override existing `AppOptions`.\n return;\n }\n try {\n AppOptions.setAll(await this.preferences.getAll());\n } catch (reason) {\n console.error(`_readPreferences: \"${reason?.message}\".`);\n }\n },\n\n /**\n * Potentially parse special debugging flags in the hash section of the URL.\n * @private\n */\n async _parseHashParameters() {\n if (!AppOptions.get(\"pdfBugEnabled\")) {\n return undefined;\n }\n const hash = document.location.hash.substring(1);\n if (!hash) {\n return undefined;\n }\n const hashParams = parseQueryString(hash),\n waitOn = [];\n\n if (\"disableworker\" in hashParams && hashParams.disableworker === \"true\") {\n waitOn.push(loadFakeWorker());\n }\n if (\"disablerange\" in hashParams) {\n AppOptions.set(\"disableRange\", hashParams.disablerange === \"true\");\n }\n if (\"disablestream\" in hashParams) {\n AppOptions.set(\"disableStream\", hashParams.disablestream === \"true\");\n }\n if (\"disableautofetch\" in hashParams) {\n AppOptions.set(\n \"disableAutoFetch\",\n hashParams.disableautofetch === \"true\"\n );\n }\n if (\"disablefontface\" in hashParams) {\n AppOptions.set(\"disableFontFace\", hashParams.disablefontface === \"true\");\n }\n if (\"disablehistory\" in hashParams) {\n AppOptions.set(\"disableHistory\", hashParams.disablehistory === \"true\");\n }\n if (\"verbosity\" in hashParams) {\n AppOptions.set(\"verbosity\", hashParams.verbosity | 0);\n }\n if (\"textlayer\" in hashParams) {\n switch (hashParams.textlayer) {\n case \"off\":\n AppOptions.set(\"textLayerMode\", TextLayerMode.DISABLE);\n break;\n case \"visible\":\n case \"shadow\":\n case \"hover\":\n const viewer = this.appConfig.viewerContainer;\n viewer.classList.add(\"textLayer-\" + hashParams.textlayer);\n break;\n }\n }\n if (\"pdfbug\" in hashParams) {\n AppOptions.set(\"pdfBug\", true);\n AppOptions.set(\"fontExtraProperties\", true);\n\n const enabled = hashParams.pdfbug.split(\",\");\n waitOn.push(loadAndEnablePDFBug(enabled));\n }\n // It is not possible to change locale for the (various) extension builds.\n if (\n (typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n \"locale\" in hashParams\n ) {\n AppOptions.set(\"locale\", hashParams.locale);\n }\n\n if (waitOn.length === 0) {\n return undefined;\n }\n return Promise.all(waitOn).catch(reason => {\n console.error(`_parseHashParameters: \"${reason.message}\".`);\n });\n },\n\n /**\n * @private\n */\n async _initializeL10n() {\n this.l10n = this.externalServices.createL10n(\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ? { locale: AppOptions.get(\"locale\") }\n : null\n );\n const dir = await this.l10n.getDirection();\n document.getElementsByTagName(\"html\")[0].dir = dir;\n },\n\n /**\n * @private\n */\n _forceCssTheme() {\n const cssTheme = AppOptions.get(\"viewerCssTheme\");\n if (\n cssTheme === ViewerCssTheme.AUTOMATIC ||\n !Object.values(ViewerCssTheme).includes(cssTheme)\n ) {\n return;\n }\n try {\n const styleSheet = document.styleSheets[0];\n const cssRules = styleSheet?.cssRules || [];\n const mediaMatcher =\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? \"-moz-toolbar-prefers-color-scheme\"\n : \"prefers-color-scheme\";\n const mediaRule = `(${mediaMatcher}: dark)`;\n const mediaRegex = new RegExp(\n `^@media \\\\(${mediaMatcher}: dark\\\\) {\\\\n\\\\s*([\\\\w\\\\s-.,:;/\\\\\\\\{}()]+)\\\\n}$`\n );\n for (let i = 0, ii = cssRules.length; i < ii; i++) {\n const rule = cssRules[i];\n if (rule instanceof CSSMediaRule && rule.media?.[0] === mediaRule) {\n if (cssTheme === ViewerCssTheme.LIGHT) {\n styleSheet.deleteRule(i);\n return;\n }\n // cssTheme === ViewerCssTheme.DARK\n const darkRules = mediaRegex.exec(rule.cssText);\n if (darkRules?.[1]) {\n styleSheet.deleteRule(i);\n styleSheet.insertRule(darkRules[1], i);\n }\n return;\n }\n }\n } catch (reason) {\n console.error(`_forceCssTheme: \"${reason?.message}\".`);\n }\n },\n\n /**\n * @private\n */\n async _initializeViewerComponents() {\n const appConfig = this.appConfig;\n\n const eventBus =\n appConfig.eventBus ||\n new EventBus({ isInAutomation: this.externalServices.isInAutomation });\n this.eventBus = eventBus;\n\n this.overlayManager = new OverlayManager();\n\n const pdfRenderingQueue = new PDFRenderingQueue();\n pdfRenderingQueue.onIdle = this._cleanup.bind(this);\n this.pdfRenderingQueue = pdfRenderingQueue;\n\n const pdfLinkService = new PDFLinkService({\n eventBus,\n externalLinkTarget: AppOptions.get(\"externalLinkTarget\"),\n externalLinkRel: AppOptions.get(\"externalLinkRel\"),\n ignoreDestinationZoom: AppOptions.get(\"ignoreDestinationZoom\"),\n });\n this.pdfLinkService = pdfLinkService;\n\n const downloadManager = this.externalServices.createDownloadManager();\n this.downloadManager = downloadManager;\n\n const findController = new PDFFindController({\n linkService: pdfLinkService,\n eventBus,\n });\n this.findController = findController;\n\n const pdfScriptingManager = new PDFScriptingManager({\n eventBus,\n sandboxBundleSrc:\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC || CHROME\")\n ? AppOptions.get(\"sandboxBundleSrc\")\n : null,\n scriptingFactory: this.externalServices,\n docPropertiesLookup: this._scriptingDocProperties.bind(this),\n });\n this.pdfScriptingManager = pdfScriptingManager;\n\n const container = appConfig.mainContainer;\n const viewer = appConfig.viewerContainer;\n this.pdfViewer = new PDFViewer({\n container,\n viewer,\n eventBus,\n renderingQueue: pdfRenderingQueue,\n linkService: pdfLinkService,\n downloadManager,\n findController,\n scriptingManager: pdfScriptingManager,\n renderer: AppOptions.get(\"renderer\"),\n l10n: this.l10n,\n textLayerMode: AppOptions.get(\"textLayerMode\"),\n imageResourcesPath: AppOptions.get(\"imageResourcesPath\"),\n renderInteractiveForms: AppOptions.get(\"renderInteractiveForms\"),\n enablePrintAutoRotate: AppOptions.get(\"enablePrintAutoRotate\"),\n useOnlyCssZoom: AppOptions.get(\"useOnlyCssZoom\"),\n maxCanvasPixels: AppOptions.get(\"maxCanvasPixels\"),\n enableScripting: AppOptions.get(\"enableScripting\"),\n });\n pdfRenderingQueue.setViewer(this.pdfViewer);\n pdfLinkService.setViewer(this.pdfViewer);\n pdfScriptingManager.setViewer(this.pdfViewer);\n\n this.pdfThumbnailViewer = new PDFThumbnailViewer({\n container: appConfig.sidebar.thumbnailView,\n eventBus,\n renderingQueue: pdfRenderingQueue,\n linkService: pdfLinkService,\n l10n: this.l10n,\n });\n pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);\n\n this.pdfHistory = new PDFHistory({\n linkService: pdfLinkService,\n eventBus,\n });\n pdfLinkService.setHistory(this.pdfHistory);\n\n if (!this.supportsIntegratedFind) {\n this.findBar = new PDFFindBar(appConfig.findBar, eventBus, this.l10n);\n }\n\n this.pdfDocumentProperties = new PDFDocumentProperties(\n appConfig.documentProperties,\n this.overlayManager,\n eventBus,\n this.l10n\n );\n\n this.pdfCursorTools = new PDFCursorTools({\n container,\n eventBus,\n cursorToolOnLoad: AppOptions.get(\"cursorToolOnLoad\"),\n });\n\n this.toolbar = new Toolbar(appConfig.toolbar, eventBus, this.l10n);\n\n this.secondaryToolbar = new SecondaryToolbar(\n appConfig.secondaryToolbar,\n container,\n eventBus\n );\n\n if (this.supportsFullscreen) {\n this.pdfPresentationMode = new PDFPresentationMode({\n container,\n pdfViewer: this.pdfViewer,\n eventBus,\n });\n }\n\n this.passwordPrompt = new PasswordPrompt(\n appConfig.passwordOverlay,\n this.overlayManager,\n this.l10n,\n this.isViewerEmbedded\n );\n\n this.pdfOutlineViewer = new PDFOutlineViewer({\n container: appConfig.sidebar.outlineView,\n eventBus,\n linkService: pdfLinkService,\n });\n\n this.pdfAttachmentViewer = new PDFAttachmentViewer({\n container: appConfig.sidebar.attachmentsView,\n eventBus,\n downloadManager,\n });\n\n this.pdfLayerViewer = new PDFLayerViewer({\n container: appConfig.sidebar.layersView,\n eventBus,\n l10n: this.l10n,\n });\n\n this.pdfSidebar = new PDFSidebar({\n elements: appConfig.sidebar,\n pdfViewer: this.pdfViewer,\n pdfThumbnailViewer: this.pdfThumbnailViewer,\n eventBus,\n l10n: this.l10n,\n });\n this.pdfSidebar.onToggled = this.forceRendering.bind(this);\n\n this.pdfSidebarResizer = new PDFSidebarResizer(\n appConfig.sidebarResizer,\n eventBus,\n this.l10n\n );\n },\n\n run(config) {\n this.initialize(config).then(webViewerInitialized);\n },\n\n get initialized() {\n return this._initializedCapability.settled;\n },\n\n get initializedPromise() {\n return this._initializedCapability.promise;\n },\n\n zoomIn(ticks) {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n let newScale = this.pdfViewer.currentScale;\n do {\n newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2);\n newScale = Math.ceil(newScale * 10) / 10;\n newScale = Math.min(MAX_SCALE, newScale);\n } while (--ticks > 0 && newScale < MAX_SCALE);\n this.pdfViewer.currentScaleValue = newScale;\n },\n\n zoomOut(ticks) {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n let newScale = this.pdfViewer.currentScale;\n do {\n newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2);\n newScale = Math.floor(newScale * 10) / 10;\n newScale = Math.max(MIN_SCALE, newScale);\n } while (--ticks > 0 && newScale > MIN_SCALE);\n this.pdfViewer.currentScaleValue = newScale;\n },\n\n zoomReset() {\n if (this.pdfViewer.isInPresentationMode) {\n return;\n }\n this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n },\n\n get pagesCount() {\n return this.pdfDocument ? this.pdfDocument.numPages : 0;\n },\n\n get page() {\n return this.pdfViewer.currentPageNumber;\n },\n\n set page(val) {\n this.pdfViewer.currentPageNumber = val;\n },\n\n get supportsPrinting() {\n return PDFPrintServiceFactory.instance.supportsPrinting;\n },\n\n get supportsFullscreen() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return shadow(this, \"supportsFullscreen\", document.fullscreenEnabled);\n }\n const doc = document.documentElement;\n let support = !!(\n doc.requestFullscreen ||\n doc.mozRequestFullScreen ||\n doc.webkitRequestFullScreen\n );\n\n if (\n document.fullscreenEnabled === false ||\n document.mozFullScreenEnabled === false ||\n document.webkitFullscreenEnabled === false\n ) {\n support = false;\n }\n return shadow(this, \"supportsFullscreen\", support);\n },\n\n get supportsIntegratedFind() {\n return this.externalServices.supportsIntegratedFind;\n },\n\n get supportsDocumentFonts() {\n return this.externalServices.supportsDocumentFonts;\n },\n\n get loadingBar() {\n const bar = new ProgressBar(\"#loadingBar\");\n return shadow(this, \"loadingBar\", bar);\n },\n\n get supportedMouseWheelZoomModifierKeys() {\n return this.externalServices.supportedMouseWheelZoomModifierKeys;\n },\n\n initPassiveLoading() {\n if (\n typeof PDFJSDev === \"undefined\" ||\n !PDFJSDev.test(\"MOZCENTRAL || CHROME\")\n ) {\n throw new Error(\"Not implemented: initPassiveLoading\");\n }\n this.externalServices.initPassiveLoading({\n onOpenWithTransport: (url, length, transport) => {\n this.open(url, { length, range: transport });\n },\n onOpenWithData: (data, contentDispositionFilename) => {\n if (isPdfFile(contentDispositionFilename)) {\n this._contentDispositionFilename = contentDispositionFilename;\n }\n this.open(data);\n },\n onOpenWithURL: (url, length, originalUrl) => {\n const file = originalUrl !== undefined ? { url, originalUrl } : url;\n const args = length !== undefined ? { length } : null;\n\n this.open(file, args);\n },\n onError: err => {\n this.l10n.get(\"loading_error\").then(msg => {\n this._documentError(msg, err);\n });\n },\n onProgress: (loaded, total) => {\n this.progress(loaded / total);\n },\n });\n },\n\n setTitleUsingUrl(url = \"\") {\n this.url = url;\n this.baseUrl = url.split(\"#\")[0];\n let title = getPdfFilenameFromUrl(url, \"\");\n if (!title) {\n try {\n title = decodeURIComponent(getFilenameFromUrl(url)) || url;\n } catch (ex) {\n // decodeURIComponent may throw URIError,\n // fall back to using the unprocessed url in that case\n title = url;\n }\n }\n this.setTitle(title);\n },\n\n setTitle(title) {\n if (this.isViewerEmbedded) {\n // Embedded PDF viewers should not be changing their parent page's title.\n return;\n }\n document.title = title;\n },\n\n get _docFilename() {\n // Use `this.url` instead of `this.baseUrl` to perform filename detection\n // based on the reference fragment as ultimate fallback if needed.\n return this._contentDispositionFilename || getPdfFilenameFromUrl(this.url);\n },\n\n /**\n * @private\n */\n _cancelIdleCallbacks() {\n if (!this._idleCallbacks.size) {\n return;\n }\n for (const callback of this._idleCallbacks) {\n window.cancelIdleCallback(callback);\n }\n this._idleCallbacks.clear();\n },\n\n /**\n * Closes opened PDF document.\n * @returns {Promise} - Returns the promise, which is resolved when all\n * destruction is completed.\n */\n async close() {\n this._unblockDocumentLoadEvent();\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n const { container } = this.appConfig.errorWrapper;\n container.hidden = true;\n }\n\n if (!this.pdfLoadingTask) {\n return;\n }\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.pdfDocument?.annotationStorage.size > 0 &&\n this._annotationStorageModified\n ) {\n try {\n // Trigger saving, to prevent data loss in forms; see issue 12257.\n await this.save({ sourceEventType: \"save\" });\n } catch (reason) {\n // Ignoring errors, to ensure that document closing won't break.\n }\n }\n const promises = [];\n\n promises.push(this.pdfLoadingTask.destroy());\n this.pdfLoadingTask = null;\n\n if (this.pdfDocument) {\n this.pdfDocument = null;\n\n this.pdfThumbnailViewer.setDocument(null);\n this.pdfViewer.setDocument(null);\n this.pdfLinkService.setDocument(null);\n this.pdfDocumentProperties.setDocument(null);\n }\n webViewerResetPermissions();\n this.pdfLinkService.externalLinkEnabled = true;\n this._fellback = false;\n this.store = null;\n this.isInitialViewSet = false;\n this.downloadComplete = false;\n this.url = \"\";\n this.baseUrl = \"\";\n this.documentInfo = null;\n this.metadata = null;\n this._contentDispositionFilename = null;\n this._contentLength = null;\n this._saveInProgress = false;\n\n this._cancelIdleCallbacks();\n promises.push(this.pdfScriptingManager.destroyPromise);\n\n this.pdfSidebar.reset();\n this.pdfOutlineViewer.reset();\n this.pdfAttachmentViewer.reset();\n this.pdfLayerViewer.reset();\n\n if (this.pdfHistory) {\n this.pdfHistory.reset();\n }\n if (this.findBar) {\n this.findBar.reset();\n }\n this.toolbar.reset();\n this.secondaryToolbar.reset();\n\n if (typeof PDFBug !== \"undefined\") {\n PDFBug.cleanup();\n }\n await Promise.all(promises);\n },\n\n /**\n * Opens PDF document specified by URL or array with additional arguments.\n * @param {string|TypedArray|ArrayBuffer} file - PDF location or binary data.\n * @param {Object} [args] - Additional arguments for the getDocument call,\n * e.g. HTTP headers ('httpHeaders') or alternative\n * data transport ('range').\n * @returns {Promise} - Returns the promise, which is resolved when document\n * is opened.\n */\n async open(file, args) {\n if (this.pdfLoadingTask) {\n // We need to destroy already opened document.\n await this.close();\n }\n // Set the necessary global worker parameters, using the available options.\n const workerParameters = AppOptions.getAll(OptionKind.WORKER);\n for (const key in workerParameters) {\n GlobalWorkerOptions[key] = workerParameters[key];\n }\n\n const parameters = Object.create(null);\n if (typeof file === \"string\") {\n // URL\n this.setTitleUsingUrl(file);\n parameters.url = file;\n } else if (file && \"byteLength\" in file) {\n // ArrayBuffer\n parameters.data = file;\n } else if (file.url && file.originalUrl) {\n this.setTitleUsingUrl(file.originalUrl);\n parameters.url = file.url;\n }\n // Set the necessary API parameters, using the available options.\n const apiParameters = AppOptions.getAll(OptionKind.API);\n for (const key in apiParameters) {\n let value = apiParameters[key];\n\n if (key === \"docBaseUrl\" && !value) {\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n value = document.URL.split(\"#\")[0];\n } else if (PDFJSDev.test(\"MOZCENTRAL || CHROME\")) {\n value = this.baseUrl;\n }\n }\n parameters[key] = value;\n }\n // Finally, update the API parameters with the arguments (if they exist).\n if (args) {\n for (const key in args) {\n parameters[key] = args[key];\n }\n }\n\n const loadingTask = getDocument(parameters);\n this.pdfLoadingTask = loadingTask;\n\n loadingTask.onPassword = (updateCallback, reason) => {\n this.pdfLinkService.externalLinkEnabled = false;\n this.passwordPrompt.setUpdateCallback(updateCallback, reason);\n this.passwordPrompt.open();\n };\n\n loadingTask.onProgress = ({ loaded, total }) => {\n this.progress(loaded / total);\n };\n\n // Listen for unsupported features to trigger the fallback UI.\n loadingTask.onUnsupportedFeature = this.fallback.bind(this);\n\n return loadingTask.promise.then(\n pdfDocument => {\n this.load(pdfDocument);\n },\n exception => {\n if (loadingTask !== this.pdfLoadingTask) {\n return undefined; // Ignore errors for previously opened PDF files.\n }\n\n let key = \"loading_error\";\n if (exception instanceof InvalidPDFException) {\n key = \"invalid_file_error\";\n } else if (exception instanceof MissingPDFException) {\n key = \"missing_file_error\";\n } else if (exception instanceof UnexpectedResponseException) {\n key = \"unexpected_response_error\";\n }\n return this.l10n.get(key).then(msg => {\n this._documentError(msg, { message: exception?.message });\n throw exception;\n });\n }\n );\n },\n\n /**\n * @private\n */\n _ensureDownloadComplete() {\n if (this.pdfDocument && this.downloadComplete) {\n return;\n }\n throw new Error(\"PDF document not downloaded.\");\n },\n\n async download({ sourceEventType = \"download\" } = {}) {\n const url = this.baseUrl,\n filename = this._docFilename;\n try {\n this._ensureDownloadComplete();\n\n const data = await this.pdfDocument.getData();\n const blob = new Blob([data], { type: \"application/pdf\" });\n\n await this.downloadManager.download(blob, url, filename, sourceEventType);\n } catch (reason) {\n // When the PDF document isn't ready, or the PDF file is still\n // downloading, simply download using the URL.\n await this.downloadManager.downloadUrl(url, filename);\n }\n },\n\n async save({ sourceEventType = \"download\" } = {}) {\n if (this._saveInProgress) {\n return;\n }\n this._saveInProgress = true;\n await this.pdfScriptingManager.dispatchWillSave();\n\n const url = this.baseUrl,\n filename = this._docFilename;\n try {\n this._ensureDownloadComplete();\n\n const data = await this.pdfDocument.saveDocument();\n const blob = new Blob([data], { type: \"application/pdf\" });\n\n await this.downloadManager.download(blob, url, filename, sourceEventType);\n } catch (reason) {\n // When the PDF document isn't ready, or the PDF file is still\n // downloading, simply fallback to a \"regular\" download.\n await this.download({ sourceEventType });\n } finally {\n await this.pdfScriptingManager.dispatchDidSave();\n this._saveInProgress = false;\n }\n },\n\n downloadOrSave(options) {\n if (this.pdfDocument?.annotationStorage.size > 0) {\n this.save(options);\n } else {\n this.download(options);\n }\n },\n\n fallback(featureId) {\n this.externalServices.reportTelemetry({\n type: \"unsupportedFeature\",\n featureId,\n });\n\n // Only trigger the fallback once so we don't spam the user with messages\n // for one PDF.\n if (this._fellback) {\n return;\n }\n this._fellback = true;\n\n this.externalServices\n .fallback({\n featureId,\n url: this.baseUrl,\n })\n .then(download => {\n if (!download) {\n return;\n }\n this.download({ sourceEventType: \"download\" });\n });\n },\n\n /**\n * Show the error box; used for errors affecting loading and/or parsing of\n * the entire PDF document.\n */\n _documentError(message, moreInfo = null) {\n this._unblockDocumentLoadEvent();\n\n this._otherError(message, moreInfo);\n },\n\n /**\n * Show the error box; used for errors affecting e.g. only a single page.\n *\n * @param {string} message - A message that is human readable.\n * @param {Object} [moreInfo] - Further information about the error that is\n * more technical. Should have a 'message' and\n * optionally a 'stack' property.\n */\n _otherError(message, moreInfo = null) {\n const moreInfoText = [\n this.l10n.get(\"error_version_info\", {\n version: version || \"?\",\n build: build || \"?\",\n }),\n ];\n if (moreInfo) {\n moreInfoText.push(\n this.l10n.get(\"error_message\", { message: moreInfo.message })\n );\n if (moreInfo.stack) {\n moreInfoText.push(\n this.l10n.get(\"error_stack\", { stack: moreInfo.stack })\n );\n } else {\n if (moreInfo.filename) {\n moreInfoText.push(\n this.l10n.get(\"error_file\", { file: moreInfo.filename })\n );\n }\n if (moreInfo.lineNumber) {\n moreInfoText.push(\n this.l10n.get(\"error_line\", { line: moreInfo.lineNumber })\n );\n }\n }\n }\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n const errorWrapperConfig = this.appConfig.errorWrapper;\n const errorWrapper = errorWrapperConfig.container;\n errorWrapper.hidden = false;\n\n const errorMessage = errorWrapperConfig.errorMessage;\n errorMessage.textContent = message;\n\n const closeButton = errorWrapperConfig.closeButton;\n closeButton.onclick = function () {\n errorWrapper.hidden = true;\n };\n\n const errorMoreInfo = errorWrapperConfig.errorMoreInfo;\n const moreInfoButton = errorWrapperConfig.moreInfoButton;\n const lessInfoButton = errorWrapperConfig.lessInfoButton;\n moreInfoButton.onclick = function () {\n errorMoreInfo.hidden = false;\n moreInfoButton.hidden = true;\n lessInfoButton.hidden = false;\n errorMoreInfo.style.height = errorMoreInfo.scrollHeight + \"px\";\n };\n lessInfoButton.onclick = function () {\n errorMoreInfo.hidden = true;\n moreInfoButton.hidden = false;\n lessInfoButton.hidden = true;\n };\n moreInfoButton.oncontextmenu = noContextMenuHandler;\n lessInfoButton.oncontextmenu = noContextMenuHandler;\n closeButton.oncontextmenu = noContextMenuHandler;\n moreInfoButton.hidden = false;\n lessInfoButton.hidden = true;\n Promise.all(moreInfoText).then(parts => {\n errorMoreInfo.value = parts.join(\"\\n\");\n });\n } else {\n Promise.all(moreInfoText).then(parts => {\n console.error(message + \"\\n\" + parts.join(\"\\n\"));\n });\n this.fallback();\n }\n },\n\n progress(level) {\n if (this.downloadComplete) {\n // Don't accidentally show the loading bar again when the entire file has\n // already been fetched (only an issue when disableAutoFetch is enabled).\n return;\n }\n const percent = Math.round(level * 100);\n // When we transition from full request to range requests, it's possible\n // that we discard some of the loaded data. This can cause the loading\n // bar to move backwards. So prevent this by only updating the bar if it\n // increases.\n if (percent > this.loadingBar.percent || isNaN(percent)) {\n this.loadingBar.percent = percent;\n\n // When disableAutoFetch is enabled, it's not uncommon for the entire file\n // to never be fetched (depends on e.g. the file structure). In this case\n // the loading bar will not be completely filled, nor will it be hidden.\n // To prevent displaying a partially filled loading bar permanently, we\n // hide it when no data has been loaded during a certain amount of time.\n const disableAutoFetch = this.pdfDocument\n ? this.pdfDocument.loadingParams.disableAutoFetch\n : AppOptions.get(\"disableAutoFetch\");\n\n if (disableAutoFetch && percent) {\n if (this.disableAutoFetchLoadingBarTimeout) {\n clearTimeout(this.disableAutoFetchLoadingBarTimeout);\n this.disableAutoFetchLoadingBarTimeout = null;\n }\n this.loadingBar.show();\n\n this.disableAutoFetchLoadingBarTimeout = setTimeout(() => {\n this.loadingBar.hide();\n this.disableAutoFetchLoadingBarTimeout = null;\n }, DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT);\n }\n }\n },\n\n load(pdfDocument) {\n this.pdfDocument = pdfDocument;\n\n pdfDocument.getDownloadInfo().then(({ length }) => {\n this._contentLength = length; // Ensure that the correct length is used.\n this.downloadComplete = true;\n this.loadingBar.hide();\n\n firstPagePromise.then(() => {\n this.eventBus.dispatch(\"documentloaded\", { source: this });\n });\n });\n\n // Since the `setInitialView` call below depends on this being resolved,\n // fetch it early to avoid delaying initial rendering of the PDF document.\n const pageLayoutPromise = pdfDocument.getPageLayout().catch(function () {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n const pageModePromise = pdfDocument.getPageMode().catch(function () {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n const openActionPromise = pdfDocument.getOpenAction().catch(function () {\n /* Avoid breaking initial rendering; ignoring errors. */\n });\n\n this.toolbar.setPagesCount(pdfDocument.numPages, false);\n this.secondaryToolbar.setPagesCount(pdfDocument.numPages);\n\n let baseDocumentUrl;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n baseDocumentUrl = null;\n } else if (PDFJSDev.test(\"MOZCENTRAL\")) {\n baseDocumentUrl = this.baseUrl;\n } else if (PDFJSDev.test(\"CHROME\")) {\n baseDocumentUrl = location.href.split(\"#\")[0];\n }\n this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl);\n this.pdfDocumentProperties.setDocument(pdfDocument, this.url);\n\n const pdfViewer = this.pdfViewer;\n pdfViewer.setDocument(pdfDocument);\n const { firstPagePromise, onePageRendered, pagesPromise } = pdfViewer;\n\n const pdfThumbnailViewer = this.pdfThumbnailViewer;\n pdfThumbnailViewer.setDocument(pdfDocument);\n\n const storedPromise = (this.store = new ViewHistory(\n pdfDocument.fingerprints[0]\n ))\n .getMultiple({\n page: null,\n zoom: DEFAULT_SCALE_VALUE,\n scrollLeft: \"0\",\n scrollTop: \"0\",\n rotation: null,\n sidebarView: SidebarView.UNKNOWN,\n scrollMode: ScrollMode.UNKNOWN,\n spreadMode: SpreadMode.UNKNOWN,\n })\n .catch(() => {\n /* Unable to read from storage; ignoring errors. */\n return Object.create(null);\n });\n\n firstPagePromise.then(pdfPage => {\n this.loadingBar.setWidth(this.appConfig.viewerContainer);\n this._initializeAnnotationStorageCallbacks(pdfDocument);\n\n Promise.all([\n animationStarted,\n storedPromise,\n pageLayoutPromise,\n pageModePromise,\n openActionPromise,\n ])\n .then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => {\n const viewOnLoad = AppOptions.get(\"viewOnLoad\");\n\n this._initializePdfHistory({\n fingerprint: pdfDocument.fingerprints[0],\n viewOnLoad,\n initialDest: openAction?.dest,\n });\n const initialBookmark = this.initialBookmark;\n\n // Initialize the default values, from user preferences.\n const zoom = AppOptions.get(\"defaultZoomValue\");\n let hash = zoom ? `zoom=${zoom}` : null;\n\n let rotation = null;\n let sidebarView = AppOptions.get(\"sidebarViewOnLoad\");\n let scrollMode = AppOptions.get(\"scrollModeOnLoad\");\n let spreadMode = AppOptions.get(\"spreadModeOnLoad\");\n\n if (stored.page && viewOnLoad !== ViewOnLoad.INITIAL) {\n hash =\n `page=${stored.page}&zoom=${zoom || stored.zoom},` +\n `${stored.scrollLeft},${stored.scrollTop}`;\n\n rotation = parseInt(stored.rotation, 10);\n // Always let user preference take precedence over the view history.\n if (sidebarView === SidebarView.UNKNOWN) {\n sidebarView = stored.sidebarView | 0;\n }\n if (scrollMode === ScrollMode.UNKNOWN) {\n scrollMode = stored.scrollMode | 0;\n }\n if (spreadMode === SpreadMode.UNKNOWN) {\n spreadMode = stored.spreadMode | 0;\n }\n }\n // Always let the user preference/view history take precedence.\n if (pageMode && sidebarView === SidebarView.UNKNOWN) {\n sidebarView = apiPageModeToSidebarView(pageMode);\n }\n if (pageLayout && spreadMode === SpreadMode.UNKNOWN) {\n spreadMode = apiPageLayoutToSpreadMode(pageLayout);\n }\n\n this.setInitialView(hash, {\n rotation,\n sidebarView,\n scrollMode,\n spreadMode,\n });\n this.eventBus.dispatch(\"documentinit\", { source: this });\n // Make all navigation keys work on document load,\n // unless the viewer is embedded in a web page.\n if (!this.isViewerEmbedded) {\n pdfViewer.focus();\n }\n\n // Currently only the \"copy\"-permission is supported, hence we delay\n // the `getPermissions` API call until *after* rendering has started.\n this._initializePermissions(pdfDocument);\n\n // For documents with different page sizes, once all pages are\n // resolved, ensure that the correct location becomes visible on load.\n // (To reduce the risk, in very large and/or slow loading documents,\n // that the location changes *after* the user has started interacting\n // with the viewer, wait for either `pagesPromise` or a timeout.)\n await Promise.race([\n pagesPromise,\n new Promise(resolve => {\n setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT);\n }),\n ]);\n if (!initialBookmark && !hash) {\n return;\n }\n if (pdfViewer.hasEqualPageSizes) {\n return;\n }\n this.initialBookmark = initialBookmark;\n\n // eslint-disable-next-line no-self-assign\n pdfViewer.currentScaleValue = pdfViewer.currentScaleValue;\n // Re-apply the initial document location.\n this.setInitialView(hash);\n })\n .catch(() => {\n // Ensure that the document is always completely initialized,\n // even if there are any errors thrown above.\n this.setInitialView();\n })\n .then(function () {\n // At this point, rendering of the initial page(s) should always have\n // started (and may even have completed).\n // To prevent any future issues, e.g. the document being completely\n // blank on load, always trigger rendering here.\n pdfViewer.update();\n });\n });\n\n pagesPromise.then(() => {\n this._unblockDocumentLoadEvent();\n\n this._initializeAutoPrint(pdfDocument, openActionPromise);\n });\n\n onePageRendered.then(() => {\n pdfDocument.getOutline().then(outline => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the outline resolved.\n }\n this.pdfOutlineViewer.render({ outline, pdfDocument });\n });\n pdfDocument.getAttachments().then(attachments => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the attachments resolved.\n }\n this.pdfAttachmentViewer.render({ attachments });\n });\n // Ensure that the layers accurately reflects the current state in the\n // viewer itself, rather than the default state provided by the API.\n pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the layers resolved.\n }\n this.pdfLayerViewer.render({ optionalContentConfig, pdfDocument });\n });\n if (\n (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n \"requestIdleCallback\" in window\n ) {\n const callback = window.requestIdleCallback(\n () => {\n this._collectTelemetry(pdfDocument);\n this._idleCallbacks.delete(callback);\n },\n { timeout: 1000 }\n );\n this._idleCallbacks.add(callback);\n }\n });\n\n this._initializePageLabels(pdfDocument);\n this._initializeMetadata(pdfDocument);\n },\n\n /**\n * @private\n */\n async _scriptingDocProperties(pdfDocument) {\n if (!this.documentInfo) {\n // It should be *extremely* rare for metadata to not have been resolved\n // when this code runs, but ensure that we handle that case here.\n await new Promise(resolve => {\n this.eventBus._on(\"metadataloaded\", resolve, { once: true });\n });\n if (pdfDocument !== this.pdfDocument) {\n return null; // The document was closed while the metadata resolved.\n }\n }\n if (!this._contentLength) {\n // Always waiting for the entire PDF document to be loaded will, most\n // likely, delay sandbox-creation too much in the general case for all\n // PDF documents which are not provided as binary data to the API.\n // Hence we'll simply have to trust that the `contentLength` (as provided\n // by the server), when it exists, is accurate enough here.\n await new Promise(resolve => {\n this.eventBus._on(\"documentloaded\", resolve, { once: true });\n });\n if (pdfDocument !== this.pdfDocument) {\n return null; // The document was closed while the downloadInfo resolved.\n }\n }\n\n return {\n ...this.documentInfo,\n baseURL: this.baseUrl,\n filesize: this._contentLength,\n filename: this._docFilename,\n metadata: this.metadata?.getRaw(),\n authors: this.metadata?.get(\"dc:creator\"),\n numPages: this.pagesCount,\n URL: this.url,\n };\n },\n\n /**\n * A place to fetch data for telemetry after one page is rendered and the\n * viewer is idle.\n * @private\n */\n async _collectTelemetry(pdfDocument) {\n const markInfo = await this.pdfDocument.getMarkInfo();\n if (pdfDocument !== this.pdfDocument) {\n return; // Document was closed while waiting for mark info.\n }\n const tagged = markInfo?.Marked || false;\n this.externalServices.reportTelemetry({\n type: \"tagged\",\n tagged,\n });\n },\n\n /**\n * @private\n */\n async _initializeAutoPrint(pdfDocument, openActionPromise) {\n const [openAction, javaScript] = await Promise.all([\n openActionPromise,\n !this.pdfViewer.enableScripting ? pdfDocument.getJavaScript() : null,\n ]);\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the auto print data resolved.\n }\n let triggerAutoPrint = false;\n\n if (openAction?.action === \"Print\") {\n triggerAutoPrint = true;\n }\n if (javaScript) {\n javaScript.some(js => {\n if (!js) {\n // Don't warn/fallback for empty JavaScript actions.\n return false;\n }\n console.warn(\"Warning: JavaScript support is not enabled\");\n this.fallback(UNSUPPORTED_FEATURES.javaScript);\n return true;\n });\n\n if (!triggerAutoPrint) {\n // Hack to support auto printing.\n for (const js of javaScript) {\n if (js && AutoPrintRegExp.test(js)) {\n triggerAutoPrint = true;\n break;\n }\n }\n }\n }\n\n if (triggerAutoPrint) {\n this.triggerPrinting();\n }\n },\n\n /**\n * @private\n */\n async _initializeMetadata(pdfDocument) {\n const { info, metadata, contentDispositionFilename, contentLength } =\n await pdfDocument.getMetadata();\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the metadata resolved.\n }\n this.documentInfo = info;\n this.metadata = metadata;\n this._contentDispositionFilename ??= contentDispositionFilename;\n this._contentLength ??= contentLength; // See `getDownloadInfo`-call above.\n\n // Provides some basic debug information\n console.log(\n `PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` +\n `${(info.Producer || \"-\").trim()} / ${(info.Creator || \"-\").trim()}] ` +\n `(PDF.js: ${version || \"-\"})`\n );\n\n let pdfTitle = info?.Title;\n\n const metadataTitle = metadata?.get(\"dc:title\");\n if (metadataTitle) {\n // Ghostscript can produce invalid 'dc:title' Metadata entries:\n // - The title may be \"Untitled\" (fixes bug 1031612).\n // - The title may contain incorrectly encoded characters, which thus\n // looks broken, hence we ignore the Metadata entry when it\n // contains characters from the Specials Unicode block\n // (fixes bug 1605526).\n if (\n metadataTitle !== \"Untitled\" &&\n !/[\\uFFF0-\\uFFFF]/g.test(metadataTitle)\n ) {\n pdfTitle = metadataTitle;\n }\n }\n if (pdfTitle) {\n this.setTitle(\n `${pdfTitle} - ${contentDispositionFilename || document.title}`\n );\n } else if (contentDispositionFilename) {\n this.setTitle(contentDispositionFilename);\n }\n\n if (\n info.IsXFAPresent &&\n !info.IsAcroFormPresent &&\n // Note: `isPureXfa === true` implies that `enableXfa = true` was set.\n !pdfDocument.isPureXfa\n ) {\n console.warn(\"Warning: XFA support is not enabled\");\n this.fallback(UNSUPPORTED_FEATURES.forms);\n } else if (\n (info.IsAcroFormPresent || info.IsXFAPresent) &&\n !this.pdfViewer.renderInteractiveForms\n ) {\n console.warn(\"Warning: Interactive form support is not enabled\");\n this.fallback(UNSUPPORTED_FEATURES.forms);\n }\n\n if (info.IsSignaturesPresent) {\n console.warn(\"Warning: Digital signatures validation is not supported\");\n this.fallback(UNSUPPORTED_FEATURES.signatures);\n }\n\n // Telemetry labels must be C++ variable friendly.\n let versionId = \"other\";\n if (KNOWN_VERSIONS.includes(info.PDFFormatVersion)) {\n versionId = `v${info.PDFFormatVersion.replace(\".\", \"_\")}`;\n }\n let generatorId = \"other\";\n if (info.Producer) {\n const producer = info.Producer.toLowerCase();\n KNOWN_GENERATORS.some(function (generator) {\n if (!producer.includes(generator)) {\n return false;\n }\n generatorId = generator.replace(/[ .-]/g, \"_\");\n return true;\n });\n }\n let formType = null;\n if (info.IsXFAPresent) {\n formType = \"xfa\";\n } else if (info.IsAcroFormPresent) {\n formType = \"acroform\";\n }\n this.externalServices.reportTelemetry({\n type: \"documentInfo\",\n version: versionId,\n generator: generatorId,\n formType,\n });\n\n this.eventBus.dispatch(\"metadataloaded\", { source: this });\n },\n\n /**\n * @private\n */\n async _initializePageLabels(pdfDocument) {\n const labels = await pdfDocument.getPageLabels();\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the page labels resolved.\n }\n if (!labels || AppOptions.get(\"disablePageLabels\")) {\n return;\n }\n const numLabels = labels.length;\n if (numLabels !== this.pagesCount) {\n console.error(\n \"The number of Page Labels does not match the number of pages in the document.\"\n );\n return;\n }\n let i = 0;\n // Ignore page labels that correspond to standard page numbering.\n while (i < numLabels && labels[i] === (i + 1).toString()) {\n i++;\n }\n if (i === numLabels) {\n return;\n }\n const { pdfViewer, pdfThumbnailViewer, toolbar } = this;\n\n pdfViewer.setPageLabels(labels);\n pdfThumbnailViewer.setPageLabels(labels);\n\n // Changing toolbar page display to use labels and we need to set\n // the label of the current page.\n toolbar.setPagesCount(numLabels, true);\n toolbar.setPageNumber(\n pdfViewer.currentPageNumber,\n pdfViewer.currentPageLabel\n );\n },\n\n /**\n * @private\n */\n _initializePdfHistory({ fingerprint, viewOnLoad, initialDest = null }) {\n if (this.isViewerEmbedded || AppOptions.get(\"disableHistory\")) {\n // The browsing history is only enabled when the viewer is standalone,\n // i.e. not when it is embedded in a web page.\n return;\n }\n this.pdfHistory.initialize({\n fingerprint,\n resetHistory: viewOnLoad === ViewOnLoad.INITIAL,\n updateUrl: AppOptions.get(\"historyUpdateUrl\"),\n });\n\n if (this.pdfHistory.initialBookmark) {\n this.initialBookmark = this.pdfHistory.initialBookmark;\n\n this.initialRotation = this.pdfHistory.initialRotation;\n }\n\n // Always let the browser history/document hash take precedence.\n if (\n initialDest &&\n !this.initialBookmark &&\n viewOnLoad === ViewOnLoad.UNKNOWN\n ) {\n this.initialBookmark = JSON.stringify(initialDest);\n // TODO: Re-factor the `PDFHistory` initialization to remove this hack\n // that's currently necessary to prevent weird initial history state.\n this.pdfHistory.push({ explicitDest: initialDest, pageNumber: null });\n }\n },\n\n /**\n * @private\n */\n async _initializePermissions(pdfDocument) {\n const permissions = await pdfDocument.getPermissions();\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the permissions resolved.\n }\n if (!permissions || !AppOptions.get(\"enablePermissions\")) {\n return;\n }\n // Currently only the \"copy\"-permission is supported.\n if (!permissions.includes(PermissionFlag.COPY)) {\n this.appConfig.viewerContainer.classList.add(ENABLE_PERMISSIONS_CLASS);\n }\n },\n\n /**\n * @private\n */\n _initializeAnnotationStorageCallbacks(pdfDocument) {\n if (pdfDocument !== this.pdfDocument) {\n return;\n }\n const { annotationStorage } = pdfDocument;\n\n annotationStorage.onSetModified = () => {\n window.addEventListener(\"beforeunload\", beforeUnload);\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this._annotationStorageModified = true;\n }\n };\n annotationStorage.onResetModified = () => {\n window.removeEventListener(\"beforeunload\", beforeUnload);\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n delete this._annotationStorageModified;\n }\n };\n },\n\n setInitialView(\n storedHash,\n { rotation, sidebarView, scrollMode, spreadMode } = {}\n ) {\n const setRotation = angle => {\n if (isValidRotation(angle)) {\n this.pdfViewer.pagesRotation = angle;\n }\n };\n const setViewerModes = (scroll, spread) => {\n if (isValidScrollMode(scroll)) {\n this.pdfViewer.scrollMode = scroll;\n }\n if (isValidSpreadMode(spread)) {\n this.pdfViewer.spreadMode = spread;\n }\n };\n this.isInitialViewSet = true;\n this.pdfSidebar.setInitialView(sidebarView);\n\n setViewerModes(scrollMode, spreadMode);\n\n if (this.initialBookmark) {\n setRotation(this.initialRotation);\n delete this.initialRotation;\n\n this.pdfLinkService.setHash(this.initialBookmark);\n this.initialBookmark = null;\n } else if (storedHash) {\n setRotation(rotation);\n\n this.pdfLinkService.setHash(storedHash);\n }\n\n // Ensure that the correct page number is displayed in the UI,\n // even if the active page didn't change during document load.\n this.toolbar.setPageNumber(\n this.pdfViewer.currentPageNumber,\n this.pdfViewer.currentPageLabel\n );\n this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber);\n\n if (!this.pdfViewer.currentScaleValue) {\n // Scale was not initialized: invalid bookmark or scale was not specified.\n // Setting the default one.\n this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n }\n },\n\n /**\n * @private\n */\n _cleanup() {\n if (!this.pdfDocument) {\n return; // run cleanup when document is loaded\n }\n this.pdfViewer.cleanup();\n this.pdfThumbnailViewer.cleanup();\n\n // We don't want to remove fonts used by active page SVGs.\n this.pdfDocument.cleanup(\n /* keepLoadedFonts = */ this.pdfViewer.renderer === RendererType.SVG\n );\n },\n\n forceRendering() {\n this.pdfRenderingQueue.printing = !!this.printService;\n this.pdfRenderingQueue.isThumbnailViewEnabled =\n this.pdfSidebar.isThumbnailViewVisible;\n this.pdfRenderingQueue.renderHighestPriority();\n },\n\n beforePrint() {\n // Given that the \"beforeprint\" browser event is synchronous, we\n // unfortunately cannot await the scripting event dispatching here.\n this.pdfScriptingManager.dispatchWillPrint();\n\n if (this.printService) {\n // There is no way to suppress beforePrint/afterPrint events,\n // but PDFPrintService may generate double events -- this will ignore\n // the second event that will be coming from native window.print().\n return;\n }\n\n if (!this.supportsPrinting) {\n this.l10n.get(\"printing_not_supported\").then(msg => {\n this._otherError(msg);\n });\n return;\n }\n\n // The beforePrint is a sync method and we need to know layout before\n // returning from this method. Ensure that we can get sizes of the pages.\n if (!this.pdfViewer.pageViewsReady) {\n this.l10n.get(\"printing_not_ready\").then(msg => {\n // eslint-disable-next-line no-alert\n window.alert(msg);\n });\n return;\n }\n\n const pagesOverview = this.pdfViewer.getPagesOverview();\n const printContainer = this.appConfig.printContainer;\n const printResolution = AppOptions.get(\"printResolution\");\n const optionalContentConfigPromise =\n this.pdfViewer.optionalContentConfigPromise;\n\n const printService = PDFPrintServiceFactory.instance.createPrintService(\n this.pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n optionalContentConfigPromise,\n this.l10n\n );\n this.printService = printService;\n this.forceRendering();\n\n printService.layout();\n\n this.externalServices.reportTelemetry({\n type: \"print\",\n });\n },\n\n afterPrint() {\n // Given that the \"afterprint\" browser event is synchronous, we\n // unfortunately cannot await the scripting event dispatching here.\n this.pdfScriptingManager.dispatchDidPrint();\n\n if (this.printService) {\n this.printService.destroy();\n this.printService = null;\n\n if (this.pdfDocument) {\n this.pdfDocument.annotationStorage.resetModified();\n }\n }\n this.forceRendering();\n },\n\n rotatePages(delta) {\n this.pdfViewer.pagesRotation += delta;\n // Note that the thumbnail viewer is updated, and rendering is triggered,\n // in the 'rotationchanging' event handler.\n },\n\n requestPresentationMode() {\n if (!this.pdfPresentationMode) {\n return;\n }\n this.pdfPresentationMode.request();\n },\n\n triggerPrinting() {\n if (!this.supportsPrinting) {\n return;\n }\n window.print();\n },\n\n bindEvents() {\n const { eventBus, _boundEvents } = this;\n\n _boundEvents.beforePrint = this.beforePrint.bind(this);\n _boundEvents.afterPrint = this.afterPrint.bind(this);\n\n eventBus._on(\"resize\", webViewerResize);\n eventBus._on(\"hashchange\", webViewerHashchange);\n eventBus._on(\"beforeprint\", _boundEvents.beforePrint);\n eventBus._on(\"afterprint\", _boundEvents.afterPrint);\n eventBus._on(\"pagerendered\", webViewerPageRendered);\n eventBus._on(\"updateviewarea\", webViewerUpdateViewarea);\n eventBus._on(\"pagechanging\", webViewerPageChanging);\n eventBus._on(\"scalechanging\", webViewerScaleChanging);\n eventBus._on(\"rotationchanging\", webViewerRotationChanging);\n eventBus._on(\"sidebarviewchanged\", webViewerSidebarViewChanged);\n eventBus._on(\"pagemode\", webViewerPageMode);\n eventBus._on(\"namedaction\", webViewerNamedAction);\n eventBus._on(\"presentationmodechanged\", webViewerPresentationModeChanged);\n eventBus._on(\"presentationmode\", webViewerPresentationMode);\n eventBus._on(\"print\", webViewerPrint);\n eventBus._on(\"download\", webViewerDownload);\n eventBus._on(\"save\", webViewerSave);\n eventBus._on(\"firstpage\", webViewerFirstPage);\n eventBus._on(\"lastpage\", webViewerLastPage);\n eventBus._on(\"nextpage\", webViewerNextPage);\n eventBus._on(\"previouspage\", webViewerPreviousPage);\n eventBus._on(\"zoomin\", webViewerZoomIn);\n eventBus._on(\"zoomout\", webViewerZoomOut);\n eventBus._on(\"zoomreset\", webViewerZoomReset);\n eventBus._on(\"pagenumberchanged\", webViewerPageNumberChanged);\n eventBus._on(\"scalechanged\", webViewerScaleChanged);\n eventBus._on(\"rotatecw\", webViewerRotateCw);\n eventBus._on(\"rotateccw\", webViewerRotateCcw);\n eventBus._on(\"optionalcontentconfig\", webViewerOptionalContentConfig);\n eventBus._on(\"switchscrollmode\", webViewerSwitchScrollMode);\n eventBus._on(\"scrollmodechanged\", webViewerScrollModeChanged);\n eventBus._on(\"switchspreadmode\", webViewerSwitchSpreadMode);\n eventBus._on(\"spreadmodechanged\", webViewerSpreadModeChanged);\n eventBus._on(\"documentproperties\", webViewerDocumentProperties);\n eventBus._on(\"find\", webViewerFind);\n eventBus._on(\"findfromurlhash\", webViewerFindFromUrlHash);\n eventBus._on(\"updatefindmatchescount\", webViewerUpdateFindMatchesCount);\n eventBus._on(\"updatefindcontrolstate\", webViewerUpdateFindControlState);\n\n if (AppOptions.get(\"pdfBug\")) {\n _boundEvents.reportPageStatsPDFBug = reportPageStatsPDFBug;\n\n eventBus._on(\"pagerendered\", _boundEvents.reportPageStatsPDFBug);\n eventBus._on(\"pagechanging\", _boundEvents.reportPageStatsPDFBug);\n }\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n eventBus._on(\"fileinputchange\", webViewerFileInputChange);\n eventBus._on(\"openfile\", webViewerOpenFile);\n }\n },\n\n bindWindowEvents() {\n const { eventBus, _boundEvents } = this;\n\n _boundEvents.windowResize = () => {\n eventBus.dispatch(\"resize\", { source: window });\n };\n _boundEvents.windowHashChange = () => {\n eventBus.dispatch(\"hashchange\", {\n source: window,\n hash: document.location.hash.substring(1),\n });\n };\n _boundEvents.windowBeforePrint = () => {\n eventBus.dispatch(\"beforeprint\", { source: window });\n };\n _boundEvents.windowAfterPrint = () => {\n eventBus.dispatch(\"afterprint\", { source: window });\n };\n _boundEvents.windowUpdateFromSandbox = event => {\n eventBus.dispatch(\"updatefromsandbox\", {\n source: window,\n detail: event.detail,\n });\n };\n\n window.addEventListener(\"visibilitychange\", webViewerVisibilityChange);\n window.addEventListener(\"wheel\", webViewerWheel, { passive: false });\n window.addEventListener(\"touchstart\", webViewerTouchStart, {\n passive: false,\n });\n window.addEventListener(\"click\", webViewerClick);\n window.addEventListener(\"keydown\", webViewerKeyDown);\n window.addEventListener(\"resize\", _boundEvents.windowResize);\n window.addEventListener(\"hashchange\", _boundEvents.windowHashChange);\n window.addEventListener(\"beforeprint\", _boundEvents.windowBeforePrint);\n window.addEventListener(\"afterprint\", _boundEvents.windowAfterPrint);\n window.addEventListener(\n \"updatefromsandbox\",\n _boundEvents.windowUpdateFromSandbox\n );\n },\n\n unbindEvents() {\n const { eventBus, _boundEvents } = this;\n\n eventBus._off(\"resize\", webViewerResize);\n eventBus._off(\"hashchange\", webViewerHashchange);\n eventBus._off(\"beforeprint\", _boundEvents.beforePrint);\n eventBus._off(\"afterprint\", _boundEvents.afterPrint);\n eventBus._off(\"pagerendered\", webViewerPageRendered);\n eventBus._off(\"updateviewarea\", webViewerUpdateViewarea);\n eventBus._off(\"pagechanging\", webViewerPageChanging);\n eventBus._off(\"scalechanging\", webViewerScaleChanging);\n eventBus._off(\"rotationchanging\", webViewerRotationChanging);\n eventBus._off(\"sidebarviewchanged\", webViewerSidebarViewChanged);\n eventBus._off(\"pagemode\", webViewerPageMode);\n eventBus._off(\"namedaction\", webViewerNamedAction);\n eventBus._off(\"presentationmodechanged\", webViewerPresentationModeChanged);\n eventBus._off(\"presentationmode\", webViewerPresentationMode);\n eventBus._off(\"print\", webViewerPrint);\n eventBus._off(\"download\", webViewerDownload);\n eventBus._off(\"save\", webViewerSave);\n eventBus._off(\"firstpage\", webViewerFirstPage);\n eventBus._off(\"lastpage\", webViewerLastPage);\n eventBus._off(\"nextpage\", webViewerNextPage);\n eventBus._off(\"previouspage\", webViewerPreviousPage);\n eventBus._off(\"zoomin\", webViewerZoomIn);\n eventBus._off(\"zoomout\", webViewerZoomOut);\n eventBus._off(\"zoomreset\", webViewerZoomReset);\n eventBus._off(\"pagenumberchanged\", webViewerPageNumberChanged);\n eventBus._off(\"scalechanged\", webViewerScaleChanged);\n eventBus._off(\"rotatecw\", webViewerRotateCw);\n eventBus._off(\"rotateccw\", webViewerRotateCcw);\n eventBus._off(\"optionalcontentconfig\", webViewerOptionalContentConfig);\n eventBus._off(\"switchscrollmode\", webViewerSwitchScrollMode);\n eventBus._off(\"scrollmodechanged\", webViewerScrollModeChanged);\n eventBus._off(\"switchspreadmode\", webViewerSwitchSpreadMode);\n eventBus._off(\"spreadmodechanged\", webViewerSpreadModeChanged);\n eventBus._off(\"documentproperties\", webViewerDocumentProperties);\n eventBus._off(\"find\", webViewerFind);\n eventBus._off(\"findfromurlhash\", webViewerFindFromUrlHash);\n eventBus._off(\"updatefindmatchescount\", webViewerUpdateFindMatchesCount);\n eventBus._off(\"updatefindcontrolstate\", webViewerUpdateFindControlState);\n\n if (_boundEvents.reportPageStatsPDFBug) {\n eventBus._off(\"pagerendered\", _boundEvents.reportPageStatsPDFBug);\n eventBus._off(\"pagechanging\", _boundEvents.reportPageStatsPDFBug);\n\n _boundEvents.reportPageStatsPDFBug = null;\n }\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n eventBus._off(\"fileinputchange\", webViewerFileInputChange);\n eventBus._off(\"openfile\", webViewerOpenFile);\n }\n\n _boundEvents.beforePrint = null;\n _boundEvents.afterPrint = null;\n },\n\n unbindWindowEvents() {\n const { _boundEvents } = this;\n\n window.removeEventListener(\"visibilitychange\", webViewerVisibilityChange);\n window.removeEventListener(\"wheel\", webViewerWheel, { passive: false });\n window.removeEventListener(\"touchstart\", webViewerTouchStart, {\n passive: false,\n });\n window.removeEventListener(\"click\", webViewerClick);\n window.removeEventListener(\"keydown\", webViewerKeyDown);\n window.removeEventListener(\"resize\", _boundEvents.windowResize);\n window.removeEventListener(\"hashchange\", _boundEvents.windowHashChange);\n window.removeEventListener(\"beforeprint\", _boundEvents.windowBeforePrint);\n window.removeEventListener(\"afterprint\", _boundEvents.windowAfterPrint);\n window.removeEventListener(\n \"updatefromsandbox\",\n _boundEvents.windowUpdateFromSandbox\n );\n\n _boundEvents.windowResize = null;\n _boundEvents.windowHashChange = null;\n _boundEvents.windowBeforePrint = null;\n _boundEvents.windowAfterPrint = null;\n _boundEvents.windowUpdateFromSandbox = null;\n },\n\n accumulateWheelTicks(ticks) {\n // If the scroll direction changed, reset the accumulated wheel ticks.\n if (\n (this._wheelUnusedTicks > 0 && ticks < 0) ||\n (this._wheelUnusedTicks < 0 && ticks > 0)\n ) {\n this._wheelUnusedTicks = 0;\n }\n this._wheelUnusedTicks += ticks;\n const wholeTicks =\n Math.sign(this._wheelUnusedTicks) *\n Math.floor(Math.abs(this._wheelUnusedTicks));\n this._wheelUnusedTicks -= wholeTicks;\n return wholeTicks;\n },\n\n /**\n * Should be called *after* all pages have loaded, or if an error occurred,\n * to unblock the \"load\" event; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553\n * @private\n */\n _unblockDocumentLoadEvent() {\n if (document.blockUnblockOnload) {\n document.blockUnblockOnload(false);\n }\n // Ensure that this method is only ever run once.\n this._unblockDocumentLoadEvent = () => {};\n },\n\n /**\n * Used together with the integration-tests, to enable awaiting full\n * initialization of the scripting/sandbox.\n */\n get scriptingReady() {\n return this.pdfScriptingManager.ready;\n },\n};\n\nlet validateFileURL;\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const HOSTED_VIEWER_ORIGINS = [\n \"null\",\n \"http://mozilla.github.io\",\n \"https://mozilla.github.io\",\n ];\n validateFileURL = function (file) {\n if (file === undefined) {\n return;\n }\n try {\n const viewerOrigin = new URL(window.location.href).origin || \"null\";\n if (HOSTED_VIEWER_ORIGINS.includes(viewerOrigin)) {\n // Hosted or local viewer, allow for any file locations\n return;\n }\n const { origin, protocol } = new URL(file, window.location.href);\n // Removing of the following line will not guarantee that the viewer will\n // start accepting URLs from foreign origin -- CORS headers on the remote\n // server must be properly configured.\n // IE10 / IE11 does not include an origin in `blob:`-URLs. So don't block\n // any blob:-URL. The browser's same-origin policy will block requests to\n // blob:-URLs from other origins, so this is safe.\n if (origin !== viewerOrigin && protocol !== \"blob:\") {\n throw new Error(\"file origin does not match viewer's\");\n }\n } catch (ex) {\n PDFViewerApplication.l10n.get(\"loading_error\").then(msg => {\n PDFViewerApplication._documentError(msg, { message: ex?.message });\n });\n throw ex;\n }\n };\n}\n\nasync function loadFakeWorker() {\n if (!GlobalWorkerOptions.workerSrc) {\n GlobalWorkerOptions.workerSrc = AppOptions.get(\"workerSrc\");\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n window.pdfjsWorker = await import(\"pdfjs/core/worker.js\");\n return undefined;\n }\n return loadScript(PDFWorker.getWorkerSrc());\n}\n\nfunction loadAndEnablePDFBug(enabledTabs) {\n const appConfig = PDFViewerApplication.appConfig;\n return loadScript(appConfig.debuggerScriptPath).then(function () {\n PDFBug.enable(enabledTabs);\n PDFBug.init({ OPS }, appConfig.mainContainer);\n });\n}\n\nfunction reportPageStatsPDFBug({ pageNumber }) {\n if (typeof Stats === \"undefined\" || !Stats.enabled) {\n return;\n }\n const pageView = PDFViewerApplication.pdfViewer.getPageView(\n /* index = */ pageNumber - 1\n );\n const pageStats = pageView?.pdfPage?.stats;\n if (!pageStats) {\n return;\n }\n Stats.add(pageNumber, pageStats);\n}\n\nfunction webViewerInitialized() {\n const appConfig = PDFViewerApplication.appConfig;\n let file;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const queryString = document.location.search.substring(1);\n const params = parseQueryString(queryString);\n file = \"file\" in params ? params.file : AppOptions.get(\"defaultUrl\");\n validateFileURL(file);\n } else if (PDFJSDev.test(\"MOZCENTRAL\")) {\n file = window.location.href;\n } else if (PDFJSDev.test(\"CHROME\")) {\n file = AppOptions.get(\"defaultUrl\");\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n const fileInput = document.createElement(\"input\");\n fileInput.id = appConfig.openFileInputName;\n fileInput.className = \"fileInput\";\n fileInput.setAttribute(\"type\", \"file\");\n fileInput.oncontextmenu = noContextMenuHandler;\n document.body.appendChild(fileInput);\n\n if (\n !window.File ||\n !window.FileReader ||\n !window.FileList ||\n !window.Blob\n ) {\n appConfig.toolbar.openFile.hidden = true;\n appConfig.secondaryToolbar.openFileButton.hidden = true;\n } else {\n fileInput.value = null;\n }\n\n fileInput.addEventListener(\"change\", function (evt) {\n const files = evt.target.files;\n if (!files || files.length === 0) {\n return;\n }\n PDFViewerApplication.eventBus.dispatch(\"fileinputchange\", {\n source: this,\n fileInput: evt.target,\n });\n });\n\n // Enable dragging-and-dropping a new PDF file onto the viewerContainer.\n appConfig.mainContainer.addEventListener(\"dragover\", function (evt) {\n evt.preventDefault();\n\n evt.dataTransfer.dropEffect = \"move\";\n });\n appConfig.mainContainer.addEventListener(\"drop\", function (evt) {\n evt.preventDefault();\n\n const files = evt.dataTransfer.files;\n if (!files || files.length === 0) {\n return;\n }\n PDFViewerApplication.eventBus.dispatch(\"fileinputchange\", {\n source: this,\n fileInput: evt.dataTransfer,\n });\n });\n } else {\n appConfig.toolbar.openFile.hidden = true;\n appConfig.secondaryToolbar.openFileButton.hidden = true;\n }\n\n if (!PDFViewerApplication.supportsDocumentFonts) {\n AppOptions.set(\"disableFontFace\", true);\n PDFViewerApplication.l10n.get(\"web_fonts_disabled\").then(msg => {\n console.warn(msg);\n });\n }\n\n if (!PDFViewerApplication.supportsPrinting) {\n appConfig.toolbar.print.classList.add(\"hidden\");\n appConfig.secondaryToolbar.printButton.classList.add(\"hidden\");\n }\n\n if (!PDFViewerApplication.supportsFullscreen) {\n appConfig.toolbar.presentationModeButton.classList.add(\"hidden\");\n appConfig.secondaryToolbar.presentationModeButton.classList.add(\"hidden\");\n }\n\n if (PDFViewerApplication.supportsIntegratedFind) {\n appConfig.toolbar.viewFind.classList.add(\"hidden\");\n }\n\n appConfig.mainContainer.addEventListener(\n \"transitionend\",\n function (evt) {\n if (evt.target === /* mainContainer */ this) {\n PDFViewerApplication.eventBus.dispatch(\"resize\", { source: this });\n }\n },\n true\n );\n\n try {\n webViewerOpenFileViaURL(file);\n } catch (reason) {\n PDFViewerApplication.l10n.get(\"loading_error\").then(msg => {\n PDFViewerApplication._documentError(msg, reason);\n });\n }\n}\n\nfunction webViewerOpenFileViaURL(file) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n if (file) {\n PDFViewerApplication.open(file);\n }\n } else if (PDFJSDev.test(\"MOZCENTRAL || CHROME\")) {\n PDFViewerApplication.setTitleUsingUrl(file);\n PDFViewerApplication.initPassiveLoading();\n } else {\n if (file) {\n throw new Error(\"Not implemented: webViewerOpenFileViaURL\");\n }\n }\n}\n\nfunction webViewerResetPermissions() {\n const { appConfig } = PDFViewerApplication;\n if (!appConfig) {\n return;\n }\n // Currently only the \"copy\"-permission is supported.\n appConfig.viewerContainer.classList.remove(ENABLE_PERMISSIONS_CLASS);\n}\n\nfunction webViewerPageRendered({ pageNumber, timestamp, error }) {\n // If the page is still visible when it has finished rendering,\n // ensure that the page number input loading indicator is hidden.\n if (pageNumber === PDFViewerApplication.page) {\n PDFViewerApplication.toolbar.updateLoadingIndicatorState(false);\n }\n\n // Use the rendered page to set the corresponding thumbnail image.\n if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) {\n const pageView = PDFViewerApplication.pdfViewer.getPageView(\n /* index = */ pageNumber - 1\n );\n const thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(\n /* index = */ pageNumber - 1\n );\n if (pageView && thumbnailView) {\n thumbnailView.setImage(pageView);\n }\n }\n\n if (error) {\n PDFViewerApplication.l10n.get(\"rendering_error\").then(msg => {\n PDFViewerApplication._otherError(msg, error);\n });\n }\n\n PDFViewerApplication.externalServices.reportTelemetry({\n type: \"pageInfo\",\n timestamp,\n });\n // It is a good time to report stream and font types.\n PDFViewerApplication.pdfDocument.getStats().then(function (stats) {\n PDFViewerApplication.externalServices.reportTelemetry({\n type: \"documentStats\",\n stats,\n });\n });\n}\n\nfunction webViewerPageMode({ mode }) {\n // Handle the 'pagemode' hash parameter, see also `PDFLinkService_setHash`.\n let view;\n switch (mode) {\n case \"thumbs\":\n view = SidebarView.THUMBS;\n break;\n case \"bookmarks\":\n case \"outline\": // non-standard\n view = SidebarView.OUTLINE;\n break;\n case \"attachments\": // non-standard\n view = SidebarView.ATTACHMENTS;\n break;\n case \"layers\": // non-standard\n view = SidebarView.LAYERS;\n break;\n case \"none\":\n view = SidebarView.NONE;\n break;\n default:\n console.error('Invalid \"pagemode\" hash parameter: ' + mode);\n return;\n }\n PDFViewerApplication.pdfSidebar.switchView(view, /* forceOpen = */ true);\n}\n\nfunction webViewerNamedAction(evt) {\n // Processing a couple of named actions that might be useful, see also\n // `PDFLinkService.executeNamedAction`.\n switch (evt.action) {\n case \"GoToPage\":\n PDFViewerApplication.appConfig.toolbar.pageNumber.select();\n break;\n\n case \"Find\":\n if (!PDFViewerApplication.supportsIntegratedFind) {\n PDFViewerApplication.findBar.toggle();\n }\n break;\n\n case \"Print\":\n PDFViewerApplication.triggerPrinting();\n break;\n\n case \"SaveAs\":\n webViewerSave();\n break;\n }\n}\n\nfunction webViewerPresentationModeChanged(evt) {\n PDFViewerApplication.pdfViewer.presentationModeState = evt.state;\n}\n\nfunction webViewerSidebarViewChanged(evt) {\n PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled =\n PDFViewerApplication.pdfSidebar.isThumbnailViewVisible;\n\n const store = PDFViewerApplication.store;\n if (store && PDFViewerApplication.isInitialViewSet) {\n // Only update the storage when the document has been loaded *and* rendered.\n store.set(\"sidebarView\", evt.view).catch(function () {});\n }\n}\n\nfunction webViewerUpdateViewarea(evt) {\n const location = evt.location,\n store = PDFViewerApplication.store;\n\n if (store && PDFViewerApplication.isInitialViewSet) {\n store\n .setMultiple({\n page: location.pageNumber,\n zoom: location.scale,\n scrollLeft: location.left,\n scrollTop: location.top,\n rotation: location.rotation,\n })\n .catch(function () {\n /* unable to write to storage */\n });\n }\n const href = PDFViewerApplication.pdfLinkService.getAnchorUrl(\n location.pdfOpenParams\n );\n PDFViewerApplication.appConfig.toolbar.viewBookmark.href = href;\n PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href =\n href;\n\n // Show/hide the loading indicator in the page number input element.\n const currentPage = PDFViewerApplication.pdfViewer.getPageView(\n /* index = */ PDFViewerApplication.page - 1\n );\n const loading = currentPage?.renderingState !== RenderingStates.FINISHED;\n PDFViewerApplication.toolbar.updateLoadingIndicatorState(loading);\n}\n\nfunction webViewerScrollModeChanged(evt) {\n const store = PDFViewerApplication.store;\n if (store && PDFViewerApplication.isInitialViewSet) {\n // Only update the storage when the document has been loaded *and* rendered.\n store.set(\"scrollMode\", evt.mode).catch(function () {});\n }\n}\n\nfunction webViewerSpreadModeChanged(evt) {\n const store = PDFViewerApplication.store;\n if (store && PDFViewerApplication.isInitialViewSet) {\n // Only update the storage when the document has been loaded *and* rendered.\n store.set(\"spreadMode\", evt.mode).catch(function () {});\n }\n}\n\nfunction webViewerResize() {\n const { pdfDocument, pdfViewer } = PDFViewerApplication;\n if (!pdfDocument) {\n return;\n }\n const currentScaleValue = pdfViewer.currentScaleValue;\n if (\n currentScaleValue === \"auto\" ||\n currentScaleValue === \"page-fit\" ||\n currentScaleValue === \"page-width\"\n ) {\n // Note: the scale is constant for 'page-actual'.\n pdfViewer.currentScaleValue = currentScaleValue;\n }\n pdfViewer.update();\n}\n\nfunction webViewerHashchange(evt) {\n const hash = evt.hash;\n if (!hash) {\n return;\n }\n if (!PDFViewerApplication.isInitialViewSet) {\n PDFViewerApplication.initialBookmark = hash;\n } else if (!PDFViewerApplication.pdfHistory.popStateInProgress) {\n PDFViewerApplication.pdfLinkService.setHash(hash);\n }\n}\n\nlet webViewerFileInputChange, webViewerOpenFile;\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n webViewerFileInputChange = function (evt) {\n if (PDFViewerApplication.pdfViewer?.isInPresentationMode) {\n return; // Opening a new PDF file isn't supported in Presentation Mode.\n }\n const file = evt.fileInput.files[0];\n\n if (!viewerCompatibilityParams.disableCreateObjectURL) {\n let url = URL.createObjectURL(file);\n if (file.name) {\n url = { url, originalUrl: file.name };\n }\n PDFViewerApplication.open(url);\n } else {\n PDFViewerApplication.setTitleUsingUrl(file.name);\n // Read the local file into a Uint8Array.\n const fileReader = new FileReader();\n fileReader.onload = function webViewerChangeFileReaderOnload(event) {\n const buffer = event.target.result;\n PDFViewerApplication.open(new Uint8Array(buffer));\n };\n fileReader.readAsArrayBuffer(file);\n }\n\n // URL does not reflect proper document location - hiding some icons.\n const appConfig = PDFViewerApplication.appConfig;\n appConfig.toolbar.viewBookmark.hidden = true;\n appConfig.secondaryToolbar.viewBookmarkButton.hidden = true;\n appConfig.toolbar.download.hidden = true;\n appConfig.secondaryToolbar.downloadButton.hidden = true;\n };\n\n webViewerOpenFile = function (evt) {\n const openFileInputName = PDFViewerApplication.appConfig.openFileInputName;\n document.getElementById(openFileInputName).click();\n };\n}\n\nfunction webViewerPresentationMode() {\n PDFViewerApplication.requestPresentationMode();\n}\nfunction webViewerPrint() {\n PDFViewerApplication.triggerPrinting();\n}\nfunction webViewerDownload() {\n PDFViewerApplication.downloadOrSave({ sourceEventType: \"download\" });\n}\nfunction webViewerSave() {\n PDFViewerApplication.downloadOrSave({ sourceEventType: \"save\" });\n}\nfunction webViewerFirstPage() {\n if (PDFViewerApplication.pdfDocument) {\n PDFViewerApplication.page = 1;\n }\n}\nfunction webViewerLastPage() {\n if (PDFViewerApplication.pdfDocument) {\n PDFViewerApplication.page = PDFViewerApplication.pagesCount;\n }\n}\nfunction webViewerNextPage() {\n PDFViewerApplication.pdfViewer.nextPage();\n}\nfunction webViewerPreviousPage() {\n PDFViewerApplication.pdfViewer.previousPage();\n}\nfunction webViewerZoomIn() {\n PDFViewerApplication.zoomIn();\n}\nfunction webViewerZoomOut() {\n PDFViewerApplication.zoomOut();\n}\nfunction webViewerZoomReset() {\n PDFViewerApplication.zoomReset();\n}\nfunction webViewerPageNumberChanged(evt) {\n const pdfViewer = PDFViewerApplication.pdfViewer;\n // Note that for `<input type=\"number\">` HTML elements, an empty string will\n // be returned for non-number inputs; hence we simply do nothing in that case.\n if (evt.value !== \"\") {\n PDFViewerApplication.pdfLinkService.goToPage(evt.value);\n }\n\n // Ensure that the page number input displays the correct value, even if the\n // value entered by the user was invalid (e.g. a floating point number).\n if (\n evt.value !== pdfViewer.currentPageNumber.toString() &&\n evt.value !== pdfViewer.currentPageLabel\n ) {\n PDFViewerApplication.toolbar.setPageNumber(\n pdfViewer.currentPageNumber,\n pdfViewer.currentPageLabel\n );\n }\n}\nfunction webViewerScaleChanged(evt) {\n PDFViewerApplication.pdfViewer.currentScaleValue = evt.value;\n}\nfunction webViewerRotateCw() {\n PDFViewerApplication.rotatePages(90);\n}\nfunction webViewerRotateCcw() {\n PDFViewerApplication.rotatePages(-90);\n}\nfunction webViewerOptionalContentConfig(evt) {\n PDFViewerApplication.pdfViewer.optionalContentConfigPromise = evt.promise;\n}\nfunction webViewerSwitchScrollMode(evt) {\n PDFViewerApplication.pdfViewer.scrollMode = evt.mode;\n}\nfunction webViewerSwitchSpreadMode(evt) {\n PDFViewerApplication.pdfViewer.spreadMode = evt.mode;\n}\nfunction webViewerDocumentProperties() {\n PDFViewerApplication.pdfDocumentProperties.open();\n}\n\nfunction webViewerFind(evt) {\n PDFViewerApplication.findController.executeCommand(\"find\" + evt.type, {\n query: evt.query,\n phraseSearch: evt.phraseSearch,\n caseSensitive: evt.caseSensitive,\n entireWord: evt.entireWord,\n highlightAll: evt.highlightAll,\n findPrevious: evt.findPrevious,\n });\n}\n\nfunction webViewerFindFromUrlHash(evt) {\n PDFViewerApplication.findController.executeCommand(\"find\", {\n query: evt.query,\n phraseSearch: evt.phraseSearch,\n caseSensitive: false,\n entireWord: false,\n highlightAll: true,\n findPrevious: false,\n });\n}\n\nfunction webViewerUpdateFindMatchesCount({ matchesCount }) {\n if (PDFViewerApplication.supportsIntegratedFind) {\n PDFViewerApplication.externalServices.updateFindMatchesCount(matchesCount);\n } else {\n PDFViewerApplication.findBar.updateResultsCount(matchesCount);\n }\n}\n\nfunction webViewerUpdateFindControlState({\n state,\n previous,\n matchesCount,\n rawQuery,\n}) {\n if (PDFViewerApplication.supportsIntegratedFind) {\n PDFViewerApplication.externalServices.updateFindControlState({\n result: state,\n findPrevious: previous,\n matchesCount,\n rawQuery,\n });\n } else {\n PDFViewerApplication.findBar.updateUIState(state, previous, matchesCount);\n }\n}\n\nfunction webViewerScaleChanging(evt) {\n PDFViewerApplication.toolbar.setPageScale(evt.presetValue, evt.scale);\n\n PDFViewerApplication.pdfViewer.update();\n}\n\nfunction webViewerRotationChanging(evt) {\n PDFViewerApplication.pdfThumbnailViewer.pagesRotation = evt.pagesRotation;\n\n PDFViewerApplication.forceRendering();\n // Ensure that the active page doesn't change during rotation.\n PDFViewerApplication.pdfViewer.currentPageNumber = evt.pageNumber;\n}\n\nfunction webViewerPageChanging({ pageNumber, pageLabel }) {\n PDFViewerApplication.toolbar.setPageNumber(pageNumber, pageLabel);\n PDFViewerApplication.secondaryToolbar.setPageNumber(pageNumber);\n\n if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) {\n PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(pageNumber);\n }\n}\n\nfunction webViewerVisibilityChange(evt) {\n if (document.visibilityState === \"visible\") {\n // Ignore mouse wheel zooming during tab switches (bug 1503412).\n setZoomDisabledTimeout();\n }\n}\n\nlet zoomDisabledTimeout = null;\nfunction setZoomDisabledTimeout() {\n if (zoomDisabledTimeout) {\n clearTimeout(zoomDisabledTimeout);\n }\n zoomDisabledTimeout = setTimeout(function () {\n zoomDisabledTimeout = null;\n }, WHEEL_ZOOM_DISABLED_TIMEOUT);\n}\n\nfunction webViewerWheel(evt) {\n const { pdfViewer, supportedMouseWheelZoomModifierKeys } =\n PDFViewerApplication;\n\n if (pdfViewer.isInPresentationMode) {\n return;\n }\n\n if (\n (evt.ctrlKey && supportedMouseWheelZoomModifierKeys.ctrlKey) ||\n (evt.metaKey && supportedMouseWheelZoomModifierKeys.metaKey)\n ) {\n // Only zoom the pages, not the entire viewer.\n evt.preventDefault();\n // NOTE: this check must be placed *after* preventDefault.\n if (zoomDisabledTimeout || document.visibilityState === \"hidden\") {\n return;\n }\n\n const previousScale = pdfViewer.currentScale;\n\n const delta = normalizeWheelEventDirection(evt);\n let ticks = 0;\n if (\n evt.deltaMode === WheelEvent.DOM_DELTA_LINE ||\n evt.deltaMode === WheelEvent.DOM_DELTA_PAGE\n ) {\n // For line-based devices, use one tick per event, because different\n // OSs have different defaults for the number lines. But we generally\n // want one \"clicky\" roll of the wheel (which produces one event) to\n // adjust the zoom by one step.\n if (Math.abs(delta) >= 1) {\n ticks = Math.sign(delta);\n } else {\n // If we're getting fractional lines (I can't think of a scenario\n // this might actually happen), be safe and use the accumulator.\n ticks = PDFViewerApplication.accumulateWheelTicks(delta);\n }\n } else {\n // pixel-based devices\n const PIXELS_PER_LINE_SCALE = 30;\n ticks = PDFViewerApplication.accumulateWheelTicks(\n delta / PIXELS_PER_LINE_SCALE\n );\n }\n\n if (ticks < 0) {\n PDFViewerApplication.zoomOut(-ticks);\n } else if (ticks > 0) {\n PDFViewerApplication.zoomIn(ticks);\n }\n\n const currentScale = pdfViewer.currentScale;\n if (previousScale !== currentScale) {\n // After scaling the page via zoomIn/zoomOut, the position of the upper-\n // left corner is restored. When the mouse wheel is used, the position\n // under the cursor should be restored instead.\n const scaleCorrectionFactor = currentScale / previousScale - 1;\n const rect = pdfViewer.container.getBoundingClientRect();\n const dx = evt.clientX - rect.left;\n const dy = evt.clientY - rect.top;\n pdfViewer.container.scrollLeft += dx * scaleCorrectionFactor;\n pdfViewer.container.scrollTop += dy * scaleCorrectionFactor;\n }\n } else {\n setZoomDisabledTimeout();\n }\n}\n\nfunction webViewerTouchStart(evt) {\n if (evt.touches.length > 1) {\n // Disable touch-based zooming, because the entire UI bits gets zoomed and\n // that doesn't look great. If we do want to have a good touch-based\n // zooming experience, we need to implement smooth zoom capability (probably\n // using a CSS transform for faster visual response, followed by async\n // re-rendering at the final zoom level) and do gesture detection on the\n // touchmove events to drive it. Or if we want to settle for a less good\n // experience we can make the touchmove events drive the existing step-zoom\n // behaviour that the ctrl+mousewheel path takes.\n evt.preventDefault();\n }\n}\n\nfunction webViewerClick(evt) {\n if (!PDFViewerApplication.secondaryToolbar.isOpen) {\n return;\n }\n const appConfig = PDFViewerApplication.appConfig;\n if (\n PDFViewerApplication.pdfViewer.containsElement(evt.target) ||\n (appConfig.toolbar.container.contains(evt.target) &&\n evt.target !== appConfig.secondaryToolbar.toggleButton)\n ) {\n PDFViewerApplication.secondaryToolbar.close();\n }\n}\n\nfunction webViewerKeyDown(evt) {\n if (PDFViewerApplication.overlayManager.active) {\n return;\n }\n\n let handled = false,\n ensureViewerFocused = false;\n const cmd =\n (evt.ctrlKey ? 1 : 0) |\n (evt.altKey ? 2 : 0) |\n (evt.shiftKey ? 4 : 0) |\n (evt.metaKey ? 8 : 0);\n\n const pdfViewer = PDFViewerApplication.pdfViewer;\n const isViewerInPresentationMode = pdfViewer?.isInPresentationMode;\n\n // First, handle the key bindings that are independent whether an input\n // control is selected or not.\n if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {\n // either CTRL or META key with optional SHIFT.\n switch (evt.keyCode) {\n case 70: // f\n if (!PDFViewerApplication.supportsIntegratedFind && !evt.shiftKey) {\n PDFViewerApplication.findBar.open();\n handled = true;\n }\n break;\n case 71: // g\n if (!PDFViewerApplication.supportsIntegratedFind) {\n const findState = PDFViewerApplication.findController.state;\n if (findState) {\n PDFViewerApplication.findController.executeCommand(\"findagain\", {\n query: findState.query,\n phraseSearch: findState.phraseSearch,\n caseSensitive: findState.caseSensitive,\n entireWord: findState.entireWord,\n highlightAll: findState.highlightAll,\n findPrevious: cmd === 5 || cmd === 12,\n });\n }\n handled = true;\n }\n break;\n case 61: // FF/Mac '='\n case 107: // FF '+' and '='\n case 187: // Chrome '+'\n case 171: // FF with German keyboard\n if (!isViewerInPresentationMode) {\n PDFViewerApplication.zoomIn();\n }\n handled = true;\n break;\n case 173: // FF/Mac '-'\n case 109: // FF '-'\n case 189: // Chrome '-'\n if (!isViewerInPresentationMode) {\n PDFViewerApplication.zoomOut();\n }\n handled = true;\n break;\n case 48: // '0'\n case 96: // '0' on Numpad of Swedish keyboard\n if (!isViewerInPresentationMode) {\n // keeping it unhandled (to restore page zoom to 100%)\n setTimeout(function () {\n // ... and resetting the scale after browser adjusts its scale\n PDFViewerApplication.zoomReset();\n });\n handled = false;\n }\n break;\n\n case 38: // up arrow\n if (isViewerInPresentationMode || PDFViewerApplication.page > 1) {\n PDFViewerApplication.page = 1;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 40: // down arrow\n if (\n isViewerInPresentationMode ||\n PDFViewerApplication.page < PDFViewerApplication.pagesCount\n ) {\n PDFViewerApplication.page = PDFViewerApplication.pagesCount;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n }\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC || CHROME\")) {\n const { eventBus } = PDFViewerApplication;\n\n // CTRL or META without shift\n if (cmd === 1 || cmd === 8) {\n switch (evt.keyCode) {\n case 83: // s\n eventBus.dispatch(\"download\", { source: window });\n handled = true;\n break;\n\n case 79: // o\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n eventBus.dispatch(\"openfile\", { source: window });\n handled = true;\n }\n break;\n }\n }\n }\n\n // CTRL+ALT or Option+Command\n if (cmd === 3 || cmd === 10) {\n switch (evt.keyCode) {\n case 80: // p\n PDFViewerApplication.requestPresentationMode();\n handled = true;\n break;\n case 71: // g\n // focuses input#pageNumber field\n PDFViewerApplication.appConfig.toolbar.pageNumber.select();\n handled = true;\n break;\n }\n }\n\n if (handled) {\n if (ensureViewerFocused && !isViewerInPresentationMode) {\n pdfViewer.focus();\n }\n evt.preventDefault();\n return;\n }\n\n // Some shortcuts should not get handled if a control/input element\n // is selected.\n const curElement = getActiveOrFocusedElement();\n const curElementTagName = curElement?.tagName.toUpperCase();\n if (\n curElementTagName === \"INPUT\" ||\n curElementTagName === \"TEXTAREA\" ||\n curElementTagName === \"SELECT\" ||\n curElement?.isContentEditable\n ) {\n // Make sure that the secondary toolbar is closed when Escape is pressed.\n if (evt.keyCode !== /* Esc = */ 27) {\n return;\n }\n }\n\n // No control key pressed at all.\n if (cmd === 0) {\n let turnPage = 0,\n turnOnlyIfPageFit = false;\n switch (evt.keyCode) {\n case 38: // up arrow\n case 33: // pg up\n // vertical scrolling using arrow/pg keys\n if (pdfViewer.isVerticalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n turnPage = -1;\n break;\n case 8: // backspace\n if (!isViewerInPresentationMode) {\n turnOnlyIfPageFit = true;\n }\n turnPage = -1;\n break;\n case 37: // left arrow\n // horizontal scrolling using arrow keys\n if (pdfViewer.isHorizontalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n /* falls through */\n case 75: // 'k'\n case 80: // 'p'\n turnPage = -1;\n break;\n case 27: // esc key\n if (PDFViewerApplication.secondaryToolbar.isOpen) {\n PDFViewerApplication.secondaryToolbar.close();\n handled = true;\n }\n if (\n !PDFViewerApplication.supportsIntegratedFind &&\n PDFViewerApplication.findBar.opened\n ) {\n PDFViewerApplication.findBar.close();\n handled = true;\n }\n break;\n case 40: // down arrow\n case 34: // pg down\n // vertical scrolling using arrow/pg keys\n if (pdfViewer.isVerticalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n turnPage = 1;\n break;\n case 13: // enter key\n case 32: // spacebar\n if (!isViewerInPresentationMode) {\n turnOnlyIfPageFit = true;\n }\n turnPage = 1;\n break;\n case 39: // right arrow\n // horizontal scrolling using arrow keys\n if (pdfViewer.isHorizontalScrollbarEnabled) {\n turnOnlyIfPageFit = true;\n }\n /* falls through */\n case 74: // 'j'\n case 78: // 'n'\n turnPage = 1;\n break;\n\n case 36: // home\n if (isViewerInPresentationMode || PDFViewerApplication.page > 1) {\n PDFViewerApplication.page = 1;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n case 35: // end\n if (\n isViewerInPresentationMode ||\n PDFViewerApplication.page < PDFViewerApplication.pagesCount\n ) {\n PDFViewerApplication.page = PDFViewerApplication.pagesCount;\n handled = true;\n ensureViewerFocused = true;\n }\n break;\n\n case 83: // 's'\n PDFViewerApplication.pdfCursorTools.switchTool(CursorTool.SELECT);\n break;\n case 72: // 'h'\n PDFViewerApplication.pdfCursorTools.switchTool(CursorTool.HAND);\n break;\n\n case 82: // 'r'\n PDFViewerApplication.rotatePages(90);\n break;\n\n case 115: // F4\n PDFViewerApplication.pdfSidebar.toggle();\n break;\n }\n\n if (\n turnPage !== 0 &&\n (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === \"page-fit\")\n ) {\n if (turnPage > 0) {\n pdfViewer.nextPage();\n } else {\n pdfViewer.previousPage();\n }\n handled = true;\n }\n }\n\n // shift-key\n if (cmd === 4) {\n switch (evt.keyCode) {\n case 13: // enter key\n case 32: // spacebar\n if (\n !isViewerInPresentationMode &&\n pdfViewer.currentScaleValue !== \"page-fit\"\n ) {\n break;\n }\n if (PDFViewerApplication.page > 1) {\n PDFViewerApplication.page--;\n }\n handled = true;\n break;\n\n case 82: // 'r'\n PDFViewerApplication.rotatePages(-90);\n break;\n }\n }\n\n if (!handled && !isViewerInPresentationMode) {\n // 33=Page Up 34=Page Down 35=End 36=Home\n // 37=Left 38=Up 39=Right 40=Down\n // 32=Spacebar\n if (\n (evt.keyCode >= 33 && evt.keyCode <= 40) ||\n (evt.keyCode === 32 && curElementTagName !== \"BUTTON\")\n ) {\n ensureViewerFocused = true;\n }\n }\n\n if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) {\n // The page container is not focused, but a page navigation key has been\n // pressed. Change the focus to the viewer container to make sure that\n // navigation by keyboard works as expected.\n pdfViewer.focus();\n }\n\n if (handled) {\n evt.preventDefault();\n }\n}\n\nfunction beforeUnload(evt) {\n evt.preventDefault();\n evt.returnValue = \"\";\n return false;\n}\n\n/* Abstract factory for the print service. */\nconst PDFPrintServiceFactory = {\n instance: {\n supportsPrinting: false,\n createPrintService() {\n throw new Error(\"Not implemented: createPrintService\");\n },\n },\n};\n\nexport {\n DefaultExternalServices,\n PDFPrintServiceFactory,\n PDFViewerApplication,\n};\n","module.exports = require(\"regenerator-runtime\");\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\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\nconst CSS_UNITS = 96.0 / 72.0;\nconst DEFAULT_SCALE_VALUE = \"auto\";\nconst DEFAULT_SCALE = 1.0;\nconst MIN_SCALE = 0.1;\nconst MAX_SCALE = 10.0;\nconst UNKNOWN_SCALE = 0;\nconst MAX_AUTO_SCALE = 1.25;\nconst SCROLLBAR_PADDING = 40;\nconst VERTICAL_PADDING = 5;\n\nconst LOADINGBAR_END_OFFSET_VAR = \"--loadingBar-end-offset\";\n\nconst PresentationModeState = {\n UNKNOWN: 0,\n NORMAL: 1,\n CHANGING: 2,\n FULLSCREEN: 3,\n};\n\nconst SidebarView = {\n UNKNOWN: -1,\n NONE: 0,\n THUMBS: 1, // Default value.\n OUTLINE: 2,\n ATTACHMENTS: 3,\n LAYERS: 4,\n};\n\nconst RendererType = {\n CANVAS: \"canvas\",\n SVG: \"svg\",\n};\n\nconst TextLayerMode = {\n DISABLE: 0,\n ENABLE: 1,\n ENABLE_ENHANCE: 2,\n};\n\nconst ScrollMode = {\n UNKNOWN: -1,\n VERTICAL: 0, // Default value.\n HORIZONTAL: 1,\n WRAPPED: 2,\n};\n\nconst SpreadMode = {\n UNKNOWN: -1,\n NONE: 0, // Default value.\n ODD: 1,\n EVEN: 2,\n};\n\n// Used by `PDFViewerApplication`, and by the API unit-tests.\nconst AutoPrintRegExp = /\\bprint\\s*\\(/;\n\n/**\n * Returns scale factor for the canvas. It makes sense for the HiDPI displays.\n * @returns {Object} The object with horizontal (sx) and vertical (sy)\n * scales. The scaled property is set to false if scaling is\n * not required, true otherwise.\n */\nfunction getOutputScale(ctx) {\n const devicePixelRatio = window.devicePixelRatio || 1;\n const backingStoreRatio =\n ctx.webkitBackingStorePixelRatio ||\n ctx.mozBackingStorePixelRatio ||\n ctx.backingStorePixelRatio ||\n 1;\n const pixelRatio = devicePixelRatio / backingStoreRatio;\n return {\n sx: pixelRatio,\n sy: pixelRatio,\n scaled: pixelRatio !== 1,\n };\n}\n\n/**\n * Scrolls specified element into view of its parent.\n * @param {Object} element - The element to be visible.\n * @param {Object} spot - An object with optional top and left properties,\n * specifying the offset from the top left edge.\n * @param {boolean} [scrollMatches] - When scrolling search results into view,\n * ignore elements that either: Contains marked content identifiers,\n * or have the CSS-rule `overflow: hidden;` set. The default value is `false`.\n */\nfunction scrollIntoView(element, spot, scrollMatches = false) {\n // Assuming offsetParent is available (it's not available when viewer is in\n // hidden iframe or object). We have to scroll: if the offsetParent is not set\n // producing the error. See also animationStarted.\n let parent = element.offsetParent;\n if (!parent) {\n console.error(\"offsetParent is not set -- cannot scroll\");\n return;\n }\n let offsetY = element.offsetTop + element.clientTop;\n let offsetX = element.offsetLeft + element.clientLeft;\n while (\n (parent.clientHeight === parent.scrollHeight &&\n parent.clientWidth === parent.scrollWidth) ||\n (scrollMatches &&\n (parent.classList.contains(\"markedContent\") ||\n getComputedStyle(parent).overflow === \"hidden\"))\n ) {\n offsetY += parent.offsetTop;\n offsetX += parent.offsetLeft;\n\n parent = parent.offsetParent;\n if (!parent) {\n return; // no need to scroll\n }\n }\n if (spot) {\n if (spot.top !== undefined) {\n offsetY += spot.top;\n }\n if (spot.left !== undefined) {\n offsetX += spot.left;\n parent.scrollLeft = offsetX;\n }\n }\n parent.scrollTop = offsetY;\n}\n\n/**\n * Helper function to start monitoring the scroll event and converting them into\n * PDF.js friendly one: with scroll debounce and scroll direction.\n */\nfunction watchScroll(viewAreaElement, callback) {\n const debounceScroll = function (evt) {\n if (rAF) {\n return;\n }\n // schedule an invocation of scroll for next animation frame.\n rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {\n rAF = null;\n\n const currentX = viewAreaElement.scrollLeft;\n const lastX = state.lastX;\n if (currentX !== lastX) {\n state.right = currentX > lastX;\n }\n state.lastX = currentX;\n const currentY = viewAreaElement.scrollTop;\n const lastY = state.lastY;\n if (currentY !== lastY) {\n state.down = currentY > lastY;\n }\n state.lastY = currentY;\n callback(state);\n });\n };\n\n const state = {\n right: true,\n down: true,\n lastX: viewAreaElement.scrollLeft,\n lastY: viewAreaElement.scrollTop,\n _eventHandler: debounceScroll,\n };\n\n let rAF = null;\n viewAreaElement.addEventListener(\"scroll\", debounceScroll, true);\n return state;\n}\n\n/**\n * Helper function to parse query string (e.g. ?param1=value&parm2=...).\n */\nfunction parseQueryString(query) {\n const parts = query.split(\"&\");\n const params = Object.create(null);\n for (let i = 0, ii = parts.length; i < ii; ++i) {\n const param = parts[i].split(\"=\");\n const key = param[0].toLowerCase();\n const value = param.length > 1 ? param[1] : null;\n params[decodeURIComponent(key)] = decodeURIComponent(value);\n }\n return params;\n}\n\n/**\n * Use binary search to find the index of the first item in a given array which\n * passes a given condition. The items are expected to be sorted in the sense\n * that if the condition is true for one item in the array, then it is also true\n * for all following items.\n *\n * @returns {number} Index of the first array element to pass the test,\n * or |items.length| if no such element exists.\n */\nfunction binarySearchFirstItem(items, condition) {\n let minIndex = 0;\n let maxIndex = items.length - 1;\n\n if (maxIndex < 0 || !condition(items[maxIndex])) {\n return items.length;\n }\n if (condition(items[minIndex])) {\n return minIndex;\n }\n\n while (minIndex < maxIndex) {\n const currentIndex = (minIndex + maxIndex) >> 1;\n const currentItem = items[currentIndex];\n if (condition(currentItem)) {\n maxIndex = currentIndex;\n } else {\n minIndex = currentIndex + 1;\n }\n }\n return minIndex; /* === maxIndex */\n}\n\n/**\n * Approximates float number as a fraction using Farey sequence (max order\n * of 8).\n * @param {number} x - Positive float number.\n * @returns {Array} Estimated fraction: the first array item is a numerator,\n * the second one is a denominator.\n */\nfunction approximateFraction(x) {\n // Fast paths for int numbers or their inversions.\n if (Math.floor(x) === x) {\n return [x, 1];\n }\n const xinv = 1 / x;\n const limit = 8;\n if (xinv > limit) {\n return [1, limit];\n } else if (Math.floor(xinv) === xinv) {\n return [1, xinv];\n }\n\n const x_ = x > 1 ? xinv : x;\n // a/b and c/d are neighbours in Farey sequence.\n let a = 0,\n b = 1,\n c = 1,\n d = 1;\n // Limiting search to order 8.\n while (true) {\n // Generating next term in sequence (order of q).\n const p = a + c,\n q = b + d;\n if (q > limit) {\n break;\n }\n if (x_ <= p / q) {\n c = p;\n d = q;\n } else {\n a = p;\n b = q;\n }\n }\n let result;\n // Select closest of the neighbours to x.\n if (x_ - a / b < c / d - x_) {\n result = x_ === x ? [a, b] : [b, a];\n } else {\n result = x_ === x ? [c, d] : [d, c];\n }\n return result;\n}\n\nfunction roundToDivide(x, div) {\n const r = x % div;\n return r === 0 ? x : Math.round(x - r + div);\n}\n\n/**\n * Gets the size of the specified page, converted from PDF units to inches.\n * @param {Object} An Object containing the properties: {Array} `view`,\n * {number} `userUnit`, and {number} `rotate`.\n * @returns {Object} An Object containing the properties: {number} `width`\n * and {number} `height`, given in inches.\n */\nfunction getPageSizeInches({ view, userUnit, rotate }) {\n const [x1, y1, x2, y2] = view;\n // We need to take the page rotation into account as well.\n const changeOrientation = rotate % 180 !== 0;\n\n const width = ((x2 - x1) / 72) * userUnit;\n const height = ((y2 - y1) / 72) * userUnit;\n\n return {\n width: changeOrientation ? height : width,\n height: changeOrientation ? width : height,\n };\n}\n\n/**\n * Helper function for getVisibleElements.\n *\n * @param {number} index - initial guess at the first visible element\n * @param {Array} views - array of pages, into which `index` is an index\n * @param {number} top - the top of the scroll pane\n * @returns {number} less than or equal to `index` that is definitely at or\n * before the first visible element in `views`, but not by too much. (Usually,\n * this will be the first element in the first partially visible row in\n * `views`, although sometimes it goes back one row further.)\n */\nfunction backtrackBeforeAllVisibleElements(index, views, top) {\n // binarySearchFirstItem's assumption is that the input is ordered, with only\n // one index where the conditions flips from false to true: [false ...,\n // true...]. With vertical scrolling and spreads, it is possible to have\n // [false ..., true, false, true ...]. With wrapped scrolling we can have a\n // similar sequence, with many more mixed true and false in the middle.\n //\n // So there is no guarantee that the binary search yields the index of the\n // first visible element. It could have been any of the other visible elements\n // that were preceded by a hidden element.\n\n // Of course, if either this element or the previous (hidden) element is also\n // the first element, there's nothing to worry about.\n if (index < 2) {\n return index;\n }\n\n // That aside, the possible cases are represented below.\n //\n // **** = fully hidden\n // A*B* = mix of partially visible and/or hidden pages\n // CDEF = fully visible\n //\n // (1) Binary search could have returned A, in which case we can stop.\n // (2) Binary search could also have returned B, in which case we need to\n // check the whole row.\n // (3) Binary search could also have returned C, in which case we need to\n // check the whole previous row.\n //\n // There's one other possibility:\n //\n // **** = fully hidden\n // ABCD = mix of fully and/or partially visible pages\n //\n // (4) Binary search could only have returned A.\n\n // Initially assume that we need to find the beginning of the current row\n // (case 1, 2, or 4), which means finding a page that is above the current\n // page's top. If the found page is partially visible, we're definitely not in\n // case 3, and this assumption is correct.\n let elt = views[index].div;\n let pageTop = elt.offsetTop + elt.clientTop;\n\n if (pageTop >= top) {\n // The found page is fully visible, so we're actually either in case 3 or 4,\n // and unfortunately we can't tell the difference between them without\n // scanning the entire previous row, so we just conservatively assume that\n // we do need to backtrack to that row. In both cases, the previous page is\n // in the previous row, so use its top instead.\n elt = views[index - 1].div;\n pageTop = elt.offsetTop + elt.clientTop;\n }\n\n // Now we backtrack to the first page that still has its bottom below\n // `pageTop`, which is the top of a page in the first visible row (unless\n // we're in case 4, in which case it's the row before that).\n // `index` is found by binary search, so the page at `index - 1` is\n // invisible and we can start looking for potentially visible pages from\n // `index - 2`. (However, if this loop terminates on its first iteration,\n // which is the case when pages are stacked vertically, `index` should remain\n // unchanged, so we use a distinct loop variable.)\n for (let i = index - 2; i >= 0; --i) {\n elt = views[i].div;\n if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {\n // We have reached the previous row, so stop now.\n // This loop is expected to terminate relatively quickly because the\n // number of pages per row is expected to be small.\n break;\n }\n index = i;\n }\n return index;\n}\n\n/**\n * @typedef {Object} GetVisibleElementsParameters\n * @property {HTMLElement} scrollEl - A container that can possibly scroll.\n * @property {Array} views - Objects with a `div` property that contains an\n * HTMLElement, which should all be descendants of `scrollEl` satisfying the\n * relevant layout assumptions.\n * @property {boolean} sortByVisibility - If `true`, the returned elements are\n * sorted in descending order of the percent of their padding box that is\n * visible. The default value is `false`.\n * @property {boolean} horizontal - If `true`, the elements are assumed to be\n * laid out horizontally instead of vertically. The default value is `false`.\n * @property {boolean} rtl - If `true`, the `scrollEl` container is assumed to\n * be in right-to-left mode. The default value is `false`.\n */\n\n/**\n * Generic helper to find out what elements are visible within a scroll pane.\n *\n * Well, pretty generic. There are some assumptions placed on the elements\n * referenced by `views`:\n * - If `horizontal`, no left of any earlier element is to the right of the\n * left of any later element.\n * - Otherwise, `views` can be split into contiguous rows where, within a row,\n * no top of any element is below the bottom of any other element, and\n * between rows, no bottom of any element in an earlier row is below the\n * top of any element in a later row.\n *\n * (Here, top, left, etc. all refer to the padding edge of the element in\n * question. For pages, that ends up being equivalent to the bounding box of the\n * rendering canvas. Earlier and later refer to index in `views`, not page\n * layout.)\n *\n * @param {GetVisibleElementsParameters}\n * @returns {Object} `{ first, last, views: [{ id, x, y, view, percent }] }`\n */\nfunction getVisibleElements({\n scrollEl,\n views,\n sortByVisibility = false,\n horizontal = false,\n rtl = false,\n}) {\n const top = scrollEl.scrollTop,\n bottom = top + scrollEl.clientHeight;\n const left = scrollEl.scrollLeft,\n right = left + scrollEl.clientWidth;\n\n // Throughout this \"generic\" function, comments will assume we're working with\n // PDF document pages, which is the most important and complex case. In this\n // case, the visible elements we're actually interested is the page canvas,\n // which is contained in a wrapper which adds no padding/border/margin, which\n // is itself contained in `view.div` which adds no padding (but does add a\n // border). So, as specified in this function's doc comment, this function\n // does all of its work on the padding edge of the provided views, starting at\n // offsetLeft/Top (which includes margin) and adding clientLeft/Top (which is\n // the border). Adding clientWidth/Height gets us the bottom-right corner of\n // the padding edge.\n function isElementBottomAfterViewTop(view) {\n const element = view.div;\n const elementBottom =\n element.offsetTop + element.clientTop + element.clientHeight;\n return elementBottom > top;\n }\n function isElementNextAfterViewHorizontally(view) {\n const element = view.div;\n const elementLeft = element.offsetLeft + element.clientLeft;\n const elementRight = elementLeft + element.clientWidth;\n return rtl ? elementLeft < right : elementRight > left;\n }\n\n const visible = [],\n numViews = views.length;\n let firstVisibleElementInd = binarySearchFirstItem(\n views,\n horizontal\n ? isElementNextAfterViewHorizontally\n : isElementBottomAfterViewTop\n );\n\n // Please note the return value of the `binarySearchFirstItem` function when\n // no valid element is found (hence the `firstVisibleElementInd` check below).\n if (\n firstVisibleElementInd > 0 &&\n firstVisibleElementInd < numViews &&\n !horizontal\n ) {\n // In wrapped scrolling (or vertical scrolling with spreads), with some page\n // sizes, isElementBottomAfterViewTop doesn't satisfy the binary search\n // condition: there can be pages with bottoms above the view top between\n // pages with bottoms below. This function detects and corrects that error;\n // see it for more comments.\n firstVisibleElementInd = backtrackBeforeAllVisibleElements(\n firstVisibleElementInd,\n views,\n top\n );\n }\n\n // lastEdge acts as a cutoff for us to stop looping, because we know all\n // subsequent pages will be hidden.\n //\n // When using wrapped scrolling or vertical scrolling with spreads, we can't\n // simply stop the first time we reach a page below the bottom of the view;\n // the tops of subsequent pages on the same row could still be visible. In\n // horizontal scrolling, we don't have that issue, so we can stop as soon as\n // we pass `right`, without needing the code below that handles the -1 case.\n let lastEdge = horizontal ? right : -1;\n\n for (let i = firstVisibleElementInd; i < numViews; i++) {\n const view = views[i],\n element = view.div;\n const currentWidth = element.offsetLeft + element.clientLeft;\n const currentHeight = element.offsetTop + element.clientTop;\n const viewWidth = element.clientWidth,\n viewHeight = element.clientHeight;\n const viewRight = currentWidth + viewWidth;\n const viewBottom = currentHeight + viewHeight;\n\n if (lastEdge === -1) {\n // As commented above, this is only needed in non-horizontal cases.\n // Setting lastEdge to the bottom of the first page that is partially\n // visible ensures that the next page fully below lastEdge is on the\n // next row, which has to be fully hidden along with all subsequent rows.\n if (viewBottom >= bottom) {\n lastEdge = viewBottom;\n }\n } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {\n break;\n }\n\n if (\n viewBottom <= top ||\n currentHeight >= bottom ||\n viewRight <= left ||\n currentWidth >= right\n ) {\n continue;\n }\n\n const hiddenHeight =\n Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);\n const hiddenWidth =\n Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);\n\n const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,\n fractionWidth = (viewWidth - hiddenWidth) / viewWidth;\n const percent = (fractionHeight * fractionWidth * 100) | 0;\n\n visible.push({\n id: view.id,\n x: currentWidth,\n y: currentHeight,\n view,\n percent,\n widthPercent: (fractionWidth * 100) | 0,\n });\n }\n\n const first = visible[0],\n last = visible[visible.length - 1];\n\n if (sortByVisibility) {\n visible.sort(function (a, b) {\n const pc = a.percent - b.percent;\n if (Math.abs(pc) > 0.001) {\n return -pc;\n }\n return a.id - b.id; // ensure stability\n });\n }\n return { first, last, views: visible };\n}\n\n/**\n * Event handler to suppress context menu.\n */\nfunction noContextMenuHandler(evt) {\n evt.preventDefault();\n}\n\nfunction normalizeWheelEventDirection(evt) {\n let delta = Math.hypot(evt.deltaX, evt.deltaY);\n const angle = Math.atan2(evt.deltaY, evt.deltaX);\n if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {\n // All that is left-up oriented has to change the sign.\n delta = -delta;\n }\n return delta;\n}\n\nfunction normalizeWheelEventDelta(evt) {\n let delta = normalizeWheelEventDirection(evt);\n\n const MOUSE_DOM_DELTA_PIXEL_MODE = 0;\n const MOUSE_DOM_DELTA_LINE_MODE = 1;\n const MOUSE_PIXELS_PER_LINE = 30;\n const MOUSE_LINES_PER_PAGE = 30;\n\n // Converts delta to per-page units\n if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {\n delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;\n } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {\n delta /= MOUSE_LINES_PER_PAGE;\n }\n return delta;\n}\n\nfunction isValidRotation(angle) {\n return Number.isInteger(angle) && angle % 90 === 0;\n}\n\nfunction isValidScrollMode(mode) {\n return (\n Number.isInteger(mode) &&\n Object.values(ScrollMode).includes(mode) &&\n mode !== ScrollMode.UNKNOWN\n );\n}\n\nfunction isValidSpreadMode(mode) {\n return (\n Number.isInteger(mode) &&\n Object.values(SpreadMode).includes(mode) &&\n mode !== SpreadMode.UNKNOWN\n );\n}\n\nfunction isPortraitOrientation(size) {\n return size.width <= size.height;\n}\n\nconst WaitOnType = {\n EVENT: \"event\",\n TIMEOUT: \"timeout\",\n};\n\n/**\n * @typedef {Object} WaitOnEventOrTimeoutParameters\n * @property {Object} target - The event target, can for example be:\n * `window`, `document`, a DOM element, or an {EventBus} instance.\n * @property {string} name - The name of the event.\n * @property {number} delay - The delay, in milliseconds, after which the\n * timeout occurs (if the event wasn't already dispatched).\n */\n\n/**\n * Allows waiting for an event or a timeout, whichever occurs first.\n * Can be used to ensure that an action always occurs, even when an event\n * arrives late or not at all.\n *\n * @param {WaitOnEventOrTimeoutParameters}\n * @returns {Promise} A promise that is resolved with a {WaitOnType} value.\n */\nfunction waitOnEventOrTimeout({ target, name, delay = 0 }) {\n return new Promise(function (resolve, reject) {\n if (\n typeof target !== \"object\" ||\n !(name && typeof name === \"string\") ||\n !(Number.isInteger(delay) && delay >= 0)\n ) {\n throw new Error(\"waitOnEventOrTimeout - invalid parameters.\");\n }\n\n function handler(type) {\n if (target instanceof EventBus) {\n target._off(name, eventHandler);\n } else {\n target.removeEventListener(name, eventHandler);\n }\n\n if (timeout) {\n clearTimeout(timeout);\n }\n resolve(type);\n }\n\n const eventHandler = handler.bind(null, WaitOnType.EVENT);\n if (target instanceof EventBus) {\n target._on(name, eventHandler);\n } else {\n target.addEventListener(name, eventHandler);\n }\n\n const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);\n const timeout = setTimeout(timeoutHandler, delay);\n });\n}\n\n/**\n * Promise that is resolved when DOM window becomes visible.\n */\nconst animationStarted = new Promise(function (resolve) {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof window === \"undefined\"\n ) {\n // Prevent \"ReferenceError: window is not defined\" errors when running the\n // unit-tests in Node.js environments.\n setTimeout(resolve, 20);\n return;\n }\n window.requestAnimationFrame(resolve);\n});\n\n/**\n * NOTE: Only used to support various PDF viewer tests in `mozilla-central`.\n */\nfunction dispatchDOMEvent(eventName, args = null) {\n if (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: dispatchDOMEvent\");\n }\n const details = Object.create(null);\n if (args?.length > 0) {\n const obj = args[0];\n for (const key in obj) {\n const value = obj[key];\n if (key === \"source\") {\n if (value === window || value === document) {\n return; // No need to re-dispatch (already) global events.\n }\n continue; // Ignore the `source` property.\n }\n details[key] = value;\n }\n }\n const event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(eventName, true, true, details);\n document.dispatchEvent(event);\n}\n\n/**\n * Simple event bus for an application. Listeners are attached using the `on`\n * and `off` methods. To raise an event, the `dispatch` method shall be used.\n */\nclass EventBus {\n constructor(options) {\n this._listeners = Object.create(null);\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"MOZCENTRAL\")) {\n this._isInAutomation = options?.isInAutomation === true;\n }\n }\n\n /**\n * @param {string} eventName\n * @param {function} listener\n * @param {Object} [options]\n */\n on(eventName, listener, options = null) {\n this._on(eventName, listener, {\n external: true,\n once: options?.once,\n });\n }\n\n /**\n * @param {string} eventName\n * @param {function} listener\n * @param {Object} [options]\n */\n off(eventName, listener, options = null) {\n this._off(eventName, listener, {\n external: true,\n once: options?.once,\n });\n }\n\n dispatch(eventName) {\n const eventListeners = this._listeners[eventName];\n if (!eventListeners || eventListeners.length === 0) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"MOZCENTRAL\")) &&\n this._isInAutomation\n ) {\n const args = Array.prototype.slice.call(arguments, 1);\n dispatchDOMEvent(eventName, args);\n }\n return;\n }\n // Passing all arguments after the eventName to the listeners.\n const args = Array.prototype.slice.call(arguments, 1);\n let externalListeners;\n // Making copy of the listeners array in case if it will be modified\n // during dispatch.\n for (const { listener, external, once } of eventListeners.slice(0)) {\n if (once) {\n this._off(eventName, listener);\n }\n if (external) {\n (externalListeners ||= []).push(listener);\n continue;\n }\n listener.apply(null, args);\n }\n // Dispatch any \"external\" listeners *after* the internal ones, to give the\n // viewer components time to handle events and update their state first.\n if (externalListeners) {\n for (const listener of externalListeners) {\n listener.apply(null, args);\n }\n externalListeners = null;\n }\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"MOZCENTRAL\")) &&\n this._isInAutomation\n ) {\n dispatchDOMEvent(eventName, args);\n }\n }\n\n /**\n * @ignore\n */\n _on(eventName, listener, options = null) {\n const eventListeners = (this._listeners[eventName] ||= []);\n eventListeners.push({\n listener,\n external: options?.external === true,\n once: options?.once === true,\n });\n }\n\n /**\n * @ignore\n */\n _off(eventName, listener, options = null) {\n const eventListeners = this._listeners[eventName];\n if (!eventListeners) {\n return;\n }\n for (let i = 0, ii = eventListeners.length; i < ii; i++) {\n if (eventListeners[i].listener === listener) {\n eventListeners.splice(i, 1);\n return;\n }\n }\n }\n}\n\nfunction clamp(v, min, max) {\n return Math.min(Math.max(v, min), max);\n}\n\nclass ProgressBar {\n constructor(id, { height, width, units } = {}) {\n this.visible = true;\n\n // Fetch the sub-elements for later.\n this.div = document.querySelector(id + \" .progress\");\n // Get the loading bar element, so it can be resized to fit the viewer.\n this.bar = this.div.parentNode;\n\n // Get options, with sensible defaults.\n this.height = height || 100;\n this.width = width || 100;\n this.units = units || \"%\";\n\n // Initialize heights.\n this.div.style.height = this.height + this.units;\n this.percent = 0;\n }\n\n _updateBar() {\n if (this._indeterminate) {\n this.div.classList.add(\"indeterminate\");\n this.div.style.width = this.width + this.units;\n return;\n }\n\n this.div.classList.remove(\"indeterminate\");\n const progressSize = (this.width * this._percent) / 100;\n this.div.style.width = progressSize + this.units;\n }\n\n get percent() {\n return this._percent;\n }\n\n set percent(val) {\n this._indeterminate = isNaN(val);\n this._percent = clamp(val, 0, 100);\n this._updateBar();\n }\n\n setWidth(viewer) {\n if (!viewer) {\n return;\n }\n const container = viewer.parentNode;\n const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;\n if (scrollbarWidth > 0) {\n const doc = document.documentElement;\n doc.style.setProperty(LOADINGBAR_END_OFFSET_VAR, `${scrollbarWidth}px`);\n }\n }\n\n hide() {\n if (!this.visible) {\n return;\n }\n this.visible = false;\n this.bar.classList.add(\"hidden\");\n }\n\n show() {\n if (this.visible) {\n return;\n }\n this.visible = true;\n this.bar.classList.remove(\"hidden\");\n }\n}\n\n/**\n * Moves all elements of an array that satisfy condition to the end of the\n * array, preserving the order of the rest.\n */\nfunction moveToEndOfArray(arr, condition) {\n const moved = [],\n len = arr.length;\n let write = 0;\n for (let read = 0; read < len; ++read) {\n if (condition(arr[read])) {\n moved.push(arr[read]);\n } else {\n arr[write] = arr[read];\n ++write;\n }\n }\n for (let read = 0; write < len; ++read, ++write) {\n arr[write] = moved[read];\n }\n}\n\n/**\n * Get the active or focused element in current DOM.\n *\n * Recursively search for the truly active or focused element in case there are\n * shadow DOMs.\n *\n * @returns {Element} the truly active or focused element.\n */\nfunction getActiveOrFocusedElement() {\n let curRoot = document;\n let curActiveOrFocused =\n curRoot.activeElement || curRoot.querySelector(\":focus\");\n\n while (curActiveOrFocused?.shadowRoot) {\n curRoot = curActiveOrFocused.shadowRoot;\n curActiveOrFocused =\n curRoot.activeElement || curRoot.querySelector(\":focus\");\n }\n\n return curActiveOrFocused;\n}\n\n/**\n * Converts API PageLayout values to the format used by `BaseViewer`.\n * NOTE: This is supported to the extent that the viewer implements the\n * necessary Scroll/Spread modes (since SinglePage, TwoPageLeft,\n * and TwoPageRight all suggests using non-continuous scrolling).\n * @param {string} mode - The API PageLayout value.\n * @returns {number} A value from {SpreadMode}.\n */\nfunction apiPageLayoutToSpreadMode(layout) {\n switch (layout) {\n case \"SinglePage\":\n case \"OneColumn\":\n return SpreadMode.NONE;\n case \"TwoColumnLeft\":\n case \"TwoPageLeft\":\n return SpreadMode.ODD;\n case \"TwoColumnRight\":\n case \"TwoPageRight\":\n return SpreadMode.EVEN;\n }\n return SpreadMode.NONE; // Default value.\n}\n\n/**\n * Converts API PageMode values to the format used by `PDFSidebar`.\n * NOTE: There's also a \"FullScreen\" parameter which is not possible to support,\n * since the Fullscreen API used in browsers requires that entering\n * fullscreen mode only occurs as a result of a user-initiated event.\n * @param {string} mode - The API PageMode value.\n * @returns {number} A value from {SidebarView}.\n */\nfunction apiPageModeToSidebarView(mode) {\n switch (mode) {\n case \"UseNone\":\n return SidebarView.NONE;\n case \"UseThumbs\":\n return SidebarView.THUMBS;\n case \"UseOutlines\":\n return SidebarView.OUTLINE;\n case \"UseAttachments\":\n return SidebarView.ATTACHMENTS;\n case \"UseOC\":\n return SidebarView.LAYERS;\n }\n return SidebarView.NONE; // Default value.\n}\n\nexport {\n animationStarted,\n apiPageLayoutToSpreadMode,\n apiPageModeToSidebarView,\n approximateFraction,\n AutoPrintRegExp,\n backtrackBeforeAllVisibleElements, // only exported for testing\n binarySearchFirstItem,\n CSS_UNITS,\n DEFAULT_SCALE,\n DEFAULT_SCALE_VALUE,\n EventBus,\n getActiveOrFocusedElement,\n getOutputScale,\n getPageSizeInches,\n getVisibleElements,\n isPortraitOrientation,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n MAX_AUTO_SCALE,\n MAX_SCALE,\n MIN_SCALE,\n moveToEndOfArray,\n noContextMenuHandler,\n normalizeWheelEventDelta,\n normalizeWheelEventDirection,\n parseQueryString,\n PresentationModeState,\n ProgressBar,\n RendererType,\n roundToDivide,\n SCROLLBAR_PADDING,\n scrollIntoView,\n ScrollMode,\n SidebarView,\n SpreadMode,\n TextLayerMode,\n UNKNOWN_SCALE,\n VERTICAL_PADDING,\n waitOnEventOrTimeout,\n WaitOnType,\n watchScroll,\n};\n","/* Copyright 2016 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 module, __non_webpack_require__ */\n\n\"use strict\";\n\nlet pdfjsLib;\nif (typeof window !== \"undefined\" && window[\"pdfjs-dist/build/pdf\"]) {\n pdfjsLib = window[\"pdfjs-dist/build/pdf\"];\n} else {\n pdfjsLib = __non_webpack_require__(\"../build/pdf.js\");\n}\nmodule.exports = pdfjsLib;\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { GrabToPan } from \"./grab_to_pan.js\";\nimport { PresentationModeState } from \"./ui_utils.js\";\n\nconst CursorTool = {\n SELECT: 0, // The default value.\n HAND: 1,\n ZOOM: 2,\n};\n\n/**\n * @typedef {Object} PDFCursorToolsOptions\n * @property {HTMLDivElement} container - The document container.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} [cursorToolOnLoad] - The cursor tool that will be enabled\n * on load; the constants from {CursorTool} should be used. The default value\n * is `CursorTool.SELECT`.\n */\n\nclass PDFCursorTools {\n /**\n * @param {PDFCursorToolsOptions} options\n */\n constructor({ container, eventBus, cursorToolOnLoad = CursorTool.SELECT }) {\n this.container = container;\n this.eventBus = eventBus;\n\n this.active = CursorTool.SELECT;\n this.activeBeforePresentationMode = null;\n\n this.handTool = new GrabToPan({\n element: this.container,\n });\n\n this._addEventListeners();\n\n // Defer the initial `switchTool` call, to give other viewer components\n // time to initialize *and* register 'cursortoolchanged' event listeners.\n Promise.resolve().then(() => {\n this.switchTool(cursorToolOnLoad);\n });\n }\n\n /**\n * @type {number} One of the values in {CursorTool}.\n */\n get activeTool() {\n return this.active;\n }\n\n /**\n * NOTE: This method is ignored while Presentation Mode is active.\n * @param {number} tool - The cursor mode that should be switched to,\n * must be one of the values in {CursorTool}.\n */\n switchTool(tool) {\n if (this.activeBeforePresentationMode !== null) {\n return; // Cursor tools cannot be used in Presentation Mode.\n }\n if (tool === this.active) {\n return; // The requested tool is already active.\n }\n\n const disableActiveTool = () => {\n switch (this.active) {\n case CursorTool.SELECT:\n break;\n case CursorTool.HAND:\n this.handTool.deactivate();\n break;\n case CursorTool.ZOOM:\n /* falls through */\n }\n };\n\n // Enable the new cursor tool.\n switch (tool) {\n case CursorTool.SELECT:\n disableActiveTool();\n break;\n case CursorTool.HAND:\n disableActiveTool();\n this.handTool.activate();\n break;\n case CursorTool.ZOOM:\n /* falls through */\n default:\n console.error(`switchTool: \"${tool}\" is an unsupported value.`);\n return;\n }\n // Update the active tool *after* it has been validated above,\n // in order to prevent setting it to an invalid state.\n this.active = tool;\n\n this._dispatchEvent();\n }\n\n /**\n * @private\n */\n _dispatchEvent() {\n this.eventBus.dispatch(\"cursortoolchanged\", {\n source: this,\n tool: this.active,\n });\n }\n\n /**\n * @private\n */\n _addEventListeners() {\n this.eventBus._on(\"switchcursortool\", evt => {\n this.switchTool(evt.tool);\n });\n\n this.eventBus._on(\"presentationmodechanged\", evt => {\n switch (evt.state) {\n case PresentationModeState.FULLSCREEN: {\n const previouslyActive = this.active;\n\n this.switchTool(CursorTool.SELECT);\n this.activeBeforePresentationMode = previouslyActive;\n break;\n }\n case PresentationModeState.NORMAL: {\n const previouslyActive = this.activeBeforePresentationMode;\n\n this.activeBeforePresentationMode = null;\n this.switchTool(previouslyActive);\n break;\n }\n }\n });\n }\n}\n\nexport { CursorTool, PDFCursorTools };\n","/* Copyright 2013 Rob Wu <rob@robwu.nl>\n * https://github.com/Rob--W/grab-to-pan.js\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Construct a GrabToPan instance for a given HTML element.\n * @param options.element {Element}\n * @param options.ignoreTarget {function} optional. See `ignoreTarget(node)`\n * @param options.onActiveChanged {function(boolean)} optional. Called\n * when grab-to-pan is (de)activated. The first argument is a boolean that\n * shows whether grab-to-pan is activated.\n */\nfunction GrabToPan(options) {\n this.element = options.element;\n this.document = options.element.ownerDocument;\n if (typeof options.ignoreTarget === \"function\") {\n this.ignoreTarget = options.ignoreTarget;\n }\n this.onActiveChanged = options.onActiveChanged;\n\n // Bind the contexts to ensure that `this` always points to\n // the GrabToPan instance.\n this.activate = this.activate.bind(this);\n this.deactivate = this.deactivate.bind(this);\n this.toggle = this.toggle.bind(this);\n this._onmousedown = this._onmousedown.bind(this);\n this._onmousemove = this._onmousemove.bind(this);\n this._endPan = this._endPan.bind(this);\n\n // This overlay will be inserted in the document when the mouse moves during\n // a grab operation, to ensure that the cursor has the desired appearance.\n const overlay = (this.overlay = document.createElement(\"div\"));\n overlay.className = \"grab-to-pan-grabbing\";\n}\nGrabToPan.prototype = {\n /**\n * Class name of element which can be grabbed\n */\n CSS_CLASS_GRAB: \"grab-to-pan-grab\",\n\n /**\n * Bind a mousedown event to the element to enable grab-detection.\n */\n activate: function GrabToPan_activate() {\n if (!this.active) {\n this.active = true;\n this.element.addEventListener(\"mousedown\", this._onmousedown, true);\n this.element.classList.add(this.CSS_CLASS_GRAB);\n if (this.onActiveChanged) {\n this.onActiveChanged(true);\n }\n }\n },\n\n /**\n * Removes all events. Any pending pan session is immediately stopped.\n */\n deactivate: function GrabToPan_deactivate() {\n if (this.active) {\n this.active = false;\n this.element.removeEventListener(\"mousedown\", this._onmousedown, true);\n this._endPan();\n this.element.classList.remove(this.CSS_CLASS_GRAB);\n if (this.onActiveChanged) {\n this.onActiveChanged(false);\n }\n }\n },\n\n toggle: function GrabToPan_toggle() {\n if (this.active) {\n this.deactivate();\n } else {\n this.activate();\n }\n },\n\n /**\n * Whether to not pan if the target element is clicked.\n * Override this method to change the default behaviour.\n *\n * @param node {Element} The target of the event\n * @returns {boolean} Whether to not react to the click event.\n */\n ignoreTarget: function GrabToPan_ignoreTarget(node) {\n // Check whether the clicked element is, a child of, an input element/link.\n return node.matches(\n \"a[href], a[href] *, input, textarea, button, button *, select, option\"\n );\n },\n\n /**\n * @private\n */\n _onmousedown: function GrabToPan__onmousedown(event) {\n if (event.button !== 0 || this.ignoreTarget(event.target)) {\n return;\n }\n if (event.originalTarget) {\n try {\n // eslint-disable-next-line no-unused-expressions\n event.originalTarget.tagName;\n } catch (e) {\n // Mozilla-specific: element is a scrollbar (XUL element)\n return;\n }\n }\n\n this.scrollLeftStart = this.element.scrollLeft;\n this.scrollTopStart = this.element.scrollTop;\n this.clientXStart = event.clientX;\n this.clientYStart = event.clientY;\n this.document.addEventListener(\"mousemove\", this._onmousemove, true);\n this.document.addEventListener(\"mouseup\", this._endPan, true);\n // When a scroll event occurs before a mousemove, assume that the user\n // dragged a scrollbar (necessary for Opera Presto, Safari and IE)\n // (not needed for Chrome/Firefox)\n this.element.addEventListener(\"scroll\", this._endPan, true);\n event.preventDefault();\n event.stopPropagation();\n\n const focusedElement = document.activeElement;\n if (focusedElement && !focusedElement.contains(event.target)) {\n focusedElement.blur();\n }\n },\n\n /**\n * @private\n */\n _onmousemove: function GrabToPan__onmousemove(event) {\n this.element.removeEventListener(\"scroll\", this._endPan, true);\n if (isLeftMouseReleased(event)) {\n this._endPan();\n return;\n }\n const xDiff = event.clientX - this.clientXStart;\n const yDiff = event.clientY - this.clientYStart;\n const scrollTop = this.scrollTopStart - yDiff;\n const scrollLeft = this.scrollLeftStart - xDiff;\n if (this.element.scrollTo) {\n this.element.scrollTo({\n top: scrollTop,\n left: scrollLeft,\n behavior: \"instant\",\n });\n } else {\n this.element.scrollTop = scrollTop;\n this.element.scrollLeft = scrollLeft;\n }\n if (!this.overlay.parentNode) {\n document.body.appendChild(this.overlay);\n }\n },\n\n /**\n * @private\n */\n _endPan: function GrabToPan__endPan() {\n this.element.removeEventListener(\"scroll\", this._endPan, true);\n this.document.removeEventListener(\"mousemove\", this._onmousemove, true);\n this.document.removeEventListener(\"mouseup\", this._endPan, true);\n // Note: ChildNode.remove doesn't throw if the parentNode is undefined.\n this.overlay.remove();\n },\n};\n\n/**\n * Whether the left mouse is not pressed.\n * @param event {MouseEvent}\n * @returns {boolean} True if the left mouse button is not pressed,\n * False if unsure or if the left mouse button is pressed.\n */\nfunction isLeftMouseReleased(event) {\n if (\"buttons\" in event) {\n // http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons\n // Firefox 15+\n // Chrome 43+\n // Safari 11.1+\n return !(event.buttons & 1);\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n // Browser sniffing because it's impossible to feature-detect\n // whether event.which for onmousemove is reliable.\n const chrome = window.chrome;\n const isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app);\n // ^ Chrome 15+ ^ Opera 15+\n const isSafari6plus =\n /Apple/.test(navigator.vendor) &&\n /Version\\/([6-9]\\d*|[1-5]\\d+)/.test(navigator.userAgent);\n\n if (isChrome15OrOpera15plus || isSafari6plus) {\n // Chrome 14+\n // Opera 15+\n // Safari 6.0+\n return event.which === 0;\n }\n }\n return false;\n}\n\nexport { GrabToPan };\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 { RenderingCancelledException } from \"pdfjs-lib\";\n\nconst CLEANUP_TIMEOUT = 30000;\n\nconst RenderingStates = {\n INITIAL: 0,\n RUNNING: 1,\n PAUSED: 2,\n FINISHED: 3,\n};\n\n/**\n * Controls rendering of the views for pages and thumbnails.\n */\nclass PDFRenderingQueue {\n constructor() {\n this.pdfViewer = null;\n this.pdfThumbnailViewer = null;\n this.onIdle = null;\n this.highestPriorityPage = null;\n this.idleTimeout = null;\n this.printing = false;\n this.isThumbnailViewEnabled = false;\n }\n\n /**\n * @param {PDFViewer} pdfViewer\n */\n setViewer(pdfViewer) {\n this.pdfViewer = pdfViewer;\n }\n\n /**\n * @param {PDFThumbnailViewer} pdfThumbnailViewer\n */\n setThumbnailViewer(pdfThumbnailViewer) {\n this.pdfThumbnailViewer = pdfThumbnailViewer;\n }\n\n /**\n * @param {IRenderableView} view\n * @returns {boolean}\n */\n isHighestPriority(view) {\n return this.highestPriorityPage === view.renderingId;\n }\n\n /**\n * @param {Object} currentlyVisiblePages\n */\n renderHighestPriority(currentlyVisiblePages) {\n if (this.idleTimeout) {\n clearTimeout(this.idleTimeout);\n this.idleTimeout = null;\n }\n\n // Pages have a higher priority than thumbnails, so check them first.\n if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {\n return;\n }\n // No pages needed rendering, so check thumbnails.\n if (this.pdfThumbnailViewer && this.isThumbnailViewEnabled) {\n if (this.pdfThumbnailViewer.forceRendering()) {\n return;\n }\n }\n\n if (this.printing) {\n // If printing is currently ongoing do not reschedule cleanup.\n return;\n }\n\n if (this.onIdle) {\n this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);\n }\n }\n\n /**\n * @param {Object} visible\n * @param {Array} views\n * @param {boolean} scrolledDown\n */\n getHighestPriority(visible, views, scrolledDown) {\n /**\n * The state has changed. Figure out which page has the highest priority to\n * render next (if any).\n *\n * Priority:\n * 1. visible pages\n * 2. if last scrolled down, the page after the visible pages, or\n * if last scrolled up, the page before the visible pages\n */\n const visibleViews = visible.views;\n\n const numVisible = visibleViews.length;\n if (numVisible === 0) {\n return null;\n }\n for (let i = 0; i < numVisible; ++i) {\n const view = visibleViews[i].view;\n if (!this.isViewFinished(view)) {\n return view;\n }\n }\n\n // All the visible views have rendered; try to render next/previous pages.\n if (scrolledDown) {\n const nextPageIndex = visible.last.id;\n // IDs start at 1, so no need to add 1.\n if (views[nextPageIndex] && !this.isViewFinished(views[nextPageIndex])) {\n return views[nextPageIndex];\n }\n } else {\n const previousPageIndex = visible.first.id - 2;\n if (\n views[previousPageIndex] &&\n !this.isViewFinished(views[previousPageIndex])\n ) {\n return views[previousPageIndex];\n }\n }\n // Everything that needs to be rendered has been.\n return null;\n }\n\n /**\n * @param {IRenderableView} view\n * @returns {boolean}\n */\n isViewFinished(view) {\n return view.renderingState === RenderingStates.FINISHED;\n }\n\n /**\n * Render a page or thumbnail view. This calls the appropriate function\n * based on the views state. If the view is already rendered it will return\n * `false`.\n *\n * @param {IRenderableView} view\n */\n renderView(view) {\n switch (view.renderingState) {\n case RenderingStates.FINISHED:\n return false;\n case RenderingStates.PAUSED:\n this.highestPriorityPage = view.renderingId;\n view.resume();\n break;\n case RenderingStates.RUNNING:\n this.highestPriorityPage = view.renderingId;\n break;\n case RenderingStates.INITIAL:\n this.highestPriorityPage = view.renderingId;\n view\n .draw()\n .finally(() => {\n this.renderHighestPriority();\n })\n .catch(reason => {\n if (reason instanceof RenderingCancelledException) {\n return;\n }\n console.error(`renderView: \"${reason}\"`);\n });\n break;\n }\n return true;\n }\n}\n\nexport { PDFRenderingQueue, RenderingStates };\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\nclass OverlayManager {\n constructor() {\n this._overlays = {};\n this._active = null;\n this._keyDownBound = this._keyDown.bind(this);\n }\n\n get active() {\n return this._active;\n }\n\n /**\n * @param {string} name - The name of the overlay that is registered.\n * @param {HTMLDivElement} element - The overlay's DOM element.\n * @param {function} [callerCloseMethod] - The method that, if present, calls\n * `OverlayManager.close` from the object registering the\n * overlay. Access to this method is necessary in order to\n * run cleanup code when e.g. the overlay is force closed.\n * The default is `null`.\n * @param {boolean} [canForceClose] - Indicates if opening the overlay closes\n * an active overlay. The default is `false`.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * registered.\n */\n async register(\n name,\n element,\n callerCloseMethod = null,\n canForceClose = false\n ) {\n let container;\n if (!name || !element || !(container = element.parentNode)) {\n throw new Error(\"Not enough parameters.\");\n } else if (this._overlays[name]) {\n throw new Error(\"The overlay is already registered.\");\n }\n this._overlays[name] = {\n element,\n container,\n callerCloseMethod,\n canForceClose,\n };\n }\n\n /**\n * @param {string} name - The name of the overlay that is unregistered.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * unregistered.\n */\n async unregister(name) {\n if (!this._overlays[name]) {\n throw new Error(\"The overlay does not exist.\");\n } else if (this._active === name) {\n throw new Error(\"The overlay cannot be removed while it is active.\");\n }\n delete this._overlays[name];\n }\n\n /**\n * @param {string} name - The name of the overlay that should be opened.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * opened.\n */\n async open(name) {\n if (!this._overlays[name]) {\n throw new Error(\"The overlay does not exist.\");\n } else if (this._active) {\n if (this._overlays[name].canForceClose) {\n this._closeThroughCaller();\n } else if (this._active === name) {\n throw new Error(\"The overlay is already active.\");\n } else {\n throw new Error(\"Another overlay is currently active.\");\n }\n }\n this._active = name;\n this._overlays[this._active].element.classList.remove(\"hidden\");\n this._overlays[this._active].container.classList.remove(\"hidden\");\n\n window.addEventListener(\"keydown\", this._keyDownBound);\n }\n\n /**\n * @param {string} name - The name of the overlay that should be closed.\n * @returns {Promise} A promise that is resolved when the overlay has been\n * closed.\n */\n async close(name) {\n if (!this._overlays[name]) {\n throw new Error(\"The overlay does not exist.\");\n } else if (!this._active) {\n throw new Error(\"The overlay is currently not active.\");\n } else if (this._active !== name) {\n throw new Error(\"Another overlay is currently active.\");\n }\n this._overlays[this._active].container.classList.add(\"hidden\");\n this._overlays[this._active].element.classList.add(\"hidden\");\n this._active = null;\n\n window.removeEventListener(\"keydown\", this._keyDownBound);\n }\n\n /**\n * @private\n */\n _keyDown(evt) {\n if (this._active && evt.keyCode === /* Esc = */ 27) {\n this._closeThroughCaller();\n evt.preventDefault();\n }\n }\n\n /**\n * @private\n */\n _closeThroughCaller() {\n if (this._overlays[this._active].callerCloseMethod) {\n this._overlays[this._active].callerCloseMethod();\n }\n if (this._active) {\n this.close(this._active);\n }\n }\n}\n\nexport { OverlayManager };\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 { PasswordResponses } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} PasswordPromptOptions\n * @property {string} overlayName - Name of the overlay for the overlay manager.\n * @property {HTMLDivElement} container - Div container for the overlay.\n * @property {HTMLParagraphElement} label - Label containing instructions for\n * entering the password.\n * @property {HTMLInputElement} input - Input field for entering the password.\n * @property {HTMLButtonElement} submitButton - Button for submitting the\n * password.\n * @property {HTMLButtonElement} cancelButton - Button for cancelling password\n * entry.\n */\n\nclass PasswordPrompt {\n /**\n * @param {PasswordPromptOptions} options\n * @param {OverlayManager} overlayManager - Manager for the viewer overlays.\n * @param {IL10n} l10n - Localization service.\n * @param {boolean} [isViewerEmbedded] - If the viewer is embedded, in e.g.\n * an <iframe> or an <object>. The default value is `false`.\n */\n constructor(options, overlayManager, l10n, isViewerEmbedded = false) {\n this.overlayName = options.overlayName;\n this.container = options.container;\n this.label = options.label;\n this.input = options.input;\n this.submitButton = options.submitButton;\n this.cancelButton = options.cancelButton;\n this.overlayManager = overlayManager;\n this.l10n = l10n;\n this._isViewerEmbedded = isViewerEmbedded;\n\n this.updateCallback = null;\n this.reason = null;\n\n // Attach the event listeners.\n this.submitButton.addEventListener(\"click\", this.verify.bind(this));\n this.cancelButton.addEventListener(\"click\", this.close.bind(this));\n this.input.addEventListener(\"keydown\", e => {\n if (e.keyCode === /* Enter = */ 13) {\n this.verify();\n }\n });\n\n this.overlayManager.register(\n this.overlayName,\n this.container,\n this.close.bind(this),\n true\n );\n }\n\n async open() {\n await this.overlayManager.open(this.overlayName);\n\n const passwordIncorrect =\n this.reason === PasswordResponses.INCORRECT_PASSWORD;\n\n if (!this._isViewerEmbedded || passwordIncorrect) {\n this.input.focus();\n }\n this.label.textContent = await this.l10n.get(\n `password_${passwordIncorrect ? \"invalid\" : \"label\"}`\n );\n }\n\n close() {\n this.overlayManager.close(this.overlayName).then(() => {\n this.input.value = \"\";\n });\n }\n\n verify() {\n const password = this.input.value;\n if (password?.length > 0) {\n this.close();\n this.updateCallback(password);\n }\n }\n\n setUpdateCallback(updateCallback, reason) {\n this.updateCallback = updateCallback;\n this.reason = reason;\n }\n}\n\nexport { PasswordPrompt };\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 { createPromiseCapability, getFilenameFromUrl } from \"pdfjs-lib\";\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\n\n/**\n * @typedef {Object} PDFAttachmentViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {DownloadManager} downloadManager - The download manager.\n */\n\n/**\n * @typedef {Object} PDFAttachmentViewerRenderParameters\n * @property {Object|null} attachments - A lookup table of attachment objects.\n */\n\nclass PDFAttachmentViewer extends BaseTreeViewer {\n /**\n * @param {PDFAttachmentViewerOptions} options\n */\n constructor(options) {\n super(options);\n this.downloadManager = options.downloadManager;\n\n this.eventBus._on(\n \"fileattachmentannotation\",\n this._appendAttachment.bind(this)\n );\n }\n\n reset(keepRenderedCapability = false) {\n super.reset();\n this._attachments = null;\n\n if (!keepRenderedCapability) {\n // The only situation in which the `_renderedCapability` should *not* be\n // replaced is when appending FileAttachment annotations.\n this._renderedCapability = createPromiseCapability();\n }\n if (this._pendingDispatchEvent) {\n clearTimeout(this._pendingDispatchEvent);\n }\n this._pendingDispatchEvent = null;\n }\n\n /**\n * @private\n */\n _dispatchEvent(attachmentsCount) {\n this._renderedCapability.resolve();\n\n if (this._pendingDispatchEvent) {\n clearTimeout(this._pendingDispatchEvent);\n this._pendingDispatchEvent = null;\n }\n if (attachmentsCount === 0) {\n // Delay the event when no \"regular\" attachments exist, to allow time for\n // parsing of any FileAttachment annotations that may be present on the\n // *initially* rendered page; this reduces the likelihood of temporarily\n // disabling the attachmentsView when the `PDFSidebar` handles the event.\n this._pendingDispatchEvent = setTimeout(() => {\n this.eventBus.dispatch(\"attachmentsloaded\", {\n source: this,\n attachmentsCount: 0,\n });\n this._pendingDispatchEvent = null;\n });\n return;\n }\n\n this.eventBus.dispatch(\"attachmentsloaded\", {\n source: this,\n attachmentsCount,\n });\n }\n\n /**\n * @private\n */\n _bindLink(element, { content, filename }) {\n element.onclick = () => {\n this.downloadManager.openOrDownloadData(element, content, filename);\n return false;\n };\n }\n\n /**\n * @param {PDFAttachmentViewerRenderParameters} params\n */\n render({ attachments, keepRenderedCapability = false }) {\n if (this._attachments) {\n this.reset(keepRenderedCapability);\n }\n this._attachments = attachments || null;\n\n if (!attachments) {\n this._dispatchEvent(/* attachmentsCount = */ 0);\n return;\n }\n const names = Object.keys(attachments).sort(function (a, b) {\n return a.toLowerCase().localeCompare(b.toLowerCase());\n });\n\n const fragment = document.createDocumentFragment();\n let attachmentsCount = 0;\n for (const name of names) {\n const item = attachments[name];\n const content = item.content,\n filename = getFilenameFromUrl(item.filename);\n\n const div = document.createElement(\"div\");\n div.className = \"treeItem\";\n\n const element = document.createElement(\"a\");\n this._bindLink(element, { content, filename });\n element.textContent = this._normalizeTextContent(filename);\n\n div.appendChild(element);\n\n fragment.appendChild(div);\n attachmentsCount++;\n }\n\n this._finishRendering(fragment, attachmentsCount);\n }\n\n /**\n * Used to append FileAttachment annotations to the sidebar.\n * @private\n */\n _appendAttachment({ id, filename, content }) {\n const renderedPromise = this._renderedCapability.promise;\n\n renderedPromise.then(() => {\n if (renderedPromise !== this._renderedCapability.promise) {\n return; // The FileAttachment annotation belongs to a previous document.\n }\n let attachments = this._attachments;\n\n if (!attachments) {\n attachments = Object.create(null);\n } else {\n for (const name in attachments) {\n if (id === name) {\n return; // Ignore the new attachment if it already exists.\n }\n }\n }\n attachments[id] = {\n filename,\n content,\n };\n this.render({\n attachments,\n keepRenderedCapability: true,\n });\n });\n }\n}\n\nexport { PDFAttachmentViewer };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { removeNullCharacters } from \"pdfjs-lib\";\n\nconst TREEITEM_OFFSET_TOP = -100; // px\nconst TREEITEM_SELECTED_CLASS = \"selected\";\n\nclass BaseTreeViewer {\n constructor(options) {\n if (this.constructor === BaseTreeViewer) {\n throw new Error(\"Cannot initialize BaseTreeViewer.\");\n }\n this.container = options.container;\n this.eventBus = options.eventBus;\n\n this.reset();\n }\n\n reset() {\n this._pdfDocument = null;\n this._lastToggleIsShow = true;\n this._currentTreeItem = null;\n\n // Remove the tree from the DOM.\n this.container.textContent = \"\";\n // Ensure that the left (right in RTL locales) margin is always reset,\n // to prevent incorrect tree alignment if a new document is opened.\n this.container.classList.remove(\"treeWithDeepNesting\");\n }\n\n /**\n * @private\n */\n _dispatchEvent(count) {\n throw new Error(\"Not implemented: _dispatchEvent\");\n }\n\n /**\n * @private\n */\n _bindLink(element, params) {\n throw new Error(\"Not implemented: _bindLink\");\n }\n\n /**\n * @private\n */\n _normalizeTextContent(str) {\n return removeNullCharacters(str) || /* en dash = */ \"\\u2013\";\n }\n\n /**\n * Prepend a button before a tree item which allows the user to collapse or\n * expand all tree items at that level; see `_toggleTreeItem`.\n * @private\n */\n _addToggleButton(div, hidden = false) {\n const toggler = document.createElement(\"div\");\n toggler.className = \"treeItemToggler\";\n if (hidden) {\n toggler.classList.add(\"treeItemsHidden\");\n }\n toggler.onclick = evt => {\n evt.stopPropagation();\n toggler.classList.toggle(\"treeItemsHidden\");\n\n if (evt.shiftKey) {\n const shouldShowAll = !toggler.classList.contains(\"treeItemsHidden\");\n this._toggleTreeItem(div, shouldShowAll);\n }\n };\n div.insertBefore(toggler, div.firstChild);\n }\n\n /**\n * Collapse or expand the subtree of a tree item.\n *\n * @param {Element} root - the root of the item (sub)tree.\n * @param {boolean} show - whether to show the item (sub)tree. If false,\n * the item subtree rooted at `root` will be collapsed.\n * @private\n */\n _toggleTreeItem(root, show = false) {\n this._lastToggleIsShow = show;\n for (const toggler of root.querySelectorAll(\".treeItemToggler\")) {\n toggler.classList.toggle(\"treeItemsHidden\", !show);\n }\n }\n\n /**\n * Collapse or expand all subtrees of the `container`.\n * @private\n */\n _toggleAllTreeItems() {\n this._toggleTreeItem(this.container, !this._lastToggleIsShow);\n }\n\n /**\n * @private\n */\n _finishRendering(fragment, count, hasAnyNesting = false) {\n if (hasAnyNesting) {\n this.container.classList.add(\"treeWithDeepNesting\");\n\n this._lastToggleIsShow = !fragment.querySelector(\".treeItemsHidden\");\n }\n this.container.appendChild(fragment);\n\n this._dispatchEvent(count);\n }\n\n render(params) {\n throw new Error(\"Not implemented: render\");\n }\n\n /**\n * @private\n */\n _updateCurrentTreeItem(treeItem = null) {\n if (this._currentTreeItem) {\n // Ensure that the current treeItem-selection is always removed.\n this._currentTreeItem.classList.remove(TREEITEM_SELECTED_CLASS);\n this._currentTreeItem = null;\n }\n if (treeItem) {\n treeItem.classList.add(TREEITEM_SELECTED_CLASS);\n this._currentTreeItem = treeItem;\n }\n }\n\n /**\n * @private\n */\n _scrollToCurrentTreeItem(treeItem) {\n if (!treeItem) {\n return;\n }\n // Ensure that the treeItem is *fully* expanded, such that it will first of\n // all be visible and secondly that scrolling it into view works correctly.\n let currentNode = treeItem.parentNode;\n while (currentNode && currentNode !== this.container) {\n if (currentNode.classList.contains(\"treeItem\")) {\n const toggler = currentNode.firstElementChild;\n toggler?.classList.remove(\"treeItemsHidden\");\n }\n currentNode = currentNode.parentNode;\n }\n this._updateCurrentTreeItem(treeItem);\n\n this.container.scrollTo(\n treeItem.offsetLeft,\n treeItem.offsetTop + TREEITEM_OFFSET_TOP\n );\n }\n}\n\nexport { BaseTreeViewer };\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 createPromiseCapability,\n getPdfFilenameFromUrl,\n PDFDateString,\n} from \"pdfjs-lib\";\nimport { getPageSizeInches, isPortraitOrientation } from \"./ui_utils.js\";\n\nconst DEFAULT_FIELD_CONTENT = \"-\";\n\n// See https://en.wikibooks.org/wiki/Lentis/Conversion_to_the_Metric_Standard_in_the_United_States\nconst NON_METRIC_LOCALES = [\"en-us\", \"en-lr\", \"my\"];\n\n// Should use the format: `width x height`, in portrait orientation.\n// See https://en.wikipedia.org/wiki/Paper_size\nconst US_PAGE_NAMES = {\n \"8.5x11\": \"Letter\",\n \"8.5x14\": \"Legal\",\n};\nconst METRIC_PAGE_NAMES = {\n \"297x420\": \"A3\",\n \"210x297\": \"A4\",\n};\n\nfunction getPageName(size, isPortrait, pageNames) {\n const width = isPortrait ? size.width : size.height;\n const height = isPortrait ? size.height : size.width;\n\n return pageNames[`${width}x${height}`];\n}\n\n/**\n * @typedef {Object} PDFDocumentPropertiesOptions\n * @property {string} overlayName - Name/identifier for the overlay.\n * @property {Object} fields - Names and elements of the overlay's fields.\n * @property {HTMLDivElement} container - Div container for the overlay.\n * @property {HTMLButtonElement} closeButton - Button for closing the overlay.\n */\n\nclass PDFDocumentProperties {\n /**\n * @param {PDFDocumentPropertiesOptions} options\n * @param {OverlayManager} overlayManager - Manager for the viewer overlays.\n * @param {EventBus} eventBus - The application event bus.\n * @param {IL10n} l10n - Localization service.\n */\n constructor(\n { overlayName, fields, container, closeButton },\n overlayManager,\n eventBus,\n l10n\n ) {\n this.overlayName = overlayName;\n this.fields = fields;\n this.container = container;\n this.overlayManager = overlayManager;\n this.l10n = l10n;\n\n this._reset();\n // Bind the event listener for the Close button.\n closeButton.addEventListener(\"click\", this.close.bind(this));\n\n this.overlayManager.register(\n this.overlayName,\n this.container,\n this.close.bind(this)\n );\n\n eventBus._on(\"pagechanging\", evt => {\n this._currentPageNumber = evt.pageNumber;\n });\n eventBus._on(\"rotationchanging\", evt => {\n this._pagesRotation = evt.pagesRotation;\n });\n\n this._isNonMetricLocale = true; // The default viewer locale is 'en-us'.\n l10n.getLanguage().then(locale => {\n this._isNonMetricLocale = NON_METRIC_LOCALES.includes(locale);\n });\n }\n\n /**\n * Open the document properties overlay.\n */\n async open() {\n const freezeFieldData = data => {\n Object.defineProperty(this, \"fieldData\", {\n value: Object.freeze(data),\n writable: false,\n enumerable: true,\n configurable: true,\n });\n };\n\n await Promise.all([\n this.overlayManager.open(this.overlayName),\n this._dataAvailableCapability.promise,\n ]);\n const currentPageNumber = this._currentPageNumber;\n const pagesRotation = this._pagesRotation;\n\n // If the document properties were previously fetched (for this PDF file),\n // just update the dialog immediately to avoid redundant lookups.\n if (\n this.fieldData &&\n currentPageNumber === this.fieldData._currentPageNumber &&\n pagesRotation === this.fieldData._pagesRotation\n ) {\n this._updateUI();\n return;\n }\n\n // Get the document properties.\n const {\n info,\n /* metadata, */\n contentDispositionFilename,\n contentLength,\n } = await this.pdfDocument.getMetadata();\n\n const [\n fileName,\n fileSize,\n creationDate,\n modificationDate,\n pageSize,\n isLinearized,\n ] = await Promise.all([\n contentDispositionFilename || getPdfFilenameFromUrl(this.url),\n this._parseFileSize(contentLength),\n this._parseDate(info.CreationDate),\n this._parseDate(info.ModDate),\n this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {\n return this._parsePageSize(getPageSizeInches(pdfPage), pagesRotation);\n }),\n this._parseLinearization(info.IsLinearized),\n ]);\n\n freezeFieldData({\n fileName,\n fileSize,\n title: info.Title,\n author: info.Author,\n subject: info.Subject,\n keywords: info.Keywords,\n creationDate,\n modificationDate,\n creator: info.Creator,\n producer: info.Producer,\n version: info.PDFFormatVersion,\n pageCount: this.pdfDocument.numPages,\n pageSize,\n linearized: isLinearized,\n _currentPageNumber: currentPageNumber,\n _pagesRotation: pagesRotation,\n });\n this._updateUI();\n\n // Get the correct fileSize, since it may not have been available\n // or could potentially be wrong.\n const { length } = await this.pdfDocument.getDownloadInfo();\n if (contentLength === length) {\n return; // The fileSize has already been correctly set.\n }\n const data = Object.assign(Object.create(null), this.fieldData);\n data.fileSize = await this._parseFileSize(length);\n\n freezeFieldData(data);\n this._updateUI();\n }\n\n /**\n * Close the document properties overlay.\n */\n close() {\n this.overlayManager.close(this.overlayName);\n }\n\n /**\n * Set a reference to the PDF document and the URL in order\n * to populate the overlay fields with the document properties.\n * Note that the overlay will contain no information if this method\n * is not called.\n *\n * @param {PDFDocumentProxy} pdfDocument - A reference to the PDF document.\n * @param {string} url - The URL of the document.\n */\n setDocument(pdfDocument, url = null) {\n if (this.pdfDocument) {\n this._reset();\n this._updateUI(true);\n }\n if (!pdfDocument) {\n return;\n }\n this.pdfDocument = pdfDocument;\n this.url = url;\n\n this._dataAvailableCapability.resolve();\n }\n\n /**\n * @private\n */\n _reset() {\n this.pdfDocument = null;\n this.url = null;\n\n delete this.fieldData;\n this._dataAvailableCapability = createPromiseCapability();\n this._currentPageNumber = 1;\n this._pagesRotation = 0;\n }\n\n /**\n * Always updates all of the dialog fields, to prevent inconsistent UI state.\n * NOTE: If the contents of a particular field is neither a non-empty string,\n * nor a number, it will fall back to `DEFAULT_FIELD_CONTENT`.\n * @private\n */\n _updateUI(reset = false) {\n if (reset || !this.fieldData) {\n for (const id in this.fields) {\n this.fields[id].textContent = DEFAULT_FIELD_CONTENT;\n }\n return;\n }\n if (this.overlayManager.active !== this.overlayName) {\n // Don't bother updating the dialog if has already been closed,\n // since it will be updated the next time `this.open` is called.\n return;\n }\n for (const id in this.fields) {\n const content = this.fieldData[id];\n this.fields[id].textContent =\n content || content === 0 ? content : DEFAULT_FIELD_CONTENT;\n }\n }\n\n /**\n * @private\n */\n async _parseFileSize(fileSize = 0) {\n const kb = fileSize / 1024,\n mb = kb / 1024;\n if (!kb) {\n return undefined;\n }\n return this.l10n.get(`document_properties_${mb >= 1 ? \"mb\" : \"kb\"}`, {\n size_mb: mb >= 1 && (+mb.toPrecision(3)).toLocaleString(),\n size_kb: mb < 1 && (+kb.toPrecision(3)).toLocaleString(),\n size_b: fileSize.toLocaleString(),\n });\n }\n\n /**\n * @private\n */\n async _parsePageSize(pageSizeInches, pagesRotation) {\n if (!pageSizeInches) {\n return undefined;\n }\n // Take the viewer rotation into account as well; compare with Adobe Reader.\n if (pagesRotation % 180 !== 0) {\n pageSizeInches = {\n width: pageSizeInches.height,\n height: pageSizeInches.width,\n };\n }\n const isPortrait = isPortraitOrientation(pageSizeInches);\n\n let sizeInches = {\n width: Math.round(pageSizeInches.width * 100) / 100,\n height: Math.round(pageSizeInches.height * 100) / 100,\n };\n // 1in == 25.4mm; no need to round to 2 decimals for millimeters.\n let sizeMillimeters = {\n width: Math.round(pageSizeInches.width * 25.4 * 10) / 10,\n height: Math.round(pageSizeInches.height * 25.4 * 10) / 10,\n };\n\n let rawName =\n getPageName(sizeInches, isPortrait, US_PAGE_NAMES) ||\n getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);\n\n if (\n !rawName &&\n !(\n Number.isInteger(sizeMillimeters.width) &&\n Number.isInteger(sizeMillimeters.height)\n )\n ) {\n // Attempt to improve the page name detection by falling back to fuzzy\n // matching of the metric dimensions, to account for e.g. rounding errors\n // and/or PDF files that define the page sizes in an imprecise manner.\n const exactMillimeters = {\n width: pageSizeInches.width * 25.4,\n height: pageSizeInches.height * 25.4,\n };\n const intMillimeters = {\n width: Math.round(sizeMillimeters.width),\n height: Math.round(sizeMillimeters.height),\n };\n\n // Try to avoid false positives, by only considering \"small\" differences.\n if (\n Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 &&\n Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1\n ) {\n rawName = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);\n if (rawName) {\n // Update *both* sizes, computed above, to ensure that the displayed\n // dimensions always correspond to the detected page name.\n sizeInches = {\n width: Math.round((intMillimeters.width / 25.4) * 100) / 100,\n height: Math.round((intMillimeters.height / 25.4) * 100) / 100,\n };\n sizeMillimeters = intMillimeters;\n }\n }\n }\n\n const [{ width, height }, unit, name, orientation] = await Promise.all([\n this._isNonMetricLocale ? sizeInches : sizeMillimeters,\n this.l10n.get(\n `document_properties_page_size_unit_${\n this._isNonMetricLocale ? \"inches\" : \"millimeters\"\n }`\n ),\n rawName &&\n this.l10n.get(\n `document_properties_page_size_name_${rawName.toLowerCase()}`\n ),\n this.l10n.get(\n `document_properties_page_size_orientation_${\n isPortrait ? \"portrait\" : \"landscape\"\n }`\n ),\n ]);\n\n return this.l10n.get(\n `document_properties_page_size_dimension_${name ? \"name_\" : \"\"}string`,\n {\n width: width.toLocaleString(),\n height: height.toLocaleString(),\n unit,\n name,\n orientation,\n }\n );\n }\n\n /**\n * @private\n */\n async _parseDate(inputDate) {\n const dateObject = PDFDateString.toDateObject(inputDate);\n if (!dateObject) {\n return undefined;\n }\n return this.l10n.get(\"document_properties_date_string\", {\n date: dateObject.toLocaleDateString(),\n time: dateObject.toLocaleTimeString(),\n });\n }\n\n /**\n * @private\n */\n _parseLinearization(isLinearized) {\n return this.l10n.get(\n `document_properties_linearized_${isLinearized ? \"yes\" : \"no\"}`\n );\n }\n}\n\nexport { PDFDocumentProperties };\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 { FindState } from \"./pdf_find_controller.js\";\n\nconst MATCHES_COUNT_LIMIT = 1000;\n\n/**\n * Creates a \"search bar\" given a set of DOM elements that act as controls\n * for searching or for setting search preferences in the UI. This object\n * also sets up the appropriate events for the controls. Actual searching\n * is done by PDFFindController.\n */\nclass PDFFindBar {\n constructor(options, eventBus, l10n) {\n this.opened = false;\n\n this.bar = options.bar;\n this.toggleButton = options.toggleButton;\n this.findField = options.findField;\n this.highlightAll = options.highlightAllCheckbox;\n this.caseSensitive = options.caseSensitiveCheckbox;\n this.entireWord = options.entireWordCheckbox;\n this.findMsg = options.findMsg;\n this.findResultsCount = options.findResultsCount;\n this.findPreviousButton = options.findPreviousButton;\n this.findNextButton = options.findNextButton;\n this.eventBus = eventBus;\n this.l10n = l10n;\n\n // Add event listeners to the DOM elements.\n this.toggleButton.addEventListener(\"click\", () => {\n this.toggle();\n });\n\n this.findField.addEventListener(\"input\", () => {\n this.dispatchEvent(\"\");\n });\n\n this.bar.addEventListener(\"keydown\", e => {\n switch (e.keyCode) {\n case 13: // Enter\n if (e.target === this.findField) {\n this.dispatchEvent(\"again\", e.shiftKey);\n }\n break;\n case 27: // Escape\n this.close();\n break;\n }\n });\n\n this.findPreviousButton.addEventListener(\"click\", () => {\n this.dispatchEvent(\"again\", true);\n });\n\n this.findNextButton.addEventListener(\"click\", () => {\n this.dispatchEvent(\"again\", false);\n });\n\n this.highlightAll.addEventListener(\"click\", () => {\n this.dispatchEvent(\"highlightallchange\");\n });\n\n this.caseSensitive.addEventListener(\"click\", () => {\n this.dispatchEvent(\"casesensitivitychange\");\n });\n\n this.entireWord.addEventListener(\"click\", () => {\n this.dispatchEvent(\"entirewordchange\");\n });\n\n this.eventBus._on(\"resize\", this._adjustWidth.bind(this));\n }\n\n reset() {\n this.updateUIState();\n }\n\n dispatchEvent(type, findPrev) {\n this.eventBus.dispatch(\"find\", {\n source: this,\n type,\n query: this.findField.value,\n phraseSearch: true,\n caseSensitive: this.caseSensitive.checked,\n entireWord: this.entireWord.checked,\n highlightAll: this.highlightAll.checked,\n findPrevious: findPrev,\n });\n }\n\n updateUIState(state, previous, matchesCount) {\n let findMsg = Promise.resolve(\"\");\n let status = \"\";\n\n switch (state) {\n case FindState.FOUND:\n break;\n case FindState.PENDING:\n status = \"pending\";\n break;\n case FindState.NOT_FOUND:\n findMsg = this.l10n.get(\"find_not_found\");\n status = \"notFound\";\n break;\n case FindState.WRAPPED:\n findMsg = this.l10n.get(`find_reached_${previous ? \"top\" : \"bottom\"}`);\n break;\n }\n this.findField.setAttribute(\"data-status\", status);\n\n findMsg.then(msg => {\n this.findMsg.textContent = msg;\n this._adjustWidth();\n });\n\n this.updateResultsCount(matchesCount);\n }\n\n updateResultsCount({ current = 0, total = 0 } = {}) {\n const limit = MATCHES_COUNT_LIMIT;\n let matchCountMsg = Promise.resolve(\"\");\n\n if (total > 0) {\n if (total > limit) {\n let key = \"find_match_count_limit\";\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n // TODO: Remove this hard-coded `[other]` form once plural support has\n // been implemented in the mozilla-central specific `l10n.js` file.\n key += \"[other]\";\n }\n matchCountMsg = this.l10n.get(key, { limit });\n } else {\n let key = \"find_match_count\";\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n // TODO: Remove this hard-coded `[other]` form once plural support has\n // been implemented in the mozilla-central specific `l10n.js` file.\n key += \"[other]\";\n }\n matchCountMsg = this.l10n.get(key, { current, total });\n }\n }\n matchCountMsg.then(msg => {\n this.findResultsCount.textContent = msg;\n this.findResultsCount.classList.toggle(\"hidden\", !total);\n // Since `updateResultsCount` may be called from `PDFFindController`,\n // ensure that the width of the findbar is always updated correctly.\n this._adjustWidth();\n });\n }\n\n open() {\n if (!this.opened) {\n this.opened = true;\n this.toggleButton.classList.add(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"true\");\n this.bar.classList.remove(\"hidden\");\n }\n this.findField.select();\n this.findField.focus();\n\n this._adjustWidth();\n }\n\n close() {\n if (!this.opened) {\n return;\n }\n this.opened = false;\n this.toggleButton.classList.remove(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"false\");\n this.bar.classList.add(\"hidden\");\n\n this.eventBus.dispatch(\"findbarclose\", { source: this });\n }\n\n toggle() {\n if (this.opened) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /**\n * @private\n */\n _adjustWidth() {\n if (!this.opened) {\n return;\n }\n\n // The find bar has an absolute position and thus the browser extends\n // its width to the maximum possible width once the find bar does not fit\n // entirely within the window anymore (and its elements are automatically\n // wrapped). Here we detect and fix that.\n this.bar.classList.remove(\"wrapContainers\");\n\n const findbarHeight = this.bar.clientHeight;\n const inputContainerHeight = this.bar.firstElementChild.clientHeight;\n\n if (findbarHeight > inputContainerHeight) {\n // The findbar is taller than the input container, which means that\n // the browser wrapped some of the elements. For a consistent look,\n // wrap all of them to adjust the width of the find bar.\n this.bar.classList.add(\"wrapContainers\");\n }\n }\n}\n\nexport { PDFFindBar };\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 { createPromiseCapability } from \"pdfjs-lib\";\nimport { getCharacterType } from \"./pdf_find_utils.js\";\nimport { scrollIntoView } from \"./ui_utils.js\";\n\nconst FindState = {\n FOUND: 0,\n NOT_FOUND: 1,\n WRAPPED: 2,\n PENDING: 3,\n};\n\nconst FIND_TIMEOUT = 250; // ms\nconst MATCH_SCROLL_OFFSET_TOP = -50; // px\nconst MATCH_SCROLL_OFFSET_LEFT = -400; // px\n\nconst CHARACTERS_TO_NORMALIZE = {\n \"\\u2010\": \"-\", // Hyphen\n \"\\u2018\": \"'\", // Left single quotation mark\n \"\\u2019\": \"'\", // Right single quotation mark\n \"\\u201A\": \"'\", // Single low-9 quotation mark\n \"\\u201B\": \"'\", // Single high-reversed-9 quotation mark\n \"\\u201C\": '\"', // Left double quotation mark\n \"\\u201D\": '\"', // Right double quotation mark\n \"\\u201E\": '\"', // Double low-9 quotation mark\n \"\\u201F\": '\"', // Double high-reversed-9 quotation mark\n \"\\u00BC\": \"1/4\", // Vulgar fraction one quarter\n \"\\u00BD\": \"1/2\", // Vulgar fraction one half\n \"\\u00BE\": \"3/4\", // Vulgar fraction three quarters\n};\n\nlet normalizationRegex = null;\nfunction normalize(text) {\n if (!normalizationRegex) {\n // Compile the regular expression for text normalization once.\n const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(\"\");\n normalizationRegex = new RegExp(`[${replace}]`, \"g\");\n }\n let diffs = null;\n const normalizedText = text.replace(normalizationRegex, function (ch, index) {\n const normalizedCh = CHARACTERS_TO_NORMALIZE[ch],\n diff = normalizedCh.length - ch.length;\n if (diff !== 0) {\n (diffs ||= []).push([index, diff]);\n }\n return normalizedCh;\n });\n\n return [normalizedText, diffs];\n}\n\n// Determine the original, non-normalized, match index such that highlighting of\n// search results is correct in the `textLayer` for strings containing e.g. \"½\"\n// characters; essentially \"inverting\" the result of the `normalize` function.\nfunction getOriginalIndex(matchIndex, diffs = null) {\n if (!diffs) {\n return matchIndex;\n }\n let totalDiff = 0;\n for (const [index, diff] of diffs) {\n const currentIndex = index + totalDiff;\n\n if (currentIndex >= matchIndex) {\n break;\n }\n if (currentIndex + diff > matchIndex) {\n totalDiff += matchIndex - currentIndex;\n break;\n }\n totalDiff += diff;\n }\n return matchIndex - totalDiff;\n}\n\n/**\n * @typedef {Object} PDFFindControllerOptions\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * Provides search functionality to find a given string in a PDF document.\n */\nclass PDFFindController {\n /**\n * @param {PDFFindControllerOptions} options\n */\n constructor({ linkService, eventBus }) {\n this._linkService = linkService;\n this._eventBus = eventBus;\n\n this._reset();\n eventBus._on(\"findbarclose\", this._onFindBarClose.bind(this));\n }\n\n get highlightMatches() {\n return this._highlightMatches;\n }\n\n get pageMatches() {\n return this._pageMatches;\n }\n\n get pageMatchesLength() {\n return this._pageMatchesLength;\n }\n\n get selected() {\n return this._selected;\n }\n\n get state() {\n return this._state;\n }\n\n /**\n * Set a reference to the PDF document in order to search it.\n * Note that searching is not possible if this method is not called.\n *\n * @param {PDFDocumentProxy} pdfDocument - The PDF document to search.\n */\n setDocument(pdfDocument) {\n if (this._pdfDocument) {\n this._reset();\n }\n if (!pdfDocument) {\n return;\n }\n this._pdfDocument = pdfDocument;\n this._firstPageCapability.resolve();\n }\n\n executeCommand(cmd, state) {\n if (!state) {\n return;\n }\n const pdfDocument = this._pdfDocument;\n\n if (this._state === null || this._shouldDirtyMatch(cmd, state)) {\n this._dirtyMatch = true;\n }\n this._state = state;\n if (cmd !== \"findhighlightallchange\") {\n this._updateUIState(FindState.PENDING);\n }\n\n this._firstPageCapability.promise.then(() => {\n // If the document was closed before searching began, or if the search\n // operation was relevant for a previously opened document, do nothing.\n if (\n !this._pdfDocument ||\n (pdfDocument && this._pdfDocument !== pdfDocument)\n ) {\n return;\n }\n this._extractText();\n\n const findbarClosed = !this._highlightMatches;\n const pendingTimeout = !!this._findTimeout;\n\n if (this._findTimeout) {\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n }\n if (cmd === \"find\") {\n // Trigger the find action with a small delay to avoid starting the\n // search when the user is still typing (saving resources).\n this._findTimeout = setTimeout(() => {\n this._nextMatch();\n this._findTimeout = null;\n }, FIND_TIMEOUT);\n } else if (this._dirtyMatch) {\n // Immediately trigger searching for non-'find' operations, when the\n // current state needs to be reset and matches re-calculated.\n this._nextMatch();\n } else if (cmd === \"findagain\") {\n this._nextMatch();\n\n // When the findbar was previously closed, and `highlightAll` is set,\n // ensure that the matches on all active pages are highlighted again.\n if (findbarClosed && this._state.highlightAll) {\n this._updateAllPages();\n }\n } else if (cmd === \"findhighlightallchange\") {\n // If there was a pending search operation, synchronously trigger a new\n // search *first* to ensure that the correct matches are highlighted.\n if (pendingTimeout) {\n this._nextMatch();\n } else {\n this._highlightMatches = true;\n }\n this._updateAllPages(); // Update the highlighting on all active pages.\n } else {\n this._nextMatch();\n }\n });\n }\n\n scrollMatchIntoView({\n element = null,\n selectedLeft = 0,\n pageIndex = -1,\n matchIndex = -1,\n }) {\n if (!this._scrollMatches || !element) {\n return;\n } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {\n return;\n } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {\n return;\n }\n this._scrollMatches = false; // Ensure that scrolling only happens once.\n\n const spot = {\n top: MATCH_SCROLL_OFFSET_TOP,\n left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT,\n };\n scrollIntoView(element, spot, /* scrollMatches = */ true);\n }\n\n _reset() {\n this._highlightMatches = false;\n this._scrollMatches = false;\n this._pdfDocument = null;\n this._pageMatches = [];\n this._pageMatchesLength = [];\n this._state = null;\n // Currently selected match.\n this._selected = {\n pageIdx: -1,\n matchIdx: -1,\n };\n // Where the find algorithm currently is in the document.\n this._offset = {\n pageIdx: null,\n matchIdx: null,\n wrapped: false,\n };\n this._extractTextPromises = [];\n this._pageContents = []; // Stores the normalized text for each page.\n this._pageDiffs = [];\n this._matchesCountTotal = 0;\n this._pagesToSearch = null;\n this._pendingFindMatches = new Set();\n this._resumePageIdx = null;\n this._dirtyMatch = false;\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n\n this._firstPageCapability = createPromiseCapability();\n }\n\n /**\n * @type {string} The (current) normalized search query.\n */\n get _query() {\n if (this._state.query !== this._rawQuery) {\n this._rawQuery = this._state.query;\n [this._normalizedQuery] = normalize(this._state.query);\n }\n return this._normalizedQuery;\n }\n\n _shouldDirtyMatch(cmd, state) {\n // When the search query changes, regardless of the actual search command\n // used, always re-calculate matches to avoid errors (fixes bug 1030622).\n if (state.query !== this._state.query) {\n return true;\n }\n switch (cmd) {\n case \"findagain\":\n const pageNumber = this._selected.pageIdx + 1;\n const linkService = this._linkService;\n // Only treat a 'findagain' event as a new search operation when it's\n // *absolutely* certain that the currently selected match is no longer\n // visible, e.g. as a result of the user scrolling in the document.\n //\n // NOTE: If only a simple `this._linkService.page` check was used here,\n // there's a risk that consecutive 'findagain' operations could \"skip\"\n // over matches at the top/bottom of pages thus making them completely\n // inaccessible when there's multiple pages visible in the viewer.\n if (\n pageNumber >= 1 &&\n pageNumber <= linkService.pagesCount &&\n pageNumber !== linkService.page &&\n !linkService.isPageVisible(pageNumber)\n ) {\n return true;\n }\n return false;\n case \"findhighlightallchange\":\n return false;\n }\n return true;\n }\n\n /**\n * Helper for multi-term search that fills the `matchesWithLength` array\n * and handles cases where one search term includes another search term (for\n * example, \"tamed tame\" or \"this is\"). It looks for intersecting terms in\n * the `matches` and keeps elements with a longer match length.\n */\n _prepareMatches(matchesWithLength, matches, matchesLength) {\n function isSubTerm(currentIndex) {\n const currentElem = matchesWithLength[currentIndex];\n const nextElem = matchesWithLength[currentIndex + 1];\n\n // Check for cases like \"TAMEd TAME\".\n if (\n currentIndex < matchesWithLength.length - 1 &&\n currentElem.match === nextElem.match\n ) {\n currentElem.skipped = true;\n return true;\n }\n\n // Check for cases like \"thIS IS\".\n for (let i = currentIndex - 1; i >= 0; i--) {\n const prevElem = matchesWithLength[i];\n if (prevElem.skipped) {\n continue;\n }\n if (prevElem.match + prevElem.matchLength < currentElem.match) {\n break;\n }\n if (\n prevElem.match + prevElem.matchLength >=\n currentElem.match + currentElem.matchLength\n ) {\n currentElem.skipped = true;\n return true;\n }\n }\n return false;\n }\n\n // Sort the array of `{ match: <match>, matchLength: <matchLength> }`\n // objects on increasing index first and on the length otherwise.\n matchesWithLength.sort(function (a, b) {\n return a.match === b.match\n ? a.matchLength - b.matchLength\n : a.match - b.match;\n });\n for (let i = 0, len = matchesWithLength.length; i < len; i++) {\n if (isSubTerm(i)) {\n continue;\n }\n matches.push(matchesWithLength[i].match);\n matchesLength.push(matchesWithLength[i].matchLength);\n }\n }\n\n /**\n * Determine if the search query constitutes a \"whole word\", by comparing the\n * first/last character type with the preceding/following character type.\n */\n _isEntireWord(content, startIdx, length) {\n if (startIdx > 0) {\n const first = content.charCodeAt(startIdx);\n const limit = content.charCodeAt(startIdx - 1);\n if (getCharacterType(first) === getCharacterType(limit)) {\n return false;\n }\n }\n const endIdx = startIdx + length - 1;\n if (endIdx < content.length - 1) {\n const last = content.charCodeAt(endIdx);\n const limit = content.charCodeAt(endIdx + 1);\n if (getCharacterType(last) === getCharacterType(limit)) {\n return false;\n }\n }\n return true;\n }\n\n _calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord) {\n const matches = [],\n matchesLength = [];\n const queryLen = query.length;\n\n let matchIdx = -queryLen;\n while (true) {\n matchIdx = pageContent.indexOf(query, matchIdx + queryLen);\n if (matchIdx === -1) {\n break;\n }\n if (entireWord && !this._isEntireWord(pageContent, matchIdx, queryLen)) {\n continue;\n }\n const originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs),\n matchEnd = matchIdx + queryLen - 1,\n originalQueryLen =\n getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1;\n\n matches.push(originalMatchIdx);\n matchesLength.push(originalQueryLen);\n }\n this._pageMatches[pageIndex] = matches;\n this._pageMatchesLength[pageIndex] = matchesLength;\n }\n\n _calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord) {\n const matchesWithLength = [];\n\n // Divide the query into pieces and search for text in each piece.\n const queryArray = query.match(/\\S+/g);\n for (let i = 0, len = queryArray.length; i < len; i++) {\n const subquery = queryArray[i];\n const subqueryLen = subquery.length;\n\n let matchIdx = -subqueryLen;\n while (true) {\n matchIdx = pageContent.indexOf(subquery, matchIdx + subqueryLen);\n if (matchIdx === -1) {\n break;\n }\n if (\n entireWord &&\n !this._isEntireWord(pageContent, matchIdx, subqueryLen)\n ) {\n continue;\n }\n const originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs),\n matchEnd = matchIdx + subqueryLen - 1,\n originalQueryLen =\n getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1;\n\n // Other searches do not, so we store the length.\n matchesWithLength.push({\n match: originalMatchIdx,\n matchLength: originalQueryLen,\n skipped: false,\n });\n }\n }\n\n // Prepare arrays for storing the matches.\n this._pageMatchesLength[pageIndex] = [];\n this._pageMatches[pageIndex] = [];\n\n // Sort `matchesWithLength`, remove intersecting terms and put the result\n // into the two arrays.\n this._prepareMatches(\n matchesWithLength,\n this._pageMatches[pageIndex],\n this._pageMatchesLength[pageIndex]\n );\n }\n\n _calculateMatch(pageIndex) {\n let pageContent = this._pageContents[pageIndex];\n const pageDiffs = this._pageDiffs[pageIndex];\n let query = this._query;\n const { caseSensitive, entireWord, phraseSearch } = this._state;\n\n if (query.length === 0) {\n // Do nothing: the matches should be wiped out already.\n return;\n }\n\n if (!caseSensitive) {\n pageContent = pageContent.toLowerCase();\n query = query.toLowerCase();\n }\n\n if (phraseSearch) {\n this._calculatePhraseMatch(\n query,\n pageIndex,\n pageContent,\n pageDiffs,\n entireWord\n );\n } else {\n this._calculateWordMatch(\n query,\n pageIndex,\n pageContent,\n pageDiffs,\n entireWord\n );\n }\n\n // When `highlightAll` is set, ensure that the matches on previously\n // rendered (and still active) pages are correctly highlighted.\n if (this._state.highlightAll) {\n this._updatePage(pageIndex);\n }\n if (this._resumePageIdx === pageIndex) {\n this._resumePageIdx = null;\n this._nextPageMatch();\n }\n\n // Update the match count.\n const pageMatchesCount = this._pageMatches[pageIndex].length;\n if (pageMatchesCount > 0) {\n this._matchesCountTotal += pageMatchesCount;\n this._updateUIResultsCount();\n }\n }\n\n _extractText() {\n // Perform text extraction once if this method is called multiple times.\n if (this._extractTextPromises.length > 0) {\n return;\n }\n\n let promise = Promise.resolve();\n for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {\n const extractTextCapability = createPromiseCapability();\n this._extractTextPromises[i] = extractTextCapability.promise;\n\n promise = promise.then(() => {\n return this._pdfDocument\n .getPage(i + 1)\n .then(pdfPage => {\n return pdfPage.getTextContent({\n normalizeWhitespace: true,\n });\n })\n .then(\n textContent => {\n const textItems = textContent.items;\n const strBuf = [];\n\n for (let j = 0, jj = textItems.length; j < jj; j++) {\n strBuf.push(textItems[j].str);\n }\n\n // Store the normalized page content (text items) as one string.\n [this._pageContents[i], this._pageDiffs[i]] = normalize(\n strBuf.join(\"\")\n );\n extractTextCapability.resolve(i);\n },\n reason => {\n console.error(\n `Unable to get text content for page ${i + 1}`,\n reason\n );\n // Page error -- assuming no text content.\n this._pageContents[i] = \"\";\n this._pageDiffs[i] = null;\n extractTextCapability.resolve(i);\n }\n );\n });\n }\n }\n\n _updatePage(index) {\n if (this._scrollMatches && this._selected.pageIdx === index) {\n // If the page is selected, scroll the page into view, which triggers\n // rendering the page, which adds the text layer. Once the text layer\n // is built, it will attempt to scroll the selected match into view.\n this._linkService.page = index + 1;\n }\n\n this._eventBus.dispatch(\"updatetextlayermatches\", {\n source: this,\n pageIndex: index,\n });\n }\n\n _updateAllPages() {\n this._eventBus.dispatch(\"updatetextlayermatches\", {\n source: this,\n pageIndex: -1,\n });\n }\n\n _nextMatch() {\n const previous = this._state.findPrevious;\n const currentPageIndex = this._linkService.page - 1;\n const numPages = this._linkService.pagesCount;\n\n this._highlightMatches = true;\n\n if (this._dirtyMatch) {\n // Need to recalculate the matches, reset everything.\n this._dirtyMatch = false;\n this._selected.pageIdx = this._selected.matchIdx = -1;\n this._offset.pageIdx = currentPageIndex;\n this._offset.matchIdx = null;\n this._offset.wrapped = false;\n this._resumePageIdx = null;\n this._pageMatches.length = 0;\n this._pageMatchesLength.length = 0;\n this._matchesCountTotal = 0;\n\n this._updateAllPages(); // Wipe out any previously highlighted matches.\n\n for (let i = 0; i < numPages; i++) {\n // Start finding the matches as soon as the text is extracted.\n if (this._pendingFindMatches.has(i)) {\n continue;\n }\n this._pendingFindMatches.add(i);\n this._extractTextPromises[i].then(pageIdx => {\n this._pendingFindMatches.delete(pageIdx);\n this._calculateMatch(pageIdx);\n });\n }\n }\n\n // If there's no query there's no point in searching.\n if (this._query === \"\") {\n this._updateUIState(FindState.FOUND);\n return;\n }\n // If we're waiting on a page, we return since we can't do anything else.\n if (this._resumePageIdx) {\n return;\n }\n\n const offset = this._offset;\n // Keep track of how many pages we should maximally iterate through.\n this._pagesToSearch = numPages;\n // If there's already a `matchIdx` that means we are iterating through a\n // page's matches.\n if (offset.matchIdx !== null) {\n const numPageMatches = this._pageMatches[offset.pageIdx].length;\n if (\n (!previous && offset.matchIdx + 1 < numPageMatches) ||\n (previous && offset.matchIdx > 0)\n ) {\n // The simple case; we just have advance the matchIdx to select\n // the next match on the page.\n offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;\n this._updateMatch(/* found = */ true);\n return;\n }\n // We went beyond the current page's matches, so we advance to\n // the next page.\n this._advanceOffsetPage(previous);\n }\n // Start searching through the page.\n this._nextPageMatch();\n }\n\n _matchesReady(matches) {\n const offset = this._offset;\n const numMatches = matches.length;\n const previous = this._state.findPrevious;\n\n if (numMatches) {\n // There were matches for the page, so initialize `matchIdx`.\n offset.matchIdx = previous ? numMatches - 1 : 0;\n this._updateMatch(/* found = */ true);\n return true;\n }\n // No matches, so attempt to search the next page.\n this._advanceOffsetPage(previous);\n if (offset.wrapped) {\n offset.matchIdx = null;\n if (this._pagesToSearch < 0) {\n // No point in wrapping again, there were no matches.\n this._updateMatch(/* found = */ false);\n // While matches were not found, searching for a page\n // with matches should nevertheless halt.\n return true;\n }\n }\n // Matches were not found (and searching is not done).\n return false;\n }\n\n _nextPageMatch() {\n if (this._resumePageIdx !== null) {\n console.error(\"There can only be one pending page.\");\n }\n\n let matches = null;\n do {\n const pageIdx = this._offset.pageIdx;\n matches = this._pageMatches[pageIdx];\n if (!matches) {\n // The matches don't exist yet for processing by `_matchesReady`,\n // so set a resume point for when they do exist.\n this._resumePageIdx = pageIdx;\n break;\n }\n } while (!this._matchesReady(matches));\n }\n\n _advanceOffsetPage(previous) {\n const offset = this._offset;\n const numPages = this._linkService.pagesCount;\n offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;\n offset.matchIdx = null;\n\n this._pagesToSearch--;\n\n if (offset.pageIdx >= numPages || offset.pageIdx < 0) {\n offset.pageIdx = previous ? numPages - 1 : 0;\n offset.wrapped = true;\n }\n }\n\n _updateMatch(found = false) {\n let state = FindState.NOT_FOUND;\n const wrapped = this._offset.wrapped;\n this._offset.wrapped = false;\n\n if (found) {\n const previousPage = this._selected.pageIdx;\n this._selected.pageIdx = this._offset.pageIdx;\n this._selected.matchIdx = this._offset.matchIdx;\n state = wrapped ? FindState.WRAPPED : FindState.FOUND;\n\n // Update the currently selected page to wipe out any selected matches.\n if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {\n this._updatePage(previousPage);\n }\n }\n\n this._updateUIState(state, this._state.findPrevious);\n if (this._selected.pageIdx !== -1) {\n // Ensure that the match will be scrolled into view.\n this._scrollMatches = true;\n\n this._updatePage(this._selected.pageIdx);\n }\n }\n\n _onFindBarClose(evt) {\n const pdfDocument = this._pdfDocument;\n // Since searching is asynchronous, ensure that the removal of highlighted\n // matches (from the UI) is async too such that the 'updatetextlayermatches'\n // events will always be dispatched in the expected order.\n this._firstPageCapability.promise.then(() => {\n // Only update the UI if the document is open, and is the current one.\n if (\n !this._pdfDocument ||\n (pdfDocument && this._pdfDocument !== pdfDocument)\n ) {\n return;\n }\n // Ensure that a pending, not yet started, search operation is aborted.\n if (this._findTimeout) {\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n }\n // Abort any long running searches, to avoid a match being scrolled into\n // view *after* the findbar has been closed. In this case `this._offset`\n // will most likely differ from `this._selected`, hence we also ensure\n // that any new search operation will always start with a clean slate.\n if (this._resumePageIdx) {\n this._resumePageIdx = null;\n this._dirtyMatch = true;\n }\n // Avoid the UI being in a pending state when the findbar is re-opened.\n this._updateUIState(FindState.FOUND);\n\n this._highlightMatches = false;\n this._updateAllPages(); // Wipe out any previously highlighted matches.\n });\n }\n\n _requestMatchesCount() {\n const { pageIdx, matchIdx } = this._selected;\n let current = 0,\n total = this._matchesCountTotal;\n if (matchIdx !== -1) {\n for (let i = 0; i < pageIdx; i++) {\n current += this._pageMatches[i]?.length || 0;\n }\n current += matchIdx + 1;\n }\n // When searching starts, this method may be called before the `pageMatches`\n // have been counted (in `_calculateMatch`). Ensure that the UI won't show\n // temporarily broken state when the active find result doesn't make sense.\n if (current < 1 || current > total) {\n current = total = 0;\n }\n return { current, total };\n }\n\n _updateUIResultsCount() {\n this._eventBus.dispatch(\"updatefindmatchescount\", {\n source: this,\n matchesCount: this._requestMatchesCount(),\n });\n }\n\n _updateUIState(state, previous) {\n this._eventBus.dispatch(\"updatefindcontrolstate\", {\n source: this,\n state,\n previous,\n matchesCount: this._requestMatchesCount(),\n rawQuery: this._state?.query ?? null,\n });\n }\n}\n\nexport { FindState, PDFFindController };\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 CharacterType = {\n SPACE: 0,\n ALPHA_LETTER: 1,\n PUNCT: 2,\n HAN_LETTER: 3,\n KATAKANA_LETTER: 4,\n HIRAGANA_LETTER: 5,\n HALFWIDTH_KATAKANA_LETTER: 6,\n THAI_LETTER: 7,\n};\n\nfunction isAlphabeticalScript(charCode) {\n return charCode < 0x2e80;\n}\n\nfunction isAscii(charCode) {\n return (charCode & 0xff80) === 0;\n}\n\nfunction isAsciiAlpha(charCode) {\n return (\n (charCode >= /* a = */ 0x61 && charCode <= /* z = */ 0x7a) ||\n (charCode >= /* A = */ 0x41 && charCode <= /* Z = */ 0x5a)\n );\n}\n\nfunction isAsciiDigit(charCode) {\n return charCode >= /* 0 = */ 0x30 && charCode <= /* 9 = */ 0x39;\n}\n\nfunction isAsciiSpace(charCode) {\n return (\n charCode === /* SPACE = */ 0x20 ||\n charCode === /* TAB = */ 0x09 ||\n charCode === /* CR = */ 0x0d ||\n charCode === /* LF = */ 0x0a\n );\n}\n\nfunction isHan(charCode) {\n return (\n (charCode >= 0x3400 && charCode <= 0x9fff) ||\n (charCode >= 0xf900 && charCode <= 0xfaff)\n );\n}\n\nfunction isKatakana(charCode) {\n return charCode >= 0x30a0 && charCode <= 0x30ff;\n}\n\nfunction isHiragana(charCode) {\n return charCode >= 0x3040 && charCode <= 0x309f;\n}\n\nfunction isHalfwidthKatakana(charCode) {\n return charCode >= 0xff60 && charCode <= 0xff9f;\n}\n\nfunction isThai(charCode) {\n return (charCode & 0xff80) === 0x0e00;\n}\n\n/**\n * This function is based on the word-break detection implemented in:\n * https://hg.mozilla.org/mozilla-central/file/tip/intl/lwbrk/WordBreaker.cpp\n */\nfunction getCharacterType(charCode) {\n if (isAlphabeticalScript(charCode)) {\n if (isAscii(charCode)) {\n if (isAsciiSpace(charCode)) {\n return CharacterType.SPACE;\n } else if (\n isAsciiAlpha(charCode) ||\n isAsciiDigit(charCode) ||\n charCode === /* UNDERSCORE = */ 0x5f\n ) {\n return CharacterType.ALPHA_LETTER;\n }\n return CharacterType.PUNCT;\n } else if (isThai(charCode)) {\n return CharacterType.THAI_LETTER;\n } else if (charCode === /* NBSP = */ 0xa0) {\n return CharacterType.SPACE;\n }\n return CharacterType.ALPHA_LETTER;\n }\n\n if (isHan(charCode)) {\n return CharacterType.HAN_LETTER;\n } else if (isKatakana(charCode)) {\n return CharacterType.KATAKANA_LETTER;\n } else if (isHiragana(charCode)) {\n return CharacterType.HIRAGANA_LETTER;\n } else if (isHalfwidthKatakana(charCode)) {\n return CharacterType.HALFWIDTH_KATAKANA_LETTER;\n }\n return CharacterType.ALPHA_LETTER;\n}\n\nexport { CharacterType, getCharacterType };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n isValidRotation,\n parseQueryString,\n PresentationModeState,\n waitOnEventOrTimeout,\n} from \"./ui_utils.js\";\n\n// Heuristic value used when force-resetting `this._blockHashChange`.\nconst HASH_CHANGE_TIMEOUT = 1000; // milliseconds\n// Heuristic value used when adding the current position to the browser history.\nconst POSITION_UPDATED_THRESHOLD = 50;\n// Heuristic value used when adding a temporary position to the browser history.\nconst UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds\n\n/**\n * @typedef {Object} PDFHistoryOptions\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * @typedef {Object} InitializeParameters\n * @property {string} fingerprint - The PDF document's unique fingerprint.\n * @property {boolean} [resetHistory] - Reset the browsing history.\n * @property {boolean} [updateUrl] - Attempt to update the document URL, with\n * the current hash, when pushing/replacing browser history entries.\n */\n\n/**\n * @typedef {Object} PushParameters\n * @property {string} [namedDest] - The named destination. If absent, a\n * stringified version of `explicitDest` is used.\n * @property {Array} explicitDest - The explicit destination array.\n * @property {number} pageNumber - The page to which the destination points.\n */\n\nfunction getCurrentHash() {\n return document.location.hash;\n}\n\nclass PDFHistory {\n /**\n * @param {PDFHistoryOptions} options\n */\n constructor({ linkService, eventBus }) {\n this.linkService = linkService;\n this.eventBus = eventBus;\n\n this._initialized = false;\n this._fingerprint = \"\";\n this.reset();\n\n this._boundEvents = null;\n this._isViewerInPresentationMode = false;\n // Ensure that we don't miss either a 'presentationmodechanged' or a\n // 'pagesinit' event, by registering the listeners immediately.\n this.eventBus._on(\"presentationmodechanged\", evt => {\n this._isViewerInPresentationMode =\n evt.state !== PresentationModeState.NORMAL;\n });\n this.eventBus._on(\"pagesinit\", () => {\n this._isPagesLoaded = false;\n\n this.eventBus._on(\n \"pagesloaded\",\n evt => {\n this._isPagesLoaded = !!evt.pagesCount;\n },\n { once: true }\n );\n });\n }\n\n /**\n * Initialize the history for the PDF document, using either the current\n * browser history entry or the document hash, whichever is present.\n * @param {InitializeParameters} params\n */\n initialize({ fingerprint, resetHistory = false, updateUrl = false }) {\n if (!fingerprint || typeof fingerprint !== \"string\") {\n console.error(\n 'PDFHistory.initialize: The \"fingerprint\" must be a non-empty string.'\n );\n return;\n }\n // Ensure that any old state is always reset upon initialization.\n if (this._initialized) {\n this.reset();\n }\n const reInitialized =\n this._fingerprint !== \"\" && this._fingerprint !== fingerprint;\n this._fingerprint = fingerprint;\n this._updateUrl = updateUrl === true;\n\n this._initialized = true;\n this._bindEvents();\n const state = window.history.state;\n\n this._popStateInProgress = false;\n this._blockHashChange = 0;\n this._currentHash = getCurrentHash();\n this._numPositionUpdates = 0;\n\n this._uid = this._maxUid = 0;\n this._destination = null;\n this._position = null;\n\n if (!this._isValidState(state, /* checkReload = */ true) || resetHistory) {\n const { hash, page, rotation } = this._parseCurrentHash(\n /* checkNameddest = */ true\n );\n\n if (!hash || reInitialized || resetHistory) {\n // Ensure that the browser history is reset on PDF document load.\n this._pushOrReplaceState(null, /* forceReplace = */ true);\n return;\n }\n // Ensure that the browser history is initialized correctly when\n // the document hash is present on PDF document load.\n this._pushOrReplaceState(\n { hash, page, rotation },\n /* forceReplace = */ true\n );\n return;\n }\n\n // The browser history contains a valid entry, ensure that the history is\n // initialized correctly on PDF document load.\n const destination = state.destination;\n this._updateInternalState(\n destination,\n state.uid,\n /* removeTemporary = */ true\n );\n\n if (destination.rotation !== undefined) {\n this._initialRotation = destination.rotation;\n }\n if (destination.dest) {\n this._initialBookmark = JSON.stringify(destination.dest);\n\n // If the history is updated, e.g. through the user changing the hash,\n // before the initial destination has become visible, then we do *not*\n // want to potentially add `this._position` to the browser history.\n this._destination.page = null;\n } else if (destination.hash) {\n this._initialBookmark = destination.hash;\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this._initialBookmark = `page=${destination.page}`;\n }\n }\n\n /**\n * Reset the current `PDFHistory` instance, and consequently prevent any\n * further updates and/or navigation of the browser history.\n */\n reset() {\n if (this._initialized) {\n this._pageHide(); // Simulate a 'pagehide' event when resetting.\n\n this._initialized = false;\n this._unbindEvents();\n }\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n this._initialBookmark = null;\n this._initialRotation = null;\n }\n\n /**\n * Push an internal destination to the browser history.\n * @param {PushParameters}\n */\n push({ namedDest = null, explicitDest, pageNumber }) {\n if (!this._initialized) {\n return;\n }\n if (namedDest && typeof namedDest !== \"string\") {\n console.error(\n \"PDFHistory.push: \" +\n `\"${namedDest}\" is not a valid namedDest parameter.`\n );\n return;\n } else if (!Array.isArray(explicitDest)) {\n console.error(\n \"PDFHistory.push: \" +\n `\"${explicitDest}\" is not a valid explicitDest parameter.`\n );\n return;\n } else if (!this._isValidPage(pageNumber)) {\n // Allow an unset `pageNumber` if and only if the history is still empty;\n // please refer to the `this._destination.page = null;` comment above.\n if (pageNumber !== null || this._destination) {\n console.error(\n \"PDFHistory.push: \" +\n `\"${pageNumber}\" is not a valid pageNumber parameter.`\n );\n return;\n }\n }\n\n const hash = namedDest || JSON.stringify(explicitDest);\n if (!hash) {\n // The hash *should* never be undefined, but if that were to occur,\n // avoid any possible issues by not updating the browser history.\n return;\n }\n\n let forceReplace = false;\n if (\n this._destination &&\n (isDestHashesEqual(this._destination.hash, hash) ||\n isDestArraysEqual(this._destination.dest, explicitDest))\n ) {\n // When the new destination is identical to `this._destination`, and\n // its `page` is undefined, replace the current browser history entry.\n // NOTE: This can only occur if `this._destination` was set either:\n // - through the document hash being specified on load.\n // - through the user changing the hash of the document.\n if (this._destination.page) {\n return;\n }\n forceReplace = true;\n }\n if (this._popStateInProgress && !forceReplace) {\n return;\n }\n\n this._pushOrReplaceState(\n {\n dest: explicitDest,\n hash,\n page: pageNumber,\n rotation: this.linkService.rotation,\n },\n forceReplace\n );\n\n if (!this._popStateInProgress) {\n // Prevent the browser history from updating while the new destination is\n // being scrolled into view, to avoid potentially inconsistent state.\n this._popStateInProgress = true;\n // We defer the resetting of `this._popStateInProgress`, to account for\n // e.g. zooming occurring when the new destination is being navigated to.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n\n /**\n * Push a page to the browser history; generally the `push` method should be\n * used instead.\n * @param {number} pageNumber\n */\n pushPage(pageNumber) {\n if (!this._initialized) {\n return;\n }\n if (!this._isValidPage(pageNumber)) {\n console.error(\n `PDFHistory.pushPage: \"${pageNumber}\" is not a valid page number.`\n );\n return;\n }\n\n if (this._destination?.page === pageNumber) {\n // When the new page is identical to the one in `this._destination`, we\n // don't want to add a potential duplicate entry in the browser history.\n return;\n }\n if (this._popStateInProgress) {\n return;\n }\n\n this._pushOrReplaceState({\n // Simulate an internal destination, for `this._tryPushCurrentPosition`:\n dest: null,\n hash: `page=${pageNumber}`,\n page: pageNumber,\n rotation: this.linkService.rotation,\n });\n\n if (!this._popStateInProgress) {\n // Prevent the browser history from updating while the new page is\n // being scrolled into view, to avoid potentially inconsistent state.\n this._popStateInProgress = true;\n // We defer the resetting of `this._popStateInProgress`, to account for\n // e.g. zooming occurring when the new page is being navigated to.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n\n /**\n * Push the current position to the browser history.\n */\n pushCurrentPosition() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n this._tryPushCurrentPosition();\n }\n\n /**\n * Go back one step in the browser history.\n * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n */\n back() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n const state = window.history.state;\n if (this._isValidState(state) && state.uid > 0) {\n window.history.back();\n }\n }\n\n /**\n * Go forward one step in the browser history.\n * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n */\n forward() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n const state = window.history.state;\n if (this._isValidState(state) && state.uid < this._maxUid) {\n window.history.forward();\n }\n }\n\n /**\n * @type {boolean} Indicating if the user is currently moving through the\n * browser history, useful e.g. for skipping the next 'hashchange' event.\n */\n get popStateInProgress() {\n return (\n this._initialized &&\n (this._popStateInProgress || this._blockHashChange > 0)\n );\n }\n\n get initialBookmark() {\n return this._initialized ? this._initialBookmark : null;\n }\n\n get initialRotation() {\n return this._initialized ? this._initialRotation : null;\n }\n\n /**\n * @private\n */\n _pushOrReplaceState(destination, forceReplace = false) {\n const shouldReplace = forceReplace || !this._destination;\n const newState = {\n fingerprint: this._fingerprint,\n uid: shouldReplace ? this._uid : this._uid + 1,\n destination,\n };\n\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n window.history.state?.chromecomState\n ) {\n // history.state.chromecomState is managed by chromecom.js.\n newState.chromecomState = window.history.state.chromecomState;\n }\n this._updateInternalState(destination, newState.uid);\n\n let newUrl;\n if (this._updateUrl && destination?.hash) {\n const baseUrl = document.location.href.split(\"#\")[0];\n // Prevent errors in Firefox.\n if (!baseUrl.startsWith(\"file://\")) {\n newUrl = `${baseUrl}#${destination.hash}`;\n }\n }\n if (shouldReplace) {\n window.history.replaceState(newState, \"\", newUrl);\n } else {\n window.history.pushState(newState, \"\", newUrl);\n }\n\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n top === window\n ) {\n // eslint-disable-next-line no-undef\n chrome.runtime.sendMessage(\"showPageAction\");\n }\n }\n\n /**\n * @private\n */\n _tryPushCurrentPosition(temporary = false) {\n if (!this._position) {\n return;\n }\n let position = this._position;\n if (temporary) {\n position = Object.assign(Object.create(null), this._position);\n position.temporary = true;\n }\n\n if (!this._destination) {\n this._pushOrReplaceState(position);\n return;\n }\n if (this._destination.temporary) {\n // Always replace a previous *temporary* position.\n this._pushOrReplaceState(position, /* forceReplace = */ true);\n return;\n }\n if (this._destination.hash === position.hash) {\n return; // The current document position has not changed.\n }\n if (\n !this._destination.page &&\n (POSITION_UPDATED_THRESHOLD <= 0 ||\n this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)\n ) {\n // `this._destination` was set through the user changing the hash of\n // the document. Do not add `this._position` to the browser history,\n // to avoid \"flooding\" it with lots of (nearly) identical entries,\n // since we cannot ensure that the document position has changed.\n return;\n }\n\n let forceReplace = false;\n if (\n this._destination.page >= position.first &&\n this._destination.page <= position.page\n ) {\n // When the `page` of `this._destination` is still visible, do not\n // update the browsing history when `this._destination` either:\n // - contains an internal destination, since in this case we\n // cannot ensure that the document position has actually changed.\n // - was set through the user changing the hash of the document.\n if (this._destination.dest !== undefined || !this._destination.first) {\n return;\n }\n // To avoid \"flooding\" the browser history, replace the current entry.\n forceReplace = true;\n }\n this._pushOrReplaceState(position, forceReplace);\n }\n\n /**\n * @private\n */\n _isValidPage(val) {\n return (\n Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount\n );\n }\n\n /**\n * @private\n */\n _isValidState(state, checkReload = false) {\n if (!state) {\n return false;\n }\n if (state.fingerprint !== this._fingerprint) {\n if (checkReload) {\n // Potentially accept the history entry, even if the fingerprints don't\n // match, when the viewer was reloaded (see issue 6847).\n if (\n typeof state.fingerprint !== \"string\" ||\n state.fingerprint.length !== this._fingerprint.length\n ) {\n return false;\n }\n const [perfEntry] = performance.getEntriesByType(\"navigation\");\n if (perfEntry?.type !== \"reload\") {\n return false;\n }\n } else {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return false;\n }\n }\n if (!Number.isInteger(state.uid) || state.uid < 0) {\n return false;\n }\n if (state.destination === null || typeof state.destination !== \"object\") {\n return false;\n }\n return true;\n }\n\n /**\n * @private\n */\n _updateInternalState(destination, uid, removeTemporary = false) {\n if (this._updateViewareaTimeout) {\n // When updating `this._destination`, make sure that we always wait for\n // the next 'updateviewarea' event before (potentially) attempting to\n // push the current position to the browser history.\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n if (removeTemporary && destination?.temporary) {\n // When the `destination` comes from the browser history,\n // we no longer treat it as a *temporary* position.\n delete destination.temporary;\n }\n this._destination = destination;\n this._uid = uid;\n this._maxUid = Math.max(this._maxUid, uid);\n // This should always be reset when `this._destination` is updated.\n this._numPositionUpdates = 0;\n }\n\n /**\n * @private\n */\n _parseCurrentHash(checkNameddest = false) {\n const hash = unescape(getCurrentHash()).substring(1);\n const params = parseQueryString(hash);\n\n const nameddest = params.nameddest || \"\";\n let page = params.page | 0;\n\n if (!this._isValidPage(page) || (checkNameddest && nameddest.length > 0)) {\n page = null;\n }\n return { hash, page, rotation: this.linkService.rotation };\n }\n\n /**\n * @private\n */\n _updateViewarea({ location }) {\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n\n this._position = {\n hash: this._isViewerInPresentationMode\n ? `page=${location.pageNumber}`\n : location.pdfOpenParams.substring(1),\n page: this.linkService.page,\n first: location.pageNumber,\n rotation: location.rotation,\n };\n\n if (this._popStateInProgress) {\n return;\n }\n\n if (\n POSITION_UPDATED_THRESHOLD > 0 &&\n this._isPagesLoaded &&\n this._destination &&\n !this._destination.page\n ) {\n // If the current destination was set through the user changing the hash\n // of the document, we will usually not try to push the current position\n // to the browser history; see `this._tryPushCurrentPosition()`.\n //\n // To prevent `this._tryPushCurrentPosition()` from effectively being\n // reduced to a no-op in this case, we will assume that the position\n // *did* in fact change if the 'updateviewarea' event was dispatched\n // more than `POSITION_UPDATED_THRESHOLD` times.\n this._numPositionUpdates++;\n }\n\n if (UPDATE_VIEWAREA_TIMEOUT > 0) {\n // When closing the browser, a 'pagehide' event will be dispatched which\n // *should* allow us to push the current position to the browser history.\n // In practice, it seems that the event is arriving too late in order for\n // the session history to be successfully updated.\n // (For additional details, please refer to the discussion in\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1153393.)\n //\n // To workaround this we attempt to *temporarily* add the current position\n // to the browser history only when the viewer is *idle*,\n // i.e. when scrolling and/or zooming does not occur.\n //\n // PLEASE NOTE: It's absolutely imperative that the browser history is\n // *not* updated too often, since that would render the viewer more or\n // less unusable. Hence the use of a timeout to delay the update until\n // the viewer has been idle for `UPDATE_VIEWAREA_TIMEOUT` milliseconds.\n this._updateViewareaTimeout = setTimeout(() => {\n if (!this._popStateInProgress) {\n this._tryPushCurrentPosition(/* temporary = */ true);\n }\n this._updateViewareaTimeout = null;\n }, UPDATE_VIEWAREA_TIMEOUT);\n }\n }\n\n /**\n * @private\n */\n _popState({ state }) {\n const newHash = getCurrentHash(),\n hashChanged = this._currentHash !== newHash;\n this._currentHash = newHash;\n\n if (\n (typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n state?.chromecomState &&\n !this._isValidState(state)) ||\n !state\n ) {\n // This case corresponds to the user changing the hash of the document.\n this._uid++;\n\n const { hash, page, rotation } = this._parseCurrentHash();\n this._pushOrReplaceState(\n { hash, page, rotation },\n /* forceReplace = */ true\n );\n return;\n }\n if (!this._isValidState(state)) {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return;\n }\n\n // Prevent the browser history from updating until the new destination,\n // as stored in the browser history, has been scrolled into view.\n this._popStateInProgress = true;\n\n if (hashChanged) {\n // When the hash changed, implying that the 'popstate' event will be\n // followed by a 'hashchange' event, then we do *not* want to update the\n // browser history when handling the 'hashchange' event (in web/app.js)\n // since that would *overwrite* the new destination navigated to below.\n //\n // To avoid accidentally disabling all future user-initiated hash changes,\n // if there's e.g. another 'hashchange' listener that stops the event\n // propagation, we make sure to always force-reset `this._blockHashChange`\n // after `HASH_CHANGE_TIMEOUT` milliseconds have passed.\n this._blockHashChange++;\n waitOnEventOrTimeout({\n target: window,\n name: \"hashchange\",\n delay: HASH_CHANGE_TIMEOUT,\n }).then(() => {\n this._blockHashChange--;\n });\n }\n\n // Navigate to the new destination.\n const destination = state.destination;\n this._updateInternalState(\n destination,\n state.uid,\n /* removeTemporary = */ true\n );\n\n if (isValidRotation(destination.rotation)) {\n this.linkService.rotation = destination.rotation;\n }\n if (destination.dest) {\n this.linkService.goToDestination(destination.dest);\n } else if (destination.hash) {\n this.linkService.setHash(destination.hash);\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this.linkService.page = destination.page;\n }\n\n // Since `PDFLinkService.goToDestination` is asynchronous, we thus defer the\n // resetting of `this._popStateInProgress` slightly.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n\n /**\n * @private\n */\n _pageHide() {\n // Attempt to push the `this._position` into the browser history when\n // navigating away from the document. This is *only* done if the history\n // is empty/temporary, since otherwise an existing browser history entry\n // will end up being overwritten (given that new entries cannot be pushed\n // into the browser history when the 'unload' event has already fired).\n if (!this._destination || this._destination.temporary) {\n this._tryPushCurrentPosition();\n }\n }\n\n /**\n * @private\n */\n _bindEvents() {\n if (this._boundEvents) {\n return; // The event listeners were already added.\n }\n this._boundEvents = {\n updateViewarea: this._updateViewarea.bind(this),\n popState: this._popState.bind(this),\n pageHide: this._pageHide.bind(this),\n };\n\n this.eventBus._on(\"updateviewarea\", this._boundEvents.updateViewarea);\n window.addEventListener(\"popstate\", this._boundEvents.popState);\n window.addEventListener(\"pagehide\", this._boundEvents.pageHide);\n }\n\n /**\n * @private\n */\n _unbindEvents() {\n if (!this._boundEvents) {\n return; // The event listeners were already removed.\n }\n this.eventBus._off(\"updateviewarea\", this._boundEvents.updateViewarea);\n window.removeEventListener(\"popstate\", this._boundEvents.popState);\n window.removeEventListener(\"pagehide\", this._boundEvents.pageHide);\n\n this._boundEvents = null;\n }\n}\n\nfunction isDestHashesEqual(destHash, pushHash) {\n if (typeof destHash !== \"string\" || typeof pushHash !== \"string\") {\n return false;\n }\n if (destHash === pushHash) {\n return true;\n }\n const { nameddest } = parseQueryString(destHash);\n if (nameddest === pushHash) {\n return true;\n }\n return false;\n}\n\nfunction isDestArraysEqual(firstDest, secondDest) {\n function isEntryEqual(first, second) {\n if (typeof first !== typeof second) {\n return false;\n }\n if (Array.isArray(first) || Array.isArray(second)) {\n return false;\n }\n if (first !== null && typeof first === \"object\" && second !== null) {\n if (Object.keys(first).length !== Object.keys(second).length) {\n return false;\n }\n for (const key in first) {\n if (!isEntryEqual(first[key], second[key])) {\n return false;\n }\n }\n return true;\n }\n return first === second || (Number.isNaN(first) && Number.isNaN(second));\n }\n\n if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {\n return false;\n }\n if (firstDest.length !== secondDest.length) {\n return false;\n }\n for (let i = 0, ii = firstDest.length; i < ii; i++) {\n if (!isEntryEqual(firstDest[i], secondDest[i])) {\n return false;\n }\n }\n return true;\n}\n\nexport { isDestArraysEqual, isDestHashesEqual, PDFHistory };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\n\n/**\n * @typedef {Object} PDFLayerViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IL10n} l10n - Localization service.\n */\n\n/**\n * @typedef {Object} PDFLayerViewerRenderParameters\n * @property {OptionalContentConfig|null} optionalContentConfig - An\n * {OptionalContentConfig} instance.\n * @property {PDFDocument} pdfDocument - A {PDFDocument} instance.\n */\n\nclass PDFLayerViewer extends BaseTreeViewer {\n constructor(options) {\n super(options);\n this.l10n = options.l10n;\n\n this.eventBus._on(\"resetlayers\", this._resetLayers.bind(this));\n this.eventBus._on(\"togglelayerstree\", this._toggleAllTreeItems.bind(this));\n }\n\n reset() {\n super.reset();\n this._optionalContentConfig = null;\n }\n\n /**\n * @private\n */\n _dispatchEvent(layersCount) {\n this.eventBus.dispatch(\"layersloaded\", {\n source: this,\n layersCount,\n });\n }\n\n /**\n * @private\n */\n _bindLink(element, { groupId, input }) {\n const setVisibility = () => {\n this._optionalContentConfig.setVisibility(groupId, input.checked);\n\n this.eventBus.dispatch(\"optionalcontentconfig\", {\n source: this,\n promise: Promise.resolve(this._optionalContentConfig),\n });\n };\n\n element.onclick = evt => {\n if (evt.target === input) {\n setVisibility();\n return true;\n } else if (evt.target !== element) {\n return true; // The target is the \"label\", which is handled above.\n }\n input.checked = !input.checked;\n setVisibility();\n return false;\n };\n }\n\n /**\n * @private\n */\n async _setNestedName(element, { name = null }) {\n if (typeof name === \"string\") {\n element.textContent = this._normalizeTextContent(name);\n return;\n }\n element.textContent = await this.l10n.get(\"additional_layers\");\n element.style.fontStyle = \"italic\";\n }\n\n /**\n * @private\n */\n _addToggleButton(div, { name = null }) {\n super._addToggleButton(div, /* hidden = */ name === null);\n }\n\n /**\n * @private\n */\n _toggleAllTreeItems() {\n if (!this._optionalContentConfig) {\n return;\n }\n super._toggleAllTreeItems();\n }\n\n /**\n * @param {PDFLayerViewerRenderParameters} params\n */\n render({ optionalContentConfig, pdfDocument }) {\n if (this._optionalContentConfig) {\n this.reset();\n }\n this._optionalContentConfig = optionalContentConfig || null;\n this._pdfDocument = pdfDocument || null;\n\n const groups = optionalContentConfig?.getOrder();\n if (!groups) {\n this._dispatchEvent(/* layersCount = */ 0);\n return;\n }\n\n const fragment = document.createDocumentFragment(),\n queue = [{ parent: fragment, groups }];\n let layersCount = 0,\n hasAnyNesting = false;\n while (queue.length > 0) {\n const levelData = queue.shift();\n for (const groupId of levelData.groups) {\n const div = document.createElement(\"div\");\n div.className = \"treeItem\";\n\n const element = document.createElement(\"a\");\n div.appendChild(element);\n\n if (typeof groupId === \"object\") {\n hasAnyNesting = true;\n this._addToggleButton(div, groupId);\n this._setNestedName(element, groupId);\n\n const itemsDiv = document.createElement(\"div\");\n itemsDiv.className = \"treeItems\";\n div.appendChild(itemsDiv);\n\n queue.push({ parent: itemsDiv, groups: groupId.order });\n } else {\n const group = optionalContentConfig.getGroup(groupId);\n\n const input = document.createElement(\"input\");\n this._bindLink(element, { groupId, input });\n input.type = \"checkbox\";\n input.id = groupId;\n input.checked = group.visible;\n\n const label = document.createElement(\"label\");\n label.setAttribute(\"for\", groupId);\n label.textContent = this._normalizeTextContent(group.name);\n\n element.appendChild(input);\n element.appendChild(label);\n\n layersCount++;\n }\n\n levelData.parent.appendChild(div);\n }\n }\n\n this._finishRendering(fragment, layersCount, hasAnyNesting);\n }\n\n /**\n * @private\n */\n async _resetLayers() {\n if (!this._optionalContentConfig) {\n return;\n }\n // Fetch the default optional content configuration...\n const optionalContentConfig =\n await this._pdfDocument.getOptionalContentConfig();\n\n this.eventBus.dispatch(\"optionalcontentconfig\", {\n source: this,\n promise: Promise.resolve(optionalContentConfig),\n });\n\n // ... and reset the sidebarView to the default state.\n this.render({\n optionalContentConfig,\n pdfDocument: this._pdfDocument,\n });\n }\n}\n\nexport { PDFLayerViewer };\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 { parseQueryString } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} PDFLinkServiceOptions\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} [externalLinkTarget] - Specifies the `target` attribute\n * for external links. Must use one of the values from {LinkTarget}.\n * Defaults to using no target.\n * @property {string} [externalLinkRel] - Specifies the `rel` attribute for\n * external links. Defaults to stripping the referrer.\n * @property {boolean} [ignoreDestinationZoom] - Ignores the zoom argument,\n * thus preserving the current zoom level in the viewer, when navigating\n * to internal destinations. The default value is `false`.\n */\n\n/**\n * Performs navigation functions inside PDF, such as opening specified page,\n * or destination.\n * @implements {IPDFLinkService}\n */\nclass PDFLinkService {\n /**\n * @param {PDFLinkServiceOptions} options\n */\n constructor({\n eventBus,\n externalLinkTarget = null,\n externalLinkRel = null,\n ignoreDestinationZoom = false,\n } = {}) {\n this.eventBus = eventBus;\n this.externalLinkTarget = externalLinkTarget;\n this.externalLinkRel = externalLinkRel;\n this.externalLinkEnabled = true;\n this._ignoreDestinationZoom = ignoreDestinationZoom;\n\n this.baseUrl = null;\n this.pdfDocument = null;\n this.pdfViewer = null;\n this.pdfHistory = null;\n\n this._pagesRefCache = null;\n }\n\n setDocument(pdfDocument, baseUrl = null) {\n this.baseUrl = baseUrl;\n this.pdfDocument = pdfDocument;\n this._pagesRefCache = Object.create(null);\n }\n\n setViewer(pdfViewer) {\n this.pdfViewer = pdfViewer;\n }\n\n setHistory(pdfHistory) {\n this.pdfHistory = pdfHistory;\n }\n\n /**\n * @type {number}\n */\n get pagesCount() {\n return this.pdfDocument ? this.pdfDocument.numPages : 0;\n }\n\n /**\n * @type {number}\n */\n get page() {\n return this.pdfViewer.currentPageNumber;\n }\n\n /**\n * @param {number} value\n */\n set page(value) {\n this.pdfViewer.currentPageNumber = value;\n }\n\n /**\n * @type {number}\n */\n get rotation() {\n return this.pdfViewer.pagesRotation;\n }\n\n /**\n * @param {number} value\n */\n set rotation(value) {\n this.pdfViewer.pagesRotation = value;\n }\n\n /**\n * @private\n */\n _goToDestinationHelper(rawDest, namedDest = null, explicitDest) {\n // Dest array looks like that: <page-ref> </XYZ|/FitXXX> <args..>\n const destRef = explicitDest[0];\n let pageNumber;\n\n if (typeof destRef === \"object\" && destRef !== null) {\n pageNumber = this._cachedPageNumber(destRef);\n\n if (pageNumber === null) {\n // Fetch the page reference if it's not yet available. This could\n // only occur during loading, before all pages have been resolved.\n this.pdfDocument\n .getPageIndex(destRef)\n .then(pageIndex => {\n this.cachePageRef(pageIndex + 1, destRef);\n this._goToDestinationHelper(rawDest, namedDest, explicitDest);\n })\n .catch(() => {\n console.error(\n `PDFLinkService._goToDestinationHelper: \"${destRef}\" is not ` +\n `a valid page reference, for dest=\"${rawDest}\".`\n );\n });\n return;\n }\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n } else {\n console.error(\n `PDFLinkService._goToDestinationHelper: \"${destRef}\" is not ` +\n `a valid destination reference, for dest=\"${rawDest}\".`\n );\n return;\n }\n if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n console.error(\n `PDFLinkService._goToDestinationHelper: \"${pageNumber}\" is not ` +\n `a valid page number, for dest=\"${rawDest}\".`\n );\n return;\n }\n\n if (this.pdfHistory) {\n // Update the browser history before scrolling the new destination into\n // view, to be able to accurately capture the current document position.\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.push({ namedDest, explicitDest, pageNumber });\n }\n\n this.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: explicitDest,\n ignoreDestinationZoom: this._ignoreDestinationZoom,\n });\n }\n\n /**\n * This method will, when available, also update the browser history.\n *\n * @param {string|Array} dest - The named, or explicit, PDF destination.\n */\n async goToDestination(dest) {\n if (!this.pdfDocument) {\n return;\n }\n let namedDest, explicitDest;\n if (typeof dest === \"string\") {\n namedDest = dest;\n explicitDest = await this.pdfDocument.getDestination(dest);\n } else {\n namedDest = null;\n explicitDest = await dest;\n }\n if (!Array.isArray(explicitDest)) {\n console.error(\n `PDFLinkService.goToDestination: \"${explicitDest}\" is not ` +\n `a valid destination array, for dest=\"${dest}\".`\n );\n return;\n }\n this._goToDestinationHelper(dest, namedDest, explicitDest);\n }\n\n /**\n * This method will, when available, also update the browser history.\n *\n * @param {number|string} val - The page number, or page label.\n */\n goToPage(val) {\n if (!this.pdfDocument) {\n return;\n }\n const pageNumber =\n (typeof val === \"string\" && this.pdfViewer.pageLabelToPageNumber(val)) ||\n val | 0;\n if (\n !(\n Number.isInteger(pageNumber) &&\n pageNumber > 0 &&\n pageNumber <= this.pagesCount\n )\n ) {\n console.error(`PDFLinkService.goToPage: \"${val}\" is not a valid page.`);\n return;\n }\n\n if (this.pdfHistory) {\n // Update the browser history before scrolling the new page into view,\n // to be able to accurately capture the current document position.\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.pushPage(pageNumber);\n }\n\n this.pdfViewer.scrollPageIntoView({ pageNumber });\n }\n\n /**\n * @param {string|Array} dest - The PDF destination object.\n * @returns {string} The hyperlink to the PDF object.\n */\n getDestinationHash(dest) {\n if (typeof dest === \"string\") {\n if (dest.length > 0) {\n return this.getAnchorUrl(\"#\" + escape(dest));\n }\n } else if (Array.isArray(dest)) {\n const str = JSON.stringify(dest);\n if (str.length > 0) {\n return this.getAnchorUrl(\"#\" + escape(str));\n }\n }\n return this.getAnchorUrl(\"\");\n }\n\n /**\n * Prefix the full url on anchor links to make sure that links are resolved\n * relative to the current URL instead of the one defined in <base href>.\n * @param {string} anchor - The anchor hash, including the #.\n * @returns {string} The hyperlink to the PDF object.\n */\n getAnchorUrl(anchor) {\n return (this.baseUrl || \"\") + anchor;\n }\n\n /**\n * @param {string} hash\n */\n setHash(hash) {\n if (!this.pdfDocument) {\n return;\n }\n let pageNumber, dest;\n if (hash.includes(\"=\")) {\n const params = parseQueryString(hash);\n if (\"search\" in params) {\n this.eventBus.dispatch(\"findfromurlhash\", {\n source: this,\n query: params.search.replace(/\"/g, \"\"),\n phraseSearch: params.phrase === \"true\",\n });\n }\n // borrowing syntax from \"Parameters for Opening PDF Files\"\n if (\"page\" in params) {\n pageNumber = params.page | 0 || 1;\n }\n if (\"zoom\" in params) {\n // Build the destination array.\n const zoomArgs = params.zoom.split(\",\"); // scale,left,top\n const zoomArg = zoomArgs[0];\n const zoomArgNumber = parseFloat(zoomArg);\n\n if (!zoomArg.includes(\"Fit\")) {\n // If the zoomArg is a number, it has to get divided by 100. If it's\n // a string, it should stay as it is.\n dest = [\n null,\n { name: \"XYZ\" },\n zoomArgs.length > 1 ? zoomArgs[1] | 0 : null,\n zoomArgs.length > 2 ? zoomArgs[2] | 0 : null,\n zoomArgNumber ? zoomArgNumber / 100 : zoomArg,\n ];\n } else {\n if (zoomArg === \"Fit\" || zoomArg === \"FitB\") {\n dest = [null, { name: zoomArg }];\n } else if (\n zoomArg === \"FitH\" ||\n zoomArg === \"FitBH\" ||\n zoomArg === \"FitV\" ||\n zoomArg === \"FitBV\"\n ) {\n dest = [\n null,\n { name: zoomArg },\n zoomArgs.length > 1 ? zoomArgs[1] | 0 : null,\n ];\n } else if (zoomArg === \"FitR\") {\n if (zoomArgs.length !== 5) {\n console.error(\n 'PDFLinkService.setHash: Not enough parameters for \"FitR\".'\n );\n } else {\n dest = [\n null,\n { name: zoomArg },\n zoomArgs[1] | 0,\n zoomArgs[2] | 0,\n zoomArgs[3] | 0,\n zoomArgs[4] | 0,\n ];\n }\n } else {\n console.error(\n `PDFLinkService.setHash: \"${zoomArg}\" is not ` +\n \"a valid zoom value.\"\n );\n }\n }\n }\n if (dest) {\n this.pdfViewer.scrollPageIntoView({\n pageNumber: pageNumber || this.page,\n destArray: dest,\n allowNegativeOffset: true,\n });\n } else if (pageNumber) {\n this.page = pageNumber; // simple page\n }\n if (\"pagemode\" in params) {\n this.eventBus.dispatch(\"pagemode\", {\n source: this,\n mode: params.pagemode,\n });\n }\n // Ensure that this parameter is *always* handled last, in order to\n // guarantee that it won't be overridden (e.g. by the \"page\" parameter).\n if (\"nameddest\" in params) {\n this.goToDestination(params.nameddest);\n }\n } else {\n // Named (or explicit) destination.\n dest = unescape(hash);\n try {\n dest = JSON.parse(dest);\n\n if (!Array.isArray(dest)) {\n // Avoid incorrectly rejecting a valid named destination, such as\n // e.g. \"4.3\" or \"true\", because `JSON.parse` converted its type.\n dest = dest.toString();\n }\n } catch (ex) {}\n\n if (typeof dest === \"string\" || isValidExplicitDestination(dest)) {\n this.goToDestination(dest);\n return;\n }\n console.error(\n `PDFLinkService.setHash: \"${unescape(hash)}\" is not ` +\n \"a valid destination.\"\n );\n }\n }\n\n /**\n * @param {string} action\n */\n executeNamedAction(action) {\n // See PDF reference, table 8.45 - Named action\n switch (action) {\n case \"GoBack\":\n if (this.pdfHistory) {\n this.pdfHistory.back();\n }\n break;\n\n case \"GoForward\":\n if (this.pdfHistory) {\n this.pdfHistory.forward();\n }\n break;\n\n case \"NextPage\":\n this.pdfViewer.nextPage();\n break;\n\n case \"PrevPage\":\n this.pdfViewer.previousPage();\n break;\n\n case \"LastPage\":\n this.page = this.pagesCount;\n break;\n\n case \"FirstPage\":\n this.page = 1;\n break;\n\n default:\n break; // No action according to spec\n }\n\n this.eventBus.dispatch(\"namedaction\", {\n source: this,\n action,\n });\n }\n\n /**\n * @param {number} pageNum - page number.\n * @param {Object} pageRef - reference to the page.\n */\n cachePageRef(pageNum, pageRef) {\n if (!pageRef) {\n return;\n }\n const refStr =\n pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;\n this._pagesRefCache[refStr] = pageNum;\n }\n\n /**\n * @private\n */\n _cachedPageNumber(pageRef) {\n const refStr =\n pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;\n return this._pagesRefCache?.[refStr] || null;\n }\n\n /**\n * @param {number} pageNumber\n */\n isPageVisible(pageNumber) {\n return this.pdfViewer.isPageVisible(pageNumber);\n }\n\n /**\n * @param {number} pageNumber\n */\n isPageCached(pageNumber) {\n return this.pdfViewer.isPageCached(pageNumber);\n }\n}\n\nfunction isValidExplicitDestination(dest) {\n if (!Array.isArray(dest)) {\n return false;\n }\n const destLength = dest.length;\n if (destLength < 2) {\n return false;\n }\n const page = dest[0];\n if (\n !(\n typeof page === \"object\" &&\n Number.isInteger(page.num) &&\n Number.isInteger(page.gen)\n ) &&\n !(Number.isInteger(page) && page >= 0)\n ) {\n return false;\n }\n const zoom = dest[1];\n if (!(typeof zoom === \"object\" && typeof zoom.name === \"string\")) {\n return false;\n }\n let allowNull = true;\n switch (zoom.name) {\n case \"XYZ\":\n if (destLength !== 5) {\n return false;\n }\n break;\n case \"Fit\":\n case \"FitB\":\n return destLength === 2;\n case \"FitH\":\n case \"FitBH\":\n case \"FitV\":\n case \"FitBV\":\n if (destLength !== 3) {\n return false;\n }\n break;\n case \"FitR\":\n if (destLength !== 6) {\n return false;\n }\n allowNull = false;\n break;\n default:\n return false;\n }\n for (let i = 2; i < destLength; i++) {\n const param = dest[i];\n if (!(typeof param === \"number\" || (allowNull && param === null))) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * @implements {IPDFLinkService}\n */\nclass SimpleLinkService {\n constructor() {\n this.externalLinkTarget = null;\n this.externalLinkRel = null;\n this.externalLinkEnabled = true;\n this._ignoreDestinationZoom = false;\n }\n\n /**\n * @type {number}\n */\n get pagesCount() {\n return 0;\n }\n\n /**\n * @type {number}\n */\n get page() {\n return 0;\n }\n\n /**\n * @param {number} value\n */\n set page(value) {}\n\n /**\n * @type {number}\n */\n get rotation() {\n return 0;\n }\n\n /**\n * @param {number} value\n */\n set rotation(value) {}\n\n /**\n * @param {string|Array} dest - The named, or explicit, PDF destination.\n */\n async goToDestination(dest) {}\n\n /**\n * @param {number|string} val - The page number, or page label.\n */\n goToPage(val) {}\n\n /**\n * @param dest - The PDF destination object.\n * @returns {string} The hyperlink to the PDF object.\n */\n getDestinationHash(dest) {\n return \"#\";\n }\n\n /**\n * @param hash - The PDF parameters/hash.\n * @returns {string} The hyperlink to the PDF object.\n */\n getAnchorUrl(hash) {\n return \"#\";\n }\n\n /**\n * @param {string} hash\n */\n setHash(hash) {}\n\n /**\n * @param {string} action\n */\n executeNamedAction(action) {}\n\n /**\n * @param {number} pageNum - page number.\n * @param {Object} pageRef - reference to the page.\n */\n cachePageRef(pageNum, pageRef) {}\n\n /**\n * @param {number} pageNumber\n */\n isPageVisible(pageNumber) {\n return true;\n }\n\n /**\n * @param {number} pageNumber\n */\n isPageCached(pageNumber) {\n return true;\n }\n}\n\nexport { PDFLinkService, SimpleLinkService };\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 addLinkAttributes,\n createPromiseCapability,\n LinkTarget,\n} from \"pdfjs-lib\";\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\nimport { SidebarView } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} PDFOutlineViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * @typedef {Object} PDFOutlineViewerRenderParameters\n * @property {Array|null} outline - An array of outline objects.\n * @property {PDFDocument} pdfDocument - A {PDFDocument} instance.\n */\n\nclass PDFOutlineViewer extends BaseTreeViewer {\n /**\n * @param {PDFOutlineViewerOptions} options\n */\n constructor(options) {\n super(options);\n this.linkService = options.linkService;\n\n this.eventBus._on(\"toggleoutlinetree\", this._toggleAllTreeItems.bind(this));\n this.eventBus._on(\n \"currentoutlineitem\",\n this._currentOutlineItem.bind(this)\n );\n\n this.eventBus._on(\"pagechanging\", evt => {\n this._currentPageNumber = evt.pageNumber;\n });\n this.eventBus._on(\"pagesloaded\", evt => {\n this._isPagesLoaded = !!evt.pagesCount;\n\n // If the capability is still pending, see the `_dispatchEvent`-method,\n // we know that the `currentOutlineItem`-button can be enabled here.\n if (\n this._currentOutlineItemCapability &&\n !this._currentOutlineItemCapability.settled\n ) {\n this._currentOutlineItemCapability.resolve(\n /* enabled = */ this._isPagesLoaded\n );\n }\n });\n this.eventBus._on(\"sidebarviewchanged\", evt => {\n this._sidebarView = evt.view;\n });\n }\n\n reset() {\n super.reset();\n this._outline = null;\n\n this._pageNumberToDestHashCapability = null;\n this._currentPageNumber = 1;\n this._isPagesLoaded = false;\n\n if (\n this._currentOutlineItemCapability &&\n !this._currentOutlineItemCapability.settled\n ) {\n this._currentOutlineItemCapability.resolve(/* enabled = */ false);\n }\n this._currentOutlineItemCapability = null;\n }\n\n /**\n * @private\n */\n _dispatchEvent(outlineCount) {\n this._currentOutlineItemCapability = createPromiseCapability();\n if (\n outlineCount === 0 ||\n this._pdfDocument?.loadingParams.disableAutoFetch\n ) {\n this._currentOutlineItemCapability.resolve(/* enabled = */ false);\n } else if (this._isPagesLoaded) {\n this._currentOutlineItemCapability.resolve(/* enabled = */ true);\n }\n\n this.eventBus.dispatch(\"outlineloaded\", {\n source: this,\n outlineCount,\n currentOutlineItemPromise: this._currentOutlineItemCapability.promise,\n });\n }\n\n /**\n * @private\n */\n _bindLink(element, { url, newWindow, dest }) {\n const { linkService } = this;\n\n if (url) {\n addLinkAttributes(element, {\n url,\n target: newWindow ? LinkTarget.BLANK : linkService.externalLinkTarget,\n rel: linkService.externalLinkRel,\n enabled: linkService.externalLinkEnabled,\n });\n return;\n }\n\n element.href = linkService.getDestinationHash(dest);\n element.onclick = evt => {\n this._updateCurrentTreeItem(evt.target.parentNode);\n\n if (dest) {\n linkService.goToDestination(dest);\n }\n return false;\n };\n }\n\n /**\n * @private\n */\n _setStyles(element, { bold, italic }) {\n if (bold) {\n element.style.fontWeight = \"bold\";\n }\n if (italic) {\n element.style.fontStyle = \"italic\";\n }\n }\n\n /**\n * @private\n */\n _addToggleButton(div, { count, items }) {\n let hidden = false;\n if (count < 0) {\n let totalCount = items.length;\n if (totalCount > 0) {\n const queue = [...items];\n while (queue.length > 0) {\n const { count: nestedCount, items: nestedItems } = queue.shift();\n if (nestedCount > 0 && nestedItems.length > 0) {\n totalCount += nestedItems.length;\n queue.push(...nestedItems);\n }\n }\n }\n if (Math.abs(count) === totalCount) {\n hidden = true;\n }\n }\n super._addToggleButton(div, hidden);\n }\n\n /**\n * @private\n */\n _toggleAllTreeItems() {\n if (!this._outline) {\n return;\n }\n super._toggleAllTreeItems();\n }\n\n /**\n * @param {PDFOutlineViewerRenderParameters} params\n */\n render({ outline, pdfDocument }) {\n if (this._outline) {\n this.reset();\n }\n this._outline = outline || null;\n this._pdfDocument = pdfDocument || null;\n\n if (!outline) {\n this._dispatchEvent(/* outlineCount = */ 0);\n return;\n }\n\n const fragment = document.createDocumentFragment();\n const queue = [{ parent: fragment, items: outline }];\n let outlineCount = 0,\n hasAnyNesting = false;\n while (queue.length > 0) {\n const levelData = queue.shift();\n for (const item of levelData.items) {\n const div = document.createElement(\"div\");\n div.className = \"treeItem\";\n\n const element = document.createElement(\"a\");\n this._bindLink(element, item);\n this._setStyles(element, item);\n element.textContent = this._normalizeTextContent(item.title);\n\n div.appendChild(element);\n\n if (item.items.length > 0) {\n hasAnyNesting = true;\n this._addToggleButton(div, item);\n\n const itemsDiv = document.createElement(\"div\");\n itemsDiv.className = \"treeItems\";\n div.appendChild(itemsDiv);\n\n queue.push({ parent: itemsDiv, items: item.items });\n }\n\n levelData.parent.appendChild(div);\n outlineCount++;\n }\n }\n\n this._finishRendering(fragment, outlineCount, hasAnyNesting);\n }\n\n /**\n * Find/highlight the current outline item, corresponding to the active page.\n * @private\n */\n async _currentOutlineItem() {\n if (!this._isPagesLoaded) {\n throw new Error(\"_currentOutlineItem: All pages have not been loaded.\");\n }\n if (!this._outline || !this._pdfDocument) {\n return;\n }\n\n const pageNumberToDestHash = await this._getPageNumberToDestHash(\n this._pdfDocument\n );\n if (!pageNumberToDestHash) {\n return;\n }\n this._updateCurrentTreeItem(/* treeItem = */ null);\n\n if (this._sidebarView !== SidebarView.OUTLINE) {\n return; // The outline view is no longer visible, hence do nothing.\n }\n // When there is no destination on the current page, always check the\n // previous ones in (reverse) order.\n for (let i = this._currentPageNumber; i > 0; i--) {\n const destHash = pageNumberToDestHash.get(i);\n if (!destHash) {\n continue;\n }\n const linkElement = this.container.querySelector(`a[href=\"${destHash}\"]`);\n if (!linkElement) {\n continue;\n }\n this._scrollToCurrentTreeItem(linkElement.parentNode);\n break;\n }\n }\n\n /**\n * To (significantly) simplify the overall implementation, we will only\n * consider *one* destination per page when finding/highlighting the current\n * outline item (similar to e.g. Adobe Reader); more specifically, we choose\n * the *first* outline item at the *lowest* level of the outline tree.\n * @private\n */\n async _getPageNumberToDestHash(pdfDocument) {\n if (this._pageNumberToDestHashCapability) {\n return this._pageNumberToDestHashCapability.promise;\n }\n this._pageNumberToDestHashCapability = createPromiseCapability();\n\n const pageNumberToDestHash = new Map(),\n pageNumberNesting = new Map();\n const queue = [{ nesting: 0, items: this._outline }];\n while (queue.length > 0) {\n const levelData = queue.shift(),\n currentNesting = levelData.nesting;\n for (const { dest, items } of levelData.items) {\n let explicitDest, pageNumber;\n if (typeof dest === \"string\") {\n explicitDest = await pdfDocument.getDestination(dest);\n\n if (pdfDocument !== this._pdfDocument) {\n return null; // The document was closed while the data resolved.\n }\n } else {\n explicitDest = dest;\n }\n if (Array.isArray(explicitDest)) {\n const [destRef] = explicitDest;\n\n if (typeof destRef === \"object\" && destRef !== null) {\n pageNumber = this.linkService._cachedPageNumber(destRef);\n\n if (!pageNumber) {\n try {\n pageNumber = (await pdfDocument.getPageIndex(destRef)) + 1;\n\n if (pdfDocument !== this._pdfDocument) {\n return null; // The document was closed while the data resolved.\n }\n this.linkService.cachePageRef(pageNumber, destRef);\n } catch (ex) {\n // Invalid page reference, ignore it and continue parsing.\n }\n }\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n }\n\n if (\n Number.isInteger(pageNumber) &&\n (!pageNumberToDestHash.has(pageNumber) ||\n currentNesting > pageNumberNesting.get(pageNumber))\n ) {\n const destHash = this.linkService.getDestinationHash(dest);\n pageNumberToDestHash.set(pageNumber, destHash);\n pageNumberNesting.set(pageNumber, currentNesting);\n }\n }\n\n if (items.length > 0) {\n queue.push({ nesting: currentNesting + 1, items });\n }\n }\n }\n\n this._pageNumberToDestHashCapability.resolve(\n pageNumberToDestHash.size > 0 ? pageNumberToDestHash : null\n );\n return this._pageNumberToDestHashCapability.promise;\n }\n}\n\nexport { PDFOutlineViewer };\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 { normalizeWheelEventDelta, PresentationModeState } from \"./ui_utils.js\";\n\nconst DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; // in ms\nconst DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms\nconst ACTIVE_SELECTOR = \"pdfPresentationMode\";\nconst CONTROLS_SELECTOR = \"pdfPresentationModeControls\";\nconst MOUSE_SCROLL_COOLDOWN_TIME = 50; // in ms\nconst PAGE_SWITCH_THRESHOLD = 0.1;\n\n// Number of CSS pixels for a movement to count as a swipe.\nconst SWIPE_MIN_DISTANCE_THRESHOLD = 50;\n\n// Swipe angle deviation from the x or y axis before it is not\n// considered a swipe in that direction any more.\nconst SWIPE_ANGLE_THRESHOLD = Math.PI / 6;\n\n/**\n * @typedef {Object} PDFPresentationModeOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {PDFViewer} pdfViewer - The document viewer.\n * @property {EventBus} eventBus - The application event bus.\n */\n\nclass PDFPresentationMode {\n /**\n * @param {PDFPresentationModeOptions} options\n */\n constructor({ container, pdfViewer, eventBus }) {\n this.container = container;\n this.pdfViewer = pdfViewer;\n this.eventBus = eventBus;\n\n this.active = false;\n this.args = null;\n this.contextMenuOpen = false;\n this.mouseScrollTimeStamp = 0;\n this.mouseScrollDelta = 0;\n this.touchSwipeState = null;\n }\n\n /**\n * Request the browser to enter fullscreen mode.\n * @returns {boolean} Indicating if the request was successful.\n */\n request() {\n if (this.switchInProgress || this.active || !this.pdfViewer.pagesCount) {\n return false;\n }\n this._addFullscreenChangeListeners();\n this._setSwitchInProgress();\n this._notifyStateChange();\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n if (this.container.requestFullscreen) {\n this.container.requestFullscreen();\n } else {\n return false;\n }\n } else {\n if (this.container.requestFullscreen) {\n this.container.requestFullscreen();\n } else if (this.container.mozRequestFullScreen) {\n this.container.mozRequestFullScreen();\n } else if (this.container.webkitRequestFullscreen) {\n this.container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);\n } else {\n return false;\n }\n }\n\n this.args = {\n page: this.pdfViewer.currentPageNumber,\n previousScale: this.pdfViewer.currentScaleValue,\n };\n\n return true;\n }\n\n /**\n * @private\n */\n _mouseWheel(evt) {\n if (!this.active) {\n return;\n }\n\n evt.preventDefault();\n\n const delta = normalizeWheelEventDelta(evt);\n const currentTime = Date.now();\n const storedTime = this.mouseScrollTimeStamp;\n\n // If we've already switched page, avoid accidentally switching again.\n if (\n currentTime > storedTime &&\n currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME\n ) {\n return;\n }\n // If the scroll direction changed, reset the accumulated scroll delta.\n if (\n (this.mouseScrollDelta > 0 && delta < 0) ||\n (this.mouseScrollDelta < 0 && delta > 0)\n ) {\n this._resetMouseScrollState();\n }\n this.mouseScrollDelta += delta;\n\n if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {\n const totalDelta = this.mouseScrollDelta;\n this._resetMouseScrollState();\n const success =\n totalDelta > 0\n ? this.pdfViewer.previousPage()\n : this.pdfViewer.nextPage();\n if (success) {\n this.mouseScrollTimeStamp = currentTime;\n }\n }\n }\n\n get isFullscreen() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return !!document.fullscreenElement;\n }\n return !!(\n document.fullscreenElement ||\n document.mozFullScreen ||\n document.webkitIsFullScreen\n );\n }\n\n /**\n * @private\n */\n _notifyStateChange() {\n let state = PresentationModeState.NORMAL;\n if (this.switchInProgress) {\n state = PresentationModeState.CHANGING;\n } else if (this.active) {\n state = PresentationModeState.FULLSCREEN;\n }\n this.eventBus.dispatch(\"presentationmodechanged\", {\n source: this,\n state,\n });\n }\n\n /**\n * Used to initialize a timeout when requesting Presentation Mode,\n * i.e. when the browser is requested to enter fullscreen mode.\n * This timeout is used to prevent the current page from being scrolled\n * partially, or completely, out of view when entering Presentation Mode.\n * NOTE: This issue seems limited to certain zoom levels (e.g. page-width).\n *\n * @private\n */\n _setSwitchInProgress() {\n if (this.switchInProgress) {\n clearTimeout(this.switchInProgress);\n }\n this.switchInProgress = setTimeout(() => {\n this._removeFullscreenChangeListeners();\n delete this.switchInProgress;\n this._notifyStateChange();\n }, DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS);\n }\n\n /**\n * @private\n */\n _resetSwitchInProgress() {\n if (this.switchInProgress) {\n clearTimeout(this.switchInProgress);\n delete this.switchInProgress;\n }\n }\n\n /**\n * @private\n */\n _enter() {\n this.active = true;\n this._resetSwitchInProgress();\n this._notifyStateChange();\n this.container.classList.add(ACTIVE_SELECTOR);\n\n // Ensure that the correct page is scrolled into view when entering\n // Presentation Mode, by waiting until fullscreen mode in enabled.\n setTimeout(() => {\n this.pdfViewer.currentPageNumber = this.args.page;\n this.pdfViewer.currentScaleValue = \"page-fit\";\n }, 0);\n\n this._addWindowListeners();\n this._showControls();\n this.contextMenuOpen = false;\n\n // Text selection is disabled in Presentation Mode, thus it's not possible\n // for the user to deselect text that is selected (e.g. with \"Select all\")\n // when entering Presentation Mode, hence we remove any active selection.\n window.getSelection().removeAllRanges();\n }\n\n /**\n * @private\n */\n _exit() {\n const page = this.pdfViewer.currentPageNumber;\n this.container.classList.remove(ACTIVE_SELECTOR);\n\n // Ensure that the correct page is scrolled into view when exiting\n // Presentation Mode, by waiting until fullscreen mode is disabled.\n setTimeout(() => {\n this.active = false;\n this._removeFullscreenChangeListeners();\n this._notifyStateChange();\n\n this.pdfViewer.currentScaleValue = this.args.previousScale;\n this.pdfViewer.currentPageNumber = page;\n this.args = null;\n }, 0);\n\n this._removeWindowListeners();\n this._hideControls();\n this._resetMouseScrollState();\n this.contextMenuOpen = false;\n }\n\n /**\n * @private\n */\n _mouseDown(evt) {\n if (this.contextMenuOpen) {\n this.contextMenuOpen = false;\n evt.preventDefault();\n return;\n }\n if (evt.button === 0) {\n // Enable clicking of links in presentation mode. Note: only links\n // pointing to destinations in the current PDF document work.\n const isInternalLink =\n evt.target.href && evt.target.classList.contains(\"internalLink\");\n if (!isInternalLink) {\n // Unless an internal link was clicked, advance one page.\n evt.preventDefault();\n\n if (evt.shiftKey) {\n this.pdfViewer.previousPage();\n } else {\n this.pdfViewer.nextPage();\n }\n }\n }\n }\n\n /**\n * @private\n */\n _contextMenu() {\n this.contextMenuOpen = true;\n }\n\n /**\n * @private\n */\n _showControls() {\n if (this.controlsTimeout) {\n clearTimeout(this.controlsTimeout);\n } else {\n this.container.classList.add(CONTROLS_SELECTOR);\n }\n this.controlsTimeout = setTimeout(() => {\n this.container.classList.remove(CONTROLS_SELECTOR);\n delete this.controlsTimeout;\n }, DELAY_BEFORE_HIDING_CONTROLS);\n }\n\n /**\n * @private\n */\n _hideControls() {\n if (!this.controlsTimeout) {\n return;\n }\n clearTimeout(this.controlsTimeout);\n this.container.classList.remove(CONTROLS_SELECTOR);\n delete this.controlsTimeout;\n }\n\n /**\n * Resets the properties used for tracking mouse scrolling events.\n *\n * @private\n */\n _resetMouseScrollState() {\n this.mouseScrollTimeStamp = 0;\n this.mouseScrollDelta = 0;\n }\n\n /**\n * @private\n */\n _touchSwipe(evt) {\n if (!this.active) {\n return;\n }\n if (evt.touches.length > 1) {\n // Multiple touch points detected; cancel the swipe.\n this.touchSwipeState = null;\n return;\n }\n\n switch (evt.type) {\n case \"touchstart\":\n this.touchSwipeState = {\n startX: evt.touches[0].pageX,\n startY: evt.touches[0].pageY,\n endX: evt.touches[0].pageX,\n endY: evt.touches[0].pageY,\n };\n break;\n case \"touchmove\":\n if (this.touchSwipeState === null) {\n return;\n }\n this.touchSwipeState.endX = evt.touches[0].pageX;\n this.touchSwipeState.endY = evt.touches[0].pageY;\n // Avoid the swipe from triggering browser gestures (Chrome in\n // particular has some sort of swipe gesture in fullscreen mode).\n evt.preventDefault();\n break;\n case \"touchend\":\n if (this.touchSwipeState === null) {\n return;\n }\n let delta = 0;\n const dx = this.touchSwipeState.endX - this.touchSwipeState.startX;\n const dy = this.touchSwipeState.endY - this.touchSwipeState.startY;\n const absAngle = Math.abs(Math.atan2(dy, dx));\n if (\n Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD &&\n (absAngle <= SWIPE_ANGLE_THRESHOLD ||\n absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD)\n ) {\n // Horizontal swipe.\n delta = dx;\n } else if (\n Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD &&\n Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD\n ) {\n // Vertical swipe.\n delta = dy;\n }\n if (delta > 0) {\n this.pdfViewer.previousPage();\n } else if (delta < 0) {\n this.pdfViewer.nextPage();\n }\n break;\n }\n }\n\n /**\n * @private\n */\n _addWindowListeners() {\n this.showControlsBind = this._showControls.bind(this);\n this.mouseDownBind = this._mouseDown.bind(this);\n this.mouseWheelBind = this._mouseWheel.bind(this);\n this.resetMouseScrollStateBind = this._resetMouseScrollState.bind(this);\n this.contextMenuBind = this._contextMenu.bind(this);\n this.touchSwipeBind = this._touchSwipe.bind(this);\n\n window.addEventListener(\"mousemove\", this.showControlsBind);\n window.addEventListener(\"mousedown\", this.mouseDownBind);\n window.addEventListener(\"wheel\", this.mouseWheelBind, { passive: false });\n window.addEventListener(\"keydown\", this.resetMouseScrollStateBind);\n window.addEventListener(\"contextmenu\", this.contextMenuBind);\n window.addEventListener(\"touchstart\", this.touchSwipeBind);\n window.addEventListener(\"touchmove\", this.touchSwipeBind);\n window.addEventListener(\"touchend\", this.touchSwipeBind);\n }\n\n /**\n * @private\n */\n _removeWindowListeners() {\n window.removeEventListener(\"mousemove\", this.showControlsBind);\n window.removeEventListener(\"mousedown\", this.mouseDownBind);\n window.removeEventListener(\"wheel\", this.mouseWheelBind, {\n passive: false,\n });\n window.removeEventListener(\"keydown\", this.resetMouseScrollStateBind);\n window.removeEventListener(\"contextmenu\", this.contextMenuBind);\n window.removeEventListener(\"touchstart\", this.touchSwipeBind);\n window.removeEventListener(\"touchmove\", this.touchSwipeBind);\n window.removeEventListener(\"touchend\", this.touchSwipeBind);\n\n delete this.showControlsBind;\n delete this.mouseDownBind;\n delete this.mouseWheelBind;\n delete this.resetMouseScrollStateBind;\n delete this.contextMenuBind;\n delete this.touchSwipeBind;\n }\n\n /**\n * @private\n */\n _fullscreenChange() {\n if (this.isFullscreen) {\n this._enter();\n } else {\n this._exit();\n }\n }\n\n /**\n * @private\n */\n _addFullscreenChangeListeners() {\n this.fullscreenChangeBind = this._fullscreenChange.bind(this);\n\n window.addEventListener(\"fullscreenchange\", this.fullscreenChangeBind);\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n window.addEventListener(\"mozfullscreenchange\", this.fullscreenChangeBind);\n window.addEventListener(\n \"webkitfullscreenchange\",\n this.fullscreenChangeBind\n );\n }\n }\n\n /**\n * @private\n */\n _removeFullscreenChangeListeners() {\n window.removeEventListener(\"fullscreenchange\", this.fullscreenChangeBind);\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n window.removeEventListener(\n \"mozfullscreenchange\",\n this.fullscreenChangeBind\n );\n window.removeEventListener(\n \"webkitfullscreenchange\",\n this.fullscreenChangeBind\n );\n }\n\n delete this.fullscreenChangeBind;\n }\n}\n\nexport { PDFPresentationMode };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPromiseCapability, shadow } from \"pdfjs-lib\";\nimport { apiPageLayoutToSpreadMode } from \"./ui_utils.js\";\nimport { RenderingStates } from \"./pdf_rendering_queue.js\";\n\n/**\n * @typedef {Object} PDFScriptingManagerOptions\n * @property {EventBus} eventBus - The application event bus.\n * @property {string} sandboxBundleSrc - The path and filename of the scripting\n * bundle.\n * @property {Object} [scriptingFactory] - The factory that is used when\n * initializing scripting; must contain a `createScripting` method.\n * PLEASE NOTE: Primarily intended for the default viewer use-case.\n * @property {function} [docPropertiesLookup] - The function that is used to\n * lookup the necessary document properties.\n */\n\nclass PDFScriptingManager {\n /**\n * @param {PDFScriptingManagerOptions} options\n */\n constructor({\n eventBus,\n sandboxBundleSrc = null,\n scriptingFactory = null,\n docPropertiesLookup = null,\n }) {\n this._pdfDocument = null;\n this._pdfViewer = null;\n this._closeCapability = null;\n this._destroyCapability = null;\n\n this._scripting = null;\n this._mouseState = Object.create(null);\n this._ready = false;\n\n this._eventBus = eventBus;\n this._sandboxBundleSrc = sandboxBundleSrc;\n this._scriptingFactory = scriptingFactory;\n this._docPropertiesLookup = docPropertiesLookup;\n\n // The default viewer already handles adding/removing of DOM events,\n // hence limit this to only the viewer components.\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"COMPONENTS\") &&\n !this._scriptingFactory\n ) {\n window.addEventListener(\"updatefromsandbox\", event => {\n this._eventBus.dispatch(\"updatefromsandbox\", {\n source: window,\n detail: event.detail,\n });\n });\n }\n }\n\n setViewer(pdfViewer) {\n this._pdfViewer = pdfViewer;\n }\n\n async setDocument(pdfDocument) {\n if (this._pdfDocument) {\n await this._destroyScripting();\n }\n this._pdfDocument = pdfDocument;\n\n if (!pdfDocument) {\n return;\n }\n const [objects, calculationOrder, docActions] = await Promise.all([\n pdfDocument.getFieldObjects(),\n pdfDocument.getCalculationOrderIds(),\n pdfDocument.getJSActions(),\n ]);\n\n if (!objects && !docActions) {\n // No FieldObjects or JavaScript actions were found in the document.\n await this._destroyScripting();\n return;\n }\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the data resolved.\n }\n try {\n this._scripting = this._createScripting();\n } catch (error) {\n console.error(`PDFScriptingManager.setDocument: \"${error?.message}\".`);\n\n await this._destroyScripting();\n return;\n }\n\n this._internalEvents.set(\"updatefromsandbox\", event => {\n if (event?.source !== window) {\n return;\n }\n this._updateFromSandbox(event.detail);\n });\n this._internalEvents.set(\"dispatcheventinsandbox\", event => {\n this._scripting?.dispatchEventInSandbox(event.detail);\n });\n\n this._internalEvents.set(\"pagechanging\", ({ pageNumber, previous }) => {\n if (pageNumber === previous) {\n return; // The current page didn't change.\n }\n this._dispatchPageClose(previous);\n this._dispatchPageOpen(pageNumber);\n });\n this._internalEvents.set(\"pagerendered\", ({ pageNumber }) => {\n if (!this._pageOpenPending.has(pageNumber)) {\n return; // No pending \"PageOpen\" event for the newly rendered page.\n }\n if (pageNumber !== this._pdfViewer.currentPageNumber) {\n return; // The newly rendered page is no longer the current one.\n }\n this._dispatchPageOpen(pageNumber);\n });\n this._internalEvents.set(\"pagesdestroy\", async event => {\n await this._dispatchPageClose(this._pdfViewer.currentPageNumber);\n\n await this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillClose\",\n });\n\n this._closeCapability?.resolve();\n });\n\n this._domEvents.set(\"mousedown\", event => {\n this._mouseState.isDown = true;\n });\n this._domEvents.set(\"mouseup\", event => {\n this._mouseState.isDown = false;\n });\n\n for (const [name, listener] of this._internalEvents) {\n this._eventBus._on(name, listener);\n }\n for (const [name, listener] of this._domEvents) {\n window.addEventListener(name, listener);\n }\n\n try {\n const docProperties = await this._getDocProperties();\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the properties resolved.\n }\n\n await this._scripting.createSandbox({\n objects,\n calculationOrder,\n appInfo: {\n platform: navigator.platform,\n language: navigator.language,\n },\n docInfo: {\n ...docProperties,\n actions: docActions,\n },\n });\n\n this._eventBus.dispatch(\"sandboxcreated\", { source: this });\n } catch (error) {\n console.error(`PDFScriptingManager.setDocument: \"${error?.message}\".`);\n\n await this._destroyScripting();\n return;\n }\n\n await this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"Open\",\n });\n await this._dispatchPageOpen(\n this._pdfViewer.currentPageNumber,\n /* initialize = */ true\n );\n\n // Defer this slightly, to ensure that scripting is *fully* initialized.\n Promise.resolve().then(() => {\n if (pdfDocument === this._pdfDocument) {\n this._ready = true;\n }\n });\n }\n\n async dispatchWillSave(detail) {\n return this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillSave\",\n });\n }\n\n async dispatchDidSave(detail) {\n return this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"DidSave\",\n });\n }\n\n async dispatchWillPrint(detail) {\n return this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillPrint\",\n });\n }\n\n async dispatchDidPrint(detail) {\n return this._scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"DidPrint\",\n });\n }\n\n get mouseState() {\n return this._mouseState;\n }\n\n get destroyPromise() {\n return this._destroyCapability?.promise || null;\n }\n\n get ready() {\n return this._ready;\n }\n\n /**\n * @private\n */\n get _internalEvents() {\n return shadow(this, \"_internalEvents\", new Map());\n }\n\n /**\n * @private\n */\n get _domEvents() {\n return shadow(this, \"_domEvents\", new Map());\n }\n\n /**\n * @private\n */\n get _pageOpenPending() {\n return shadow(this, \"_pageOpenPending\", new Set());\n }\n\n /**\n * @private\n */\n get _visitedPages() {\n return shadow(this, \"_visitedPages\", new Map());\n }\n\n /**\n * @private\n */\n async _updateFromSandbox(detail) {\n // Ignore some events, see below, that don't make sense in PresentationMode.\n const isInPresentationMode =\n this._pdfViewer.isInPresentationMode ||\n this._pdfViewer.isChangingPresentationMode;\n\n const { id, siblings, command, value } = detail;\n if (!id) {\n switch (command) {\n case \"clear\":\n console.clear();\n break;\n case \"error\":\n console.error(value);\n break;\n case \"layout\":\n this._pdfViewer.spreadMode = apiPageLayoutToSpreadMode(value);\n break;\n case \"page-num\":\n this._pdfViewer.currentPageNumber = value + 1;\n break;\n case \"print\":\n await this._pdfViewer.pagesPromise;\n this._eventBus.dispatch(\"print\", { source: this });\n break;\n case \"println\":\n console.log(value);\n break;\n case \"zoom\":\n if (isInPresentationMode) {\n return;\n }\n this._pdfViewer.currentScaleValue = value;\n break;\n }\n return;\n }\n\n if (isInPresentationMode) {\n if (detail.focus) {\n return;\n }\n }\n delete detail.id;\n delete detail.siblings;\n\n const ids = siblings ? [id, ...siblings] : [id];\n for (const elementId of ids) {\n const element = document.getElementById(elementId);\n if (element) {\n element.dispatchEvent(new CustomEvent(\"updatefromsandbox\", { detail }));\n } else {\n // The element hasn't been rendered yet, use the AnnotationStorage.\n this._pdfDocument?.annotationStorage.setValue(elementId, detail);\n }\n }\n }\n\n /**\n * @private\n */\n async _dispatchPageOpen(pageNumber, initialize = false) {\n const pdfDocument = this._pdfDocument,\n visitedPages = this._visitedPages;\n\n if (initialize) {\n this._closeCapability = createPromiseCapability();\n }\n if (!this._closeCapability) {\n return; // Scripting isn't fully initialized yet.\n }\n const pageView = this._pdfViewer.getPageView(/* index = */ pageNumber - 1);\n\n if (pageView?.renderingState !== RenderingStates.FINISHED) {\n this._pageOpenPending.add(pageNumber);\n return; // Wait for the page to finish rendering.\n }\n this._pageOpenPending.delete(pageNumber);\n\n const actionsPromise = (async () => {\n // Avoid sending, and thus serializing, the `actions` data more than once.\n const actions = await (!visitedPages.has(pageNumber)\n ? pageView.pdfPage?.getJSActions()\n : null);\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the actions resolved.\n }\n\n await this._scripting?.dispatchEventInSandbox({\n id: \"page\",\n name: \"PageOpen\",\n pageNumber,\n actions,\n });\n })();\n visitedPages.set(pageNumber, actionsPromise);\n }\n\n /**\n * @private\n */\n async _dispatchPageClose(pageNumber) {\n const pdfDocument = this._pdfDocument,\n visitedPages = this._visitedPages;\n\n if (!this._closeCapability) {\n return; // Scripting isn't fully initialized yet.\n }\n if (this._pageOpenPending.has(pageNumber)) {\n return; // The page is still rendering; no \"PageOpen\" event dispatched.\n }\n const actionsPromise = visitedPages.get(pageNumber);\n if (!actionsPromise) {\n return; // The \"PageClose\" event must be preceded by a \"PageOpen\" event.\n }\n visitedPages.set(pageNumber, null);\n\n // Ensure that the \"PageOpen\" event is dispatched first.\n await actionsPromise;\n if (pdfDocument !== this._pdfDocument) {\n return; // The document was closed while the actions resolved.\n }\n\n await this._scripting?.dispatchEventInSandbox({\n id: \"page\",\n name: \"PageClose\",\n pageNumber,\n });\n }\n\n /**\n * @returns {Promise<Object>} A promise that is resolved with an {Object}\n * containing the necessary document properties; please find the expected\n * format in `PDFViewerApplication._scriptingDocProperties`.\n * @private\n */\n async _getDocProperties() {\n if (this._docPropertiesLookup) {\n return this._docPropertiesLookup(this._pdfDocument);\n }\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"COMPONENTS\")) {\n const { docPropertiesLookup } = require(\"./generic_scripting.js\");\n\n return docPropertiesLookup(this._pdfDocument);\n }\n throw new Error(\"_getDocProperties: Unable to lookup properties.\");\n }\n\n /**\n * @private\n */\n _createScripting() {\n this._destroyCapability = createPromiseCapability();\n\n if (this._scripting) {\n throw new Error(\"_createScripting: Scripting already exists.\");\n }\n if (this._scriptingFactory) {\n return this._scriptingFactory.createScripting({\n sandboxBundleSrc: this._sandboxBundleSrc,\n });\n }\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"COMPONENTS\")) {\n const { GenericScripting } = require(\"./generic_scripting.js\");\n\n return new GenericScripting(this._sandboxBundleSrc);\n }\n throw new Error(\"_createScripting: Cannot create scripting.\");\n }\n\n /**\n * @private\n */\n async _destroyScripting() {\n if (!this._scripting) {\n this._pdfDocument = null;\n\n this._destroyCapability?.resolve();\n return;\n }\n if (this._closeCapability) {\n await Promise.race([\n this._closeCapability.promise,\n new Promise(resolve => {\n // Avoid the scripting/sandbox-destruction hanging indefinitely.\n setTimeout(resolve, 1000);\n }),\n ]).catch(reason => {\n // Ignore any errors, to ensure that the sandbox is always destroyed.\n });\n this._closeCapability = null;\n }\n this._pdfDocument = null;\n\n try {\n await this._scripting.destroySandbox();\n } catch (ex) {}\n\n for (const [name, listener] of this._internalEvents) {\n this._eventBus._off(name, listener);\n }\n this._internalEvents.clear();\n\n for (const [name, listener] of this._domEvents) {\n window.removeEventListener(name, listener);\n }\n this._domEvents.clear();\n\n this._pageOpenPending.clear();\n this._visitedPages.clear();\n\n this._scripting = null;\n delete this._mouseState.isDown;\n this._ready = false;\n\n this._destroyCapability?.resolve();\n }\n}\n\nexport { PDFScriptingManager };\n","/* Copyright 2016 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 { PresentationModeState, SidebarView } from \"./ui_utils.js\";\nimport { RenderingStates } from \"./pdf_rendering_queue.js\";\n\nconst UI_NOTIFICATION_CLASS = \"pdfSidebarNotification\";\n\n/**\n * @typedef {Object} PDFSidebarOptions\n * @property {PDFSidebarElements} elements - The DOM elements.\n * @property {PDFViewer} pdfViewer - The document viewer.\n * @property {PDFThumbnailViewer} pdfThumbnailViewer - The thumbnail viewer.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IL10n} l10n - The localization service.\n */\n\n/**\n * @typedef {Object} PDFSidebarElements\n * @property {HTMLDivElement} outerContainer - The outer container\n * (encasing both the viewer and sidebar elements).\n * @property {HTMLDivElement} viewerContainer - The viewer container\n * (in which the viewer element is placed).\n * @property {HTMLButtonElement} toggleButton - The button used for\n * opening/closing the sidebar.\n * @property {HTMLButtonElement} thumbnailButton - The button used to show\n * the thumbnail view.\n * @property {HTMLButtonElement} outlineButton - The button used to show\n * the outline view.\n * @property {HTMLButtonElement} attachmentsButton - The button used to show\n * the attachments view.\n * @property {HTMLButtonElement} layersButton - The button used to show\n * the layers view.\n * @property {HTMLDivElement} thumbnailView - The container in which\n * the thumbnails are placed.\n * @property {HTMLDivElement} outlineView - The container in which\n * the outline is placed.\n * @property {HTMLDivElement} attachmentsView - The container in which\n * the attachments are placed.\n * @property {HTMLDivElement} layersView - The container in which\n * the layers are placed.\n * @property {HTMLDivElement} outlineOptionsContainer - The container in which\n * the outline view-specific option button(s) are placed.\n * @property {HTMLButtonElement} currentOutlineItemButton - The button used to\n * find the current outline item.\n */\n\nclass PDFSidebar {\n /**\n * @param {PDFSidebarOptions} options\n */\n constructor({ elements, pdfViewer, pdfThumbnailViewer, eventBus, l10n }) {\n this.isOpen = false;\n this.active = SidebarView.THUMBS;\n this.isInitialViewSet = false;\n\n /**\n * Callback used when the sidebar has been opened/closed, to ensure that\n * the viewers (PDFViewer/PDFThumbnailViewer) are updated correctly.\n */\n this.onToggled = null;\n\n this.pdfViewer = pdfViewer;\n this.pdfThumbnailViewer = pdfThumbnailViewer;\n\n this.outerContainer = elements.outerContainer;\n this.viewerContainer = elements.viewerContainer;\n this.toggleButton = elements.toggleButton;\n\n this.thumbnailButton = elements.thumbnailButton;\n this.outlineButton = elements.outlineButton;\n this.attachmentsButton = elements.attachmentsButton;\n this.layersButton = elements.layersButton;\n\n this.thumbnailView = elements.thumbnailView;\n this.outlineView = elements.outlineView;\n this.attachmentsView = elements.attachmentsView;\n this.layersView = elements.layersView;\n\n this._outlineOptionsContainer = elements.outlineOptionsContainer;\n this._currentOutlineItemButton = elements.currentOutlineItemButton;\n\n this.eventBus = eventBus;\n this.l10n = l10n;\n\n this._addEventListeners();\n }\n\n reset() {\n this.isInitialViewSet = false;\n\n this._hideUINotification(/* reset = */ true);\n this.switchView(SidebarView.THUMBS);\n\n this.outlineButton.disabled = false;\n this.attachmentsButton.disabled = false;\n this.layersButton.disabled = false;\n this._currentOutlineItemButton.disabled = true;\n }\n\n /**\n * @type {number} One of the values in {SidebarView}.\n */\n get visibleView() {\n return this.isOpen ? this.active : SidebarView.NONE;\n }\n\n get isThumbnailViewVisible() {\n return this.isOpen && this.active === SidebarView.THUMBS;\n }\n\n get isOutlineViewVisible() {\n return this.isOpen && this.active === SidebarView.OUTLINE;\n }\n\n get isAttachmentsViewVisible() {\n return this.isOpen && this.active === SidebarView.ATTACHMENTS;\n }\n\n get isLayersViewVisible() {\n return this.isOpen && this.active === SidebarView.LAYERS;\n }\n\n /**\n * @param {number} view - The sidebar view that should become visible,\n * must be one of the values in {SidebarView}.\n */\n setInitialView(view = SidebarView.NONE) {\n if (this.isInitialViewSet) {\n return;\n }\n this.isInitialViewSet = true;\n\n // If the user has already manually opened the sidebar, immediately closing\n // it would be bad UX; also ignore the \"unknown\" sidebar view value.\n if (view === SidebarView.NONE || view === SidebarView.UNKNOWN) {\n this._dispatchEvent();\n return;\n }\n // Prevent dispatching two back-to-back `sidebarviewchanged` events,\n // since `this._switchView` dispatched the event if the view changed.\n if (!this._switchView(view, /* forceOpen */ true)) {\n this._dispatchEvent();\n }\n }\n\n /**\n * @param {number} view - The sidebar view that should be switched to,\n * must be one of the values in {SidebarView}.\n * @param {boolean} [forceOpen] - Ensure that the sidebar is open.\n * The default value is `false`.\n */\n switchView(view, forceOpen = false) {\n this._switchView(view, forceOpen);\n }\n\n /**\n * @returns {boolean} Indicating if `this._dispatchEvent` was called.\n * @private\n */\n _switchView(view, forceOpen = false) {\n const isViewChanged = view !== this.active;\n let shouldForceRendering = false;\n\n switch (view) {\n case SidebarView.NONE:\n if (this.isOpen) {\n this.close();\n return true; // Closing will trigger rendering and dispatch the event.\n }\n return false;\n case SidebarView.THUMBS:\n if (this.isOpen && isViewChanged) {\n shouldForceRendering = true;\n }\n break;\n case SidebarView.OUTLINE:\n if (this.outlineButton.disabled) {\n return false;\n }\n break;\n case SidebarView.ATTACHMENTS:\n if (this.attachmentsButton.disabled) {\n return false;\n }\n break;\n case SidebarView.LAYERS:\n if (this.layersButton.disabled) {\n return false;\n }\n break;\n default:\n console.error(`PDFSidebar._switchView: \"${view}\" is not a valid view.`);\n return false;\n }\n // Update the active view *after* it has been validated above,\n // in order to prevent setting it to an invalid state.\n this.active = view;\n\n // Update the CSS classes, for all buttons...\n this.thumbnailButton.classList.toggle(\n \"toggled\",\n view === SidebarView.THUMBS\n );\n this.outlineButton.classList.toggle(\n \"toggled\",\n view === SidebarView.OUTLINE\n );\n this.attachmentsButton.classList.toggle(\n \"toggled\",\n view === SidebarView.ATTACHMENTS\n );\n this.layersButton.classList.toggle(\"toggled\", view === SidebarView.LAYERS);\n // ... and for all views.\n this.thumbnailView.classList.toggle(\"hidden\", view !== SidebarView.THUMBS);\n this.outlineView.classList.toggle(\"hidden\", view !== SidebarView.OUTLINE);\n this.attachmentsView.classList.toggle(\n \"hidden\",\n view !== SidebarView.ATTACHMENTS\n );\n this.layersView.classList.toggle(\"hidden\", view !== SidebarView.LAYERS);\n\n // Finally, update view-specific CSS classes.\n this._outlineOptionsContainer.classList.toggle(\n \"hidden\",\n view !== SidebarView.OUTLINE\n );\n\n if (forceOpen && !this.isOpen) {\n this.open();\n return true; // Opening will trigger rendering and dispatch the event.\n }\n if (shouldForceRendering) {\n this._updateThumbnailViewer();\n this._forceRendering();\n }\n if (isViewChanged) {\n this._dispatchEvent();\n }\n return isViewChanged;\n }\n\n open() {\n if (this.isOpen) {\n return;\n }\n this.isOpen = true;\n this.toggleButton.classList.add(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"true\");\n\n this.outerContainer.classList.add(\"sidebarMoving\", \"sidebarOpen\");\n\n if (this.active === SidebarView.THUMBS) {\n this._updateThumbnailViewer();\n }\n this._forceRendering();\n this._dispatchEvent();\n\n this._hideUINotification();\n }\n\n close() {\n if (!this.isOpen) {\n return;\n }\n this.isOpen = false;\n this.toggleButton.classList.remove(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"false\");\n\n this.outerContainer.classList.add(\"sidebarMoving\");\n this.outerContainer.classList.remove(\"sidebarOpen\");\n\n this._forceRendering();\n this._dispatchEvent();\n }\n\n toggle() {\n if (this.isOpen) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /**\n * @private\n */\n _dispatchEvent() {\n this.eventBus.dispatch(\"sidebarviewchanged\", {\n source: this,\n view: this.visibleView,\n });\n }\n\n /**\n * @private\n */\n _forceRendering() {\n if (this.onToggled) {\n this.onToggled();\n } else {\n // Fallback\n this.pdfViewer.forceRendering();\n this.pdfThumbnailViewer.forceRendering();\n }\n }\n\n /**\n * @private\n */\n _updateThumbnailViewer() {\n const { pdfViewer, pdfThumbnailViewer } = this;\n\n // Use the rendered pages to set the corresponding thumbnail images.\n const pagesCount = pdfViewer.pagesCount;\n for (let pageIndex = 0; pageIndex < pagesCount; pageIndex++) {\n const pageView = pdfViewer.getPageView(pageIndex);\n if (pageView?.renderingState === RenderingStates.FINISHED) {\n const thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex);\n thumbnailView.setImage(pageView);\n }\n }\n pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber);\n }\n\n /**\n * @private\n */\n _showUINotification() {\n this.l10n.get(\"toggle_sidebar_notification2.title\").then(msg => {\n this.toggleButton.title = msg;\n });\n\n if (!this.isOpen) {\n // Only show the notification on the `toggleButton` if the sidebar is\n // currently closed, to avoid unnecessarily bothering the user.\n this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);\n }\n }\n\n /**\n * @private\n */\n _hideUINotification(reset = false) {\n if (this.isOpen || reset) {\n // Only hide the notification on the `toggleButton` if the sidebar is\n // currently open, or when the current PDF document is being closed.\n this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);\n }\n\n if (reset) {\n this.l10n.get(\"toggle_sidebar.title\").then(msg => {\n this.toggleButton.title = msg;\n });\n }\n }\n\n /**\n * @private\n */\n _addEventListeners() {\n this.viewerContainer.addEventListener(\"transitionend\", evt => {\n if (evt.target === this.viewerContainer) {\n this.outerContainer.classList.remove(\"sidebarMoving\");\n }\n });\n\n this.toggleButton.addEventListener(\"click\", () => {\n this.toggle();\n });\n\n // Buttons for switching views.\n this.thumbnailButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.THUMBS);\n });\n\n this.outlineButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.OUTLINE);\n });\n this.outlineButton.addEventListener(\"dblclick\", () => {\n this.eventBus.dispatch(\"toggleoutlinetree\", { source: this });\n });\n\n this.attachmentsButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.ATTACHMENTS);\n });\n\n this.layersButton.addEventListener(\"click\", () => {\n this.switchView(SidebarView.LAYERS);\n });\n this.layersButton.addEventListener(\"dblclick\", () => {\n this.eventBus.dispatch(\"resetlayers\", { source: this });\n });\n\n // Buttons for view-specific options.\n this._currentOutlineItemButton.addEventListener(\"click\", () => {\n this.eventBus.dispatch(\"currentoutlineitem\", { source: this });\n });\n\n // Disable/enable views.\n const onTreeLoaded = (count, button, view) => {\n button.disabled = !count;\n\n if (count) {\n this._showUINotification();\n } else if (this.active === view) {\n // If the `view` was opened by the user during document load,\n // switch away from it if it turns out to be empty.\n this.switchView(SidebarView.THUMBS);\n }\n };\n\n this.eventBus._on(\"outlineloaded\", evt => {\n onTreeLoaded(evt.outlineCount, this.outlineButton, SidebarView.OUTLINE);\n\n evt.currentOutlineItemPromise.then(enabled => {\n if (!this.isInitialViewSet) {\n return;\n }\n this._currentOutlineItemButton.disabled = !enabled;\n });\n });\n\n this.eventBus._on(\"attachmentsloaded\", evt => {\n onTreeLoaded(\n evt.attachmentsCount,\n this.attachmentsButton,\n SidebarView.ATTACHMENTS\n );\n });\n\n this.eventBus._on(\"layersloaded\", evt => {\n onTreeLoaded(evt.layersCount, this.layersButton, SidebarView.LAYERS);\n });\n\n // Update the thumbnailViewer, if visible, when exiting presentation mode.\n this.eventBus._on(\"presentationmodechanged\", evt => {\n if (\n evt.state === PresentationModeState.NORMAL &&\n this.isThumbnailViewVisible\n ) {\n this._updateThumbnailViewer();\n }\n });\n }\n}\n\nexport { PDFSidebar };\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\nconst SIDEBAR_WIDTH_VAR = \"--sidebar-width\";\nconst SIDEBAR_MIN_WIDTH = 200; // pixels\nconst SIDEBAR_RESIZING_CLASS = \"sidebarResizing\";\n\n/**\n * @typedef {Object} PDFSidebarResizerOptions\n * @property {HTMLDivElement} outerContainer - The outer container\n * (encasing both the viewer and sidebar elements).\n * @property {HTMLDivElement} resizer - The DOM element that can be dragged in\n * order to adjust the width of the sidebar.\n */\n\nclass PDFSidebarResizer {\n /**\n * @param {PDFSidebarResizerOptions} options\n * @param {EventBus} eventBus - The application event bus.\n * @param {IL10n} l10n - Localization service.\n */\n constructor(options, eventBus, l10n) {\n this.isRTL = false;\n this.sidebarOpen = false;\n this.doc = document.documentElement;\n this._width = null;\n this._outerContainerWidth = null;\n this._boundEvents = Object.create(null);\n\n this.outerContainer = options.outerContainer;\n this.resizer = options.resizer;\n this.eventBus = eventBus;\n\n l10n.getDirection().then(dir => {\n this.isRTL = dir === \"rtl\";\n });\n this._addEventListeners();\n }\n\n /**\n * @type {number}\n */\n get outerContainerWidth() {\n return (this._outerContainerWidth ||= this.outerContainer.clientWidth);\n }\n\n /**\n * @private\n * returns {boolean} Indicating if the sidebar width was updated.\n */\n _updateWidth(width = 0) {\n // Prevent the sidebar from becoming too narrow, or from occupying more\n // than half of the available viewer width.\n const maxWidth = Math.floor(this.outerContainerWidth / 2);\n if (width > maxWidth) {\n width = maxWidth;\n }\n if (width < SIDEBAR_MIN_WIDTH) {\n width = SIDEBAR_MIN_WIDTH;\n }\n // Only update the UI when the sidebar width did in fact change.\n if (width === this._width) {\n return false;\n }\n this._width = width;\n this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`);\n return true;\n }\n\n /**\n * @private\n */\n _mouseMove(evt) {\n let width = evt.clientX;\n // For sidebar resizing to work correctly in RTL mode, invert the width.\n if (this.isRTL) {\n width = this.outerContainerWidth - width;\n }\n this._updateWidth(width);\n }\n\n /**\n * @private\n */\n _mouseUp(evt) {\n // Re-enable the `transition-duration` rules when sidebar resizing ends...\n this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n // ... and ensure that rendering will always be triggered.\n this.eventBus.dispatch(\"resize\", { source: this });\n\n const _boundEvents = this._boundEvents;\n window.removeEventListener(\"mousemove\", _boundEvents.mouseMove);\n window.removeEventListener(\"mouseup\", _boundEvents.mouseUp);\n }\n\n /**\n * @private\n */\n _addEventListeners() {\n const _boundEvents = this._boundEvents;\n _boundEvents.mouseMove = this._mouseMove.bind(this);\n _boundEvents.mouseUp = this._mouseUp.bind(this);\n\n this.resizer.addEventListener(\"mousedown\", evt => {\n if (evt.button !== 0) {\n return;\n }\n // Disable the `transition-duration` rules when sidebar resizing begins,\n // in order to improve responsiveness and to avoid visual glitches.\n this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n\n window.addEventListener(\"mousemove\", _boundEvents.mouseMove);\n window.addEventListener(\"mouseup\", _boundEvents.mouseUp);\n });\n\n this.eventBus._on(\"sidebarviewchanged\", evt => {\n this.sidebarOpen = !!evt?.view;\n });\n\n this.eventBus._on(\"resize\", evt => {\n // When the *entire* viewer is resized, such that it becomes narrower,\n // ensure that the sidebar doesn't end up being too wide.\n if (evt?.source !== window) {\n return;\n }\n // Always reset the cached width when the viewer is resized.\n this._outerContainerWidth = null;\n\n if (!this._width) {\n // The sidebar hasn't been resized, hence no need to adjust its width.\n return;\n }\n // NOTE: If the sidebar is closed, we don't need to worry about\n // visual glitches nor ensure that rendering is triggered.\n if (!this.sidebarOpen) {\n this._updateWidth(this._width);\n return;\n }\n this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n const updated = this._updateWidth(this._width);\n\n Promise.resolve().then(() => {\n this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n // Trigger rendering if the sidebar width changed, to avoid\n // depending on the order in which 'resize' events are handled.\n if (updated) {\n this.eventBus.dispatch(\"resize\", { source: this });\n }\n });\n });\n }\n}\n\nexport { PDFSidebarResizer };\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 getVisibleElements,\n isValidRotation,\n scrollIntoView,\n watchScroll,\n} from \"./ui_utils.js\";\nimport { PDFThumbnailView, TempImageFactory } from \"./pdf_thumbnail_view.js\";\nimport { RenderingStates } from \"./pdf_rendering_queue.js\";\n\nconst THUMBNAIL_SCROLL_MARGIN = -19;\nconst THUMBNAIL_SELECTED_CLASS = \"selected\";\n\n/**\n * @typedef {Object} PDFThumbnailViewerOptions\n * @property {HTMLDivElement} container - The container for the thumbnail\n * elements.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {IL10n} l10n - Localization service.\n */\n\n/**\n * Viewer control to display thumbnails for pages in a PDF document.\n *\n * @implements {IRenderableView}\n */\nclass PDFThumbnailViewer {\n /**\n * @param {PDFThumbnailViewerOptions} options\n */\n constructor({ container, eventBus, linkService, renderingQueue, l10n }) {\n this.container = container;\n this.linkService = linkService;\n this.renderingQueue = renderingQueue;\n this.l10n = l10n;\n\n this.scroll = watchScroll(this.container, this._scrollUpdated.bind(this));\n this._resetView();\n\n eventBus._on(\"optionalcontentconfigchanged\", () => {\n // Ensure that the thumbnails always render with the *default* optional\n // content configuration.\n this._setImageDisabled = true;\n });\n }\n\n /**\n * @private\n */\n _scrollUpdated() {\n this.renderingQueue.renderHighestPriority();\n }\n\n getThumbnail(index) {\n return this._thumbnails[index];\n }\n\n /**\n * @private\n */\n _getVisibleThumbs() {\n return getVisibleElements({\n scrollEl: this.container,\n views: this._thumbnails,\n });\n }\n\n scrollThumbnailIntoView(pageNumber) {\n if (!this.pdfDocument) {\n return;\n }\n const thumbnailView = this._thumbnails[pageNumber - 1];\n\n if (!thumbnailView) {\n console.error('scrollThumbnailIntoView: Invalid \"pageNumber\" parameter.');\n return;\n }\n\n if (pageNumber !== this._currentPageNumber) {\n const prevThumbnailView = this._thumbnails[this._currentPageNumber - 1];\n // Remove the highlight from the previous thumbnail...\n prevThumbnailView.div.classList.remove(THUMBNAIL_SELECTED_CLASS);\n // ... and add the highlight to the new thumbnail.\n thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);\n }\n const visibleThumbs = this._getVisibleThumbs();\n const numVisibleThumbs = visibleThumbs.views.length;\n\n // If the thumbnail isn't currently visible, scroll it into view.\n if (numVisibleThumbs > 0) {\n const first = visibleThumbs.first.id;\n // Account for only one thumbnail being visible.\n const last = numVisibleThumbs > 1 ? visibleThumbs.last.id : first;\n\n let shouldScroll = false;\n if (pageNumber <= first || pageNumber >= last) {\n shouldScroll = true;\n } else {\n visibleThumbs.views.some(function (view) {\n if (view.id !== pageNumber) {\n return false;\n }\n shouldScroll = view.percent < 100;\n return true;\n });\n }\n if (shouldScroll) {\n scrollIntoView(thumbnailView.div, { top: THUMBNAIL_SCROLL_MARGIN });\n }\n }\n\n this._currentPageNumber = pageNumber;\n }\n\n get pagesRotation() {\n return this._pagesRotation;\n }\n\n set pagesRotation(rotation) {\n if (!isValidRotation(rotation)) {\n throw new Error(\"Invalid thumbnails rotation angle.\");\n }\n if (!this.pdfDocument) {\n return;\n }\n if (this._pagesRotation === rotation) {\n return; // The rotation didn't change.\n }\n this._pagesRotation = rotation;\n\n for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n this._thumbnails[i].update(rotation);\n }\n }\n\n cleanup() {\n for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n if (\n this._thumbnails[i] &&\n this._thumbnails[i].renderingState !== RenderingStates.FINISHED\n ) {\n this._thumbnails[i].reset();\n }\n }\n TempImageFactory.destroyCanvas();\n }\n\n /**\n * @private\n */\n _resetView() {\n this._thumbnails = [];\n this._currentPageNumber = 1;\n this._pageLabels = null;\n this._pagesRotation = 0;\n this._optionalContentConfigPromise = null;\n this._pagesRequests = new WeakMap();\n this._setImageDisabled = false;\n\n // Remove the thumbnails from the DOM.\n this.container.textContent = \"\";\n }\n\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this._cancelRendering();\n this._resetView();\n }\n\n this.pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n const firstPagePromise = pdfDocument.getPage(1);\n const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();\n\n firstPagePromise\n .then(firstPdfPage => {\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n const pagesCount = pdfDocument.numPages;\n const viewport = firstPdfPage.getViewport({ scale: 1 });\n const checkSetImageDisabled = () => {\n return this._setImageDisabled;\n };\n\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n const thumbnail = new PDFThumbnailView({\n container: this.container,\n id: pageNum,\n defaultViewport: viewport.clone(),\n optionalContentConfigPromise,\n linkService: this.linkService,\n renderingQueue: this.renderingQueue,\n checkSetImageDisabled,\n l10n: this.l10n,\n });\n this._thumbnails.push(thumbnail);\n }\n // Set the first `pdfPage` immediately, since it's already loaded,\n // rather than having to repeat the `PDFDocumentProxy.getPage` call in\n // the `this._ensurePdfPageLoaded` method before rendering can start.\n const firstThumbnailView = this._thumbnails[0];\n if (firstThumbnailView) {\n firstThumbnailView.setPdfPage(firstPdfPage);\n }\n\n // Ensure that the current thumbnail is always highlighted on load.\n const thumbnailView = this._thumbnails[this._currentPageNumber - 1];\n thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);\n })\n .catch(reason => {\n console.error(\"Unable to initialize thumbnail viewer\", reason);\n });\n }\n\n /**\n * @private\n */\n _cancelRendering() {\n for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n if (this._thumbnails[i]) {\n this._thumbnails[i].cancelRendering();\n }\n }\n }\n\n /**\n * @param {Array|null} labels\n */\n setPageLabels(labels) {\n if (!this.pdfDocument) {\n return;\n }\n if (!labels) {\n this._pageLabels = null;\n } else if (\n !(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)\n ) {\n this._pageLabels = null;\n console.error(\"PDFThumbnailViewer_setPageLabels: Invalid page labels.\");\n } else {\n this._pageLabels = labels;\n }\n // Update all the `PDFThumbnailView` instances.\n for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n this._thumbnails[i].setPageLabel(this._pageLabels?.[i] ?? null);\n }\n }\n\n /**\n * @param {PDFThumbnailView} thumbView\n * @returns {PDFPage}\n * @private\n */\n _ensurePdfPageLoaded(thumbView) {\n if (thumbView.pdfPage) {\n return Promise.resolve(thumbView.pdfPage);\n }\n if (this._pagesRequests.has(thumbView)) {\n return this._pagesRequests.get(thumbView);\n }\n const promise = this.pdfDocument\n .getPage(thumbView.id)\n .then(pdfPage => {\n if (!thumbView.pdfPage) {\n thumbView.setPdfPage(pdfPage);\n }\n this._pagesRequests.delete(thumbView);\n return pdfPage;\n })\n .catch(reason => {\n console.error(\"Unable to get page for thumb view\", reason);\n // Page error -- there is nothing that can be done.\n this._pagesRequests.delete(thumbView);\n });\n this._pagesRequests.set(thumbView, promise);\n return promise;\n }\n\n forceRendering() {\n const visibleThumbs = this._getVisibleThumbs();\n const thumbView = this.renderingQueue.getHighestPriority(\n visibleThumbs,\n this._thumbnails,\n this.scroll.down\n );\n if (thumbView) {\n this._ensurePdfPageLoaded(thumbView).then(() => {\n this.renderingQueue.renderView(thumbView);\n });\n return true;\n }\n return false;\n }\n}\n\nexport { PDFThumbnailViewer };\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 { getOutputScale } from \"./ui_utils.js\";\nimport { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./pdf_rendering_queue.js\";\n\nconst DRAW_UPSCALE_FACTOR = 2; // See comment in `PDFThumbnailView.draw` below.\nconst MAX_NUM_SCALING_STEPS = 3;\nconst THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px\nconst THUMBNAIL_WIDTH = 98; // px\n\n/**\n * @typedef {Object} PDFThumbnailViewOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {number} id - The thumbnail's unique ID (normally its number).\n * @property {PageViewport} defaultViewport - The page viewport.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -\n * A promise that is resolved with an {@link OptionalContentConfig} instance.\n * The default value is `null`.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {function} checkSetImageDisabled\n * @property {IL10n} l10n - Localization service.\n */\n\nconst TempImageFactory = (function TempImageFactoryClosure() {\n let tempCanvasCache = null;\n\n return {\n getCanvas(width, height) {\n let tempCanvas = tempCanvasCache;\n if (!tempCanvas) {\n tempCanvas = document.createElement(\"canvas\");\n tempCanvasCache = tempCanvas;\n }\n tempCanvas.width = width;\n tempCanvas.height = height;\n\n // Since this is a temporary canvas, we need to fill it with a white\n // background ourselves. `_getPageDrawContext` uses CSS rules for this.\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"MOZCENTRAL || GENERIC\")\n ) {\n tempCanvas.mozOpaque = true;\n }\n\n const ctx = tempCanvas.getContext(\"2d\", { alpha: false });\n ctx.save();\n ctx.fillStyle = \"rgb(255, 255, 255)\";\n ctx.fillRect(0, 0, width, height);\n ctx.restore();\n return [tempCanvas, tempCanvas.getContext(\"2d\")];\n },\n\n destroyCanvas() {\n const tempCanvas = tempCanvasCache;\n if (tempCanvas) {\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n tempCanvas.width = 0;\n tempCanvas.height = 0;\n }\n tempCanvasCache = null;\n },\n };\n})();\n\n/**\n * @implements {IRenderableView}\n */\nclass PDFThumbnailView {\n /**\n * @param {PDFThumbnailViewOptions} options\n */\n constructor({\n container,\n id,\n defaultViewport,\n optionalContentConfigPromise,\n linkService,\n renderingQueue,\n checkSetImageDisabled,\n l10n,\n }) {\n this.id = id;\n this.renderingId = \"thumbnail\" + id;\n this.pageLabel = null;\n\n this.pdfPage = null;\n this.rotation = 0;\n this.viewport = defaultViewport;\n this.pdfPageRotate = defaultViewport.rotation;\n this._optionalContentConfigPromise = optionalContentConfigPromise || null;\n\n this.linkService = linkService;\n this.renderingQueue = renderingQueue;\n\n this.renderTask = null;\n this.renderingState = RenderingStates.INITIAL;\n this.resume = null;\n this._checkSetImageDisabled =\n checkSetImageDisabled ||\n function () {\n return false;\n };\n\n const pageWidth = this.viewport.width,\n pageHeight = this.viewport.height,\n pageRatio = pageWidth / pageHeight;\n\n this.canvasWidth = THUMBNAIL_WIDTH;\n this.canvasHeight = (this.canvasWidth / pageRatio) | 0;\n this.scale = this.canvasWidth / pageWidth;\n\n this.l10n = l10n;\n\n const anchor = document.createElement(\"a\");\n anchor.href = linkService.getAnchorUrl(\"#page=\" + id);\n this._thumbPageTitle.then(msg => {\n anchor.title = msg;\n });\n anchor.onclick = function () {\n linkService.goToPage(id);\n return false;\n };\n this.anchor = anchor;\n\n const div = document.createElement(\"div\");\n div.className = \"thumbnail\";\n div.setAttribute(\"data-page-number\", this.id);\n this.div = div;\n\n const ring = document.createElement(\"div\");\n ring.className = \"thumbnailSelectionRing\";\n const borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;\n ring.style.width = this.canvasWidth + borderAdjustment + \"px\";\n ring.style.height = this.canvasHeight + borderAdjustment + \"px\";\n this.ring = ring;\n\n div.appendChild(ring);\n anchor.appendChild(div);\n container.appendChild(anchor);\n }\n\n setPdfPage(pdfPage) {\n this.pdfPage = pdfPage;\n this.pdfPageRotate = pdfPage.rotate;\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = pdfPage.getViewport({ scale: 1, rotation: totalRotation });\n this.reset();\n }\n\n reset() {\n this.cancelRendering();\n this.renderingState = RenderingStates.INITIAL;\n\n const pageWidth = this.viewport.width,\n pageHeight = this.viewport.height,\n pageRatio = pageWidth / pageHeight;\n\n this.canvasHeight = (this.canvasWidth / pageRatio) | 0;\n this.scale = this.canvasWidth / pageWidth;\n\n this.div.removeAttribute(\"data-loaded\");\n const ring = this.ring;\n ring.textContent = \"\"; // Remove the thumbnail from the DOM.\n const borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;\n ring.style.width = this.canvasWidth + borderAdjustment + \"px\";\n ring.style.height = this.canvasHeight + borderAdjustment + \"px\";\n\n if (this.canvas) {\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n this.canvas.width = 0;\n this.canvas.height = 0;\n delete this.canvas;\n }\n if (this.image) {\n this.image.removeAttribute(\"src\");\n delete this.image;\n }\n }\n\n update(rotation) {\n if (typeof rotation !== \"undefined\") {\n this.rotation = rotation;\n }\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = this.viewport.clone({\n scale: 1,\n rotation: totalRotation,\n });\n this.reset();\n }\n\n /**\n * PLEASE NOTE: Most likely you want to use the `this.reset()` method,\n * rather than calling this one directly.\n */\n cancelRendering() {\n if (this.renderTask) {\n this.renderTask.cancel();\n this.renderTask = null;\n }\n this.resume = null;\n }\n\n /**\n * @private\n */\n _getPageDrawContext(upscaleFactor = 1) {\n // Keep the no-thumbnail outline visible, i.e. `data-loaded === false`,\n // until rendering/image conversion is complete, to avoid display issues.\n const canvas = document.createElement(\"canvas\");\n\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"MOZCENTRAL || GENERIC\")\n ) {\n canvas.mozOpaque = true;\n }\n const ctx = canvas.getContext(\"2d\", { alpha: false });\n const outputScale = getOutputScale(ctx);\n\n canvas.width = (upscaleFactor * this.canvasWidth * outputScale.sx) | 0;\n canvas.height = (upscaleFactor * this.canvasHeight * outputScale.sy) | 0;\n\n const transform = outputScale.scaled\n ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n : null;\n\n return { ctx, canvas, transform };\n }\n\n /**\n * @private\n */\n _convertCanvasToImage(canvas) {\n if (this.renderingState !== RenderingStates.FINISHED) {\n throw new Error(\"_convertCanvasToImage: Rendering has not finished.\");\n }\n const reducedCanvas = this._reduceImage(canvas);\n\n const image = document.createElement(\"img\");\n image.className = \"thumbnailImage\";\n this._thumbPageCanvas.then(msg => {\n image.setAttribute(\"aria-label\", msg);\n });\n image.style.width = this.canvasWidth + \"px\";\n image.style.height = this.canvasHeight + \"px\";\n\n image.src = reducedCanvas.toDataURL();\n this.image = image;\n\n this.div.setAttribute(\"data-loaded\", true);\n this.ring.appendChild(image);\n\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n reducedCanvas.width = 0;\n reducedCanvas.height = 0;\n }\n\n draw() {\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error(\"Must be in new state before drawing\");\n return Promise.resolve(undefined);\n }\n const { pdfPage } = this;\n\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n return Promise.reject(new Error(\"pdfPage is not loaded\"));\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n const finishRenderTask = async (error = null) => {\n // The renderTask may have been replaced by a new one, so only remove\n // the reference to the renderTask if it matches the one that is\n // triggering this callback.\n if (renderTask === this.renderTask) {\n this.renderTask = null;\n }\n\n if (error instanceof RenderingCancelledException) {\n return;\n }\n this.renderingState = RenderingStates.FINISHED;\n this._convertCanvasToImage(canvas);\n\n if (error) {\n throw error;\n }\n };\n\n // Render the thumbnail at a larger size and downsize the canvas (similar\n // to `setImage`), to improve consistency between thumbnails created by\n // the `draw` and `setImage` methods (fixes issue 8233).\n // NOTE: To primarily avoid increasing memory usage too much, but also to\n // reduce downsizing overhead, we purposely limit the up-scaling factor.\n const { ctx, canvas, transform } =\n this._getPageDrawContext(DRAW_UPSCALE_FACTOR);\n const drawViewport = this.viewport.clone({\n scale: DRAW_UPSCALE_FACTOR * this.scale,\n });\n const renderContinueCallback = cont => {\n if (!this.renderingQueue.isHighestPriority(this)) {\n this.renderingState = RenderingStates.PAUSED;\n this.resume = () => {\n this.renderingState = RenderingStates.RUNNING;\n cont();\n };\n return;\n }\n cont();\n };\n\n const renderContext = {\n canvasContext: ctx,\n transform,\n viewport: drawViewport,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n };\n const renderTask = (this.renderTask = pdfPage.render(renderContext));\n renderTask.onContinue = renderContinueCallback;\n\n const resultPromise = renderTask.promise.then(\n function () {\n return finishRenderTask(null);\n },\n function (error) {\n return finishRenderTask(error);\n }\n );\n resultPromise.finally(() => {\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n canvas.width = 0;\n canvas.height = 0;\n\n // Only trigger cleanup, once rendering has finished, when the current\n // pageView is *not* cached on the `BaseViewer`-instance.\n const pageCached = this.linkService.isPageCached(this.id);\n if (!pageCached) {\n this.pdfPage?.cleanup();\n }\n });\n\n return resultPromise;\n }\n\n setImage(pageView) {\n if (this._checkSetImageDisabled()) {\n return;\n }\n if (this.renderingState !== RenderingStates.INITIAL) {\n return;\n }\n const { canvas, pdfPage } = pageView;\n if (!canvas) {\n return;\n }\n if (!this.pdfPage) {\n this.setPdfPage(pdfPage);\n }\n this.renderingState = RenderingStates.FINISHED;\n this._convertCanvasToImage(canvas);\n }\n\n /**\n * @private\n */\n _reduceImage(img) {\n const { ctx, canvas } = this._getPageDrawContext();\n\n if (img.width <= 2 * canvas.width) {\n ctx.drawImage(\n img,\n 0,\n 0,\n img.width,\n img.height,\n 0,\n 0,\n canvas.width,\n canvas.height\n );\n return canvas;\n }\n // drawImage does an awful job of rescaling the image, doing it gradually.\n let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;\n let reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;\n const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(\n reducedWidth,\n reducedHeight\n );\n\n while (reducedWidth > img.width || reducedHeight > img.height) {\n reducedWidth >>= 1;\n reducedHeight >>= 1;\n }\n reducedImageCtx.drawImage(\n img,\n 0,\n 0,\n img.width,\n img.height,\n 0,\n 0,\n reducedWidth,\n reducedHeight\n );\n while (reducedWidth > 2 * canvas.width) {\n reducedImageCtx.drawImage(\n reducedImage,\n 0,\n 0,\n reducedWidth,\n reducedHeight,\n 0,\n 0,\n reducedWidth >> 1,\n reducedHeight >> 1\n );\n reducedWidth >>= 1;\n reducedHeight >>= 1;\n }\n ctx.drawImage(\n reducedImage,\n 0,\n 0,\n reducedWidth,\n reducedHeight,\n 0,\n 0,\n canvas.width,\n canvas.height\n );\n return canvas;\n }\n\n get _thumbPageTitle() {\n return this.l10n.get(\"thumb_page_title\", {\n page: this.pageLabel ?? this.id,\n });\n }\n\n get _thumbPageCanvas() {\n return this.l10n.get(\"thumb_page_canvas\", {\n page: this.pageLabel ?? this.id,\n });\n }\n\n /**\n * @param {string|null} label\n */\n setPageLabel(label) {\n this.pageLabel = typeof label === \"string\" ? label : null;\n\n this._thumbPageTitle.then(msg => {\n this.anchor.title = msg;\n });\n\n if (this.renderingState !== RenderingStates.FINISHED) {\n return;\n }\n\n this._thumbPageCanvas.then(msg => {\n this.image?.setAttribute(\"aria-label\", msg);\n });\n }\n}\n\nexport { PDFThumbnailView, TempImageFactory };\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 { ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { BaseViewer } from \"./base_viewer.js\";\nimport { shadow } from \"pdfjs-lib\";\n\nclass PDFViewer extends BaseViewer {\n get _viewerElement() {\n return shadow(this, \"_viewerElement\", this.viewer);\n }\n\n _scrollIntoView({ pageDiv, pageSpot = null, pageNumber = null }) {\n if (!pageSpot && !this.isInPresentationMode) {\n const left = pageDiv.offsetLeft + pageDiv.clientLeft;\n const right = left + pageDiv.clientWidth;\n const { scrollLeft, clientWidth } = this.container;\n if (\n this._isScrollModeHorizontal ||\n left < scrollLeft ||\n right > scrollLeft + clientWidth\n ) {\n pageSpot = { left: 0, top: 0 };\n }\n }\n super._scrollIntoView({ pageDiv, pageSpot, pageNumber });\n }\n\n _getVisiblePages() {\n if (this.isInPresentationMode) {\n // The algorithm in `getVisibleElements` doesn't work in all browsers and\n // configurations (e.g. Chrome) when Presentation Mode is active.\n return this._getCurrentVisiblePage();\n }\n return super._getVisiblePages();\n }\n\n _updateHelper(visiblePages) {\n if (this.isInPresentationMode) {\n return;\n }\n let currentId = this._currentPageNumber;\n let stillFullyVisible = false;\n\n for (const page of visiblePages) {\n if (page.percent < 100) {\n break;\n }\n if (\n page.id === currentId &&\n this._scrollMode === ScrollMode.VERTICAL &&\n this._spreadMode === SpreadMode.NONE\n ) {\n stillFullyVisible = true;\n break;\n }\n }\n if (!stillFullyVisible) {\n currentId = visiblePages[0].id;\n }\n this._setCurrentPageNumber(currentId);\n }\n}\n\nexport { PDFViewer };\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 { createPromiseCapability, version } from \"pdfjs-lib\";\nimport {\n CSS_UNITS,\n DEFAULT_SCALE,\n DEFAULT_SCALE_VALUE,\n getVisibleElements,\n isPortraitOrientation,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n MAX_AUTO_SCALE,\n moveToEndOfArray,\n PresentationModeState,\n RendererType,\n SCROLLBAR_PADDING,\n scrollIntoView,\n ScrollMode,\n SpreadMode,\n TextLayerMode,\n UNKNOWN_SCALE,\n VERTICAL_PADDING,\n watchScroll,\n} from \"./ui_utils.js\";\nimport { PDFRenderingQueue, RenderingStates } from \"./pdf_rendering_queue.js\";\nimport { AnnotationLayerBuilder } from \"./annotation_layer_builder.js\";\nimport { NullL10n } from \"./l10n_utils.js\";\nimport { PDFPageView } from \"./pdf_page_view.js\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\nimport { StructTreeLayerBuilder } from \"./struct_tree_layer_builder.js\";\nimport { TextLayerBuilder } from \"./text_layer_builder.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.js\";\n\nconst DEFAULT_CACHE_SIZE = 10;\n\n/**\n * @typedef {Object} PDFViewerOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {HTMLDivElement} [viewer] - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {DownloadManager} [downloadManager] - The download manager\n * component.\n * @property {PDFFindController} [findController] - The find controller\n * component.\n * @property {PDFScriptingManager} [scriptingManager] - The scripting manager\n * component.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {boolean} [removePageBorders] - Removes the border shadow around\n * the pages. The default value is `false`.\n * @property {number} [textLayerMode] - Controls if the text layer used for\n * selection and searching is created, and if the improved text selection\n * behaviour is enabled. The constants from {TextLayerMode} should be used.\n * The default value is `TextLayerMode.ENABLE`.\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * mainly for annotation icons. Include trailing slash.\n * @property {boolean} [renderInteractiveForms] - Enables rendering of\n * interactive form elements. The default value is `true`.\n * @property {boolean} [enablePrintAutoRotate] - Enables automatic rotation of\n * landscape pages upon printing. The default is `false`.\n * @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.\n * @property {boolean} [useOnlyCssZoom] - Enables CSS only zooming. The default\n * value is `false`.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n * total pixels, i.e. width * height. Use -1 for no limit. The default value\n * is 4096 * 4096 (16 mega-pixels).\n * @property {IL10n} l10n - Localization service.\n * @property {boolean} [enableScripting] - Enable embedded script execution\n * (also requires {scriptingManager} being set). The default value is `false`.\n */\n\nfunction PDFPageViewBuffer(size) {\n const data = [];\n this.push = function (view) {\n const i = data.indexOf(view);\n if (i >= 0) {\n data.splice(i, 1);\n }\n data.push(view);\n if (data.length > size) {\n data.shift().destroy();\n }\n };\n /**\n * After calling resize, the size of the buffer will be newSize. The optional\n * parameter pagesToKeep is, if present, an array of pages to push to the back\n * of the buffer, delaying their destruction. The size of pagesToKeep has no\n * impact on the final size of the buffer; if pagesToKeep has length larger\n * than newSize, some of those pages will be destroyed anyway.\n */\n this.resize = function (newSize, pagesToKeep) {\n size = newSize;\n if (pagesToKeep) {\n const pageIdsToKeep = new Set();\n for (let i = 0, iMax = pagesToKeep.length; i < iMax; ++i) {\n pageIdsToKeep.add(pagesToKeep[i].id);\n }\n moveToEndOfArray(data, function (page) {\n return pageIdsToKeep.has(page.id);\n });\n }\n while (data.length > size) {\n data.shift().destroy();\n }\n };\n\n this.has = function (view) {\n return data.includes(view);\n };\n}\n\nfunction isSameScale(oldScale, newScale) {\n if (newScale === oldScale) {\n return true;\n }\n if (Math.abs(newScale - oldScale) < 1e-15) {\n // Prevent unnecessary re-rendering of all pages when the scale\n // changes only because of limited numerical precision.\n return true;\n }\n return false;\n}\n\n/**\n * Simple viewer control to display PDF content/pages.\n * @implements {IRenderableView}\n */\nclass BaseViewer {\n /**\n * @param {PDFViewerOptions} options\n */\n constructor(options) {\n if (this.constructor === BaseViewer) {\n throw new Error(\"Cannot initialize BaseViewer.\");\n }\n const viewerVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : null;\n if (version !== viewerVersion) {\n throw new Error(\n `The API version \"${version}\" does not match the Viewer version \"${viewerVersion}\".`\n );\n }\n this._name = this.constructor.name;\n\n this.container = options.container;\n this.viewer = options.viewer || options.container.firstElementChild;\n\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n ) {\n if (\n !(\n this.container?.tagName.toUpperCase() === \"DIV\" &&\n this.viewer?.tagName.toUpperCase() === \"DIV\"\n )\n ) {\n throw new Error(\"Invalid `container` and/or `viewer` option.\");\n }\n\n if (\n this.container.offsetParent &&\n getComputedStyle(this.container).position !== \"absolute\"\n ) {\n throw new Error(\"The `container` must be absolutely positioned.\");\n }\n }\n this.eventBus = options.eventBus;\n this.linkService = options.linkService || new SimpleLinkService();\n this.downloadManager = options.downloadManager || null;\n this.findController = options.findController || null;\n this._scriptingManager = options.scriptingManager || null;\n this.removePageBorders = options.removePageBorders || false;\n this.textLayerMode = Number.isInteger(options.textLayerMode)\n ? options.textLayerMode\n : TextLayerMode.ENABLE;\n this.imageResourcesPath = options.imageResourcesPath || \"\";\n this.renderInteractiveForms = options.renderInteractiveForms !== false;\n this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;\n this.renderer = options.renderer || RendererType.CANVAS;\n this.useOnlyCssZoom = options.useOnlyCssZoom || false;\n this.maxCanvasPixels = options.maxCanvasPixels;\n this.l10n = options.l10n || NullL10n;\n this.enableScripting =\n options.enableScripting === true && !!this._scriptingManager;\n\n this.defaultRenderingQueue = !options.renderingQueue;\n if (this.defaultRenderingQueue) {\n // Custom rendering queue is not specified, using default one\n this.renderingQueue = new PDFRenderingQueue();\n this.renderingQueue.setViewer(this);\n } else {\n this.renderingQueue = options.renderingQueue;\n }\n\n this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));\n this.presentationModeState = PresentationModeState.UNKNOWN;\n this._onBeforeDraw = this._onAfterDraw = null;\n this._resetView();\n\n if (this.removePageBorders) {\n this.viewer.classList.add(\"removePageBorders\");\n }\n // Defer the dispatching of this event, to give other viewer components\n // time to initialize *and* register 'baseviewerinit' event listeners.\n Promise.resolve().then(() => {\n this.eventBus.dispatch(\"baseviewerinit\", { source: this });\n });\n }\n\n get pagesCount() {\n return this._pages.length;\n }\n\n getPageView(index) {\n return this._pages[index];\n }\n\n /**\n * @type {boolean} - True if all {PDFPageView} objects are initialized.\n */\n get pageViewsReady() {\n if (!this._pagesCapability.settled) {\n return false;\n }\n // Prevent printing errors when 'disableAutoFetch' is set, by ensuring\n // that *all* pages have in fact been completely loaded.\n return this._pages.every(function (pageView) {\n return pageView?.pdfPage;\n });\n }\n\n /**\n * @type {number}\n */\n get currentPageNumber() {\n return this._currentPageNumber;\n }\n\n /**\n * @param {number} val - The page number.\n */\n set currentPageNumber(val) {\n if (!Number.isInteger(val)) {\n throw new Error(\"Invalid page number.\");\n }\n if (!this.pdfDocument) {\n return;\n }\n // The intent can be to just reset a scroll position and/or scale.\n if (!this._setCurrentPageNumber(val, /* resetCurrentPageView = */ true)) {\n console.error(\n `${this._name}.currentPageNumber: \"${val}\" is not a valid page.`\n );\n }\n }\n\n /**\n * @returns {boolean} Whether the pageNumber is valid (within bounds).\n * @private\n */\n _setCurrentPageNumber(val, resetCurrentPageView = false) {\n if (this._currentPageNumber === val) {\n if (resetCurrentPageView) {\n this._resetCurrentPageView();\n }\n return true;\n }\n\n if (!(0 < val && val <= this.pagesCount)) {\n return false;\n }\n const previous = this._currentPageNumber;\n this._currentPageNumber = val;\n\n this.eventBus.dispatch(\"pagechanging\", {\n source: this,\n pageNumber: val,\n pageLabel: this._pageLabels?.[val - 1] ?? null,\n previous,\n });\n\n if (resetCurrentPageView) {\n this._resetCurrentPageView();\n }\n return true;\n }\n\n /**\n * @type {string|null} Returns the current page label, or `null` if no page\n * labels exist.\n */\n get currentPageLabel() {\n return this._pageLabels?.[this._currentPageNumber - 1] ?? null;\n }\n\n /**\n * @param {string} val - The page label.\n */\n set currentPageLabel(val) {\n if (!this.pdfDocument) {\n return;\n }\n let page = val | 0; // Fallback page number.\n if (this._pageLabels) {\n const i = this._pageLabels.indexOf(val);\n if (i >= 0) {\n page = i + 1;\n }\n }\n // The intent can be to just reset a scroll position and/or scale.\n if (!this._setCurrentPageNumber(page, /* resetCurrentPageView = */ true)) {\n console.error(\n `${this._name}.currentPageLabel: \"${val}\" is not a valid page.`\n );\n }\n }\n\n /**\n * @type {number}\n */\n get currentScale() {\n return this._currentScale !== UNKNOWN_SCALE\n ? this._currentScale\n : DEFAULT_SCALE;\n }\n\n /**\n * @param {number} val - Scale of the pages in percents.\n */\n set currentScale(val) {\n if (isNaN(val)) {\n throw new Error(\"Invalid numeric scale.\");\n }\n if (!this.pdfDocument) {\n return;\n }\n this._setScale(val, false);\n }\n\n /**\n * @type {string}\n */\n get currentScaleValue() {\n return this._currentScaleValue;\n }\n\n /**\n * @param val - The scale of the pages (in percent or predefined value).\n */\n set currentScaleValue(val) {\n if (!this.pdfDocument) {\n return;\n }\n this._setScale(val, false);\n }\n\n /**\n * @type {number}\n */\n get pagesRotation() {\n return this._pagesRotation;\n }\n\n /**\n * @param {number} rotation - The rotation of the pages (0, 90, 180, 270).\n */\n set pagesRotation(rotation) {\n if (!isValidRotation(rotation)) {\n throw new Error(\"Invalid pages rotation angle.\");\n }\n if (!this.pdfDocument) {\n return;\n }\n // Normalize the rotation, by clamping it to the [0, 360) range.\n rotation %= 360;\n if (rotation < 0) {\n rotation += 360;\n }\n if (this._pagesRotation === rotation) {\n return; // The rotation didn't change.\n }\n this._pagesRotation = rotation;\n\n const pageNumber = this._currentPageNumber;\n\n for (let i = 0, ii = this._pages.length; i < ii; i++) {\n const pageView = this._pages[i];\n pageView.update(pageView.scale, rotation);\n }\n // Prevent errors in case the rotation changes *before* the scale has been\n // set to a non-default value.\n if (this._currentScaleValue) {\n this._setScale(this._currentScaleValue, true);\n }\n\n this.eventBus.dispatch(\"rotationchanging\", {\n source: this,\n pagesRotation: rotation,\n pageNumber,\n });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n }\n\n get firstPagePromise() {\n return this.pdfDocument ? this._firstPageCapability.promise : null;\n }\n\n get onePageRendered() {\n return this.pdfDocument ? this._onePageRenderedCapability.promise : null;\n }\n\n get pagesPromise() {\n return this.pdfDocument ? this._pagesCapability.promise : null;\n }\n\n /**\n * @private\n */\n get _viewerElement() {\n // In most viewers, e.g. `PDFViewer`, this should return `this.viewer`.\n throw new Error(\"Not implemented: _viewerElement\");\n }\n\n /**\n * @private\n */\n _onePageRenderedOrForceFetch() {\n // Unless the viewer *and* its pages are visible, rendering won't start and\n // `this._onePageRenderedCapability` thus won't be resolved.\n // To ensure that automatic printing, on document load, still works even in\n // those cases we force-allow fetching of all pages when:\n // - The viewer is hidden in the DOM, e.g. in a `display: none` <iframe>\n // element; fixes bug 1618621.\n // - The viewer is visible, but none of the pages are (e.g. if the\n // viewer is very small); fixes bug 1618955.\n if (\n !this.container.offsetParent ||\n this._getVisiblePages().views.length === 0\n ) {\n return Promise.resolve();\n }\n return this._onePageRenderedCapability.promise;\n }\n\n /**\n * @param pdfDocument {PDFDocument}\n */\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this.eventBus.dispatch(\"pagesdestroy\", { source: this });\n\n this._cancelRendering();\n this._resetView();\n\n if (this.findController) {\n this.findController.setDocument(null);\n }\n if (this._scriptingManager) {\n this._scriptingManager.setDocument(null);\n }\n }\n\n this.pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n const isPureXfa = pdfDocument.isPureXfa;\n const pagesCount = pdfDocument.numPages;\n const firstPagePromise = pdfDocument.getPage(1);\n // Rendering (potentially) depends on this, hence fetching it immediately.\n const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();\n\n this._pagesCapability.promise.then(() => {\n this.eventBus.dispatch(\"pagesloaded\", {\n source: this,\n pagesCount,\n });\n });\n\n this._onBeforeDraw = evt => {\n const pageView = this._pages[evt.pageNumber - 1];\n if (!pageView) {\n return;\n }\n // Add the page to the buffer at the start of drawing. That way it can be\n // evicted from the buffer and destroyed even if we pause its rendering.\n this._buffer.push(pageView);\n };\n this.eventBus._on(\"pagerender\", this._onBeforeDraw);\n\n this._onAfterDraw = evt => {\n if (evt.cssTransform || this._onePageRenderedCapability.settled) {\n return;\n }\n this._onePageRenderedCapability.resolve();\n\n this.eventBus._off(\"pagerendered\", this._onAfterDraw);\n this._onAfterDraw = null;\n };\n this.eventBus._on(\"pagerendered\", this._onAfterDraw);\n\n // Fetch a single page so we can get a viewport that will be the default\n // viewport for all pages\n firstPagePromise\n .then(firstPdfPage => {\n this._firstPageCapability.resolve(firstPdfPage);\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n const scale = this.currentScale;\n const viewport = firstPdfPage.getViewport({ scale: scale * CSS_UNITS });\n const textLayerFactory =\n this.textLayerMode !== TextLayerMode.DISABLE ? this : null;\n const xfaLayerFactory = isPureXfa ? this : null;\n\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n const pageView = new PDFPageView({\n container: this._viewerElement,\n eventBus: this.eventBus,\n id: pageNum,\n scale,\n defaultViewport: viewport.clone(),\n optionalContentConfigPromise,\n renderingQueue: this.renderingQueue,\n textLayerFactory,\n textLayerMode: this.textLayerMode,\n annotationLayerFactory: this,\n xfaLayerFactory,\n structTreeLayerFactory: this,\n imageResourcesPath: this.imageResourcesPath,\n renderInteractiveForms: this.renderInteractiveForms,\n renderer: this.renderer,\n useOnlyCssZoom: this.useOnlyCssZoom,\n maxCanvasPixels: this.maxCanvasPixels,\n l10n: this.l10n,\n });\n this._pages.push(pageView);\n }\n // Set the first `pdfPage` immediately, since it's already loaded,\n // rather than having to repeat the `PDFDocumentProxy.getPage` call in\n // the `this._ensurePdfPageLoaded` method before rendering can start.\n const firstPageView = this._pages[0];\n if (firstPageView) {\n firstPageView.setPdfPage(firstPdfPage);\n this.linkService.cachePageRef(1, firstPdfPage.ref);\n }\n if (this._spreadMode !== SpreadMode.NONE) {\n this._updateSpreadMode();\n }\n\n // Fetch all the pages since the viewport is needed before printing\n // starts to create the correct size canvas. Wait until one page is\n // rendered so we don't tie up too many resources early on.\n this._onePageRenderedOrForceFetch().then(() => {\n if (this.findController) {\n this.findController.setDocument(pdfDocument); // Enable searching.\n }\n if (this.enableScripting) {\n this._scriptingManager.setDocument(pdfDocument);\n }\n\n // In addition to 'disableAutoFetch' being set, also attempt to reduce\n // resource usage when loading *very* long/large documents.\n if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > 7500) {\n // XXX: Printing is semi-broken with auto fetch disabled.\n this._pagesCapability.resolve();\n return;\n }\n let getPagesLeft = pagesCount - 1; // The first page was already loaded.\n\n if (getPagesLeft <= 0) {\n this._pagesCapability.resolve();\n return;\n }\n for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {\n pdfDocument.getPage(pageNum).then(\n pdfPage => {\n const pageView = this._pages[pageNum - 1];\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n this.linkService.cachePageRef(pageNum, pdfPage.ref);\n if (--getPagesLeft === 0) {\n this._pagesCapability.resolve();\n }\n },\n reason => {\n console.error(\n `Unable to get page ${pageNum} to initialize viewer`,\n reason\n );\n if (--getPagesLeft === 0) {\n this._pagesCapability.resolve();\n }\n }\n );\n }\n });\n\n this.eventBus.dispatch(\"pagesinit\", { source: this });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n })\n .catch(reason => {\n console.error(\"Unable to initialize viewer\", reason);\n });\n }\n\n /**\n * @param {Array|null} labels\n */\n setPageLabels(labels) {\n if (!this.pdfDocument) {\n return;\n }\n if (!labels) {\n this._pageLabels = null;\n } else if (\n !(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)\n ) {\n this._pageLabels = null;\n console.error(`${this._name}.setPageLabels: Invalid page labels.`);\n } else {\n this._pageLabels = labels;\n }\n // Update all the `PDFPageView` instances.\n for (let i = 0, ii = this._pages.length; i < ii; i++) {\n this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null);\n }\n }\n\n _resetView() {\n this._pages = [];\n this._currentPageNumber = 1;\n this._currentScale = UNKNOWN_SCALE;\n this._currentScaleValue = null;\n this._pageLabels = null;\n this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);\n this._location = null;\n this._pagesRotation = 0;\n this._optionalContentConfigPromise = null;\n this._pagesRequests = new WeakMap();\n this._firstPageCapability = createPromiseCapability();\n this._onePageRenderedCapability = createPromiseCapability();\n this._pagesCapability = createPromiseCapability();\n this._scrollMode = ScrollMode.VERTICAL;\n this._spreadMode = SpreadMode.NONE;\n\n if (this._onBeforeDraw) {\n this.eventBus._off(\"pagerender\", this._onBeforeDraw);\n this._onBeforeDraw = null;\n }\n if (this._onAfterDraw) {\n this.eventBus._off(\"pagerendered\", this._onAfterDraw);\n this._onAfterDraw = null;\n }\n // Remove the pages from the DOM...\n this.viewer.textContent = \"\";\n // ... and reset the Scroll mode CSS class(es) afterwards.\n this._updateScrollMode();\n }\n\n _scrollUpdate() {\n if (this.pagesCount === 0) {\n return;\n }\n this.update();\n }\n\n _scrollIntoView({ pageDiv, pageSpot = null, pageNumber = null }) {\n scrollIntoView(pageDiv, pageSpot);\n }\n\n _setScaleUpdatePages(newScale, newValue, noScroll = false, preset = false) {\n this._currentScaleValue = newValue.toString();\n\n if (isSameScale(this._currentScale, newScale)) {\n if (preset) {\n this.eventBus.dispatch(\"scalechanging\", {\n source: this,\n scale: newScale,\n presetValue: newValue,\n });\n }\n return;\n }\n\n for (let i = 0, ii = this._pages.length; i < ii; i++) {\n this._pages[i].update(newScale);\n }\n this._currentScale = newScale;\n\n if (!noScroll) {\n let page = this._currentPageNumber,\n dest;\n if (\n this._location &&\n !(this.isInPresentationMode || this.isChangingPresentationMode)\n ) {\n page = this._location.pageNumber;\n dest = [\n null,\n { name: \"XYZ\" },\n this._location.left,\n this._location.top,\n null,\n ];\n }\n this.scrollPageIntoView({\n pageNumber: page,\n destArray: dest,\n allowNegativeOffset: true,\n });\n }\n\n this.eventBus.dispatch(\"scalechanging\", {\n source: this,\n scale: newScale,\n presetValue: preset ? newValue : undefined,\n });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n }\n\n /**\n * @private\n */\n get _pageWidthScaleFactor() {\n if (\n this._spreadMode !== SpreadMode.NONE &&\n this._scrollMode !== ScrollMode.HORIZONTAL &&\n !this.isInPresentationMode\n ) {\n return 2;\n }\n return 1;\n }\n\n _setScale(value, noScroll = false) {\n let scale = parseFloat(value);\n\n if (scale > 0) {\n this._setScaleUpdatePages(scale, value, noScroll, /* preset = */ false);\n } else {\n const currentPage = this._pages[this._currentPageNumber - 1];\n if (!currentPage) {\n return;\n }\n const noPadding = this.isInPresentationMode || this.removePageBorders;\n let hPadding = noPadding ? 0 : SCROLLBAR_PADDING;\n let vPadding = noPadding ? 0 : VERTICAL_PADDING;\n\n if (!noPadding && this._isScrollModeHorizontal) {\n [hPadding, vPadding] = [vPadding, hPadding]; // Swap the padding values.\n }\n const pageWidthScale =\n (((this.container.clientWidth - hPadding) / currentPage.width) *\n currentPage.scale) /\n this._pageWidthScaleFactor;\n const pageHeightScale =\n ((this.container.clientHeight - vPadding) / currentPage.height) *\n currentPage.scale;\n switch (value) {\n case \"page-actual\":\n scale = 1;\n break;\n case \"page-width\":\n scale = pageWidthScale;\n break;\n case \"page-height\":\n scale = pageHeightScale;\n break;\n case \"page-fit\":\n scale = Math.min(pageWidthScale, pageHeightScale);\n break;\n case \"auto\":\n // For pages in landscape mode, fit the page height to the viewer\n // *unless* the page would thus become too wide to fit horizontally.\n const horizontalScale = isPortraitOrientation(currentPage)\n ? pageWidthScale\n : Math.min(pageHeightScale, pageWidthScale);\n scale = Math.min(MAX_AUTO_SCALE, horizontalScale);\n break;\n default:\n console.error(\n `${this._name}._setScale: \"${value}\" is an unknown zoom value.`\n );\n return;\n }\n this._setScaleUpdatePages(scale, value, noScroll, /* preset = */ true);\n }\n }\n\n /**\n * Refreshes page view: scrolls to the current page and updates the scale.\n * @private\n */\n _resetCurrentPageView() {\n if (this.isInPresentationMode) {\n // Fixes the case when PDF has different page sizes.\n this._setScale(this._currentScaleValue, true);\n }\n\n const pageView = this._pages[this._currentPageNumber - 1];\n this._scrollIntoView({ pageDiv: pageView.div });\n }\n\n /**\n * @param {string} label - The page label.\n * @returns {number|null} The page number corresponding to the page label,\n * or `null` when no page labels exist and/or the input is invalid.\n */\n pageLabelToPageNumber(label) {\n if (!this._pageLabels) {\n return null;\n }\n const i = this._pageLabels.indexOf(label);\n if (i < 0) {\n return null;\n }\n return i + 1;\n }\n\n /**\n * @typedef ScrollPageIntoViewParameters\n * @property {number} pageNumber - The page number.\n * @property {Array} [destArray] - The original PDF destination array, in the\n * format: <page-ref> </XYZ|/FitXXX> <args..>\n * @property {boolean} [allowNegativeOffset] - Allow negative page offsets.\n * The default value is `false`.\n * @property {boolean} [ignoreDestinationZoom] - Ignore the zoom argument in\n * the destination array. The default value is `false`.\n */\n\n /**\n * Scrolls page into view.\n * @param {ScrollPageIntoViewParameters} params\n */\n scrollPageIntoView({\n pageNumber,\n destArray = null,\n allowNegativeOffset = false,\n ignoreDestinationZoom = false,\n }) {\n if (!this.pdfDocument) {\n return;\n }\n const pageView =\n Number.isInteger(pageNumber) && this._pages[pageNumber - 1];\n if (!pageView) {\n console.error(\n `${this._name}.scrollPageIntoView: ` +\n `\"${pageNumber}\" is not a valid pageNumber parameter.`\n );\n return;\n }\n\n if (this.isInPresentationMode || !destArray) {\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n return;\n }\n let x = 0,\n y = 0;\n let width = 0,\n height = 0,\n widthScale,\n heightScale;\n const changeOrientation = pageView.rotation % 180 !== 0;\n const pageWidth =\n (changeOrientation ? pageView.height : pageView.width) /\n pageView.scale /\n CSS_UNITS;\n const pageHeight =\n (changeOrientation ? pageView.width : pageView.height) /\n pageView.scale /\n CSS_UNITS;\n let scale = 0;\n switch (destArray[1].name) {\n case \"XYZ\":\n x = destArray[2];\n y = destArray[3];\n scale = destArray[4];\n // If x and/or y coordinates are not supplied, default to\n // _top_ left of the page (not the obvious bottom left,\n // since aligning the bottom of the intended page with the\n // top of the window is rarely helpful).\n x = x !== null ? x : 0;\n y = y !== null ? y : pageHeight;\n break;\n case \"Fit\":\n case \"FitB\":\n scale = \"page-fit\";\n break;\n case \"FitH\":\n case \"FitBH\":\n y = destArray[2];\n scale = \"page-width\";\n // According to the PDF spec, section 12.3.2.2, a `null` value in the\n // parameter should maintain the position relative to the new page.\n if (y === null && this._location) {\n x = this._location.left;\n y = this._location.top;\n } else if (typeof y !== \"number\") {\n // The \"top\" value isn't optional, according to the spec, however some\n // bad PDF generators will pretend that it is (fixes bug 1663390).\n y = pageHeight;\n }\n break;\n case \"FitV\":\n case \"FitBV\":\n x = destArray[2];\n width = pageWidth;\n height = pageHeight;\n scale = \"page-height\";\n break;\n case \"FitR\":\n x = destArray[2];\n y = destArray[3];\n width = destArray[4] - x;\n height = destArray[5] - y;\n const hPadding = this.removePageBorders ? 0 : SCROLLBAR_PADDING;\n const vPadding = this.removePageBorders ? 0 : VERTICAL_PADDING;\n\n widthScale =\n (this.container.clientWidth - hPadding) / width / CSS_UNITS;\n heightScale =\n (this.container.clientHeight - vPadding) / height / CSS_UNITS;\n scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));\n break;\n default:\n console.error(\n `${this._name}.scrollPageIntoView: ` +\n `\"${destArray[1].name}\" is not a valid destination type.`\n );\n return;\n }\n\n if (!ignoreDestinationZoom) {\n if (scale && scale !== this._currentScale) {\n this.currentScaleValue = scale;\n } else if (this._currentScale === UNKNOWN_SCALE) {\n this.currentScaleValue = DEFAULT_SCALE_VALUE;\n }\n }\n\n if (scale === \"page-fit\" && !destArray[4]) {\n this._scrollIntoView({\n pageDiv: pageView.div,\n pageNumber,\n });\n return;\n }\n\n const boundingRect = [\n pageView.viewport.convertToViewportPoint(x, y),\n pageView.viewport.convertToViewportPoint(x + width, y + height),\n ];\n let left = Math.min(boundingRect[0][0], boundingRect[1][0]);\n let top = Math.min(boundingRect[0][1], boundingRect[1][1]);\n\n if (!allowNegativeOffset) {\n // Some bad PDF generators will create destinations with e.g. top values\n // that exceeds the page height. Ensure that offsets are not negative,\n // to prevent a previous page from becoming visible (fixes bug 874482).\n left = Math.max(left, 0);\n top = Math.max(top, 0);\n }\n this._scrollIntoView({\n pageDiv: pageView.div,\n pageSpot: { left, top },\n pageNumber,\n });\n }\n\n _updateLocation(firstPage) {\n const currentScale = this._currentScale;\n const currentScaleValue = this._currentScaleValue;\n const normalizedScaleValue =\n parseFloat(currentScaleValue) === currentScale\n ? Math.round(currentScale * 10000) / 100\n : currentScaleValue;\n\n const pageNumber = firstPage.id;\n let pdfOpenParams = \"#page=\" + pageNumber;\n pdfOpenParams += \"&zoom=\" + normalizedScaleValue;\n const currentPageView = this._pages[pageNumber - 1];\n const container = this.container;\n const topLeft = currentPageView.getPagePoint(\n container.scrollLeft - firstPage.x,\n container.scrollTop - firstPage.y\n );\n const intLeft = Math.round(topLeft[0]);\n const intTop = Math.round(topLeft[1]);\n pdfOpenParams += \",\" + intLeft + \",\" + intTop;\n\n this._location = {\n pageNumber,\n scale: normalizedScaleValue,\n top: intTop,\n left: intLeft,\n rotation: this._pagesRotation,\n pdfOpenParams,\n };\n }\n\n _updateHelper(visiblePages) {\n throw new Error(\"Not implemented: _updateHelper\");\n }\n\n update() {\n const visible = this._getVisiblePages();\n const visiblePages = visible.views,\n numVisiblePages = visiblePages.length;\n\n if (numVisiblePages === 0) {\n return;\n }\n const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);\n this._buffer.resize(newCacheSize, visiblePages);\n\n this.renderingQueue.renderHighestPriority(visible);\n\n this._updateHelper(visiblePages); // Run any class-specific update code.\n\n this._updateLocation(visible.first);\n this.eventBus.dispatch(\"updateviewarea\", {\n source: this,\n location: this._location,\n });\n }\n\n containsElement(element) {\n return this.container.contains(element);\n }\n\n focus() {\n this.container.focus();\n }\n\n get _isScrollModeHorizontal() {\n // Used to ensure that pre-rendering of the next/previous page works\n // correctly, since Scroll/Spread modes are ignored in Presentation Mode.\n return this.isInPresentationMode\n ? false\n : this._scrollMode === ScrollMode.HORIZONTAL;\n }\n\n get _isContainerRtl() {\n return getComputedStyle(this.container).direction === \"rtl\";\n }\n\n get isInPresentationMode() {\n return this.presentationModeState === PresentationModeState.FULLSCREEN;\n }\n\n get isChangingPresentationMode() {\n return this.presentationModeState === PresentationModeState.CHANGING;\n }\n\n get isHorizontalScrollbarEnabled() {\n return this.isInPresentationMode\n ? false\n : this.container.scrollWidth > this.container.clientWidth;\n }\n\n get isVerticalScrollbarEnabled() {\n return this.isInPresentationMode\n ? false\n : this.container.scrollHeight > this.container.clientHeight;\n }\n\n /**\n * Helper method for `this._getVisiblePages`. Should only ever be used when\n * the viewer can only display a single page at a time, for example in:\n * - `PDFSinglePageViewer`.\n * - `PDFViewer` with Presentation Mode active.\n */\n _getCurrentVisiblePage() {\n if (!this.pagesCount) {\n return { views: [] };\n }\n const pageView = this._pages[this._currentPageNumber - 1];\n // NOTE: Compute the `x` and `y` properties of the current view,\n // since `this._updateLocation` depends of them being available.\n const element = pageView.div;\n\n const view = {\n id: pageView.id,\n x: element.offsetLeft + element.clientLeft,\n y: element.offsetTop + element.clientTop,\n view: pageView,\n };\n return { first: view, last: view, views: [view] };\n }\n\n _getVisiblePages() {\n return getVisibleElements({\n scrollEl: this.container,\n views: this._pages,\n sortByVisibility: true,\n horizontal: this._isScrollModeHorizontal,\n rtl: this._isScrollModeHorizontal && this._isContainerRtl,\n });\n }\n\n /**\n * @param {number} pageNumber\n */\n isPageVisible(pageNumber) {\n if (!this.pdfDocument) {\n return false;\n }\n if (\n !(\n Number.isInteger(pageNumber) &&\n pageNumber > 0 &&\n pageNumber <= this.pagesCount\n )\n ) {\n console.error(\n `${this._name}.isPageVisible: \"${pageNumber}\" is not a valid page.`\n );\n return false;\n }\n return this._getVisiblePages().views.some(function (view) {\n return view.id === pageNumber;\n });\n }\n\n /**\n * @param {number} pageNumber\n */\n isPageCached(pageNumber) {\n if (!this.pdfDocument || !this._buffer) {\n return false;\n }\n if (\n !(\n Number.isInteger(pageNumber) &&\n pageNumber > 0 &&\n pageNumber <= this.pagesCount\n )\n ) {\n console.error(\n `${this._name}.isPageCached: \"${pageNumber}\" is not a valid page.`\n );\n return false;\n }\n const pageView = this._pages[pageNumber - 1];\n if (!pageView) {\n return false;\n }\n return this._buffer.has(pageView);\n }\n\n cleanup() {\n for (let i = 0, ii = this._pages.length; i < ii; i++) {\n if (\n this._pages[i] &&\n this._pages[i].renderingState !== RenderingStates.FINISHED\n ) {\n this._pages[i].reset();\n }\n }\n }\n\n /**\n * @private\n */\n _cancelRendering() {\n for (let i = 0, ii = this._pages.length; i < ii; i++) {\n if (this._pages[i]) {\n this._pages[i].cancelRendering();\n }\n }\n }\n\n /**\n * @param {PDFPageView} pageView\n * @returns {Promise} Returns a promise containing a {PDFPageProxy} object.\n * @private\n */\n _ensurePdfPageLoaded(pageView) {\n if (pageView.pdfPage) {\n return Promise.resolve(pageView.pdfPage);\n }\n if (this._pagesRequests.has(pageView)) {\n return this._pagesRequests.get(pageView);\n }\n const promise = this.pdfDocument\n .getPage(pageView.id)\n .then(pdfPage => {\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n this._pagesRequests.delete(pageView);\n return pdfPage;\n })\n .catch(reason => {\n console.error(\"Unable to get page for page view\", reason);\n // Page error -- there is nothing that can be done.\n this._pagesRequests.delete(pageView);\n });\n this._pagesRequests.set(pageView, promise);\n return promise;\n }\n\n forceRendering(currentlyVisiblePages) {\n const visiblePages = currentlyVisiblePages || this._getVisiblePages();\n const scrollAhead = this._isScrollModeHorizontal\n ? this.scroll.right\n : this.scroll.down;\n const pageView = this.renderingQueue.getHighestPriority(\n visiblePages,\n this._pages,\n scrollAhead\n );\n if (pageView) {\n this._ensurePdfPageLoaded(pageView).then(() => {\n this.renderingQueue.renderView(pageView);\n });\n return true;\n }\n return false;\n }\n\n /**\n * @param {HTMLDivElement} textLayerDiv\n * @param {number} pageIndex\n * @param {PageViewport} viewport\n * @param {boolean} enhanceTextSelection\n * @param {EventBus} eventBus\n * @returns {TextLayerBuilder}\n */\n createTextLayerBuilder(\n textLayerDiv,\n pageIndex,\n viewport,\n enhanceTextSelection = false,\n eventBus\n ) {\n return new TextLayerBuilder({\n textLayerDiv,\n eventBus,\n pageIndex,\n viewport,\n findController: this.isInPresentationMode ? null : this.findController,\n enhanceTextSelection: this.isInPresentationMode\n ? false\n : enhanceTextSelection,\n });\n }\n\n /**\n * @param {HTMLDivElement} pageDiv\n * @param {PDFPage} pdfPage\n * @param {AnnotationStorage} [annotationStorage] - Storage for annotation\n * data in forms.\n * @param {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @param {boolean} renderInteractiveForms\n * @param {IL10n} l10n\n * @param {boolean} [enableScripting]\n * @param {Promise<boolean>} [hasJSActionsPromise]\n * @param {Object} [mouseState]\n * @returns {AnnotationLayerBuilder}\n */\n createAnnotationLayerBuilder(\n pageDiv,\n pdfPage,\n annotationStorage = null,\n imageResourcesPath = \"\",\n renderInteractiveForms = false,\n l10n = NullL10n,\n enableScripting = null,\n hasJSActionsPromise = null,\n mouseState = null\n ) {\n return new AnnotationLayerBuilder({\n pageDiv,\n pdfPage,\n annotationStorage:\n annotationStorage || this.pdfDocument?.annotationStorage,\n imageResourcesPath,\n renderInteractiveForms,\n linkService: this.linkService,\n downloadManager: this.downloadManager,\n l10n,\n enableScripting: enableScripting ?? this.enableScripting,\n hasJSActionsPromise:\n hasJSActionsPromise || this.pdfDocument?.hasJSActions(),\n mouseState: mouseState || this._scriptingManager?.mouseState,\n });\n }\n\n /**\n * @param {HTMLDivElement} pageDiv\n * @param {PDFPage} pdfPage\n * @param {AnnotationStorage} [annotationStorage] - Storage for annotation\n * data in forms.\n * @returns {XfaLayerBuilder}\n */\n createXfaLayerBuilder(pageDiv, pdfPage, annotationStorage = null) {\n return new XfaLayerBuilder({\n pageDiv,\n pdfPage,\n annotationStorage:\n annotationStorage || this.pdfDocument?.annotationStorage,\n });\n }\n\n /**\n * @param {PDFPage} pdfPage\n * @returns {StructTreeLayerBuilder}\n */\n createStructTreeLayerBuilder(pdfPage) {\n return new StructTreeLayerBuilder({\n pdfPage,\n });\n }\n\n /**\n * @type {boolean} Whether all pages of the PDF document have identical\n * widths and heights.\n */\n get hasEqualPageSizes() {\n const firstPageView = this._pages[0];\n for (let i = 1, ii = this._pages.length; i < ii; ++i) {\n const pageView = this._pages[i];\n if (\n pageView.width !== firstPageView.width ||\n pageView.height !== firstPageView.height\n ) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Returns sizes of the pages.\n * @returns {Array} Array of objects with width/height/rotation fields.\n */\n getPagesOverview() {\n return this._pages.map(pageView => {\n const viewport = pageView.pdfPage.getViewport({ scale: 1 });\n\n if (!this.enablePrintAutoRotate || isPortraitOrientation(viewport)) {\n return {\n width: viewport.width,\n height: viewport.height,\n rotation: viewport.rotation,\n };\n }\n // Landscape orientation.\n return {\n width: viewport.height,\n height: viewport.width,\n rotation: (viewport.rotation - 90) % 360,\n };\n });\n }\n\n /**\n * @type {Promise<OptionalContentConfig | null>}\n */\n get optionalContentConfigPromise() {\n if (!this.pdfDocument) {\n return Promise.resolve(null);\n }\n if (!this._optionalContentConfigPromise) {\n // Prevent issues if the getter is accessed *before* the `onePageRendered`\n // promise has resolved; won't (normally) happen in the default viewer.\n return this.pdfDocument.getOptionalContentConfig();\n }\n return this._optionalContentConfigPromise;\n }\n\n /**\n * @param {Promise<OptionalContentConfig>} promise - A promise that is\n * resolved with an {@link OptionalContentConfig} instance.\n */\n set optionalContentConfigPromise(promise) {\n if (!(promise instanceof Promise)) {\n throw new Error(`Invalid optionalContentConfigPromise: ${promise}`);\n }\n if (!this.pdfDocument) {\n return;\n }\n if (!this._optionalContentConfigPromise) {\n // Ignore the setter *before* the `onePageRendered` promise has resolved,\n // since it'll be overwritten anyway; won't happen in the default viewer.\n return;\n }\n this._optionalContentConfigPromise = promise;\n\n for (const pageView of this._pages) {\n pageView.update(pageView.scale, pageView.rotation, promise);\n }\n this.update();\n\n this.eventBus.dispatch(\"optionalcontentconfigchanged\", {\n source: this,\n promise,\n });\n }\n\n /**\n * @type {number} One of the values in {ScrollMode}.\n */\n get scrollMode() {\n return this._scrollMode;\n }\n\n /**\n * @param {number} mode - The direction in which the document pages should be\n * laid out within the scrolling container.\n * The constants from {ScrollMode} should be used.\n */\n set scrollMode(mode) {\n if (this._scrollMode === mode) {\n return; // The Scroll mode didn't change.\n }\n if (!isValidScrollMode(mode)) {\n throw new Error(`Invalid scroll mode: ${mode}`);\n }\n this._scrollMode = mode;\n this.eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n\n this._updateScrollMode(/* pageNumber = */ this._currentPageNumber);\n }\n\n _updateScrollMode(pageNumber = null) {\n const scrollMode = this._scrollMode,\n viewer = this.viewer;\n\n viewer.classList.toggle(\n \"scrollHorizontal\",\n scrollMode === ScrollMode.HORIZONTAL\n );\n viewer.classList.toggle(\"scrollWrapped\", scrollMode === ScrollMode.WRAPPED);\n\n if (!this.pdfDocument || !pageNumber) {\n return;\n }\n // Non-numeric scale values can be sensitive to the scroll orientation.\n // Call this before re-scrolling to the current page, to ensure that any\n // changes in scale don't move the current page.\n if (this._currentScaleValue && isNaN(this._currentScaleValue)) {\n this._setScale(this._currentScaleValue, true);\n }\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n this.update();\n }\n\n /**\n * @type {number} One of the values in {SpreadMode}.\n */\n get spreadMode() {\n return this._spreadMode;\n }\n\n /**\n * @param {number} mode - Group the pages in spreads, starting with odd- or\n * even-number pages (unless `SpreadMode.NONE` is used).\n * The constants from {SpreadMode} should be used.\n */\n set spreadMode(mode) {\n if (this._spreadMode === mode) {\n return; // The Spread mode didn't change.\n }\n if (!isValidSpreadMode(mode)) {\n throw new Error(`Invalid spread mode: ${mode}`);\n }\n this._spreadMode = mode;\n this.eventBus.dispatch(\"spreadmodechanged\", { source: this, mode });\n\n this._updateSpreadMode(/* pageNumber = */ this._currentPageNumber);\n }\n\n _updateSpreadMode(pageNumber = null) {\n if (!this.pdfDocument) {\n return;\n }\n const viewer = this.viewer,\n pages = this._pages;\n // Temporarily remove all the pages from the DOM.\n viewer.textContent = \"\";\n\n if (this._spreadMode === SpreadMode.NONE) {\n for (let i = 0, iMax = pages.length; i < iMax; ++i) {\n viewer.appendChild(pages[i].div);\n }\n } else {\n const parity = this._spreadMode - 1;\n let spread = null;\n for (let i = 0, iMax = pages.length; i < iMax; ++i) {\n if (spread === null) {\n spread = document.createElement(\"div\");\n spread.className = \"spread\";\n viewer.appendChild(spread);\n } else if (i % 2 === parity) {\n spread = spread.cloneNode(false);\n viewer.appendChild(spread);\n }\n spread.appendChild(pages[i].div);\n }\n }\n\n if (!pageNumber) {\n return;\n }\n if (this._currentScaleValue && isNaN(this._currentScaleValue)) {\n this._setScale(this._currentScaleValue, true);\n }\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n this.update();\n }\n\n /**\n * @private\n */\n _getPageAdvance(currentPageNumber, previous = false) {\n if (this.isInPresentationMode) {\n return 1;\n }\n switch (this._scrollMode) {\n case ScrollMode.WRAPPED: {\n const { views } = this._getVisiblePages(),\n pageLayout = new Map();\n\n // Determine the current (visible) page layout.\n for (const { id, y, percent, widthPercent } of views) {\n if (percent === 0 || widthPercent < 100) {\n continue;\n }\n let yArray = pageLayout.get(y);\n if (!yArray) {\n pageLayout.set(y, (yArray ||= []));\n }\n yArray.push(id);\n }\n // Find the row of the current page.\n for (const yArray of pageLayout.values()) {\n const currentIndex = yArray.indexOf(currentPageNumber);\n if (currentIndex === -1) {\n continue;\n }\n const numPages = yArray.length;\n if (numPages === 1) {\n break;\n }\n // Handle documents with varying page sizes.\n if (previous) {\n for (let i = currentIndex - 1, ii = 0; i >= ii; i--) {\n const currentId = yArray[i],\n expectedId = yArray[i + 1] - 1;\n if (currentId < expectedId) {\n return currentPageNumber - expectedId;\n }\n }\n } else {\n for (let i = currentIndex + 1, ii = numPages; i < ii; i++) {\n const currentId = yArray[i],\n expectedId = yArray[i - 1] + 1;\n if (currentId > expectedId) {\n return expectedId - currentPageNumber;\n }\n }\n }\n // The current row is \"complete\", advance to the previous/next one.\n if (previous) {\n const firstId = yArray[0];\n if (firstId < currentPageNumber) {\n return currentPageNumber - firstId + 1;\n }\n } else {\n const lastId = yArray[numPages - 1];\n if (lastId > currentPageNumber) {\n return lastId - currentPageNumber + 1;\n }\n }\n break;\n }\n break;\n }\n case ScrollMode.HORIZONTAL: {\n break;\n }\n case ScrollMode.VERTICAL: {\n if (this._spreadMode === SpreadMode.NONE) {\n break; // Normal vertical scrolling.\n }\n const parity = this._spreadMode - 1;\n\n if (previous && currentPageNumber % 2 !== parity) {\n break; // Left-hand side page.\n } else if (!previous && currentPageNumber % 2 === parity) {\n break; // Right-hand side page.\n }\n const { views } = this._getVisiblePages(),\n expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1;\n\n for (const { id, percent, widthPercent } of views) {\n if (id !== expectedId) {\n continue;\n }\n if (percent > 0 && widthPercent === 100) {\n return 2;\n }\n break;\n }\n break;\n }\n }\n return 1;\n }\n\n /**\n * Go to the next page, taking scroll/spread-modes into account.\n * @returns {boolean} Whether navigation occured.\n */\n nextPage() {\n const currentPageNumber = this._currentPageNumber,\n pagesCount = this.pagesCount;\n\n if (currentPageNumber >= pagesCount) {\n return false;\n }\n const advance =\n this._getPageAdvance(currentPageNumber, /* previous = */ false) || 1;\n\n this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);\n return true;\n }\n\n /**\n * Go to the previous page, taking scroll/spread-modes into account.\n * @returns {boolean} Whether navigation occured.\n */\n previousPage() {\n const currentPageNumber = this._currentPageNumber;\n\n if (currentPageNumber <= 1) {\n return false;\n }\n const advance =\n this._getPageAdvance(currentPageNumber, /* previous = */ true) || 1;\n\n this.currentPageNumber = Math.max(currentPageNumber - advance, 1);\n return true;\n }\n}\n\nexport { BaseViewer };\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 { AnnotationLayer } from \"pdfjs-lib\";\nimport { NullL10n } from \"./l10n_utils.js\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\n\n/**\n * @typedef {Object} AnnotationLayerBuilderOptions\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPage} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @property {boolean} renderInteractiveForms\n * @property {IPDFLinkService} linkService\n * @property {DownloadManager} downloadManager\n * @property {IL10n} l10n - Localization service.\n * @property {boolean} [enableScripting]\n * @property {Promise<boolean>} [hasJSActionsPromise]\n * @property {Object} [mouseState]\n */\n\nclass AnnotationLayerBuilder {\n /**\n * @param {AnnotationLayerBuilderOptions} options\n */\n constructor({\n pageDiv,\n pdfPage,\n linkService,\n downloadManager,\n annotationStorage = null,\n imageResourcesPath = \"\",\n renderInteractiveForms = true,\n l10n = NullL10n,\n enableScripting = false,\n hasJSActionsPromise = null,\n mouseState = null,\n }) {\n this.pageDiv = pageDiv;\n this.pdfPage = pdfPage;\n this.linkService = linkService;\n this.downloadManager = downloadManager;\n this.imageResourcesPath = imageResourcesPath;\n this.renderInteractiveForms = renderInteractiveForms;\n this.l10n = l10n;\n this.annotationStorage = annotationStorage;\n this.enableScripting = enableScripting;\n this._hasJSActionsPromise = hasJSActionsPromise;\n this._mouseState = mouseState;\n\n this.div = null;\n this._cancelled = false;\n }\n\n /**\n * @param {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n * @returns {Promise<void>} A promise that is resolved when rendering of the\n * annotations is complete.\n */\n render(viewport, intent = \"display\") {\n return Promise.all([\n this.pdfPage.getAnnotations({ intent }),\n this._hasJSActionsPromise,\n ]).then(([annotations, hasJSActions = false]) => {\n if (this._cancelled) {\n return;\n }\n if (annotations.length === 0) {\n return;\n }\n\n const parameters = {\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n annotations,\n page: this.pdfPage,\n imageResourcesPath: this.imageResourcesPath,\n renderInteractiveForms: this.renderInteractiveForms,\n linkService: this.linkService,\n downloadManager: this.downloadManager,\n annotationStorage: this.annotationStorage,\n enableScripting: this.enableScripting,\n hasJSActions,\n mouseState: this._mouseState,\n };\n\n if (this.div) {\n // If an annotationLayer already exists, refresh its children's\n // transformation matrices.\n AnnotationLayer.update(parameters);\n } else {\n // Create an annotation layer div and render the annotations\n // if there is at least one annotation.\n this.div = document.createElement(\"div\");\n this.div.className = \"annotationLayer\";\n this.pageDiv.appendChild(this.div);\n parameters.div = this.div;\n\n AnnotationLayer.render(parameters);\n this.l10n.translate(this.div);\n }\n });\n }\n\n cancel() {\n this._cancelled = true;\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n}\n\n/**\n * @implements IPDFAnnotationLayerFactory\n */\nclass DefaultAnnotationLayerFactory {\n /**\n * @param {HTMLDivElement} pageDiv\n * @param {PDFPage} pdfPage\n * @param {AnnotationStorage} [annotationStorage]\n * @param {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @param {boolean} renderInteractiveForms\n * @param {IL10n} l10n\n * @param {boolean} [enableScripting]\n * @param {Promise<boolean>} [hasJSActionsPromise]\n * @param {Object} [mouseState]\n * @returns {AnnotationLayerBuilder}\n */\n createAnnotationLayerBuilder(\n pageDiv,\n pdfPage,\n annotationStorage = null,\n imageResourcesPath = \"\",\n renderInteractiveForms = true,\n l10n = NullL10n,\n enableScripting = false,\n hasJSActionsPromise = null,\n mouseState = null\n ) {\n return new AnnotationLayerBuilder({\n pageDiv,\n pdfPage,\n imageResourcesPath,\n renderInteractiveForms,\n linkService: new SimpleLinkService(),\n l10n,\n annotationStorage,\n enableScripting,\n hasJSActionsPromise,\n mouseState,\n });\n }\n}\n\nexport { AnnotationLayerBuilder, DefaultAnnotationLayerFactory };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A subset of the l10n strings in the `l10n/en-US/viewer.properties` file.\n */\nconst DEFAULT_L10N_STRINGS = {\n of_pages: \"of {{pagesCount}}\",\n page_of_pages: \"({{pageNumber}} of {{pagesCount}})\",\n\n document_properties_kb: \"{{size_kb}} KB ({{size_b}} bytes)\",\n document_properties_mb: \"{{size_mb}} MB ({{size_b}} bytes)\",\n document_properties_date_string: \"{{date}}, {{time}}\",\n document_properties_page_size_unit_inches: \"in\",\n document_properties_page_size_unit_millimeters: \"mm\",\n document_properties_page_size_orientation_portrait: \"portrait\",\n document_properties_page_size_orientation_landscape: \"landscape\",\n document_properties_page_size_name_a3: \"A3\",\n document_properties_page_size_name_a4: \"A4\",\n document_properties_page_size_name_letter: \"Letter\",\n document_properties_page_size_name_legal: \"Legal\",\n document_properties_page_size_dimension_string:\n \"{{width}} × {{height}} {{unit}} ({{orientation}})\",\n document_properties_page_size_dimension_name_string:\n \"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})\",\n document_properties_linearized_yes: \"Yes\",\n document_properties_linearized_no: \"No\",\n\n print_progress_percent: \"{{progress}}%\",\n\n \"toggle_sidebar.title\": \"Toggle Sidebar\",\n \"toggle_sidebar_notification2.title\":\n \"Toggle Sidebar (document contains outline/attachments/layers)\",\n\n additional_layers: \"Additional Layers\",\n page_landmark: \"Page {{page}}\",\n thumb_page_title: \"Page {{page}}\",\n thumb_page_canvas: \"Thumbnail of Page {{page}}\",\n\n find_reached_top: \"Reached top of document, continued from bottom\",\n find_reached_bottom: \"Reached end of document, continued from top\",\n \"find_match_count[one]\": \"{{current}} of {{total}} match\",\n \"find_match_count[other]\": \"{{current}} of {{total}} matches\",\n \"find_match_count_limit[one]\": \"More than {{limit}} match\",\n \"find_match_count_limit[other]\": \"More than {{limit}} matches\",\n find_not_found: \"Phrase not found\",\n\n error_version_info: \"PDF.js v{{version}} (build: {{build}})\",\n error_message: \"Message: {{message}}\",\n error_stack: \"Stack: {{stack}}\",\n error_file: \"File: {{file}}\",\n error_line: \"Line: {{line}}\",\n rendering_error: \"An error occurred while rendering the page.\",\n\n page_scale_width: \"Page Width\",\n page_scale_fit: \"Page Fit\",\n page_scale_auto: \"Automatic Zoom\",\n page_scale_actual: \"Actual Size\",\n page_scale_percent: \"{{scale}}%\",\n\n loading: \"Loading…\",\n loading_error: \"An error occurred while loading the PDF.\",\n invalid_file_error: \"Invalid or corrupted PDF file.\",\n missing_file_error: \"Missing PDF file.\",\n unexpected_response_error: \"Unexpected server response.\",\n\n printing_not_supported:\n \"Warning: Printing is not fully supported by this browser.\",\n printing_not_ready: \"Warning: The PDF is not fully loaded for printing.\",\n web_fonts_disabled:\n \"Web fonts are disabled: unable to use embedded PDF fonts.\",\n};\n\nfunction getL10nFallback(key, args) {\n switch (key) {\n case \"find_match_count\":\n key = `find_match_count[${args.total === 1 ? \"one\" : \"other\"}]`;\n break;\n case \"find_match_count_limit\":\n key = `find_match_count_limit[${args.limit === 1 ? \"one\" : \"other\"}]`;\n break;\n }\n return DEFAULT_L10N_STRINGS[key] || \"\";\n}\n\nconst PARTIAL_LANG_CODES = {\n en: \"en-US\",\n es: \"es-ES\",\n fy: \"fy-NL\",\n ga: \"ga-IE\",\n gu: \"gu-IN\",\n hi: \"hi-IN\",\n hy: \"hy-AM\",\n nb: \"nb-NO\",\n ne: \"ne-NP\",\n nn: \"nn-NO\",\n pa: \"pa-IN\",\n pt: \"pt-PT\",\n sv: \"sv-SE\",\n zh: \"zh-CN\",\n};\n\n// Try to support \"incompletely\" specified language codes (see issue 13689).\nfunction fixupLangCode(langCode) {\n return PARTIAL_LANG_CODES[langCode?.toLowerCase()] || langCode;\n}\n\n// Replaces {{arguments}} with their values.\nfunction formatL10nValue(text, args) {\n if (!args) {\n return text;\n }\n return text.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (all, name) => {\n return name in args ? args[name] : \"{{\" + name + \"}}\";\n });\n}\n\n/**\n * No-op implementation of the localization service.\n * @implements {IL10n}\n */\nconst NullL10n = {\n async getLanguage() {\n return \"en-us\";\n },\n\n async getDirection() {\n return \"ltr\";\n },\n\n async get(key, args = null, fallback = getL10nFallback(key, args)) {\n return formatL10nValue(fallback, args);\n },\n\n async translate(element) {},\n};\n\nexport { fixupLangCode, getL10nFallback, NullL10n };\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 approximateFraction,\n CSS_UNITS,\n DEFAULT_SCALE,\n getOutputScale,\n RendererType,\n roundToDivide,\n TextLayerMode,\n} from \"./ui_utils.js\";\nimport {\n createPromiseCapability,\n RenderingCancelledException,\n SVGGraphics,\n} from \"pdfjs-lib\";\nimport { NullL10n } from \"./l10n_utils.js\";\nimport { RenderingStates } from \"./pdf_rendering_queue.js\";\nimport { viewerCompatibilityParams } from \"./viewer_compatibility.js\";\n\n/**\n * @typedef {Object} PDFPageViewOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} id - The page unique ID (normally its number).\n * @property {number} scale - The page scale display.\n * @property {PageViewport} defaultViewport - The page viewport.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -\n * A promise that is resolved with an {@link OptionalContentConfig} instance.\n * The default value is `null`.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {IPDFTextLayerFactory} textLayerFactory\n * @property {number} [textLayerMode] - Controls if the text layer used for\n * selection and searching is created, and if the improved text selection\n * behaviour is enabled. The constants from {TextLayerMode} should be used.\n * The default value is `TextLayerMode.ENABLE`.\n * @property {IPDFAnnotationLayerFactory} annotationLayerFactory\n * @property {IPDFXfaLayerFactory} xfaLayerFactory\n * @property {IPDFStructTreeLayerFactory} structTreeLayerFactory\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @property {boolean} renderInteractiveForms - Turns on rendering of\n * interactive form elements. The default value is `true`.\n * @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.\n * @property {boolean} [useOnlyCssZoom] - Enables CSS only zooming. The default\n * value is `false`.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n * total pixels, i.e. width * height. Use -1 for no limit. The default value\n * is 4096 * 4096 (16 mega-pixels).\n * @property {IL10n} l10n - Localization service.\n */\n\nconst MAX_CANVAS_PIXELS = viewerCompatibilityParams.maxCanvasPixels || 16777216;\n\n/**\n * @implements {IRenderableView}\n */\nclass PDFPageView {\n /**\n * @param {PDFPageViewOptions} options\n */\n constructor(options) {\n const container = options.container;\n const defaultViewport = options.defaultViewport;\n\n this.id = options.id;\n this.renderingId = \"page\" + this.id;\n\n this.pdfPage = null;\n this.pageLabel = null;\n this.rotation = 0;\n this.scale = options.scale || DEFAULT_SCALE;\n this.viewport = defaultViewport;\n this.pdfPageRotate = defaultViewport.rotation;\n this._optionalContentConfigPromise =\n options.optionalContentConfigPromise || null;\n this.hasRestrictedScaling = false;\n this.textLayerMode = Number.isInteger(options.textLayerMode)\n ? options.textLayerMode\n : TextLayerMode.ENABLE;\n this.imageResourcesPath = options.imageResourcesPath || \"\";\n this.renderInteractiveForms = options.renderInteractiveForms !== false;\n this.useOnlyCssZoom = options.useOnlyCssZoom || false;\n this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;\n\n this.eventBus = options.eventBus;\n this.renderingQueue = options.renderingQueue;\n this.textLayerFactory = options.textLayerFactory;\n this.annotationLayerFactory = options.annotationLayerFactory;\n this.xfaLayerFactory = options.xfaLayerFactory;\n this.structTreeLayerFactory = options.structTreeLayerFactory;\n this.renderer = options.renderer || RendererType.CANVAS;\n this.l10n = options.l10n || NullL10n;\n\n this.paintTask = null;\n this.paintedViewportMap = new WeakMap();\n this.renderingState = RenderingStates.INITIAL;\n this.resume = null;\n this._renderError = null;\n\n this.annotationLayer = null;\n this.textLayer = null;\n this.zoomLayer = null;\n this.xfaLayer = null;\n this.structTreeLayer = null;\n\n const div = document.createElement(\"div\");\n div.className = \"page\";\n div.style.width = Math.floor(this.viewport.width) + \"px\";\n div.style.height = Math.floor(this.viewport.height) + \"px\";\n div.setAttribute(\"data-page-number\", this.id);\n div.setAttribute(\"role\", \"region\");\n this.l10n.get(\"page_landmark\", { page: this.id }).then(msg => {\n div.setAttribute(\"aria-label\", msg);\n });\n this.div = div;\n\n container.appendChild(div);\n }\n\n setPdfPage(pdfPage) {\n this.pdfPage = pdfPage;\n this.pdfPageRotate = pdfPage.rotate;\n\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = pdfPage.getViewport({\n scale: this.scale * CSS_UNITS,\n rotation: totalRotation,\n });\n this.reset();\n }\n\n destroy() {\n this.reset();\n if (this.pdfPage) {\n this.pdfPage.cleanup();\n }\n }\n\n /**\n * @private\n */\n async _renderAnnotationLayer() {\n let error = null;\n try {\n await this.annotationLayer.render(this.viewport, \"display\");\n } catch (ex) {\n error = ex;\n } finally {\n this.eventBus.dispatch(\"annotationlayerrendered\", {\n source: this,\n pageNumber: this.id,\n error,\n });\n }\n }\n\n /**\n * @private\n */\n async _renderXfaLayer() {\n let error = null;\n try {\n await this.xfaLayer.render(this.viewport, \"display\");\n } catch (ex) {\n error = ex;\n } finally {\n this.eventBus.dispatch(\"xfalayerrendered\", {\n source: this,\n pageNumber: this.id,\n error,\n });\n }\n }\n\n /**\n * @private\n */\n _resetZoomLayer(removeFromDOM = false) {\n if (!this.zoomLayer) {\n return;\n }\n const zoomLayerCanvas = this.zoomLayer.firstChild;\n this.paintedViewportMap.delete(zoomLayerCanvas);\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n zoomLayerCanvas.width = 0;\n zoomLayerCanvas.height = 0;\n\n if (removeFromDOM) {\n // Note: `ChildNode.remove` doesn't throw if the parent node is undefined.\n this.zoomLayer.remove();\n }\n this.zoomLayer = null;\n }\n\n reset({\n keepZoomLayer = false,\n keepAnnotationLayer = false,\n keepXfaLayer = false,\n } = {}) {\n this.cancelRendering({ keepAnnotationLayer, keepXfaLayer });\n this.renderingState = RenderingStates.INITIAL;\n\n const div = this.div;\n div.style.width = Math.floor(this.viewport.width) + \"px\";\n div.style.height = Math.floor(this.viewport.height) + \"px\";\n\n const childNodes = div.childNodes,\n zoomLayerNode = (keepZoomLayer && this.zoomLayer) || null,\n annotationLayerNode =\n (keepAnnotationLayer && this.annotationLayer?.div) || null,\n xfaLayerNode = (keepXfaLayer && this.xfaLayer?.div) || null;\n for (let i = childNodes.length - 1; i >= 0; i--) {\n const node = childNodes[i];\n switch (node) {\n case zoomLayerNode:\n case annotationLayerNode:\n case xfaLayerNode:\n continue;\n }\n div.removeChild(node);\n }\n div.removeAttribute(\"data-loaded\");\n\n if (annotationLayerNode) {\n // Hide the annotation layer until all elements are resized\n // so they are not displayed on the already resized page.\n this.annotationLayer.hide();\n }\n if (xfaLayerNode) {\n // Hide the XFA layer until all elements are resized\n // so they are not displayed on the already resized page.\n this.xfaLayer.hide();\n }\n\n if (!zoomLayerNode) {\n if (this.canvas) {\n this.paintedViewportMap.delete(this.canvas);\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n this.canvas.width = 0;\n this.canvas.height = 0;\n delete this.canvas;\n }\n this._resetZoomLayer();\n }\n if (this.svg) {\n this.paintedViewportMap.delete(this.svg);\n delete this.svg;\n }\n\n this.loadingIconDiv = document.createElement(\"div\");\n this.loadingIconDiv.className = \"loadingIcon\";\n this.loadingIconDiv.setAttribute(\"role\", \"img\");\n this.l10n.get(\"loading\").then(msg => {\n this.loadingIconDiv?.setAttribute(\"aria-label\", msg);\n });\n div.appendChild(this.loadingIconDiv);\n }\n\n update(scale, rotation, optionalContentConfigPromise = null) {\n this.scale = scale || this.scale;\n // The rotation may be zero.\n if (typeof rotation !== \"undefined\") {\n this.rotation = rotation;\n }\n if (optionalContentConfigPromise instanceof Promise) {\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n }\n\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = this.viewport.clone({\n scale: this.scale * CSS_UNITS,\n rotation: totalRotation,\n });\n\n if (this.svg) {\n this.cssTransform({\n target: this.svg,\n redrawAnnotationLayer: true,\n redrawXfaLayer: true,\n });\n\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform: true,\n timestamp: performance.now(),\n error: this._renderError,\n });\n return;\n }\n\n let isScalingRestricted = false;\n if (this.canvas && this.maxCanvasPixels > 0) {\n const outputScale = this.outputScale;\n if (\n ((Math.floor(this.viewport.width) * outputScale.sx) | 0) *\n ((Math.floor(this.viewport.height) * outputScale.sy) | 0) >\n this.maxCanvasPixels\n ) {\n isScalingRestricted = true;\n }\n }\n\n if (this.canvas) {\n if (\n this.useOnlyCssZoom ||\n (this.hasRestrictedScaling && isScalingRestricted)\n ) {\n this.cssTransform({\n target: this.canvas,\n redrawAnnotationLayer: true,\n redrawXfaLayer: true,\n });\n\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform: true,\n timestamp: performance.now(),\n error: this._renderError,\n });\n return;\n }\n if (!this.zoomLayer && !this.canvas.hidden) {\n this.zoomLayer = this.canvas.parentNode;\n this.zoomLayer.style.position = \"absolute\";\n }\n }\n if (this.zoomLayer) {\n this.cssTransform({ target: this.zoomLayer.firstChild });\n }\n this.reset({\n keepZoomLayer: true,\n keepAnnotationLayer: true,\n keepXfaLayer: true,\n });\n }\n\n /**\n * PLEASE NOTE: Most likely you want to use the `this.reset()` method,\n * rather than calling this one directly.\n */\n cancelRendering({ keepAnnotationLayer = false, keepXfaLayer = false } = {}) {\n if (this.paintTask) {\n this.paintTask.cancel();\n this.paintTask = null;\n }\n this.resume = null;\n\n if (this.textLayer) {\n this.textLayer.cancel();\n this.textLayer = null;\n }\n if (\n this.annotationLayer &&\n (!keepAnnotationLayer || !this.annotationLayer.div)\n ) {\n this.annotationLayer.cancel();\n this.annotationLayer = null;\n }\n if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {\n this.xfaLayer.cancel();\n this.xfaLayer = null;\n }\n if (this._onTextLayerRendered) {\n this.eventBus._off(\"textlayerrendered\", this._onTextLayerRendered);\n this._onTextLayerRendered = null;\n }\n }\n\n cssTransform({\n target,\n redrawAnnotationLayer = false,\n redrawXfaLayer = false,\n }) {\n // Scale target (canvas or svg), its wrapper and page container.\n const width = this.viewport.width;\n const height = this.viewport.height;\n const div = this.div;\n target.style.width =\n target.parentNode.style.width =\n div.style.width =\n Math.floor(width) + \"px\";\n target.style.height =\n target.parentNode.style.height =\n div.style.height =\n Math.floor(height) + \"px\";\n // The canvas may have been originally rotated; rotate relative to that.\n const relativeRotation =\n this.viewport.rotation - this.paintedViewportMap.get(target).rotation;\n const absRotation = Math.abs(relativeRotation);\n let scaleX = 1,\n scaleY = 1;\n if (absRotation === 90 || absRotation === 270) {\n // Scale x and y because of the rotation.\n scaleX = height / width;\n scaleY = width / height;\n }\n target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;\n\n if (this.textLayer) {\n // Rotating the text layer is more complicated since the divs inside the\n // the text layer are rotated.\n // TODO: This could probably be simplified by drawing the text layer in\n // one orientation and then rotating overall.\n const textLayerViewport = this.textLayer.viewport;\n const textRelativeRotation =\n this.viewport.rotation - textLayerViewport.rotation;\n const textAbsRotation = Math.abs(textRelativeRotation);\n let scale = width / textLayerViewport.width;\n if (textAbsRotation === 90 || textAbsRotation === 270) {\n scale = width / textLayerViewport.height;\n }\n const textLayerDiv = this.textLayer.textLayerDiv;\n let transX, transY;\n switch (textAbsRotation) {\n case 0:\n transX = transY = 0;\n break;\n case 90:\n transX = 0;\n transY = \"-\" + textLayerDiv.style.height;\n break;\n case 180:\n transX = \"-\" + textLayerDiv.style.width;\n transY = \"-\" + textLayerDiv.style.height;\n break;\n case 270:\n transX = \"-\" + textLayerDiv.style.width;\n transY = 0;\n break;\n default:\n console.error(\"Bad rotation value.\");\n break;\n }\n\n textLayerDiv.style.transform =\n `rotate(${textAbsRotation}deg) ` +\n `scale(${scale}) ` +\n `translate(${transX}, ${transY})`;\n textLayerDiv.style.transformOrigin = \"0% 0%\";\n }\n\n if (redrawAnnotationLayer && this.annotationLayer) {\n this._renderAnnotationLayer();\n }\n if (redrawXfaLayer && this.xfaLayer) {\n this._renderXfaLayer();\n }\n }\n\n get width() {\n return this.viewport.width;\n }\n\n get height() {\n return this.viewport.height;\n }\n\n getPagePoint(x, y) {\n return this.viewport.convertToPdfPoint(x, y);\n }\n\n draw() {\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error(\"Must be in new state before drawing\");\n this.reset(); // Ensure that we reset all state to prevent issues.\n }\n const { div, pdfPage } = this;\n\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n\n if (this.loadingIconDiv) {\n div.removeChild(this.loadingIconDiv);\n delete this.loadingIconDiv;\n }\n return Promise.reject(new Error(\"pdfPage is not loaded\"));\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n // Wrap the canvas so that if it has a CSS transform for high DPI the\n // overflow will be hidden in Firefox.\n const canvasWrapper = document.createElement(\"div\");\n canvasWrapper.style.width = div.style.width;\n canvasWrapper.style.height = div.style.height;\n canvasWrapper.classList.add(\"canvasWrapper\");\n\n if (this.annotationLayer?.div) {\n // The annotation layer needs to stay on top.\n div.insertBefore(canvasWrapper, this.annotationLayer.div);\n } else {\n div.appendChild(canvasWrapper);\n }\n\n let textLayer = null;\n if (this.textLayerMode !== TextLayerMode.DISABLE && this.textLayerFactory) {\n const textLayerDiv = document.createElement(\"div\");\n textLayerDiv.className = \"textLayer\";\n textLayerDiv.style.width = canvasWrapper.style.width;\n textLayerDiv.style.height = canvasWrapper.style.height;\n if (this.annotationLayer?.div) {\n // The annotation layer needs to stay on top.\n div.insertBefore(textLayerDiv, this.annotationLayer.div);\n } else {\n div.appendChild(textLayerDiv);\n }\n\n textLayer = this.textLayerFactory.createTextLayerBuilder(\n textLayerDiv,\n this.id - 1,\n this.viewport,\n this.textLayerMode === TextLayerMode.ENABLE_ENHANCE,\n this.eventBus\n );\n }\n this.textLayer = textLayer;\n\n if (this.xfaLayer?.div) {\n // The xfa layer needs to stay on top.\n div.appendChild(this.xfaLayer.div);\n }\n\n let renderContinueCallback = null;\n if (this.renderingQueue) {\n renderContinueCallback = cont => {\n if (!this.renderingQueue.isHighestPriority(this)) {\n this.renderingState = RenderingStates.PAUSED;\n this.resume = () => {\n this.renderingState = RenderingStates.RUNNING;\n cont();\n };\n return;\n }\n cont();\n };\n }\n\n const finishPaintTask = async (error = null) => {\n // The paintTask may have been replaced by a new one, so only remove\n // the reference to the paintTask if it matches the one that is\n // triggering this callback.\n if (paintTask === this.paintTask) {\n this.paintTask = null;\n }\n\n if (error instanceof RenderingCancelledException) {\n this._renderError = null;\n return;\n }\n this._renderError = error;\n\n this.renderingState = RenderingStates.FINISHED;\n\n if (this.loadingIconDiv) {\n div.removeChild(this.loadingIconDiv);\n delete this.loadingIconDiv;\n }\n this._resetZoomLayer(/* removeFromDOM = */ true);\n\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform: false,\n timestamp: performance.now(),\n error: this._renderError,\n });\n\n if (error) {\n throw error;\n }\n };\n\n const paintTask =\n this.renderer === RendererType.SVG\n ? this.paintOnSvg(canvasWrapper)\n : this.paintOnCanvas(canvasWrapper);\n paintTask.onRenderContinue = renderContinueCallback;\n this.paintTask = paintTask;\n\n const resultPromise = paintTask.promise.then(\n () => {\n return finishPaintTask(null).then(() => {\n if (textLayer) {\n const readableStream = pdfPage.streamTextContent({\n normalizeWhitespace: true,\n includeMarkedContent: true,\n });\n textLayer.setTextContentStream(readableStream);\n textLayer.render();\n }\n });\n },\n function (reason) {\n return finishPaintTask(reason);\n }\n );\n\n if (this.annotationLayerFactory) {\n if (!this.annotationLayer) {\n this.annotationLayer =\n this.annotationLayerFactory.createAnnotationLayerBuilder(\n div,\n pdfPage,\n /* annotationStorage = */ null,\n this.imageResourcesPath,\n this.renderInteractiveForms,\n this.l10n,\n /* enableScripting */ null,\n /* hasJSActionsPromise = */ null,\n /* mouseState = */ null\n );\n }\n this._renderAnnotationLayer();\n }\n\n if (this.xfaLayerFactory) {\n if (!this.xfaLayer) {\n this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder(\n div,\n pdfPage,\n /* annotationStorage = */ null\n );\n }\n this._renderXfaLayer();\n }\n\n // The structure tree is currently only supported when the text layer is\n // enabled and a canvas is used for rendering.\n if (this.structTreeLayerFactory && this.textLayer && this.canvas) {\n // The structure tree must be generated after the text layer for the\n // aria-owns to work.\n this._onTextLayerRendered = event => {\n if (event.pageNumber !== this.id) {\n return;\n }\n this.eventBus._off(\"textlayerrendered\", this._onTextLayerRendered);\n this._onTextLayerRendered = null;\n\n if (!this.canvas) {\n return; // The canvas was removed, prevent errors below.\n }\n this.pdfPage.getStructTree().then(tree => {\n if (!tree) {\n return;\n }\n if (!this.canvas) {\n return; // The canvas was removed, prevent errors below.\n }\n const treeDom = this.structTreeLayer.render(tree);\n treeDom.classList.add(\"structTree\");\n this.canvas.appendChild(treeDom);\n });\n };\n this.eventBus._on(\"textlayerrendered\", this._onTextLayerRendered);\n this.structTreeLayer =\n this.structTreeLayerFactory.createStructTreeLayerBuilder(pdfPage);\n }\n\n div.setAttribute(\"data-loaded\", true);\n\n this.eventBus.dispatch(\"pagerender\", {\n source: this,\n pageNumber: this.id,\n });\n return resultPromise;\n }\n\n paintOnCanvas(canvasWrapper) {\n const renderCapability = createPromiseCapability();\n const result = {\n promise: renderCapability.promise,\n onRenderContinue(cont) {\n cont();\n },\n cancel() {\n renderTask.cancel();\n },\n };\n\n const viewport = this.viewport;\n const canvas = document.createElement(\"canvas\");\n\n // Keep the canvas hidden until the first draw callback, or until drawing\n // is complete when `!this.renderingQueue`, to prevent black flickering.\n canvas.hidden = true;\n let isCanvasHidden = true;\n const showCanvas = function () {\n if (isCanvasHidden) {\n canvas.hidden = false;\n isCanvasHidden = false;\n }\n };\n\n canvasWrapper.appendChild(canvas);\n this.canvas = canvas;\n\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"MOZCENTRAL || GENERIC\")\n ) {\n canvas.mozOpaque = true;\n }\n\n const ctx = canvas.getContext(\"2d\", { alpha: false });\n const outputScale = getOutputScale(ctx);\n this.outputScale = outputScale;\n\n if (this.useOnlyCssZoom) {\n const actualSizeViewport = viewport.clone({ scale: CSS_UNITS });\n // Use a scale that makes the canvas have the originally intended size\n // of the page.\n outputScale.sx *= actualSizeViewport.width / viewport.width;\n outputScale.sy *= actualSizeViewport.height / viewport.height;\n outputScale.scaled = true;\n }\n\n if (this.maxCanvasPixels > 0) {\n const pixelsInViewport = viewport.width * viewport.height;\n const maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);\n if (outputScale.sx > maxScale || outputScale.sy > maxScale) {\n outputScale.sx = maxScale;\n outputScale.sy = maxScale;\n outputScale.scaled = true;\n this.hasRestrictedScaling = true;\n } else {\n this.hasRestrictedScaling = false;\n }\n }\n\n const sfx = approximateFraction(outputScale.sx);\n const sfy = approximateFraction(outputScale.sy);\n canvas.width = roundToDivide(viewport.width * outputScale.sx, sfx[0]);\n canvas.height = roundToDivide(viewport.height * outputScale.sy, sfy[0]);\n canvas.style.width = roundToDivide(viewport.width, sfx[1]) + \"px\";\n canvas.style.height = roundToDivide(viewport.height, sfy[1]) + \"px\";\n // Add the viewport so it's known what it was originally drawn with.\n this.paintedViewportMap.set(canvas, viewport);\n\n // Rendering area\n const transform = !outputScale.scaled\n ? null\n : [outputScale.sx, 0, 0, outputScale.sy, 0, 0];\n const renderContext = {\n canvasContext: ctx,\n transform,\n viewport: this.viewport,\n renderInteractiveForms: this.renderInteractiveForms,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n };\n const renderTask = this.pdfPage.render(renderContext);\n renderTask.onContinue = function (cont) {\n showCanvas();\n if (result.onRenderContinue) {\n result.onRenderContinue(cont);\n } else {\n cont();\n }\n };\n\n renderTask.promise.then(\n function () {\n showCanvas();\n renderCapability.resolve(undefined);\n },\n function (error) {\n showCanvas();\n renderCapability.reject(error);\n }\n );\n return result;\n }\n\n paintOnSvg(wrapper) {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"MOZCENTRAL || CHROME\")\n ) {\n // Return a mock object, to prevent errors such as e.g.\n // \"TypeError: paintTask.promise is undefined\".\n return {\n promise: Promise.reject(new Error(\"SVG rendering is not supported.\")),\n onRenderContinue(cont) {},\n cancel() {},\n };\n }\n\n let cancelled = false;\n const ensureNotCancelled = () => {\n if (cancelled) {\n throw new RenderingCancelledException(\n `Rendering cancelled, page ${this.id}`,\n \"svg\"\n );\n }\n };\n\n const pdfPage = this.pdfPage;\n const actualSizeViewport = this.viewport.clone({ scale: CSS_UNITS });\n const promise = pdfPage.getOperatorList().then(opList => {\n ensureNotCancelled();\n const svgGfx = new SVGGraphics(\n pdfPage.commonObjs,\n pdfPage.objs,\n /* forceDataSchema = */ viewerCompatibilityParams.disableCreateObjectURL\n );\n return svgGfx.getSVG(opList, actualSizeViewport).then(svg => {\n ensureNotCancelled();\n this.svg = svg;\n this.paintedViewportMap.set(svg, actualSizeViewport);\n\n svg.style.width = wrapper.style.width;\n svg.style.height = wrapper.style.height;\n this.renderingState = RenderingStates.FINISHED;\n wrapper.appendChild(svg);\n });\n });\n\n return {\n promise,\n onRenderContinue(cont) {\n cont();\n },\n cancel() {\n cancelled = true;\n },\n };\n }\n\n /**\n * @param {string|null} label\n */\n setPageLabel(label) {\n this.pageLabel = typeof label === \"string\" ? label : null;\n\n if (this.pageLabel !== null) {\n this.div.setAttribute(\"data-page-label\", this.pageLabel);\n } else {\n this.div.removeAttribute(\"data-page-label\");\n }\n }\n}\n\nexport { PDFPageView };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst PDF_ROLE_TO_HTML_ROLE = {\n // Document level structure types\n Document: null, // There's a \"document\" role, but it doesn't make sense here.\n DocumentFragment: null,\n // Grouping level structure types\n Part: \"group\",\n Sect: \"group\", // XXX: There's a \"section\" role, but it's abstract.\n Div: \"group\",\n Aside: \"note\",\n NonStruct: \"none\",\n // Block level structure types\n P: null,\n // H<n>,\n H: \"heading\",\n Title: null,\n FENote: \"note\",\n // Sub-block level structure type\n Sub: \"group\",\n // General inline level structure types\n Lbl: null,\n Span: null,\n Em: null,\n Strong: null,\n Link: \"link\",\n Annot: \"note\",\n Form: \"form\",\n // Ruby and Warichu structure types\n Ruby: null,\n RB: null,\n RT: null,\n RP: null,\n Warichu: null,\n WT: null,\n WP: null,\n // List standard structure types\n L: \"list\",\n LI: \"listitem\",\n LBody: null,\n // Table standard structure types\n Table: \"table\",\n TR: \"row\",\n TH: \"columnheader\",\n TD: \"cell\",\n THead: \"columnheader\",\n TBody: null,\n TFoot: null,\n // Standard structure type Caption\n Caption: null,\n // Standard structure type Figure\n Figure: \"figure\",\n // Standard structure type Formula\n Formula: null,\n // standard structure type Artifact\n Artifact: null,\n};\n\nconst HEADING_PATTERN = /^H(\\d+)$/;\n\n/**\n * @typedef {Object} StructTreeLayerBuilderOptions\n * @property {PDFPage} pdfPage\n */\n\nclass StructTreeLayerBuilder {\n /**\n * @param {StructTreeLayerBuilderOptions} options\n */\n constructor({ pdfPage }) {\n this.pdfPage = pdfPage;\n }\n\n render(structTree) {\n return this._walk(structTree);\n }\n\n _setAttributes(structElement, htmlElement) {\n if (structElement.alt !== undefined) {\n htmlElement.setAttribute(\"aria-label\", structElement.alt);\n }\n if (structElement.id !== undefined) {\n htmlElement.setAttribute(\"aria-owns\", structElement.id);\n }\n }\n\n _walk(node) {\n if (!node) {\n return null;\n }\n\n const element = document.createElement(\"span\");\n if (\"role\" in node) {\n const { role } = node;\n const match = role.match(HEADING_PATTERN);\n if (match) {\n element.setAttribute(\"role\", \"heading\");\n element.setAttribute(\"aria-level\", match[1]);\n } else if (PDF_ROLE_TO_HTML_ROLE[role]) {\n element.setAttribute(\"role\", PDF_ROLE_TO_HTML_ROLE[role]);\n }\n }\n\n this._setAttributes(node, element);\n\n if (node.children) {\n if (node.children.length === 1 && \"id\" in node.children[0]) {\n // Often there is only one content node so just set the values on the\n // parent node to avoid creating an extra span.\n this._setAttributes(node.children[0], element);\n } else {\n for (const kid of node.children) {\n element.appendChild(this._walk(kid));\n }\n }\n }\n return element;\n }\n}\n\n/**\n * @implements IPDFStructTreeLayerFactory\n */\nclass DefaultStructTreeLayerFactory {\n /**\n * @param {PDFPage} pdfPage\n * @returns {StructTreeLayerBuilder}\n */\n createStructTreeLayerBuilder(pdfPage) {\n return new StructTreeLayerBuilder({\n pdfPage,\n });\n }\n}\n\nexport { DefaultStructTreeLayerFactory, StructTreeLayerBuilder };\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 { renderTextLayer } from \"pdfjs-lib\";\n\nconst EXPAND_DIVS_TIMEOUT = 300; // ms\n\n/**\n * @typedef {Object} TextLayerBuilderOptions\n * @property {HTMLDivElement} textLayerDiv - The text layer container.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} pageIndex - The page index.\n * @property {PageViewport} viewport - The viewport of the text layer.\n * @property {PDFFindController} findController\n * @property {boolean} enhanceTextSelection - Option to turn on improved\n * text selection.\n */\n\n/**\n * The text layer builder provides text selection functionality for the PDF.\n * It does this by creating overlay divs over the PDF's text. These divs\n * contain text that matches the PDF text they are overlaying. This object\n * also provides a way to highlight text that is being searched for.\n */\nclass TextLayerBuilder {\n constructor({\n textLayerDiv,\n eventBus,\n pageIndex,\n viewport,\n findController = null,\n enhanceTextSelection = false,\n }) {\n this.textLayerDiv = textLayerDiv;\n this.eventBus = eventBus;\n this.textContent = null;\n this.textContentItemsStr = [];\n this.textContentStream = null;\n this.renderingDone = false;\n this.pageIdx = pageIndex;\n this.pageNumber = this.pageIdx + 1;\n this.matches = [];\n this.viewport = viewport;\n this.textDivs = [];\n this.findController = findController;\n this.textLayerRenderTask = null;\n this.enhanceTextSelection = enhanceTextSelection;\n\n this._onUpdateTextLayerMatches = null;\n this._bindMouse();\n }\n\n /**\n * @private\n */\n _finishRendering() {\n this.renderingDone = true;\n\n if (!this.enhanceTextSelection) {\n const endOfContent = document.createElement(\"div\");\n endOfContent.className = \"endOfContent\";\n this.textLayerDiv.appendChild(endOfContent);\n }\n\n this.eventBus.dispatch(\"textlayerrendered\", {\n source: this,\n pageNumber: this.pageNumber,\n numTextDivs: this.textDivs.length,\n });\n }\n\n /**\n * Renders the text layer.\n *\n * @param {number} [timeout] - Wait for a specified amount of milliseconds\n * before rendering.\n */\n render(timeout = 0) {\n if (!(this.textContent || this.textContentStream) || this.renderingDone) {\n return;\n }\n this.cancel();\n\n this.textDivs = [];\n const textLayerFrag = document.createDocumentFragment();\n this.textLayerRenderTask = renderTextLayer({\n textContent: this.textContent,\n textContentStream: this.textContentStream,\n container: textLayerFrag,\n viewport: this.viewport,\n textDivs: this.textDivs,\n textContentItemsStr: this.textContentItemsStr,\n timeout,\n enhanceTextSelection: this.enhanceTextSelection,\n });\n this.textLayerRenderTask.promise.then(\n () => {\n this.textLayerDiv.appendChild(textLayerFrag);\n this._finishRendering();\n this._updateMatches();\n },\n function (reason) {\n // Cancelled or failed to render text layer; skipping errors.\n }\n );\n\n if (!this._onUpdateTextLayerMatches) {\n this._onUpdateTextLayerMatches = evt => {\n if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {\n this._updateMatches();\n }\n };\n this.eventBus._on(\n \"updatetextlayermatches\",\n this._onUpdateTextLayerMatches\n );\n }\n }\n\n /**\n * Cancel rendering of the text layer.\n */\n cancel() {\n if (this.textLayerRenderTask) {\n this.textLayerRenderTask.cancel();\n this.textLayerRenderTask = null;\n }\n if (this._onUpdateTextLayerMatches) {\n this.eventBus._off(\n \"updatetextlayermatches\",\n this._onUpdateTextLayerMatches\n );\n this._onUpdateTextLayerMatches = null;\n }\n }\n\n setTextContentStream(readableStream) {\n this.cancel();\n this.textContentStream = readableStream;\n }\n\n setTextContent(textContent) {\n this.cancel();\n this.textContent = textContent;\n }\n\n _convertMatches(matches, matchesLength) {\n // Early exit if there is nothing to convert.\n if (!matches) {\n return [];\n }\n const { textContentItemsStr } = this;\n\n let i = 0,\n iIndex = 0;\n const end = textContentItemsStr.length - 1;\n const result = [];\n\n for (let m = 0, mm = matches.length; m < mm; m++) {\n // Calculate the start position.\n let matchIdx = matches[m];\n\n // Loop over the divIdxs.\n while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n\n if (i === textContentItemsStr.length) {\n console.error(\"Could not find a matching mapping\");\n }\n\n const match = {\n begin: {\n divIdx: i,\n offset: matchIdx - iIndex,\n },\n };\n\n // Calculate the end position.\n matchIdx += matchesLength[m];\n\n // Somewhat the same array as above, but use > instead of >= to get\n // the end position right.\n while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n\n match.end = {\n divIdx: i,\n offset: matchIdx - iIndex,\n };\n result.push(match);\n }\n return result;\n }\n\n _renderMatches(matches) {\n // Early exit if there is nothing to render.\n if (matches.length === 0) {\n return;\n }\n const { findController, pageIdx, textContentItemsStr, textDivs } = this;\n\n const isSelectedPage = pageIdx === findController.selected.pageIdx;\n const selectedMatchIdx = findController.selected.matchIdx;\n const highlightAll = findController.state.highlightAll;\n let prevEnd = null;\n const infinity = {\n divIdx: -1,\n offset: undefined,\n };\n\n function beginText(begin, className) {\n const divIdx = begin.divIdx;\n textDivs[divIdx].textContent = \"\";\n return appendTextToDiv(divIdx, 0, begin.offset, className);\n }\n\n function appendTextToDiv(divIdx, fromOffset, toOffset, className) {\n const div = textDivs[divIdx];\n const content = textContentItemsStr[divIdx].substring(\n fromOffset,\n toOffset\n );\n const node = document.createTextNode(content);\n if (className) {\n const span = document.createElement(\"span\");\n span.className = `${className} appended`;\n span.appendChild(node);\n div.appendChild(span);\n return className.includes(\"selected\") ? span.offsetLeft : 0;\n }\n div.appendChild(node);\n return 0;\n }\n\n let i0 = selectedMatchIdx,\n i1 = i0 + 1;\n if (highlightAll) {\n i0 = 0;\n i1 = matches.length;\n } else if (!isSelectedPage) {\n // Not highlighting all and this isn't the selected page, so do nothing.\n return;\n }\n\n for (let i = i0; i < i1; i++) {\n const match = matches[i];\n const begin = match.begin;\n const end = match.end;\n const isSelected = isSelectedPage && i === selectedMatchIdx;\n const highlightSuffix = isSelected ? \" selected\" : \"\";\n let selectedLeft = 0;\n\n // Match inside new div.\n if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {\n // If there was a previous div, then add the text at the end.\n if (prevEnd !== null) {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n }\n // Clear the divs and set the content until the starting point.\n beginText(begin);\n } else {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);\n }\n\n if (begin.divIdx === end.divIdx) {\n selectedLeft = appendTextToDiv(\n begin.divIdx,\n begin.offset,\n end.offset,\n \"highlight\" + highlightSuffix\n );\n } else {\n selectedLeft = appendTextToDiv(\n begin.divIdx,\n begin.offset,\n infinity.offset,\n \"highlight begin\" + highlightSuffix\n );\n for (let n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {\n textDivs[n0].className = \"highlight middle\" + highlightSuffix;\n }\n beginText(end, \"highlight end\" + highlightSuffix);\n }\n prevEnd = end;\n\n if (isSelected) {\n // Attempt to scroll the selected match into view.\n findController.scrollMatchIntoView({\n element: textDivs[begin.divIdx],\n selectedLeft,\n pageIndex: pageIdx,\n matchIndex: selectedMatchIdx,\n });\n }\n }\n\n if (prevEnd) {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n }\n }\n\n _updateMatches() {\n // Only show matches when all rendering is done.\n if (!this.renderingDone) {\n return;\n }\n const { findController, matches, pageIdx, textContentItemsStr, textDivs } =\n this;\n let clearedUntilDivIdx = -1;\n\n // Clear all current matches.\n for (let i = 0, ii = matches.length; i < ii; i++) {\n const match = matches[i];\n const begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);\n for (let n = begin, end = match.end.divIdx; n <= end; n++) {\n const div = textDivs[n];\n div.textContent = textContentItemsStr[n];\n div.className = \"\";\n }\n clearedUntilDivIdx = match.end.divIdx + 1;\n }\n\n if (!findController?.highlightMatches) {\n return;\n }\n // Convert the matches on the `findController` into the match format\n // used for the textLayer.\n const pageMatches = findController.pageMatches[pageIdx] || null;\n const pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;\n\n this.matches = this._convertMatches(pageMatches, pageMatchesLength);\n this._renderMatches(this.matches);\n }\n\n /**\n * Improves text selection by adding an additional div where the mouse was\n * clicked. This reduces flickering of the content if the mouse is slowly\n * dragged up or down.\n *\n * @private\n */\n _bindMouse() {\n const div = this.textLayerDiv;\n let expandDivsTimer = null;\n\n div.addEventListener(\"mousedown\", evt => {\n if (this.enhanceTextSelection && this.textLayerRenderTask) {\n this.textLayerRenderTask.expandTextDivs(true);\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n expandDivsTimer\n ) {\n clearTimeout(expandDivsTimer);\n expandDivsTimer = null;\n }\n return;\n }\n\n const end = div.querySelector(\".endOfContent\");\n if (!end) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n // On non-Firefox browsers, the selection will feel better if the height\n // of the `endOfContent` div is adjusted to start at mouse click\n // location. This avoids flickering when the selection moves up.\n // However it does not work when selection is started on empty space.\n let adjustTop = evt.target !== div;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n adjustTop =\n adjustTop &&\n window\n .getComputedStyle(end)\n .getPropertyValue(\"-moz-user-select\") !== \"none\";\n }\n if (adjustTop) {\n const divBounds = div.getBoundingClientRect();\n const r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);\n end.style.top = (r * 100).toFixed(2) + \"%\";\n }\n }\n end.classList.add(\"active\");\n });\n\n div.addEventListener(\"mouseup\", () => {\n if (this.enhanceTextSelection && this.textLayerRenderTask) {\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n expandDivsTimer = setTimeout(() => {\n if (this.textLayerRenderTask) {\n this.textLayerRenderTask.expandTextDivs(false);\n }\n expandDivsTimer = null;\n }, EXPAND_DIVS_TIMEOUT);\n } else {\n this.textLayerRenderTask.expandTextDivs(false);\n }\n return;\n }\n\n const end = div.querySelector(\".endOfContent\");\n if (!end) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n end.style.top = \"\";\n }\n end.classList.remove(\"active\");\n });\n }\n}\n\n/**\n * @implements IPDFTextLayerFactory\n */\nclass DefaultTextLayerFactory {\n /**\n * @param {HTMLDivElement} textLayerDiv\n * @param {number} pageIndex\n * @param {PageViewport} viewport\n * @param {boolean} enhanceTextSelection\n * @param {EventBus} eventBus\n * @returns {TextLayerBuilder}\n */\n createTextLayerBuilder(\n textLayerDiv,\n pageIndex,\n viewport,\n enhanceTextSelection = false,\n eventBus\n ) {\n return new TextLayerBuilder({\n textLayerDiv,\n pageIndex,\n viewport,\n enhanceTextSelection,\n eventBus,\n });\n }\n}\n\nexport { DefaultTextLayerFactory, TextLayerBuilder };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { XfaLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} XfaLayerBuilderOptions\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPage} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n */\n\nclass XfaLayerBuilder {\n /**\n * @param {XfaLayerBuilderOptions} options\n */\n constructor({ pageDiv, pdfPage, xfaHtml, annotationStorage }) {\n this.pageDiv = pageDiv;\n this.pdfPage = pdfPage;\n this.xfaHtml = xfaHtml;\n this.annotationStorage = annotationStorage;\n\n this.div = null;\n this._cancelled = false;\n }\n\n /**\n * @param {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n * @returns {Promise<void>} A promise that is resolved when rendering of the\n * annotations is complete.\n */\n render(viewport, intent = \"display\") {\n if (intent === \"print\") {\n const parameters = {\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n xfa: this.xfaHtml,\n page: null,\n annotationStorage: this.annotationStorage,\n intent,\n };\n\n // Create an xfa layer div and render the form\n const div = document.createElement(\"div\");\n this.pageDiv.appendChild(div);\n parameters.div = div;\n\n XfaLayer.render(parameters);\n return Promise.resolve();\n }\n\n // intent === \"display\"\n return this.pdfPage\n .getXfa()\n .then(xfa => {\n if (this._cancelled) {\n return;\n }\n const parameters = {\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n xfa,\n page: this.pdfPage,\n annotationStorage: this.annotationStorage,\n intent,\n };\n\n if (this.div) {\n XfaLayer.update(parameters);\n } else {\n // Create an xfa layer div and render the form\n this.div = document.createElement(\"div\");\n this.pageDiv.appendChild(this.div);\n parameters.div = this.div;\n\n XfaLayer.render(parameters);\n }\n })\n .catch(error => {\n console.error(error);\n });\n }\n\n cancel() {\n this._cancelled = true;\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n}\n\n/**\n * @implements IPDFXfaLayerFactory\n */\nclass DefaultXfaLayerFactory {\n /**\n * @param {HTMLDivElement} pageDiv\n * @param {PDFPage} pdfPage\n * @param {AnnotationStorage} [annotationStorage]\n * @param {Object} [xfaHtml]\n */\n createXfaLayerBuilder(\n pageDiv,\n pdfPage,\n annotationStorage = null,\n xfaHtml = null\n ) {\n return new XfaLayerBuilder({\n pageDiv,\n pdfPage,\n annotationStorage,\n xfaHtml,\n });\n }\n}\n\nexport { DefaultXfaLayerFactory, XfaLayerBuilder };\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 { SCROLLBAR_PADDING, ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { CursorTool } from \"./pdf_cursor_tools.js\";\nimport { PDFSinglePageViewer } from \"./pdf_single_page_viewer.js\";\n\n/**\n * @typedef {Object} SecondaryToolbarOptions\n * @property {HTMLDivElement} toolbar - Container for the secondary toolbar.\n * @property {HTMLButtonElement} toggleButton - Button to toggle the visibility\n * of the secondary toolbar.\n * @property {HTMLDivElement} toolbarButtonContainer - Container where all the\n * toolbar buttons are placed. The maximum height of the toolbar is controlled\n * dynamically by adjusting the 'max-height' CSS property of this DOM element.\n * @property {HTMLButtonElement} presentationModeButton - Button for entering\n * presentation mode.\n * @property {HTMLButtonElement} openFileButton - Button to open a file.\n * @property {HTMLButtonElement} printButton - Button to print the document.\n * @property {HTMLButtonElement} downloadButton - Button to download the\n * document.\n * @property {HTMLLinkElement} viewBookmarkButton - Button to obtain a bookmark\n * link to the current location in the document.\n * @property {HTMLButtonElement} firstPageButton - Button to go to the first\n * page in the document.\n * @property {HTMLButtonElement} lastPageButton - Button to go to the last page\n * in the document.\n * @property {HTMLButtonElement} pageRotateCwButton - Button to rotate the pages\n * clockwise.\n * @property {HTMLButtonElement} pageRotateCcwButton - Button to rotate the\n * pages counterclockwise.\n * @property {HTMLButtonElement} cursorSelectToolButton - Button to enable the\n * select tool.\n * @property {HTMLButtonElement} cursorHandToolButton - Button to enable the\n * hand tool.\n * @property {HTMLButtonElement} documentPropertiesButton - Button for opening\n * the document properties dialog.\n */\n\nclass SecondaryToolbar {\n /**\n * @param {SecondaryToolbarOptions} options\n * @param {HTMLDivElement} mainContainer\n * @param {EventBus} eventBus\n */\n constructor(options, mainContainer, eventBus) {\n this.toolbar = options.toolbar;\n this.toggleButton = options.toggleButton;\n this.toolbarButtonContainer = options.toolbarButtonContainer;\n this.buttons = [\n {\n element: options.presentationModeButton,\n eventName: \"presentationmode\",\n close: true,\n },\n { element: options.openFileButton, eventName: \"openfile\", close: true },\n { element: options.printButton, eventName: \"print\", close: true },\n { element: options.downloadButton, eventName: \"download\", close: true },\n { element: options.viewBookmarkButton, eventName: null, close: true },\n { element: options.firstPageButton, eventName: \"firstpage\", close: true },\n { element: options.lastPageButton, eventName: \"lastpage\", close: true },\n {\n element: options.pageRotateCwButton,\n eventName: \"rotatecw\",\n close: false,\n },\n {\n element: options.pageRotateCcwButton,\n eventName: \"rotateccw\",\n close: false,\n },\n {\n element: options.cursorSelectToolButton,\n eventName: \"switchcursortool\",\n eventDetails: { tool: CursorTool.SELECT },\n close: true,\n },\n {\n element: options.cursorHandToolButton,\n eventName: \"switchcursortool\",\n eventDetails: { tool: CursorTool.HAND },\n close: true,\n },\n {\n element: options.scrollVerticalButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.VERTICAL },\n close: true,\n },\n {\n element: options.scrollHorizontalButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.HORIZONTAL },\n close: true,\n },\n {\n element: options.scrollWrappedButton,\n eventName: \"switchscrollmode\",\n eventDetails: { mode: ScrollMode.WRAPPED },\n close: true,\n },\n {\n element: options.spreadNoneButton,\n eventName: \"switchspreadmode\",\n eventDetails: { mode: SpreadMode.NONE },\n close: true,\n },\n {\n element: options.spreadOddButton,\n eventName: \"switchspreadmode\",\n eventDetails: { mode: SpreadMode.ODD },\n close: true,\n },\n {\n element: options.spreadEvenButton,\n eventName: \"switchspreadmode\",\n eventDetails: { mode: SpreadMode.EVEN },\n close: true,\n },\n {\n element: options.documentPropertiesButton,\n eventName: \"documentproperties\",\n close: true,\n },\n ];\n this.items = {\n firstPage: options.firstPageButton,\n lastPage: options.lastPageButton,\n pageRotateCw: options.pageRotateCwButton,\n pageRotateCcw: options.pageRotateCcwButton,\n };\n\n this.mainContainer = mainContainer;\n this.eventBus = eventBus;\n\n this.opened = false;\n this.containerHeight = null;\n this.previousContainerHeight = null;\n\n this.reset();\n\n // Bind the event listeners for click, cursor tool, and scroll/spread mode\n // actions.\n this._bindClickListeners();\n this._bindCursorToolsListener(options);\n this._bindScrollModeListener(options);\n this._bindSpreadModeListener(options);\n\n // Bind the event listener for adjusting the 'max-height' of the toolbar.\n this.eventBus._on(\"resize\", this._setMaxHeight.bind(this));\n\n // Hide the Scroll/Spread mode buttons, when they're not applicable to the\n // current `BaseViewer` instance (in particular `PDFSinglePageViewer`).\n this.eventBus._on(\"baseviewerinit\", evt => {\n if (evt.source instanceof PDFSinglePageViewer) {\n this.toolbarButtonContainer.classList.add(\n \"hiddenScrollModeButtons\",\n \"hiddenSpreadModeButtons\"\n );\n } else {\n this.toolbarButtonContainer.classList.remove(\n \"hiddenScrollModeButtons\",\n \"hiddenSpreadModeButtons\"\n );\n }\n });\n }\n\n /**\n * @type {boolean}\n */\n get isOpen() {\n return this.opened;\n }\n\n setPageNumber(pageNumber) {\n this.pageNumber = pageNumber;\n this._updateUIState();\n }\n\n setPagesCount(pagesCount) {\n this.pagesCount = pagesCount;\n this._updateUIState();\n }\n\n reset() {\n this.pageNumber = 0;\n this.pagesCount = 0;\n this._updateUIState();\n\n // Reset the Scroll/Spread buttons too, since they're document specific.\n this.eventBus.dispatch(\"secondarytoolbarreset\", { source: this });\n }\n\n _updateUIState() {\n this.items.firstPage.disabled = this.pageNumber <= 1;\n this.items.lastPage.disabled = this.pageNumber >= this.pagesCount;\n this.items.pageRotateCw.disabled = this.pagesCount === 0;\n this.items.pageRotateCcw.disabled = this.pagesCount === 0;\n }\n\n _bindClickListeners() {\n // Button to toggle the visibility of the secondary toolbar.\n this.toggleButton.addEventListener(\"click\", this.toggle.bind(this));\n\n // All items within the secondary toolbar.\n for (const { element, eventName, close, eventDetails } of this.buttons) {\n element.addEventListener(\"click\", evt => {\n if (eventName !== null) {\n const details = { source: this };\n for (const property in eventDetails) {\n details[property] = eventDetails[property];\n }\n this.eventBus.dispatch(eventName, details);\n }\n if (close) {\n this.close();\n }\n });\n }\n }\n\n _bindCursorToolsListener(buttons) {\n this.eventBus._on(\"cursortoolchanged\", function ({ tool }) {\n buttons.cursorSelectToolButton.classList.toggle(\n \"toggled\",\n tool === CursorTool.SELECT\n );\n buttons.cursorHandToolButton.classList.toggle(\n \"toggled\",\n tool === CursorTool.HAND\n );\n });\n }\n\n _bindScrollModeListener(buttons) {\n function scrollModeChanged({ mode }) {\n buttons.scrollVerticalButton.classList.toggle(\n \"toggled\",\n mode === ScrollMode.VERTICAL\n );\n buttons.scrollHorizontalButton.classList.toggle(\n \"toggled\",\n mode === ScrollMode.HORIZONTAL\n );\n buttons.scrollWrappedButton.classList.toggle(\n \"toggled\",\n mode === ScrollMode.WRAPPED\n );\n\n // Temporarily *disable* the Spread buttons when horizontal scrolling is\n // enabled, since the non-default Spread modes doesn't affect the layout.\n const isScrollModeHorizontal = mode === ScrollMode.HORIZONTAL;\n buttons.spreadNoneButton.disabled = isScrollModeHorizontal;\n buttons.spreadOddButton.disabled = isScrollModeHorizontal;\n buttons.spreadEvenButton.disabled = isScrollModeHorizontal;\n }\n this.eventBus._on(\"scrollmodechanged\", scrollModeChanged);\n\n this.eventBus._on(\"secondarytoolbarreset\", evt => {\n if (evt.source === this) {\n scrollModeChanged({ mode: ScrollMode.VERTICAL });\n }\n });\n }\n\n _bindSpreadModeListener(buttons) {\n function spreadModeChanged({ mode }) {\n buttons.spreadNoneButton.classList.toggle(\n \"toggled\",\n mode === SpreadMode.NONE\n );\n buttons.spreadOddButton.classList.toggle(\n \"toggled\",\n mode === SpreadMode.ODD\n );\n buttons.spreadEvenButton.classList.toggle(\n \"toggled\",\n mode === SpreadMode.EVEN\n );\n }\n this.eventBus._on(\"spreadmodechanged\", spreadModeChanged);\n\n this.eventBus._on(\"secondarytoolbarreset\", evt => {\n if (evt.source === this) {\n spreadModeChanged({ mode: SpreadMode.NONE });\n }\n });\n }\n\n open() {\n if (this.opened) {\n return;\n }\n this.opened = true;\n this._setMaxHeight();\n\n this.toggleButton.classList.add(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"true\");\n this.toolbar.classList.remove(\"hidden\");\n }\n\n close() {\n if (!this.opened) {\n return;\n }\n this.opened = false;\n this.toolbar.classList.add(\"hidden\");\n this.toggleButton.classList.remove(\"toggled\");\n this.toggleButton.setAttribute(\"aria-expanded\", \"false\");\n }\n\n toggle() {\n if (this.opened) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /**\n * @private\n */\n _setMaxHeight() {\n if (!this.opened) {\n return; // Only adjust the 'max-height' if the toolbar is visible.\n }\n this.containerHeight = this.mainContainer.clientHeight;\n\n if (this.containerHeight === this.previousContainerHeight) {\n return;\n }\n this.toolbarButtonContainer.style.maxHeight = `${\n this.containerHeight - SCROLLBAR_PADDING\n }px`;\n\n this.previousContainerHeight = this.containerHeight;\n }\n}\n\nexport { SecondaryToolbar };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BaseViewer } from \"./base_viewer.js\";\nimport { shadow } from \"pdfjs-lib\";\n\nclass PDFSinglePageViewer extends BaseViewer {\n constructor(options) {\n super(options);\n\n this.eventBus._on(\"pagesinit\", evt => {\n // Since the pages are placed in a `DocumentFragment`, make sure that\n // the current page becomes visible upon loading of the document.\n this._ensurePageViewVisible();\n });\n }\n\n get _viewerElement() {\n // Since we only want to display *one* page at a time when using the\n // `PDFSinglePageViewer`, we cannot append them to the `viewer` DOM element.\n // Instead, they are placed in a `DocumentFragment`, and only the current\n // page is displayed in the viewer (refer to `this._ensurePageViewVisible`).\n return shadow(this, \"_viewerElement\", this._shadowViewer);\n }\n\n get _pageWidthScaleFactor() {\n return 1;\n }\n\n _resetView() {\n super._resetView();\n this._previousPageNumber = 1;\n this._shadowViewer = document.createDocumentFragment();\n this._updateScrollDown = null;\n }\n\n _ensurePageViewVisible() {\n const pageView = this._pages[this._currentPageNumber - 1];\n const previousPageView = this._pages[this._previousPageNumber - 1];\n\n const viewerNodes = this.viewer.childNodes;\n switch (viewerNodes.length) {\n case 0: // Should *only* occur on initial loading.\n this.viewer.appendChild(pageView.div);\n break;\n case 1: // The normal page-switching case.\n if (viewerNodes[0] !== previousPageView.div) {\n throw new Error(\n \"_ensurePageViewVisible: Unexpected previously visible page.\"\n );\n }\n if (pageView === previousPageView) {\n break; // The correct page is already visible.\n }\n // Switch visible pages, and reset the viewerContainer scroll position.\n this._shadowViewer.appendChild(previousPageView.div);\n this.viewer.appendChild(pageView.div);\n\n this.container.scrollTop = 0;\n break;\n default:\n throw new Error(\n \"_ensurePageViewVisible: Only one page should be visible at a time.\"\n );\n }\n this._previousPageNumber = this._currentPageNumber;\n }\n\n _scrollUpdate() {\n if (this._updateScrollDown) {\n this._updateScrollDown();\n }\n super._scrollUpdate();\n }\n\n _scrollIntoView({ pageDiv, pageSpot = null, pageNumber = null }) {\n if (pageNumber) {\n // Ensure that `this._currentPageNumber` is correct.\n this._setCurrentPageNumber(pageNumber);\n }\n const scrolledDown = this._currentPageNumber >= this._previousPageNumber;\n\n this._ensurePageViewVisible();\n // Ensure that rendering always occurs, to avoid showing a blank page,\n // even if the current position doesn't change when the page is scrolled.\n this.update();\n\n super._scrollIntoView({ pageDiv, pageSpot, pageNumber });\n\n // Since scrolling is tracked using `requestAnimationFrame`, update the\n // scroll direction during the next `this._scrollUpdate` invocation.\n this._updateScrollDown = () => {\n this.scroll.down = scrolledDown;\n this._updateScrollDown = null;\n };\n }\n\n _getVisiblePages() {\n return this._getCurrentVisiblePage();\n }\n\n _updateHelper(visiblePages) {}\n\n get _isScrollModeHorizontal() {\n // The Scroll/Spread modes are never used in `PDFSinglePageViewer`.\n return shadow(this, \"_isScrollModeHorizontal\", false);\n }\n\n _updateScrollMode() {}\n\n _updateSpreadMode() {}\n\n _getPageAdvance() {\n return 1;\n }\n}\n\nexport { PDFSinglePageViewer };\n","/* Copyright 2016 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 animationStarted,\n DEFAULT_SCALE,\n DEFAULT_SCALE_VALUE,\n MAX_SCALE,\n MIN_SCALE,\n noContextMenuHandler,\n} from \"./ui_utils.js\";\n\nconst PAGE_NUMBER_LOADING_INDICATOR = \"visiblePageIsLoading\";\n// Keep the two values below up-to-date with the values in `web/viewer.css`:\nconst SCALE_SELECT_CONTAINER_WIDTH = 140; // px\nconst SCALE_SELECT_WIDTH = 162; // px\n\n/**\n * @typedef {Object} ToolbarOptions\n * @property {HTMLDivElement} container - Container for the secondary toolbar.\n * @property {HTMLSpanElement} numPages - Label that contains number of pages.\n * @property {HTMLInputElement} pageNumber - Control for display and user input\n * of the current page number.\n * @property {HTMLSpanElement} scaleSelectContainer - Container where scale\n * controls are placed. The width is adjusted on UI initialization.\n * @property {HTMLSelectElement} scaleSelect - Scale selection control.\n * @property {HTMLOptionElement} customScaleOption - The item used to display\n * a non-predefined scale.\n * @property {HTMLButtonElement} previous - Button to go to the previous page.\n * @property {HTMLButtonElement} next - Button to go to the next page.\n * @property {HTMLButtonElement} zoomIn - Button to zoom in the pages.\n * @property {HTMLButtonElement} zoomOut - Button to zoom out the pages.\n * @property {HTMLButtonElement} viewFind - Button to open find bar.\n * @property {HTMLButtonElement} openFile - Button to open a new document.\n * @property {HTMLButtonElement} presentationModeButton - Button to switch to\n * presentation mode.\n * @property {HTMLButtonElement} download - Button to download the document.\n * @property {HTMLAElement} viewBookmark - Element to link current url of\n * the page view.\n */\n\nclass Toolbar {\n /**\n * @param {ToolbarOptions} options\n * @param {EventBus} eventBus\n * @param {IL10n} l10n - Localization service.\n */\n constructor(options, eventBus, l10n) {\n this.toolbar = options.container;\n this.eventBus = eventBus;\n this.l10n = l10n;\n this.buttons = [\n { element: options.previous, eventName: \"previouspage\" },\n { element: options.next, eventName: \"nextpage\" },\n { element: options.zoomIn, eventName: \"zoomin\" },\n { element: options.zoomOut, eventName: \"zoomout\" },\n { element: options.openFile, eventName: \"openfile\" },\n { element: options.print, eventName: \"print\" },\n {\n element: options.presentationModeButton,\n eventName: \"presentationmode\",\n },\n { element: options.download, eventName: \"download\" },\n { element: options.viewBookmark, eventName: null },\n ];\n this.items = {\n numPages: options.numPages,\n pageNumber: options.pageNumber,\n scaleSelectContainer: options.scaleSelectContainer,\n scaleSelect: options.scaleSelect,\n customScaleOption: options.customScaleOption,\n previous: options.previous,\n next: options.next,\n zoomIn: options.zoomIn,\n zoomOut: options.zoomOut,\n };\n\n this._wasLocalized = false;\n this.reset();\n\n // Bind the event listeners for click and various other actions.\n this._bindListeners();\n }\n\n setPageNumber(pageNumber, pageLabel) {\n this.pageNumber = pageNumber;\n this.pageLabel = pageLabel;\n this._updateUIState(false);\n }\n\n setPagesCount(pagesCount, hasPageLabels) {\n this.pagesCount = pagesCount;\n this.hasPageLabels = hasPageLabels;\n this._updateUIState(true);\n }\n\n setPageScale(pageScaleValue, pageScale) {\n this.pageScaleValue = (pageScaleValue || pageScale).toString();\n this.pageScale = pageScale;\n this._updateUIState(false);\n }\n\n reset() {\n this.pageNumber = 0;\n this.pageLabel = null;\n this.hasPageLabels = false;\n this.pagesCount = 0;\n this.pageScaleValue = DEFAULT_SCALE_VALUE;\n this.pageScale = DEFAULT_SCALE;\n this._updateUIState(true);\n this.updateLoadingIndicatorState();\n }\n\n _bindListeners() {\n const { pageNumber, scaleSelect } = this.items;\n const self = this;\n\n // The buttons within the toolbar.\n for (const { element, eventName } of this.buttons) {\n element.addEventListener(\"click\", evt => {\n if (eventName !== null) {\n this.eventBus.dispatch(eventName, { source: this });\n }\n });\n }\n // The non-button elements within the toolbar.\n pageNumber.addEventListener(\"click\", function () {\n this.select();\n });\n pageNumber.addEventListener(\"change\", function () {\n self.eventBus.dispatch(\"pagenumberchanged\", {\n source: self,\n value: this.value,\n });\n });\n\n scaleSelect.addEventListener(\"change\", function () {\n if (this.value === \"custom\") {\n return;\n }\n self.eventBus.dispatch(\"scalechanged\", {\n source: self,\n value: this.value,\n });\n });\n // Here we depend on browsers dispatching the \"click\" event *after* the\n // \"change\" event, when the <select>-element changes.\n scaleSelect.addEventListener(\"click\", function (evt) {\n const target = evt.target;\n // Remove focus when an <option>-element was *clicked*, to improve the UX\n // for mouse users (fixes bug 1300525 and issue 4923).\n if (\n this.value === self.pageScaleValue &&\n target.tagName.toUpperCase() === \"OPTION\"\n ) {\n this.blur();\n }\n });\n // Suppress context menus for some controls.\n scaleSelect.oncontextmenu = noContextMenuHandler;\n\n this.eventBus._on(\"localized\", () => {\n this._wasLocalized = true;\n this._adjustScaleWidth();\n this._updateUIState(true);\n });\n }\n\n _updateUIState(resetNumPages = false) {\n if (!this._wasLocalized) {\n // Don't update the UI state until we localize the toolbar.\n return;\n }\n const { pageNumber, pagesCount, pageScaleValue, pageScale, items } = this;\n\n if (resetNumPages) {\n if (this.hasPageLabels) {\n items.pageNumber.type = \"text\";\n } else {\n items.pageNumber.type = \"number\";\n this.l10n.get(\"of_pages\", { pagesCount }).then(msg => {\n items.numPages.textContent = msg;\n });\n }\n items.pageNumber.max = pagesCount;\n }\n\n if (this.hasPageLabels) {\n items.pageNumber.value = this.pageLabel;\n this.l10n.get(\"page_of_pages\", { pageNumber, pagesCount }).then(msg => {\n items.numPages.textContent = msg;\n });\n } else {\n items.pageNumber.value = pageNumber;\n }\n\n items.previous.disabled = pageNumber <= 1;\n items.next.disabled = pageNumber >= pagesCount;\n\n items.zoomOut.disabled = pageScale <= MIN_SCALE;\n items.zoomIn.disabled = pageScale >= MAX_SCALE;\n\n this.l10n\n .get(\"page_scale_percent\", { scale: Math.round(pageScale * 10000) / 100 })\n .then(msg => {\n let predefinedValueFound = false;\n for (const option of items.scaleSelect.options) {\n if (option.value !== pageScaleValue) {\n option.selected = false;\n continue;\n }\n option.selected = true;\n predefinedValueFound = true;\n }\n if (!predefinedValueFound) {\n items.customScaleOption.textContent = msg;\n items.customScaleOption.selected = true;\n }\n });\n }\n\n updateLoadingIndicatorState(loading = false) {\n const pageNumberInput = this.items.pageNumber;\n\n pageNumberInput.classList.toggle(PAGE_NUMBER_LOADING_INDICATOR, loading);\n }\n\n /**\n * Increase the width of the zoom dropdown DOM element if, and only if, it's\n * too narrow to fit the *longest* of the localized strings.\n * @private\n */\n async _adjustScaleWidth() {\n const { items, l10n } = this;\n\n const predefinedValuesPromise = Promise.all([\n l10n.get(\"page_scale_auto\"),\n l10n.get(\"page_scale_actual\"),\n l10n.get(\"page_scale_fit\"),\n l10n.get(\"page_scale_width\"),\n ]);\n\n // The temporary canvas is used to measure text length in the DOM.\n let canvas = document.createElement(\"canvas\");\n if (\n typeof PDFJSDev === \"undefined\" ||\n PDFJSDev.test(\"MOZCENTRAL || GENERIC\")\n ) {\n canvas.mozOpaque = true;\n }\n let ctx = canvas.getContext(\"2d\", { alpha: false });\n\n await animationStarted;\n const { fontSize, fontFamily } = getComputedStyle(items.scaleSelect);\n ctx.font = `${fontSize} ${fontFamily}`;\n\n let maxWidth = 0;\n for (const predefinedValue of await predefinedValuesPromise) {\n const { width } = ctx.measureText(predefinedValue);\n if (width > maxWidth) {\n maxWidth = width;\n }\n }\n const overflow = SCALE_SELECT_WIDTH - SCALE_SELECT_CONTAINER_WIDTH;\n maxWidth += 2 * overflow;\n\n if (maxWidth > SCALE_SELECT_CONTAINER_WIDTH) {\n items.scaleSelect.style.width = `${maxWidth + overflow}px`;\n items.scaleSelectContainer.style.width = `${maxWidth}px`;\n }\n // Zeroing the width and height cause Firefox to release graphics resources\n // immediately, which can greatly reduce memory consumption.\n canvas.width = 0;\n canvas.height = 0;\n canvas = ctx = null;\n }\n}\n\nexport { Toolbar };\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\nconst DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;\n\n/**\n * View History - This is a utility for saving various view parameters for\n * recently opened files.\n *\n * The way that the view parameters are stored depends on how PDF.js is built,\n * for 'gulp <flag>' the following cases exist:\n * - MOZCENTRAL - uses sessionStorage.\n * - GENERIC or CHROME - uses localStorage, if it is available.\n */\nclass ViewHistory {\n constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) {\n this.fingerprint = fingerprint;\n this.cacheSize = cacheSize;\n\n this._initializedPromise = this._readFromStorage().then(databaseStr => {\n const database = JSON.parse(databaseStr || \"{}\");\n let index = -1;\n if (!Array.isArray(database.files)) {\n database.files = [];\n } else {\n while (database.files.length >= this.cacheSize) {\n database.files.shift();\n }\n\n for (let i = 0, ii = database.files.length; i < ii; i++) {\n const branch = database.files[i];\n if (branch.fingerprint === this.fingerprint) {\n index = i;\n break;\n }\n }\n }\n if (index === -1) {\n index = database.files.push({ fingerprint: this.fingerprint }) - 1;\n }\n this.file = database.files[index];\n this.database = database;\n });\n }\n\n async _writeToStorage() {\n const databaseStr = JSON.stringify(this.database);\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n sessionStorage.setItem(\"pdfjs.history\", databaseStr);\n return;\n }\n localStorage.setItem(\"pdfjs.history\", databaseStr);\n }\n\n async _readFromStorage() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return sessionStorage.getItem(\"pdfjs.history\");\n }\n return localStorage.getItem(\"pdfjs.history\");\n }\n\n async set(name, val) {\n await this._initializedPromise;\n this.file[name] = val;\n return this._writeToStorage();\n }\n\n async setMultiple(properties) {\n await this._initializedPromise;\n for (const name in properties) {\n this.file[name] = properties[name];\n }\n return this._writeToStorage();\n }\n\n async get(name, defaultValue) {\n await this._initializedPromise;\n const val = this.file[name];\n return val !== undefined ? val : defaultValue;\n }\n\n async getMultiple(properties) {\n await this._initializedPromise;\n const values = Object.create(null);\n\n for (const name in properties) {\n const val = this.file[name];\n values[name] = val !== undefined ? val : properties[name];\n }\n return values;\n }\n}\n\nexport { ViewHistory };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DefaultExternalServices, PDFViewerApplication } from \"./app.js\";\nimport { BasePreferences } from \"./preferences.js\";\nimport { DownloadManager } from \"./download_manager.js\";\nimport { GenericL10n } from \"./genericl10n.js\";\nimport { GenericScripting } from \"./generic_scripting.js\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"GENERIC\")) {\n throw new Error(\n 'Module \"pdfjs-web/genericcom\" shall not be used outside ' +\n \"GENERIC build.\"\n );\n}\n\nconst GenericCom = {};\n\nclass GenericPreferences extends BasePreferences {\n async _writeToStorage(prefObj) {\n localStorage.setItem(\"pdfjs.preferences\", JSON.stringify(prefObj));\n }\n\n async _readFromStorage(prefObj) {\n return JSON.parse(localStorage.getItem(\"pdfjs.preferences\"));\n }\n}\n\nclass GenericExternalServices extends DefaultExternalServices {\n static createDownloadManager(options) {\n return new DownloadManager();\n }\n\n static createPreferences() {\n return new GenericPreferences();\n }\n\n static createL10n({ locale = \"en-US\" }) {\n return new GenericL10n(locale);\n }\n\n static createScripting({ sandboxBundleSrc }) {\n return new GenericScripting(sandboxBundleSrc);\n }\n}\nPDFViewerApplication.externalServices = GenericExternalServices;\n\nexport { GenericCom };\n","/* Copyright 2013 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 { AppOptions, OptionKind } from \"./app_options.js\";\n\n/**\n * BasePreferences - Abstract base class for storing persistent settings.\n * Used for settings that should be applied to all opened documents,\n * or every time the viewer is loaded.\n */\nclass BasePreferences {\n constructor() {\n if (this.constructor === BasePreferences) {\n throw new Error(\"Cannot initialize BasePreferences.\");\n }\n Object.defineProperty(this, \"defaults\", {\n value: Object.freeze(\n typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n ? AppOptions.getAll(OptionKind.PREFERENCE)\n : PDFJSDev.eval(\"DEFAULT_PREFERENCES\")\n ),\n writable: false,\n enumerable: true,\n configurable: false,\n });\n this.prefs = Object.create(null);\n\n this._initializedPromise = this._readFromStorage(this.defaults).then(\n prefs => {\n for (const name in this.defaults) {\n const prefValue = prefs?.[name];\n // Ignore preferences whose types don't match the default values.\n if (typeof prefValue === typeof this.defaults[name]) {\n this.prefs[name] = prefValue;\n }\n }\n }\n );\n }\n\n /**\n * Stub function for writing preferences to storage.\n * @param {Object} prefObj The preferences that should be written to storage.\n * @returns {Promise} A promise that is resolved when the preference values\n * have been written.\n */\n async _writeToStorage(prefObj) {\n throw new Error(\"Not implemented: _writeToStorage\");\n }\n\n /**\n * Stub function for reading preferences from storage.\n * @param {Object} prefObj The preferences that should be read from storage.\n * @returns {Promise} A promise that is resolved with an {Object} containing\n * the preferences that have been read.\n */\n async _readFromStorage(prefObj) {\n throw new Error(\"Not implemented: _readFromStorage\");\n }\n\n /**\n * Reset the preferences to their default values and update storage.\n * @returns {Promise} A promise that is resolved when the preference values\n * have been reset.\n */\n async reset() {\n await this._initializedPromise;\n this.prefs = Object.create(null);\n return this._writeToStorage(this.defaults);\n }\n\n /**\n * Set the value of a preference.\n * @param {string} name The name of the preference that should be changed.\n * @param {boolean|number|string} value The new value of the preference.\n * @returns {Promise} A promise that is resolved when the value has been set,\n * provided that the preference exists and the types match.\n */\n async set(name, value) {\n await this._initializedPromise;\n const defaultValue = this.defaults[name];\n\n if (defaultValue === undefined) {\n throw new Error(`Set preference: \"${name}\" is undefined.`);\n } else if (value === undefined) {\n throw new Error(\"Set preference: no value is specified.\");\n }\n const valueType = typeof value;\n const defaultType = typeof defaultValue;\n\n if (valueType !== defaultType) {\n if (valueType === \"number\" && defaultType === \"string\") {\n value = value.toString();\n } else {\n throw new Error(\n `Set preference: \"${value}\" is a ${valueType}, expected a ${defaultType}.`\n );\n }\n } else {\n if (valueType === \"number\" && !Number.isInteger(value)) {\n throw new Error(`Set preference: \"${value}\" must be an integer.`);\n }\n }\n this.prefs[name] = value;\n return this._writeToStorage(this.prefs);\n }\n\n /**\n * Get the value of a preference.\n * @param {string} name The name of the preference whose value is requested.\n * @returns {Promise} A promise resolved with a {boolean|number|string}\n * containing the value of the preference.\n */\n async get(name) {\n await this._initializedPromise;\n const defaultValue = this.defaults[name],\n prefValue = this.prefs[name];\n\n if (defaultValue === undefined) {\n throw new Error(`Get preference: \"${name}\" is undefined.`);\n }\n return prefValue !== undefined ? prefValue : defaultValue;\n }\n\n /**\n * Get the values of all preferences.\n * @returns {Promise} A promise that is resolved with an {Object} containing\n * the values of all preferences.\n */\n async getAll() {\n await this._initializedPromise;\n const obj = Object.create(null);\n\n for (const name in this.defaults) {\n const prefValue = this.prefs[name];\n obj[name] = prefValue !== undefined ? prefValue : this.defaults[name];\n }\n return obj;\n }\n}\n\nexport { BasePreferences };\n","/* Copyright 2013 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 { createObjectURL, createValidAbsoluteUrl, isPdfFile } from \"pdfjs-lib\";\nimport { viewerCompatibilityParams } from \"./viewer_compatibility.js\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"CHROME || GENERIC\")) {\n throw new Error(\n 'Module \"pdfjs-web/download_manager\" shall not be used ' +\n \"outside CHROME and GENERIC builds.\"\n );\n}\n\nfunction download(blobUrl, filename) {\n const a = document.createElement(\"a\");\n if (!a.click) {\n throw new Error('DownloadManager: \"a.click()\" is not supported.');\n }\n a.href = blobUrl;\n a.target = \"_parent\";\n // Use a.download if available. This increases the likelihood that\n // the file is downloaded instead of opened by another PDF plugin.\n if (\"download\" in a) {\n a.download = filename;\n }\n // <a> must be in the document for recent Firefox versions,\n // otherwise .click() is ignored.\n (document.body || document.documentElement).appendChild(a);\n a.click();\n a.remove();\n}\n\nclass DownloadManager {\n constructor() {\n this._openBlobUrls = new WeakMap();\n }\n\n downloadUrl(url, filename) {\n if (!createValidAbsoluteUrl(url, \"http://example.com\")) {\n return; // restricted/invalid URL\n }\n download(url + \"#pdfjs.action=download\", filename);\n }\n\n downloadData(data, filename, contentType) {\n const blobUrl = createObjectURL(\n data,\n contentType,\n viewerCompatibilityParams.disableCreateObjectURL\n );\n download(blobUrl, filename);\n }\n\n /**\n * @returns {boolean} Indicating if the data was opened.\n */\n openOrDownloadData(element, data, filename) {\n const isPdfData = isPdfFile(filename);\n const contentType = isPdfData ? \"application/pdf\" : \"\";\n\n if (isPdfData && !viewerCompatibilityParams.disableCreateObjectURL) {\n let blobUrl = this._openBlobUrls.get(element);\n if (!blobUrl) {\n blobUrl = URL.createObjectURL(new Blob([data], { type: contentType }));\n this._openBlobUrls.set(element, blobUrl);\n }\n let viewerUrl;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // The current URL is the viewer, let's use it and append the file.\n viewerUrl = \"?file=\" + encodeURIComponent(blobUrl + \"#\" + filename);\n } else if (PDFJSDev.test(\"CHROME\")) {\n // In the Chrome extension, the URL is rewritten using the history API\n // in viewer.js, so an absolute URL must be generated.\n viewerUrl =\n // eslint-disable-next-line no-undef\n chrome.runtime.getURL(\"/content/web/viewer.html\") +\n \"?file=\" +\n encodeURIComponent(blobUrl + \"#\" + filename);\n }\n\n try {\n window.open(viewerUrl);\n return true;\n } catch (ex) {\n console.error(`openOrDownloadData: ${ex}`);\n // Release the `blobUrl`, since opening it failed, and fallback to\n // downloading the PDF file.\n URL.revokeObjectURL(blobUrl);\n this._openBlobUrls.delete(element);\n }\n }\n\n this.downloadData(data, filename, contentType);\n return false;\n }\n\n /**\n * @param sourceEventType {string} Used to signal what triggered the download.\n * The version of PDF.js integrated with Firefox uses this to to determine\n * which dialog to show. \"save\" triggers \"save as\" and \"download\" triggers\n * the \"open with\" dialog.\n */\n download(blob, url, filename, sourceEventType = \"download\") {\n if (viewerCompatibilityParams.disableCreateObjectURL) {\n // URL.createObjectURL is not supported\n this.downloadUrl(url, filename);\n return;\n }\n const blobUrl = URL.createObjectURL(blob);\n download(blobUrl, filename);\n }\n}\n\nexport { DownloadManager };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport \"../external/webL10n/l10n.js\";\nimport { fixupLangCode, getL10nFallback } from \"./l10n_utils.js\";\n\nconst webL10n = document.webL10n;\n\nclass GenericL10n {\n constructor(lang) {\n this._lang = lang;\n this._ready = new Promise((resolve, reject) => {\n webL10n.setLanguage(fixupLangCode(lang), () => {\n resolve(webL10n);\n });\n });\n }\n\n async getLanguage() {\n const l10n = await this._ready;\n return l10n.getLanguage();\n }\n\n async getDirection() {\n const l10n = await this._ready;\n return l10n.getDirection();\n }\n\n async get(key, args = null, fallback = getL10nFallback(key, args)) {\n const l10n = await this._ready;\n return l10n.get(key, args, fallback);\n }\n\n async translate(element) {\n const l10n = await this._ready;\n return l10n.translate(element);\n }\n}\n\nexport { GenericL10n };\n","/**\n * Copyright (c) 2011-2013 Fabien Cazenave, Mozilla.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n/*\n Additional modifications for PDF.js project:\n - Disables language initialization on page loading.\n - Disables document translation on page loading.\n - Removes consoleWarn and consoleLog and use console.log/warn directly.\n - Removes window._ assignment.\n - Remove compatibility code for OldIE.\n - Replaces `String.prototype.substr()` with `String.prototype.substring()`.\n - Removes `fireL10nReadyEvent` since the \"localized\" event it dispatches\n is unused and may clash with an identically named event in the viewer.\n*/\n\n/*jshint browser: true, devel: true, es5: true, globalstrict: true */\n'use strict';\n\ndocument.webL10n = (function(window, document, undefined) {\n var gL10nData = {};\n var gTextData = '';\n var gTextProp = 'textContent';\n var gLanguage = '';\n var gMacros = {};\n var gReadyState = 'loading';\n\n\n /**\n * Synchronously loading l10n resources significantly minimizes flickering\n * from displaying the app with non-localized strings and then updating the\n * strings. Although this will block all script execution on this page, we\n * expect that the l10n resources are available locally on flash-storage.\n *\n * As synchronous XHR is generally considered as a bad idea, we're still\n * loading l10n resources asynchronously -- but we keep this in a setting,\n * just in case... and applications using this library should hide their\n * content until the `localized' event happens.\n */\n\n var gAsyncResourceLoading = true; // read-only\n\n\n /**\n * DOM helpers for the so-called \"HTML API\".\n *\n * These functions are written for modern browsers. For old versions of IE,\n * they're overridden in the 'startup' section at the end of this file.\n */\n\n function getL10nResourceLinks() {\n return document.querySelectorAll('link[type=\"application/l10n\"]');\n }\n\n function getL10nDictionary() {\n var script = document.querySelector('script[type=\"application/l10n\"]');\n // TODO: support multiple and external JSON dictionaries\n return script ? JSON.parse(script.innerHTML) : null;\n }\n\n function getTranslatableChildren(element) {\n return element ? element.querySelectorAll('*[data-l10n-id]') : [];\n }\n\n function getL10nAttributes(element) {\n if (!element)\n return {};\n\n var l10nId = element.getAttribute('data-l10n-id');\n var l10nArgs = element.getAttribute('data-l10n-args');\n var args = {};\n if (l10nArgs) {\n try {\n args = JSON.parse(l10nArgs);\n } catch (e) {\n console.warn('could not parse arguments for #' + l10nId);\n }\n }\n return { id: l10nId, args: args };\n }\n\n function xhrLoadText(url, onSuccess, onFailure) {\n onSuccess = onSuccess || function _onSuccess(data) {};\n onFailure = onFailure || function _onFailure() {};\n\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, gAsyncResourceLoading);\n if (xhr.overrideMimeType) {\n xhr.overrideMimeType('text/plain; charset=utf-8');\n }\n xhr.onreadystatechange = function() {\n if (xhr.readyState == 4) {\n if (xhr.status == 200 || xhr.status === 0) {\n onSuccess(xhr.responseText);\n } else {\n onFailure();\n }\n }\n };\n xhr.onerror = onFailure;\n xhr.ontimeout = onFailure;\n\n // in Firefox OS with the app:// protocol, trying to XHR a non-existing\n // URL will raise an exception here -- hence this ugly try...catch.\n try {\n xhr.send(null);\n } catch (e) {\n onFailure();\n }\n }\n\n\n /**\n * l10n resource parser:\n * - reads (async XHR) the l10n resource matching `lang';\n * - imports linked resources (synchronously) when specified;\n * - parses the text data (fills `gL10nData' and `gTextData');\n * - triggers success/failure callbacks when done.\n *\n * @param {string} href\n * URL of the l10n resource to parse.\n *\n * @param {string} lang\n * locale (language) to parse. Must be a lowercase string.\n *\n * @param {Function} successCallback\n * triggered when the l10n resource has been successfully parsed.\n *\n * @param {Function} failureCallback\n * triggered when the an error has occurred.\n *\n * @return {void}\n * uses the following global variables: gL10nData, gTextData, gTextProp.\n */\n\n function parseResource(href, lang, successCallback, failureCallback) {\n var baseURL = href.replace(/[^\\/]*$/, '') || './';\n\n // handle escaped characters (backslashes) in a string\n function evalString(text) {\n if (text.lastIndexOf('\\\\') < 0)\n return text;\n return text.replace(/\\\\\\\\/g, '\\\\')\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\t/g, '\\t')\n .replace(/\\\\b/g, '\\b')\n .replace(/\\\\f/g, '\\f')\n .replace(/\\\\{/g, '{')\n .replace(/\\\\}/g, '}')\n .replace(/\\\\\"/g, '\"')\n .replace(/\\\\'/g, \"'\");\n }\n\n // parse *.properties text data into an l10n dictionary\n // If gAsyncResourceLoading is false, then the callback will be called\n // synchronously. Otherwise it is called asynchronously.\n function parseProperties(text, parsedPropertiesCallback) {\n var dictionary = {};\n\n // token expressions\n var reBlank = /^\\s*|\\s*$/;\n var reComment = /^\\s*#|^\\s*$/;\n var reSection = /^\\s*\\[(.*)\\]\\s*$/;\n var reImport = /^\\s*@import\\s+url\\((.*)\\)\\s*$/i;\n var reSplit = /^([^=\\s]*)\\s*=\\s*(.+)$/; // TODO: escape EOLs with '\\'\n\n // parse the *.properties file into an associative array\n function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {\n var entries = rawText.replace(reBlank, '').split(/[\\r\\n]+/);\n var currentLang = '*';\n var genericLang = lang.split('-', 1)[0];\n var skipLang = false;\n var match = '';\n\n function nextEntry() {\n // Use infinite loop instead of recursion to avoid reaching the\n // maximum recursion limit for content with many lines.\n while (true) {\n if (!entries.length) {\n parsedRawLinesCallback();\n return;\n }\n var line = entries.shift();\n\n // comment or blank line?\n if (reComment.test(line))\n continue;\n\n // the extended syntax supports [lang] sections and @import rules\n if (extendedSyntax) {\n match = reSection.exec(line);\n if (match) { // section start?\n // RFC 4646, section 4.4, \"All comparisons MUST be performed\n // in a case-insensitive manner.\"\n\n currentLang = match[1].toLowerCase();\n skipLang = (currentLang !== '*') &&\n (currentLang !== lang) && (currentLang !== genericLang);\n continue;\n } else if (skipLang) {\n continue;\n }\n match = reImport.exec(line);\n if (match) { // @import rule?\n loadImport(baseURL + match[1], nextEntry);\n return;\n }\n }\n\n // key-value pair\n var tmp = line.match(reSplit);\n if (tmp && tmp.length == 3) {\n dictionary[tmp[1]] = evalString(tmp[2]);\n }\n }\n }\n nextEntry();\n }\n\n // import another *.properties file\n function loadImport(url, callback) {\n xhrLoadText(url, function(content) {\n parseRawLines(content, false, callback); // don't allow recursive imports\n }, function () {\n console.warn(url + ' not found.');\n callback();\n });\n }\n\n // fill the dictionary\n parseRawLines(text, true, function() {\n parsedPropertiesCallback(dictionary);\n });\n }\n\n // load and parse l10n data (warning: global variables are used here)\n xhrLoadText(href, function(response) {\n gTextData += response; // mostly for debug\n\n // parse *.properties text data into an l10n dictionary\n parseProperties(response, function(data) {\n\n // find attribute descriptions, if any\n for (var key in data) {\n var id, prop, index = key.lastIndexOf('.');\n if (index > 0) { // an attribute has been specified\n id = key.substring(0, index);\n prop = key.substring(index + 1);\n } else { // no attribute: assuming text content by default\n id = key;\n prop = gTextProp;\n }\n if (!gL10nData[id]) {\n gL10nData[id] = {};\n }\n gL10nData[id][prop] = data[key];\n }\n\n // trigger callback\n if (successCallback) {\n successCallback();\n }\n });\n }, failureCallback);\n }\n\n // load and parse all resources for the specified locale\n function loadLocale(lang, callback) {\n // RFC 4646, section 2.1 states that language tags have to be treated as\n // case-insensitive. Convert to lowercase for case-insensitive comparisons.\n if (lang) {\n lang = lang.toLowerCase();\n }\n\n callback = callback || function _callback() {};\n\n clear();\n gLanguage = lang;\n\n // check all <link type=\"application/l10n\" href=\"...\" /> nodes\n // and load the resource files\n var langLinks = getL10nResourceLinks();\n var langCount = langLinks.length;\n if (langCount === 0) {\n // we might have a pre-compiled dictionary instead\n var dict = getL10nDictionary();\n if (dict && dict.locales && dict.default_locale) {\n console.log('using the embedded JSON directory, early way out');\n gL10nData = dict.locales[lang];\n if (!gL10nData) {\n var defaultLocale = dict.default_locale.toLowerCase();\n for (var anyCaseLang in dict.locales) {\n anyCaseLang = anyCaseLang.toLowerCase();\n if (anyCaseLang === lang) {\n gL10nData = dict.locales[lang];\n break;\n } else if (anyCaseLang === defaultLocale) {\n gL10nData = dict.locales[defaultLocale];\n }\n }\n }\n callback();\n } else {\n console.log('no resource to load, early way out');\n }\n // early way out\n gReadyState = 'complete';\n return;\n }\n\n // start the callback when all resources are loaded\n var onResourceLoaded = null;\n var gResourceCount = 0;\n onResourceLoaded = function() {\n gResourceCount++;\n if (gResourceCount >= langCount) {\n callback();\n gReadyState = 'complete';\n }\n };\n\n // load all resource files\n function L10nResourceLink(link) {\n var href = link.href;\n // Note: If |gAsyncResourceLoading| is false, then the following callbacks\n // are synchronously called.\n this.load = function(lang, callback) {\n parseResource(href, lang, callback, function() {\n console.warn(href + ' not found.');\n // lang not found, used default resource instead\n console.warn('\"' + lang + '\" resource not found');\n gLanguage = '';\n // Resource not loaded, but we still need to call the callback.\n callback();\n });\n };\n }\n\n for (var i = 0; i < langCount; i++) {\n var resource = new L10nResourceLink(langLinks[i]);\n resource.load(lang, onResourceLoaded);\n }\n }\n\n // clear all l10n data\n function clear() {\n gL10nData = {};\n gTextData = '';\n gLanguage = '';\n // TODO: clear all non predefined macros.\n // There's no such macro /yet/ but we're planning to have some...\n }\n\n\n /**\n * Get rules for plural forms (shared with JetPack), see:\n * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html\n * https://github.com/mozilla/addon-sdk/blob/master/python-lib/plural-rules-generator.p\n *\n * @param {string} lang\n * locale (language) used.\n *\n * @return {Function}\n * returns a function that gives the plural form name for a given integer:\n * var fun = getPluralRules('en');\n * fun(1) -> 'one'\n * fun(0) -> 'other'\n * fun(1000) -> 'other'.\n */\n\n function getPluralRules(lang) {\n var locales2rules = {\n 'af': 3,\n 'ak': 4,\n 'am': 4,\n 'ar': 1,\n 'asa': 3,\n 'az': 0,\n 'be': 11,\n 'bem': 3,\n 'bez': 3,\n 'bg': 3,\n 'bh': 4,\n 'bm': 0,\n 'bn': 3,\n 'bo': 0,\n 'br': 20,\n 'brx': 3,\n 'bs': 11,\n 'ca': 3,\n 'cgg': 3,\n 'chr': 3,\n 'cs': 12,\n 'cy': 17,\n 'da': 3,\n 'de': 3,\n 'dv': 3,\n 'dz': 0,\n 'ee': 3,\n 'el': 3,\n 'en': 3,\n 'eo': 3,\n 'es': 3,\n 'et': 3,\n 'eu': 3,\n 'fa': 0,\n 'ff': 5,\n 'fi': 3,\n 'fil': 4,\n 'fo': 3,\n 'fr': 5,\n 'fur': 3,\n 'fy': 3,\n 'ga': 8,\n 'gd': 24,\n 'gl': 3,\n 'gsw': 3,\n 'gu': 3,\n 'guw': 4,\n 'gv': 23,\n 'ha': 3,\n 'haw': 3,\n 'he': 2,\n 'hi': 4,\n 'hr': 11,\n 'hu': 0,\n 'id': 0,\n 'ig': 0,\n 'ii': 0,\n 'is': 3,\n 'it': 3,\n 'iu': 7,\n 'ja': 0,\n 'jmc': 3,\n 'jv': 0,\n 'ka': 0,\n 'kab': 5,\n 'kaj': 3,\n 'kcg': 3,\n 'kde': 0,\n 'kea': 0,\n 'kk': 3,\n 'kl': 3,\n 'km': 0,\n 'kn': 0,\n 'ko': 0,\n 'ksb': 3,\n 'ksh': 21,\n 'ku': 3,\n 'kw': 7,\n 'lag': 18,\n 'lb': 3,\n 'lg': 3,\n 'ln': 4,\n 'lo': 0,\n 'lt': 10,\n 'lv': 6,\n 'mas': 3,\n 'mg': 4,\n 'mk': 16,\n 'ml': 3,\n 'mn': 3,\n 'mo': 9,\n 'mr': 3,\n 'ms': 0,\n 'mt': 15,\n 'my': 0,\n 'nah': 3,\n 'naq': 7,\n 'nb': 3,\n 'nd': 3,\n 'ne': 3,\n 'nl': 3,\n 'nn': 3,\n 'no': 3,\n 'nr': 3,\n 'nso': 4,\n 'ny': 3,\n 'nyn': 3,\n 'om': 3,\n 'or': 3,\n 'pa': 3,\n 'pap': 3,\n 'pl': 13,\n 'ps': 3,\n 'pt': 3,\n 'rm': 3,\n 'ro': 9,\n 'rof': 3,\n 'ru': 11,\n 'rwk': 3,\n 'sah': 0,\n 'saq': 3,\n 'se': 7,\n 'seh': 3,\n 'ses': 0,\n 'sg': 0,\n 'sh': 11,\n 'shi': 19,\n 'sk': 12,\n 'sl': 14,\n 'sma': 7,\n 'smi': 7,\n 'smj': 7,\n 'smn': 7,\n 'sms': 7,\n 'sn': 3,\n 'so': 3,\n 'sq': 3,\n 'sr': 11,\n 'ss': 3,\n 'ssy': 3,\n 'st': 3,\n 'sv': 3,\n 'sw': 3,\n 'syr': 3,\n 'ta': 3,\n 'te': 3,\n 'teo': 3,\n 'th': 0,\n 'ti': 4,\n 'tig': 3,\n 'tk': 3,\n 'tl': 4,\n 'tn': 3,\n 'to': 0,\n 'tr': 0,\n 'ts': 3,\n 'tzm': 22,\n 'uk': 11,\n 'ur': 3,\n 've': 3,\n 'vi': 0,\n 'vun': 3,\n 'wa': 4,\n 'wae': 3,\n 'wo': 0,\n 'xh': 3,\n 'xog': 3,\n 'yo': 0,\n 'zh': 0,\n 'zu': 3\n };\n\n // utility functions for plural rules methods\n function isIn(n, list) {\n return list.indexOf(n) !== -1;\n }\n function isBetween(n, start, end) {\n return start <= n && n <= end;\n }\n\n // list of all plural rules methods:\n // map an integer to the plural form name to use\n var pluralRules = {\n '0': function(n) {\n return 'other';\n },\n '1': function(n) {\n if ((isBetween((n % 100), 3, 10)))\n return 'few';\n if (n === 0)\n return 'zero';\n if ((isBetween((n % 100), 11, 99)))\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '2': function(n) {\n if (n !== 0 && (n % 10) === 0)\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '3': function(n) {\n if (n == 1)\n return 'one';\n return 'other';\n },\n '4': function(n) {\n if ((isBetween(n, 0, 1)))\n return 'one';\n return 'other';\n },\n '5': function(n) {\n if ((isBetween(n, 0, 2)) && n != 2)\n return 'one';\n return 'other';\n },\n '6': function(n) {\n if (n === 0)\n return 'zero';\n if ((n % 10) == 1 && (n % 100) != 11)\n return 'one';\n return 'other';\n },\n '7': function(n) {\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '8': function(n) {\n if ((isBetween(n, 3, 6)))\n return 'few';\n if ((isBetween(n, 7, 10)))\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '9': function(n) {\n if (n === 0 || n != 1 && (isBetween((n % 100), 1, 19)))\n return 'few';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '10': function(n) {\n if ((isBetween((n % 10), 2, 9)) && !(isBetween((n % 100), 11, 19)))\n return 'few';\n if ((n % 10) == 1 && !(isBetween((n % 100), 11, 19)))\n return 'one';\n return 'other';\n },\n '11': function(n) {\n if ((isBetween((n % 10), 2, 4)) && !(isBetween((n % 100), 12, 14)))\n return 'few';\n if ((n % 10) === 0 ||\n (isBetween((n % 10), 5, 9)) ||\n (isBetween((n % 100), 11, 14)))\n return 'many';\n if ((n % 10) == 1 && (n % 100) != 11)\n return 'one';\n return 'other';\n },\n '12': function(n) {\n if ((isBetween(n, 2, 4)))\n return 'few';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '13': function(n) {\n if ((isBetween((n % 10), 2, 4)) && !(isBetween((n % 100), 12, 14)))\n return 'few';\n if (n != 1 && (isBetween((n % 10), 0, 1)) ||\n (isBetween((n % 10), 5, 9)) ||\n (isBetween((n % 100), 12, 14)))\n return 'many';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '14': function(n) {\n if ((isBetween((n % 100), 3, 4)))\n return 'few';\n if ((n % 100) == 2)\n return 'two';\n if ((n % 100) == 1)\n return 'one';\n return 'other';\n },\n '15': function(n) {\n if (n === 0 || (isBetween((n % 100), 2, 10)))\n return 'few';\n if ((isBetween((n % 100), 11, 19)))\n return 'many';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '16': function(n) {\n if ((n % 10) == 1 && n != 11)\n return 'one';\n return 'other';\n },\n '17': function(n) {\n if (n == 3)\n return 'few';\n if (n === 0)\n return 'zero';\n if (n == 6)\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '18': function(n) {\n if (n === 0)\n return 'zero';\n if ((isBetween(n, 0, 2)) && n !== 0 && n != 2)\n return 'one';\n return 'other';\n },\n '19': function(n) {\n if ((isBetween(n, 2, 10)))\n return 'few';\n if ((isBetween(n, 0, 1)))\n return 'one';\n return 'other';\n },\n '20': function(n) {\n if ((isBetween((n % 10), 3, 4) || ((n % 10) == 9)) && !(\n isBetween((n % 100), 10, 19) ||\n isBetween((n % 100), 70, 79) ||\n isBetween((n % 100), 90, 99)\n ))\n return 'few';\n if ((n % 1000000) === 0 && n !== 0)\n return 'many';\n if ((n % 10) == 2 && !isIn((n % 100), [12, 72, 92]))\n return 'two';\n if ((n % 10) == 1 && !isIn((n % 100), [11, 71, 91]))\n return 'one';\n return 'other';\n },\n '21': function(n) {\n if (n === 0)\n return 'zero';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '22': function(n) {\n if ((isBetween(n, 0, 1)) || (isBetween(n, 11, 99)))\n return 'one';\n return 'other';\n },\n '23': function(n) {\n if ((isBetween((n % 10), 1, 2)) || (n % 20) === 0)\n return 'one';\n return 'other';\n },\n '24': function(n) {\n if ((isBetween(n, 3, 10) || isBetween(n, 13, 19)))\n return 'few';\n if (isIn(n, [2, 12]))\n return 'two';\n if (isIn(n, [1, 11]))\n return 'one';\n return 'other';\n }\n };\n\n // return a function that gives the plural form name for a given integer\n var index = locales2rules[lang.replace(/-.*$/, '')];\n if (!(index in pluralRules)) {\n console.warn('plural form unknown for [' + lang + ']');\n return function() { return 'other'; };\n }\n return pluralRules[index];\n }\n\n // pre-defined 'plural' macro\n gMacros.plural = function(str, param, key, prop) {\n var n = parseFloat(param);\n if (isNaN(n))\n return str;\n\n // TODO: support other properties (l20n still doesn't...)\n if (prop != gTextProp)\n return str;\n\n // initialize _pluralRules\n if (!gMacros._pluralRules) {\n gMacros._pluralRules = getPluralRules(gLanguage);\n }\n var index = '[' + gMacros._pluralRules(n) + ']';\n\n // try to find a [zero|one|two] key if it's defined\n if (n === 0 && (key + '[zero]') in gL10nData) {\n str = gL10nData[key + '[zero]'][prop];\n } else if (n == 1 && (key + '[one]') in gL10nData) {\n str = gL10nData[key + '[one]'][prop];\n } else if (n == 2 && (key + '[two]') in gL10nData) {\n str = gL10nData[key + '[two]'][prop];\n } else if ((key + index) in gL10nData) {\n str = gL10nData[key + index][prop];\n } else if ((key + '[other]') in gL10nData) {\n str = gL10nData[key + '[other]'][prop];\n }\n\n return str;\n };\n\n\n /**\n * l10n dictionary functions\n */\n\n // fetch an l10n object, warn if not found, apply `args' if possible\n function getL10nData(key, args, fallback) {\n var data = gL10nData[key];\n if (!data) {\n console.warn('#' + key + ' is undefined.');\n if (!fallback) {\n return null;\n }\n data = fallback;\n }\n\n /** This is where l10n expressions should be processed.\n * The plan is to support C-style expressions from the l20n project;\n * until then, only two kinds of simple expressions are supported:\n * {[ index ]} and {{ arguments }}.\n */\n var rv = {};\n for (var prop in data) {\n var str = data[prop];\n str = substIndexes(str, args, key, prop);\n str = substArguments(str, args, key);\n rv[prop] = str;\n }\n return rv;\n }\n\n // replace {[macros]} with their values\n function substIndexes(str, args, key, prop) {\n var reIndex = /\\{\\[\\s*([a-zA-Z]+)\\(([a-zA-Z]+)\\)\\s*\\]\\}/;\n var reMatch = reIndex.exec(str);\n if (!reMatch || !reMatch.length)\n return str;\n\n // an index/macro has been found\n // Note: at the moment, only one parameter is supported\n var macroName = reMatch[1];\n var paramName = reMatch[2];\n var param;\n if (args && paramName in args) {\n param = args[paramName];\n } else if (paramName in gL10nData) {\n param = gL10nData[paramName];\n }\n\n // there's no macro parser yet: it has to be defined in gMacros\n if (macroName in gMacros) {\n var macro = gMacros[macroName];\n str = macro(str, param, key, prop);\n }\n return str;\n }\n\n // replace {{arguments}} with their values\n function substArguments(str, args, key) {\n var reArgs = /\\{\\{\\s*(.+?)\\s*\\}\\}/g;\n return str.replace(reArgs, function(matched_text, arg) {\n if (args && arg in args) {\n return args[arg];\n }\n if (arg in gL10nData) {\n return gL10nData[arg];\n }\n console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');\n return matched_text;\n });\n }\n\n // translate an HTML element\n function translateElement(element) {\n var l10n = getL10nAttributes(element);\n if (!l10n.id)\n return;\n\n // get the related l10n object\n var data = getL10nData(l10n.id, l10n.args);\n if (!data) {\n console.warn('#' + l10n.id + ' is undefined.');\n return;\n }\n\n // translate element (TODO: security checks?)\n if (data[gTextProp]) { // XXX\n if (getChildElementCount(element) === 0) {\n element[gTextProp] = data[gTextProp];\n } else {\n // this element has element children: replace the content of the first\n // (non-empty) child textNode and clear other child textNodes\n var children = element.childNodes;\n var found = false;\n for (var i = 0, l = children.length; i < l; i++) {\n if (children[i].nodeType === 3 && /\\S/.test(children[i].nodeValue)) {\n if (found) {\n children[i].nodeValue = '';\n } else {\n children[i].nodeValue = data[gTextProp];\n found = true;\n }\n }\n }\n // if no (non-empty) textNode is found, insert a textNode before the\n // first element child.\n if (!found) {\n var textNode = document.createTextNode(data[gTextProp]);\n element.insertBefore(textNode, element.firstChild);\n }\n }\n delete data[gTextProp];\n }\n\n for (var k in data) {\n element[k] = data[k];\n }\n }\n\n // webkit browsers don't currently support 'children' on SVG elements...\n function getChildElementCount(element) {\n if (element.children) {\n return element.children.length;\n }\n if (typeof element.childElementCount !== 'undefined') {\n return element.childElementCount;\n }\n var count = 0;\n for (var i = 0; i < element.childNodes.length; i++) {\n count += element.nodeType === 1 ? 1 : 0;\n }\n return count;\n }\n\n // translate an HTML subtree\n function translateFragment(element) {\n element = element || document.documentElement;\n\n // check all translatable children (= w/ a `data-l10n-id' attribute)\n var children = getTranslatableChildren(element);\n var elementCount = children.length;\n for (var i = 0; i < elementCount; i++) {\n translateElement(children[i]);\n }\n\n // translate element itself if necessary\n translateElement(element);\n }\n\n return {\n // get a localized string\n get: function(key, args, fallbackString) {\n var index = key.lastIndexOf('.');\n var prop = gTextProp;\n if (index > 0) { // An attribute has been specified\n prop = key.substring(index + 1);\n key = key.substring(0, index);\n }\n var fallback;\n if (fallbackString) {\n fallback = {};\n fallback[prop] = fallbackString;\n }\n var data = getL10nData(key, args, fallback);\n if (data && prop in data) {\n return data[prop];\n }\n return '{{' + key + '}}';\n },\n\n // debug\n getData: function() { return gL10nData; },\n getText: function() { return gTextData; },\n\n // get|set the document language\n getLanguage: function() { return gLanguage; },\n setLanguage: function(lang, callback) {\n loadLocale(lang, function() {\n if (callback)\n callback();\n });\n },\n\n // get the direction (ltr|rtl) of the current language\n getDirection: function() {\n // http://www.w3.org/International/questions/qa-scripts\n // Arabic, Hebrew, Farsi, Pashto, Urdu\n var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];\n var shortCode = gLanguage.split('-', 1)[0];\n return (rtlList.indexOf(shortCode) >= 0) ? 'rtl' : 'ltr';\n },\n\n // translate an element or document fragment\n translate: translateFragment,\n\n // this can be used to prevent race conditions\n getReadyState: function() { return gReadyState; },\n ready: function(callback) {\n if (!callback) {\n return;\n } else if (gReadyState == 'complete' || gReadyState == 'interactive') {\n window.setTimeout(function() {\n callback();\n });\n } else if (document.addEventListener) {\n document.addEventListener('localized', function once() {\n document.removeEventListener('localized', once);\n callback();\n });\n }\n }\n };\n}) (window, document);\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getPdfFilenameFromUrl, loadScript } from \"pdfjs-lib\";\n\nasync function docPropertiesLookup(pdfDocument) {\n const url = \"\",\n baseUrl = url.split(\"#\")[0];\n // eslint-disable-next-line prefer-const\n let { info, metadata, contentDispositionFilename, contentLength } =\n await pdfDocument.getMetadata();\n\n if (!contentLength) {\n const { length } = await pdfDocument.getDownloadInfo();\n contentLength = length;\n }\n\n return {\n ...info,\n baseURL: baseUrl,\n filesize: contentLength,\n filename: contentDispositionFilename || getPdfFilenameFromUrl(url),\n metadata: metadata?.getRaw(),\n authors: metadata?.get(\"dc:creator\"),\n numPages: pdfDocument.numPages,\n URL: url,\n };\n}\n\nclass GenericScripting {\n constructor(sandboxBundleSrc) {\n this._ready = loadScript(\n sandboxBundleSrc,\n /* removeScriptElement = */ true\n ).then(() => {\n return window.pdfjsSandbox.QuickJSSandbox();\n });\n }\n\n async createSandbox(data) {\n const sandbox = await this._ready;\n sandbox.create(data);\n }\n\n async dispatchEventInSandbox(event) {\n const sandbox = await this._ready;\n sandbox.dispatchEvent(event);\n }\n\n async destroySandbox() {\n const sandbox = await this._ready;\n sandbox.nukeSandbox();\n }\n}\n\nexport { docPropertiesLookup, GenericScripting };\n","/* Copyright 2016 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 { PDFPrintServiceFactory, PDFViewerApplication } from \"./app.js\";\nimport { getXfaHtmlForPrinting } from \"./print_utils.js\";\nimport { viewerCompatibilityParams } from \"./viewer_compatibility.js\";\n\nlet activeService = null;\nlet overlayManager = null;\n\n// Renders the page to the canvas of the given print service, and returns\n// the suggested dimensions of the output page.\nfunction renderPage(\n activeServiceOnEntry,\n pdfDocument,\n pageNumber,\n size,\n printResolution,\n optionalContentConfigPromise\n) {\n const scratchCanvas = activeService.scratchCanvas;\n\n // The size of the canvas in pixels for printing.\n const PRINT_UNITS = printResolution / 72.0;\n scratchCanvas.width = Math.floor(size.width * PRINT_UNITS);\n scratchCanvas.height = Math.floor(size.height * PRINT_UNITS);\n\n const ctx = scratchCanvas.getContext(\"2d\");\n ctx.save();\n ctx.fillStyle = \"rgb(255, 255, 255)\";\n ctx.fillRect(0, 0, scratchCanvas.width, scratchCanvas.height);\n ctx.restore();\n\n return pdfDocument.getPage(pageNumber).then(function (pdfPage) {\n const renderContext = {\n canvasContext: ctx,\n transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],\n viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }),\n intent: \"print\",\n includeAnnotationStorage: true,\n optionalContentConfigPromise,\n };\n return pdfPage.render(renderContext).promise;\n });\n}\n\nfunction PDFPrintService(\n pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n optionalContentConfigPromise = null,\n l10n\n) {\n this.pdfDocument = pdfDocument;\n this.pagesOverview = pagesOverview;\n this.printContainer = printContainer;\n this._printResolution = printResolution || 150;\n this._optionalContentConfigPromise =\n optionalContentConfigPromise || pdfDocument.getOptionalContentConfig();\n this.l10n = l10n;\n this.currentPage = -1;\n // The temporary canvas where renderPage paints one page at a time.\n this.scratchCanvas = document.createElement(\"canvas\");\n}\n\nPDFPrintService.prototype = {\n layout() {\n this.throwIfInactive();\n\n const body = document.querySelector(\"body\");\n body.setAttribute(\"data-pdfjsprinting\", true);\n\n const hasEqualPageSizes = this.pagesOverview.every(function (size) {\n return (\n size.width === this.pagesOverview[0].width &&\n size.height === this.pagesOverview[0].height\n );\n }, this);\n if (!hasEqualPageSizes) {\n console.warn(\n \"Not all pages have the same size. The printed \" +\n \"result may be incorrect!\"\n );\n }\n\n // Insert a @page + size rule to make sure that the page size is correctly\n // set. Note that we assume that all pages have the same size, because\n // variable-size pages are not supported yet (e.g. in Chrome & Firefox).\n // TODO(robwu): Use named pages when size calculation bugs get resolved\n // (e.g. https://crbug.com/355116) AND when support for named pages is\n // added (http://www.w3.org/TR/css3-page/#using-named-pages).\n // In browsers where @page + size is not supported (such as Firefox,\n // https://bugzil.la/851441), the next stylesheet will be ignored and the\n // user has to select the correct paper size in the UI if wanted.\n this.pageStyleSheet = document.createElement(\"style\");\n const pageSize = this.pagesOverview[0];\n this.pageStyleSheet.textContent =\n \"@page { size: \" + pageSize.width + \"pt \" + pageSize.height + \"pt;}\";\n body.appendChild(this.pageStyleSheet);\n },\n\n destroy() {\n if (activeService !== this) {\n // |activeService| cannot be replaced without calling destroy() first,\n // so if it differs then an external consumer has a stale reference to\n // us.\n return;\n }\n this.printContainer.textContent = \"\";\n\n const body = document.querySelector(\"body\");\n body.removeAttribute(\"data-pdfjsprinting\");\n\n if (this.pageStyleSheet) {\n this.pageStyleSheet.remove();\n this.pageStyleSheet = null;\n }\n this.scratchCanvas.width = this.scratchCanvas.height = 0;\n this.scratchCanvas = null;\n activeService = null;\n ensureOverlay().then(function () {\n if (overlayManager.active !== \"printServiceOverlay\") {\n return; // overlay was already closed\n }\n overlayManager.close(\"printServiceOverlay\");\n });\n },\n\n renderPages() {\n if (this.pdfDocument.isPureXfa) {\n getXfaHtmlForPrinting(this.printContainer, this.pdfDocument);\n return Promise.resolve();\n }\n\n const pageCount = this.pagesOverview.length;\n const renderNextPage = (resolve, reject) => {\n this.throwIfInactive();\n if (++this.currentPage >= pageCount) {\n renderProgress(pageCount, pageCount, this.l10n);\n resolve();\n return;\n }\n const index = this.currentPage;\n renderProgress(index, pageCount, this.l10n);\n renderPage(\n this,\n this.pdfDocument,\n /* pageNumber = */ index + 1,\n this.pagesOverview[index],\n this._printResolution,\n this._optionalContentConfigPromise\n )\n .then(this.useRenderedPage.bind(this))\n .then(function () {\n renderNextPage(resolve, reject);\n }, reject);\n };\n return new Promise(renderNextPage);\n },\n\n useRenderedPage() {\n this.throwIfInactive();\n const img = document.createElement(\"img\");\n const scratchCanvas = this.scratchCanvas;\n if (\n \"toBlob\" in scratchCanvas &&\n !viewerCompatibilityParams.disableCreateObjectURL\n ) {\n scratchCanvas.toBlob(function (blob) {\n img.src = URL.createObjectURL(blob);\n });\n } else {\n img.src = scratchCanvas.toDataURL();\n }\n\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"printedPage\";\n wrapper.appendChild(img);\n this.printContainer.appendChild(wrapper);\n\n return new Promise(function (resolve, reject) {\n img.onload = resolve;\n img.onerror = reject;\n });\n },\n\n performPrint() {\n this.throwIfInactive();\n return new Promise(resolve => {\n // Push window.print in the macrotask queue to avoid being affected by\n // the deprecation of running print() code in a microtask, see\n // https://github.com/mozilla/pdf.js/issues/7547.\n setTimeout(() => {\n if (!this.active) {\n resolve();\n return;\n }\n print.call(window);\n // Delay promise resolution in case print() was not synchronous.\n setTimeout(resolve, 20); // Tidy-up.\n }, 0);\n });\n },\n\n get active() {\n return this === activeService;\n },\n\n throwIfInactive() {\n if (!this.active) {\n throw new Error(\"This print request was cancelled or completed.\");\n }\n },\n};\n\nconst print = window.print;\nwindow.print = function () {\n if (activeService) {\n console.warn(\"Ignored window.print() because of a pending print job.\");\n return;\n }\n ensureOverlay().then(function () {\n if (activeService) {\n overlayManager.open(\"printServiceOverlay\");\n }\n });\n\n try {\n dispatchEvent(\"beforeprint\");\n } finally {\n if (!activeService) {\n console.error(\"Expected print service to be initialized.\");\n ensureOverlay().then(function () {\n if (overlayManager.active === \"printServiceOverlay\") {\n overlayManager.close(\"printServiceOverlay\");\n }\n });\n return; // eslint-disable-line no-unsafe-finally\n }\n const activeServiceOnEntry = activeService;\n activeService\n .renderPages()\n .then(function () {\n return activeServiceOnEntry.performPrint();\n })\n .catch(function () {\n // Ignore any error messages.\n })\n .then(function () {\n // aborts acts on the \"active\" print request, so we need to check\n // whether the print request (activeServiceOnEntry) is still active.\n // Without the check, an unrelated print request (created after aborting\n // this print request while the pages were being generated) would be\n // aborted.\n if (activeServiceOnEntry.active) {\n abort();\n }\n });\n }\n};\n\nfunction dispatchEvent(eventType) {\n const event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(eventType, false, false, \"custom\");\n window.dispatchEvent(event);\n}\n\nfunction abort() {\n if (activeService) {\n activeService.destroy();\n dispatchEvent(\"afterprint\");\n }\n}\n\nfunction renderProgress(index, total, l10n) {\n const progressContainer = document.getElementById(\"printServiceOverlay\");\n const progress = Math.round((100 * index) / total);\n const progressBar = progressContainer.querySelector(\"progress\");\n const progressPerc = progressContainer.querySelector(\".relative-progress\");\n progressBar.value = progress;\n l10n.get(\"print_progress_percent\", { progress }).then(msg => {\n progressPerc.textContent = msg;\n });\n}\n\nwindow.addEventListener(\n \"keydown\",\n function (event) {\n // Intercept Cmd/Ctrl + P in all browsers.\n // Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera\n if (\n event.keyCode === /* P= */ 80 &&\n (event.ctrlKey || event.metaKey) &&\n !event.altKey &&\n (!event.shiftKey || window.chrome || window.opera)\n ) {\n window.print();\n\n // The (browser) print dialog cannot be prevented from being shown in\n // IE11.\n event.preventDefault();\n if (event.stopImmediatePropagation) {\n event.stopImmediatePropagation();\n } else {\n event.stopPropagation();\n }\n }\n },\n true\n);\n\nif (\"onbeforeprint\" in window) {\n // Do not propagate before/afterprint events when they are not triggered\n // from within this polyfill. (FF / Chrome 63+).\n const stopPropagationIfNeeded = function (event) {\n if (event.detail !== \"custom\" && event.stopImmediatePropagation) {\n event.stopImmediatePropagation();\n }\n };\n window.addEventListener(\"beforeprint\", stopPropagationIfNeeded);\n window.addEventListener(\"afterprint\", stopPropagationIfNeeded);\n}\n\nlet overlayPromise;\nfunction ensureOverlay() {\n if (!overlayPromise) {\n overlayManager = PDFViewerApplication.overlayManager;\n if (!overlayManager) {\n throw new Error(\"The overlay manager has not yet been initialized.\");\n }\n\n overlayPromise = overlayManager.register(\n \"printServiceOverlay\",\n document.getElementById(\"printServiceOverlay\"),\n abort,\n true\n );\n document.getElementById(\"printCancel\").onclick = abort;\n }\n return overlayPromise;\n}\n\nPDFPrintServiceFactory.instance = {\n supportsPrinting: true,\n\n createPrintService(\n pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n optionalContentConfigPromise,\n l10n\n ) {\n if (activeService) {\n throw new Error(\"The print service is created and active.\");\n }\n activeService = new PDFPrintService(\n pdfDocument,\n pagesOverview,\n printContainer,\n printResolution,\n optionalContentConfigPromise,\n l10n\n );\n return activeService;\n },\n};\n\nexport { PDFPrintService };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CSS_UNITS } from \"./ui_utils.js\";\nimport { DefaultXfaLayerFactory } from \"./xfa_layer_builder.js\";\nimport { getXfaPageViewport } from \"pdfjs-lib\";\n\nfunction getXfaHtmlForPrinting(printContainer, pdfDocument) {\n const xfaHtml = pdfDocument.allXfaHtml;\n const factory = new DefaultXfaLayerFactory();\n const scale = Math.round(CSS_UNITS * 100) / 100;\n\n for (const xfaPage of xfaHtml.children) {\n const page = document.createElement(\"div\");\n page.className = \"xfaPrintedPage\";\n printContainer.appendChild(page);\n\n const builder = factory.createXfaLayerBuilder(\n /* pageDiv = */ page,\n /* pdfPage = */ null,\n /* annotationStorage = */ pdfDocument.annotationStorage,\n /* xfaHtml = */ xfaPage\n );\n const viewport = getXfaPageViewport(xfaPage, { scale });\n\n builder.render(viewport, \"print\");\n }\n}\n\nexport { getXfaHtmlForPrinting };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","/* Copyright 2016 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 { AppOptions } from \"./app_options.js\";\nimport { PDFViewerApplication } from \"./app.js\";\n\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : void 0;\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsBuild =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_BUILD\") : void 0;\n\nwindow.PDFViewerApplication = PDFViewerApplication;\nwindow.PDFViewerApplicationOptions = AppOptions;\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n var defaultUrl; // eslint-disable-line no-var\n\n (function rewriteUrlClosure() {\n // Run this code outside DOMContentLoaded to make sure that the URL\n // is rewritten as soon as possible.\n const queryString = document.location.search.slice(1);\n const m = /(^|&)file=([^&]*)/.exec(queryString);\n defaultUrl = m ? decodeURIComponent(m[2]) : \"\";\n\n // Example: chrome-extension://.../http://example.com/file.pdf\n const humanReadableUrl = \"/\" + defaultUrl + location.hash;\n history.replaceState(history.state, \"\", humanReadableUrl);\n if (top === window) {\n // eslint-disable-next-line no-undef\n chrome.runtime.sendMessage(\"showPageAction\");\n }\n })();\n}\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n require(\"./firefoxcom.js\");\n require(\"./firefox_print_service.js\");\n}\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\")) {\n require(\"./genericcom.js\");\n}\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n require(\"./chromecom.js\");\n}\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME || GENERIC\")) {\n require(\"./pdf_print_service.js\");\n}\n\nfunction getViewerConfiguration() {\n let errorWrapper = null;\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n errorWrapper = {\n container: document.getElementById(\"errorWrapper\"),\n errorMessage: document.getElementById(\"errorMessage\"),\n closeButton: document.getElementById(\"errorClose\"),\n errorMoreInfo: document.getElementById(\"errorMoreInfo\"),\n moreInfoButton: document.getElementById(\"errorShowMore\"),\n lessInfoButton: document.getElementById(\"errorShowLess\"),\n };\n }\n\n return {\n appContainer: document.body,\n mainContainer: document.getElementById(\"viewerContainer\"),\n viewerContainer: document.getElementById(\"viewer\"),\n eventBus: null,\n toolbar: {\n container: document.getElementById(\"toolbarViewer\"),\n numPages: document.getElementById(\"numPages\"),\n pageNumber: document.getElementById(\"pageNumber\"),\n scaleSelectContainer: document.getElementById(\"scaleSelectContainer\"),\n scaleSelect: document.getElementById(\"scaleSelect\"),\n customScaleOption: document.getElementById(\"customScaleOption\"),\n previous: document.getElementById(\"previous\"),\n next: document.getElementById(\"next\"),\n zoomIn: document.getElementById(\"zoomIn\"),\n zoomOut: document.getElementById(\"zoomOut\"),\n viewFind: document.getElementById(\"viewFind\"),\n openFile: document.getElementById(\"openFile\"),\n print: document.getElementById(\"print\"),\n presentationModeButton: document.getElementById(\"presentationMode\"),\n download: document.getElementById(\"download\"),\n viewBookmark: document.getElementById(\"viewBookmark\"),\n },\n secondaryToolbar: {\n toolbar: document.getElementById(\"secondaryToolbar\"),\n toggleButton: document.getElementById(\"secondaryToolbarToggle\"),\n toolbarButtonContainer: document.getElementById(\n \"secondaryToolbarButtonContainer\"\n ),\n presentationModeButton: document.getElementById(\n \"secondaryPresentationMode\"\n ),\n openFileButton: document.getElementById(\"secondaryOpenFile\"),\n printButton: document.getElementById(\"secondaryPrint\"),\n downloadButton: document.getElementById(\"secondaryDownload\"),\n viewBookmarkButton: document.getElementById(\"secondaryViewBookmark\"),\n firstPageButton: document.getElementById(\"firstPage\"),\n lastPageButton: document.getElementById(\"lastPage\"),\n pageRotateCwButton: document.getElementById(\"pageRotateCw\"),\n pageRotateCcwButton: document.getElementById(\"pageRotateCcw\"),\n cursorSelectToolButton: document.getElementById(\"cursorSelectTool\"),\n cursorHandToolButton: document.getElementById(\"cursorHandTool\"),\n scrollVerticalButton: document.getElementById(\"scrollVertical\"),\n scrollHorizontalButton: document.getElementById(\"scrollHorizontal\"),\n scrollWrappedButton: document.getElementById(\"scrollWrapped\"),\n spreadNoneButton: document.getElementById(\"spreadNone\"),\n spreadOddButton: document.getElementById(\"spreadOdd\"),\n spreadEvenButton: document.getElementById(\"spreadEven\"),\n documentPropertiesButton: document.getElementById(\"documentProperties\"),\n },\n sidebar: {\n // Divs (and sidebar button)\n outerContainer: document.getElementById(\"outerContainer\"),\n viewerContainer: document.getElementById(\"viewerContainer\"),\n toggleButton: document.getElementById(\"sidebarToggle\"),\n // Buttons\n thumbnailButton: document.getElementById(\"viewThumbnail\"),\n outlineButton: document.getElementById(\"viewOutline\"),\n attachmentsButton: document.getElementById(\"viewAttachments\"),\n layersButton: document.getElementById(\"viewLayers\"),\n // Views\n thumbnailView: document.getElementById(\"thumbnailView\"),\n outlineView: document.getElementById(\"outlineView\"),\n attachmentsView: document.getElementById(\"attachmentsView\"),\n layersView: document.getElementById(\"layersView\"),\n // View-specific options\n outlineOptionsContainer: document.getElementById(\n \"outlineOptionsContainer\"\n ),\n currentOutlineItemButton: document.getElementById(\"currentOutlineItem\"),\n },\n sidebarResizer: {\n outerContainer: document.getElementById(\"outerContainer\"),\n resizer: document.getElementById(\"sidebarResizer\"),\n },\n findBar: {\n bar: document.getElementById(\"findbar\"),\n toggleButton: document.getElementById(\"viewFind\"),\n findField: document.getElementById(\"findInput\"),\n highlightAllCheckbox: document.getElementById(\"findHighlightAll\"),\n caseSensitiveCheckbox: document.getElementById(\"findMatchCase\"),\n entireWordCheckbox: document.getElementById(\"findEntireWord\"),\n findMsg: document.getElementById(\"findMsg\"),\n findResultsCount: document.getElementById(\"findResultsCount\"),\n findPreviousButton: document.getElementById(\"findPrevious\"),\n findNextButton: document.getElementById(\"findNext\"),\n },\n passwordOverlay: {\n overlayName: \"passwordOverlay\",\n container: document.getElementById(\"passwordOverlay\"),\n label: document.getElementById(\"passwordText\"),\n input: document.getElementById(\"password\"),\n submitButton: document.getElementById(\"passwordSubmit\"),\n cancelButton: document.getElementById(\"passwordCancel\"),\n },\n documentProperties: {\n overlayName: \"documentPropertiesOverlay\",\n container: document.getElementById(\"documentPropertiesOverlay\"),\n closeButton: document.getElementById(\"documentPropertiesClose\"),\n fields: {\n fileName: document.getElementById(\"fileNameField\"),\n fileSize: document.getElementById(\"fileSizeField\"),\n title: document.getElementById(\"titleField\"),\n author: document.getElementById(\"authorField\"),\n subject: document.getElementById(\"subjectField\"),\n keywords: document.getElementById(\"keywordsField\"),\n creationDate: document.getElementById(\"creationDateField\"),\n modificationDate: document.getElementById(\"modificationDateField\"),\n creator: document.getElementById(\"creatorField\"),\n producer: document.getElementById(\"producerField\"),\n version: document.getElementById(\"versionField\"),\n pageCount: document.getElementById(\"pageCountField\"),\n pageSize: document.getElementById(\"pageSizeField\"),\n linearized: document.getElementById(\"linearizedField\"),\n },\n },\n errorWrapper,\n printContainer: document.getElementById(\"printContainer\"),\n openFileInputName: \"fileInput\",\n debuggerScriptPath: \"./debugger.js\",\n };\n}\n\nfunction webViewerLoad() {\n const config = getViewerConfiguration();\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n Promise.all([\n import(\"pdfjs-web/genericcom.js\"),\n import(\"pdfjs-web/pdf_print_service.js\"),\n ]).then(function ([genericCom, pdfPrintService]) {\n PDFViewerApplication.run(config);\n });\n } else {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n AppOptions.set(\"defaultUrl\", defaultUrl);\n }\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\")) {\n // Give custom implementations of the default viewer a simpler way to\n // set various `AppOptions`, by dispatching an event once all viewer\n // files are loaded but *before* the viewer initialization has run.\n const event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(\"webviewerloaded\", true, true, {\n source: window,\n });\n try {\n // Attempt to dispatch the event at the embedding `document`,\n // in order to support cases where the viewer is embedded in\n // a *dynamically* created <iframe> element.\n parent.document.dispatchEvent(event);\n } catch (ex) {\n // The viewer could be in e.g. a cross-origin <iframe> element,\n // fallback to dispatching the event at the current `document`.\n console.error(`webviewerloaded: ${ex}`);\n document.dispatchEvent(event);\n }\n }\n\n PDFViewerApplication.run(config);\n }\n}\n\n// Block the \"load\" event until all pages are loaded, to ensure that printing\n// works in Firefox; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553\nif (document.blockUnblockOnload) {\n document.blockUnblockOnload(true);\n}\n\nif (\n document.readyState === \"interactive\" ||\n document.readyState === \"complete\"\n) {\n webViewerLoad();\n} else {\n document.addEventListener(\"DOMContentLoaded\", webViewerLoad, true);\n}\n\nexport { PDFViewerApplication, AppOptions as PDFViewerApplicationOptions };\n"],"sourceRoot":""} |