1{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///web/viewer.js","webpack:///web/app.js","webpack:///node_modules/@babel/runtime/regenerator/index.js","webpack:///node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js","webpack:///node_modules/webpack/buildin/module.js","webpack:///web/ui_utils.js","webpack:///web/app_options.js","webpack:///web/pdfjs.js","webpack:///web/viewer_compatibility.js","webpack:///web/pdf_cursor_tools.js","webpack:///web/grab_to_pan.js","webpack:///web/pdf_rendering_queue.js","webpack:///web/pdf_sidebar.js","webpack:///web/overlay_manager.js","webpack:///web/password_prompt.js","webpack:///web/pdf_attachment_viewer.js","webpack:///web/pdf_document_properties.js","webpack:///web/pdf_find_bar.js","webpack:///web/pdf_find_controller.js","webpack:///web/pdf_find_utils.js","webpack:///web/pdf_history.js","webpack:///web/pdf_link_service.js","webpack:///web/pdf_outline_viewer.js","webpack:///web/pdf_presentation_mode.js","webpack:///web/pdf_sidebar_resizer.js","webpack:///web/pdf_thumbnail_viewer.js","webpack:///web/pdf_thumbnail_view.js","webpack:///web/pdf_viewer.js","webpack:///web/base_viewer.js","webpack:///web/annotation_layer_builder.js","webpack:///web/pdf_page_view.js","webpack:///web/text_layer_builder.js","webpack:///web/secondary_toolbar.js","webpack:///web/pdf_single_page_viewer.js","webpack:///web/toolbar.js","webpack:///web/view_history.js","webpack:///web/genericcom.js","webpack:///web/preferences.js","webpack:///web/download_manager.js","webpack:///web/genericl10n.js","webpack:///external/webL10n/l10n.js","webpack:///web/pdf_print_service.js"],"names":["pdfjsWebApp","require","pdfjsWebAppOptions","appContainer","document","mainContainer","viewerContainer","eventBus","toolbar","container","numPages","pageNumber","scaleSelectContainer","scaleSelect","customScaleOption","previous","next","zoomIn","zoomOut","viewFind","openFile","print","presentationModeButton","download","viewBookmark","secondaryToolbar","toggleButton","toolbarButtonContainer","openFileButton","printButton","downloadButton","viewBookmarkButton","firstPageButton","lastPageButton","pageRotateCwButton","pageRotateCcwButton","cursorSelectToolButton","cursorHandToolButton","scrollVerticalButton","scrollHorizontalButton","scrollWrappedButton","spreadNoneButton","spreadOddButton","spreadEvenButton","documentPropertiesButton","fullscreen","contextFirstPage","contextLastPage","contextPageRotateCw","contextPageRotateCcw","sidebar","outerContainer","thumbnailButton","outlineButton","attachmentsButton","thumbnailView","outlineView","attachmentsView","sidebarResizer","resizer","findBar","bar","findField","highlightAllCheckbox","caseSensitiveCheckbox","entireWordCheckbox","findMsg","findResultsCount","findPreviousButton","findNextButton","passwordOverlay","overlayName","label","input","submitButton","cancelButton","documentProperties","closeButton","fields","errorWrapper","errorMessage","errorMoreInfo","moreInfoButton","lessInfoButton","printContainer","openFileInputName","debuggerScriptPath","config","getViewerConfiguration","window","event","webViewerLoad","DEFAULT_SCALE_DELTA","DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT","FORCE_PAGES_LOADED_TIMEOUT","WHEEL_ZOOM_DISABLED_TIMEOUT","ViewOnLoad","UNKNOWN","PREVIOUS","INITIAL","DefaultExternalServices","updateFindControlState","updateFindMatchesCount","initPassiveLoading","fallback","reportTelemetry","createDownloadManager","createPreferences","createL10n","supportsIntegratedFind","supportsDocumentFonts","supportsDocumentColors","supportedMouseWheelZoomModifierKeys","ctrlKey","metaKey","PDFViewerApplication","initialBookmark","initialized","fellback","appConfig","pdfDocument","pdfLoadingTask","printService","pdfViewer","pdfThumbnailViewer","pdfRenderingQueue","pdfPresentationMode","pdfDocumentProperties","pdfLinkService","pdfHistory","pdfSidebar","pdfSidebarResizer","pdfOutlineViewer","pdfAttachmentViewer","pdfCursorTools","store","downloadManager","overlayManager","preferences","l10n","isInitialViewSet","downloadComplete","isViewerEmbedded","url","baseUrl","externalServices","_boundEvents","contentDispositionFilename","AppOptions","LinkTarget","source","prefs","console","reason","waitOn","hash","hashParams","parseQueryString","loadFakeWorker","TextLayerMode","viewer","enabled","loadAndEnablePDFBug","locale","dir","getGlobalEventBus","externalLinkTarget","externalLinkRel","disableCreateObjectURL","findController","linkService","renderingQueue","renderer","enableWebGL","textLayerMode","imageResourcesPath","renderInteractiveForms","enablePrintAutoRotate","useOnlyCssZoom","maxCanvasPixels","cursorToolOnLoad","contextMenuItems","elements","run","newScale","Math","zoomReset","ignoreDuplicate","PDFPrintServiceFactory","doc","support","shadow","setTitleUsingUrl","title","getPDFFileNameFromURL","decodeURIComponent","getFilenameFromUrl","setTitle","promise","PDFBug","workerParameters","OptionKind","GlobalWorkerOptions","parameters","Object","file","apiParameters","prop","args","loadingTask","getDocument","loaded","exception","message","loadingErrorMessage","msg","filename","err","downloadByUrl","blob","type","error","moreInfoText","version","build","moreInfo","stack","line","errorWrapperConfig","Promise","parts","progress","percent","level","isNaN","disableAutoFetch","clearTimeout","load","firstPagePromise","pageLayoutPromise","pageModePromise","openActionDestPromise","baseDocumentUrl","pagesPromise","onePageRendered","pdfPage","storePromise","page","zoom","scrollLeft","scrollTop","rotation","sidebarView","SidebarView","scrollMode","ScrollMode","spreadMode","SpreadMode","values","viewOnLoad","fingerprint","initialDest","parseInt","pageMode","apiPageModeToSidebarView","pageLayout","apiPageLayoutToSpreadMode","resolve","setTimeout","labels","i","numLabels","javaScript","js","UNSUPPORTED_FEATURES","regex","ii","outline","attachments","info","metadata","pdfTitle","_initializePdfHistory","resetHistory","updateUrl","JSON","explicitDest","setInitialView","setRotation","angle","isValidRotation","setViewerModes","isValidScrollMode","isValidSpreadMode","cleanup","RendererType","forceRendering","beforePrint","printMessage","notReadyMessage","pagesOverview","afterPrint","rotatePages","newRotation","requestPresentationMode","bindEvents","bindWindowEvents","passive","unbindEvents","unbindWindowEvents","HOSTED_VIEWER_ORIGINS","validateFileURL","viewerOrigin","origin","protocol","ex","loadScript","PDFWorker","OPS","createObjectURL","queryString","params","fileInput","files","evt","webViewerOpenFileViaURL","xhr","pageIndex","pageView","Stats","mode","view","action","switchInProgress","PresentationModeState","active","location","href","currentPage","loading","RenderingStates","currentScaleValue","webViewerFileInputChange","URL","originalUrl","fileReader","buffer","query","phraseSearch","caseSensitive","entireWord","highlightAll","findPrevious","result","matchesCount","setZoomDisabledTimeout","zoomDisabledTimeout","previousScale","delta","normalizeWheelEventDelta","MOUSE_WHEEL_DELTA_PER_PAGE_SCALE","ticks","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","protoGenerator","outerFn","generator","context","tryLocsList","makeInvokeMethod","exports","arg","fn","GenStateSuspendedStart","GenStateSuspendedYield","GenStateExecuting","GenStateCompleted","ContinueSentinel","IteratorPrototype","getProto","NativeIteratorPrototype","Gp","GeneratorFunctionPrototype","Generator","GeneratorFunction","prototype","ctor","genFun","__await","record","tryCatch","reject","value","invoke","previousPromise","callInvokeWithMethodAndArg","defineIteratorMethods","AsyncIterator","iter","wrap","state","method","doneResult","delegate","delegateResult","maybeInvokeDelegate","done","entry","tryLoc","locs","keys","key","iteratorMethod","iterable","Context","constructor","reset","name","stop","rootEntry","rootRecord","dispatchException","handle","hasCatch","hasFinally","abrupt","finallyEntry","complete","finish","resetTryEntry","thrown","delegateYield","iterator","resultName","nextLoc","regeneratorRuntime","Function","enumerable","get","CSS_UNITS","DEFAULT_SCALE_VALUE","DEFAULT_SCALE","MIN_SCALE","MAX_SCALE","UNKNOWN_SCALE","MAX_AUTO_SCALE","SCROLLBAR_PADDING","VERTICAL_PADDING","NORMAL","CHANGING","FULLSCREEN","CANVAS","SVG","DISABLE","ENABLE","ENABLE_ENHANCE","VERTICAL","HORIZONTAL","WRAPPED","NONE","ODD","EVEN","NullL10n","formatL10nValue","devicePixelRatio","backingStoreRatio","ctx","pixelRatio","sx","sy","scaled","skipOverflowHiddenElements","parent","element","offsetY","offsetX","getComputedStyle","spot","debounceScroll","rAF","currentX","viewAreaElement","lastX","currentY","lastY","callback","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","top","scrollEl","bottom","left","elementBottom","elementRight","visible","numViews","firstVisibleElementInd","binarySearchFirstItem","backtrackBeforeAllVisibleElements","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","hiddenHeight","hiddenWidth","id","y","first","last","pc","defaultFilename","isDataSchema","reURI","reFilename","splitURI","suggestedFilename","MOUSE_DOM_DELTA_PIXEL_MODE","MOUSE_DOM_DELTA_LINE_MODE","MOUSE_PIXELS_PER_LINE","MOUSE_LINES_PER_PAGE","Number","size","WaitOnType","EVENT","TIMEOUT","delay","target","eventHandler","handler","timeoutHandler","timeout","animationStarted","dispatchToDOM","on","eventListeners","off","dispatch","Array","listener","_dispatchDOMEvent","details","obj","globalEventBus","units","progressSize","setWidth","scrollbarWidth","clamp","moved","len","arr","write","read","VIEWER","API","WORKER","PREFERENCE","defaultOptions","kind","defaultUrl","defaultZoomValue","disableHistory","disablePageLabels","eventBusDispatchToDOM","historyUpdateUrl","compatibility","viewerCompatibilityParams","pdfBugEnabled","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","cMapPacked","cMapUrl","apiCompatibilityParams","disableFontFace","disableRange","disableStream","isEvalSupported","maxImageSize","pdfBug","postMessageTransfers","verbosity","workerPort","workerSrc","navigator","userOptions","userOption","defaultOption","options","valueType","pdfjsLib","__non_webpack_require__","compatibilityParams","userAgent","isAndroid","isIOS","SELECT","HAND","ZOOM","switchTool","tool","disableActiveTool","previouslyActive","overlay","GrabToPan","CSS_CLASS_GRAB","activate","deactivate","toggle","ignoreTarget","node","_onmousedown","focusedElement","_onmousemove","isLeftMouseReleased","xDiff","yDiff","behavior","_endPan","prefix","matchesSelector","isNotIEorIsIE10plus","chrome","isChrome15OrOpera15plus","isSafari6plus","CLEANUP_TIMEOUT","RUNNING","PAUSED","FINISHED","setViewer","setThumbnailViewer","isHighestPriority","renderHighestPriority","getHighestPriority","visibleViews","numVisible","nextPageIndex","previousPageIndex","isViewFinished","renderView","UI_NOTIFICATION_CLASS","THUMBS","OUTLINE","ATTACHMENTS","LAYERS","disableNotification","switchView","forceOpen","_switchView","isViewChanged","shouldForceRendering","pagesCount","_showUINotification","_hideUINotification","removeNotification","outlineCount","callerCloseMethod","canForceClose","_keyDown","e","PasswordResponses","promptString","password","setUpdateCallback","keepRenderedCapability","_dispatchEvent","attachmentsCount","_bindPdfLink","button","blobUrl","viewerUrl","encodeURIComponent","_bindLink","render","names","item","removeNullCharacters","div","_appendAttachment","content","DEFAULT_FIELD_CONTENT","NON_METRIC_LOCALES","US_PAGE_NAMES","METRIC_PAGE_NAMES","isPortrait","pageNames","freezeFieldData","data","writable","configurable","currentPageNumber","pagesRotation","getPageSizeInches","fileSize","setDocument","setFileSize","_updateUI","kb","size_kb","size_b","size_mb","pageSizeInches","isPortraitOrientation","sizeInches","sizeMillimeters","pageName","getPageName","exactMillimeters","intMillimeters","unit","orientation","dateObject","PDFDateString","date","time","_parseLinearization","isLinearized","MATCHES_COUNT_LIMIT","dispatchEvent","updateUIState","notFound","status","FindState","updateResultsCount","current","total","matchesCountMsg","findbarHeight","inputContainerHeight","FOUND","NOT_FOUND","PENDING","FIND_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","MATCH_SCROLL_OFFSET_LEFT","CHARACTERS_TO_NORMALIZE","normalizationRegex","replace","executeCommand","findbarClosed","pendingTimeout","matchIndex","scrollMatchIntoView","scrollIntoView","pageIdx","matchIdx","wrapped","_shouldDirtyMatch","_prepareMatches","currentElem","matchesWithLength","nextElem","prevElem","isSubTerm","matches","matchesLength","_isEntireWord","startIdx","getCharacterType","endIdx","_calculatePhraseMatch","queryLen","pageContent","_calculateWordMatch","queryArray","subquery","subqueryLen","match","matchLength","skipped","_calculateMatch","pageMatchesCount","extractTextCapability","normalizeWhitespace","textContent","textItems","strBuf","j","jj","normalize","_updatePage","currentPageIndex","offset","numPageMatches","_matchesReady","numMatches","_advanceOffsetPage","found","_updateMatch","previousPage","_onFindBarClose","_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","unescape","getCurrentHash","initialize","reInitialized","parseCurrentHash","destination","namedDest","push","forceReplace","isDestArraysEqual","dest","_pushOrReplaceState","shouldReplace","newState","uid","newUrl","temporary","_tryPushCurrentPosition","position","_isValidState","checkReload","performance","perfEntry","_updateInternalState","removeTemporary","_updateViewarea","_popState","newHash","hashChanged","waitOnEventOrTimeout","destHash","nameddest","second","isEntryEqual","firstDest","secondDest","setHistory","navigateTo","goToDestination","destRef","destArray","getDestinationHash","escape","str","getAnchorUrl","setHash","zoomArgs","zoomArg","zoomArgNumber","parseFloat","allowNegativeOffset","isValidExplicitDestination","executeNamedAction","cachePageRef","refStr","pageRef","_cachedPageNumber","isPageVisible","destLength","allowNull","DEFAULT_TITLE","addLinkAttributes","newWindow","rel","_setStyles","styleStr","_addToggleButton","toggler","count","shouldShowAll","_toggleOutlineItem","show","root","fragment","queue","hasAnyNesting","levelData","itemsDiv","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","Element","_mouseWheel","currentTime","storedTime","totalDelta","success","_mouseDown","isInternalLink","_touchSwipe","startX","startY","endX","endY","absAngle","SIDEBAR_WIDTH_VAR","SIDEBAR_MIN_WIDTH","SIDEBAR_RESIZING_CLASS","CSS","_updateWidth","maxWidth","_mouseMove","_mouseUp","updated","THUMBNAIL_SCROLL_MARGIN","THUMBNAIL_SELECTED_CLASS","watchScroll","getThumbnail","getVisibleElements","scrollThumbnailIntoView","prevThumbnailView","visibleThumbs","numVisibleThumbs","shouldScroll","PDFThumbnailView","firstPage","viewport","scale","pageNum","thumbnail","defaultViewport","disableCanvasToImageConversion","setPageLabels","_ensurePdfPageLoaded","thumbView","MAX_NUM_SCALING_STEPS","THUMBNAIL_CANVAS_BORDER_WIDTH","THUMBNAIL_WIDTH","TempImageFactory","tempCanvasCache","getCanvas","tempCanvas","alpha","destroyCanvas","anchor","ring","borderAdjustment","setPdfPage","totalRotation","childNodes","update","noCtxScale","_getPageDrawContext","canvas","outputScale","getOutputScale","className","image","renderCapability","finishRenderTask","renderTask","drawViewport","renderContinueCallback","cont","renderContext","canvasContext","setImage","img","reducedWidth","reducedHeight","reducedImage","reducedImageCtx","setPageLabel","ariaLabel","pageSpot","_scrollIntoView","pageDiv","_updateHelper","currentId","stillFullyVisible","visiblePages","DEFAULT_CACHE_SIZE","pageIdsToKeep","iMax","pagesToKeep","moveToEndOfArray","getPageView","_setCurrentPageNumber","resetCurrentPageView","val","pageLabel","pagesCapability","onePageRenderedCapability","bindOnAfterAndBeforeDraw","textLayerFactory","annotationLayerFactory","getPagesLeft","_setScaleUpdatePages","noScroll","preset","newValue","isSameScale","presetValue","_setScale","noPadding","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","scrollPageIntoView","pageWidth","pageHeight","widthScale","heightScale","boundingRect","_updateLocation","normalizedScaleValue","pdfOpenParams","currentPageView","topLeft","intLeft","intTop","numVisiblePages","newCacheSize","containsElement","currentlyVisiblePages","scrollAhead","createTextLayerBuilder","enhanceTextSelection","textLayerDiv","createAnnotationLayerBuilder","isFirstPagePortrait","_updateScrollMode","_updateSpreadMode","pages","parity","spread","firstPageView","intent","annotations","dontFlip","AnnotationLayer","MAX_CANVAS_PIXELS","removeFromDOM","_resetZoomLayer","zoomLayerCanvas","keepZoomLayer","keepAnnotations","currentZoomLayerNode","currentAnnotationNode","cssTransform","isScalingRestricted","cancelRendering","redrawAnnotations","relativeRotation","absRotation","scaleX","scaleY","textLayerViewport","textRelativeRotation","textAbsRotation","transX","transY","getPagePoint","canvasWrapper","textLayer","finishPaintTask","paintTask","resultPromise","readableStream","paintOnCanvas","onRenderContinue","cancel","isCanvasHidden","showCanvas","actualSizeViewport","pixelsInViewport","maxScale","sfx","approximateFraction","sfy","roundToDivide","transform","paintOnSvg","cancelled","ensureNotCancelled","opList","svgGfx","svg","wrapper","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","i0","i1","isSelected","highlightSuffix","beginText","n0","n1","clearedUntilDivIdx","n","pageMatches","pageMatchesLength","expandDivsTimer","adjustTop","divBounds","eventName","close","eventDetails","lastPage","pageRotateCw","pageRotateCcw","setPageNumber","setPagesCount","_bindCursorToolsListener","buttons","_bindScrollModeListener","isScrollModeHorizontal","scrollModeChanged","_bindSpreadModeListener","spreadModeChanged","previousPageView","viewerNodes","scrolledDown","PAGE_NUMBER_LOADING_INDICATOR","SCALE_SELECT_CONTAINER_PADDING","SCALE_SELECT_PADDING","setPageScale","self","resetNumPages","pageScale","customScale","predefinedValueFound","option","updateLoadingIndicatorState","pageNumberInput","select","DEFAULT_VIEW_HISTORY_CACHE_SIZE","cacheSize","databaseStr","database","length","branch","localStorage","properties","GenericCom","GenericExternalServices","defaultPreferences","defaults","defaultValue","prefValue","defaultType","DISABLE_CREATE_OBJECT_URL","downloadUrl","createValidAbsoluteUrl","downloadData","webL10n","gL10nData","gTextData","gTextProp","gLanguage","gMacros","gReadyState","gAsyncResourceLoading","script","l10nId","l10nArgs","evtObject","onSuccess","onFailure","baseURL","text","dictionary","reBlank","reComment","reSection","reImport","reSplit","entries","rawText","currentLang","genericLang","lang","skipLang","parsedRawLinesCallback","loadImport","tmp","evalString","nextEntry","xhrLoadText","parseRawLines","parsedPropertiesCallback","parseProperties","successCallback","clear","langLinks","getL10nResourceLinks","langCount","dict","getL10nDictionary","defaultLocale","anyCaseLang","fireL10nReadyEvent","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","getData","getText","getLanguage","setLanguage","loadLocale","getDirection","rtlList","shortCode","translate","getReadyState","ready","activeService","scratchCanvas","PRINT_RESOLUTION","PRINT_UNITS","PDFPrintService","layout","body","hasEqualPageSizes","pageSize","destroy","ensureOverlay","renderPages","pageCount","renderNextPage","renderProgress","renderPage","useRenderedPage","printItem","performPrint","throwIfInactive","activeServiceOnEntry","abort","progressContainer","progressBar","progressPerc","hasAttachEvent","stopPropagationIfNeeded","overlayPromise"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAEr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;;AA6TA,IA7TA,cA6TA;;AACA,yBAAyB;AACvB,MAAI,CAAJ,gBAAqB;AACnBgD,qBAAiBtB,0BADE,cACnBsB;;AACA,QAAI,CAAJ,gBAAqB;AACnB,YAAM,UADa,mDACb,CAAN;AAHiB;;AAMnBqsC,qBAAiBrsC,+CACfrI,wBADeqI,qBACfrI,CADeqI,SANE,IAMFA,CAAjBqsC;AAEA10C,qDARmB,KAQnBA;AATqB;;AAWvB,SAXuB,cAWvB;AAzUF;;AA4UAwL,uCAAkC;AAChC8L,oBADgC;AAGhCC,oBAHgC,8BAGhCA,WAHgC,EAGhCA,aAHgC,EAGhCA,cAHgC,EAGhCA,IAHgC,EAGqC;AACnE,uBAAmB;AACjB,YAAM,UADW,0CACX,CAAN;AAFiE;;AAInEw7B,oBAAgB,gEAJmD,IAInD,CAAhBA;AAEA,WANmE,aAMnE;AAT8B;AAAA,CAAlCvnC,C","file":"viewer.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\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 chrome */\n\n'use strict';\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    let queryString = document.location.search.slice(1);\n    let m = /(^|&)file=([^&]*)/.exec(queryString);\n    defaultUrl = m ? decodeURIComponent(m[2]) : '';\n\n    // Example: chrome-extension://.../http://example.com/file.pdf\n    let humanReadableUrl = '/' + defaultUrl + location.hash;\n    history.replaceState(history.state, '', humanReadableUrl);\n    if (top === window) {\n      chrome.runtime.sendMessage('showPageAction');\n    }\n  })();\n}\n\nlet pdfjsWebApp, pdfjsWebAppOptions;\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) {\n  pdfjsWebApp = require('./app.js');\n  pdfjsWebAppOptions = require('./app_options.js');\n}\n\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || 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  return {\n    appContainer: document.body,\n    mainContainer: document.getElementById('viewerContainer'),\n    viewerContainer: document.getElementById('viewer'),\n    eventBus: null, // Using global event bus with (optional) DOM events.\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:\n        document.getElementById('secondaryToolbarButtonContainer'),\n      presentationModeButton:\n        document.getElementById('secondaryPresentationMode'),\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    fullscreen: {\n      contextFirstPage: document.getElementById('contextFirstPage'),\n      contextLastPage: document.getElementById('contextLastPage'),\n      contextPageRotateCw: document.getElementById('contextPageRotateCw'),\n      contextPageRotateCcw: document.getElementById('contextPageRotateCcw'),\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      // Views\n      thumbnailView: document.getElementById('thumbnailView'),\n      outlineView: document.getElementById('outlineView'),\n      attachmentsView: document.getElementById('attachmentsView'),\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      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    printContainer: document.getElementById('printContainer'),\n    openFileInputName: 'fileInput',\n    debuggerScriptPath: './debugger.js',\n  };\n}\n\nfunction webViewerLoad() {\n  let config = getViewerConfiguration();\n  if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {\n    Promise.all([\n      SystemJS.import('pdfjs-web/app'),\n      SystemJS.import('pdfjs-web/app_options'),\n      SystemJS.import('pdfjs-web/genericcom'),\n      SystemJS.import('pdfjs-web/pdf_print_service'),\n    ]).then(function([app, appOptions, ...otherModules]) {\n      window.PDFViewerApplication = app.PDFViewerApplication;\n      window.PDFViewerApplicationOptions = appOptions.AppOptions;\n      app.PDFViewerApplication.run(config);\n    });\n  } else {\n    if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {\n      pdfjsWebAppOptions.AppOptions.set('defaultUrl', defaultUrl);\n    }\n\n    window.PDFViewerApplication = pdfjsWebApp.PDFViewerApplication;\n    window.PDFViewerApplicationOptions = pdfjsWebAppOptions.AppOptions;\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      document.dispatchEvent(event);\n    }\n\n    pdfjsWebApp.PDFViewerApplication.run(config);\n  }\n}\n\nif (document.readyState === 'interactive' ||\n    document.readyState === 'complete') {\n  webViewerLoad();\n} else {\n  document.addEventListener('DOMContentLoaded', webViewerLoad, true);\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/* globals PDFBug, Stats */\n\nimport {\n  animationStarted, DEFAULT_SCALE_VALUE, getGlobalEventBus,\n  getPDFFileNameFromURL, isValidRotation, isValidScrollMode, isValidSpreadMode,\n  MAX_SCALE, MIN_SCALE, noContextMenuHandler, normalizeWheelEventDelta,\n  parseQueryString, PresentationModeState, ProgressBar, RendererType,\n  ScrollMode, SpreadMode, TextLayerMode\n} from './ui_utils';\nimport { AppOptions, OptionKind } from './app_options';\nimport {\n  build, createObjectURL, getDocument, getFilenameFromUrl, GlobalWorkerOptions,\n  InvalidPDFException, LinkTarget, loadScript, MissingPDFException, OPS,\n  PDFWorker, shadow, UnexpectedResponseException, UNSUPPORTED_FEATURES, URL,\n  version\n} from 'pdfjs-lib';\nimport { CursorTool, PDFCursorTools } from './pdf_cursor_tools';\nimport { PDFRenderingQueue, RenderingStates } from './pdf_rendering_queue';\nimport { PDFSidebar, SidebarView } from './pdf_sidebar';\nimport { OverlayManager } from './overlay_manager';\nimport { PasswordPrompt } from './password_prompt';\nimport { PDFAttachmentViewer } from './pdf_attachment_viewer';\nimport { PDFDocumentProperties } from './pdf_document_properties';\nimport { PDFFindBar } from './pdf_find_bar';\nimport { PDFFindController } from './pdf_find_controller';\nimport { PDFHistory } from './pdf_history';\nimport { PDFLinkService } from './pdf_link_service';\nimport { PDFOutlineViewer } from './pdf_outline_viewer';\nimport { PDFPresentationMode } from './pdf_presentation_mode';\nimport { PDFSidebarResizer } from './pdf_sidebar_resizer';\nimport { PDFThumbnailViewer } from './pdf_thumbnail_viewer';\nimport { PDFViewer } from './pdf_viewer';\nimport { SecondaryToolbar } from './secondary_toolbar';\nimport { Toolbar } from './toolbar';\nimport { ViewHistory } from './view_history';\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\n\nconst ViewOnLoad = {\n  UNKNOWN: -1,\n  PREVIOUS: 0, // Default value.\n  INITIAL: 1,\n};\n\nconst DefaultExternalServices = {\n  updateFindControlState(data) {},\n  updateFindMatchesCount(data) {},\n  initPassiveLoading(callbacks) {},\n  fallback(data, callback) {},\n  reportTelemetry(data) {},\n  createDownloadManager(options) {\n    throw new Error('Not implemented: createDownloadManager');\n  },\n  createPreferences() {\n    throw new Error('Not implemented: createPreferences');\n  },\n  createL10n(options) {\n    throw new Error('Not implemented: createL10n');\n  },\n  supportsIntegratedFind: false,\n  supportsDocumentFonts: true,\n  supportsDocumentColors: true,\n  supportedMouseWheelZoomModifierKeys: {\n    ctrlKey: true,\n    metaKey: true,\n  },\n};\n\nlet PDFViewerApplication = {\n  initialBookmark: document.location.hash.substring(1),\n  initialized: false,\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 {PDFCursorTools} */\n  pdfCursorTools: 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: {},\n  contentDispositionFilename: null,\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    await this._initializeL10n();\n\n    if (this.isViewerEmbedded &&\n        AppOptions.get('externalLinkTarget') === LinkTarget.NONE) {\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    let 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.initialized = true;\n  },\n\n  /**\n   * @private\n   */\n  async _readPreferences() {\n    if (AppOptions.get('disablePreferences') === true) {\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      const prefs = await this.preferences.getAll();\n      for (const name in prefs) {\n        AppOptions.set(name, prefs[name]);\n      }\n    } catch (reason) {\n      console.error(`_readPreferences: \"${reason.message}\".`);\n    }\n  },\n\n  /**\n   * @private\n   */\n  async _parseHashParameters() {\n    if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION') &&\n        !AppOptions.get('pdfBugEnabled')) {\n      return undefined;\n    }\n    const waitOn = [];\n\n    // Special debugging flags in the hash section of the URL.\n    let hash = document.location.hash.substring(1);\n    let hashParams = parseQueryString(hash);\n\n    if ('disableworker' in hashParams &&\n        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('disableAutoFetch',\n                     hashParams['disableautofetch'] === 'true');\n    }\n    if ('disablefontface' in hashParams) {\n      AppOptions.set('disableFontFace',\n                     hashParams['disablefontface'] === 'true');\n    }\n    if ('disablehistory' in hashParams) {\n      AppOptions.set('disableHistory', hashParams['disablehistory'] === 'true');\n    }\n    if ('webgl' in hashParams) {\n      AppOptions.set('enableWebGL', hashParams['webgl'] === 'true');\n    }\n    if ('useonlycsszoom' in hashParams) {\n      AppOptions.set('useOnlyCssZoom', hashParams['useonlycsszoom'] === 'true');\n    }\n    if ('verbosity' in hashParams) {\n      AppOptions.set('verbosity', hashParams['verbosity'] | 0);\n    }\n    if ((typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) &&\n        hashParams['disablebcmaps'] === 'true') {\n      AppOptions.set('cMapUrl', '../external/cmaps/');\n      AppOptions.set('cMapPacked', false);\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          let 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      let 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 ((typeof PDFJSDev === 'undefined' ||\n         PDFJSDev.test('!PRODUCTION || GENERIC')) && 'locale' in hashParams) {\n      AppOptions.set('locale', hashParams['locale']);\n    }\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      locale: AppOptions.get('locale'),\n    });\n    const dir = await this.l10n.getDirection();\n    document.getElementsByTagName('html')[0].dir = dir;\n  },\n\n  /**\n   * @private\n   */\n  async _initializeViewerComponents() {\n    const appConfig = this.appConfig;\n\n    this.overlayManager = new OverlayManager();\n\n    const eventBus = appConfig.eventBus ||\n                     getGlobalEventBus(AppOptions.get('eventBusDispatchToDOM'));\n    this.eventBus = eventBus;\n\n    let pdfRenderingQueue = new PDFRenderingQueue();\n    pdfRenderingQueue.onIdle = this.cleanup.bind(this);\n    this.pdfRenderingQueue = pdfRenderingQueue;\n\n    let pdfLinkService = new PDFLinkService({\n      eventBus,\n      externalLinkTarget: AppOptions.get('externalLinkTarget'),\n      externalLinkRel: AppOptions.get('externalLinkRel'),\n    });\n    this.pdfLinkService = pdfLinkService;\n\n    let downloadManager = this.externalServices.createDownloadManager({\n      disableCreateObjectURL: AppOptions.get('disableCreateObjectURL'),\n    });\n    this.downloadManager = downloadManager;\n\n    const findController = new PDFFindController({\n      linkService: pdfLinkService,\n      eventBus,\n    });\n    this.findController = findController;\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      renderer: AppOptions.get('renderer'),\n      enableWebGL: AppOptions.get('enableWebGL'),\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    });\n    pdfRenderingQueue.setViewer(this.pdfViewer);\n    pdfLinkService.setViewer(this.pdfViewer);\n\n    this.pdfThumbnailViewer = new PDFThumbnailViewer({\n      container: appConfig.sidebar.thumbnailView,\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    this.findBar = new PDFFindBar(appConfig.findBar, eventBus, this.l10n);\n\n    this.pdfDocumentProperties =\n      new PDFDocumentProperties(appConfig.documentProperties,\n                                this.overlayManager, eventBus, this.l10n);\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 =\n      new SecondaryToolbar(appConfig.secondaryToolbar, container, eventBus);\n\n    if (this.supportsFullscreen) {\n      this.pdfPresentationMode = new PDFPresentationMode({\n        container,\n        viewer,\n        pdfViewer: this.pdfViewer,\n        eventBus,\n        contextMenuItems: appConfig.fullscreen,\n      });\n    }\n\n    this.passwordPrompt = new PasswordPrompt(appConfig.passwordOverlay,\n                                             this.overlayManager, this.l10n);\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.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(appConfig.sidebarResizer,\n                                                   eventBus, this.l10n);\n  },\n\n  run(config) {\n    this.initialize(config).then(webViewerInitialized);\n  },\n\n  zoomIn(ticks) {\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    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(ignoreDuplicate = false) {\n    if (this.pdfViewer.isInPresentationMode) {\n      return;\n    } else if (ignoreDuplicate &&\n               this.pdfViewer.currentScaleValue === DEFAULT_SCALE_VALUE) {\n      // Avoid attempting to needlessly reset the zoom level *twice* in a row,\n      // when using the `Ctrl + 0` keyboard shortcut in `MOZCENTRAL` builds.\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  set page(val) {\n    this.pdfViewer.currentPageNumber = val;\n  },\n\n  get page() {\n    return this.pdfViewer.currentPageNumber;\n  },\n\n  get printing() {\n    return !!this.printService;\n  },\n\n  get supportsPrinting() {\n    return PDFPrintServiceFactory.instance.supportsPrinting;\n  },\n\n  get supportsFullscreen() {\n    let support;\n    if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('MOZCENTRAL')) {\n      support = document.fullscreenEnabled === true ||\n                document.mozFullScreenEnabled === true;\n    } else {\n      let doc = document.documentElement;\n      support = !!(doc.requestFullscreen || doc.mozRequestFullScreen ||\n                   doc.webkitRequestFullScreen || doc.msRequestFullscreen);\n\n      if (document.fullscreenEnabled === false ||\n          document.mozFullScreenEnabled === false ||\n          document.webkitFullscreenEnabled === false ||\n          document.msFullscreenEnabled === false) {\n        support = false;\n      }\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 supportsDocumentColors() {\n    return this.externalServices.supportsDocumentColors;\n  },\n\n  get loadingBar() {\n    let 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 (typeof PDFJSDev === 'undefined' ||\n        !PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {\n      throw new Error('Not implemented: initPassiveLoading');\n    }\n    this.externalServices.initPassiveLoading({\n      onOpenWithTransport(url, length, transport) {\n        PDFViewerApplication.open(url, { range: transport, });\n\n        if (length) {\n          PDFViewerApplication.pdfDocumentProperties.setFileSize(length);\n        }\n      },\n      onOpenWithData(data) {\n        PDFViewerApplication.open(data);\n      },\n      onOpenWithURL(url, length, originalUrl) {\n        let file = url, args = null;\n        if (length !== undefined) {\n          args = { length, };\n        }\n        if (originalUrl !== undefined) {\n          file = { url, originalUrl, };\n        }\n        PDFViewerApplication.open(file, args);\n      },\n      onError(err) {\n        PDFViewerApplication.l10n.get('loading_error', null,\n            'An error occurred while loading the PDF.').then((msg) => {\n          PDFViewerApplication.error(msg, err);\n        });\n      },\n      onProgress(loaded, total) {\n        PDFViewerApplication.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  /**\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    let errorWrapper = this.appConfig.errorWrapper.container;\n    errorWrapper.setAttribute('hidden', 'true');\n\n    if (!this.pdfLoadingTask) {\n      return undefined;\n    }\n\n    let promise = 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    this.store = null;\n    this.isInitialViewSet = false;\n    this.downloadComplete = false;\n    this.url = '';\n    this.baseUrl = '';\n    this.contentDispositionFilename = null;\n\n    this.pdfSidebar.reset();\n    this.pdfOutlineViewer.reset();\n    this.pdfAttachmentViewer.reset();\n\n    this.findBar.reset();\n    this.toolbar.reset();\n    this.secondaryToolbar.reset();\n\n    if (typeof PDFBug !== 'undefined') {\n      PDFBug.cleanup();\n    }\n    return promise;\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 - (optional) Additional arguments for the getDocument\n   *                        call, e.g. HTTP headers ('httpHeaders') or\n   *                        alternative 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 (let key in workerParameters) {\n      GlobalWorkerOptions[key] = workerParameters[key];\n    }\n\n    let parameters = Object.create(null);\n    if (typeof file === 'string') { // URL\n      this.setTitleUsingUrl(file);\n      parameters.url = file;\n    } else if (file && 'byteLength' in file) { // ArrayBuffer\n      parameters.data = file;\n    } else if (file.url && file.originalUrl) {\n      this.setTitleUsingUrl(file.originalUrl);\n      parameters.url = file.url;\n    }\n    if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {\n      parameters.docBaseUrl = document.URL.split('#')[0];\n    } else if (typeof PDFJSDev !== 'undefined' &&\n               PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {\n      parameters.docBaseUrl = this.baseUrl;\n    }\n    // Set the necessary API parameters, using the available options.\n    const apiParameters = AppOptions.getAll(OptionKind.API);\n    for (let key in apiParameters) {\n      parameters[key] = apiParameters[key];\n    }\n\n    if (args) {\n      for (let prop in args) {\n        if (prop === 'length') {\n          this.pdfDocumentProperties.setFileSize(args[prop]);\n        }\n        parameters[prop] = args[prop];\n      }\n    }\n\n    let loadingTask = getDocument(parameters);\n    this.pdfLoadingTask = loadingTask;\n\n    loadingTask.onPassword = (updateCallback, reason) => {\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((pdfDocument) => {\n      this.load(pdfDocument);\n    }, (exception) => {\n      if (loadingTask !== this.pdfLoadingTask) {\n        return undefined; // Ignore errors for previously opened PDF files.\n      }\n\n      let message = exception && exception.message;\n      let loadingErrorMessage;\n      if (exception instanceof InvalidPDFException) {\n        // change error message also for other builds\n        loadingErrorMessage = this.l10n.get('invalid_file_error', null,\n                                            'Invalid or corrupted PDF file.');\n      } else if (exception instanceof MissingPDFException) {\n        // special message for missing PDF's\n        loadingErrorMessage = this.l10n.get('missing_file_error', null,\n                                            'Missing PDF file.');\n      } else if (exception instanceof UnexpectedResponseException) {\n        loadingErrorMessage = this.l10n.get('unexpected_response_error', null,\n                                            'Unexpected server response.');\n      } else {\n        loadingErrorMessage = this.l10n.get('loading_error', null,\n          'An error occurred while loading the PDF.');\n      }\n\n      return loadingErrorMessage.then((msg) => {\n        this.error(msg, { message, });\n        throw new Error(msg);\n      });\n    });\n  },\n\n  download() {\n    function downloadByUrl() {\n      downloadManager.downloadUrl(url, filename);\n    }\n\n    let url = this.baseUrl;\n    // Use this.url instead of this.baseUrl to perform filename detection based\n    // on the reference fragment as ultimate fallback if needed.\n    let filename = this.contentDispositionFilename ||\n      getPDFFileNameFromURL(this.url);\n    let downloadManager = this.downloadManager;\n    downloadManager.onerror = (err) => {\n      // This error won't really be helpful because it's likely the\n      // fallback won't work either (or is already open).\n      this.error(`PDF failed to download: ${err}`);\n    };\n\n    // When the PDF document isn't ready, or the PDF file is still downloading,\n    // simply download using the URL.\n    if (!this.pdfDocument || !this.downloadComplete) {\n      downloadByUrl();\n      return;\n    }\n\n    this.pdfDocument.getData().then(function(data) {\n      const blob = new Blob([data], { type: 'application/pdf', });\n      downloadManager.download(blob, url, filename);\n    }).catch(downloadByUrl); // Error occurred, try downloading with the URL.\n  },\n\n  fallback(featureId) {\n    if (typeof PDFJSDev !== 'undefined' &&\n        PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\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      this.externalServices.fallback({\n        featureId,\n        url: this.baseUrl,\n      }, function response(download) {\n        if (!download) {\n          return;\n        }\n        PDFViewerApplication.download();\n      });\n    }\n  },\n\n  /**\n   * Show the error box.\n   * @param {String} message A message that is human readable.\n   * @param {Object} moreInfo (optional) Further information about the error\n   *                            that is more technical.  Should have a 'message'\n   *                            and optionally a 'stack' property.\n   */\n  error(message, moreInfo) {\n    let moreInfoText = [this.l10n.get('error_version_info',\n      { version: version || '?', build: build || '?', },\n      'PDF.js v{{version}} (build: {{build}})')];\n    if (moreInfo) {\n      moreInfoText.push(\n        this.l10n.get('error_message', { message: moreInfo.message, },\n                      'Message: {{message}}'));\n      if (moreInfo.stack) {\n        moreInfoText.push(\n          this.l10n.get('error_stack', { stack: moreInfo.stack, },\n                        'Stack: {{stack}}'));\n      } else {\n        if (moreInfo.filename) {\n          moreInfoText.push(\n            this.l10n.get('error_file', { file: moreInfo.filename, },\n                          'File: {{file}}'));\n        }\n        if (moreInfo.lineNumber) {\n          moreInfoText.push(\n            this.l10n.get('error_line', { line: moreInfo.lineNumber, },\n                          'Line: {{line}}'));\n        }\n      }\n    }\n\n    if (typeof PDFJSDev === 'undefined' ||\n        !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n      let errorWrapperConfig = this.appConfig.errorWrapper;\n      let errorWrapper = errorWrapperConfig.container;\n      errorWrapper.removeAttribute('hidden');\n\n      let errorMessage = errorWrapperConfig.errorMessage;\n      errorMessage.textContent = message;\n\n      let closeButton = errorWrapperConfig.closeButton;\n      closeButton.onclick = function() {\n        errorWrapper.setAttribute('hidden', 'true');\n      };\n\n      let errorMoreInfo = errorWrapperConfig.errorMoreInfo;\n      let moreInfoButton = errorWrapperConfig.moreInfoButton;\n      let lessInfoButton = errorWrapperConfig.lessInfoButton;\n      moreInfoButton.onclick = function() {\n        errorMoreInfo.removeAttribute('hidden');\n        moreInfoButton.setAttribute('hidden', 'true');\n        lessInfoButton.removeAttribute('hidden');\n        errorMoreInfo.style.height = errorMoreInfo.scrollHeight + 'px';\n      };\n      lessInfoButton.onclick = function() {\n        errorMoreInfo.setAttribute('hidden', 'true');\n        moreInfoButton.removeAttribute('hidden');\n        lessInfoButton.setAttribute('hidden', 'true');\n      };\n      moreInfoButton.oncontextmenu = noContextMenuHandler;\n      lessInfoButton.oncontextmenu = noContextMenuHandler;\n      closeButton.oncontextmenu = noContextMenuHandler;\n      moreInfoButton.removeAttribute('hidden');\n      lessInfoButton.setAttribute('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    let 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(() => {\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(\n      function() { /* Avoid breaking initial rendering; ignoring errors. */ });\n    const pageModePromise = pdfDocument.getPageMode().catch(\n      function() { /* Avoid breaking initial rendering; ignoring errors. */ });\n    const openActionDestPromise = pdfDocument.getOpenActionDestination().catch(\n      function() { /* Avoid breaking initial rendering; ignoring errors. */ });\n\n    this.toolbar.setPagesCount(pdfDocument.numPages, false);\n    this.secondaryToolbar.setPagesCount(pdfDocument.numPages);\n\n    const store = this.store = new ViewHistory(pdfDocument.fingerprint);\n\n    let baseDocumentUrl;\n    if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n      baseDocumentUrl = null;\n    } else if (PDFJSDev.test('FIREFOX || 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    let pdfViewer = this.pdfViewer;\n    pdfViewer.setDocument(pdfDocument);\n    let firstPagePromise = pdfViewer.firstPagePromise;\n    let pagesPromise = pdfViewer.pagesPromise;\n    let onePageRendered = pdfViewer.onePageRendered;\n\n    let pdfThumbnailViewer = this.pdfThumbnailViewer;\n    pdfThumbnailViewer.setDocument(pdfDocument);\n\n    firstPagePromise.then((pdfPage) => {\n      this.loadingBar.setWidth(this.appConfig.viewerContainer);\n\n      const storePromise = store.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      }).catch(() => { /* Unable to read from storage; ignoring errors. */ });\n\n      Promise.all([\n        storePromise, pageLayoutPromise, pageModePromise, openActionDestPromise,\n      ]).then(async ([values = {}, pageLayout, pageMode, openActionDest]) => {\n        const viewOnLoad = AppOptions.get('viewOnLoad');\n\n        this._initializePdfHistory({\n          fingerprint: pdfDocument.fingerprint,\n          viewOnLoad,\n          initialDest: openActionDest,\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 (values.page && viewOnLoad !== ViewOnLoad.INITIAL) {\n          hash = `page=${values.page}&zoom=${zoom || values.zoom},` +\n                 `${values.scrollLeft},${values.scrollTop}`;\n\n          rotation = parseInt(values.rotation, 10);\n          // Always let user preferences take precedence over the view history.\n          if (sidebarView === SidebarView.UNKNOWN) {\n            sidebarView = (values.sidebarView | 0);\n          }\n          if (scrollMode === ScrollMode.UNKNOWN) {\n            scrollMode = (values.scrollMode | 0);\n          }\n          if (spreadMode === SpreadMode.UNKNOWN) {\n            spreadMode = (values.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, sidebarView, scrollMode, 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        // For documents with different page sizes, once all pages are resolved,\n        // 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      }).catch(() => {\n        // Ensure that the document is always completely initialized,\n        // even if there are any errors thrown above.\n        this.setInitialView();\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    pdfDocument.getPageLabels().then((labels) => {\n      if (!labels || AppOptions.get('disablePageLabels')) {\n        return;\n      }\n      let i = 0, numLabels = labels.length;\n      if (numLabels !== this.pagesCount) {\n        console.error('The number of Page Labels does not match ' +\n                      'the number of pages in the document.');\n        return;\n      }\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\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      this.toolbar.setPagesCount(pdfDocument.numPages, true);\n      this.toolbar.setPageNumber(pdfViewer.currentPageNumber,\n                                 pdfViewer.currentPageLabel);\n    });\n\n    pagesPromise.then(() => {\n      if (!this.supportsPrinting) {\n        return;\n      }\n      pdfDocument.getJavaScript().then((javaScript) => {\n        if (!javaScript) {\n          return;\n        }\n        javaScript.some((js) => {\n          if (!js) { // Don't warn/fallback for empty JavaScript actions.\n            return false;\n          }\n          console.warn('Warning: JavaScript is not supported');\n          this.fallback(UNSUPPORTED_FEATURES.javaScript);\n          return true;\n        });\n\n        // Hack to support auto printing.\n        let regex = /\\bprint\\s*\\(/;\n        for (let i = 0, ii = javaScript.length; i < ii; i++) {\n          let js = javaScript[i];\n          if (js && regex.test(js)) {\n            setTimeout(function() {\n              window.print();\n            });\n            return;\n          }\n        }\n      });\n    });\n\n    Promise.all([onePageRendered, animationStarted]).then(() => {\n      pdfDocument.getOutline().then((outline) => {\n        this.pdfOutlineViewer.render({ outline, });\n      });\n      pdfDocument.getAttachments().then((attachments) => {\n        this.pdfAttachmentViewer.render({ attachments, });\n      });\n    });\n\n    pdfDocument.getMetadata().then(\n        ({ info, metadata, contentDispositionFilename, }) => {\n      this.documentInfo = info;\n      this.metadata = metadata;\n      this.contentDispositionFilename = contentDispositionFilename;\n\n      // Provides some basic debug information\n      console.log('PDF ' + pdfDocument.fingerprint + ' [' +\n                  info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() +\n                  ' / ' + (info.Creator || '-').trim() + ']' +\n                  ' (PDF.js: ' + (version || '-') +\n                  (AppOptions.get('enableWebGL') ? ' [WebGL]' : '') + ')');\n\n      let pdfTitle;\n      if (metadata && metadata.has('dc:title')) {\n        let title = metadata.get('dc:title');\n        // Ghostscript sometimes return 'Untitled', sets the title to 'Untitled'\n        if (title !== 'Untitled') {\n          pdfTitle = title;\n        }\n      }\n\n      if (!pdfTitle && info && info['Title']) {\n        pdfTitle = info['Title'];\n      }\n\n      if (pdfTitle) {\n        this.setTitle(\n          `${pdfTitle} - ${contentDispositionFilename || document.title}`);\n      } else if (contentDispositionFilename) {\n        this.setTitle(contentDispositionFilename);\n      }\n\n      if (info.IsAcroFormPresent) {\n        console.warn('Warning: AcroForm/XFA is not supported');\n        this.fallback(UNSUPPORTED_FEATURES.forms);\n      }\n\n      if (typeof PDFJSDev !== 'undefined' &&\n          PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n        let versionId = String(info.PDFFormatVersion).slice(-1) | 0;\n        let generatorId = 0;\n        const KNOWN_GENERATORS = [\n          'acrobat distiller', 'acrobat pdfwriter', 'adobe livecycle',\n          'adobe pdf library', 'adobe photoshop', 'ghostscript', 'tcpdf',\n          'cairo', 'dvipdfm', 'dvips', 'pdftex', 'pdfkit', 'itext', 'prince',\n          'quarkxpress', 'mac os x', 'microsoft', 'openoffice', 'oracle',\n          'luradocument', 'pdf-xchange', 'antenna house', 'aspose.cells', 'fpdf'\n        ];\n        if (info.Producer) {\n          KNOWN_GENERATORS.some(function (generator, s, i) {\n            if (!generator.includes(s)) {\n              return false;\n            }\n            generatorId = i + 1;\n            return true;\n          }.bind(null, info.Producer.toLowerCase()));\n        }\n        let formType = !info.IsAcroFormPresent ? null : info.IsXFAPresent ?\n                      'xfa' : 'acroform';\n        this.externalServices.reportTelemetry({\n          type: 'documentInfo',\n          version: versionId,\n          generator: generatorId,\n          formType,\n        });\n      }\n    });\n  },\n\n  /**\n   * @private\n   */\n  _initializePdfHistory({ fingerprint, viewOnLoad, initialDest = null, }) {\n    if (AppOptions.get('disableHistory') || this.isViewerEmbedded) {\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 (initialDest && !this.initialBookmark &&\n        viewOnLoad === ViewOnLoad.UNKNOWN) {\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  setInitialView(storedHash, { rotation, sidebarView,\n                               scrollMode, spreadMode, } = {}) {\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(this.pdfViewer.currentPageNumber,\n                               this.pdfViewer.currentPageLabel);\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  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    if (this.pdfViewer.renderer !== RendererType.SVG) {\n      this.pdfDocument.cleanup();\n    }\n  },\n\n  forceRendering() {\n    this.pdfRenderingQueue.printing = this.printing;\n    this.pdfRenderingQueue.isThumbnailViewEnabled =\n      this.pdfSidebar.isThumbnailViewVisible;\n    this.pdfRenderingQueue.renderHighestPriority();\n  },\n\n  beforePrint() {\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', null,\n                    'Warning: Printing is not fully supported by ' +\n                    'this browser.').then((printMessage) => {\n        this.error(printMessage);\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', null,\n                    'Warning: The PDF is not fully loaded for printing.').\n          then((notReadyMessage) => {\n        window.alert(notReadyMessage);\n      });\n      return;\n    }\n\n    let pagesOverview = this.pdfViewer.getPagesOverview();\n    let printContainer = this.appConfig.printContainer;\n    let printService = PDFPrintServiceFactory.instance.createPrintService(\n      this.pdfDocument, pagesOverview, printContainer, this.l10n);\n    this.printService = printService;\n    this.forceRendering();\n\n    printService.layout();\n\n    if (typeof PDFJSDev !== 'undefined' &&\n        PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n      this.externalServices.reportTelemetry({\n        type: 'print',\n      });\n    }\n  },\n\n  afterPrint: function pdfViewSetupAfterPrint() {\n    if (this.printService) {\n      this.printService.destroy();\n      this.printService = null;\n    }\n    this.forceRendering();\n  },\n\n  rotatePages(delta) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    let newRotation = (this.pdfViewer.pagesRotation + 360 + delta) % 360;\n    this.pdfViewer.pagesRotation = newRotation;\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  bindEvents() {\n    let { 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('textlayerrendered', webViewerTextLayerRendered);\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('openfile', webViewerOpenFile);\n    eventBus.on('print', webViewerPrint);\n    eventBus.on('download', webViewerDownload);\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('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    if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n      eventBus.on('fileinputchange', webViewerFileInputChange);\n    }\n  },\n\n  bindWindowEvents() {\n    let { 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\n    window.addEventListener('visibilitychange', webViewerVisibilityChange);\n    window.addEventListener('wheel', webViewerWheel, { passive: false, });\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  },\n\n  unbindEvents() {\n    let { 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('textlayerrendered', webViewerTextLayerRendered);\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('openfile', webViewerOpenFile);\n    eventBus.off('print', webViewerPrint);\n    eventBus.off('download', webViewerDownload);\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('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    if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n      eventBus.off('fileinputchange', webViewerFileInputChange);\n    }\n\n    _boundEvents.beforePrint = null;\n    _boundEvents.afterPrint = null;\n  },\n\n  unbindWindowEvents() {\n    let { _boundEvents, } = this;\n\n    window.removeEventListener('visibilitychange', webViewerVisibilityChange);\n    window.removeEventListener('wheel', webViewerWheel);\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\n    _boundEvents.windowResize = null;\n    _boundEvents.windowHashChange = null;\n    _boundEvents.windowBeforePrint = null;\n    _boundEvents.windowAfterPrint = null;\n  },\n};\n\nlet validateFileURL;\nif (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n  const HOSTED_VIEWER_ORIGINS = ['null',\n    'http://mozilla.github.io', 'https://mozilla.github.io'];\n  validateFileURL = function validateFileURL(file) {\n    if (file === undefined) {\n      return;\n    }\n    try {\n      let 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      let { 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      let message = ex && ex.message;\n      PDFViewerApplication.l10n.get('loading_error', null,\n          'An error occurred while loading the PDF.').\n          then((loadingErrorMessage) => {\n        PDFViewerApplication.error(loadingErrorMessage, { message, });\n      });\n      throw ex;\n    }\n  };\n}\n\nfunction loadFakeWorker() {\n  if (!GlobalWorkerOptions.workerSrc) {\n    GlobalWorkerOptions.workerSrc = AppOptions.get('workerSrc');\n  }\n  if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {\n    return new Promise(function(resolve, reject) {\n      if (typeof SystemJS === 'object') {\n        SystemJS.import('pdfjs/core/worker').then((worker) => {\n          window.pdfjsWorker = worker;\n          resolve();\n        }).catch(reject);\n      } else if (typeof require === 'function') {\n        try {\n          window.pdfjsWorker = require('../src/core/worker.js');\n          resolve();\n        } catch (ex) {\n          reject(ex);\n        }\n      } else {\n        reject(new Error(\n          'SystemJS or CommonJS must be used to load fake worker.'));\n      }\n    });\n  }\n  return loadScript(PDFWorker.getWorkerSrc());\n}\n\nfunction loadAndEnablePDFBug(enabledTabs) {\n  let appConfig = PDFViewerApplication.appConfig;\n  return loadScript(appConfig.debuggerScriptPath).then(function() {\n    PDFBug.enable(enabledTabs);\n    PDFBug.init({\n      OPS,\n      createObjectURL,\n    }, appConfig.mainContainer);\n  });\n}\n\nfunction webViewerInitialized() {\n  let appConfig = PDFViewerApplication.appConfig;\n  let file;\n  if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n    let queryString = document.location.search.substring(1);\n    let params = parseQueryString(queryString);\n    file = 'file' in params ? params.file : AppOptions.get('defaultUrl');\n    validateFileURL(file);\n  } else if (PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n    file = window.location.href.split('#')[0];\n  } else if (PDFJSDev.test('CHROME')) {\n    file = AppOptions.get('defaultUrl');\n  }\n\n  if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n    let 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 (!window.File || !window.FileReader ||\n        !window.FileList || !window.Blob) {\n      appConfig.toolbar.openFile.setAttribute('hidden', 'true');\n      appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true');\n    } else {\n      fileInput.value = null;\n    }\n\n    fileInput.addEventListener('change', function(evt) {\n      let 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 draging-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.setAttribute('hidden', 'true');\n    appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true');\n  }\n\n  if (typeof PDFJSDev !== 'undefined' &&\n      PDFJSDev.test('FIREFOX || MOZCENTRAL') &&\n      !PDFViewerApplication.supportsDocumentFonts) {\n    AppOptions.set('disableFontFace', true);\n    PDFViewerApplication.l10n.get('web_fonts_disabled', null,\n      'Web fonts are disabled: unable to use embedded PDF fonts.').\n        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('transitionend', function(evt) {\n    if (evt.target === /* mainContainer */ this) {\n      PDFViewerApplication.eventBus.dispatch('resize', { source: this, });\n    }\n  }, true);\n\n  appConfig.sidebar.toggleButton.addEventListener('click', function() {\n    PDFViewerApplication.pdfSidebar.toggle();\n  });\n\n  try {\n    webViewerOpenFileViaURL(file);\n  } catch (reason) {\n    PDFViewerApplication.l10n.get('loading_error', null,\n        'An error occurred while loading the PDF.').then((msg) => {\n      PDFViewerApplication.error(msg, reason);\n    });\n  }\n}\n\nlet webViewerOpenFileViaURL;\nif (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n  webViewerOpenFileViaURL = function webViewerOpenFileViaURL(file) {\n    if (file && file.lastIndexOf('file:', 0) === 0) {\n      // file:-scheme. Load the contents in the main thread because QtWebKit\n      // cannot load file:-URLs in a Web Worker. file:-URLs are usually loaded\n      // very quickly, so there is no need to set up progress event listeners.\n      PDFViewerApplication.setTitleUsingUrl(file);\n      const xhr = new XMLHttpRequest();\n      xhr.onload = function() {\n        PDFViewerApplication.open(new Uint8Array(xhr.response));\n      };\n      xhr.open('GET', file);\n      xhr.responseType = 'arraybuffer';\n      xhr.send();\n      return;\n    }\n\n    if (file) {\n      PDFViewerApplication.open(file);\n    }\n  };\n} else if (PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {\n  webViewerOpenFileViaURL = function webViewerOpenFileViaURL(file) {\n    PDFViewerApplication.setTitleUsingUrl(file);\n    PDFViewerApplication.initPassiveLoading();\n  };\n} else {\n  webViewerOpenFileViaURL = function webViewerOpenFileViaURL(file) {\n    if (file) {\n      throw new Error('Not implemented: webViewerOpenFileViaURL');\n    }\n  };\n}\n\nfunction webViewerPageRendered(evt) {\n  let pageNumber = evt.pageNumber;\n  let pageIndex = pageNumber - 1;\n  let pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);\n\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  // Prevent errors in the edge-case where the PDF document is removed *before*\n  // the 'pagerendered' event handler is invoked.\n  if (!pageView) {\n    return;\n  }\n\n  // Use the rendered page to set the corresponding thumbnail image.\n  if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) {\n    let thumbnailView = PDFViewerApplication.pdfThumbnailViewer.\n                        getThumbnail(pageIndex);\n    thumbnailView.setImage(pageView);\n  }\n\n  if (typeof Stats !== 'undefined' && Stats.enabled && pageView.stats) {\n    Stats.add(pageNumber, pageView.stats);\n  }\n\n  if (pageView.error) {\n    PDFViewerApplication.l10n.get('rendering_error', null,\n        'An error occurred while rendering the page.').then((msg) => {\n      PDFViewerApplication.error(msg, pageView.error);\n    });\n  }\n\n  if (typeof PDFJSDev !== 'undefined' &&\n      PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n    PDFViewerApplication.externalServices.reportTelemetry({\n      type: 'pageInfo',\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}\n\nfunction webViewerTextLayerRendered(evt) {\n  if (typeof PDFJSDev !== 'undefined' &&\n      PDFJSDev.test('FIREFOX || MOZCENTRAL') &&\n      evt.numTextDivs > 0 && !PDFViewerApplication.supportsDocumentColors) {\n    PDFViewerApplication.l10n.get('document_colors_not_allowed', null,\n      'PDF documents are not allowed to use their own colors: ' +\n      '\\'Allow pages to choose their own colors\\' ' +\n      'is deactivated in the browser.').\n        then((msg) => {\n      console.error(msg);\n    });\n    PDFViewerApplication.fallback();\n  }\n}\n\nfunction webViewerPageMode(evt) {\n  // Handle the 'pagemode' hash parameter, see also `PDFLinkService_setHash`.\n  let mode = evt.mode, view;\n  switch (mode) {\n    case 'thumbs':\n      view = SidebarView.THUMBS;\n      break;\n    case 'bookmarks':\n    case 'outline':\n      view = SidebarView.OUTLINE;\n      break;\n    case 'attachments':\n      view = SidebarView.ATTACHMENTS;\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 couple of named actions that might be useful.\n  // See also PDFLinkService.executeNamedAction\n  let action = evt.action;\n  switch (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}\n\nfunction webViewerPresentationModeChanged(evt) {\n  let { active, switchInProgress, } = evt;\n  PDFViewerApplication.pdfViewer.presentationModeState =\n    switchInProgress ? PresentationModeState.CHANGING :\n    active ? PresentationModeState.FULLSCREEN : PresentationModeState.NORMAL;\n}\n\nfunction webViewerSidebarViewChanged(evt) {\n  PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled =\n    PDFViewerApplication.pdfSidebar.isThumbnailViewVisible;\n\n  let 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  let location = evt.location, store = PDFViewerApplication.store;\n\n  if (store && PDFViewerApplication.isInitialViewSet) {\n    store.setMultiple({\n      'page': location.pageNumber,\n      'zoom': location.scale,\n      'scrollLeft': location.left,\n      'scrollTop': location.top,\n      'rotation': location.rotation,\n    }).catch(function() { /* unable to write to storage */ });\n  }\n  let href =\n    PDFViewerApplication.pdfLinkService.getAnchorUrl(location.pdfOpenParams);\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  let currentPage =\n    PDFViewerApplication.pdfViewer.getPageView(PDFViewerApplication.page - 1);\n  let loading = currentPage.renderingState !== RenderingStates.FINISHED;\n  PDFViewerApplication.toolbar.updateLoadingIndicatorState(loading);\n}\n\nfunction webViewerScrollModeChanged(evt) {\n  let 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  let 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  let { pdfDocument, pdfViewer, } = PDFViewerApplication;\n  if (!pdfDocument) {\n    return;\n  }\n  let currentScaleValue = pdfViewer.currentScaleValue;\n  if (currentScaleValue === 'auto' ||\n      currentScaleValue === 'page-fit' ||\n      currentScaleValue === 'page-width') {\n    // Note: the scale is constant for 'page-actual'.\n    pdfViewer.currentScaleValue = currentScaleValue;\n  }\n  pdfViewer.update();\n}\n\nfunction webViewerHashchange(evt) {\n  let 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;\nif (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n  webViewerFileInputChange = function webViewerFileInputChange(evt) {\n    if (PDFViewerApplication.pdfViewer &&\n        PDFViewerApplication.pdfViewer.isInPresentationMode) {\n      return; // Opening a new PDF file isn't supported in Presentation Mode.\n    }\n    let file = evt.fileInput.files[0];\n\n    if (URL.createObjectURL && !AppOptions.get('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      let fileReader = new FileReader();\n      fileReader.onload = function webViewerChangeFileReaderOnload(evt) {\n        let buffer = evt.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    let appConfig = PDFViewerApplication.appConfig;\n    appConfig.toolbar.viewBookmark.setAttribute('hidden', 'true');\n    appConfig.secondaryToolbar.viewBookmarkButton.setAttribute('hidden',\n                                                               'true');\n    appConfig.toolbar.download.setAttribute('hidden', 'true');\n    appConfig.secondaryToolbar.downloadButton.setAttribute('hidden', 'true');\n  };\n}\n\nfunction webViewerPresentationMode() {\n  PDFViewerApplication.requestPresentationMode();\n}\nfunction webViewerOpenFile() {\n  if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n    let openFileInputName = PDFViewerApplication.appConfig.openFileInputName;\n    document.getElementById(openFileInputName).click();\n  }\n}\nfunction webViewerPrint() {\n  window.print();\n}\nfunction webViewerDownload() {\n  PDFViewerApplication.download();\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.page++;\n}\nfunction webViewerPreviousPage() {\n  PDFViewerApplication.page--;\n}\nfunction webViewerZoomIn() {\n  PDFViewerApplication.zoomIn();\n}\nfunction webViewerZoomOut() {\n  PDFViewerApplication.zoomOut();\n}\nfunction webViewerZoomReset(evt) {\n  PDFViewerApplication.zoomReset(evt && evt.ignoreDuplicate);\n}\nfunction webViewerPageNumberChanged(evt) {\n  let 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    pdfViewer.currentPageLabel = 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 (evt.value !== pdfViewer.currentPageNumber.toString() &&\n      evt.value !== pdfViewer.currentPageLabel) {\n    PDFViewerApplication.toolbar.setPageNumber(\n      pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);\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 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({ state, previous, matchesCount, }) {\n  if (PDFViewerApplication.supportsIntegratedFind) {\n    PDFViewerApplication.externalServices.updateFindControlState({\n      result: state,\n      findPrevious: previous,\n      matchesCount,\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(evt) {\n  let page = evt.pageNumber;\n\n  PDFViewerApplication.toolbar.setPageNumber(page, evt.pageLabel || null);\n  PDFViewerApplication.secondaryToolbar.setPageNumber(page);\n\n  if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) {\n    PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page);\n  }\n\n  // We need to update stats.\n  if (typeof Stats !== 'undefined' && Stats.enabled) {\n    let pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1);\n    if (pageView && pageView.stats) {\n      Stats.add(page, pageView.stats);\n    }\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  let pdfViewer = PDFViewerApplication.pdfViewer;\n  if (pdfViewer.isInPresentationMode) {\n    return;\n  }\n\n  if (evt.ctrlKey || evt.metaKey) {\n    let support = PDFViewerApplication.supportedMouseWheelZoomModifierKeys;\n    if ((evt.ctrlKey && !support.ctrlKey) ||\n        (evt.metaKey && !support.metaKey)) {\n      return;\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    let previousScale = pdfViewer.currentScale;\n\n    let delta = normalizeWheelEventDelta(evt);\n\n    const MOUSE_WHEEL_DELTA_PER_PAGE_SCALE = 3.0;\n    let ticks = delta * MOUSE_WHEEL_DELTA_PER_PAGE_SCALE;\n    if (ticks < 0) {\n      PDFViewerApplication.zoomOut(-ticks);\n    } else {\n      PDFViewerApplication.zoomIn(ticks);\n    }\n\n    let 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      let scaleCorrectionFactor = currentScale / previousScale - 1;\n      let rect = pdfViewer.container.getBoundingClientRect();\n      let dx = evt.clientX - rect.left;\n      let 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 webViewerClick(evt) {\n  if (!PDFViewerApplication.secondaryToolbar.isOpen) {\n    return;\n  }\n  let appConfig = PDFViewerApplication.appConfig;\n  if (PDFViewerApplication.pdfViewer.containsElement(evt.target) ||\n      (appConfig.toolbar.container.contains(evt.target) &&\n       evt.target !== appConfig.secondaryToolbar.toggleButton)) {\n    PDFViewerApplication.secondaryToolbar.close();\n  }\n}\n\nfunction webViewerKeyDown(evt) {\n  if (PDFViewerApplication.overlayManager.active) {\n    return;\n  }\n\n  let handled = false, ensureViewerFocused = false;\n  let cmd = (evt.ctrlKey ? 1 : 0) |\n            (evt.altKey ? 2 : 0) |\n            (evt.shiftKey ? 4 : 0) |\n            (evt.metaKey ? 8 : 0);\n\n  let pdfViewer = PDFViewerApplication.pdfViewer;\n  let isViewerInPresentationMode = pdfViewer && 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) {\n          PDFViewerApplication.findBar.open();\n          handled = true;\n        }\n        break;\n      case 71: // g\n        if (!PDFViewerApplication.supportsIntegratedFind) {\n          let 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 (isViewerInPresentationMode ||\n            PDFViewerApplication.page < PDFViewerApplication.pagesCount) {\n          PDFViewerApplication.page = PDFViewerApplication.pagesCount;\n          handled = true;\n          ensureViewerFocused = true;\n        }\n        break;\n    }\n  }\n\n  if (typeof PDFJSDev === 'undefined' ||\n      !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n    // CTRL or META without shift\n    if (cmd === 1 || cmd === 8) {\n      switch (evt.keyCode) {\n        case 83: // s\n          PDFViewerApplication.download();\n          handled = true;\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  let curElement = document.activeElement || document.querySelector(':focus');\n  let curElementTagName = curElement && curElement.tagName.toUpperCase();\n  if (curElementTagName === 'INPUT' ||\n      curElementTagName === 'TEXTAREA' ||\n      curElementTagName === 'SELECT') {\n    // Make sure that the secondary toolbar is closed when Escape is pressed.\n    if (evt.keyCode !== 27) { // 'Esc'\n      return;\n    }\n  }\n\n  if (cmd === 0) { // no control key pressed at all.\n    let turnPage = 0, 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 (!PDFViewerApplication.supportsIntegratedFind &&\n            PDFViewerApplication.findBar.opened) {\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 (isViewerInPresentationMode ||\n            PDFViewerApplication.page < PDFViewerApplication.pagesCount) {\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 (turnPage !== 0 &&\n        (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === 'page-fit')) {\n      if (turnPage > 0) {\n        if (PDFViewerApplication.page < PDFViewerApplication.pagesCount) {\n          PDFViewerApplication.page++;\n        }\n      } else {\n        if (PDFViewerApplication.page > 1) {\n          PDFViewerApplication.page--;\n        }\n      }\n      handled = true;\n    }\n  }\n\n  if (cmd === 4) { // shift-key\n    switch (evt.keyCode) {\n      case 13: // enter key\n      case 32: // spacebar\n        if (!isViewerInPresentationMode &&\n            pdfViewer.currentScaleValue !== 'page-fit') {\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 ((evt.keyCode >= 33 && evt.keyCode <= 40) ||\n        (evt.keyCode === 32 && curElementTagName !== 'BUTTON')) {\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\n/**\n * Converts API PageLayout values to the format used by `PDFViewer`.\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      // Not implemented, since we don't support Optional Content Groups yet.\n  }\n  return SidebarView.NONE; // Default value.\n}\n\n/* Abstract factory for the print service. */\nlet PDFPrintServiceFactory = {\n  instance: {\n    supportsPrinting: false,\n    createPrintService() {\n      throw new Error('Not implemented: createPrintService');\n    },\n  },\n};\n\nexport {\n  PDFViewerApplication,\n  DefaultExternalServices,\n  PDFPrintServiceFactory,\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 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  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 = Gp.constructor = GeneratorFunctionPrototype;\n  GeneratorFunctionPrototype.constructor = GeneratorFunction;\n  GeneratorFunctionPrototype[toStringTagSymbol] =\n    GeneratorFunction.displayName = \"GeneratorFunction\";\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      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      if (!(toStringTagSymbol in genFun)) {\n        genFun[toStringTagSymbol] = \"GeneratorFunction\";\n      }\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) {\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 Promise.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 Promise.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 Promise(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  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) {\n    var iter = new AsyncIterator(\n      wrap(innerFn, outerFn, self, tryLocsList)\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  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  Gp[iteratorSymbol] = function() {\n    return this;\n  };\n\n  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, 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  Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\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.10;\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 PresentationModeState = {\n  UNKNOWN: 0,\n  NORMAL: 1,\n  CHANGING: 2,\n  FULLSCREEN: 3,\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// 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 */\nlet NullL10n = {\n  async getLanguage() {\n    return 'en-us';\n  },\n\n  async getDirection() {\n    return 'ltr';\n  },\n\n  async get(property, args, fallback) {\n    return formatL10nValue(fallback, args);\n  },\n\n  async translate(element) { },\n};\n\n/**\n * Returns scale factor for the canvas. It makes sense for the HiDPI displays.\n * @return {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  let devicePixelRatio = window.devicePixelRatio || 1;\n  let backingStoreRatio = ctx.webkitBackingStorePixelRatio ||\n                          ctx.mozBackingStorePixelRatio ||\n                          ctx.msBackingStorePixelRatio ||\n                          ctx.oBackingStorePixelRatio ||\n                          ctx.backingStorePixelRatio || 1;\n  let 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} skipOverflowHiddenElements - Ignore elements that have\n *   the CSS rule `overflow: hidden;` set. The default is false.\n */\nfunction scrollIntoView(element, spot, skipOverflowHiddenElements = 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 ((parent.clientHeight === parent.scrollHeight &&\n          parent.clientWidth === parent.scrollWidth) ||\n         (skipOverflowHiddenElements &&\n          getComputedStyle(parent).overflow === 'hidden')) {\n    if (parent.dataset._scaleY) {\n      offsetY /= parent.dataset._scaleY;\n      offsetX /= parent.dataset._scaleX;\n    }\n    offsetY += parent.offsetTop;\n    offsetX += parent.offsetLeft;\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  let 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      let currentX = viewAreaElement.scrollLeft;\n      let lastX = state.lastX;\n      if (currentX !== lastX) {\n        state.right = currentX > lastX;\n      }\n      state.lastX = currentX;\n      let currentY = viewAreaElement.scrollTop;\n      let lastY = state.lastY;\n      if (currentY !== lastY) {\n        state.down = currentY > lastY;\n      }\n      state.lastY = currentY;\n      callback(state);\n    });\n  };\n\n  let 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  let parts = query.split('&');\n  let params = Object.create(null);\n  for (let i = 0, ii = parts.length; i < ii; ++i) {\n    let param = parts[i].split('=');\n    let key = param[0].toLowerCase();\n    let 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 (items.length === 0 || !condition(items[maxIndex])) {\n    return items.length;\n  }\n  if (condition(items[minIndex])) {\n    return minIndex;\n  }\n\n  while (minIndex < maxIndex) {\n    let currentIndex = (minIndex + maxIndex) >> 1;\n    let 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  let xinv = 1 / x;\n  let limit = 8;\n  if (xinv > limit) {\n    return [1, limit];\n  } else if (Math.floor(xinv) === xinv) {\n    return [1, xinv];\n  }\n\n  let x_ = x > 1 ? xinv : x;\n  // a/b and c/d are neighbours in Farey sequence.\n  let a = 0, b = 1, c = 1, d = 1;\n  // Limiting search to order 8.\n  while (true) {\n    // Generating next term in sequence (order of q).\n    let p = a + c, q = b + d;\n    if (q > limit) {\n      break;\n    }\n    if (x_ <= p / q) {\n      c = p; d = q;\n    } else {\n      a = p; 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  let 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 * @return {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 * 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 scrollEl {HTMLElement} - a container that can possibly scroll\n * @param views {Array} - objects with a `div` property that contains an\n *   HTMLElement, which should all be descendents of `scrollEl` satisfying the\n *   above layout assumptions\n * @param sortByVisibility {boolean} - if true, the returned elements are sorted\n *   in descending order of the percent of their padding box that is visible\n * @param horizontal {boolean} - if true, the elements are assumed to be laid\n *   out horizontally instead of vertically\n * @returns {Object} `{ first, last, views: [{ id, x, y, view, percent }] }`\n */\nfunction getVisibleElements(scrollEl, views, sortByVisibility = false,\n                            horizontal = false) {\n  const top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight;\n  const left = scrollEl.scrollLeft, 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 isElementRightAfterViewLeft(view) {\n    const element = view.div;\n    const elementRight =\n      element.offsetLeft + element.clientLeft + element.clientWidth;\n    return elementRight > left;\n  }\n\n  const visible = [], numViews = views.length;\n  let firstVisibleElementInd = numViews === 0 ? 0 :\n    binarySearchFirstItem(views, horizontal ? isElementRightAfterViewLeft :\n                                              isElementBottomAfterViewTop);\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 (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews &&\n      !horizontal) {\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 =\n      backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);\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], element = view.div;\n    const currentWidth = element.offsetLeft + element.clientLeft;\n    const currentHeight = element.offsetTop + element.clientTop;\n    const viewWidth = element.clientWidth, 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 (viewBottom <= top || currentHeight >= bottom ||\n        viewRight <= left || currentWidth >= right) {\n      continue;\n    }\n\n    const hiddenHeight = Math.max(0, top - currentHeight) +\n                         Math.max(0, viewBottom - bottom);\n    const hiddenWidth = Math.max(0, left - currentWidth) +\n                        Math.max(0, viewRight - right);\n    const percent = ((viewHeight - hiddenHeight) * (viewWidth - hiddenWidth) *\n                     100 / viewHeight / viewWidth) | 0;\n    visible.push({\n      id: view.id,\n      x: currentWidth,\n      y: currentHeight,\n      view,\n      percent,\n    });\n  }\n\n  const first = visible[0], last = visible[visible.length - 1];\n\n  if (sortByVisibility) {\n    visible.sort(function(a, b) {\n      let 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 isDataSchema(url) {\n  let i = 0, ii = url.length;\n  while (i < ii && url[i].trim() === '') {\n    i++;\n  }\n  return url.substring(i, i + 5).toLowerCase() === 'data:';\n}\n\n/**\n * Returns the filename or guessed filename from the url (see issue 3455).\n * @param {string} url - The original PDF location.\n * @param {string} defaultFilename - The value returned if the filename is\n *   unknown, or the protocol is unsupported.\n * @returns {string} Guessed PDF filename.\n */\nfunction getPDFFileNameFromURL(url, defaultFilename = 'document.pdf') {\n  if (typeof url !== 'string') {\n    return defaultFilename;\n  }\n  if (isDataSchema(url)) {\n    console.warn('getPDFFileNameFromURL: ' +\n                 'ignoring \"data:\" URL for performance reasons.');\n    return defaultFilename;\n  }\n  const reURI = /^(?:(?:[^:]+:)?\\/\\/[^\\/]+)?([^?#]*)(\\?[^#]*)?(#.*)?$/;\n  //            SCHEME        HOST         1.PATH  2.QUERY   3.REF\n  // Pattern to get last matching NAME.pdf\n  const reFilename = /[^\\/?#=]+\\.pdf\\b(?!.*\\.pdf\\b)/i;\n  let splitURI = reURI.exec(url);\n  let suggestedFilename = reFilename.exec(splitURI[1]) ||\n                          reFilename.exec(splitURI[2]) ||\n                          reFilename.exec(splitURI[3]);\n  if (suggestedFilename) {\n    suggestedFilename = suggestedFilename[0];\n    if (suggestedFilename.includes('%')) {\n      // URL-encoded %2Fpath%2Fto%2Ffile.pdf should be file.pdf\n      try {\n        suggestedFilename =\n          reFilename.exec(decodeURIComponent(suggestedFilename))[0];\n      } catch (ex) { // Possible (extremely rare) errors:\n        // URIError \"Malformed URI\", e.g. for \"%AA.pdf\"\n        // TypeError \"null has no properties\", e.g. for \"%2F.pdf\"\n      }\n    }\n  }\n  return suggestedFilename || defaultFilename;\n}\n\nfunction normalizeWheelEventDelta(evt) {\n  let delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY);\n  let 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\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 (Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) &&\n          mode !== ScrollMode.UNKNOWN);\n}\n\nfunction isValidSpreadMode(mode) {\n  return (Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) &&\n          mode !== SpreadMode.UNKNOWN);\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 (typeof target !== 'object' || !(name && typeof name === 'string') ||\n        !(Number.isInteger(delay) && delay >= 0)) {\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    let timeout = setTimeout(timeoutHandler, delay);\n  });\n}\n\n/**\n * Promise that is resolved when DOM window becomes visible.\n */\nlet animationStarted = new Promise(function (resolve) {\n  if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('LIB')) &&\n      typeof window === 'undefined') {\n    // Prevent \"ReferenceError: window is not defined\" errors when running the\n    // unit-tests in Node.js/Travis.\n    setTimeout(resolve, 20);\n    return;\n  }\n  window.requestAnimationFrame(resolve);\n});\n\n/**\n * Simple event bus for an application. Listeners are attached using the\n * `on` and `off` methods. To raise an event, the `dispatch` method shall be\n * used.\n */\nclass EventBus {\n  constructor({ dispatchToDOM = false, } = {}) {\n    this._listeners = Object.create(null);\n    this._dispatchToDOM = dispatchToDOM === true;\n  }\n\n  on(eventName, listener) {\n    let eventListeners = this._listeners[eventName];\n    if (!eventListeners) {\n      eventListeners = [];\n      this._listeners[eventName] = eventListeners;\n    }\n    eventListeners.push(listener);\n  }\n\n  off(eventName, listener) {\n    let eventListeners = this._listeners[eventName];\n    let i;\n    if (!eventListeners || ((i = eventListeners.indexOf(listener)) < 0)) {\n      return;\n    }\n    eventListeners.splice(i, 1);\n  }\n\n  dispatch(eventName) {\n    let eventListeners = this._listeners[eventName];\n    if (!eventListeners || eventListeners.length === 0) {\n      if (this._dispatchToDOM) {\n        const args = Array.prototype.slice.call(arguments, 1);\n        this._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    // Making copy of the listeners array in case if it will be modified\n    // during dispatch.\n    eventListeners.slice(0).forEach(function (listener) {\n      listener.apply(null, args);\n    });\n    if (this._dispatchToDOM) {\n      this._dispatchDOMEvent(eventName, args);\n    }\n  }\n\n  /**\n   * @private\n   */\n  _dispatchDOMEvent(eventName, args = null) {\n    const details = Object.create(null);\n    if (args && args.length > 0) {\n      const obj = args[0];\n      for (let 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\nlet globalEventBus = null;\nfunction getGlobalEventBus(dispatchToDOM = false) {\n  if (!globalEventBus) {\n    globalEventBus = new EventBus({ dispatchToDOM, });\n  }\n  return globalEventBus;\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    let 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    let container = viewer.parentNode;\n    let scrollbarWidth = container.offsetWidth - viewer.offsetWidth;\n    if (scrollbarWidth > 0) {\n      this.bar.setAttribute('style', 'width: calc(100% - ' +\n                                     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    document.body.classList.remove('loadingInProgress');\n  }\n\n  show() {\n    if (this.visible) {\n      return;\n    }\n    this.visible = true;\n    document.body.classList.add('loadingInProgress');\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 = [], 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\nexport {\n  CSS_UNITS,\n  DEFAULT_SCALE_VALUE,\n  DEFAULT_SCALE,\n  MIN_SCALE,\n  MAX_SCALE,\n  UNKNOWN_SCALE,\n  MAX_AUTO_SCALE,\n  SCROLLBAR_PADDING,\n  VERTICAL_PADDING,\n  isValidRotation,\n  isValidScrollMode,\n  isValidSpreadMode,\n  isPortraitOrientation,\n  PresentationModeState,\n  RendererType,\n  TextLayerMode,\n  ScrollMode,\n  SpreadMode,\n  NullL10n,\n  EventBus,\n  getGlobalEventBus,\n  ProgressBar,\n  getPDFFileNameFromURL,\n  noContextMenuHandler,\n  parseQueryString,\n  backtrackBeforeAllVisibleElements, // only exported for testing\n  getVisibleElements,\n  roundToDivide,\n  getPageSizeInches,\n  approximateFraction,\n  getOutputScale,\n  scrollIntoView,\n  watchScroll,\n  binarySearchFirstItem,\n  normalizeWheelEventDelta,\n  animationStarted,\n  WaitOnType,\n  waitOnEventOrTimeout,\n  moveToEndOfArray,\n};\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { apiCompatibilityParams } from 'pdfjs-lib';\nimport { viewerCompatibilityParams } from './viewer_compatibility';\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  /**\n   * The `disablePreferences` is, conditionally, defined below.\n   */\n  enablePrintAutoRotate: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableWebGL: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  eventBusDispatchToDOM: {\n    /** @type {boolean} */\n    value: false,\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  imageResourcesPath: {\n    /** @type {string} */\n    value: './images/',\n    kind: OptionKind.VIEWER,\n  },\n  /**\n   * The `locale` is, conditionally, defined below.\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: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  renderer: {\n    /** @type {string} */\n    value: 'canvas',\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  renderInteractiveForms: {\n    /** @type {boolean} */\n    value: false,\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  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: (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION') ?\n            '../external/bcmaps/' : '../web/cmaps/'),\n    kind: OptionKind.API,\n  },\n  disableAutoFetch: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.API + OptionKind.PREFERENCE,\n  },\n  disableCreateObjectURL: {\n    /** @type {boolean} */\n    value: false,\n    compatibility: apiCompatibilityParams.disableCreateObjectURL,\n    kind: OptionKind.API,\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  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  postMessageTransfers: {\n    /** @type {boolean} */\n    value: true,\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: (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION') ?\n            '../src/worker_loader.js' : '../build/pdf.worker.js'),\n    kind: OptionKind.WORKER,\n  },\n};\nif (typeof PDFJSDev === 'undefined' ||\n    PDFJSDev.test('!PRODUCTION || (GENERIC && !LIB)')) {\n  defaultOptions.disablePreferences = {\n    /** @type {boolean} */\n    value: false,\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.printResolution = {\n    /** @type {number} */\n    value: 150,\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, valueType = typeof value;\n\n          if (valueType === 'boolean' || valueType === 'string' ||\n              (valueType === 'number' && Number.isInteger(value))) {\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] = (userOption !== undefined ? 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 remove(name) {\n    delete userOptions[name];\n  }\n}\n\nexport {\n  AppOptions,\n  OptionKind,\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 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\nlet compatibilityParams = Object.create(null);\nif (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n  const userAgent =\n    (typeof navigator !== 'undefined' && navigator.userAgent) || '';\n  const isAndroid = /Android/.test(userAgent);\n  const isIOS = /\\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);\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}\n\nexports.viewerCompatibilityParams = Object.freeze(compatibilityParams);\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';\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 - (optional) The cursor tool that will be\n *   enabled on load; the constants from {CursorTool} should be used.\n *   The default value 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   * @returns {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    let 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    switch (tool) { // Enable the new cursor 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      if (evt.switchInProgress) {\n        return;\n      }\n      let previouslyActive;\n\n      if (evt.active) {\n        previouslyActive = this.active;\n\n        this.switchTool(CursorTool.SELECT);\n        this.activeBeforePresentationMode = previouslyActive;\n      } else {\n        previouslyActive = this.activeBeforePresentationMode;\n\n        this.activeBeforePresentationMode = null;\n        this.switchTool(previouslyActive);\n      }\n    });\n  }\n}\n\nexport {\n  CursorTool,\n  PDFCursorTools,\n};\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/* eslint-disable no-var */\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  var 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   * @return {boolean} Whether to not react to the click event.\n   */\n  ignoreTarget: function GrabToPan_ignoreTarget(node) {\n    // Use matchesSelector to check whether the clicked element\n    // is (a child of) an input element / link\n    return node[matchesSelector](\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    var 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    var xDiff = event.clientX - this.clientXStart;\n    var yDiff = event.clientY - this.clientYStart;\n    var scrollTop = this.scrollTopStart - yDiff;\n    var 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// Get the correct (vendor-prefixed) name of the matches method.\nvar matchesSelector;\n['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function(prefix) {\n  var name = prefix + 'atches';\n  if (name in document.documentElement) {\n    matchesSelector = name;\n  }\n  name += 'Selector';\n  if (name in document.documentElement) {\n    matchesSelector = name;\n  }\n  return matchesSelector; // If found, then truthy, and [].some() ends.\n});\n\n// Browser sniffing because it's impossible to feature-detect\n// whether event.which for onmousemove is reliable\nvar isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9;\nvar chrome = window.chrome;\nvar isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app);\n//                                       ^ Chrome 15+       ^ Opera 15+\nvar isSafari6plus = /Apple/.test(navigator.vendor) &&\n                    /Version\\/([6-9]\\d*|[1-5]\\d+)/.test(navigator.userAgent);\n\n/**\n * Whether the left mouse is not pressed.\n * @param event {MouseEvent}\n * @return {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 && isNotIEorIsIE10plus) {\n    // http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons\n    // Firefox 15+\n    // Internet Explorer 10+\n    return !(event.buttons & 1);\n  }\n  if (isChrome15OrOpera15plus || isSafari6plus) {\n    // Chrome 14+\n    // Opera 15+\n    // Safari 6.0+\n    return event.which === 0;\n  }\n  return false;\n}\n\nexport {\n  GrabToPan,\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 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    let visibleViews = visible.views;\n\n    let numVisible = visibleViews.length;\n    if (numVisible === 0) {\n      return null;\n    }\n    for (let i = 0; i < numVisible; ++i) {\n      let 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      let 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      let previousPageIndex = visible.first.id - 2;\n      if (views[previousPageIndex] &&\n          !this.isViewFinished(views[previousPageIndex])) {\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.draw().finally(() => {\n          this.renderHighestPriority();\n        });\n        break;\n    }\n    return true;\n  }\n}\n\nexport {\n  RenderingStates,\n  PDFRenderingQueue,\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\nimport { NullL10n } from './ui_utils';\nimport { RenderingStates } from './pdf_rendering_queue';\n\nconst UI_NOTIFICATION_CLASS = 'pdfSidebarNotification';\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\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 * @property {boolean} disableNotification - (optional) Disable the notification\n *   for documents containing outline/attachments. The default value is `false`.\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 {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 */\n\nclass PDFSidebar {\n  /**\n   * @param {PDFSidebarOptions} options\n   */\n  constructor({ elements, pdfViewer, pdfThumbnailViewer, eventBus,\n                l10n = NullL10n, disableNotification = false, }) {\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\n    this.thumbnailView = elements.thumbnailView;\n    this.outlineView = elements.outlineView;\n    this.attachmentsView = elements.attachmentsView;\n\n    this.eventBus = eventBus;\n    this.l10n = l10n;\n    this._disableNotification = disableNotification;\n\n    this._addEventListeners();\n  }\n\n  reset() {\n    this.isInitialViewSet = false;\n\n    this._hideUINotification(null);\n    this.switchView(SidebarView.THUMBS);\n\n    this.outlineButton.disabled = false;\n    this.attachmentsButton.disabled = false;\n  }\n\n  /**\n   * @returns {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  /**\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 - (optional) 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      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('toggled',\n      view === SidebarView.THUMBS);\n    this.outlineButton.classList.toggle('toggled',\n      view === SidebarView.OUTLINE);\n    this.attachmentsButton.classList.toggle('toggled',\n      view === SidebarView.ATTACHMENTS);\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('hidden',\n      view !== SidebarView.ATTACHMENTS);\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    this._hideUINotification(this.active);\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\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(this.active);\n  }\n\n  close() {\n    if (!this.isOpen) {\n      return;\n    }\n    this.isOpen = false;\n    this.toggleButton.classList.remove('toggled');\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 { // Fallback\n      this.pdfViewer.forceRendering();\n      this.pdfThumbnailViewer.forceRendering();\n    }\n  }\n\n  /**\n   * @private\n   */\n  _updateThumbnailViewer() {\n    let { pdfViewer, pdfThumbnailViewer, } = this;\n\n    // Use the rendered pages to set the corresponding thumbnail images.\n    let pagesCount = pdfViewer.pagesCount;\n    for (let pageIndex = 0; pageIndex < pagesCount; pageIndex++) {\n      let pageView = pdfViewer.getPageView(pageIndex);\n      if (pageView && pageView.renderingState === RenderingStates.FINISHED) {\n        let thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex);\n        thumbnailView.setImage(pageView);\n      }\n    }\n    pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber);\n  }\n\n  /**\n   * @private\n   */\n  _showUINotification(view) {\n    if (this._disableNotification) {\n      return;\n    }\n\n    this.l10n.get('toggle_sidebar_notification.title', null,\n                  'Toggle Sidebar (document contains outline/attachments)').\n        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    } else if (view === this.active) {\n      // If the sidebar is currently open *and* the `view` is visible, do not\n      // bother the user with a notification on the corresponding button.\n      return;\n    }\n\n    switch (view) {\n      case SidebarView.OUTLINE:\n        this.outlineButton.classList.add(UI_NOTIFICATION_CLASS);\n        break;\n      case SidebarView.ATTACHMENTS:\n        this.attachmentsButton.classList.add(UI_NOTIFICATION_CLASS);\n        break;\n    }\n  }\n\n  /**\n   * @private\n   */\n  _hideUINotification(view) {\n    if (this._disableNotification) {\n      return;\n    }\n\n    let removeNotification = (view) => {\n      switch (view) {\n        case SidebarView.OUTLINE:\n          this.outlineButton.classList.remove(UI_NOTIFICATION_CLASS);\n          break;\n        case SidebarView.ATTACHMENTS:\n          this.attachmentsButton.classList.remove(UI_NOTIFICATION_CLASS);\n          break;\n      }\n    };\n\n    if (!this.isOpen && view !== null) {\n      // Only hide the notifications when the sidebar is currently open,\n      // or when it is being reset (i.e. `view === null`).\n      return;\n    }\n    this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);\n\n    if (view !== null) {\n      removeNotification(view);\n      return;\n    }\n    for (view in SidebarView) { // Remove all sidebar notifications on reset.\n      removeNotification(SidebarView[view]);\n    }\n\n    this.l10n.get('toggle_sidebar.title', null, 'Toggle Sidebar').\n        then((msg) => {\n      this.toggleButton.title = msg;\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    // 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    // Disable/enable views.\n    this.eventBus.on('outlineloaded', (evt) => {\n      let outlineCount = evt.outlineCount;\n\n      this.outlineButton.disabled = !outlineCount;\n\n      if (outlineCount) {\n        this._showUINotification(SidebarView.OUTLINE);\n      } else if (this.active === SidebarView.OUTLINE) {\n        // If the outline view was opened during document load, switch away\n        // from it if it turns out that the document has no outline.\n        this.switchView(SidebarView.THUMBS);\n      }\n    });\n\n    this.eventBus.on('attachmentsloaded', (evt) => {\n      if (evt.attachmentsCount) {\n        this.attachmentsButton.disabled = false;\n\n        this._showUINotification(SidebarView.ATTACHMENTS);\n        return;\n      }\n\n      // Attempt to avoid temporarily disabling, and switching away from, the\n      // attachment view for documents that do not contain proper attachments\n      // but *only* FileAttachment annotations. Hence we defer those operations\n      // slightly to allow time for parsing any FileAttachment annotations that\n      // may be present on the *initially* rendered page of the document.\n      Promise.resolve().then(() => {\n        if (this.attachmentsView.hasChildNodes()) {\n          // FileAttachment annotations were appended to the attachment view.\n          return;\n        }\n        this.attachmentsButton.disabled = true;\n\n        if (this.active === SidebarView.ATTACHMENTS) {\n          // If the attachment view was opened during document load, switch away\n          // from it if it turns out that the document has no attachments.\n          this.switchView(SidebarView.THUMBS);\n        }\n      });\n    });\n\n    // Update the thumbnailViewer, if visible, when exiting presentation mode.\n    this.eventBus.on('presentationmodechanged', (evt) => {\n      if (!evt.active && !evt.switchInProgress && this.isThumbnailViewVisible) {\n        this._updateThumbnailViewer();\n      }\n    });\n  }\n}\n\nexport {\n  SidebarView,\n  PDFSidebar,\n};\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 - (optional) The method that, if\n   *                   present, calls `OverlayManager.close` from the object\n   *                   registering the overlay. Access to this method is\n   *                   necessary in order to run cleanup code when e.g.\n   *                   the overlay is force closed. The default is `null`.\n   * @param {boolean} canForceClose - (optional) Indicates if opening the\n   *                  overlay closes 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(name, element, callerCloseMethod = null,\n                 canForceClose = false) {\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 === 27) { // Esc key.\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 {\n  OverlayManager,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullL10n } from './ui_utils';\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   */\n  constructor(options, overlayManager, l10n = NullL10n) {\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\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 === 13) { // Enter key\n        this.verify();\n      }\n    });\n\n    this.overlayManager.register(this.overlayName, this.container,\n                                 this.close.bind(this), true);\n  }\n\n  open() {\n    this.overlayManager.open(this.overlayName).then(() => {\n      this.input.focus();\n\n      let promptString;\n      if (this.reason === PasswordResponses.INCORRECT_PASSWORD) {\n        promptString = this.l10n.get('password_invalid', null,\n          'Invalid password. Please try again.');\n      } else {\n        promptString = this.l10n.get('password_label', null,\n          'Enter the password to open this PDF file.');\n      }\n\n      promptString.then((msg) => {\n        this.label.textContent = msg;\n      });\n    });\n  }\n\n  close() {\n    this.overlayManager.close(this.overlayName).then(() => {\n      this.input.value = '';\n    });\n  }\n\n  verify() {\n    let password = this.input.value;\n    if (password && 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 {\n  PasswordPrompt,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  createObjectURL, createPromiseCapability, getFilenameFromUrl,\n  removeNullCharacters\n} from 'pdfjs-lib';\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 {\n  /**\n   * @param {PDFAttachmentViewerOptions} options\n   */\n  constructor({ container, eventBus, downloadManager, }) {\n    this.container = container;\n    this.eventBus = eventBus;\n    this.downloadManager = downloadManager;\n\n    this.reset();\n\n    this.eventBus.on('fileattachmentannotation',\n      this._appendAttachment.bind(this));\n  }\n\n  reset(keepRenderedCapability = false) {\n    this.attachments = null;\n\n    // Remove the attachments from the DOM.\n    this.container.textContent = '';\n\n    if (!keepRenderedCapability) {\n      // NOTE: The *only* situation in which the `_renderedCapability` should\n      //       not be replaced is when appending file attachment annotations.\n      this._renderedCapability = createPromiseCapability();\n    }\n  }\n\n  /**\n   * @private\n   */\n  _dispatchEvent(attachmentsCount) {\n    this._renderedCapability.resolve();\n\n    this.eventBus.dispatch('attachmentsloaded', {\n      source: this,\n      attachmentsCount,\n    });\n  }\n\n  /**\n   * @private\n   */\n  _bindPdfLink(button, content, filename) {\n    if (this.downloadManager.disableCreateObjectURL) {\n      throw new Error(\n        'bindPdfLink: Unsupported \"disableCreateObjectURL\" value.');\n    }\n    let blobUrl;\n    button.onclick = function() {\n      if (!blobUrl) {\n        blobUrl = createObjectURL(content, 'application/pdf');\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        // eslint-disable-next-line no-undef\n        viewerUrl = chrome.runtime.getURL('/content/web/viewer.html') +\n          '?file=' + encodeURIComponent(blobUrl + '#' + filename);\n      } else if (PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n        // Let Firefox's content handler catch the URL and display the PDF.\n        viewerUrl = blobUrl + '?' + encodeURIComponent(filename);\n      }\n      window.open(viewerUrl);\n      return false;\n    };\n  }\n\n  /**\n   * @private\n   */\n  _bindLink(button, content, filename) {\n    button.onclick = () => {\n      this.downloadManager.downloadData(content, filename, '');\n      return false;\n    };\n  }\n\n  /**\n   * @param {PDFAttachmentViewerRenderParameters} params\n   */\n  render({ attachments, keepRenderedCapability = false, }) {\n    let attachmentsCount = 0;\n\n    if (this.attachments) {\n      this.reset(keepRenderedCapability === true);\n    }\n    this.attachments = attachments || null;\n\n    if (!attachments) {\n      this._dispatchEvent(attachmentsCount);\n      return;\n    }\n\n    let names = Object.keys(attachments).sort(function(a, b) {\n      return a.toLowerCase().localeCompare(b.toLowerCase());\n    });\n    attachmentsCount = names.length;\n\n    for (let i = 0; i < attachmentsCount; i++) {\n      let item = attachments[names[i]];\n      let filename = removeNullCharacters(getFilenameFromUrl(item.filename));\n\n      let div = document.createElement('div');\n      div.className = 'attachmentsItem';\n      let button = document.createElement('button');\n      button.textContent = filename;\n      if (/\\.pdf$/i.test(filename) &&\n          !this.downloadManager.disableCreateObjectURL) {\n        this._bindPdfLink(button, item.content, filename);\n      } else {\n        this._bindLink(button, item.content, filename);\n      }\n\n      div.appendChild(button);\n      this.container.appendChild(div);\n    }\n\n    this._dispatchEvent(attachmentsCount);\n  }\n\n  /**\n   * Used to append FileAttachment annotations to the sidebar.\n   * @private\n   */\n  _appendAttachment({ id, filename, content, }) {\n    this._renderedCapability.promise.then(() => {\n      let attachments = this.attachments;\n\n      if (!attachments) {\n        attachments = Object.create(null);\n      } else {\n        for (let 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 {\n  PDFAttachmentViewer,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPromiseCapability, PDFDateString } from 'pdfjs-lib';\nimport {\n  getPageSizeInches, getPDFFileNameFromURL, isPortraitOrientation, NullL10n\n} from './ui_utils';\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({ overlayName, fields, container, closeButton, },\n              overlayManager, eventBus, l10n = NullL10n) {\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\n    if (closeButton) { // Bind the event listener for the Close button.\n      closeButton.addEventListener('click', this.close.bind(this));\n    }\n    this.overlayManager.register(this.overlayName, this.container,\n                                 this.close.bind(this));\n\n    if (eventBus) {\n      eventBus.on('pagechanging', (evt) => {\n        this._currentPageNumber = evt.pageNumber;\n      });\n      eventBus.on('rotationchanging', (evt) => {\n        this._pagesRotation = evt.pagesRotation;\n      });\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  open() {\n    let 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    Promise.all([this.overlayManager.open(this.overlayName),\n                 this._dataAvailableCapability.promise]).then(() => {\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 (this.fieldData &&\n          currentPageNumber === this.fieldData['_currentPageNumber'] &&\n          pagesRotation === this.fieldData['_pagesRotation']) {\n        this._updateUI();\n        return;\n      }\n\n      // Get the document properties.\n      this.pdfDocument.getMetadata().then(\n          ({ info, metadata, contentDispositionFilename, }) => {\n        return Promise.all([\n          info,\n          metadata,\n          contentDispositionFilename || getPDFFileNameFromURL(this.url || ''),\n          this._parseFileSize(this.maybeFileSize),\n          this._parseDate(info.CreationDate),\n          this._parseDate(info.ModDate),\n          this.pdfDocument.getPage(currentPageNumber).then((pdfPage) => {\n            return this._parsePageSize(getPageSizeInches(pdfPage),\n                                       pagesRotation);\n          }),\n          this._parseLinearization(info.IsLinearized),\n        ]);\n      }).then(([info, metadata, fileName, fileSize, creationDate, modDate,\n                pageSize, isLinearized]) => {\n        freezeFieldData({\n          'fileName': fileName,\n          'fileSize': fileSize,\n          'title': info.Title,\n          'author': info.Author,\n          'subject': info.Subject,\n          'keywords': info.Keywords,\n          'creationDate': creationDate,\n          'modificationDate': modDate,\n          'creator': info.Creator,\n          'producer': info.Producer,\n          'version': info.PDFFormatVersion,\n          'pageCount': this.pdfDocument.numPages,\n          'pageSize': 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 set (if\n        // `this.setFileSize` wasn't called) or may be incorrectly set.\n        return this.pdfDocument.getDownloadInfo();\n      }).then(({ length, }) => {\n        this.maybeFileSize = length;\n        return this._parseFileSize(length);\n      }).then((fileSize) => {\n        if (fileSize === this.fieldData['fileSize']) {\n          return; // The fileSize has already been correctly set.\n        }\n        let data = Object.assign(Object.create(null), this.fieldData);\n        data['fileSize'] = fileSize;\n\n        freezeFieldData(data);\n        this._updateUI();\n      });\n    });\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   * Set the file size of the PDF document. This method is used to\n   * update the file size in the document properties overlay once it\n   * is known so we do not have to wait until the entire file is loaded.\n   *\n   * @param {number} fileSize - The file size of the PDF document.\n   */\n  setFileSize(fileSize) {\n    if (Number.isInteger(fileSize) && fileSize > 0) {\n      this.maybeFileSize = fileSize;\n    }\n  }\n\n  /**\n   * @private\n   */\n  _reset() {\n    this.pdfDocument = null;\n    this.url = null;\n\n    this.maybeFileSize = 0;\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 (let 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 (let id in this.fields) {\n      let content = this.fieldData[id];\n      this.fields[id].textContent = (content || content === 0) ?\n                                    content : DEFAULT_FIELD_CONTENT;\n    }\n  }\n\n  /**\n   * @private\n   */\n  async _parseFileSize(fileSize = 0) {\n    let kb = fileSize / 1024;\n    if (!kb) {\n      return undefined;\n    } else if (kb < 1024) {\n      return this.l10n.get('document_properties_kb', {\n        size_kb: (+kb.toPrecision(3)).toLocaleString(),\n        size_b: fileSize.toLocaleString(),\n      }, '{{size_kb}} KB ({{size_b}} bytes)');\n    }\n    return this.l10n.get('document_properties_mb', {\n      size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(),\n      size_b: fileSize.toLocaleString(),\n    }, '{{size_mb}} MB ({{size_b}} bytes)');\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 pageName = null;\n    let name = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) ||\n               getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);\n\n    if (!name && !(Number.isInteger(sizeMillimeters.width) &&\n                   Number.isInteger(sizeMillimeters.height))) {\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 (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 &&\n          Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) {\n\n        name = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);\n        if (name) {\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    if (name) {\n      pageName = this.l10n.get('document_properties_page_size_name_' +\n                               name.toLowerCase(), null, name);\n    }\n\n    return Promise.all([\n      (this._isNonMetricLocale ? sizeInches : sizeMillimeters),\n      this.l10n.get('document_properties_page_size_unit_' +\n                    (this._isNonMetricLocale ? 'inches' : 'millimeters'), null,\n                    this._isNonMetricLocale ? 'in' : 'mm'),\n      pageName,\n      this.l10n.get('document_properties_page_size_orientation_' +\n                    (isPortrait ? 'portrait' : 'landscape'), null,\n                    isPortrait ? 'portrait' : 'landscape'),\n    ]).then(([{ width, height, }, unit, name, orientation]) => {\n      return this.l10n.get('document_properties_page_size_dimension_' +\n                           (name ? 'name_' : '') + 'string', {\n          width: width.toLocaleString(),\n          height: height.toLocaleString(),\n          unit,\n          name,\n          orientation,\n        }, '{{width}} × {{height}} {{unit}} (' +\n           (name ? '{{name}}, ' : '') + '{{orientation}})');\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      }, '{{date}}, {{time}}');\n  }\n\n  /**\n   * @private\n   */\n  _parseLinearization(isLinearized) {\n    return this.l10n.get('document_properties_linearized_' +\n                         (isLinearized ? 'yes' : 'no'), null,\n                         (isLinearized ? 'Yes' : 'No'));\n  }\n}\n\nexport {\n  PDFDocumentProperties,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getGlobalEventBus, NullL10n } from './ui_utils';\nimport { FindState } from './pdf_find_controller';\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 = getGlobalEventBus(), l10n = NullL10n) {\n    this.opened = false;\n\n    this.bar = options.bar || null;\n    this.toggleButton = options.toggleButton || null;\n    this.findField = options.findField || null;\n    this.highlightAll = options.highlightAllCheckbox || null;\n    this.caseSensitive = options.caseSensitiveCheckbox || null;\n    this.entireWord = options.entireWordCheckbox || null;\n    this.findMsg = options.findMsg || null;\n    this.findResultsCount = options.findResultsCount || null;\n    this.findPreviousButton = options.findPreviousButton || null;\n    this.findNextButton = options.findNextButton || null;\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 notFound = false;\n    let findMsg = '';\n    let status = '';\n\n    switch (state) {\n      case FindState.FOUND:\n        break;\n\n      case FindState.PENDING:\n        status = 'pending';\n        break;\n\n      case FindState.NOT_FOUND:\n        findMsg = this.l10n.get('find_not_found', null, 'Phrase not found');\n        notFound = true;\n        break;\n\n      case FindState.WRAPPED:\n        if (previous) {\n          findMsg = this.l10n.get('find_reached_top', null,\n            'Reached top of document, continued from bottom');\n        } else {\n          findMsg = this.l10n.get('find_reached_bottom', null,\n            'Reached end of document, continued from top');\n        }\n        break;\n    }\n\n    this.findField.classList.toggle('notFound', notFound);\n    this.findField.setAttribute('data-status', status);\n\n    Promise.resolve(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    if (!this.findResultsCount) {\n      return; // No UI control is provided.\n    }\n    let matchesCountMsg = '', limit = MATCHES_COUNT_LIMIT;\n\n    if (total > 0) {\n      if (total > limit) {\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          matchesCountMsg = this.l10n.get('find_match_count_limit[other]', {\n            limit,\n          }, 'More than {{limit}} matches');\n        } else {\n          matchesCountMsg = this.l10n.get('find_match_count_limit', {\n            limit,\n          }, 'More than {{limit}} match' + (limit !== 1 ? 'es' : ''));\n        }\n      } else {\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          matchesCountMsg = this.l10n.get('find_match_count[other]', {\n            current,\n            total,\n          }, '{{current}} of {{total}} matches');\n        } else {\n          matchesCountMsg = this.l10n.get('find_match_count', {\n            current,\n            total,\n          }, '{{current}} of {{total}} match' + (total !== 1 ? 'es' : ''));\n        }\n      }\n    }\n    Promise.resolve(matchesCountMsg).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.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.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    let findbarHeight = this.bar.clientHeight;\n    let 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 {\n  PDFFindBar,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getGlobalEventBus, scrollIntoView } from './ui_utils';\nimport { createPromiseCapability } from 'pdfjs-lib';\nimport { getCharacterType } from './pdf_find_utils';\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  '\\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  return text.replace(normalizationRegex, function(ch) {\n    return CHARACTERS_TO_NORMALIZE[ch];\n  });\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 = getGlobalEventBus(), }) {\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 (!this._pdfDocument ||\n          (pdfDocument && this._pdfDocument !== pdfDocument)) {\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({ element = null, pageIndex = -1, matchIndex = -1, }) {\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: MATCH_SCROLL_OFFSET_LEFT,\n    };\n    scrollIntoView(element, spot, /* skipOverflowHiddenElements = */ 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    this._selected = { // Currently selected match.\n      pageIdx: -1,\n      matchIdx: -1,\n    };\n    this._offset = { // Where the find algorithm currently is in the document.\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._matchesCountTotal = 0;\n    this._pagesToSearch = null;\n    this._pendingFindMatches = Object.create(null);\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   * @return {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 (pageNumber >= 1 && pageNumber <= linkService.pagesCount &&\n            pageNumber !== linkService.page &&\n            !linkService.isPageVisible(pageNumber)) {\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(matchesWithLength, currentIndex) {\n      const currentElem = matchesWithLength[currentIndex];\n      const nextElem = matchesWithLength[currentIndex + 1];\n\n      // Check for cases like \"TAMEd TAME\".\n      if (currentIndex < matchesWithLength.length - 1 &&\n          currentElem.match === nextElem.match) {\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 (prevElem.match + prevElem.matchLength >=\n            currentElem.match + currentElem.matchLength) {\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 ? a.matchLength - b.matchLength :\n                                   a.match - b.match;\n    });\n    for (let i = 0, len = matchesWithLength.length; i < len; i++) {\n      if (isSubTerm(matchesWithLength, 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, entireWord) {\n    const matches = [];\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      matches.push(matchIdx);\n    }\n    this._pageMatches[pageIndex] = matches;\n  }\n\n  _calculateWordMatch(query, pageIndex, pageContent, 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 (entireWord &&\n            !this._isEntireWord(pageContent, matchIdx, subqueryLen)) {\n          continue;\n        }\n        // Other searches do not, so we store the length.\n        matchesWithLength.push({\n          match: matchIdx,\n          matchLength: subqueryLen,\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(matchesWithLength, this._pageMatches[pageIndex],\n      this._pageMatchesLength[pageIndex]);\n  }\n\n  _calculateMatch(pageIndex) {\n    let pageContent = this._pageContents[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(query, pageIndex, pageContent, entireWord);\n    } else {\n      this._calculateWordMatch(query, pageIndex, pageContent, entireWord);\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.getPage(i + 1).then((pdfPage) => {\n          return pdfPage.getTextContent({\n            normalizeWhitespace: true,\n          });\n        }).then((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] = normalize(strBuf.join(''));\n          extractTextCapability.resolve(i);\n        }, (reason) => {\n          console.error(`Unable to get text content for page ${i + 1}`, reason);\n          // Page error -- assuming no text content.\n          this._pageContents[i] = '';\n          extractTextCapability.resolve(i);\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[i] === true) {\n          continue;\n        }\n        this._pendingFindMatches[i] = true;\n        this._extractTextPromises[i].then((pageIdx) => {\n          delete this._pendingFindMatches[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 ((!previous && offset.matchIdx + 1 < numPageMatches) ||\n          (previous && offset.matchIdx > 0)) {\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 :\n                                      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 (!this._pdfDocument ||\n          (pdfDocument && this._pdfDocument !== pdfDocument)) {\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, total = this._matchesCountTotal;\n    if (matchIdx !== -1) {\n      for (let i = 0; i < pageIdx; i++) {\n        current += (this._pageMatches[i] && 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    });\n  }\n}\n\nexport {\n  FindState,\n  PDFFindController,\n};\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\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 (charCode >= /* a = */ 0x61 && charCode <= /* z = */ 0x7A) ||\n         (charCode >= /* A = */ 0x41 && charCode <= /* Z = */ 0x5A);\n}\n\nfunction isAsciiDigit(charCode) {\n  return (charCode >= /* 0 = */ 0x30 && charCode <= /* 9 = */ 0x39);\n}\n\nfunction isAsciiSpace(charCode) {\n  return (charCode === /* SPACE = */ 0x20 || charCode === /* TAB = */ 0x09 ||\n          charCode === /* CR = */ 0x0D || charCode === /* LF = */ 0x0A);\n}\n\nfunction isHan(charCode) {\n  return (charCode >= 0x3400 && charCode <= 0x9FFF) ||\n         (charCode >= 0xF900 && charCode <= 0xFAFF);\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 (isAsciiAlpha(charCode) || isAsciiDigit(charCode) ||\n                 charCode === /* UNDERSCORE = */ 0x5F) {\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 {\n  CharacterType,\n  getCharacterType,\n};\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  getGlobalEventBus, isValidRotation, parseQueryString, waitOnEventOrTimeout\n} from './ui_utils';\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 - (optional) Reset the browsing history.\n * @property {boolean} updateUrl - (optional) Attempt to update the document\n *   URL, with the current hash, when pushing/replacing browser history entries.\n */\n\n/**\n * @typedef {Object} PushParameters\n * @property {string} namedDest - (optional) The named destination. If absent,\n *   a 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\nfunction parseCurrentHash(linkService) {\n  let hash = unescape(getCurrentHash()).substring(1);\n  let params = parseQueryString(hash);\n\n  let page = params.page | 0;\n  if (!(Number.isInteger(page) && page > 0 && page <= linkService.pagesCount)) {\n    page = null;\n  }\n  return { hash, page, rotation: linkService.rotation, };\n}\n\nclass PDFHistory {\n  /**\n   * @param {PDFHistoryOptions} options\n   */\n  constructor({ linkService, eventBus, }) {\n    this.linkService = linkService;\n    this.eventBus = eventBus || getGlobalEventBus();\n\n    this.initialized = false;\n    this.initialBookmark = null;\n    this.initialRotation = null;\n\n    this._boundEvents = Object.create(null);\n    this._isViewerInPresentationMode = false;\n    this._isPagesLoaded = false;\n\n    // Ensure that we don't miss either a 'presentationmodechanged' or a\n    // 'pagesloaded' event, by registering the listeners immediately.\n    this.eventBus.on('presentationmodechanged', (evt) => {\n      this._isViewerInPresentationMode = evt.active || evt.switchInProgress;\n    });\n    this.eventBus.on('pagesloaded', (evt) => {\n      this._isPagesLoaded = !!evt.pagesCount;\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      return;\n    }\n    let reInitialized = this.initialized && this.fingerprint !== fingerprint;\n    this.fingerprint = fingerprint;\n    this._updateUrl = (updateUrl === true);\n\n    if (!this.initialized) {\n      this._bindEvents();\n    }\n    let state = window.history.state;\n\n    this.initialized = true;\n    this.initialBookmark = null;\n    this.initialRotation = null;\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      let { hash, page, rotation, } = parseCurrentHash(this.linkService);\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({ hash, page, rotation, },\n                               /* forceReplace = */ true);\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    let destination = state.destination;\n    this._updateInternalState(destination, state.uid,\n                              /* removeTemporary = */ true);\n    if (this._uid > this._maxUid) {\n      this._maxUid = this._uid;\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   * 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('PDFHistory.push: ' +\n                    `\"${namedDest}\" is not a valid namedDest parameter.`);\n      return;\n    } else if (!Array.isArray(explicitDest)) {\n      console.error('PDFHistory.push: ' +\n                    `\"${explicitDest}\" is not a valid explicitDest parameter.`);\n      return;\n    } else if (!(Number.isInteger(pageNumber) &&\n                 pageNumber > 0 && pageNumber <= this.linkService.pagesCount)) {\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('PDFHistory.push: ' +\n                      `\"${pageNumber}\" is not a valid pageNumber parameter.`);\n        return;\n      }\n    }\n\n    let 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 (this._destination &&\n        (isDestHashesEqual(this._destination.hash, hash) ||\n         isDestArraysEqual(this._destination.dest, explicitDest))) {\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      dest: explicitDest,\n      hash,\n      page: pageNumber,\n      rotation: this.linkService.rotation,\n    }, forceReplace);\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 occuring when the new destination 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    let 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    let state = window.history.state;\n    if (this._isValidState(state) && state.uid < this._maxUid) {\n      window.history.forward();\n    }\n  }\n\n  /**\n   * @returns {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 this.initialized &&\n           (this._popStateInProgress || this._blockHashChange > 0);\n  }\n\n  /**\n   * @private\n   */\n  _pushOrReplaceState(destination, forceReplace = false) {\n    let shouldReplace = forceReplace || !this._destination;\n    let newState = {\n      fingerprint: this.fingerprint,\n      uid: shouldReplace ? this._uid : (this._uid + 1),\n      destination,\n    };\n\n    if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') &&\n        window.history.state && window.history.state.chromecomState) {\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 && destination.hash) {\n      const baseUrl = document.location.href.split('#')[0];\n      if (!baseUrl.startsWith('file://')) { // Prevent errors in Firefox.\n        newUrl = `${baseUrl}#${destination.hash}`;\n      }\n    }\n    if (shouldReplace) {\n      if (newUrl) {\n        window.history.replaceState(newState, '', newUrl);\n      } else {\n        window.history.replaceState(newState, '');\n      }\n    } else {\n      this._maxUid = this._uid;\n      if (newUrl) {\n        window.history.pushState(newState, '', newUrl);\n      } else {\n        window.history.pushState(newState, '');\n      }\n    }\n\n    if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') &&\n        top === window) {\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 (!this._destination.page &&\n        (POSITION_UPDATED_THRESHOLD <= 0 ||\n         this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) {\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 (this._destination.page >= position.first &&\n        this._destination.page <= position.page) {\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 || !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  _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 (typeof state.fingerprint !== 'string' ||\n            state.fingerprint.length !== this.fingerprint.length) {\n          return false;\n        }\n        const [perfEntry] = performance.getEntriesByType('navigation');\n        if (!perfEntry || 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 && 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 should always be reset when `this._destination` is updated.\n    this._numPositionUpdates = 0;\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}` : 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 (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded &&\n        this._destination && !this._destination.page) {\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    let newHash = getCurrentHash(), hashChanged = this._currentHash !== newHash;\n    this._currentHash = newHash;\n\n    if (!state ||\n        (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') &&\n         state.chromecomState && !this._isValidState(state))) {\n      // This case corresponds to the user changing the hash of the document.\n      this._uid++;\n\n      let { hash, page, rotation, } = parseCurrentHash(this.linkService);\n      this._pushOrReplaceState({ hash, page, rotation, },\n                               /* forceReplace = */ true);\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    let destination = state.destination;\n    this._updateInternalState(destination, state.uid,\n                              /* removeTemporary = */ true);\n    if (this._uid > this._maxUid) {\n      this._maxUid = this._uid;\n    }\n\n    if (isValidRotation(destination.rotation)) {\n      this.linkService.rotation = destination.rotation;\n    }\n    if (destination.dest) {\n      this.linkService.navigateTo(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.navigateTo` 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  _bindEvents() {\n    let { _boundEvents, eventBus, } = this;\n\n    _boundEvents.updateViewarea = this._updateViewarea.bind(this);\n    _boundEvents.popState = this._popState.bind(this);\n    _boundEvents.pageHide = (evt) => {\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    eventBus.on('updateviewarea', _boundEvents.updateViewarea);\n    window.addEventListener('popstate', _boundEvents.popState);\n    window.addEventListener('pagehide', _boundEvents.pageHide);\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  let { 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 (let 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 {\n  PDFHistory,\n  isDestHashesEqual,\n  isDestArraysEqual,\n};\n","/* Copyright 2015 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getGlobalEventBus, parseQueryString } from './ui_utils';\n\n/**\n * @typedef {Object} PDFLinkServiceOptions\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} externalLinkTarget - (optional) Specifies the `target`\n *   attribute for external links. Must use one of the values from {LinkTarget}.\n *   Defaults to using no target.\n * @property {string} externalLinkRel - (optional) Specifies the `rel` attribute\n *   for external links. Defaults to stripping the referrer.\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({ eventBus, externalLinkTarget = null,\n                externalLinkRel = null, } = {}) {\n    this.eventBus = eventBus || getGlobalEventBus();\n    this.externalLinkTarget = externalLinkTarget;\n    this.externalLinkRel = externalLinkRel;\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   * @returns {number}\n   */\n  get pagesCount() {\n    return this.pdfDocument ? this.pdfDocument.numPages : 0;\n  }\n\n  /**\n   * @returns {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   * @returns {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   * @param {string|Array} dest - The named, or explicit, PDF destination.\n   */\n  navigateTo(dest) {\n    let goToDestination = ({ namedDest, explicitDest, }) => {\n      // Dest array looks like that: <page-ref> </XYZ|/FitXXX> <args..>\n      let destRef = explicitDest[0], pageNumber;\n\n      if (destRef instanceof Object) {\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.getPageIndex(destRef).then((pageIndex) => {\n            this.cachePageRef(pageIndex + 1, destRef);\n            goToDestination({ namedDest, explicitDest, });\n          }).catch(() => {\n            console.error(`PDFLinkService.navigateTo: \"${destRef}\" is not ` +\n                          `a valid page reference, for dest=\"${dest}\".`);\n          });\n          return;\n        }\n      } else if (Number.isInteger(destRef)) {\n        pageNumber = destRef + 1;\n      } else {\n        console.error(`PDFLinkService.navigateTo: \"${destRef}\" is not ` +\n                      `a valid destination reference, for dest=\"${dest}\".`);\n        return;\n      }\n      if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n        console.error(`PDFLinkService.navigateTo: \"${pageNumber}\" is not ` +\n                      `a valid page number, for dest=\"${dest}\".`);\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      });\n    };\n\n    new Promise((resolve, reject) => {\n      if (typeof dest === 'string') {\n        this.pdfDocument.getDestination(dest).then((destArray) => {\n          resolve({\n            namedDest: dest,\n            explicitDest: destArray,\n          });\n        });\n        return;\n      }\n      resolve({\n        namedDest: '',\n        explicitDest: dest,\n      });\n    }).then((data) => {\n      if (!Array.isArray(data.explicitDest)) {\n        console.error(`PDFLinkService.navigateTo: \"${data.explicitDest}\" is` +\n                      ` not a valid destination array, for dest=\"${dest}\".`);\n        return;\n      }\n      goToDestination(data);\n    });\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      return this.getAnchorUrl('#' + escape(dest));\n    }\n    if (Array.isArray(dest)) {\n      let str = JSON.stringify(dest);\n      return this.getAnchorUrl('#' + escape(str));\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    let pageNumber, dest;\n    if (hash.includes('=')) {\n      let 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 ('nameddest' in params) {\n        this.navigateTo(params.nameddest);\n        return;\n      }\n      if ('page' in params) {\n        pageNumber = (params.page | 0) || 1;\n      }\n      if ('zoom' in params) {\n        // Build the destination array.\n        let zoomArgs = params.zoom.split(','); // scale,left,top\n        let zoomArg = zoomArgs[0];\n        let 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 = [null, { name: 'XYZ', },\n                  zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null,\n                  zoomArgs.length > 2 ? (zoomArgs[2] | 0) : null,\n                  (zoomArgNumber ? zoomArgNumber / 100 : zoomArg)];\n        } else {\n          if (zoomArg === 'Fit' || zoomArg === 'FitB') {\n            dest = [null, { name: zoomArg, }];\n          } else if ((zoomArg === 'FitH' || zoomArg === 'FitBH') ||\n                     (zoomArg === 'FitV' || zoomArg === 'FitBV')) {\n            dest = [null, { name: zoomArg, },\n                    zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null];\n          } else if (zoomArg === 'FitR') {\n            if (zoomArgs.length !== 5) {\n              console.error(\n                'PDFLinkService.setHash: Not enough parameters for \"FitR\".');\n            } else {\n              dest = [null, { name: zoomArg, },\n                      (zoomArgs[1] | 0), (zoomArgs[2] | 0),\n                      (zoomArgs[3] | 0), (zoomArgs[4] | 0)];\n            }\n          } else {\n            console.error(`PDFLinkService.setHash: \"${zoomArg}\" is not ` +\n                          'a valid zoom value.');\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    } else { // 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.navigateTo(dest);\n        return;\n      }\n      console.error(`PDFLinkService.setHash: \"${unescape(hash)}\" is not ` +\n                    'a valid destination.');\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        if (this.page < this.pagesCount) {\n          this.page++;\n        }\n        break;\n\n      case 'PrevPage':\n        if (this.page > 1) {\n          this.page--;\n        }\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    let refStr = pageRef.num + ' ' + pageRef.gen + ' R';\n    this._pagesRefCache[refStr] = pageNum;\n  }\n\n  _cachedPageNumber(pageRef) {\n    let refStr = pageRef.num + ' ' + pageRef.gen + ' R';\n    return (this._pagesRefCache && this._pagesRefCache[refStr]) || null;\n  }\n\n  /**\n   * @param {number} pageNumber\n   */\n  isPageVisible(pageNumber) {\n    return this.pdfViewer.isPageVisible(pageNumber);\n  }\n}\n\nfunction isValidExplicitDestination(dest) {\n  if (!Array.isArray(dest)) {\n    return false;\n  }\n  let destLength = dest.length, allowNull = true;\n  if (destLength < 2) {\n    return false;\n  }\n  let page = dest[0];\n  if (!(typeof page === 'object' &&\n        Number.isInteger(page.num) && Number.isInteger(page.gen)) &&\n      !(Number.isInteger(page) && page >= 0)) {\n    return false;\n  }\n  let zoom = dest[1];\n  if (!(typeof zoom === 'object' && typeof zoom.name === 'string')) {\n    return false;\n  }\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    let 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  }\n\n  /**\n   * @returns {number}\n   */\n  get pagesCount() {\n    return 0;\n  }\n\n  /**\n   * @returns {number}\n   */\n  get page() {\n    return 0;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set page(value) {}\n\n  /**\n   * @returns {number}\n   */\n  get rotation() {\n    return 0;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set rotation(value) {}\n\n  /**\n   * @param dest - The PDF destination object.\n   */\n  navigateTo(dest) {}\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\nexport {\n  PDFLinkService,\n  SimpleLinkService,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { addLinkAttributes, LinkTarget, removeNullCharacters } from 'pdfjs-lib';\n\nconst DEFAULT_TITLE = '\\u2013';\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 */\n\nclass PDFOutlineViewer {\n  /**\n   * @param {PDFOutlineViewerOptions} options\n   */\n  constructor({ container, linkService, eventBus, }) {\n    this.container = container;\n    this.linkService = linkService;\n    this.eventBus = eventBus;\n\n    this.reset();\n\n    eventBus.on('toggleoutlinetree', this.toggleOutlineTree.bind(this));\n  }\n\n  reset() {\n    this.outline = null;\n    this.lastToggleIsShow = true;\n\n    // Remove the outline from the DOM.\n    this.container.textContent = '';\n\n    // Ensure that the left (right in RTL locales) margin is always reset,\n    // to prevent incorrect outline alignment if a new document is opened.\n    this.container.classList.remove('outlineWithDeepNesting');\n  }\n\n  /**\n   * @private\n   */\n  _dispatchEvent(outlineCount) {\n    this.eventBus.dispatch('outlineloaded', {\n      source: this,\n      outlineCount,\n    });\n  }\n\n  /**\n   * @private\n   */\n  _bindLink(element, { url, newWindow, dest, }) {\n    let { linkService, } = this;\n\n    if (url) {\n      addLinkAttributes(element, {\n        url,\n        target: (newWindow ? LinkTarget.BLANK : linkService.externalLinkTarget),\n        rel: linkService.externalLinkRel,\n      });\n      return;\n    }\n\n    element.href = linkService.getDestinationHash(dest);\n    element.onclick = () => {\n      if (dest) {\n        linkService.navigateTo(dest);\n      }\n      return false;\n    };\n  }\n\n  /**\n   * @private\n   */\n  _setStyles(element, { bold, italic, }) {\n    let styleStr = '';\n    if (bold) {\n      styleStr += 'font-weight: bold;';\n    }\n    if (italic) {\n      styleStr += 'font-style: italic;';\n    }\n\n    if (styleStr) {\n      element.setAttribute('style', styleStr);\n    }\n  }\n\n  /**\n   * Prepend a button before an outline item which allows the user to toggle\n   * the visibility of all outline items at that level.\n   *\n   * @private\n   */\n  _addToggleButton(div, { count, items, }) {\n    let toggler = document.createElement('div');\n    toggler.className = 'outlineItemToggler';\n    if (count < 0 && Math.abs(count) === items.length) {\n      toggler.classList.add('outlineItemsHidden');\n    }\n    toggler.onclick = (evt) => {\n      evt.stopPropagation();\n      toggler.classList.toggle('outlineItemsHidden');\n\n      if (evt.shiftKey) {\n        let shouldShowAll = !toggler.classList.contains('outlineItemsHidden');\n        this._toggleOutlineItem(div, shouldShowAll);\n      }\n    };\n    div.insertBefore(toggler, div.firstChild);\n  }\n\n  /**\n   * Toggle the visibility of the subtree of an outline item.\n   *\n   * @param {Element} root - the root of the outline (sub)tree.\n   * @param {boolean} show - whether to show the outline (sub)tree. If false,\n   *   the outline subtree rooted at |root| will be collapsed.\n   *\n   * @private\n   */\n  _toggleOutlineItem(root, show = false) {\n    this.lastToggleIsShow = show;\n    for (const toggler of root.querySelectorAll('.outlineItemToggler')) {\n      toggler.classList.toggle('outlineItemsHidden', !show);\n    }\n  }\n\n  /**\n   * Collapse or expand all subtrees of the outline.\n   */\n  toggleOutlineTree() {\n    if (!this.outline) {\n      return;\n    }\n    this._toggleOutlineItem(this.container, !this.lastToggleIsShow);\n  }\n\n  /**\n   * @param {PDFOutlineViewerRenderParameters} params\n   */\n  render({ outline, }) {\n    let outlineCount = 0;\n\n    if (this.outline) {\n      this.reset();\n    }\n    this.outline = outline || null;\n\n    if (!outline) {\n      this._dispatchEvent(outlineCount);\n      return;\n    }\n\n    let fragment = document.createDocumentFragment();\n    let queue = [{ parent: fragment, items: this.outline, }];\n    let hasAnyNesting = false;\n    while (queue.length > 0) {\n      const levelData = queue.shift();\n      for (const item of levelData.items) {\n        let div = document.createElement('div');\n        div.className = 'outlineItem';\n\n        let element = document.createElement('a');\n        this._bindLink(element, item);\n        this._setStyles(element, item);\n        element.textContent =\n          removeNullCharacters(item.title) || DEFAULT_TITLE;\n\n        div.appendChild(element);\n\n        if (item.items.length > 0) {\n          hasAnyNesting = true;\n          this._addToggleButton(div, item);\n\n          let itemsDiv = document.createElement('div');\n          itemsDiv.className = 'outlineItems';\n          div.appendChild(itemsDiv);\n          queue.push({ parent: itemsDiv, items: item.items, });\n        }\n\n        levelData.parent.appendChild(div);\n        outlineCount++;\n      }\n    }\n    if (hasAnyNesting) {\n      this.container.classList.add('outlineWithDeepNesting');\n\n      this.lastToggleIsShow =\n        (fragment.querySelectorAll('.outlineItemsHidden').length === 0);\n    }\n\n    this.container.appendChild(fragment);\n\n    this._dispatchEvent(outlineCount);\n  }\n}\n\nexport {\n  PDFOutlineViewer,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { normalizeWheelEventDelta } from './ui_utils';\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 {HTMLDivElement} viewer - (optional) The viewer element.\n * @property {PDFViewer} pdfViewer - The document viewer.\n * @property {EventBus} eventBus - The application event bus.\n * @property {Array} contextMenuItems - (optional) The menu items that are added\n *   to the context menu in Presentation Mode.\n */\n\nclass PDFPresentationMode {\n  /**\n   * @param {PDFPresentationModeOptions} options\n   */\n  constructor({ container, viewer = null, pdfViewer, eventBus,\n                contextMenuItems = null, }) {\n    this.container = container;\n    this.viewer = viewer || container.firstElementChild;\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    if (contextMenuItems) {\n      contextMenuItems.contextFirstPage.addEventListener('click', () => {\n        this.contextMenuOpen = false;\n        this.eventBus.dispatch('firstpage', { source: this, });\n      });\n      contextMenuItems.contextLastPage.addEventListener('click', () => {\n        this.contextMenuOpen = false;\n        this.eventBus.dispatch('lastpage', { source: this, });\n      });\n      contextMenuItems.contextPageRotateCw.addEventListener('click', () => {\n        this.contextMenuOpen = false;\n        this.eventBus.dispatch('rotatecw', { source: this, });\n      });\n      contextMenuItems.contextPageRotateCcw.addEventListener('click', () => {\n        this.contextMenuOpen = false;\n        this.eventBus.dispatch('rotateccw', { source: this, });\n      });\n    }\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.viewer.hasChildNodes()) {\n      return false;\n    }\n    this._addFullscreenChangeListeners();\n    this._setSwitchInProgress();\n    this._notifyStateChange();\n\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 if (this.container.msRequestFullscreen) {\n      this.container.msRequestFullscreen();\n    } else {\n      return false;\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    let delta = normalizeWheelEventDelta(evt);\n    let currentTime = (new Date()).getTime();\n    let storedTime = this.mouseScrollTimeStamp;\n\n    // If we've already switched page, avoid accidentally switching again.\n    if (currentTime > storedTime &&\n        currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) {\n      return;\n    }\n    // If the scroll direction changed, reset the accumulated scroll delta.\n    if ((this.mouseScrollDelta > 0 && delta < 0) ||\n        (this.mouseScrollDelta < 0 && delta > 0)) {\n      this._resetMouseScrollState();\n    }\n    this.mouseScrollDelta += delta;\n\n    if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {\n      let totalDelta = this.mouseScrollDelta;\n      this._resetMouseScrollState();\n      let success = totalDelta > 0 ? this._goToPreviousPage()\n                                   : this._goToNextPage();\n      if (success) {\n        this.mouseScrollTimeStamp = currentTime;\n      }\n    }\n  }\n\n  get isFullscreen() {\n    return !!(document.fullscreenElement || document.mozFullScreen ||\n              document.webkitIsFullScreen || document.msFullscreenElement);\n  }\n\n  /**\n   * @private\n   */\n  _goToPreviousPage() {\n    let page = this.pdfViewer.currentPageNumber;\n    // If we're at the first page, we don't need to do anything.\n    if (page <= 1) {\n      return false;\n    }\n    this.pdfViewer.currentPageNumber = (page - 1);\n    return true;\n  }\n\n  /**\n   * @private\n   */\n  _goToNextPage() {\n    let page = this.pdfViewer.currentPageNumber;\n    // If we're at the last page, we don't need to do anything.\n    if (page >= this.pdfViewer.pagesCount) {\n      return false;\n    }\n    this.pdfViewer.currentPageNumber = (page + 1);\n    return true;\n  }\n\n  /**\n   * @private\n   */\n  _notifyStateChange() {\n    this.eventBus.dispatch('presentationmodechanged', {\n      source: this,\n      active: this.active,\n      switchInProgress: !!this.switchInProgress,\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    this.container.setAttribute('contextmenu', 'viewerContextMenu');\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    let 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.container.removeAttribute('contextmenu');\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      let isInternalLink = (evt.target.href &&\n                            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._goToPreviousPage();\n        } else {\n          this._goToNextPage();\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        let dx = this.touchSwipeState.endX - this.touchSwipeState.startX;\n        let dy = this.touchSwipeState.endY - this.touchSwipeState.startY;\n        let absAngle = Math.abs(Math.atan2(dy, dx));\n        if (Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD &&\n            (absAngle <= SWIPE_ANGLE_THRESHOLD ||\n             absAngle >= (Math.PI - SWIPE_ANGLE_THRESHOLD))) {\n          // Horizontal swipe.\n          delta = dx;\n        } else if (Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD &&\n            Math.abs(absAngle - (Math.PI / 2)) <= SWIPE_ANGLE_THRESHOLD) {\n          // Vertical swipe.\n          delta = dy;\n        }\n        if (delta > 0) {\n          this._goToPreviousPage();\n        } else if (delta < 0) {\n          this._goToNextPage();\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);\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    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    window.addEventListener('mozfullscreenchange', this.fullscreenChangeBind);\n    if (typeof PDFJSDev === 'undefined' ||\n        !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n      window.addEventListener('webkitfullscreenchange',\n                              this.fullscreenChangeBind);\n      window.addEventListener('MSFullscreenChange',\n                              this.fullscreenChangeBind);\n    }\n  }\n\n  /**\n   * @private\n   */\n  _removeFullscreenChangeListeners() {\n    window.removeEventListener('fullscreenchange', this.fullscreenChangeBind);\n    window.removeEventListener('mozfullscreenchange',\n                               this.fullscreenChangeBind);\n    if (typeof PDFJSDev === 'undefined' ||\n        !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n      window.removeEventListener('webkitfullscreenchange',\n                                 this.fullscreenChangeBind);\n      window.removeEventListener('MSFullscreenChange',\n                                 this.fullscreenChangeBind);\n    }\n\n    delete this.fullscreenChangeBind;\n  }\n}\n\nexport {\n  PDFPresentationMode,\n};\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullL10n } from './ui_utils';\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 = NullL10n) {\n    this.enabled = false;\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    this.l10n = l10n;\n\n    if (typeof CSS === 'undefined' || typeof CSS.supports !== 'function' ||\n        !CSS.supports(SIDEBAR_WIDTH_VAR, `calc(-1 * ${SIDEBAR_MIN_WIDTH}px)`)) {\n      console.warn('PDFSidebarResizer: ' +\n                   'The browser does not support resizing of the sidebar.');\n      return;\n    }\n    this.enabled = true;\n    this.resizer.classList.remove('hidden'); // Show the resizer DOM element.\n\n    this.l10n.getDirection().then((dir) => {\n      this.isRTL = (dir === 'rtl');\n    });\n    this._addEventListeners();\n  }\n\n  /**\n   * returns {number}\n   */\n  get outerContainerWidth() {\n    if (!this._outerContainerWidth) {\n      this._outerContainerWidth = this.outerContainer.clientWidth;\n    }\n    return this._outerContainerWidth;\n  }\n\n  /**\n   * @private\n   * returns {boolean} Indicating if the sidebar width was updated.\n   */\n  _updateWidth(width = 0) {\n    if (!this.enabled) {\n      return false;\n    }\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    let _boundEvents = this._boundEvents;\n    window.removeEventListener('mousemove', _boundEvents.mouseMove);\n    window.removeEventListener('mouseup', _boundEvents.mouseUp);\n  }\n\n  /**\n   * @private\n   */\n  _addEventListeners() {\n    if (!this.enabled) {\n      return;\n    }\n    let _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 && 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 && evt.source === window) {\n        // Always reset the cached width when the viewer is resized.\n        this._outerContainerWidth = null;\n\n        if (this._width) {\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.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n            let 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          } else {\n            this._updateWidth(this._width);\n          }\n        }\n      }\n    });\n  }\n}\n\nexport {\n  PDFSidebarResizer,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  getVisibleElements, isValidRotation, NullL10n, scrollIntoView, watchScroll\n} from './ui_utils';\nimport { PDFThumbnailView } from './pdf_thumbnail_view';\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 {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, linkService, renderingQueue, l10n = NullL10n, }) {\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\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(this.container, this._thumbnails);\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    let visibleThumbs = this._getVisibleThumbs();\n    let numVisibleThumbs = visibleThumbs.views.length;\n\n    // If the thumbnail isn't currently visible, scroll it into view.\n    if (numVisibleThumbs > 0) {\n      let first = visibleThumbs.first.id;\n      // Account for only one thumbnail being visible.\n      let 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    PDFThumbnailView.cleanup();\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._pagesRequests = [];\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\n    pdfDocument.getPage(1).then((firstPage) => {\n      let pagesCount = pdfDocument.numPages;\n      let viewport = firstPage.getViewport({ scale: 1, });\n      for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n        let thumbnail = new PDFThumbnailView({\n          container: this.container,\n          id: pageNum,\n          defaultViewport: viewport.clone(),\n          linkService: this.linkService,\n          renderingQueue: this.renderingQueue,\n          disableCanvasToImageConversion: false,\n          l10n: this.l10n,\n        });\n        this._thumbnails.push(thumbnail);\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    }).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 (!(Array.isArray(labels) &&\n                 this.pdfDocument.numPages === labels.length)) {\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      let label = this._pageLabels && this._pageLabels[i];\n      this._thumbnails[i].setPageLabel(label);\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    let pageNumber = thumbView.id;\n    if (this._pagesRequests[pageNumber]) {\n      return this._pagesRequests[pageNumber];\n    }\n    let promise = this.pdfDocument.getPage(pageNumber).then((pdfPage) => {\n      thumbView.setPdfPage(pdfPage);\n      this._pagesRequests[pageNumber] = null;\n      return pdfPage;\n    }).catch((reason) => {\n      console.error('Unable to get page for thumb view', reason);\n      // Page error -- there is nothing can be done.\n      this._pagesRequests[pageNumber] = null;\n    });\n    this._pagesRequests[pageNumber] = promise;\n    return promise;\n  }\n\n  forceRendering() {\n    let visibleThumbs = this._getVisibleThumbs();\n    let thumbView = this.renderingQueue.getHighestPriority(visibleThumbs,\n                                                           this._thumbnails,\n                                                           this.scroll.down);\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 {\n  PDFThumbnailViewer,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  createPromiseCapability, RenderingCancelledException\n} from 'pdfjs-lib';\nimport { getOutputScale, NullL10n } from './ui_utils';\nimport { RenderingStates } from './pdf_rendering_queue';\n\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 {IPDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {boolean} disableCanvasToImageConversion - (optional) Don't convert\n *   the canvas thumbnails to images. This prevents `toDataURL` calls,\n *   but increases the overall memory usage. The default value is `false`.\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 (typeof PDFJSDev === 'undefined' ||\n          PDFJSDev.test('MOZCENTRAL || FIREFOX || GENERIC')) {\n        tempCanvas.mozOpaque = true;\n      }\n\n      let 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;\n    },\n\n    destroyCanvas() {\n      let 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({ container, id, defaultViewport, linkService, renderingQueue,\n                disableCanvasToImageConversion = false, l10n = NullL10n, }) {\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\n    this.linkService = linkService;\n    this.renderingQueue = renderingQueue;\n\n    this.renderTask = null;\n    this.renderingState = RenderingStates.INITIAL;\n    this.resume = null;\n    this.disableCanvasToImageConversion = disableCanvasToImageConversion;\n\n    this.pageWidth = this.viewport.width;\n    this.pageHeight = this.viewport.height;\n    this.pageRatio = this.pageWidth / this.pageHeight;\n\n    this.canvasWidth = THUMBNAIL_WIDTH;\n    this.canvasHeight = (this.canvasWidth / this.pageRatio) | 0;\n    this.scale = this.canvasWidth / this.pageWidth;\n\n    this.l10n = l10n;\n\n    let anchor = document.createElement('a');\n    anchor.href = linkService.getAnchorUrl('#page=' + id);\n    this.l10n.get('thumb_page_title', { page: id, }, 'Page {{page}}').\n        then((msg) => {\n      anchor.title = msg;\n    });\n    anchor.onclick = function() {\n      linkService.page = id;\n      return false;\n    };\n    this.anchor = anchor;\n\n    let div = document.createElement('div');\n    div.className = 'thumbnail';\n    div.setAttribute('data-page-number', this.id);\n    this.div = div;\n\n    let ring = document.createElement('div');\n    ring.className = 'thumbnailSelectionRing';\n    let 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    let 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    this.pageWidth = this.viewport.width;\n    this.pageHeight = this.viewport.height;\n    this.pageRatio = this.pageWidth / this.pageHeight;\n\n    this.canvasHeight = (this.canvasWidth / this.pageRatio) | 0;\n    this.scale = (this.canvasWidth / this.pageWidth);\n\n    this.div.removeAttribute('data-loaded');\n    let ring = this.ring;\n    let childNodes = ring.childNodes;\n    for (let i = childNodes.length - 1; i >= 0; i--) {\n      ring.removeChild(childNodes[i]);\n    }\n    let 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    let 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(noCtxScale = false) {\n    let canvas = document.createElement('canvas');\n    // Keep the no-thumbnail outline visible, i.e. `data-loaded === false`,\n    // until rendering/image conversion is complete, to avoid display issues.\n    this.canvas = canvas;\n\n    if (typeof PDFJSDev === 'undefined' ||\n        PDFJSDev.test('MOZCENTRAL || FIREFOX || GENERIC')) {\n      canvas.mozOpaque = true;\n    }\n    let ctx = canvas.getContext('2d', { alpha: false, });\n    let outputScale = getOutputScale(ctx);\n\n    canvas.width = (this.canvasWidth * outputScale.sx) | 0;\n    canvas.height = (this.canvasHeight * outputScale.sy) | 0;\n    canvas.style.width = this.canvasWidth + 'px';\n    canvas.style.height = this.canvasHeight + 'px';\n\n    if (!noCtxScale && outputScale.scaled) {\n      ctx.scale(outputScale.sx, outputScale.sy);\n    }\n    return ctx;\n  }\n\n  /**\n   * @private\n   */\n  _convertCanvasToImage() {\n    if (!this.canvas) {\n      return;\n    }\n    if (this.renderingState !== RenderingStates.FINISHED) {\n      return;\n    }\n    let id = this.renderingId;\n    let className = 'thumbnailImage';\n\n    if (this.disableCanvasToImageConversion) {\n      this.canvas.id = id;\n      this.canvas.className = className;\n      this.l10n.get('thumb_page_canvas', { page: this.pageId, },\n                    'Thumbnail of Page {{page}}').then((msg) => {\n        this.canvas.setAttribute('aria-label', msg);\n      });\n\n      this.div.setAttribute('data-loaded', true);\n      this.ring.appendChild(this.canvas);\n      return;\n    }\n    let image = document.createElement('img');\n    image.id = id;\n    image.className = className;\n    this.l10n.get('thumb_page_canvas', { page: this.pageId, },\n      'Thumbnail of Page {{page}}').\n        then((msg) => {\n      image.setAttribute('aria-label', msg);\n    });\n\n    image.style.width = this.canvasWidth + 'px';\n    image.style.height = this.canvasHeight + 'px';\n\n    image.src = this.canvas.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    this.canvas.width = 0;\n    this.canvas.height = 0;\n    delete this.canvas;\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    this.renderingState = RenderingStates.RUNNING;\n\n    let renderCapability = createPromiseCapability();\n    let finishRenderTask = (error) => {\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        renderCapability.resolve(undefined);\n        return;\n      }\n\n      this.renderingState = RenderingStates.FINISHED;\n      this._convertCanvasToImage();\n\n      if (!error) {\n        renderCapability.resolve(undefined);\n      } else {\n        renderCapability.reject(error);\n      }\n    };\n\n    let ctx = this._getPageDrawContext();\n    let drawViewport = this.viewport.clone({ scale: this.scale, });\n    let 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    let renderContext = {\n      canvasContext: ctx,\n      viewport: drawViewport,\n    };\n    let renderTask = this.renderTask = this.pdfPage.render(renderContext);\n    renderTask.onContinue = renderContinueCallback;\n\n    renderTask.promise.then(function() {\n      finishRenderTask(null);\n    }, function(error) {\n      finishRenderTask(error);\n    });\n    return renderCapability.promise;\n  }\n\n  setImage(pageView) {\n    if (this.renderingState !== RenderingStates.INITIAL) {\n      return;\n    }\n    let img = pageView.canvas;\n    if (!img) {\n      return;\n    }\n    if (!this.pdfPage) {\n      this.setPdfPage(pageView.pdfPage);\n    }\n\n    this.renderingState = RenderingStates.FINISHED;\n\n    let ctx = this._getPageDrawContext(true);\n    let canvas = ctx.canvas;\n    if (img.width <= 2 * canvas.width) {\n      ctx.drawImage(img, 0, 0, img.width, img.height,\n                    0, 0, canvas.width, canvas.height);\n      this._convertCanvasToImage();\n      return;\n    }\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    let reducedImage = TempImageFactory.getCanvas(reducedWidth,\n                                                  reducedHeight);\n    let reducedImageCtx = reducedImage.getContext('2d');\n\n    while (reducedWidth > img.width || reducedHeight > img.height) {\n      reducedWidth >>= 1;\n      reducedHeight >>= 1;\n    }\n    reducedImageCtx.drawImage(img, 0, 0, img.width, img.height,\n                              0, 0, reducedWidth, reducedHeight);\n    while (reducedWidth > 2 * canvas.width) {\n      reducedImageCtx.drawImage(reducedImage,\n                                0, 0, reducedWidth, reducedHeight,\n                                0, 0, reducedWidth >> 1, reducedHeight >> 1);\n      reducedWidth >>= 1;\n      reducedHeight >>= 1;\n    }\n    ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight,\n                  0, 0, canvas.width, canvas.height);\n    this._convertCanvasToImage();\n  }\n\n  get pageId() {\n    return (this.pageLabel !== null ? this.pageLabel : this.id);\n  }\n\n  /**\n   * @param {string|null} label\n   */\n  setPageLabel(label) {\n    this.pageLabel = (typeof label === 'string' ? label : null);\n\n    this.l10n.get('thumb_page_title', { page: this.pageId, },\n                  'Page {{page}}').then((msg) => {\n      this.anchor.title = msg;\n    });\n\n    if (this.renderingState !== RenderingStates.FINISHED) {\n      return;\n    }\n\n    this.l10n.get('thumb_page_canvas', { page: this.pageId, },\n                  'Thumbnail of Page {{page}}').then((ariaLabel) => {\n      if (this.image) {\n        this.image.setAttribute('aria-label', ariaLabel);\n      } else if (this.disableCanvasToImageConversion && this.canvas) {\n        this.canvas.setAttribute('aria-label', ariaLabel);\n      }\n    });\n  }\n\n  static cleanup() {\n    TempImageFactory.destroyCanvas();\n  }\n}\n\nexport {\n  PDFThumbnailView,\n};\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 { BaseViewer } from './base_viewer';\nimport { shadow } from 'pdfjs-lib';\n\nclass PDFViewer extends BaseViewer {\n  get _setDocumentViewerElement() {\n    return shadow(this, '_setDocumentViewerElement', 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 (this._isScrollModeHorizontal ||\n          left < scrollLeft || right > scrollLeft + clientWidth) {\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 (page.id === currentId) {\n        stillFullyVisible = true;\n        break;\n      }\n    }\n    if (!stillFullyVisible) {\n      currentId = visiblePages[0].id;\n    }\n    this._setCurrentPageNumber(currentId);\n  }\n}\n\nexport {\n  PDFViewer,\n};\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  CSS_UNITS, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, getGlobalEventBus,\n  getVisibleElements, isPortraitOrientation, isValidRotation, isValidScrollMode,\n  isValidSpreadMode, MAX_AUTO_SCALE, moveToEndOfArray, NullL10n,\n  PresentationModeState, RendererType, SCROLLBAR_PADDING, scrollIntoView,\n  ScrollMode, SpreadMode, TextLayerMode, UNKNOWN_SCALE, VERTICAL_PADDING,\n  watchScroll\n} from './ui_utils';\nimport { PDFRenderingQueue, RenderingStates } from './pdf_rendering_queue';\nimport { AnnotationLayerBuilder } from './annotation_layer_builder';\nimport { createPromiseCapability } from 'pdfjs-lib';\nimport { PDFPageView } from './pdf_page_view';\nimport { SimpleLinkService } from './pdf_link_service';\nimport { TextLayerBuilder } from './text_layer_builder';\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 - (optional) The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {DownloadManager} downloadManager - (optional) The download\n *   manager component.\n * @property {PDFFindController} findController - (optional) The find\n *   controller component.\n * @property {PDFRenderingQueue} renderingQueue - (optional) The rendering\n *   queue object.\n * @property {boolean} removePageBorders - (optional) Removes the border shadow\n *   around the pages. The default value is `false`.\n * @property {number} textLayerMode - (optional) Controls if the text layer used\n *   for 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 - (optional) Path for image resources,\n *   mainly for annotation icons. Include trailing slash.\n * @property {boolean} renderInteractiveForms - (optional) Enables rendering of\n *   interactive form elements. The default is `false`.\n * @property {boolean} enablePrintAutoRotate - (optional) Enables automatic\n *   rotation of pages whose orientation differ from the first page upon\n *   printing. The default is `false`.\n * @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.\n * @property {boolean} enableWebGL - (optional) Enables WebGL accelerated\n *   rendering for some operations. The default value is `false`.\n * @property {boolean} useOnlyCssZoom - (optional) Enables CSS only zooming.\n *   The default value is `false`.\n * @property {number} maxCanvasPixels - (optional) The maximum supported canvas\n *   size in total pixels, i.e. width * height. Use -1 for no limit.\n *   The default value is 4096 * 4096 (16 mega-pixels).\n * @property {IL10n} l10n - Localization service.\n */\n\nfunction PDFPageViewBuffer(size) {\n  let data = [];\n  this.push = function(view) {\n    let 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\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    this._name = this.constructor.name;\n\n    this.container = options.container;\n    this.viewer = options.viewer || options.container.firstElementChild;\n    this.eventBus = options.eventBus || getGlobalEventBus();\n    this.linkService = options.linkService || new SimpleLinkService();\n    this.downloadManager = options.downloadManager || null;\n    this.findController = options.findController || null;\n    this.removePageBorders = options.removePageBorders || false;\n    this.textLayerMode = Number.isInteger(options.textLayerMode) ?\n      options.textLayerMode : 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.enableWebGL = options.enableWebGL || false;\n    this.useOnlyCssZoom = options.useOnlyCssZoom || false;\n    this.maxCanvasPixels = options.maxCanvasPixels;\n    this.l10n = options.l10n || NullL10n;\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._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   * @returns {boolean} true if all {PDFPageView} objects are initialized.\n   */\n  get pageViewsReady() {\n    return this._pageViewsReady;\n  }\n\n  /**\n   * @returns {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   * @return {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    this._currentPageNumber = val;\n\n    this.eventBus.dispatch('pagechanging', {\n      source: this,\n      pageNumber: val,\n      pageLabel: this._pageLabels && this._pageLabels[val - 1],\n    });\n\n    if (resetCurrentPageView) {\n      this._resetCurrentPageView();\n    }\n    return true;\n  }\n\n  /**\n   * @returns {string|null} Returns the current page label,\n   *                        or `null` if no page labels exist.\n   */\n  get currentPageLabel() {\n    return this._pageLabels && this._pageLabels[this._currentPageNumber - 1];\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      let 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   * @returns {number}\n   */\n  get currentScale() {\n    return this._currentScale !== UNKNOWN_SCALE ? 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   * @returns {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   * @returns {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    if (this._pagesRotation === rotation) {\n      return; // The rotation didn't change.\n    }\n    this._pagesRotation = rotation;\n\n    let pageNumber = this._currentPageNumber;\n\n    for (let i = 0, ii = this._pages.length; i < ii; i++) {\n      let 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 _setDocumentViewerElement() {\n    // In most viewers, e.g. `PDFViewer`, this should return `this.viewer`.\n    throw new Error('Not implemented: _setDocumentViewerElement');\n  }\n\n  /**\n   * @param pdfDocument {PDFDocument}\n   */\n  setDocument(pdfDocument) {\n    if (this.pdfDocument) {\n      this._cancelRendering();\n      this._resetView();\n\n      if (this.findController) {\n        this.findController.setDocument(null);\n      }\n    }\n\n    this.pdfDocument = pdfDocument;\n    if (!pdfDocument) {\n      return;\n    }\n    let pagesCount = pdfDocument.numPages;\n\n    let pagesCapability = createPromiseCapability();\n    this.pagesPromise = pagesCapability.promise;\n\n    pagesCapability.promise.then(() => {\n      this._pageViewsReady = true;\n      this.eventBus.dispatch('pagesloaded', {\n        source: this,\n        pagesCount,\n      });\n    });\n\n    const onePageRenderedCapability = createPromiseCapability();\n    this.onePageRendered = onePageRenderedCapability.promise;\n\n    let bindOnAfterAndBeforeDraw = (pageView) => {\n      pageView.onBeforeDraw = () => {\n        // Add the page to the buffer at the start of drawing. That way it can\n        // be evicted from the buffer and destroyed even if we pause its\n        // rendering.\n        this._buffer.push(pageView);\n      };\n      pageView.onAfterDraw = () => {\n        if (!onePageRenderedCapability.settled) {\n          onePageRenderedCapability.resolve();\n        }\n      };\n    };\n\n    let firstPagePromise = pdfDocument.getPage(1);\n    this.firstPagePromise = firstPagePromise;\n\n    // Fetch a single page so we can get a viewport that will be the default\n    // viewport for all pages\n    firstPagePromise.then((pdfPage) => {\n      let scale = this.currentScale;\n      let viewport = pdfPage.getViewport({ scale: scale * CSS_UNITS, });\n      for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n        let textLayerFactory = null;\n        if (this.textLayerMode !== TextLayerMode.DISABLE) {\n          textLayerFactory = this;\n        }\n        let pageView = new PDFPageView({\n          container: this._setDocumentViewerElement,\n          eventBus: this.eventBus,\n          id: pageNum,\n          scale,\n          defaultViewport: viewport.clone(),\n          renderingQueue: this.renderingQueue,\n          textLayerFactory,\n          textLayerMode: this.textLayerMode,\n          annotationLayerFactory: this,\n          imageResourcesPath: this.imageResourcesPath,\n          renderInteractiveForms: this.renderInteractiveForms,\n          renderer: this.renderer,\n          enableWebGL: this.enableWebGL,\n          useOnlyCssZoom: this.useOnlyCssZoom,\n          maxCanvasPixels: this.maxCanvasPixels,\n          l10n: this.l10n,\n        });\n        bindOnAfterAndBeforeDraw(pageView);\n        this._pages.push(pageView);\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      onePageRenderedCapability.promise.then(() => {\n        if (this.findController) {\n          this.findController.setDocument(pdfDocument); // Enable searching.\n        }\n\n        if (pdfDocument.loadingParams['disableAutoFetch']) {\n          // XXX: Printing is semi-broken with auto fetch disabled.\n          pagesCapability.resolve();\n          return;\n        }\n        let getPagesLeft = pagesCount;\n        for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n          pdfDocument.getPage(pageNum).then((pdfPage) => {\n            let 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              pagesCapability.resolve();\n            }\n          }, (reason) => {\n            console.error(`Unable to get page ${pageNum} to initialize viewer`,\n                          reason);\n            if (--getPagesLeft === 0) {\n              pagesCapability.resolve();\n            }\n          });\n        }\n      });\n\n      this.eventBus.dispatch('pagesinit', { source: this, });\n\n      if (this.defaultRenderingQueue) {\n        this.update();\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 (!(Array.isArray(labels) &&\n                 this.pdfDocument.numPages === labels.length)) {\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      let pageView = this._pages[i];\n      let label = this._pageLabels && this._pageLabels[i];\n      pageView.setPageLabel(label);\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._pagesRequests = [];\n    this._pageViewsReady = false;\n    this._scrollMode = ScrollMode.VERTICAL;\n    this._spreadMode = SpreadMode.NONE;\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, dest;\n      if (this._location &&\n          !(this.isInPresentationMode || this.isChangingPresentationMode)) {\n        page = this._location.pageNumber;\n        dest = [null, { name: 'XYZ', }, this._location.left,\n                this._location.top, null];\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  _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      let 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      let pageWidthScale = (this.container.clientWidth - hPadding) /\n                           currentPage.width * currentPage.scale;\n      let pageHeightScale = (this.container.clientHeight - vPadding) /\n                            currentPage.height * 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          let horizontalScale = isPortraitOrientation(currentPage) ?\n            pageWidthScale : 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          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    let pageView = this._pages[this._currentPageNumber - 1];\n    this._scrollIntoView({ pageDiv: pageView.div, });\n  }\n\n  /**\n   * @typedef ScrollPageIntoViewParameters\n   * @property {number} pageNumber - The page number.\n   * @property {Array} destArray - (optional) The original PDF destination\n   *   array, in the format: <page-ref> </XYZ|/FitXXX> <args..>\n   * @property {boolean} allowNegativeOffset - (optional) Allow negative page\n   *   offsets. The default value is `false`.\n   */\n\n  /**\n   * Scrolls page into view.\n   * @param {ScrollPageIntoViewParameters} params\n   */\n  scrollPageIntoView({ pageNumber, destArray = null,\n                       allowNegativeOffset = false, }) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    const pageView = (Number.isInteger(pageNumber) &&\n                      this._pages[pageNumber - 1]);\n    if (!pageView) {\n      console.error(`${this._name}.scrollPageIntoView: ` +\n        `\"${pageNumber}\" is not a valid pageNumber parameter.`);\n      return;\n    }\n\n    if (this.isInPresentationMode || !destArray) {\n      this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n      return;\n    }\n    let x = 0, y = 0;\n    let width = 0, height = 0, widthScale, heightScale;\n    let changeOrientation = (pageView.rotation % 180 === 0 ? false : true);\n    let pageWidth = (changeOrientation ? pageView.height : pageView.width) /\n      pageView.scale / CSS_UNITS;\n    let pageHeight = (changeOrientation ? pageView.width : pageView.height) /\n      pageView.scale / 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        }\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        let hPadding = this.removePageBorders ? 0 : SCROLLBAR_PADDING;\n        let vPadding = this.removePageBorders ? 0 : VERTICAL_PADDING;\n\n        widthScale = (this.container.clientWidth - hPadding) /\n          width / CSS_UNITS;\n        heightScale = (this.container.clientHeight - vPadding) /\n          height / CSS_UNITS;\n        scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));\n        break;\n      default:\n        console.error(`${this._name}.scrollPageIntoView: ` +\n          `\"${destArray[1].name}\" is not a valid destination type.`);\n        return;\n    }\n\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    if (scale === 'page-fit' && !destArray[4]) {\n      this._scrollIntoView({\n        pageDiv: pageView.div,\n        pageNumber,\n      });\n      return;\n    }\n\n    let 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    let currentScale = this._currentScale;\n    let currentScaleValue = this._currentScaleValue;\n    let normalizedScaleValue =\n      parseFloat(currentScaleValue) === currentScale ?\n      Math.round(currentScale * 10000) / 100 : currentScaleValue;\n\n    let pageNumber = firstPage.id;\n    let pdfOpenParams = '#page=' + pageNumber;\n    pdfOpenParams += '&zoom=' + normalizedScaleValue;\n    let currentPageView = this._pages[pageNumber - 1];\n    let container = this.container;\n    let topLeft = currentPageView.getPagePoint(\n      (container.scrollLeft - firstPage.x),\n      (container.scrollTop - firstPage.y));\n    let intLeft = Math.round(topLeft[0]);\n    let 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, 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 : this._scrollMode === ScrollMode.HORIZONTAL);\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 : (this.container.scrollWidth > this.container.clientWidth));\n  }\n\n  get isVerticalScrollbarEnabled() {\n    return (this.isInPresentationMode ?\n      false : (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(this.container, this._pages, true,\n                              this._isScrollModeHorizontal);\n  }\n\n  /**\n   * @param {number} pageNumber\n   */\n  isPageVisible(pageNumber) {\n    if (!this.pdfDocument) {\n      return false;\n    }\n    if (this.pageNumber < 1 || pageNumber > this.pagesCount) {\n      console.error(\n        `${this._name}.isPageVisible: \"${pageNumber}\" is out of bounds.`);\n      return false;\n    }\n    return this._getVisiblePages().views.some(function(view) {\n      return (view.id === pageNumber);\n    });\n  }\n\n  cleanup() {\n    for (let i = 0, ii = this._pages.length; i < ii; i++) {\n      if (this._pages[i] &&\n          this._pages[i].renderingState !== RenderingStates.FINISHED) {\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    let pageNumber = pageView.id;\n    if (this._pagesRequests[pageNumber]) {\n      return this._pagesRequests[pageNumber];\n    }\n    let promise = this.pdfDocument.getPage(pageNumber).then((pdfPage) => {\n      if (!pageView.pdfPage) {\n        pageView.setPdfPage(pdfPage);\n      }\n      this._pagesRequests[pageNumber] = null;\n      return pdfPage;\n    }).catch((reason) => {\n      console.error('Unable to get page for page view', reason);\n      // Page error -- there is nothing can be done.\n      this._pagesRequests[pageNumber] = null;\n    });\n    this._pagesRequests[pageNumber] = promise;\n    return promise;\n  }\n\n  forceRendering(currentlyVisiblePages) {\n    let visiblePages = currentlyVisiblePages || this._getVisiblePages();\n    let scrollAhead = (this._isScrollModeHorizontal ?\n                       this.scroll.right : this.scroll.down);\n    let pageView = this.renderingQueue.getHighestPriority(visiblePages,\n                                                          this._pages,\n                                                          scrollAhead);\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   * @returns {TextLayerBuilder}\n   */\n  createTextLayerBuilder(textLayerDiv, pageIndex, viewport,\n                         enhanceTextSelection = false) {\n    return new TextLayerBuilder({\n      textLayerDiv,\n      eventBus: this.eventBus,\n      pageIndex,\n      viewport,\n      findController: this.isInPresentationMode ? null : this.findController,\n      enhanceTextSelection: this.isInPresentationMode ? false :\n                                                        enhanceTextSelection,\n    });\n  }\n\n  /**\n   * @param {HTMLDivElement} pageDiv\n   * @param {PDFPage} pdfPage\n   * @param {string} imageResourcesPath - (optional) Path for image resources,\n   *   mainly for annotation icons. Include trailing slash.\n   * @param {boolean} renderInteractiveForms\n   * @param {IL10n} l10n\n   * @returns {AnnotationLayerBuilder}\n   */\n  createAnnotationLayerBuilder(pageDiv, pdfPage, imageResourcesPath = '',\n                               renderInteractiveForms = false,\n                               l10n = NullL10n) {\n    return new AnnotationLayerBuilder({\n      pageDiv,\n      pdfPage,\n      imageResourcesPath,\n      renderInteractiveForms,\n      linkService: this.linkService,\n      downloadManager: this.downloadManager,\n      l10n,\n    });\n  }\n\n  /**\n   * @returns {boolean} Whether all pages of the PDF document have identical\n   *                    widths and heights.\n   */\n  get hasEqualPageSizes() {\n    let firstPageView = this._pages[0];\n    for (let i = 1, ii = this._pages.length; i < ii; ++i) {\n      let pageView = this._pages[i];\n      if (pageView.width !== firstPageView.width ||\n          pageView.height !== firstPageView.height) {\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    let pagesOverview = this._pages.map(function(pageView) {\n      let viewport = pageView.pdfPage.getViewport({ scale: 1, });\n      return {\n        width: viewport.width,\n        height: viewport.height,\n        rotation: viewport.rotation,\n      };\n    });\n    if (!this.enablePrintAutoRotate) {\n      return pagesOverview;\n    }\n    let isFirstPagePortrait = isPortraitOrientation(pagesOverview[0]);\n    return pagesOverview.map(function (size) {\n      if (isFirstPagePortrait === isPortraitOrientation(size)) {\n        return size;\n      }\n      return {\n        width: size.height,\n        height: size.width,\n        rotation: (size.rotation + 90) % 360,\n      };\n    });\n  }\n\n  /**\n   * @return {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, viewer = this.viewer;\n\n    viewer.classList.toggle('scrollHorizontal',\n                            scrollMode === ScrollMode.HORIZONTAL);\n    viewer.classList.toggle('scrollWrapped',\n                            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   * @return {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, 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    this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n    this.update();\n  }\n}\n\nexport {\n  BaseViewer,\n};\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 './ui_utils';\nimport { SimpleLinkService } from './pdf_link_service';\n\n/**\n * @typedef {Object} AnnotationLayerBuilderOptions\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPage} pdfPage\n * @property {string} imageResourcesPath - (optional) Path for image resources,\n *   mainly 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 */\n\nclass AnnotationLayerBuilder {\n  /**\n   * @param {AnnotationLayerBuilderOptions} options\n   */\n  constructor({ pageDiv, pdfPage, linkService, downloadManager,\n                imageResourcesPath = '', renderInteractiveForms = false,\n                l10n = NullL10n, }) {\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\n    this.div = null;\n    this._cancelled = false;\n  }\n\n  /**\n   * @param {PageViewport} viewport\n   * @param {string} intent (default value is 'display')\n   */\n  render(viewport, intent = 'display') {\n    this.pdfPage.getAnnotations({ intent, }).then((annotations) => {\n      if (this._cancelled) {\n        return;\n      }\n\n      let 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      };\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        if (annotations.length === 0) {\n          return;\n        }\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.setAttribute('hidden', 'true');\n  }\n}\n\n/**\n * @implements IPDFAnnotationLayerFactory\n */\nclass DefaultAnnotationLayerFactory {\n  /**\n   * @param {HTMLDivElement} pageDiv\n   * @param {PDFPage} pdfPage\n   * @param {string} imageResourcesPath - (optional) Path for image resources,\n   *   mainly for annotation icons. Include trailing slash.\n   * @param {boolean} renderInteractiveForms\n   * @param {IL10n} l10n\n   * @returns {AnnotationLayerBuilder}\n   */\n  createAnnotationLayerBuilder(pageDiv, pdfPage, imageResourcesPath = '',\n                               renderInteractiveForms = false,\n                               l10n = NullL10n) {\n    return new AnnotationLayerBuilder({\n      pageDiv,\n      pdfPage,\n      imageResourcesPath,\n      renderInteractiveForms,\n      linkService: new SimpleLinkService(),\n      l10n,\n    });\n  }\n}\n\nexport {\n  AnnotationLayerBuilder,\n  DefaultAnnotationLayerFactory,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  approximateFraction, CSS_UNITS, DEFAULT_SCALE, getGlobalEventBus,\n  getOutputScale, NullL10n, RendererType, roundToDivide, TextLayerMode\n} from './ui_utils';\nimport {\n  createPromiseCapability, RenderingCancelledException, SVGGraphics\n} from 'pdfjs-lib';\nimport { RenderingStates } from './pdf_rendering_queue';\nimport { viewerCompatibilityParams } from './viewer_compatibility';\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 {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {IPDFTextLayerFactory} textLayerFactory\n * @property {number} textLayerMode - (optional) Controls if the text layer used\n *   for 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 {string} imageResourcesPath - (optional) Path for image resources,\n *   mainly for annotation icons. Include trailing slash.\n * @property {boolean} renderInteractiveForms - Turns on rendering of\n *   interactive form elements. The default is `false`.\n * @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.\n * @property {boolean} enableWebGL - (optional) Enables WebGL accelerated\n *   rendering for some operations. The default value is `false`.\n * @property {boolean} useOnlyCssZoom - (optional) Enables CSS only zooming.\n *   The default value is `false`.\n * @property {number} maxCanvasPixels - (optional) The maximum supported canvas\n *   size in total pixels, i.e. width * height. Use -1 for no limit.\n *   The default value 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    let container = options.container;\n    let 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.hasRestrictedScaling = false;\n    this.textLayerMode = Number.isInteger(options.textLayerMode) ?\n      options.textLayerMode : 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 || getGlobalEventBus();\n    this.renderingQueue = options.renderingQueue;\n    this.textLayerFactory = options.textLayerFactory;\n    this.annotationLayerFactory = options.annotationLayerFactory;\n    this.renderer = options.renderer || RendererType.CANVAS;\n    this.enableWebGL = options.enableWebGL || false;\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.error = null;\n\n    this.onBeforeDraw = null;\n    this.onAfterDraw = null;\n\n    this.annotationLayer = null;\n    this.textLayer = null;\n    this.zoomLayer = null;\n\n    let 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    this.div = div;\n\n    container.appendChild(div);\n  }\n\n  setPdfPage(pdfPage) {\n    this.pdfPage = pdfPage;\n    this.pdfPageRotate = pdfPage.rotate;\n\n    let totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n    this.viewport = pdfPage.getViewport({ scale: this.scale * CSS_UNITS,\n                                          rotation: totalRotation, });\n    this.stats = pdfPage.stats;\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  _resetZoomLayer(removeFromDOM = false) {\n    if (!this.zoomLayer) {\n      return;\n    }\n    let 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(keepZoomLayer = false, keepAnnotations = false) {\n    this.cancelRendering(keepAnnotations);\n    this.renderingState = RenderingStates.INITIAL;\n\n    let 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    let childNodes = div.childNodes;\n    let currentZoomLayerNode = (keepZoomLayer && this.zoomLayer) || null;\n    let currentAnnotationNode = (keepAnnotations && this.annotationLayer &&\n                                 this.annotationLayer.div) || null;\n    for (let i = childNodes.length - 1; i >= 0; i--) {\n      let node = childNodes[i];\n      if (currentZoomLayerNode === node || currentAnnotationNode === node) {\n        continue;\n      }\n      div.removeChild(node);\n    }\n    div.removeAttribute('data-loaded');\n\n    if (currentAnnotationNode) {\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    } else if (this.annotationLayer) {\n      this.annotationLayer.cancel();\n      this.annotationLayer = null;\n    }\n\n    if (!currentZoomLayerNode) {\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    div.appendChild(this.loadingIconDiv);\n  }\n\n  update(scale, rotation) {\n    this.scale = scale || this.scale;\n    if (typeof rotation !== 'undefined') { // The rotation may be zero.\n      this.rotation = rotation;\n    }\n\n    let 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(this.svg, true);\n\n      this.eventBus.dispatch('pagerendered', {\n        source: this,\n        pageNumber: this.id,\n        cssTransform: true,\n      });\n      return;\n    }\n\n    let isScalingRestricted = false;\n    if (this.canvas && this.maxCanvasPixels > 0) {\n      let outputScale = this.outputScale;\n      if (((Math.floor(this.viewport.width) * outputScale.sx) | 0) *\n          ((Math.floor(this.viewport.height) * outputScale.sy) | 0) >\n          this.maxCanvasPixels) {\n        isScalingRestricted = true;\n      }\n    }\n\n    if (this.canvas) {\n      if (this.useOnlyCssZoom ||\n          (this.hasRestrictedScaling && isScalingRestricted)) {\n        this.cssTransform(this.canvas, true);\n\n        this.eventBus.dispatch('pagerendered', {\n          source: this,\n          pageNumber: this.id,\n          cssTransform: true,\n        });\n        return;\n      }\n      if (!this.zoomLayer && !this.canvas.hasAttribute('hidden')) {\n        this.zoomLayer = this.canvas.parentNode;\n        this.zoomLayer.style.position = 'absolute';\n      }\n    }\n    if (this.zoomLayer) {\n      this.cssTransform(this.zoomLayer.firstChild);\n    }\n    this.reset(/* keepZoomLayer = */ true, /* keepAnnotations = */ true);\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(keepAnnotations = 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 (!keepAnnotations && this.annotationLayer) {\n      this.annotationLayer.cancel();\n      this.annotationLayer = null;\n    }\n  }\n\n  cssTransform(target, redrawAnnotations = false) {\n    // Scale target (canvas or svg), its wrapper and page container.\n    let width = this.viewport.width;\n    let height = this.viewport.height;\n    let div = this.div;\n    target.style.width = target.parentNode.style.width = div.style.width =\n      Math.floor(width) + 'px';\n    target.style.height = target.parentNode.style.height = div.style.height =\n      Math.floor(height) + 'px';\n    // The canvas may have been originally rotated; rotate relative to that.\n    let relativeRotation = this.viewport.rotation -\n                           this.paintedViewportMap.get(target).rotation;\n    let absRotation = Math.abs(relativeRotation);\n    let scaleX = 1, 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    let cssTransform = 'rotate(' + relativeRotation + 'deg) ' +\n      'scale(' + scaleX + ',' + scaleY + ')';\n    target.style.transform = cssTransform;\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      let textLayerViewport = this.textLayer.viewport;\n      let textRelativeRotation = this.viewport.rotation -\n        textLayerViewport.rotation;\n      let textAbsRotation = Math.abs(textRelativeRotation);\n      let scale = width / textLayerViewport.width;\n      if (textAbsRotation === 90 || textAbsRotation === 270) {\n        scale = width / textLayerViewport.height;\n      }\n      let 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 + ', ' + scale + ') ' +\n        'translate(' + transX + ', ' + transY + ')';\n      textLayerDiv.style.transformOrigin = '0% 0%';\n    }\n\n    if (redrawAnnotations && this.annotationLayer) {\n      this.annotationLayer.render(this.viewport, 'display');\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\n    if (!this.pdfPage) {\n      this.renderingState = RenderingStates.FINISHED;\n      return Promise.reject(new Error('Page is not loaded'));\n    }\n\n    this.renderingState = RenderingStates.RUNNING;\n\n    let pdfPage = this.pdfPage;\n    let div = this.div;\n    // Wrap the canvas so that if it has a CSS transform for high DPI the\n    // overflow will be hidden in Firefox.\n    let 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 && 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      let 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 && 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.\n        createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport,\n            this.textLayerMode === TextLayerMode.ENABLE_ENHANCE);\n    }\n    this.textLayer = textLayer;\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) => {\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.error = null;\n        return;\n      }\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.error = error;\n      this.stats = pdfPage.stats;\n      if (this.onAfterDraw) {\n        this.onAfterDraw();\n      }\n      this.eventBus.dispatch('pagerendered', {\n        source: this,\n        pageNumber: this.id,\n        cssTransform: false,\n      });\n\n      if (error) {\n        throw error;\n      }\n    };\n\n    let paintTask = this.renderer === RendererType.SVG ?\n      this.paintOnSvg(canvasWrapper) :\n      this.paintOnCanvas(canvasWrapper);\n    paintTask.onRenderContinue = renderContinueCallback;\n    this.paintTask = paintTask;\n\n    let resultPromise = paintTask.promise.then(function() {\n      return finishPaintTask(null).then(function () {\n        if (textLayer) {\n          let readableStream = pdfPage.streamTextContent({\n            normalizeWhitespace: true,\n          });\n          textLayer.setTextContentStream(readableStream);\n          textLayer.render();\n        }\n      });\n    }, function(reason) {\n      return finishPaintTask(reason);\n    });\n\n    if (this.annotationLayerFactory) {\n      if (!this.annotationLayer) {\n        this.annotationLayer = this.annotationLayerFactory.\n          createAnnotationLayerBuilder(div, pdfPage, this.imageResourcesPath,\n                                       this.renderInteractiveForms, this.l10n);\n      }\n      this.annotationLayer.render(this.viewport, 'display');\n    }\n    div.setAttribute('data-loaded', true);\n\n    if (this.onBeforeDraw) {\n      this.onBeforeDraw();\n    }\n    return resultPromise;\n  }\n\n  paintOnCanvas(canvasWrapper) {\n    let renderCapability = createPromiseCapability();\n    let result = {\n      promise: renderCapability.promise,\n      onRenderContinue(cont) {\n        cont();\n      },\n      cancel() {\n        renderTask.cancel();\n      },\n    };\n\n    let viewport = this.viewport;\n    let canvas = document.createElement('canvas');\n    canvas.id = this.renderingId;\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.setAttribute('hidden', 'hidden');\n    let isCanvasHidden = true;\n    let showCanvas = function () {\n      if (isCanvasHidden) {\n        canvas.removeAttribute('hidden');\n        isCanvasHidden = false;\n      }\n    };\n\n    canvasWrapper.appendChild(canvas);\n    this.canvas = canvas;\n\n    if (typeof PDFJSDev === 'undefined' ||\n        PDFJSDev.test('MOZCENTRAL || FIREFOX || GENERIC')) {\n      canvas.mozOpaque = true;\n    }\n\n    let ctx = canvas.getContext('2d', { alpha: false, });\n    let outputScale = getOutputScale(ctx);\n    this.outputScale = outputScale;\n\n    if (this.useOnlyCssZoom) {\n      let 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      let pixelsInViewport = viewport.width * viewport.height;\n      let 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    let sfx = approximateFraction(outputScale.sx);\n    let 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    let transform = !outputScale.scaled ? null :\n      [outputScale.sx, 0, 0, outputScale.sy, 0, 0];\n    let renderContext = {\n      canvasContext: ctx,\n      transform,\n      viewport: this.viewport,\n      enableWebGL: this.enableWebGL,\n      renderInteractiveForms: this.renderInteractiveForms,\n    };\n    let 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(function() {\n      showCanvas();\n      renderCapability.resolve(undefined);\n    }, function(error) {\n      showCanvas();\n      renderCapability.reject(error);\n    });\n    return result;\n  }\n\n  paintOnSvg(wrapper) {\n    if (typeof PDFJSDev !== 'undefined' &&\n        PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {\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    let ensureNotCancelled = () => {\n      if (cancelled) {\n        throw new RenderingCancelledException(\n          'Rendering cancelled, page ' + this.id, 'svg');\n      }\n    };\n\n    let pdfPage = this.pdfPage;\n    let actualSizeViewport = this.viewport.clone({ scale: CSS_UNITS, });\n    let promise = pdfPage.getOperatorList().then((opList) => {\n      ensureNotCancelled();\n      let svgGfx = new SVGGraphics(pdfPage.commonObjs, pdfPage.objs);\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 {\n  PDFPageView,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getGlobalEventBus } from './ui_utils';\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({ textLayerDiv, eventBus, pageIndex, viewport,\n                findController = null, enhanceTextSelection = false, }) {\n    this.textLayerDiv = textLayerDiv;\n    this.eventBus = eventBus || getGlobalEventBus();\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      let 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 - (optional) wait for a specified amount of\n   *                           milliseconds 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    let 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      this.textLayerDiv.appendChild(textLayerFrag);\n      this._finishRendering();\n      this._updateMatches();\n    }, function (reason) {\n      // Cancelled or failed to render text layer; skipping errors.\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('updatetextlayermatches',\n                       this._onUpdateTextLayerMatches);\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('updatetextlayermatches',\n                        this._onUpdateTextLayerMatches);\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 { findController, textContentItemsStr, } = this;\n\n    let i = 0, iIndex = 0;\n    const end = textContentItemsStr.length - 1;\n    const queryLen = findController.state.query.length;\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 &&\n             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      let match = {\n        begin: {\n          divIdx: i,\n          offset: matchIdx - iIndex,\n        },\n      };\n\n      // Calculate the end position.\n      if (matchesLength) { // Multiterm search.\n        matchIdx += matchesLength[m];\n      } else { // Phrase search.\n        matchIdx += queryLen;\n      }\n\n      // Somewhat the same array as above, but use > instead of >= to get\n      // the end position right.\n      while (i !== end &&\n             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    let infinity = {\n      divIdx: -1,\n      offset: undefined,\n    };\n\n    function beginText(begin, className) {\n      let divIdx = begin.divIdx;\n      textDivs[divIdx].textContent = '';\n      appendTextToDiv(divIdx, 0, begin.offset, className);\n    }\n\n    function appendTextToDiv(divIdx, fromOffset, toOffset, className) {\n      let div = textDivs[divIdx];\n      let content = textContentItemsStr[divIdx].substring(fromOffset, toOffset);\n      let node = document.createTextNode(content);\n      if (className) {\n        let span = document.createElement('span');\n        span.className = className;\n        span.appendChild(node);\n        div.appendChild(span);\n        return;\n      }\n      div.appendChild(node);\n    }\n\n    let i0 = selectedMatchIdx, 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      let match = matches[i];\n      let begin = match.begin;\n      let end = match.end;\n      const isSelected = (isSelectedPage && i === selectedMatchIdx);\n      const highlightSuffix = (isSelected ? ' selected' : '');\n\n      if (isSelected) { // Attempt to scroll the selected match into view.\n        findController.scrollMatchIntoView({\n          element: textDivs[begin.divIdx],\n          pageIndex: pageIdx,\n          matchIndex: selectedMatchIdx,\n        });\n      }\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        appendTextToDiv(begin.divIdx, begin.offset, end.offset,\n                        'highlight' + highlightSuffix);\n      } else {\n        appendTextToDiv(begin.divIdx, begin.offset, infinity.offset,\n                        'highlight begin' + highlightSuffix);\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\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 {\n      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      let match = matches[i];\n      let begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);\n      for (let n = begin, end = match.end.divIdx; n <= end; n++) {\n        let div = textDivs[n];\n        div.textContent = textContentItemsStr[n];\n        div.className = '';\n      }\n      clearedUntilDivIdx = match.end.divIdx + 1;\n    }\n\n    if (!findController || !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    let 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 ((typeof PDFJSDev === 'undefined' ||\n             !PDFJSDev.test('FIREFOX || MOZCENTRAL')) &&\n            expandDivsTimer) {\n          clearTimeout(expandDivsTimer);\n          expandDivsTimer = null;\n        }\n        return;\n      }\n\n      let end = div.querySelector('.endOfContent');\n      if (!end) {\n        return;\n      }\n      if (typeof PDFJSDev === 'undefined' ||\n          !PDFJSDev.test('FIREFOX || 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 = adjustTop && window.getComputedStyle(end).\n            getPropertyValue('-moz-user-select') !== 'none';\n        }\n        if (adjustTop) {\n          let divBounds = div.getBoundingClientRect();\n          let 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' ||\n            !PDFJSDev.test('FIREFOX || 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      let end = div.querySelector('.endOfContent');\n      if (!end) {\n        return;\n      }\n      if (typeof PDFJSDev === 'undefined' ||\n          !PDFJSDev.test('FIREFOX || 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   * @returns {TextLayerBuilder}\n   */\n  createTextLayerBuilder(textLayerDiv, pageIndex, viewport,\n                         enhanceTextSelection = false) {\n    return new TextLayerBuilder({\n      textLayerDiv,\n      pageIndex,\n      viewport,\n      enhanceTextSelection,\n    });\n  }\n}\n\nexport {\n  TextLayerBuilder,\n  DefaultTextLayerFactory,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SCROLLBAR_PADDING, ScrollMode, SpreadMode } from './ui_utils';\nimport { CursorTool } from './pdf_cursor_tools';\nimport { PDFSinglePageViewer } from './pdf_single_page_viewer';\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      { element: options.presentationModeButton, eventName: 'presentationmode',\n        close: true, },\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',\n        close: true, },\n      { element: options.lastPageButton, eventName: 'lastpage', close: true, },\n      { element: options.pageRotateCwButton, eventName: 'rotatecw',\n        close: false, },\n      { element: options.pageRotateCcwButton, eventName: 'rotateccw',\n        close: false, },\n      { element: options.cursorSelectToolButton, eventName: 'switchcursortool',\n        eventDetails: { tool: CursorTool.SELECT, }, close: true, },\n      { element: options.cursorHandToolButton, eventName: 'switchcursortool',\n        eventDetails: { tool: CursorTool.HAND, }, close: true, },\n      { element: options.scrollVerticalButton, eventName: 'switchscrollmode',\n        eventDetails: { mode: ScrollMode.VERTICAL, }, close: true, },\n      { element: options.scrollHorizontalButton, eventName: 'switchscrollmode',\n        eventDetails: { mode: ScrollMode.HORIZONTAL, }, close: true, },\n      { element: options.scrollWrappedButton, eventName: 'switchscrollmode',\n        eventDetails: { mode: ScrollMode.WRAPPED, }, close: true, },\n      { element: options.spreadNoneButton, eventName: 'switchspreadmode',\n        eventDetails: { mode: SpreadMode.NONE, }, close: true, },\n      { element: options.spreadOddButton, eventName: 'switchspreadmode',\n        eventDetails: { mode: SpreadMode.ODD, }, close: true, },\n      { element: options.spreadEvenButton, eventName: 'switchspreadmode',\n        eventDetails: { mode: SpreadMode.EVEN, }, close: true, },\n      { element: options.documentPropertiesButton,\n        eventName: 'documentproperties', close: true, },\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('hiddenScrollModeButtons',\n                                                  'hiddenSpreadModeButtons');\n      } else {\n        this.toolbarButtonContainer.classList.remove('hiddenScrollModeButtons',\n                                                     'hiddenSpreadModeButtons');\n      }\n    });\n  }\n\n  /**\n   * @return {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 (let button in this.buttons) {\n      let { element, eventName, close, eventDetails, } = this.buttons[button];\n\n      element.addEventListener('click', (evt) => {\n        if (eventName !== null) {\n          let details = { source: this, };\n          for (let 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('toggled',\n        tool === CursorTool.SELECT);\n      buttons.cursorHandToolButton.classList.toggle('toggled',\n        tool === CursorTool.HAND);\n    });\n  }\n\n  _bindScrollModeListener(buttons) {\n    function scrollModeChanged({ mode, }) {\n      buttons.scrollVerticalButton.classList.toggle('toggled',\n        mode === ScrollMode.VERTICAL);\n      buttons.scrollHorizontalButton.classList.toggle('toggled',\n        mode === ScrollMode.HORIZONTAL);\n      buttons.scrollWrappedButton.classList.toggle('toggled',\n        mode === ScrollMode.WRAPPED);\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('toggled',\n        mode === SpreadMode.NONE);\n      buttons.spreadOddButton.classList.toggle('toggled',\n        mode === SpreadMode.ODD);\n      buttons.spreadEvenButton.classList.toggle('toggled',\n        mode === SpreadMode.EVEN);\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.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  }\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.setAttribute('style',\n      'max-height: ' + (this.containerHeight - SCROLLBAR_PADDING) + 'px;');\n\n    this.previousContainerHeight = this.containerHeight;\n  }\n}\n\nexport {\n  SecondaryToolbar,\n};\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BaseViewer } from './base_viewer';\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 _setDocumentViewerElement() {\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, '_setDocumentViewerElement', this._shadowViewer);\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    let pageView = this._pages[this._currentPageNumber - 1];\n    let previousPageView = this._pages[this._previousPageNumber - 1];\n\n    let 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        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    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) { // 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\nexport {\n  PDFSinglePageViewer,\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\nimport {\n  animationStarted, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, MAX_SCALE,\n  MIN_SCALE, noContextMenuHandler, NullL10n\n} from './ui_utils';\n\nconst PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';\nconst SCALE_SELECT_CONTAINER_PADDING = 8;\nconst SCALE_SELECT_PADDING = 22;\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 = NullL10n) {\n    this.toolbar = options.container;\n    this.eventBus = eventBus;\n    this.l10n = l10n;\n    this.items = options;\n\n    this._wasLocalized = false;\n    this.reset();\n\n    // Bind the event listeners for click and hand tool 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  }\n\n  _bindListeners() {\n    let { eventBus, items, } = this;\n    let self = this;\n\n    items.previous.addEventListener('click', function() {\n      eventBus.dispatch('previouspage', { source: self, });\n    });\n\n    items.next.addEventListener('click', function() {\n      eventBus.dispatch('nextpage', { source: self, });\n    });\n\n    items.zoomIn.addEventListener('click', function() {\n      eventBus.dispatch('zoomin', { source: self, });\n    });\n\n    items.zoomOut.addEventListener('click', function() {\n      eventBus.dispatch('zoomout', { source: self, });\n    });\n\n    items.pageNumber.addEventListener('click', function() {\n      this.select();\n    });\n\n    items.pageNumber.addEventListener('change', function() {\n      eventBus.dispatch('pagenumberchanged', {\n        source: self,\n        value: this.value,\n      });\n    });\n\n    items.scaleSelect.addEventListener('change', function() {\n      if (this.value === 'custom') {\n        return;\n      }\n      eventBus.dispatch('scalechanged', {\n        source: self,\n        value: this.value,\n      });\n    });\n\n    items.presentationModeButton.addEventListener('click', function() {\n      eventBus.dispatch('presentationmode', { source: self, });\n    });\n\n    items.openFile.addEventListener('click', function() {\n      eventBus.dispatch('openfile', { source: self, });\n    });\n\n    items.print.addEventListener('click', function() {\n      eventBus.dispatch('print', { source: self, });\n    });\n\n    items.download.addEventListener('click', function() {\n      eventBus.dispatch('download', { source: self, });\n    });\n\n    // Suppress context menus for some controls.\n    items.scaleSelect.oncontextmenu = noContextMenuHandler;\n\n    eventBus.on('localized', () => {\n      this._localized();\n    });\n  }\n\n  _localized() {\n    this._wasLocalized = true;\n    this._adjustScaleWidth();\n    this._updateUIState(true);\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, }, 'of {{pagesCount}}').\n            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, },\n                    '({{pageNumber}} of {{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    let customScale = Math.round(pageScale * 10000) / 100;\n    this.l10n.get('page_scale_percent', { scale: customScale, },\n                  '{{scale}}%').then((msg) => {\n      let options = items.scaleSelect.options;\n      let predefinedValueFound = false;\n      for (let i = 0, ii = options.length; i < ii; i++) {\n        let option = options[i];\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    let pageNumberInput = this.items.pageNumber;\n\n    pageNumberInput.classList.toggle(PAGE_NUMBER_LOADING_INDICATOR, loading);\n  }\n\n  _adjustScaleWidth() {\n    let container = this.items.scaleSelectContainer;\n    let select = this.items.scaleSelect;\n\n    animationStarted.then(function() {\n      // Adjust the width of the zoom box to fit the content.\n      // Note: If the window is narrow enough that the zoom box is not\n      //       visible, we temporarily show it to be able to adjust its width.\n      if (container.clientWidth === 0) {\n        container.setAttribute('style', 'display: inherit;');\n      }\n      if (container.clientWidth > 0) {\n        select.setAttribute('style', 'min-width: inherit;');\n        let width = select.clientWidth + SCALE_SELECT_CONTAINER_PADDING;\n        select.setAttribute('style', 'min-width: ' +\n                                     (width + SCALE_SELECT_PADDING) + 'px;');\n        container.setAttribute('style', 'min-width: ' + width + 'px; ' +\n                                        'max-width: ' + width + 'px;');\n      }\n    });\n  }\n}\n\nexport {\n  Toolbar,\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 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 *  - FIREFOX or 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      let database = JSON.parse(databaseStr || '{}');\n      if (!('files' in database)) {\n        database.files = [];\n      } else {\n        while (database.files.length >= this.cacheSize) {\n          database.files.shift();\n        }\n      }\n      let index = -1;\n      for (let i = 0, length = database.files.length; i < length; i++) {\n        let branch = database.files[i];\n        if (branch.fingerprint === this.fingerprint) {\n          index = i;\n          break;\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    let databaseStr = JSON.stringify(this.database);\n\n    if (typeof PDFJSDev !== 'undefined' &&\n        PDFJSDev.test('FIREFOX || 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' &&\n        PDFJSDev.test('FIREFOX || 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 (let 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    let val = this.file[name];\n    return val !== undefined ? val : defaultValue;\n  }\n\n  async getMultiple(properties) {\n    await this._initializedPromise;\n    let values = Object.create(null);\n\n    for (let name in properties) {\n      let val = this.file[name];\n      values[name] = val !== undefined ? val : properties[name];\n    }\n    return values;\n  }\n}\n\nexport {\n  ViewHistory,\n};\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DefaultExternalServices, PDFViewerApplication } from './app';\nimport { BasePreferences } from './preferences';\nimport { DownloadManager } from './download_manager';\nimport { GenericL10n } from './genericl10n';\n\nif (typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('GENERIC')) {\n  throw new Error('Module \"pdfjs-web/genericcom\" shall not be used outside ' +\n                  'GENERIC build.');\n}\n\nlet 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\nlet GenericExternalServices = Object.create(DefaultExternalServices);\nGenericExternalServices.createDownloadManager = function(options) {\n  return new DownloadManager(options);\n};\nGenericExternalServices.createPreferences = function() {\n  return new GenericPreferences();\n};\nGenericExternalServices.createL10n = function({ locale = 'en-US', }) {\n  return new GenericL10n(locale);\n};\nPDFViewerApplication.externalServices = GenericExternalServices;\n\nexport {\n  GenericCom,\n};\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\nlet defaultPreferences = null;\nfunction getDefaultPreferences() {\n  if (!defaultPreferences) {\n    if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) {\n      defaultPreferences = Promise.resolve(\n        PDFJSDev.json('$ROOT/build/default_preferences.json'));\n    } else {\n      defaultPreferences = new Promise(function(resolve, reject) {\n        if (typeof SystemJS === 'object') {\n          SystemJS.import('./app_options').then(resolve, reject);\n        } else if (typeof require === 'function') {\n          try {\n            resolve(require('./app_options.js'));\n          } catch (ex) {\n            reject(ex);\n          }\n        } else {\n          reject(new Error(\n            'SystemJS or CommonJS must be used to load AppOptions.'));\n        }\n      }).then(function({ AppOptions, OptionKind, }) {\n        return AppOptions.getAll(OptionKind.PREFERENCE);\n      });\n    }\n  }\n  return defaultPreferences;\n}\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    this.prefs = null;\n\n    this._initializedPromise = getDefaultPreferences().then((defaults) => {\n      Object.defineProperty(this, 'defaults', {\n        value: Object.freeze(defaults),\n        writable: false,\n        enumerable: true,\n        configurable: false,\n      });\n\n      this.prefs = Object.assign(Object.create(null), defaults);\n      return this._readFromStorage(defaults);\n    }).then((prefs) => {\n      if (!prefs) {\n        return;\n      }\n      for (let name in prefs) {\n        const defaultValue = this.defaults[name], prefValue = prefs[name];\n        // Ignore preferences not present in, or whose types don't match,\n        // the default values.\n        if (defaultValue === undefined ||\n            typeof prefValue !== typeof defaultValue) {\n          continue;\n        }\n        this.prefs[name] = prefValue;\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   * @return {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   * @return {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   * @return {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.assign(Object.create(null), this.defaults);\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   * @return {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    let 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    let valueType = typeof value;\n    let defaultType = typeof defaultValue;\n\n    if (valueType !== defaultType) {\n      if (valueType === 'number' && defaultType === 'string') {\n        value = value.toString();\n      } else {\n        throw new Error(`Set preference: \"${value}\" is a ${valueType}, ` +\n                        `expected a ${defaultType}.`);\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   * @return {Promise} A promise that is resolved with a {boolean|number|string}\n   *                   containing the value of the preference.\n   */\n  async get(name) {\n    await this._initializedPromise;\n    let defaultValue = this.defaults[name];\n\n    if (defaultValue === undefined) {\n      throw new Error(`Get preference: \"${name}\" is undefined.`);\n    } else {\n      let prefValue = this.prefs[name];\n\n      if (prefValue !== undefined) {\n        return prefValue;\n      }\n    }\n    return defaultValue;\n  }\n\n  /**\n   * Get the values of all preferences.\n   * @return {Pro