UNPKG

ngx-extended-pdf-viewer

Version:

Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.

52 lines (44 loc) 623 kB
window.ngxZone.runOutsideAngular(() => { /** * @licstart The following is the entire license notice for the * JavaScript code in this page * * Copyright 2022 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 */ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ([ /* 0 */, /* 1 */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({value:true}));exports.animationStarted=exports.VERTICAL_PADDING=exports.UNKNOWN_SCALE=exports.TextLayerMode=exports.SpreadMode=exports.SidebarView=exports.ScrollMode=exports.SCROLLBAR_PADDING=exports.RenderingStates=exports.RendererType=exports.ProgressBar=exports.PresentationModeState=exports.OutputScale=exports.MIN_SCALE=exports.MAX_SCALE=exports.MAX_AUTO_SCALE=exports.DEFAULT_SCALE_VALUE=exports.DEFAULT_SCALE_DELTA=exports.DEFAULT_SCALE=exports.AutoPrintRegExp=void 0;exports.apiPageLayoutToViewerModes=apiPageLayoutToViewerModes;exports.apiPageModeToSidebarView=apiPageModeToSidebarView;exports.approximateFraction=approximateFraction;exports.backtrackBeforeAllVisibleElements=backtrackBeforeAllVisibleElements;exports.binarySearchFirstItem=binarySearchFirstItem;exports.docStyle=void 0;exports.getActiveOrFocusedElement=getActiveOrFocusedElement;exports.getPageSizeInches=getPageSizeInches;exports.getVisibleElements=getVisibleElements;exports.isPortraitOrientation=isPortraitOrientation;exports.isValidRotation=isValidRotation;exports.isValidScrollMode=isValidScrollMode;exports.isValidSpreadMode=isValidSpreadMode;exports.noContextMenuHandler=noContextMenuHandler;exports.normalizeWheelEventDelta=normalizeWheelEventDelta;exports.normalizeWheelEventDirection=normalizeWheelEventDirection;exports.parseQueryString=parseQueryString;exports.removeNullCharacters=removeNullCharacters;exports.roundToDivide=roundToDivide;exports.scrollIntoView=scrollIntoView;exports.watchScroll=watchScroll;function _classPrivateFieldInitSpec(obj,privateMap,value){_checkPrivateRedeclaration(obj,privateMap);privateMap.set(obj,value);}function _checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj)){throw new TypeError("Cannot initialize the same private elements twice on an object");}}function _classPrivateFieldGet(receiver,privateMap){var descriptor=_classExtractFieldDescriptor(receiver,privateMap,"get");return _classApplyDescriptorGet(receiver,descriptor);}function _classApplyDescriptorGet(receiver,descriptor){if(descriptor.get){return descriptor.get.call(receiver);}return descriptor.value;}function _classPrivateFieldSet(receiver,privateMap,value){var descriptor=_classExtractFieldDescriptor(receiver,privateMap,"set");_classApplyDescriptorSet(receiver,descriptor,value);return value;}function _classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver)){throw new TypeError("attempted to "+action+" private field on non-instance");}return privateMap.get(receiver);}function _classApplyDescriptorSet(receiver,descriptor,value){if(descriptor.set){descriptor.set.call(receiver,value);}else{if(!descriptor.writable){throw new TypeError("attempted to set read only private field");}descriptor.value=value;}}const DEFAULT_SCALE_VALUE="auto";exports.DEFAULT_SCALE_VALUE=DEFAULT_SCALE_VALUE;const DEFAULT_SCALE=1.0;exports.DEFAULT_SCALE=DEFAULT_SCALE;const DEFAULT_SCALE_DELTA=1.1;exports.DEFAULT_SCALE_DELTA=DEFAULT_SCALE_DELTA;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 RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};exports.RenderingStates=RenderingStates;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};exports.TextLayerMode=TextLayerMode;const ScrollMode={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3};exports.ScrollMode=ScrollMode;const SpreadMode={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};exports.SpreadMode=SpreadMode;const AutoPrintRegExp=/\bprint\s*\(/;exports.AutoPrintRegExp=AutoPrintRegExp;class OutputScale{constructor(){const pixelRatio=window.devicePixelRatio||1;this.sx=pixelRatio;this.sy=pixelRatio;}get scaled(){return this.sx!==1||this.sy!==1;}}exports.OutputScale=OutputScale;function scrollIntoView(element,spot){let scrollMatches=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;let infiniteScroll=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(element.classList.contains("stf__item")){Window['ngxConsole'].log("don't scroll in book mode");return;}let parent=element.offsetParent;if(!parent){Window['ngxConsole'].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||scrollMatches&&(parent.classList.contains("markedContent")||getComputedStyle(parent).overflow==="hidden")){offsetY+=parent.offsetTop;offsetX+=parent.offsetLeft;parent=parent.offsetParent;if(!parent){if(infiniteScroll){if(document.body.clientHeight>offsetY){offsetY-=32;window.scrollTo(window.scrollX,offsetY);}}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 params=new Map();for(const[key,value]of new URLSearchParams(query)){params.set(key.toLowerCase(),value);}return params;}const NullCharactersRegExp=/\x00/g;const InvisibleCharactersRegExp=/[\x01-\x1F]/g;function removeNullCharacters(str){let replaceInvisible=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(typeof str!=="string"){console.error(`The argument must be a string.`);return str;}if(replaceInvisible){str=str.replace(InvisibleCharactersRegExp," ");}return str.replace(NullCharactersRegExp,"");}function binarySearchFirstItem(items,condition){let start=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;let minIndex=start;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(_ref){let{view,userUnit,rotate}=_ref;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(_ref2){let{scrollEl,views,sortByVisibility=false,horizontal=false,rtl=false}=_ref2;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=[],ids=new Set(),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});ids.add(view.id);}const first=visible[0],last=visible.at(-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,ids};}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 animationStarted=new Promise(function(resolve){window.ngxZone.runOutsideAngular(()=>{window.requestAnimationFrame(resolve);});});exports.animationStarted=animationStarted;const docStyle=document.documentElement.style;exports.docStyle=docStyle;function clamp(v,min,max){return Math.min(Math.max(v,min),max);}var _classList=/*#__PURE__*/new WeakMap();var _percent=/*#__PURE__*/new WeakMap();var _visible=/*#__PURE__*/new WeakMap();class ProgressBar{constructor(id){_classPrivateFieldInitSpec(this,_classList,{writable:true,value:null});_classPrivateFieldInitSpec(this,_percent,{writable:true,value:0});_classPrivateFieldInitSpec(this,_visible,{writable:true,value:true});const bar=document.getElementById(id);_classPrivateFieldSet(this,_classList,bar.classList);}get percent(){return _classPrivateFieldGet(this,_percent);}set percent(val){_classPrivateFieldSet(this,_percent,clamp(val,0,100));if(isNaN(val)){_classPrivateFieldGet(this,_classList).add("indeterminate");return;}_classPrivateFieldGet(this,_classList).remove("indeterminate");docStyle.setProperty("--progressBar-percent",`${_classPrivateFieldGet(this,_percent)}%`);}setWidth(viewer){if(!viewer){return;}const container=viewer.parentNode;const scrollbarWidth=container.offsetWidth-viewer.offsetWidth;if(scrollbarWidth>0){docStyle.setProperty("--progressBar-end-offset",`${scrollbarWidth}px`);}}hide(){if(!_classPrivateFieldGet(this,_visible)){return;}_classPrivateFieldSet(this,_visible,false);_classPrivateFieldGet(this,_classList).add("hidden");}show(){if(_classPrivateFieldGet(this,_visible)){return;}_classPrivateFieldSet(this,_visible,true);_classPrivateFieldGet(this,_classList).remove("hidden");}}exports.ProgressBar=ProgressBar;function getActiveOrFocusedElement(){let curRoot=document;let curActiveOrFocused=curRoot.activeElement||curRoot.querySelector(":focus");while((_curActiveOrFocused=curActiveOrFocused)!==null&&_curActiveOrFocused!==void 0&&_curActiveOrFocused.shadowRoot){var _curActiveOrFocused;curRoot=curActiveOrFocused.shadowRoot;curActiveOrFocused=curRoot.activeElement||curRoot.querySelector(":focus");}return curActiveOrFocused;}function apiPageLayoutToViewerModes(layout){let scrollMode=ScrollMode.VERTICAL,spreadMode=SpreadMode.NONE;switch(layout){case"SinglePage":scrollMode=ScrollMode.PAGE;break;case"OneColumn":break;case"TwoPageLeft":scrollMode=ScrollMode.PAGE;case"TwoColumnLeft":spreadMode=SpreadMode.ODD;break;case"TwoPageRight":scrollMode=ScrollMode.PAGE;case"TwoColumnRight":spreadMode=SpreadMode.EVEN;break;}return{scrollMode,spreadMode};}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;} /***/ }), /* 2 */ /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({value:true}));exports.compatibilityParams=exports.OptionKind=exports.AppOptions=void 0;const compatibilityParams=Object.create(null);exports.compatibilityParams=compatibilityParams;{const userAgent=navigator.userAgent||"";const platform=navigator.platform||"";const maxTouchPoints=navigator.maxTouchPoints||1;const isAndroid=/Android/.test(userAgent);const isIOS=/\b(iPad|iPhone|iPod)(?=;)/.test(userAgent)||platform==="MacIntel"&&maxTouchPoints>1;(function checkCanvasSizeLimitation(){if(isIOS||isAndroid){compatibilityParams.maxCanvasPixels=5242880;}})();}const OptionKind={VIEWER:0x02,API:0x04,WORKER:0x08,PREFERENCE:0x80};exports.OptionKind=OptionKind;const defaultOptions={annotationEditorMode:{value:0,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},annotationMode:{value:2,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},cursorToolOnLoad:{value:0,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},defaultZoomValue:{value:"",kind:OptionKind.VIEWER+OptionKind.PREFERENCE},disableHistory:{value:false,kind:OptionKind.VIEWER},disablePageLabels:{value:false,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},enablePermissions:{value:false,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},enablePrintAutoRotate:{value:true,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},enableScripting:{value:true,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:OptionKind.VIEWER},externalLinkTarget:{value:0,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},historyUpdateUrl:{value:false,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},ignoreDestinationZoom:{value:false,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},imageResourcesPath:{value:"./images/",kind:OptionKind.VIEWER},maxCanvasPixels:{value:16777216,kind:OptionKind.VIEWER},forcePageColors:{value:false,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:OptionKind.VIEWER+OptionKind.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:OptionKind.VIEWER+OptionKind.PREFERENCE},pdfBugEnabled:{value:false,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},printResolution:{value:150,kind:OptionKind.VIEWER},removePageBorders:{value:false,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},sidebarViewOnLoad:{value:-1,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},scrollModeOnLoad:{value:-1,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},spreadModeOnLoad:{value:-1,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},textLayerMode:{value:1,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},useOnlyCssZoom:{value:false,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},viewerCssTheme:{value:0,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},viewOnLoad:{value:0,kind:OptionKind.VIEWER+OptionKind.PREFERENCE},cMapPacked:{value:true,kind:OptionKind.API},cMapUrl:{value:"../web/cmaps/",kind:OptionKind.API},disableAutoFetch:{value:false,kind:OptionKind.API+OptionKind.PREFERENCE},disableFontFace:{value:false,kind:OptionKind.API+OptionKind.PREFERENCE},disableRange:{value:false,kind:OptionKind.API+OptionKind.PREFERENCE},disableStream:{value:false,kind:OptionKind.API+OptionKind.PREFERENCE},docBaseUrl:{value:"",kind:OptionKind.API},enableXfa:{value:true,kind:OptionKind.API+OptionKind.PREFERENCE},fontExtraProperties:{value:false,kind:OptionKind.API},isEvalSupported:{value:true,kind:OptionKind.API},isOffscreenCanvasSupported:{value:true,kind:OptionKind.API},maxImageSize:{value:-1,kind:OptionKind.API},pdfBug:{value:false,kind:OptionKind.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:OptionKind.API},verbosity:{value:1,kind:OptionKind.API},workerPort:{value:null,kind:OptionKind.WORKER},workerSrc:{value:"./assets/pdf.worker.js",kind:OptionKind.WORKER}};{defaultOptions.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:OptionKind.VIEWER};defaultOptions.disablePreferences={value:false,kind:OptionKind.VIEWER};defaultOptions.locale={value:navigator.language||"en-US",kind:OptionKind.VIEWER};defaultOptions.renderer={value:"canvas",kind:OptionKind.VIEWER+OptionKind.PREFERENCE};defaultOptions.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:OptionKind.VIEWER};}const userOptions=Object.create(null);if(globalThis.pdfDefaultOptions){for(const key in globalThis.pdfDefaultOptions){userOptions[key]=globalThis.pdfDefaultOptions[key];}}class AppOptions{constructor(){throw new Error("Cannot initialize AppOptions.");}static get(name){const userOption=userOptions[name];if(userOption!==undefined){return userOption;}const defaultOption=defaultOptions[name];if(defaultOption!==undefined){return compatibilityParams[name]??defaultOption.value;}return undefined;}static getAll(){let kind=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;const options=Object.create(null);for(const name in defaultOptions){const defaultOption=defaultOptions[name];if(kind){if((kind&defaultOption.kind)===0){continue;}if(kind===OptionKind.PREFERENCE){const value=defaultOption.value,valueType=typeof value;if(valueType==="boolean"||valueType==="string"||valueType==="number"&&Number.isInteger(value)){options[name]=value;continue;}throw new Error(`Invalid type for preference: ${name}`);}}const userOption=userOptions[name];options[name]=userOption!==undefined?userOption:compatibilityParams[name]??defaultOption.value;}return options;}static set(name,value){userOptions[name]=value;}static setAll(options){for(const name in options){userOptions[name]=options[name];}}static remove(name){delete userOptions[name];}static _hasUserOptions(){return Object.keys(userOptions).length>0;}}exports.AppOptions=AppOptions; /***/ }), /* 3 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({value:true}));exports.SimpleLinkService=exports.PDFLinkService=exports.LinkTarget=void 0;var _ui_utils=__webpack_require__(1);function _classPrivateMethodInitSpec(obj,privateSet){_checkPrivateRedeclaration(obj,privateSet);privateSet.add(obj);}function _classPrivateFieldInitSpec(obj,privateMap,value){_checkPrivateRedeclaration(obj,privateMap);privateMap.set(obj,value);}function _checkPrivateRedeclaration(obj,privateCollection){if(privateCollection.has(obj)){throw new TypeError("Cannot initialize the same private elements twice on an object");}}function _classStaticPrivateMethodGet(receiver,classConstructor,method){_classCheckPrivateStaticAccess(receiver,classConstructor);return method;}function _classCheckPrivateStaticAccess(receiver,classConstructor){if(receiver!==classConstructor){throw new TypeError("Private static access of wrong provenance");}}function _classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver)){throw new TypeError("attempted to get private field on non-instance");}return fn;}function _classPrivateFieldGet(receiver,privateMap){var descriptor=_classExtractFieldDescriptor(receiver,privateMap,"get");return _classApplyDescriptorGet(receiver,descriptor);}function _classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver)){throw new TypeError("attempted to "+action+" private field on non-instance");}return privateMap.get(receiver);}function _classApplyDescriptorGet(receiver,descriptor){if(descriptor.get){return descriptor.get.call(receiver);}return descriptor.value;}const DEFAULT_LINK_REL="noopener noreferrer nofollow";const LinkTarget={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};exports.LinkTarget=LinkTarget;function addLinkAttributes(link){let{url,target,rel,enabled=true}=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!url||typeof url!=="string"){throw new Error('A valid "url" parameter must provided.');}const urlNullRemoved=(0,_ui_utils.removeNullCharacters)(url);if(enabled){link.href=link.title=urlNullRemoved;}else{link.href="";link.title=`Disabled: ${urlNullRemoved}`;link.onclick=()=>{return false;};}let targetStr="";switch(target){case LinkTarget.NONE:break;case LinkTarget.SELF:targetStr="_self";break;case LinkTarget.BLANK:targetStr="_blank";break;case LinkTarget.PARENT:targetStr="_parent";break;case LinkTarget.TOP:targetStr="_top";break;}link.target=targetStr;link.rel=typeof rel==="string"?rel:DEFAULT_LINK_REL;}var _pagesRefCache=/*#__PURE__*/new WeakMap();var _goToDestinationHelper=/*#__PURE__*/new WeakSet();class PDFLinkService{constructor(){let{eventBus,externalLinkTarget=null,externalLinkRel=null,ignoreDestinationZoom=false}=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classPrivateMethodInitSpec(this,_goToDestinationHelper);_classPrivateFieldInitSpec(this,_pagesRefCache,{writable:true,value:new Map()});this.eventBus=eventBus;this.externalLinkTarget=externalLinkTarget;this.externalLinkRel=externalLinkRel;this.externalLinkEnabled=true;this._ignoreDestinationZoom=ignoreDestinationZoom;this.baseUrl=null;this.pdfDocument=null;this.pdfViewer=null;this.pdfHistory=null;}setDocument(pdfDocument){let baseUrl=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;this.baseUrl=baseUrl;this.pdfDocument=pdfDocument;_classPrivateFieldGet(this,_pagesRefCache).clear();}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;}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)){Window['ngxConsole'].error(`PDFLinkService.goToDestination: "${explicitDest}" is not `+`a valid destination array, for dest="${dest}".`);return;}_classPrivateMethodGet(this,_goToDestinationHelper,_goToDestinationHelper2).call(this,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)){Window['ngxConsole'].error(`PDFLinkService.goToPage: "${val}" is not a valid page.`);return;}if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.pushPage(pageNumber);}if(this.pdfViewer.pageViewMode==="book"){if(this.pdfViewer.pageFlip){this.pdfViewer.ensureAdjecentPagesAreLoaded();const evenPage=this.pdfViewer.currentPageNumber-this.pdfViewer.currentPageNumber%2;const evenTargetPage=pageNumber-pageNumber%2;if(evenPage===evenTargetPage-2){this.pdfViewer.pageFlip.flipNext();}else if(evenPage===evenTargetPage+2){this.pdfViewer.pageFlip.flipPrev();}else{this.pdfViewer.pageFlip.turnToPage(pageNumber-1);}}}else{this.pdfViewer.scrollPageIntoView({pageNumber});}}addLinkAttributes(link,url){let newWindow=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;addLinkAttributes(link,{url,target:newWindow?LinkTarget.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled});}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(params.has("search")){this.eventBus.dispatch("findfromurlhash",{source:this,query:params.get("search").replace(/"/g,""),phraseSearch:params.get("phrase")==="true"});}if(params.has("page")){pageNumber=params.get("page")|0||1;}if(params.has("zoom")){const zoomArgs=params.get("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){Window['ngxConsole'].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{Window['ngxConsole'].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(params.has("pagemode")){this.eventBus.dispatch("pagemode",{source:this,mode:params.get("pagemode")});}if(params.has("nameddest")){this.goToDestination(params.get("nameddest"));}}else{dest=unescape(hash);try{dest=JSON.parse(dest);if(!Array.isArray(dest)){dest=dest.toString();}}catch(ex){}if(typeof dest==="string"||_classStaticPrivateMethodGet(PDFLinkService,PDFLinkService,_isValidExplicitDestination).call(PDFLinkService,dest)){this.goToDestination(dest);return;}Window['ngxConsole'].error(`PDFLinkService.setHash: "${unescape(hash)}" is not a valid destination.`);}}executeNamedAction(action){var _this$pdfHistory,_this$pdfHistory2;switch(action){case"GoBack":(_this$pdfHistory=this.pdfHistory)===null||_this$pdfHistory===void 0?void 0:_this$pdfHistory.back();break;case"GoForward":(_this$pdfHistory2=this.pdfHistory)===null||_this$pdfHistory2===void 0?void 0:_this$pdfHistory2.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});}async executeSetOCGState(action){const pdfDocument=this.pdfDocument;const optionalContentConfig=await this.pdfViewer.optionalContentConfigPromise;if(pdfDocument!==this.pdfDocument){return;}let operator;for(const elem of action.state){switch(elem){case"ON":case"OFF":case"Toggle":operator=elem;continue;}switch(operator){case"ON":optionalContentConfig.setVisibility(elem,true);break;case"OFF":optionalContentConfig.setVisibility(elem,false);break;case"Toggle":const group=optionalContentConfig.getGroup(elem);if(group){optionalContentConfig.setVisibility(elem,!group.visible);}break;}}this.pdfViewer.optionalContentConfigPromise=Promise.resolve(optionalContentConfig);}cachePageRef(pageNum,pageRef){if(!pageRef){return;}const refStr=pageRef.gen===0?`${pageRef.num}R`:`${pageRef.num}R${pageRef.gen}`;_classPrivateFieldGet(this,_pagesRefCache).set(refStr,pageNum);}_cachedPageNumber(pageRef){if(!pageRef){return null;}const refStr=pageRef.gen===0?`${pageRef.num}R`:`${pageRef.num}R${pageRef.gen}`;return _classPrivateFieldGet(this,_pagesRefCache).get(refStr)||null;}isPageVisible(pageNumber){return this.pdfViewer.isPageVisible(pageNumber);}isPageCached(pageNumber){return this.pdfViewer.isPageCached(pageNumber);}}exports.PDFLinkService=PDFLinkService;function _goToDestinationHelper2(rawDest){let namedDest=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;let explicitDest=arguments.length>2?arguments[2]:undefined;const destRef=explicitDest[0];let pageNumber;if(typeof destRef==="object"&&destRef!==null){pageNumber=this._cachedPageNumber(destRef);if(!pageNumber){this.pdfDocument.getPageIndex(destRef).then(pageIndex=>{this.cachePageRef(pageIndex+1,destRef);_classPrivateMethodGet(this,_goToDestinationHelper,_goToDestinationHelper2).call(this,rawDest,namedDest,explicitDest);}).catch(()=>{Window['ngxConsole'].error(`PDFLinkService.#goToDestinationHelper: "${destRef}" is not `+`a valid page reference, for dest="${rawDest}".`);});return;}}else if(Number.isInteger(destRef)){pageNumber=destRef+1;}else{Window['ngxConsole'].error(`PDFLinkService.#goToDestinationHelper: "${destRef}" is not `+`a valid destination reference, for dest="${rawDest}".`);return;}if(!pageNumber||pageNumber<1||pageNumber>this.pagesCount){Window['ngxConsole'].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});}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.externalLinkEnabled=true;}get pagesCount(){return 0;}get page(){return 0;}set page(value){}get rotation(){return 0;}set rotation(value){}async goToDestination(dest){}goToPage(val){}addLinkAttributes(link,url){let newWindow=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;addLinkAttributes(link,{url,enabled:this.externalLinkEnabled});}getDestinationHash(dest){return"#";}getAnchorUrl(hash){return"#";}setHash(hash){}executeNamedAction(action){}executeSetOCGState(action){}cachePageRef(pageNum,pageRef){}isPageVisible(pageNumber){return true;}isPageCached(pageNumber){return true;}}exports.SimpleLinkService=SimpleLinkService; /***/ }), /* 4 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({value:true}));exports.PDFViewerApplication=exports.PDFPrintServiceFactory=exports.DefaultExternalServices=void 0;var _ui_utils=__webpack_require__(1);var _pdfjsLib=__webpack_require__(5);var _app_options=__webpack_require__(2);var _event_utils=__webpack_require__(6);var _pdf_cursor_tools=__webpack_require__(7);var _pdf_link_service=__webpack_require__(3);var _annotation_editor_params=__webpack_require__(9);var _overlay_manager=__webpack_require__(10);var _password_prompt=__webpack_require__(12);var _pdf_attachment_viewer=__webpack_require__(13);var _pdf_document_properties=__webpack_require__(15);var _pdf_find_bar=__webpack_require__(16);var _pdf_find_controller=__webpack_require__(17);var _pdf_history=__webpack_require__(21);var _pdf_layer_viewer=__webpack_require__(22);var _pdf_outline_viewer=__webpack_require__(23);var _pdf_presentation_mode=__webpack_require__(24);var _pdf_rendering_queue=__webpack_require__(25);var _pdf_scripting_manager=__webpack_require__(26);var _pdf_sidebar=__webpack_require__(27);var _pdf_sidebar_resizer=__webpack_require__(28);var _pdf_thumbnail_viewer=__webpack_require__(29);var _pdf_viewer=__webpack_require__(31);var _secondary_toolbar=__webpack_require__(174);var _toolbar=__webpack_require__(175);var _view_history=__webpack_require__(176);const DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT=5000;const FORCE_PAGES_LOADED_TIMEOUT=10;const WHEEL_ZOOM_DISABLED_TIMEOUT=1000;const ViewOnLoad={UNKNOWN:-1,PREVIOUS:0,INITIAL:1};const ViewerCssTheme={AUTOMATIC:0,LIGHT:1,DARK:2};const KNOWN_VERSIONS=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.9","2.0","2.1","2.2","2.3"];const KNOWN_GENERATORS=["acrobat distiller","acrobat pdfwriter","adobe livecycle","adobe pdf library","adobe photoshop","ghostscript","tcpdf","cairo","dvipdfm","dvips","pdftex","pdfkit","itext","prince","quarkxpress","mac os x","microsoft","openoffice","oracle","luradocument","pdf-xchange","antenna house","aspose.cells","fpdf"];class DefaultExternalServices{constructor(){throw new Error("Cannot initialize DefaultExternalServices.");}static updateFindControlState(data){}static updateFindMatchesCount(data){}static initPassiveLoading(callbacks){}static reportTelemetry(data){}static createDownloadManager(options){throw new Error("Not implemented: createDownloadManager");}static createPreferences(){throw new Error("Not implemented: createPreferences");}static createL10n(options){throw new Error("Not implemented: createL10n");}static createScripting(options){throw new Error("Not implemented: createScripting");}static get supportsIntegratedFind(){return(0,_pdfjsLib.shadow)(this,"supportsIntegratedFind",false);}static get supportsDocumentFonts(){return(0,_pdfjsLib.shadow)(this,"supportsDocumentFonts",true);}static get supportedMouseWheelZoomModifierKeys(){return(0,_pdfjsLib.shadow)(this,"supportedMouseWheelZoomModifierKeys",{ctrlKey:true,metaKey:true});}static get isInAutomation(){return(0,_pdfjsLib.shadow)(this,"isInAutomation",false);}static updateEditorStates(data){throw new Error("Not implemented: updateEditorStates");}}exports.DefaultExternalServices=DefaultExternalServices;const PDFViewerApplication={initialBookmark:document.location.hash.substring(1),_initializedCapability:(0,_pdfjsLib.createPromiseCapability)(),appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfHistory:null,pdfSidebar:null,pdfSidebarResizer:null,pdfOutlineViewer:null,pdfAttachmentViewer:null,pdfLayerViewer:null,pdfCursorTools:null,pdfScriptingManager:null,store:null,downloadManager:null,overlayManager:null,preferences:null,toolbar:null,secondaryToolbar:null,eventBus:null,l10n:null,annotationEditorParams:null,isInitialViewSet:false,downloadComplete:false,isViewerEmbedded:window.parent!==window,url:"",baseUrl:"",_downloadUrl:"",externalServices:DefaultExternalServices,_boundEvents:Object.create(null),documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,_saveInProgress:false,_docStats:null,_wheelUnusedTicks:0,_PDFBug:null,_hasAnnotationEditors:false,_title:document.title,_printAnnotationStoragePromise:null,async initialize(appConfig){this.preferences=this.externalServices.createPreferences();this.appConfig=appConfig;await this._readPreferences();await this._parseHashParameters();this._forceCssTheme();await this._initializeL10n();if(this.isViewerEmbedded&&_app_options.AppOptions.get("externalLinkTarget")===_pdf_link_service.LinkTarget.NONE){_app_options.AppOptions.set("externalLinkTarget",_pdf_link_service.LinkTarget.TOP);}await this._initializeViewerComponents();this.bindEvents();this.bindWindowEvents();const appContainer=appConfig.appContainer||document.documentElement;this.l10n.translate(appContainer).then(()=>{this.eventBus.dispatch("localized",{source:this});});this._initializedCapability.resolve();this.initializeLoadingBar();},async _readPreferences(){if(_app_options.AppOptions.get("disablePreferences")){return;}if(_app_options.AppOptions._hasUserOptions()){Window['ngxConsole'].warn("_readPreferences: The Preferences may override manually set AppOptions; "+'please use the "disablePreferences"-option in order to prevent that.');}try{_app_options.AppOptions.setAll(await this.preferences.getAll());}catch(reason){Window['ngxConsole'].error(`_readPreferences: "${reason===null||reason===void 0?void 0:reason.message}".`);}},async _parseHashParameters(){if(!_app_options.AppOptions.get("pdfBugEnabled")){return;}const hash=document.location.hash.substring(1);if(!hash){return;}const{mainContainer,viewerContainer}=this.appConfig,params=(0,_ui_utils.parseQueryString)(hash);if(params.get("disableworker")==="true"){try{await loadFakeWorker();}catch(ex){console.error(`_parseHashParameters: "${ex.message}".`);}}if(params.has("disablerange")){_app_options.AppOptions.set("disableRange",params.get("disablerange")==="true");}if(params.has("disablestream")){_app_options.AppOptions.set("disableStream",params.get("disablestream")==="true");}if(params.has("disableautofetch")){_app_options.AppOptions.set("disableAutoFetch",params.get("disableautofetch")==="true");}if(params.has("disablefontface")){_app_options.AppOptions.set("disableFontFace",params.get("disablefontface")==="true");}if(params.has("disablehistory")){_app_options.AppOptions.set("disableHistory",params.get("disablehistory")==="true");}if(params.has("verbosity")){_app_options.AppOptions.set("verbosity",params.get("verbosity")|0);}if(params.has("textlayer")){switch(params.get("textlayer")){case"off":_app_options.AppOptions.set("textLayerMode",_ui_utils.TextLayerMode.DISABLE);break;case"visible":case"shadow":case"hover":viewerContainer.classList.add(`textLayer-${params.get("textlayer")}`);try{await loadPDFBug(this);this._PDFBug.loadCSS();}catch(ex){console.error(`_parseHashParameters: "${ex.message}".`);}break;}}if(params.has("pdfbug")){_app_options.AppOptions.set("pdfBug",true);_app_options.AppOptions.set("fontExtraProperties",true);const enabled=params.get("pdfbug").split(",");try{await loadPDFBug(this);this._PDFBug.init({OPS:_pdfjsLib.OPS},mainContainer,enabled);}catch(ex){console.error(`_parseHashParameters: "${ex.message}".`);}}if(params.has("locale")){_app_options.AppOptions.set("locale",params.get("locale"));}},async _initializeL10n(){this.l10n=this.externalServices.createL10n({locale:_app_options.AppOptions.get("locale")});const dir=await this.l10n.getDirection();document.getElementsByTagName("html")[0].dir=dir;},_forceCssTheme(){const cssTheme=_app_options.AppOptions.get("viewerCssTheme");if(cssTheme===ViewerCssTheme.AUTOMATIC||!Object.values(ViewerCssTheme).includes(cssTheme)){return;}try{const styleSheet=document.styleSheets[0];const cssRules=(styleSheet===null||styleSheet===void 0?void 0:styleSheet.cssRules)||[];for(let i=0,ii=cssRules.length;i<ii;i++){var _rule$media;const rule=cssRules[i];if(rule instanceof CSSMediaRule&&((_rule$media=rule.media)===null||_rule$media===void 0?void 0:_rule$media[0])==="(prefers-color-scheme: dark)"){if(cssTheme===ViewerCssTheme.LIGHT){styleSheet.deleteRule(i);return;}const darkRules=/^@media \(prefers-color-scheme: dark\) {\n\s*([\w\s-.,:;/\\{}()]+)\n}$/.exec(rule.cssText);if(darkRules!==null&&darkRules!==void 0&&darkRules[1]){styleSheet.deleteRule(i);styleSheet.insertRule(darkRules[1],i);}return;}}}catch(reason){Window['ngxConsole'].error(`_forceCssTheme: "${reason===null||reason===void 0?void 0:reason.message}".`);}},async _initializeViewerComponents(){const{appConfig,externalServices}=this;const eventBus=externalServices.isInAutomation?new _event_utils.AutomationEventBus():new _event_utils.EventBus();this.eventBus=eventBus;this.overlayManager=new _overlay_manager.OverlayManager();const pdfRenderingQueue=new _pdf_rendering_queue.PDFRenderingQueue();pdfRenderingQueue.onIdle=this._cleanup.bind(this);this.pdfRenderingQueue=pdfRenderingQueue;const pdfLinkService=new _pdf_link_service.PDFLinkService({eventBus,externalLinkTarget:_app_options.AppOptions.get("externalLinkTarget"),externalLinkRel:_app_options.AppOptions.get("externalLinkRel"),ignoreDestinationZoom:_app_options.AppOptions.get("ignoreDestinationZoom")});this.pdfLinkService=pdfLinkService;const downloadManager=externalServices.createDownloadManager();this.downloadManager=downloadManager;const findController=new _pdf_find_controller.PDFFindController({linkService:pdfLinkService,eventBus,pageViewMode:_app_options.AppOptions.get("pageViewMode")});this.findController=findController;const pdfScriptingManager=new _pdf_scripting_manager.PDFScriptingManager({eventBus,sandboxBundleSrc:_app_options.AppOptions.get("sandboxBundleSrc"),scriptingFactory:externalServices,docPropertiesLookup:this._scriptingDocProperties.bind(this)});this.pdfScriptingManager=pdfScriptingManager;const container=appConfig.mainContainer,viewer=appConfig.viewerContainer;const annotationEditorMode=_app_options.AppOptions.get("annotationEditorMode");const pageColors=_app_options.AppOptions.get("forcePageColors")||window.matchMedia("(forced-colors: active)").matches?{background:_app_options.AppOptions.get("pageColorsBackground"),foreground:_app_options.AppOptions.get("pageColorsForeground")}:null;this.pdfViewer=new _pdf_viewer.PDFViewer({container,viewer,eventBus,renderingQueue:pdfRenderingQueue,linkService:pdfLinkService,downloadManager,findController,scriptingManager:_app_options.AppOptions.get("enableScripting")&&pdfScriptingManager,renderer:_app_options.AppOptions.get("renderer"),l10n:this.l10n,textLayerMode:_app_options.AppOptions.get("textLayerMode"),annotationMode:_app_options.AppOptions.get("annotationMode"),annotationEditorMode,imageResourcesPath:_app_options.AppOptions.get("imageResourcesPath"),removePageBorders:_app_options.AppOptions.get("removePageBorders"),enablePrintAutoRotate:_app_options.AppOptions.get("enablePrintAutoRotate"),useOnlyCssZoom:_app_options.AppOptions.get("useOnlyCssZoom"),maxCanvasPixels:_app_options.AppOptions.get("maxCanvasPixels"),pageViewMode:_app_options.AppOptions.get("pageViewMode"),enablePermissions:_app_options.AppOptions.get("enablePermissions"),pageColors});pdfRenderingQueue.setViewer(this.pdfViewer);pdfLinkService.setViewer(this.pdfViewer);pdfScriptingManager.setViewer(this.pdfViewer);this.pdfThumbnailViewer=new _pdf_thumbnail_viewer.PDFThumbnailViewer({container:appConfig.sidebar.thumbnailView,eventBus,renderingQueue:pdfRenderingQueue,linkService:pdfLinkService,l10n:this.l10n,pageColors});pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);if(!this.isViewerEmbedded&&!_app_options.AppOptions.get("disableHistory")){this.pdfHistory=new _pdf_history.PDFHistory({linkService:pdfLinkService,eventBus});pdfLinkService.setHistory(this.pdfHistory);}if(!this.supportsIntegratedFind){this.findBar=new _pdf_find_bar.PDFFindBar(appConfig.findBar,eventBus,this.l10n);}if(annotationEditorMode!==_pdfjsLib.AnnotationEditorType.DISABLE){this.annotationEditorParams=new _annotation_editor_params.AnnotationEditorParams(appConfig.annotationEditorParams,eventBus);}else{for(const element of[document.getElementById("editorModeButtons"),document.getElementById("editorModeSeparator")]){element.hidden=true;}}this.pdfDocumentProperties=new _pdf_document_properties.PDFDocumentProperties(appConfig.documentProperties,this.overlayManager,eventBus,this.l10n,()=>{return this._docFilename;});this.pdfCursorTools=new _pdf_cursor_tools.PDFCursorTools({container,eventBus,cursorToolOnLoad:_app_options.AppOptions.get("cursorToolOnLoad")});this.toolbar=new _toolbar.Toolbar(appConfig.toolbar,eventBus,this.l10n);this.secondaryToolbar=new _secondary_toolbar.SecondaryToolbar(appConfig.secondaryToolbar,eventBus,this.externalServices);if(this.supportsFullscreen){this.pdfPresentationMode=new _pdf_presentation_mode.PDFPresentationMode({container,pdfViewer:this.pdfViewer,eventBus});}let prompt=_app_options.AppOptions.get("passwordPrompt");if(!prompt){prompt=new _password_prompt.PasswordPrompt(appConfig.passwordOverlay,this.overlayManager,this.l10n,this.isViewerEmbedded);}this.passwordPrompt=prompt;this.pdfOutlineViewer=new _pdf_outline_viewer.PDFOutlineViewer({container:appConfig.sidebar.outlineView,eventBus,linkService:pdfLinkService,downloadManager});this.pdfAttachmentViewer=new _pdf_attachment_viewer.PDFAttachmentViewer({container:appConfig.sidebar.attachmentsView,eventBus,downloadManager});this.pdfLayerViewer=new _pdf_layer_viewer.PDFLayerViewer({container:appConfig.sidebar.layersView,eventBus,l10n:this.l10n});this.pdfSidebar=new _pdf_sidebar.PDFSidebar({elements:appConfig.sidebar,pdfViewer:this.pdfViewer,pdfThumbnailViewer:this.pdfThumbnailViewer,eventBus,l10n:this.l10n});this.pdfSidebar.onToggled=this.forceRendering.bind(this);this.pdfSidebarResizer=new _pdf_sidebar_resizer.PDFSidebarResizer(appConfig.sidebarResizer,eventBus,this.l10n);},run(config){this.initialize(config).then(webViewerInitialized);},get initialized(){return this._initializedCapability.settled;},get initializedPromise(){return this._initializedCapability.promise;},zoomIn(steps){if(this.pdfViewer.isInPresentationMode){return;}this.pdfViewer.increaseScale(steps);},zoomOut(steps){if(this.pdfViewer.isInPresentationMode){return;}this.pdfViewer.decreaseScale(steps);},zoomReset(){if(this.pdfViewer.isInPresentationMode){return;}this.pdfViewer.currentScaleValue=_ui_utils.DEFAULT_SCALE_VALUE;},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0;},get page(){return this.pdfViewer.currentPageNumber;},set page(val){this.pdfViewer.currentPageNumber=val;},get supportsPrinting(){return PDFPrintServiceFactory.instance.supportsPrinting;},get supportsFullscreen(){return(0,_pdfjsLib.shadow)(this,"supportsFullscreen",document.fullscreenEnabled);},get supportsIntegratedFind(){return this.externalServices.supportsIntegratedFind;},get supportsDocumentFonts(){return this.externalServices.supportsDocumentFonts;},initializeLoadingBar(){const bar=new _ui_utils.ProgressBar("loadingBar");bar.hide();return(0,_pdfjsLib.shadow)(this,"loadingBar",bar);},get supportedMouseWheelZoomModifierKeys(){return this.externalServices.supportedMouseWheelZoomModifierKeys;},initPassiveLoading(){throw new Error("Not implemented: initPassiveLoading");},setTitleUsingUrl(){let url=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";let downloadUrl=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;this.url=url;this.baseUrl=url.split("#")[0];if(downloadUrl){this._downloadUrl=downloadUrl===url?this.baseUrl:downloadUrl.split("#")[0];}let title=(0,_pdfjsLib.getPdfFilenameFromUrl)(url,"");if(!title){try{title=decodeURIComponent((0,_pdfjsLib.getFilenameFromUrl)(url))||url;}catch(ex){title=url;}}this.setTitle(title);},setTitle(){let title=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._title;this._title=title;if(this.isViewerEmbedded){return;}const editorIndicator=this._hasAnnotationEditors&&!this.pdfRenderingQueue.printing;document.title=`${editorIndicator?"* ":""}${title}`;},get _docFilename(){return this._contentDispositionFilename||(0,_pdfjsLib.getPdfFilenameFromUrl)(this.url);},_hideViewBookmark(){this.appConfig.secondaryToolbar.viewBookmarkButton.hidden=true;},async close(){var _this$pdfDocument,_this$pdfHistory,_this$findBar,_this$_PDFBug;this._unblockDocumentL