pdfjs-dist
Version:
Generic build of Mozilla's PDF.js library.
1,987 lines (1,604 loc) • 188 kB
JavaScript
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2021 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("pdfjs-dist/web/pdf_viewer", [], factory);
else if(typeof exports === 'object')
exports["pdfjs-dist/web/pdf_viewer"] = factory();
else
root["pdfjs-dist/web/pdf_viewer"] = root.pdfjsViewer = factory();
})(this, function() {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = void 0;
var _pdfjsLib = __w_pdfjs_require__(2);
var _l10n_utils = __w_pdfjs_require__(3);
var _pdf_link_service = __w_pdfjs_require__(4);
class AnnotationLayerBuilder {
constructor({
pageDiv,
pdfPage,
linkService,
downloadManager,
annotationStorage = null,
imageResourcesPath = "",
renderInteractiveForms = true,
l10n = _l10n_utils.NullL10n,
enableScripting = false,
hasJSActionsPromise = null,
mouseState = null
}) {
this.pageDiv = pageDiv;
this.pdfPage = pdfPage;
this.linkService = linkService;
this.downloadManager = downloadManager;
this.imageResourcesPath = imageResourcesPath;
this.renderInteractiveForms = renderInteractiveForms;
this.l10n = l10n;
this.annotationStorage = annotationStorage;
this.enableScripting = enableScripting;
this._hasJSActionsPromise = hasJSActionsPromise;
this._mouseState = mouseState;
this.div = null;
this._cancelled = false;
}
render(viewport, intent = "display") {
return Promise.all([this.pdfPage.getAnnotations({
intent
}), this._hasJSActionsPromise]).then(([annotations, hasJSActions = false]) => {
if (this._cancelled) {
return;
}
if (annotations.length === 0) {
return;
}
const parameters = {
viewport: viewport.clone({
dontFlip: true
}),
div: this.div,
annotations,
page: this.pdfPage,
imageResourcesPath: this.imageResourcesPath,
renderInteractiveForms: this.renderInteractiveForms,
linkService: this.linkService,
downloadManager: this.downloadManager,
annotationStorage: this.annotationStorage,
enableScripting: this.enableScripting,
hasJSActions,
mouseState: this._mouseState
};
if (this.div) {
_pdfjsLib.AnnotationLayer.update(parameters);
} else {
this.div = document.createElement("div");
this.div.className = "annotationLayer";
this.pageDiv.appendChild(this.div);
parameters.div = this.div;
_pdfjsLib.AnnotationLayer.render(parameters);
this.l10n.translate(this.div);
}
});
}
cancel() {
this._cancelled = true;
}
hide() {
if (!this.div) {
return;
}
this.div.hidden = true;
}
}
exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
class DefaultAnnotationLayerFactory {
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = true, l10n = _l10n_utils.NullL10n, enableScripting = false, hasJSActionsPromise = null, mouseState = null) {
return new AnnotationLayerBuilder({
pageDiv,
pdfPage,
imageResourcesPath,
renderInteractiveForms,
linkService: new _pdf_link_service.SimpleLinkService(),
l10n,
annotationStorage,
enableScripting,
hasJSActionsPromise,
mouseState
});
}
}
exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;
/***/ }),
/* 2 */
/***/ ((module) => {
let pdfjsLib;
if (typeof window !== "undefined" && window["pdfjs-dist/build/pdf"]) {
pdfjsLib = window["pdfjs-dist/build/pdf"];
} else {
pdfjsLib = require("../build/pdf.js");
}
module.exports = pdfjsLib;
/***/ }),
/* 3 */
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.getL10nFallback = getL10nFallback;
exports.NullL10n = void 0;
const DEFAULT_L10N_STRINGS = {
of_pages: "of {{pagesCount}}",
page_of_pages: "({{pageNumber}} of {{pagesCount}})",
document_properties_kb: "{{size_kb}} KB ({{size_b}} bytes)",
document_properties_mb: "{{size_mb}} MB ({{size_b}} bytes)",
document_properties_date_string: "{{date}}, {{time}}",
document_properties_page_size_unit_inches: "in",
document_properties_page_size_unit_millimeters: "mm",
document_properties_page_size_orientation_portrait: "portrait",
document_properties_page_size_orientation_landscape: "landscape",
document_properties_page_size_name_a3: "A3",
document_properties_page_size_name_a4: "A4",
document_properties_page_size_name_letter: "Letter",
document_properties_page_size_name_legal: "Legal",
document_properties_page_size_dimension_string: "{{width}} × {{height}} {{unit}} ({{orientation}})",
document_properties_page_size_dimension_name_string: "{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",
document_properties_linearized_yes: "Yes",
document_properties_linearized_no: "No",
print_progress_percent: "{{progress}}%",
"toggle_sidebar.title": "Toggle Sidebar",
"toggle_sidebar_notification2.title": "Toggle Sidebar (document contains outline/attachments/layers)",
additional_layers: "Additional Layers",
page_landmark: "Page {{page}}",
thumb_page_title: "Page {{page}}",
thumb_page_canvas: "Thumbnail of Page {{page}}",
find_reached_top: "Reached top of document, continued from bottom",
find_reached_bottom: "Reached end of document, continued from top",
"find_match_count[one]": "{{current}} of {{total}} match",
"find_match_count[other]": "{{current}} of {{total}} matches",
"find_match_count_limit[one]": "More than {{limit}} match",
"find_match_count_limit[other]": "More than {{limit}} matches",
find_not_found: "Phrase not found",
error_version_info: "PDF.js v{{version}} (build: {{build}})",
error_message: "Message: {{message}}",
error_stack: "Stack: {{stack}}",
error_file: "File: {{file}}",
error_line: "Line: {{line}}",
rendering_error: "An error occurred while rendering the page.",
page_scale_width: "Page Width",
page_scale_fit: "Page Fit",
page_scale_auto: "Automatic Zoom",
page_scale_actual: "Actual Size",
page_scale_percent: "{{scale}}%",
loading: "Loading…",
loading_error: "An error occurred while loading the PDF.",
invalid_file_error: "Invalid or corrupted PDF file.",
missing_file_error: "Missing PDF file.",
unexpected_response_error: "Unexpected server response.",
printing_not_supported: "Warning: Printing is not fully supported by this browser.",
printing_not_ready: "Warning: The PDF is not fully loaded for printing.",
web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts."
};
function getL10nFallback(key, args) {
switch (key) {
case "find_match_count":
key = `find_match_count[${args.total === 1 ? "one" : "other"}]`;
break;
case "find_match_count_limit":
key = `find_match_count_limit[${args.limit === 1 ? "one" : "other"}]`;
break;
}
return DEFAULT_L10N_STRINGS[key] || "";
}
function formatL10nValue(text, args) {
if (!args) {
return text;
}
return text.replace(/\{\{\s*(\w+)\s*\}\}/g, (all, name) => {
return name in args ? args[name] : "{{" + name + "}}";
});
}
const NullL10n = {
async getLanguage() {
return "en-us";
},
async getDirection() {
return "ltr";
},
async get(key, args = null, fallback = getL10nFallback(key, args)) {
return formatL10nValue(fallback, args);
},
async translate(element) {}
};
exports.NullL10n = NullL10n;
/***/ }),
/* 4 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.SimpleLinkService = exports.PDFLinkService = void 0;
var _ui_utils = __w_pdfjs_require__(5);
class PDFLinkService {
constructor({
eventBus,
externalLinkTarget = null,
externalLinkRel = null,
externalLinkEnabled = true,
ignoreDestinationZoom = false
} = {}) {
this.eventBus = eventBus;
this.externalLinkTarget = externalLinkTarget;
this.externalLinkRel = externalLinkRel;
this.externalLinkEnabled = externalLinkEnabled;
this._ignoreDestinationZoom = ignoreDestinationZoom;
this.baseUrl = null;
this.pdfDocument = null;
this.pdfViewer = null;
this.pdfHistory = null;
this._pagesRefCache = null;
}
setDocument(pdfDocument, baseUrl = null) {
this.baseUrl = baseUrl;
this.pdfDocument = pdfDocument;
this._pagesRefCache = Object.create(null);
}
setViewer(pdfViewer) {
this.pdfViewer = pdfViewer;
}
setHistory(pdfHistory) {
this.pdfHistory = pdfHistory;
}
get pagesCount() {
return this.pdfDocument ? this.pdfDocument.numPages : 0;
}
get page() {
return this.pdfViewer.currentPageNumber;
}
set page(value) {
this.pdfViewer.currentPageNumber = value;
}
get rotation() {
return this.pdfViewer.pagesRotation;
}
set rotation(value) {
this.pdfViewer.pagesRotation = value;
}
navigateTo(dest) {
console.error("Deprecated method: `navigateTo`, use `goToDestination` instead.");
this.goToDestination(dest);
}
_goToDestinationHelper(rawDest, namedDest = null, explicitDest) {
const destRef = explicitDest[0];
let pageNumber;
if (destRef instanceof Object) {
pageNumber = this._cachedPageNumber(destRef);
if (pageNumber === null) {
this.pdfDocument.getPageIndex(destRef).then(pageIndex => {
this.cachePageRef(pageIndex + 1, destRef);
this._goToDestinationHelper(rawDest, namedDest, explicitDest);
}).catch(() => {
console.error(`PDFLinkService._goToDestinationHelper: "${destRef}" is not ` + `a valid page reference, for dest="${rawDest}".`);
});
return;
}
} else if (Number.isInteger(destRef)) {
pageNumber = destRef + 1;
} else {
console.error(`PDFLinkService._goToDestinationHelper: "${destRef}" is not ` + `a valid destination reference, for dest="${rawDest}".`);
return;
}
if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {
console.error(`PDFLinkService._goToDestinationHelper: "${pageNumber}" is not ` + `a valid page number, for dest="${rawDest}".`);
return;
}
if (this.pdfHistory) {
this.pdfHistory.pushCurrentPosition();
this.pdfHistory.push({
namedDest,
explicitDest,
pageNumber
});
}
this.pdfViewer.scrollPageIntoView({
pageNumber,
destArray: explicitDest,
ignoreDestinationZoom: this._ignoreDestinationZoom
});
}
async goToDestination(dest) {
if (!this.pdfDocument) {
return;
}
let namedDest, explicitDest;
if (typeof dest === "string") {
namedDest = dest;
explicitDest = await this.pdfDocument.getDestination(dest);
} else {
namedDest = null;
explicitDest = await dest;
}
if (!Array.isArray(explicitDest)) {
console.error(`PDFLinkService.goToDestination: "${explicitDest}" is not ` + `a valid destination array, for dest="${dest}".`);
return;
}
this._goToDestinationHelper(dest, namedDest, explicitDest);
}
goToPage(val) {
if (!this.pdfDocument) {
return;
}
const pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0;
if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
console.error(`PDFLinkService.goToPage: "${val}" is not a valid page.`);
return;
}
if (this.pdfHistory) {
this.pdfHistory.pushCurrentPosition();
this.pdfHistory.pushPage(pageNumber);
}
this.pdfViewer.scrollPageIntoView({
pageNumber
});
}
getDestinationHash(dest) {
if (typeof dest === "string") {
if (dest.length > 0) {
return this.getAnchorUrl("#" + escape(dest));
}
} else if (Array.isArray(dest)) {
const str = JSON.stringify(dest);
if (str.length > 0) {
return this.getAnchorUrl("#" + escape(str));
}
}
return this.getAnchorUrl("");
}
getAnchorUrl(anchor) {
return (this.baseUrl || "") + anchor;
}
setHash(hash) {
if (!this.pdfDocument) {
return;
}
let pageNumber, dest;
if (hash.includes("=")) {
const params = (0, _ui_utils.parseQueryString)(hash);
if ("search" in params) {
this.eventBus.dispatch("findfromurlhash", {
source: this,
query: params.search.replace(/"/g, ""),
phraseSearch: params.phrase === "true"
});
}
if ("page" in params) {
pageNumber = params.page | 0 || 1;
}
if ("zoom" in params) {
const zoomArgs = params.zoom.split(",");
const zoomArg = zoomArgs[0];
const zoomArgNumber = parseFloat(zoomArg);
if (!zoomArg.includes("Fit")) {
dest = [null, {
name: "XYZ"
}, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg];
} else {
if (zoomArg === "Fit" || zoomArg === "FitB") {
dest = [null, {
name: zoomArg
}];
} else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") {
dest = [null, {
name: zoomArg
}, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null];
} else if (zoomArg === "FitR") {
if (zoomArgs.length !== 5) {
console.error('PDFLinkService.setHash: Not enough parameters for "FitR".');
} else {
dest = [null, {
name: zoomArg
}, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0];
}
} else {
console.error(`PDFLinkService.setHash: "${zoomArg}" is not ` + "a valid zoom value.");
}
}
}
if (dest) {
this.pdfViewer.scrollPageIntoView({
pageNumber: pageNumber || this.page,
destArray: dest,
allowNegativeOffset: true
});
} else if (pageNumber) {
this.page = pageNumber;
}
if ("pagemode" in params) {
this.eventBus.dispatch("pagemode", {
source: this,
mode: params.pagemode
});
}
if ("nameddest" in params) {
this.goToDestination(params.nameddest);
}
} else {
dest = unescape(hash);
try {
dest = JSON.parse(dest);
if (!Array.isArray(dest)) {
dest = dest.toString();
}
} catch (ex) {}
if (typeof dest === "string" || isValidExplicitDestination(dest)) {
this.goToDestination(dest);
return;
}
console.error(`PDFLinkService.setHash: "${unescape(hash)}" is not ` + "a valid destination.");
}
}
executeNamedAction(action) {
switch (action) {
case "GoBack":
if (this.pdfHistory) {
this.pdfHistory.back();
}
break;
case "GoForward":
if (this.pdfHistory) {
this.pdfHistory.forward();
}
break;
case "NextPage":
this.pdfViewer.nextPage();
break;
case "PrevPage":
this.pdfViewer.previousPage();
break;
case "LastPage":
this.page = this.pagesCount;
break;
case "FirstPage":
this.page = 1;
break;
default:
break;
}
this.eventBus.dispatch("namedaction", {
source: this,
action
});
}
cachePageRef(pageNum, pageRef) {
if (!pageRef) {
return;
}
const refStr = pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;
this._pagesRefCache[refStr] = pageNum;
}
_cachedPageNumber(pageRef) {
const refStr = pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;
return this._pagesRefCache?.[refStr] || null;
}
isPageVisible(pageNumber) {
return this.pdfViewer.isPageVisible(pageNumber);
}
isPageCached(pageNumber) {
return this.pdfViewer.isPageCached(pageNumber);
}
}
exports.PDFLinkService = PDFLinkService;
function isValidExplicitDestination(dest) {
if (!Array.isArray(dest)) {
return false;
}
const destLength = dest.length;
if (destLength < 2) {
return false;
}
const page = dest[0];
if (!(typeof page === "object" && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) {
return false;
}
const zoom = dest[1];
if (!(typeof zoom === "object" && typeof zoom.name === "string")) {
return false;
}
let allowNull = true;
switch (zoom.name) {
case "XYZ":
if (destLength !== 5) {
return false;
}
break;
case "Fit":
case "FitB":
return destLength === 2;
case "FitH":
case "FitBH":
case "FitV":
case "FitBV":
if (destLength !== 3) {
return false;
}
break;
case "FitR":
if (destLength !== 6) {
return false;
}
allowNull = false;
break;
default:
return false;
}
for (let i = 2; i < destLength; i++) {
const param = dest[i];
if (!(typeof param === "number" || allowNull && param === null)) {
return false;
}
}
return true;
}
class SimpleLinkService {
constructor() {
this.externalLinkTarget = null;
this.externalLinkRel = null;
this.externalLinkEnabled = true;
this._ignoreDestinationZoom = false;
}
get pagesCount() {
return 0;
}
get page() {
return 0;
}
set page(value) {}
get rotation() {
return 0;
}
set rotation(value) {}
async goToDestination(dest) {}
goToPage(val) {}
getDestinationHash(dest) {
return "#";
}
getAnchorUrl(hash) {
return "#";
}
setHash(hash) {}
executeNamedAction(action) {}
cachePageRef(pageNum, pageRef) {}
isPageVisible(pageNumber) {
return true;
}
isPageCached(pageNumber) {
return true;
}
}
exports.SimpleLinkService = SimpleLinkService;
/***/ }),
/* 5 */
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.apiPageLayoutToSpreadMode = apiPageLayoutToSpreadMode;
exports.apiPageModeToSidebarView = apiPageModeToSidebarView;
exports.approximateFraction = approximateFraction;
exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements;
exports.binarySearchFirstItem = binarySearchFirstItem;
exports.getActiveOrFocusedElement = getActiveOrFocusedElement;
exports.getOutputScale = getOutputScale;
exports.getPageSizeInches = getPageSizeInches;
exports.getVisibleElements = getVisibleElements;
exports.isPortraitOrientation = isPortraitOrientation;
exports.isValidRotation = isValidRotation;
exports.isValidScrollMode = isValidScrollMode;
exports.isValidSpreadMode = isValidSpreadMode;
exports.moveToEndOfArray = moveToEndOfArray;
exports.noContextMenuHandler = noContextMenuHandler;
exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
exports.parseQueryString = parseQueryString;
exports.roundToDivide = roundToDivide;
exports.scrollIntoView = scrollIntoView;
exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
exports.watchScroll = watchScroll;
exports.WaitOnType = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = exports.RendererType = exports.ProgressBar = exports.PresentationModeState = exports.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.EventBus = exports.DEFAULT_SCALE_VALUE = exports.DEFAULT_SCALE = exports.CSS_UNITS = exports.AutoPrintRegExp = exports.animationStarted = void 0;
const CSS_UNITS = 96.0 / 72.0;
exports.CSS_UNITS = CSS_UNITS;
const DEFAULT_SCALE_VALUE = "auto";
exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
const DEFAULT_SCALE = 1.0;
exports.DEFAULT_SCALE = DEFAULT_SCALE;
const MIN_SCALE = 0.1;
exports.MIN_SCALE = MIN_SCALE;
const MAX_SCALE = 10.0;
exports.MAX_SCALE = MAX_SCALE;
const UNKNOWN_SCALE = 0;
exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
const MAX_AUTO_SCALE = 1.25;
exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
const SCROLLBAR_PADDING = 40;
exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
const VERTICAL_PADDING = 5;
exports.VERTICAL_PADDING = VERTICAL_PADDING;
const LOADINGBAR_END_OFFSET_VAR = "--loadingBar-end-offset";
const PresentationModeState = {
UNKNOWN: 0,
NORMAL: 1,
CHANGING: 2,
FULLSCREEN: 3
};
exports.PresentationModeState = PresentationModeState;
const SidebarView = {
UNKNOWN: -1,
NONE: 0,
THUMBS: 1,
OUTLINE: 2,
ATTACHMENTS: 3,
LAYERS: 4
};
exports.SidebarView = SidebarView;
const RendererType = {
CANVAS: "canvas",
SVG: "svg"
};
exports.RendererType = RendererType;
const TextLayerMode = {
DISABLE: 0,
ENABLE: 1,
ENABLE_ENHANCE: 2
};
exports.TextLayerMode = TextLayerMode;
const ScrollMode = {
UNKNOWN: -1,
VERTICAL: 0,
HORIZONTAL: 1,
WRAPPED: 2
};
exports.ScrollMode = ScrollMode;
const SpreadMode = {
UNKNOWN: -1,
NONE: 0,
ODD: 1,
EVEN: 2
};
exports.SpreadMode = SpreadMode;
const AutoPrintRegExp = /\bprint\s*\(/;
exports.AutoPrintRegExp = AutoPrintRegExp;
function getOutputScale(ctx) {
const devicePixelRatio = window.devicePixelRatio || 1;
const backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
const pixelRatio = devicePixelRatio / backingStoreRatio;
return {
sx: pixelRatio,
sy: pixelRatio,
scaled: pixelRatio !== 1
};
}
function scrollIntoView(element, spot, skipOverflowHiddenElements = false) {
let parent = element.offsetParent;
if (!parent) {
console.error("offsetParent is not set -- cannot scroll");
return;
}
let offsetY = element.offsetTop + element.clientTop;
let offsetX = element.offsetLeft + element.clientLeft;
while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || skipOverflowHiddenElements && getComputedStyle(parent).overflow === "hidden") {
if (parent.dataset._scaleY) {
offsetY /= parent.dataset._scaleY;
offsetX /= parent.dataset._scaleX;
}
offsetY += parent.offsetTop;
offsetX += parent.offsetLeft;
parent = parent.offsetParent;
if (!parent) {
return;
}
}
if (spot) {
if (spot.top !== undefined) {
offsetY += spot.top;
}
if (spot.left !== undefined) {
offsetX += spot.left;
parent.scrollLeft = offsetX;
}
}
parent.scrollTop = offsetY;
}
function watchScroll(viewAreaElement, callback) {
const debounceScroll = function (evt) {
if (rAF) {
return;
}
rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
rAF = null;
const currentX = viewAreaElement.scrollLeft;
const lastX = state.lastX;
if (currentX !== lastX) {
state.right = currentX > lastX;
}
state.lastX = currentX;
const currentY = viewAreaElement.scrollTop;
const lastY = state.lastY;
if (currentY !== lastY) {
state.down = currentY > lastY;
}
state.lastY = currentY;
callback(state);
});
};
const state = {
right: true,
down: true,
lastX: viewAreaElement.scrollLeft,
lastY: viewAreaElement.scrollTop,
_eventHandler: debounceScroll
};
let rAF = null;
viewAreaElement.addEventListener("scroll", debounceScroll, true);
return state;
}
function parseQueryString(query) {
const parts = query.split("&");
const params = Object.create(null);
for (let i = 0, ii = parts.length; i < ii; ++i) {
const param = parts[i].split("=");
const key = param[0].toLowerCase();
const value = param.length > 1 ? param[1] : null;
params[decodeURIComponent(key)] = decodeURIComponent(value);
}
return params;
}
function binarySearchFirstItem(items, condition) {
let minIndex = 0;
let maxIndex = items.length - 1;
if (maxIndex < 0 || !condition(items[maxIndex])) {
return items.length;
}
if (condition(items[minIndex])) {
return minIndex;
}
while (minIndex < maxIndex) {
const currentIndex = minIndex + maxIndex >> 1;
const currentItem = items[currentIndex];
if (condition(currentItem)) {
maxIndex = currentIndex;
} else {
minIndex = currentIndex + 1;
}
}
return minIndex;
}
function approximateFraction(x) {
if (Math.floor(x) === x) {
return [x, 1];
}
const xinv = 1 / x;
const limit = 8;
if (xinv > limit) {
return [1, limit];
} else if (Math.floor(xinv) === xinv) {
return [1, xinv];
}
const x_ = x > 1 ? xinv : x;
let a = 0,
b = 1,
c = 1,
d = 1;
while (true) {
const p = a + c,
q = b + d;
if (q > limit) {
break;
}
if (x_ <= p / q) {
c = p;
d = q;
} else {
a = p;
b = q;
}
}
let result;
if (x_ - a / b < c / d - x_) {
result = x_ === x ? [a, b] : [b, a];
} else {
result = x_ === x ? [c, d] : [d, c];
}
return result;
}
function roundToDivide(x, div) {
const r = x % div;
return r === 0 ? x : Math.round(x - r + div);
}
function getPageSizeInches({
view,
userUnit,
rotate
}) {
const [x1, y1, x2, y2] = view;
const changeOrientation = rotate % 180 !== 0;
const width = (x2 - x1) / 72 * userUnit;
const height = (y2 - y1) / 72 * userUnit;
return {
width: changeOrientation ? height : width,
height: changeOrientation ? width : height
};
}
function backtrackBeforeAllVisibleElements(index, views, top) {
if (index < 2) {
return index;
}
let elt = views[index].div;
let pageTop = elt.offsetTop + elt.clientTop;
if (pageTop >= top) {
elt = views[index - 1].div;
pageTop = elt.offsetTop + elt.clientTop;
}
for (let i = index - 2; i >= 0; --i) {
elt = views[i].div;
if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {
break;
}
index = i;
}
return index;
}
function getVisibleElements({
scrollEl,
views,
sortByVisibility = false,
horizontal = false,
rtl = false
}) {
const top = scrollEl.scrollTop,
bottom = top + scrollEl.clientHeight;
const left = scrollEl.scrollLeft,
right = left + scrollEl.clientWidth;
function isElementBottomAfterViewTop(view) {
const element = view.div;
const elementBottom = element.offsetTop + element.clientTop + element.clientHeight;
return elementBottom > top;
}
function isElementNextAfterViewHorizontally(view) {
const element = view.div;
const elementLeft = element.offsetLeft + element.clientLeft;
const elementRight = elementLeft + element.clientWidth;
return rtl ? elementLeft < right : elementRight > left;
}
const visible = [],
numViews = views.length;
let firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop);
if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) {
firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);
}
let lastEdge = horizontal ? right : -1;
for (let i = firstVisibleElementInd; i < numViews; i++) {
const view = views[i],
element = view.div;
const currentWidth = element.offsetLeft + element.clientLeft;
const currentHeight = element.offsetTop + element.clientTop;
const viewWidth = element.clientWidth,
viewHeight = element.clientHeight;
const viewRight = currentWidth + viewWidth;
const viewBottom = currentHeight + viewHeight;
if (lastEdge === -1) {
if (viewBottom >= bottom) {
lastEdge = viewBottom;
}
} else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {
break;
}
if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) {
continue;
}
const hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);
const hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);
const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,
fractionWidth = (viewWidth - hiddenWidth) / viewWidth;
const percent = fractionHeight * fractionWidth * 100 | 0;
visible.push({
id: view.id,
x: currentWidth,
y: currentHeight,
view,
percent,
widthPercent: fractionWidth * 100 | 0
});
}
const first = visible[0],
last = visible[visible.length - 1];
if (sortByVisibility) {
visible.sort(function (a, b) {
const pc = a.percent - b.percent;
if (Math.abs(pc) > 0.001) {
return -pc;
}
return a.id - b.id;
});
}
return {
first,
last,
views: visible
};
}
function noContextMenuHandler(evt) {
evt.preventDefault();
}
function normalizeWheelEventDirection(evt) {
let delta = Math.hypot(evt.deltaX, evt.deltaY);
const angle = Math.atan2(evt.deltaY, evt.deltaX);
if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {
delta = -delta;
}
return delta;
}
function normalizeWheelEventDelta(evt) {
let delta = normalizeWheelEventDirection(evt);
const MOUSE_DOM_DELTA_PIXEL_MODE = 0;
const MOUSE_DOM_DELTA_LINE_MODE = 1;
const MOUSE_PIXELS_PER_LINE = 30;
const MOUSE_LINES_PER_PAGE = 30;
if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {
delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;
} else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {
delta /= MOUSE_LINES_PER_PAGE;
}
return delta;
}
function isValidRotation(angle) {
return Number.isInteger(angle) && angle % 90 === 0;
}
function isValidScrollMode(mode) {
return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN;
}
function isValidSpreadMode(mode) {
return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN;
}
function isPortraitOrientation(size) {
return size.width <= size.height;
}
const WaitOnType = {
EVENT: "event",
TIMEOUT: "timeout"
};
exports.WaitOnType = WaitOnType;
function waitOnEventOrTimeout({
target,
name,
delay = 0
}) {
return new Promise(function (resolve, reject) {
if (typeof target !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && delay >= 0)) {
throw new Error("waitOnEventOrTimeout - invalid parameters.");
}
function handler(type) {
if (target instanceof EventBus) {
target._off(name, eventHandler);
} else {
target.removeEventListener(name, eventHandler);
}
if (timeout) {
clearTimeout(timeout);
}
resolve(type);
}
const eventHandler = handler.bind(null, WaitOnType.EVENT);
if (target instanceof EventBus) {
target._on(name, eventHandler);
} else {
target.addEventListener(name, eventHandler);
}
const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
const timeout = setTimeout(timeoutHandler, delay);
});
}
const animationStarted = new Promise(function (resolve) {
window.requestAnimationFrame(resolve);
});
exports.animationStarted = animationStarted;
function dispatchDOMEvent(eventName, args = null) {
throw new Error("Not implemented: dispatchDOMEvent");
}
class EventBus {
constructor(options) {
this._listeners = Object.create(null);
}
on(eventName, listener, options = null) {
this._on(eventName, listener, {
external: true,
once: options?.once
});
}
off(eventName, listener, options = null) {
this._off(eventName, listener, {
external: true,
once: options?.once
});
}
dispatch(eventName) {
const eventListeners = this._listeners[eventName];
if (!eventListeners || eventListeners.length === 0) {
return;
}
const args = Array.prototype.slice.call(arguments, 1);
let externalListeners;
eventListeners.slice(0).forEach(({
listener,
external,
once
}) => {
if (once) {
this._off(eventName, listener);
}
if (external) {
(externalListeners || (externalListeners = [])).push(listener);
return;
}
listener.apply(null, args);
});
if (externalListeners) {
externalListeners.forEach(listener => {
listener.apply(null, args);
});
externalListeners = null;
}
}
_on(eventName, listener, options = null) {
var _this$_listeners;
const eventListeners = (_this$_listeners = this._listeners)[eventName] || (_this$_listeners[eventName] = []);
eventListeners.push({
listener,
external: options?.external === true,
once: options?.once === true
});
}
_off(eventName, listener, options = null) {
const eventListeners = this._listeners[eventName];
if (!eventListeners) {
return;
}
for (let i = 0, ii = eventListeners.length; i < ii; i++) {
if (eventListeners[i].listener === listener) {
eventListeners.splice(i, 1);
return;
}
}
}
}
exports.EventBus = EventBus;
function clamp(v, min, max) {
return Math.min(Math.max(v, min), max);
}
class ProgressBar {
constructor(id, {
height,
width,
units
} = {}) {
this.visible = true;
this.div = document.querySelector(id + " .progress");
this.bar = this.div.parentNode;
this.height = height || 100;
this.width = width || 100;
this.units = units || "%";
this.div.style.height = this.height + this.units;
this.percent = 0;
}
_updateBar() {
if (this._indeterminate) {
this.div.classList.add("indeterminate");
this.div.style.width = this.width + this.units;
return;
}
this.div.classList.remove("indeterminate");
const progressSize = this.width * this._percent / 100;
this.div.style.width = progressSize + this.units;
}
get percent() {
return this._percent;
}
set percent(val) {
this._indeterminate = isNaN(val);
this._percent = clamp(val, 0, 100);
this._updateBar();
}
setWidth(viewer) {
if (!viewer) {
return;
}
const container = viewer.parentNode;
const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
if (scrollbarWidth > 0) {
const doc = document.documentElement;
doc.style.setProperty(LOADINGBAR_END_OFFSET_VAR, `${scrollbarWidth}px`);
}
}
hide() {
if (!this.visible) {
return;
}
this.visible = false;
this.bar.classList.add("hidden");
}
show() {
if (this.visible) {
return;
}
this.visible = true;
this.bar.classList.remove("hidden");
}
}
exports.ProgressBar = ProgressBar;
function moveToEndOfArray(arr, condition) {
const moved = [],
len = arr.length;
let write = 0;
for (let read = 0; read < len; ++read) {
if (condition(arr[read])) {
moved.push(arr[read]);
} else {
arr[write] = arr[read];
++write;
}
}
for (let read = 0; write < len; ++read, ++write) {
arr[write] = moved[read];
}
}
function getActiveOrFocusedElement() {
let curRoot = document;
let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
while (curActiveOrFocused?.shadowRoot) {
curRoot = curActiveOrFocused.shadowRoot;
curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
}
return curActiveOrFocused;
}
function apiPageLayoutToSpreadMode(layout) {
switch (layout) {
case "SinglePage":
case "OneColumn":
return SpreadMode.NONE;
case "TwoColumnLeft":
case "TwoPageLeft":
return SpreadMode.ODD;
case "TwoColumnRight":
case "TwoPageRight":
return SpreadMode.EVEN;
}
return SpreadMode.NONE;
}
function apiPageModeToSidebarView(mode) {
switch (mode) {
case "UseNone":
return SidebarView.NONE;
case "UseThumbs":
return SidebarView.THUMBS;
case "UseOutlines":
return SidebarView.OUTLINE;
case "UseAttachments":
return SidebarView.ATTACHMENTS;
case "UseOC":
return SidebarView.LAYERS;
}
return SidebarView.NONE;
}
/***/ }),
/* 6 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.TextLayerBuilder = exports.DefaultTextLayerFactory = void 0;
var _pdfjsLib = __w_pdfjs_require__(2);
const EXPAND_DIVS_TIMEOUT = 300;
class TextLayerBuilder {
constructor({
textLayerDiv,
eventBus,
pageIndex,
viewport,
findController = null,
enhanceTextSelection = false
}) {
this.textLayerDiv = textLayerDiv;
this.eventBus = eventBus;
this.textContent = null;
this.textContentItemsStr = [];
this.textContentStream = null;
this.renderingDone = false;
this.pageIdx = pageIndex;
this.pageNumber = this.pageIdx + 1;
this.matches = [];
this.viewport = viewport;
this.textDivs = [];
this.findController = findController;
this.textLayerRenderTask = null;
this.enhanceTextSelection = enhanceTextSelection;
this._onUpdateTextLayerMatches = null;
this._bindMouse();
}
_finishRendering() {
this.renderingDone = true;
if (!this.enhanceTextSelection) {
const endOfContent = document.createElement("div");
endOfContent.className = "endOfContent";
this.textLayerDiv.appendChild(endOfContent);
}
this.eventBus.dispatch("textlayerrendered", {
source: this,
pageNumber: this.pageNumber,
numTextDivs: this.textDivs.length
});
}
render(timeout = 0) {
if (!(this.textContent || this.textContentStream) || this.renderingDone) {
return;
}
this.cancel();
this.textDivs = [];
const textLayerFrag = document.createDocumentFragment();
this.textLayerRenderTask = (0, _pdfjsLib.renderTextLayer)({
textContent: this.textContent,
textContentStream: this.textContentStream,
container: textLayerFrag,
viewport: this.viewport,
textDivs: this.textDivs,
textContentItemsStr: this.textContentItemsStr,
timeout,
enhanceTextSelection: this.enhanceTextSelection
});
this.textLayerRenderTask.promise.then(() => {
this.textLayerDiv.appendChild(textLayerFrag);
this._finishRendering();
this._updateMatches();
}, function (reason) {});
if (!this._onUpdateTextLayerMatches) {
this._onUpdateTextLayerMatches = evt => {
if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {
this._updateMatches();
}
};
this.eventBus._on("updatetextlayermatches", this._onUpdateTextLayerMatches);
}
}
cancel() {
if (this.textLayerRenderTask) {
this.textLayerRenderTask.cancel();
this.textLayerRenderTask = null;
}
if (this._onUpdateTextLayerMatches) {
this.eventBus._off("updatetextlayermatches", this._onUpdateTextLayerMatches);
this._onUpdateTextLayerMatches = null;
}
}
setTextContentStream(readableStream) {
this.cancel();
this.textContentStream = readableStream;
}
setTextContent(textContent) {
this.cancel();
this.textContent = textContent;
}
_convertMatches(matches, matchesLength) {
if (!matches) {
return [];
}
const {
textContentItemsStr
} = this;
let i = 0,
iIndex = 0;
const end = textContentItemsStr.length - 1;
const result = [];
for (let m = 0, mm = matches.length; m < mm; m++) {
let matchIdx = matches[m];
while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {
iIndex += textContentItemsStr[i].length;
i++;
}
if (i === textContentItemsStr.length) {
console.error("Could not find a matching mapping");
}
const match = {
begin: {
divIdx: i,
offset: matchIdx - iIndex
}
};
matchIdx += matchesLength[m];
while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {
iIndex += textContentItemsStr[i].length;
i++;
}
match.end = {
divIdx: i,
offset: matchIdx - iIndex
};
result.push(match);
}
return result;
}
_renderMatches(matches) {
if (matches.length === 0) {
return;
}
const {
findController,
pageIdx,
textContentItemsStr,
textDivs
} = this;
const isSelectedPage = pageIdx === findController.selected.pageIdx;
const selectedMatchIdx = findController.selected.matchIdx;
const highlightAll = findController.state.highlightAll;
let prevEnd = null;
const infinity = {
divIdx: -1,
offset: undefined
};
function beginText(begin, className) {
const divIdx = begin.divIdx;
textDivs[divIdx].textContent = "";
appendTextToDiv(divIdx, 0, begin.offset, className);
}
function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
const div = textDivs[divIdx];
const content = textContentItemsStr[divIdx].substring(fromOffset, toOffset);
const node = document.createTextNode(content);
if (className) {
const span = document.createElement("span");
span.className = className;
span.appendChild(node);
div.appendChild(span);
return;
}
div.appendChild(node);
}
let i0 = selectedMatchIdx,
i1 = i0 + 1;
if (highlightAll) {
i0 = 0;
i1 = matches.length;
} else if (!isSelectedPage) {
return;
}
for (let i = i0; i < i1; i++) {
const match = matches[i];
const begin = match.begin;
const end = match.end;
const isSelected = isSelectedPage && i === selectedMatchIdx;
const highlightSuffix = isSelected ? " selected" : "";
if (isSelected) {
findController.scrollMatchIntoView({
element: textDivs[begin.divIdx],
pageIndex: pageIdx,
matchIndex: selectedMatchIdx
});
}
if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {
if (prevEnd !== null) {
appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
}
beginText(begin);
} else {
appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);
}
if (begin.divIdx === end.divIdx) {
appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix);
} else {
appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix);
for (let n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {
textDivs[n0].className = "highlight middle" + highlightSuffix;
}
beginText(end, "highlight end" + highlightSuffix);
}
prevEnd = end;
}
if (prevEnd) {
appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
}
}
_updateMatches() {
if (!this.renderingDone) {
return;
}
const {
findController,
matches,
pageIdx,
textContentItemsStr,
textDivs
} = this;
let clearedUntilDivIdx = -1;
for (let i = 0, ii = matches.length; i < ii; i++) {
const match = matches[i];
const begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);
for (let n = begin, end = match.end.divIdx; n <= end; n++) {
const div = textDivs[n];
div.textContent = textContentItemsStr[n];
div.className = "";
}
clearedUntilDivIdx = match.end.divIdx + 1;
}
if (!findController?.highlightMatches) {
return;
}
const pageMatches = findController.pageMatches[pageIdx] || null;
const pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;
this.matches = this._convertMatches(pageMatches, pageMatchesLength);
this._renderMatches(this.matches);
}
_bindMouse() {
const div = this.textLayerDiv;
let expandDivsTimer = null;
div.addEventListener("mousedown", evt => {
if (this.enhanceTextSelection && this.textLayerRenderTask) {
this.textLayerRenderTask.expandTextDivs(true);
if (expandDivsTimer) {
clearTimeout(expandDivsTimer);
expandDivsTimer = null;
}
return;
}
const end = div.querySelector(".endOfContent");
if (!end) {
return;
}
let adjustTop = evt.target !== div;
adjustTop = adjustTop && window.getComputedStyle(end).getPropertyValue("-moz-user-select") !== "none";
if (adjustTop) {
const divBounds = div.getBoundingClientRect();
const r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);
end.style.top = (r * 100).toFixed(2) + "%";
}
end.classList.add("active");
});
div.addEventListener("mouseup", () => {
if (this.enhanceTextSelection && this.textLayerRenderTask) {
expandDivsTimer = setTimeout(() => {
if (this.textLayerRenderTask) {
this.textLayerRenderTask.expandTextDivs(false);
}
expandDivsTimer = null;
}, EXPAND_DIVS_TIMEOUT);
return;
}
const end = div.querySelector(".endOfContent");
if (!end) {
return;
}
end.style.top = "";
end.classList.remove("active");
});
}
}
exports.TextLayerBuilder = TextLayerBuilder;
class DefaultTextLayerFactory {
createTextLayerBuilder(textLayerDiv, pageIndex, viewport, enhanceTextSelection = false, eventBus) {
return new TextLayerBuilder({
textLayerDiv,
pageIndex,
viewport,
enhanceTextSelection,
eventBus
});
}
}
exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
/***/ }),
/* 7 */
/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.DownloadManager = void 0;
var _pdfjsLib = __w_pdfjs_require__(2);
var _viewer_compatibility = __w_pdfjs_require__(8);
;
function download(blobUrl, filename) {
const a = document.createElement("a");
if (!a.click) {
throw new Error('DownloadManager: "a.click()" is not supported.');
}
a.href = blobUrl;
a.target = "_parent";
if ("download" in a) {
a.download = filename;
}
(document.body || document.documentElement).appendChild(a);
a.click();
a.remove();
}
class DownloadManager {
constructor() {
this._openBlobUrls = new WeakMap();
}
downloadUrl(url, filename) {
if (!(0, _pdfjsLib.createValidAbsoluteUrl)(url, "http://example.com")) {
return;
}
download(url + "#pdfjs.action=download", filename);
}
downloadData(data, filename, contentType) {
const blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL);
download(blobUrl, filename);
}
openOrDownloadData(element, data, filename) {
const isPdfData = (0, _pdfjsLib.isPdfFile)(filename);
const contentType = isPdfData ? "application/pdf" : "";
if (isPdfData && !_viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL) {
let blobUrl = this._openBlobUrls.get(element);
if (!blobUrl) {
blobUrl = URL.createObjectURL(new Blob([data], {
type: contentType
}));
this._openBlobUrls.set(element, blobUrl);
}
let viewerUrl;
viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename);
try {
window.open(viewerUrl);
return true;
} catch (ex) {
console.error(`openOrDownloadData: ${ex}`);
URL.revokeObjectURL(blobUrl);
this._openBlobUrls.delete(element);
}
}
this.downloadData(data, filename, contentType);
return false;
}
download(blob, url, filename, sourceEventType = "download") {
if (_viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL) {
this.downloadUrl(url, filename);
return;
}
const blobUrl = URL.createObjectURL(blob);
download(blobUrl, filename);
}
}
exports.DownloadManager = DownloadManager;
/***/ }),
/* 8 */
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.viewerCompatibilityParams = void 0;
const compatibilityParams = Object.create(null);
{
const userAgent = typeof navigator !== "undefined" && navigator.userAgent || "";
const platform = typeof navigator !== "undefined" && navigator.platform