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.

21 lines 338 kB
/**
 * @licstart The following is the entire license notice for the
 * JavaScript code in this page
 *
 * Copyright 2023 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
 */var e,t,i,n,s={1483:(e,t,i)=>{i.d(t,{default:()=>h});function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach((function(t){_defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function _defineProperty(e,t,i){(t=function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i;return e}function _objectWithoutProperties(e,t){if(null==e)return{};var i,n,s=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var i,n,s={},r=Object.keys(e);for(n=0;n<r.length;n++){i=r[n];t.indexOf(i)>=0||(s[i]=e[i])}return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++){i=r[n];t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}}return s}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,s,r,a,o=[],l=!0,h=!1;try{if(r=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=r.call(i)).done)&&(o.push(n.value),o.length!==t);l=!0);}catch(e){h=!0,s=e}finally{try{if(!l&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(h)throw s}}return o}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);return"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function canvasTest(e){var t,i,n=e.sizes.shift(),s=Math.max(Math.ceil(n[0]),1),r=Math.max(Math.ceil(n[1]),1),a=[s-1,r-1,1,1],o=Date.now(),l="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;if(l){t=new OffscreenCanvas(1,1);i=new OffscreenCanvas(s,r)}else{(t=document.createElement("canvas")).width=1;t.height=1;(i=document.createElement("canvas")).width=s;i.height=r}var h=t.getContext("2d"),d=i.getContext("2d");if(d){d.fillRect.apply(d,a);h.drawImage(i,s-1,r-1,1,1,0,0,1,1)}var c=h&&0!==h.getImageData(0,0,1,1).data[3],u=Date.now()-o;[t,i].forEach((function(e){e.height=0;e.width=0}));if(l){postMessage({width:s,height:r,benchmark:u,isTestPass:c});!c&&e.sizes.length&&canvasTest(e)}else if(c)e.onSuccess(s,r,u);else{e.onError(s,r,u);e.sizes.length&&canvasTest(e)}return c}var n=[16384,14188,11402,11180,10836,8192,4096,1],s=[8388607,65535,32767,16384,8192,4096,1],r=[4194303,65535,32767,16384,8192,4096,1],a=["onError","onSuccess"],o={max:null,min:1,sizes:[],step:1024,usePromise:!1,useWorker:!1,onError:Function.prototype,onSuccess:Function.prototype},l={};function createSizesArray(e){var t=e.width===e.height,i=1===e.height,n=1===e.width,s=[];if(e.width&&e.height)for(var r=e.min||o.min,a=e.step||o.step,l=Math.max(e.width,e.height);l>=r;){var h=t||i?l:1,d=t||n?l:1;s.push([h,d]);l-=a}else e.sizes.forEach((function(e){var r=t||i?e:1,a=t||n?e:1;s.push([r,a])}));return s}function handleMethod(e){var t=window&&"HTMLCanvasElement"in window,i=window&&"OffscreenCanvas"in window,n=Date.now(),s=e.onError,r=e.onSuccess,o=_objectWithoutProperties(e,a),h=null;if(!t)return!1;if(e.useWorker&&i){var d="\n            var canvasTest = ".concat(canvasTest.toString(),";\n            onmessage = function(e) {\n                canvasTest(e.data);\n            };\n        "),c=new Blob([d],{type:"application/javascript"}),u=URL.createObjectURL(c);h=new Worker(u);URL.revokeObjectURL(u);h.onmessage=function(e){var t=e.data,i=t.width,s=t.height,r=t.benchmark;if(t.isTestPass){l[n].onSuccess(i,s,r);delete l[n]}else l[n].onError(i,s,r)}}if(e.usePromise)return new Promise((function(t,i){var a=_objectSpread2(_objectSpread2({},e),{},{onError:function onError(t,n,r){var a;if(0===e.sizes.length)a=!0;else{var o=_slicedToArray(e.sizes.slice(-1),1),l=_slicedToArray(o[0],2),h=l[0],d=l[1];a=t===h&&n===d}s(t,n,r);a&&i({width:t,height:n,benchmark:r})},onSuccess:function onSuccess(e,i,n){r(e,i,n);t({width:e,height:i,benchmark:n})}});if(h){var d=a.onError,c=a.onSuccess;l[n]={onError:d,onSuccess:c};h.postMessage(o)}else canvasTest(a)}));if(!h)return canvasTest(e);l[n]={onError:s,onSuccess:r};h.postMessage(o)}var h={maxArea:function maxArea(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:e.max,height:e.max,min:e.min,step:e.step,sizes:_toConsumableArray(n)});return handleMethod(_objectSpread2(_objectSpread2(_objectSpread2({},o),e),{},{sizes:t}))},maxHeight:function maxHeight(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:1,height:e.max,min:e.min,step:e.step,sizes:_toConsumableArray(s)});return handleMethod(_objectSpread2(_objectSpread2(_objectSpread2({},o),e),{},{sizes:t}))},maxWidth:function maxWidth(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:e.max,height:1,min:e.min,step:e.step,sizes:_toConsumableArray(r)});return handleMethod(_objectSpread2(_objectSpread2(_objectSpread2({},o),e),{},{sizes:t}))},test:function test(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=_objectSpread2(_objectSpread2({},o),e);t.sizes=_toConsumableArray(t.sizes);t.width&&t.height&&(t.sizes=[[t.width,t.height]]);return handleMethod(t)}}},8759:(e,t,i)=>{i.d(t,{FluentBundle:()=>FluentBundle,FluentResource:()=>FluentResource});class FluentType{constructor(e){this.value=e}valueOf(){return this.value}}class FluentNone extends FluentType{constructor(e="???"){super(e)}toString(e){return`{${this.value}}`}}class FluentNumber extends FluentType{constructor(e,t={}){super(e);this.opts=t}toString(e){try{return e.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(t){e.reportError(t);return this.value.toString(10)}}}class FluentDateTime extends FluentType{constructor(e,t={}){super(e);this.opts=t}toString(e){try{return e.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(t){e.reportError(t);return new Date(this.value).toISOString()}}}const n=100,s="⁨",r="⁩";function match(e,t,i){if(i===t)return!0;if(i instanceof FluentNumber&&t instanceof FluentNumber&&i.value===t.value)return!0;if(t instanceof FluentNumber&&"string"==typeof i){if(i===e.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value))return!0}return!1}function getDefault(e,t,i){if(t[i])return resolvePattern(e,t[i].value);e.reportError(new RangeError("No default"));return new FluentNone}function getArguments(e,t){const i=[],n=Object.create(null);for(const s of t)"narg"===s.type?n[s.name]=resolveExpression(e,s.value):i.push(resolveExpression(e,s));return{positional:i,named:n}}function resolveExpression(e,t){switch(t.type){case"str":return t.value;case"num":return new FluentNumber(t.value,{minimumFractionDigits:t.precision});case"var":return function resolveVariableReference(e,{name:t}){let i;if(e.params){if(!Object.prototype.hasOwnProperty.call(e.params,t))return new FluentNone(`$${t}`);i=e.params[t]}else{if(!e.args||!Object.prototype.hasOwnProperty.call(e.args,t)){e.reportError(new ReferenceError(`Unknown variable: $${t}`));return new FluentNone(`$${t}`)}i=e.args[t]}if(i instanceof FluentType)return i;switch(typeof i){case"string":return i;case"number":return new FluentNumber(i);case"object":if(i instanceof Date)return new FluentDateTime(i.getTime());default:e.reportError(new TypeError(`Variable type not supported: $${t}, ${typeof i}`));return new FluentNone(`$${t}`)}}(e,t);case"mesg":return function resolveMessageReference(e,{name:t,attr:i}){const n=e.bundle._messages.get(t);if(!n){e.reportError(new ReferenceError(`Unknown message: ${t}`));return new FluentNone(t)}if(i){const s=n.attributes[i];if(s)return resolvePattern(e,s);e.reportError(new ReferenceError(`Unknown attribute: ${i}`));return new FluentNone(`${t}.${i}`)}if(n.value)return resolvePattern(e,n.value);e.reportError(new ReferenceError(`No value: ${t}`));return new FluentNone(t)}(e,t);case"term":return function resolveTermReference(e,{name:t,attr:i,args:n}){const s=`-${t}`,r=e.bundle._terms.get(s);if(!r){e.reportError(new ReferenceError(`Unknown term: ${s}`));return new FluentNone(s)}if(i){const t=r.attributes[i];if(t){e.params=getArguments(e,n).named;const i=resolvePattern(e,t);e.params=null;return i}e.reportError(new ReferenceError(`Unknown attribute: ${i}`));return new FluentNone(`${s}.${i}`)}e.params=getArguments(e,n).named;const a=resolvePattern(e,r.value);e.params=null;return a}(e,t);case"func":return function resolveFunctionReference(e,{name:t,args:i}){let n=e.bundle._functions[t];if(!n){e.reportError(new ReferenceError(`Unknown function: ${t}()`));return new FluentNone(`${t}()`)}if("function"!=typeof n){e.reportError(new TypeError(`Function ${t}() is not callable`));return new FluentNone(`${t}()`)}try{let t=getArguments(e,i);return n(t.positional,t.named)}catch(i){e.reportError(i);return new FluentNone(`${t}()`)}}(e,t);case"select":return function resolveSelectExpression(e,{selector:t,variants:i,star:n}){let s=resolveExpression(e,t);if(s instanceof FluentNone)return getDefault(e,i,n);for(const t of i){if(match(e,s,resolveExpression(e,t.key)))return resolvePattern(e,t.value)}return getDefault(e,i,n)}(e,t);default:return new FluentNone}}function resolveComplexPattern(e,t){if(e.dirty.has(t)){e.reportError(new RangeError("Cyclic reference"));return new FluentNone}e.dirty.add(t);const i=[],a=e.bundle._useIsolating&&t.length>1;for(const o of t)if("string"!=typeof o){e.placeables++;if(e.placeables>n){e.dirty.delete(t);throw new RangeError(`Too many placeables expanded: ${e.placeables}, max allowed is ${n}`)}a&&i.push(s);i.push(resolveExpression(e,o).toString(e));a&&i.push(r)}else i.push(e.bundle._transform(o));e.dirty.delete(t);return i.join("")}function resolvePattern(e,t){return"string"==typeof t?e.bundle._transform(t):resolveComplexPattern(e,t)}class Scope{constructor(e,t,i){this.dirty=new WeakSet;this.params=null;this.placeables=0;this.bundle=e;this.errors=t;this.args=i}reportError(e){if(!(this.errors&&e instanceof Error))throw e;this.errors.push(e)}memoizeIntlObject(e,t){let i=this.bundle._intls.get(e);if(!i){i={};this.bundle._intls.set(e,i)}let n=JSON.stringify(t);i[n]||(i[n]=new e(this.bundle.locales,t));return i[n]}}function values(e,t){const i=Object.create(null);for(const[n,s]of Object.entries(e))t.includes(n)&&(i[n]=s.valueOf());return i}const a=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function NUMBER(e,t){let i=e[0];if(i instanceof FluentNone)return new FluentNone(`NUMBER(${i.valueOf()})`);if(i instanceof FluentNumber)return new FluentNumber(i.valueOf(),{...i.opts,...values(t,a)});if(i instanceof FluentDateTime)return new FluentNumber(i.valueOf(),{...values(t,a)});throw new TypeError("Invalid argument to NUMBER")}const o=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function DATETIME(e,t){let i=e[0];if(i instanceof FluentNone)return new FluentNone(`DATETIME(${i.valueOf()})`);if(i instanceof FluentDateTime)return new FluentDateTime(i.valueOf(),{...i.opts,...values(t,o)});if(i instanceof FluentNumber)return new FluentDateTime(i.valueOf(),{...values(t,o)});throw new TypeError("Invalid argument to DATETIME")}const l=new Map;class FluentBundle{constructor(e,{functions:t,useIsolating:i=!0,transform:n=(e=>e)}={}){this._terms=new Map;this._messages=new Map;this.locales=Array.isArray(e)?e:[e];this._functions={NUMBER:NUMBER,DATETIME:DATETIME,...t};this._useIsolating=i;this._transform=n;this._intls=function getMemoizerForLocale(e){const t=Array.isArray(e)?e.join(" "):e;let i=l.get(t);if(void 0===i){i=new Map;l.set(t,i)}return i}(e)}hasMessage(e){return this._messages.has(e)}getMessage(e){return this._messages.get(e)}addResource(e,{allowOverrides:t=!1}={}){const i=[];for(let n=0;n<e.body.length;n++){let s=e.body[n];if(s.id.startsWith("-")){if(!1===t&&this._terms.has(s.id)){i.push(new Error(`Attempt to override an existing term: "${s.id}"`));continue}this._terms.set(s.id,s)}else{if(!1===t&&this._messages.has(s.id)){i.push(new Error(`Attempt to override an existing message: "${s.id}"`));continue}this._messages.set(s.id,s)}}return i}formatPattern(e,t=null,i=null){if("string"==typeof e)return this._transform(e);let n=new Scope(this,i,t);try{return resolveComplexPattern(n,e).toString(n)}catch(e){if(n.errors&&e instanceof Error){n.errors.push(e);return(new FluentNone).toString(n)}throw e}}}const h=/^(-?[a-zA-Z][\w-]*) *= */gm,d=/\.([a-zA-Z][\w-]*) *= */y,c=/\*?\[/y,u=/(-?[0-9]+(?:\.([0-9]+))?)/y,p=/([a-zA-Z][\w-]*)/y,g=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,f=/^[A-Z][A-Z0-9_-]*$/,m=/([^{}\n\r]+)/y,w=/([^\\"\n\r]*)/y,b=/\\([\\"])/y,v=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,y=/^\n+/,P=/ +$/,S=/ *\r?\n/g,E=/( *)$/,_=/{\s*/y,C=/\s*}/y,x=/\[\s*/y,T=/\s*] */y,L=/\s*\(\s*/y,I=/\s*->\s*/y,M=/\s*:\s*/y,A=/\s*,?\s*/y,D=/\s+/y;class FluentResource{constructor(e){this.body=[];h.lastIndex=0;let t=0;for(;;){let i=h.exec(e);if(null===i)break;t=h.lastIndex;try{this.body.push(parseMessage(i[1]))}catch(e){if(e instanceof SyntaxError)continue;throw e}}function test(i){i.lastIndex=t;return i.test(e)}function consumeChar(i,n){if(e[t]===i){t++;return!0}if(n)throw new n(`Expected ${i}`);return!1}function consumeToken(e,i){if(test(e)){t=e.lastIndex;return!0}if(i)throw new i(`Expected ${e.toString()}`);return!1}function match(i){i.lastIndex=t;let n=i.exec(e);if(null===n)throw new SyntaxError(`Expected ${i.toString()}`);t=i.lastIndex;return n}function match1(e){return match(e)[1]}function parseMessage(e){let t=parsePattern(),i=function parseAttributes(){let e=Object.create(null);for(;test(d);){let t=match1(d),i=parsePattern();if(null===i)throw new SyntaxError("Expected attribute value");e[t]=i}return e}();if(null===t&&0===Object.keys(i).length)throw new SyntaxError("Expected message value or attributes");return{id:e,value:t,attributes:i}}function parsePattern(){let i;test(m)&&(i=match1(m));if("{"===e[t]||"}"===e[t])return parsePatternElements(i?[i]:[],1/0);let n=parseIndent();if(n){if(i)return parsePatternElements([i,n],n.length);n.value=trim(n.value,y);return parsePatternElements([n],n.length)}return i?trim(i,P):null}function parsePatternElements(i=[],n){for(;;){if(test(m)){i.push(match1(m));continue}if("{"===e[t]){i.push(parsePlaceable());continue}if("}"===e[t])throw new SyntaxError("Unbalanced closing brace");let s=parseIndent();if(!s)break;i.push(s);n=Math.min(n,s.length)}let s=i.length-1,r=i[s];"string"==typeof r&&(i[s]=trim(r,P));let a=[];for(let e of i){e instanceof Indent&&(e=e.value.slice(0,e.value.length-n));e&&a.push(e)}return a}function parsePlaceable(){consumeToken(_,SyntaxError);let e=parseInlineExpression();if(consumeToken(C))return e;if(consumeToken(I)){let t=function parseVariants(){let e,t=[],i=0;for(;test(c);){consumeChar("*")&&(e=i);let n=parseVariantKey(),s=parsePattern();if(null===s)throw new SyntaxError("Expected variant value");t[i++]={key:n,value:s}}if(0===i)return null;if(void 0===e)throw new SyntaxError("Expected default variant");return{variants:t,star:e}}();consumeToken(C,SyntaxError);return{type:"select",selector:e,...t}}throw new SyntaxError("Unclosed placeable")}function parseInlineExpression(){if("{"===e[t])return parsePlaceable();if(test(g)){let[,i,n,s=null]=match(g);if("$"===i)return{type:"var",name:n};if(consumeToken(L)){let r=function parseArguments(){let i=[];for(;;){switch(e[t]){case")":t++;return i;case void 0:throw new SyntaxError("Unclosed argument list")}i.push(parseArgument());consumeToken(A)}}();if("-"===i)return{type:"term",name:n,attr:s,args:r};if(f.test(n))return{type:"func",name:n,args:r};throw new SyntaxError("Function names must be all upper-case")}return"-"===i?{type:"term",name:n,attr:s,args:[]}:{type:"mesg",name:n,attr:s}}return parseLiteral()}function parseArgument(){let e=parseInlineExpression();return"mesg"!==e.type?e:consumeToken(M)?{type:"narg",name:e.name,value:parseLiteral()}:e}function parseVariantKey(){consumeToken(x,SyntaxError);let e;e=test(u)?parseNumberLiteral():{type:"str",value:match1(p)};consumeToken(T,SyntaxError);return e}function parseLiteral(){if(test(u))return parseNumberLiteral();if('"'===e[t])return function parseStringLiteral(){consumeChar('"',SyntaxError);let i="";for(;;){i+=match1(w);if("\\"!==e[t]){if(consumeChar('"'))return{type:"str",value:i};throw new SyntaxError("Unclosed string literal")}i+=parseEscapeSequence()}}();throw new SyntaxError("Invalid expression")}function parseNumberLiteral(){let[,e,t=""]=match(u),i=t.length;return{type:"num",value:parseFloat(e),precision:i}}function parseEscapeSequence(){if(test(b))return match1(b);if(test(v)){let[,e,t]=match(v),i=parseInt(e||t,16);return i<=55295||57344<=i?String.fromCodePoint(i):"�"}throw new SyntaxError("Unknown escape sequence")}function parseIndent(){let i=t;consumeToken(D);switch(e[t]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return makeIndent(e.slice(i,t))}return" "===e[t-1]&&makeIndent(e.slice(i,t))}function trim(e,t){return e.replace(t,"")}function makeIndent(e){let t=e.replace(S,"\n"),i=E.exec(e)[1].length;return new Indent(t,i)}}}class Indent{constructor(e,t){this.value=e;this.length=t}}},8275:(e,t,i)=>{i.d(t,{DOMLocalization:()=>DOMLocalization});const n=/<|&#?\w+;/,s={"http://www.w3.org/1999/xhtml":["em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr"]},r={"http://www.w3.org/1999/xhtml":{global:["title","aria-label","aria-valuetext"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:["accesskey","aria-label","aria-valuetext","label","title","tooltiptext"],description:["value"],key:["key","keycode"],label:["value"],textbox:["placeholder","value"]}};function translateElement(e,t){const{value:i}=t;if("string"==typeof i)if("title"===e.localName&&"http://www.w3.org/1999/xhtml"===e.namespaceURI)e.textContent=i;else if(n.test(i)){const t=e.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");t.innerHTML=i;!function overlayChildNodes(e,t){for(const i of e.childNodes)if(i.nodeType!==i.TEXT_NODE)if(i.hasAttribute("data-l10n-name")){const n=getNodeForNamedElement(t,i);e.replaceChild(n,i)}else if(isElementAllowed(i)){const t=createSanitizedElement(i);e.replaceChild(t,i)}else{console.warn(`An element of forbidden type "${i.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`);e.replaceChild(createTextNodeFromTextContent(i),i)}t.textContent="";t.appendChild(e)}(t.content,e)}else e.textContent=i;overlayAttributes(t,e)}function hasAttribute(e,t){if(!e)return!1;for(let i of e)if(i.name===t)return!0;return!1}function overlayAttributes(e,t){const i=t.hasAttribute("data-l10n-attrs")?t.getAttribute("data-l10n-attrs").split(",").map((e=>e.trim())):null;for(const n of Array.from(t.attributes))isAttrNameLocalizable(n.name,t,i)&&!hasAttribute(e.attributes,n.name)&&t.removeAttribute(n.name);if(e.attributes)for(const n of Array.from(e.attributes))isAttrNameLocalizable(n.name,t,i)&&t.getAttribute(n.name)!==n.value&&t.setAttribute(n.name,n.value)}function getNodeForNamedElement(e,t){const i=t.getAttribute("data-l10n-name"),n=e.querySelector(`[data-l10n-name="${i}"]`);if(!n){console.warn(`An element named "${i}" wasn't found in the source.`);return createTextNodeFromTextContent(t)}if(n.localName!==t.localName){console.warn(`An element named "${i}" was found in the translation but its type ${t.localName} didn't match the element found in the source (${n.localName}).`);return createTextNodeFromTextContent(t)}e.removeChild(n);return shallowPopulateUsing(t,n.cloneNode(!1))}function createSanitizedElement(e){const t=e.ownerDocument.createElement(e.localName);return shallowPopulateUsing(e,t)}function createTextNodeFromTextContent(e){return e.ownerDocument.createTextNode(e.textContent)}function isElementAllowed(e){const t=s[e.namespaceURI];return t&&t.includes(e.localName)}function isAttrNameLocalizable(e,t,i=null){if(i&&i.includes(e))return!0;const n=r[t.namespaceURI];if(!n)return!1;const s=e.toLowerCase(),a=t.localName;if(n.global.includes(s))return!0;if(!n[a])return!1;if(n[a].includes(s))return!0;if("http://www.w3.org/1999/xhtml"===t.namespaceURI&&"input"===a&&"value"===s){const e=t.type.toLowerCase();if("submit"===e||"button"===e||"reset"===e)return!0}return!1}function shallowPopulateUsing(e,t){t.textContent=e.textContent;overlayAttributes(e,t);return t}class CachedIterable extends Array{static from(e){return e instanceof this?e:new this(e)}}Symbol.iterator;class CachedAsyncIterable extends CachedIterable{constructor(e){super();if(Symbol.asyncIterator in Object(e))this.iterator=e[Symbol.asyncIterator]();else{if(!(Symbol.iterator in Object(e)))throw new TypeError("Argument must implement the iteration protocol.");this.iterator=e[Symbol.iterator]()}}[Symbol.asyncIterator](){const e=this;let t=0;return{async next(){e.length<=t&&e.push(e.iterator.next());return e[t++]}}}async touchNext(e=1){let t=0;for(;t++<e;){const e=this[this.length-1];if(e&&(await e).done)break;this.push(this.iterator.next())}return this[this.length-1]}}class Localization{constructor(e=[],t){this.resourceIds=e;this.generateBundles=t;this.onChange(!0)}addResourceIds(e,t=!1){this.resourceIds.push(...e);this.onChange(t);return this.resourceIds.length}removeResourceIds(e){this.resourceIds=this.resourceIds.filter((t=>!e.includes(t)));this.onChange();return this.resourceIds.length}async formatWithFallback(e,t){const i=[];let n=!1;for await(const s of this.bundles){n=!0;const r=keysFromBundle(t,s,e,i);if(0===r.size)break;if("undefined"!=typeof console){const e=s.locales[0],t=Array.from(r).join(", ");console.warn(`[fluent] Missing translations in ${e}: ${t}`)}}n||"undefined"==typeof console||console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n  keys: ${JSON.stringify(e)}.\n  resourceIds: ${JSON.stringify(this.resourceIds)}.`);return i}formatMessages(e){return this.formatWithFallback(e,messageFromBundle)}formatValues(e){return this.formatWithFallback(e,valueFromBundle)}async formatValue(e,t){const[i]=await this.formatValues([{id:e,args:t}]);return i}handleEvent(){this.onChange()}onChange(e=!1){this.bundles=CachedAsyncIterable.from(this.generateBundles(this.resourceIds));e&&this.bundles.touchNext(2)}}function valueFromBundle(e,t,i,n){return i.value?e.formatPattern(i.value,n,t):null}function messageFromBundle(e,t,i,n){const s={value:null,attributes:null};i.value&&(s.value=e.formatPattern(i.value,n,t));let r=Object.keys(i.attributes);if(r.length>0){s.attributes=new Array(r.length);for(let[a,o]of r.entries()){let r=e.formatPattern(i.attributes[o],n,t);s.attributes[a]={name:o,value:r}}}return s}function keysFromBundle(e,t,i,n){const s=[],r=new Set;i.forEach((({id:i,args:a},o)=>{if(void 0!==n[o])return;let l=t.getMessage(i);if(l){s.length=0;n[o]=e(t,s,l,a);if(s.length>0&&"undefined"!=typeof console){const e=t.locales[0],n=s.join(", ");console.warn(`[fluent][resolver] errors in ${e}/${i}: ${n}.`)}}else r.add(i)}));return r}const a="data-l10n-id",o="data-l10n-args",l=`[${a}]`;class DOMLocalization extends Localization{constructor(e,t){super(e,t);this.roots=new Set;this.pendingrAF=null;this.pendingElements=new Set;this.windowElement=null;this.mutationObserver=null;this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[a,o]}}onChange(e=!1){super.onChange(e);this.roots&&this.translateRoots()}setAttributes(e,t,i){e.setAttribute(a,t);i?e.setAttribute(o,JSON.stringify(i)):e.removeAttribute(o);return e}getAttributes(e){return{id:e.getAttribute(a),args:JSON.parse(e.getAttribute(o)||null)}}connectRoot(e){for(const t of this.roots)if(t===e||t.contains(e)||e.contains(t))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==e.ownerDocument.defaultView)throw new Error("Cannot connect a root:\n          DOMLocalization already has a root from a different window.")}else{this.windowElement=e.ownerDocument.defaultView;this.mutationObserver=new this.windowElement.MutationObserver((e=>this.translateMutations(e)))}this.roots.add(e);this.mutationObserver.observe(e,this.observerConfig)}disconnectRoot(e){this.roots.delete(e);this.pauseObserving();if(0===this.roots.size){this.mutationObserver=null;this.windowElement=null;this.pendingrAF=null;this.pendingElements.clear();return!0}this.resumeObserving();return!1}translateRoots(){const e=Array.from(this.roots);return Promise.all(e.map((e=>this.translateFragment(e))))}pauseObserving(){if(this.mutationObserver){this.translateMutations(this.mutationObserver.takeRecords());this.mutationObserver.disconnect()}}resumeObserving(){if(this.mutationObserver)for(const e of this.roots)this.mutationObserver.observe(e,this.observerConfig)}translateMutations(e){for(const t of e)switch(t.type){case"attributes":t.target.hasAttribute("data-l10n-id")&&this.pendingElements.add(t.target);break;case"childList":for(const e of t.addedNodes)if(e.nodeType===e.ELEMENT_NODE)if(e.childElementCount)for(const t of this.getTranslatables(e))this.pendingElements.add(t);else e.hasAttribute(a)&&this.pendingElements.add(e)}this.pendingElements.size>0&&null===this.pendingrAF&&(this.pendingrAF=this.windowElement.requestAnimationFrame((()=>{this.translateElements(Array.from(this.pendingElements));this.pendingElements.clear();this.pendingrAF=null})))}translateFragment(e){return this.translateElements(this.getTranslatables(e))}async translateElements(e){if(!e.length)return;const t=e.map(this.getKeysForElement),i=await this.formatMessages(t);return this.applyTranslations(e,i)}applyTranslations(e,t){this.pauseObserving();for(let i=0;i<e.length;i++)void 0!==t[i]&&translateElement(e[i],t[i]);this.resumeObserving()}getTranslatables(e){const t=Array.from(e.querySelectorAll(l));"function"==typeof e.hasAttribute&&e.hasAttribute(a)&&t.push(e);return t}getKeysForElement(e){return{id:e.getAttribute(a),args:JSON.parse(e.getAttribute(o)||null)}}}},3266:(e,t,i)=>{i.d(t,{warn:()=>warn});"object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&process.type;const n={ERRORS:0,WARNINGS:1,INFOS:5};let s=n.WARNINGS;function warn(e){s>=n.WARNINGS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Warning: ${e}`):Window&&globalThis.ngxConsole?globalThis.ngxConsole.log(`Warning: ${e}`):console.log(`Warning: ${e}`))}function unreachable(e){throw new Error(e)}!function BaseExceptionClosure(){function BaseException(e,t){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException}();[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")))},631:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{AltTextManager:()=>AltTextManager});var s=i(1869),r=e([s]);s=(r.then?(await r)():r)[0];class AltTextManager{#e=this.#t.bind(this);#i=this.#n.bind(this);#s=this.#r.bind(this);#a=null;#o;#l;#h;#d=!1;#c;#u;#p;#g;#f;#m;#w=null;#b=null;#v=null;#y;#P=null;constructor({dialog:e,optionDescription:t,optionDecorative:i,textarea:n,cancelButton:s,saveButton:r},a,o,l){this.#l=e;this.#c=t;this.#u=i;this.#f=n;this.#o=s;this.#g=r;this.#p=o;this.#h=l;this.#y=a;e.addEventListener("close",this.#S.bind(this));e.addEventListener("contextmenu",(e=>{e.target!==this.#f&&e.preventDefault()}));s.addEventListener("click",this.#E.bind(this));r.addEventListener("click",this.#_.bind(this));t.addEventListener("change",this.#e);i.addEventListener("change",this.#e);this.#p.register(e)}get _elements(){return(0,s.shadow)(this,"_elements",[this.#c,this.#u,this.#f,this.#g,this.#o])}#C(){if(this.#b)return;const e=new s.DOMSVGFactory,t=this.#b=e.createElement("svg");t.setAttribute("width","0");t.setAttribute("height","0");const i=e.createElement("defs");t.append(i);const n=e.createElement("mask");i.append(n);n.setAttribute("id","alttext-manager-mask");n.setAttribute("maskContentUnits","objectBoundingBox");let r=e.createElement("rect");n.append(r);r.setAttribute("fill","white");r.setAttribute("width","1");r.setAttribute("height","1");r.setAttribute("x","0");r.setAttribute("y","0");r=this.#v=e.createElement("rect");n.append(r);r.setAttribute("fill","black");this.#l.append(t)}async editAltText(e,t){if(this.#a||!t)return;this.#C();this.#d=!1;for(const e of this._elements)e.addEventListener("click",this.#s);const{altText:i,decorative:n}=t.altTextData;if(!0===n){this.#u.checked=!0;this.#c.checked=!1}else{this.#u.checked=!1;this.#c.checked=!0}this.#w=this.#f.value=i?.trim()||"";this.#t();this.#a=t;this.#m=e;this.#m.removeEditListeners();this.#h._on("resize",this.#i);try{await this.#p.open(this.#l);this.#n()}catch(e){this.#S();throw e}}#n(){if(!this.#a)return;const e=this.#l,{style:t}=e,{x:i,y:n,width:s,height:r}=this.#y.getBoundingClientRect(),{innerWidth:a,innerHeight:o}=window,{width:l,height:h}=e.getBoundingClientRect(),{x:d,y:c,width:u,height:p}=this.#a.getClientDimensions(),g=10,f="ltr"===this.#m.direction,m=Math.max(d,i),w=Math.min(d+u,i+s),b=Math.max(c,n),v=Math.min(c+p,n+r);this.#v.setAttribute("width",""+(w-m)/a);this.#v.setAttribute("height",""+(v-b)/o);this.#v.setAttribute("x",""+m/a);this.#v.setAttribute("y",""+b/o);let y=null,P=Math.max(c,0);P+=Math.min(o-(P+h),0);f?d+u+g+l<a?y=d+u+g:d>l+g&&(y=d-l-g):d>l+g?y=d-l-g:d+u+g+l<a&&(y=d+u+g);if(null===y){P=null;y=Math.max(d,0);y+=Math.min(a-(y+l),0);c>h+g?P=c-h-g:c+p+g+h<o&&(P=c+p+g)}if(null!==P){e.classList.add("positioned");f?t.left=`${y}px`:t.right=a-y-l+"px";t.top=`${P}px`}else{e.classList.remove("positioned");t.left="";t.top=""}}#E(){this.#p.active===this.#l&&this.#p.close(this.#l)}#S(){this.#h.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.#a.editorType,data:this.#P||{action:"alt_text_cancel",alt_text_keyboard:!this.#d}}});this.#P=null;this.#x();this.#m?.addEditListeners();this.#h._off("resize",this.#i);this.#a.altTextFinish();this.#a=null;this.#m=null}#t(){this.#f.disabled=this.#u.checked}#_(){const e=this.#f.value.trim(),t=this.#u.checked;this.#a.altTextData={altText:e,decorative:t};this.#P={action:"alt_text_save",alt_text_description:!!e,alt_text_edit:!!this.#w&&this.#w!==e,alt_text_decorative:t,alt_text_keyboard:!this.#d};this.#E()}#r(e){if(0!==e.detail){this.#d=!0;this.#x()}}#x(){for(const e of this._elements)e.removeEventListener("click",this.#s)}destroy(){this.#m=null;this.#E();this.#b?.remove();this.#b=this.#v=null}}n()}catch(e){n(e)}}))},2640:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{AnnotationEditorLayerBuilder:()=>AnnotationEditorLayerBuilder});var s=i(1869),r=i(7910),a=e([s,r]);[s,r]=a.then?(await a)():a;class AnnotationEditorLayerBuilder{#T=null;#L=null;#I=null;#m;constructor(e){this.pageDiv=e.pageDiv;this.pdfPage=e.pdfPage;this.accessibilityManager=e.accessibilityManager;this.l10n=e.l10n||r.NullL10n;this.annotationEditorLayer=null;this.div=null;this._cancelled=!1;this.#m=e.uiManager;this.#T=e.annotationLayer||null;this.#I=e.textLayer||null;this.#L=e.drawLayer||null}async render(e,t="display"){if("display"!==t)return;if(this._cancelled)return;const i=e.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:i});this.show();return}const n=this.div=document.createElement("div");n.className="annotationEditorLayer";n.tabIndex=0;n.hidden=!0;n.dir=this.#m.direction;this.pageDiv.append(n);this.annotationEditorLayer=new s.AnnotationEditorLayer({uiManager:this.#m,div:n,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:i,annotationLayer:this.#T,textLayer:this.#I,drawLayer:this.#L});const r={viewport:i,div:n,annotations:null,intent:t};this.annotationEditorLayer.render(r);this.show()}cancel(){this._cancelled=!0;if(this.div){this.pageDiv=null;this.annotationEditorLayer.destroy();this.div.remove()}}hide(){this.div&&(this.div.hidden=!0)}show(){this.div&&!this.annotationEditorLayer.isEmpty&&(this.div.hidden=!1)}}n()}catch(e){n(e)}}))},1296:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{AnnotationEditorParams:()=>AnnotationEditorParams});var s=i(1869),r=e([s]);s=(r.then?(await r)():r)[0];class AnnotationEditorParams{constructor(e,t){this.eventBus=t;this.#M(e)}#M({editorFreeTextFontSize:e,editorFreeTextColor:t,editorInkColor:i,editorInkThickness:n,editorInkOpacity:r,editorStampAddImage:a}){const dispatchEvent=(e,t)=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:s.AnnotationEditorParamsType[e],value:t})};e.addEventListener("input",(function(){dispatchEvent("FREETEXT_SIZE",this.valueAsNumber)}));t.addEventListener("input",(function(){dispatchEvent("FREETEXT_COLOR",this.value)}));i.addEventListener("input",(function(){dispatchEvent("INK_COLOR",this.value)}));n.addEventListener("input",(function(){dispatchEvent("INK_THICKNESS",this.valueAsNumber)}));r.addEventListener("input",(function(){dispatchEvent("INK_OPACITY",this.valueAsNumber)}));a.addEventListener("click",(()=>{dispatchEvent("CREATE")}));this.eventBus._on("annotationeditorparamschanged",(a=>{for(const[o,l]of a.details)switch(o){case s.AnnotationEditorParamsType.FREETEXT_SIZE:e.value=l;break;case s.AnnotationEditorParamsType.FREETEXT_COLOR:t.value=l;break;case s.AnnotationEditorParamsType.INK_COLOR:i.value=l;break;case s.AnnotationEditorParamsType.INK_THICKNESS:n.value=l;break;case s.AnnotationEditorParamsType.INK_OPACITY:r.value=l}}))}}n()}catch(e){n(e)}}))},6735:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{AnnotationLayerBuilder:()=>AnnotationLayerBuilder});var s=i(1869),r=i(4927),a=e([s]);s=(a.then?(await a)():a)[0];class AnnotationLayerBuilder{#A=null;constructor({pageDiv:e,pdfPage:t,linkService:i,downloadManager:n,annotationStorage:s=null,imageResourcesPath:r="",renderForms:a=!0,enableScripting:o=!1,hasJSActionsPromise:l=null,fieldObjectsPromise:h=null,annotationCanvasMap:d=null,accessibilityManager:c=null}){this.pageDiv=e;this.pdfPage=t;this.linkService=i;this.downloadManager=n;this.imageResourcesPath=r;this.renderForms=a;this.annotationStorage=s;this.enableScripting=o;this._hasJSActionsPromise=l||Promise.resolve(!1);this._fieldObjectsPromise=h||Promise.resolve(null);this._annotationCanvasMap=d;this._accessibilityManager=c;this.annotationLayer=null;this.div=null;this._cancelled=!1;this._eventBus=i.eventBus}async render(e,t="display"){if(this.div){if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:e.clone({dontFlip:!0})});return}const[i,n,a]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const o=this.div=document.createElement("div");o.className="annotationLayer";this.pageDiv.append(o);if(0!==i.length){this.annotationLayer=new s.AnnotationLayer({div:o,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,page:this.pdfPage,viewport:e.clone({dontFlip:!0})});await this.annotationLayer.render({annotations:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:n,fieldObjects:a});this.linkService.isInPresentationMode&&this.#D(r.PresentationModeState.FULLSCREEN);if(!this.#A){this.#A=e=>{this.#D(e.state)};this._eventBus?._on("presentationmodechanged",this.#A)}}else this.hide()}cancel(){this._cancelled=!0;if(this.#A){this._eventBus?._off("presentationmodechanged",this.#A);this.#A=null}}hide(){this.div&&(document.querySelector("[data-pdfjsprinting=true]")||(this.div.hidden=!0))}#D(e){if(!this.div)return;let t=!1;switch(e){case r.PresentationModeState.FULLSCREEN:t=!0;break;case r.PresentationModeState.NORMAL:break;default:return}for(const e of this.div.childNodes)e.hasAttribute("data-internal-link")||(e.inert=t)}}n()}catch(e){n(e)}}))},39:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{DefaultExternalServices:()=>DefaultExternalServices,PDFPrintServiceFactory:()=>F,PDFViewerApplication:()=>k});var s=i(4927),r=i(1869),a=i(5318),o=i(8961),l=i(6554),h=i(3234),d=i(631),c=i(1296),u=i(1996),p=i(6329),g=i(716),f=i(3611),m=i(6312),w=i(1795),b=i(3557),v=i(6418),y=i(3706),P=i(1141),S=i(323),E=i(5119),_=i(2599),C=i(4487),x=i(3510),T=i(9290),L=i(1544),I=i(276),M=i(1096),A=e([r,d,c,p,g,f,m,w,b,P,S,E,_,x,T,L,I]);[r,d,c,p,g,f,m,w,b,P,S,E,_,x,T,L,I]=A.then?(await A)():A;const D=10,N=1e3,B={UNKNOWN:-1,PREVIOUS:0,INITIAL:1};class DefaultExternalServices{constructor(){throw new Error("Cannot initialize DefaultExternalServices.")}static updateFindControlState(e){}static updateFindMatchesCount(e){}static initPassiveLoading(e){}static reportTelemetry(e){}static createDownloadManager(){throw new Error("Not implemented: createDownloadManager")}static createPreferences(){throw new Error("Not implemented: createPreferences")}static async createL10n(){throw new Error("Not implemented: createL10n")}static createScripting(){throw new Error("Not implemented: createScripting")}static updateEditorStates(e){throw new Error("Not implemented: updateEditorStates")}static getNimbusExperimentData(){return(0,r.shadow)(this,"getNimbusExperimentData",Promise.resolve(null))}}const k={initialBookmark:document.location.hash.substring(1),_initializedCapability:new r.PromiseCapability,appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfHistory:null,pdfSidebar: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:!1,downloadComplete:!1,isViewerEmbedded:window.parent!==window,url:"",baseUrl:"",_downloadUrl:"",externalServices:DefaultExternalServices,_boundEvents:Object.create(null),documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,_saveInProgress:!1,_wheelUnusedTicks:0,_wheelUnusedFactor:1,_touchUnusedTicks:0,_touchUnusedFactor:1,_PDFBug:null,_hasAnnotationEditors:!1,_title:document.title,_printAnnotationStoragePromise:null,_touchInfo:null,_isCtrlKeyDown:!1,_nimbusDataPromise:null,async initialize(e){let t,i;this.appConfig=e;try{await this.preferences.initializedPromise}catch(e){console.error(`initialize: "${e.message}".`)}o.AppOptions.get("pdfBugEnabled")&&await this._parseHashParams();switch(o.AppOptions.get("viewerCssTheme")){case 1:i="is-light";break;case 2:i="is-dark"}i&&document.documentElement.classList.add(i);t=this.externalServices.createL10n();this.l10n=await t;document.getElementsByTagName("html")[0].dir=this.l10n.getDirection();this.l10n.translate(e.appContainer||document.documentElement);this.isViewerEmbedded&&o.AppOptions.get("externalLinkTarget")===h.LinkTarget.NONE&&o.AppOptions.set("externalLinkTarget",h.LinkTarget.TOP);await this._initializeViewerComponents();this.bindEvents();this.bindWindowEvents();this._initializedCapability.resolve();this.initializeLoadingBar()},async _parseHashParams(){const e=document.location.hash.substring(1);if(!e)return;const{mainContainer:t,viewerContainer:i}=this.appConfig,n=(0,s.parseQueryString)(e);if("true"===n.get("disableworker"))try{await loadFakeWorker()}catch(e){console.error(`_parseHashParams: "${e.message}".`)}n.has("disablerange")&&o.AppOptions.set("disableRange","true"===n.get("disablerange"));n.has("disablestream")&&o.AppOptions.set("disableStream","true"===n.get("disablestream"));n.has("disableautofetch")&&o.AppOptions.set("disableAutoFetch","true"===n.get("disableautofetch"));n.has("disablefontface")&&o.AppOptions.set("disableFontFace","true"===n.get("disablefontface"));n.has("disablehistory")&&o.AppOptions.set("disableHistory","true"===n.get("disablehistory"));n.has("verbosity")&&o.AppOptions.set("verbosity",0|n.get("verbosity"));if(n.has("textlayer"))switch(n.get("textlayer")){case"off":o.AppOptions.set("textLayerMode",s.TextLayerMode.DISABLE);break;case"visible":case"shadow":case"hover":i.classList.add(`textLayer-${n.get("textlayer")}`);try{await loadPDFBug(this);this._PDFBug.loadCSS()}catch(e){console.error(`_parseHashParams: "${e.message}".`)}}if(n.has("pdfbug")){o.AppOptions.set("pdfBug",!0);o.AppOptions.set("fontExtraProperties",!0);const e=n.get("pdfbug").split(",");try{await loadPDFBug(this);this._PDFBug.init(t,e)}catch(e){console.error(`_parseHashParams: "${e.message}".`)}}n.has("locale")&&o.AppOptions.set("locale",n.get("locale"))},async _initializeViewerComponents(){const{appConfig:e,externalServices:t,l10n:i}=this,n=o.AppOptions.get("isInAutomation")?new l.AutomationEventBus:new l.EventBus;this.eventBus=n;this.overlayManager=new u.OverlayManager;const a=new E.PDFRenderingQueue;a.onIdle=this._cleanup.bind(this);this.pdfRenderingQueue=a;const M=new h.PDFLinkService({eventBus:n,externalLinkTarget:o.AppOptions.get("externalLinkTarget"),externalLinkRel:o.AppOptions.get("externalLinkRel"),ignoreDestinationZoom:o.AppOptions.get("ignoreDestinationZoom")});this.pdfLinkService=M;const A=t.createDownloadManager();this.downloadManager=A;const D=new b.PDFFindController({linkService:M,eventBus:n,pageViewMode:o.AppOptions.get("pageViewMode"),updateMatchesCountOnProgress:!0});this.findController=D;const N=new _.PDFScriptingManager({eventBus:n,externalServices:t,docProperties:this._scriptingDocProperties.bind(this)});this.pdfScriptingManager=N;const B=e.mainContainer,k=e.viewerContainer,V=o.AppOptions.get("annotationEditorMode"),F=o.AppOptions.get("isOffscreenCanvasSupported")&&r.FeatureTest.isOffscreenCanvasSupported,R=o.AppOptions.get("forcePageColors")||window.matchMedia("(forced-colors: active)").matches?{background:o.AppOptions.get("pageColorsBackground"),foreground:o.AppOptions.get("pageColorsForeground")}:null,O=e.altTextDialog?new d.AltTextManager(e.altTextDialog,B,this.overlayManager,n):null,H=new T.PDFViewer({container:B,viewer:k,eventBus:n,renderingQueue:a,linkService:M,downloadManager:A,altTextManager:O,findController:D,scriptingManager:o.AppOptions.get("enableScripting")&&N,l10n:i,textLayerMode:o.AppOptions.get("textLayerMode"),annotationMode:o.AppOptions.get("annotationMode"),annotationEditorMode:V,annotationEditorHighlightColors:o.AppOptions.get("highlightEditorColors"),imageResourcesPath:o.AppOptions.get("imageResourcesPath"),removePageBorders:o.AppOptions.get("removePageBorders"),enablePrintAutoRotate:o.AppOptions.get("enablePrintAutoRotate"),isOffscreenCanvasSupported:F,maxCanvasPixels:o.AppOptions.get("maxCanvasPixels"),pageViewMode:o.AppOptions.get("pageViewMode"),enablePermissions:o.AppOptions.get("enablePermissions"),pageColors:R});this.pdfViewer=H;a.setViewer(H);M.setViewer(H);N.setViewer(H);if(e.sidebar?.thumbnailView){this.pdfThumbnailViewer=new x.PDFThumbnailViewer({container:e.sidebar.thumbnailView,eventBus:n,renderingQueue:a,linkService:M,pageColors:R});a.setThumbnailViewer(this.pdfThumbnailViewer)}if(!this.isViewerEmbedded&&!o.AppOptions.get("disableHistory")){this.pdfHistory=new v.PDFHistory({linkService:M,eventBus:n});M.setHistory(this.pdfHistory)}!this.supportsIntegratedFind&&e.findBar&&(this.findBar=new w.PDFFindBar(e.findBar,n));if(e.annotationEditorParams)if(V!==r.AnnotationEditorType.DISABLE){F||e.toolbar?.editorStampButton?.classList.add("hidden");const t=e.toolbar?.editorHighlightButton;t&&o.AppOptions.get("enableHighlightEditor")&&(t.hidden=!1);this.annotationEditorParams=new c.AnnotationEditorParams(e.annotationEditorParams,n)}else for(const e of["editorModeButtons","editorModeSeparator"])document.getElementById(e)?.classList.add("hidden");e.documentProperties&&(this.pdfDocumentProperties=new m.PDFDocumentProperties(e.documentProperties,this.overlayManager,n,i,(()=>this._docFilename)));e.secondaryToolbar?.cursorHandToolButton&&(this.pdfCursorTools=new f.PDFCursorTools({container:B,eventBus:n,cursorToolOnLoad:o.AppOptions.get("cursorToolOnLoad")}));e.toolbar&&(this.toolbar=new I.Toolbar(e.toolbar,n));e.secondaryToolbar&&(this.secondaryToolbar=new L.SecondaryToolbar(e.secondaryToolbar,n));this.supportsFullscreen&&(e.toolbar?.presentationModeButton||e.secondaryToolbar?.presentationModeButton)&&(this.pdfPresentationMode=new S.PDFPresentationMode({container:B,pdfViewer:H,eventBus:n}));const U=o.AppOptions.get("passwordPrompt");U?this.passwordPrompt=U:e.passwordOverlay&&(this.passwordPrompt=new p.PasswordPrompt(e.passwordOverlay,this.overlayManager,this.isViewerEmbedded));e.sidebar?.outlineView&&(this.pdfOutlineViewer=new P.PDFOutlineViewer({container:e.sidebar.outlineView,eventBus:n,l10n:i,linkService:M,downloadManager:A}));e.sidebar?.attachmentsView&&(this.pdfAttachmentViewer=new g.PDFAttachmentViewer({container:e.sidebar.attachmentsView,eventBus:n,l10n:i,downloadManager:A}));e.sidebar?.layersView&&(this.pdfLayerViewer=new y.PDFLayerViewer({container:e.sidebar.layersView,eventBus:n,l10n:i}));if(e.sidebar){this.pdfSidebar=new C.PDFSidebar({elements:e.sidebar,eventBus:n,l10n:i});this.pdfSidebar.onToggled=this.forceRendering.bind(this);this.pdfSidebar.onUpdateThumbnails=()=>{for(const e of H.getCachedPageViews())e.renderingState===s.RenderingStates.FINISHED&&this.pdfThumbnailViewer.getThumbnail(e.id-1)?.setImage(e);this.pdfThumbnailViewer.scrollThumbnailIntoView(H.currentPageNumber)}}},async run(e){this.preferences=this.externalServices.createPreferences();await this.initialize(e);const{appConfig:t,eventBus:i}=this;let n;const r=document.location.search.substring(1);n=(0,s.parseQueryString)(r).get("file")??o.AppOptions.get("defaultUrl");validateFileURL(n);const a=t.openFileInput;a.value=null;a.addEventListener("change",(function(e){const{files:t}=e.target;t&&0!==t.length&&i.dispatch("fileinputchange",{source:this,fileInput:e.target})}));t.mainContainer.addEventListener("dragover",(function(e){if(o.AppOptions.get("enableDragAndDrop")){e.preventDefault();e.dataTransfer.dropEffect="copy"===e.dataTransfer.effectAllowed?"copy":"move"}}));t.mainContainer.addEventListener("drop",(function(e){e.preventDefault();const{files:t}=e.dataTransfer;t&&0!==t.length&&i.dispatch("fileinputchange",{source:this,fileInput:e.dataTransfer,dropEvent:e})}));if(!o.AppOptions.get("supportsDocumentFonts")){o.AppOptions.set("disableFontFace",!0);this.l10n.get("pdfjs-web-fonts-disabled").then((e=>{console.warn(e)}))}if(!this.supportsPrinting){t.toolbar?.print?.classList.add("hidden");t.secondaryToolbar?.printButton.classList.add("hidden")}if(!this.supportsFullscreen){t.toolbar.presentationModeButton.classList.add("hidden");t.secondaryToolbar?.presentationModeButton.classList.add("hidden")}this.supportsIntegratedFind&&t.toolbar?.viewFind?.classList.add("hidden");n?this.open({url:n}):this._hideViewBookmark()},get initialized(){return this._initializedCapability.settled},get initializedPromise(){return this._initializedCapability.promise},zoomIn(e,t){this.pdfViewer.isInPresentationMode||this.pdfViewer.increaseScale({drawingDelay:o.AppOptions.get("defaultZoomDelay"),steps:e,scaleFactor:t})},zoomOut(e,t){this.pdfViewer.isInPresentationMode||this.pdfViewer.decreaseScale({drawingDelay:o.AppOptions.get("defaultZoomDelay"),steps:e,scaleFactor:t})},zoomReset(){this.pdfViewer.isInPresentationMode||(this.pdfViewer.currentScaleValue=s.DEFAULT_SCALE_VALUE)},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0},get page(){return this.pdfViewer.currentPageNumber},set page(e){this.pdfViewer.currentPageNumber=e},get supportsPrinting(){return F.instance.supportsPrinting},get supportsFullscreen(){return(0,r.shadow)(this,"supportsFullscreen",document.fullscreenEnabled)},get supportsPinchToZoom(){return(0,r.shadow)(this,"supportsPinchToZoom",o.AppOptions.get("supportsPinchToZoom"))},get supportsIntegratedFind(){return(0,r.shadow)(this,"supportsIntegratedFind",o.AppOptions.get("supportsIntegratedFind"))},initializeLoadingBar(){const e=document.getElementById("loadingBar"),t=e?new s.ProgressBar(e):null;t?.hide();return(0,r.shadow)(this,"loadingBar",t)},get supportsMouseWheelZoomCtrlKey(){return(0,r.shadow)(this,"supportsMouseWheelZoomCtrlKey",o.AppOptions.get("supportsMouseWheelZoomCtrlKey"))},get supportsMouseWheelZoomMetaKey(){return(0,r.shadow)(this,"supportsMouseWheelZoomMetaKey",o.AppOptions.get("supportsMouseWheelZoomMetaKey"))},initPassiveLoading(e){throw new Error("Not implemented: initPassiveLoading")},setTitleUsingUrl(e="",t=null){},setTitle(e=this._title){this._title=e;if(this.isViewerEmbedded)return;const t=this._hasAnnotationEditors&&!this.pdfRenderingQueue.printing;document.title=`${t?"* ":""}${e}`},get _docFilename(){return this._contentDispositionFilename||(0,r.getPdfFilenameFromUrl)(this.url)},_hideViewBookmark(){if(!this.appConfig)return;const{secondaryToolbar:e}=this.appConfig;e?.viewBookmarkButton.classList.add("hidden");e?.presentationModeButton.classList.contains("hidden")&&document.getElementById("viewBookmarkSeparator")?.classList.add("hidden")},async close(){this._unblockDocumentLoadEvent();this._hideViewBookmark();if(!this.pdfLoadingTask)return;if(this.pdfDocument?.annotationStorage.size>0&&this._annotationStorageModified)try{await this.save()}catch{}const e=[];e.push(this.pdfLoadingTask.destroy());this.pdfLoadingTask=null;if(this.pdfDocument){this.pdfDocument=null;this.pdfThumbnailViewer?.setDocument(null);this.pdfViewer.setDocument(null);this.pdfLinkService.setDocument(null);this.pdfDocumentProperties?.setDocument(null)}this.pdfLinkService.externalLinkEnabled=!0;this.store=null;this.isInitialViewSet=!1;this.downloadComplete=!1;this.url="";this.baseUrl="";this._downloadUrl="";this.documentInfo=null;this.metadata=null;this._contentDispositionFilename=null;this._contentLength=null;this._saveInProgress=!1;this._hasAnnotationEditors=!1;e.push(this.pdfScriptingManager.destroyPromise,this.passwordPrompt.close());this.setTitle();this.pdfSidebar?.reset();this.pdfOutlineViewer?.reset();this.pdfAttachmentViewer?.reset();this.pdfLayerViewer?.reset();this.pdfHistory?.reset();this.findBar?.reset();this.toolbar?.reset();this.secondaryToolbar?.reset();this._PDFBug?.cleanup();await Promise.all(e)},async open(e){window.adjacentPagesLoader=void 0;this.pdfViewer?.destroyBookMode();window.ngxZone.runOutsideAngular((async()=>{this.pdfLoadingTask&&await this.close();const t=o.AppOptions.getAll(o.OptionKind.WORKER);Object.assign(r.GlobalWorkerOptions,t);e.url&&this.setTitleUsingUrl(e.originalUrl||e.url,e.url);const i=o.AppOptions.getAll(o.OptionKind.API),n=(0,r.getDocument)({...i,...e});this.pdfLoadingTask=n;n.onPassword=(e,t)=>{this.isViewerEmbedded&&this._unblockDocumentLoadEvent();this.pdfLinkService.externalLinkEnabled=!1;this.passwordPrompt.setUpdateCallback(e,t);this.passwordPrompt.open()};n.onProgress=({loaded:e,total:t})=>{this.progress(e/t);this.eventBus?.dispatch("progress",{source:this,type:"load",total:t,loaded:e,percent:100*e/t})};return n.promise.then((e=>{this.load(e)}),(e=>{if(n!==this.pdfLoadingTask)return;let t="pdfjs-loading-error";e instanceof r.InvalidPDFException?t="pdfjs-invalid-file-error":e instanceof r.MissingPDFException?t="pdfjs-missing-file-error":e instanceof r.UnexpectedResponseException&&(t="pdfjs-unexpected-response-error");k.onError&&k.onError(e);return this.l10n.get(t).then((t=>{this._documentError(t,{message:e?.message});throw e}))}))}))},_ensureDownloadComplete(){if(!this.pdfDocument||!this.downloadComplete)throw new Error("PDF document not downloaded.")},async download(e={}){const t=this._downloadUrl,i=this._docFilename;try{this._ensureDownloadComplete();const n=await this.pdfDocument.getData(),s=new Blob([n],{type:"application/pdf"});await this.downloadManager.download(s,t,i,e)}catch{await this.downloadManager.downloadUrl(t,i,e)}},async save(e={}){if(this._saveInProgress)return;this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();const t=this._downloadUrl,i=this._docFilename;try{this._ensureDownloadComplete();const n=await this.pdfDocument.saveDocument(),s=new Blob([n],{type:"application/pdf"});await this.downloadManager.download(s,t,i,e)}catch(t){globalThis.ngxConsole.error(`Error when saving the document: ${t.message}`);await this.download(e)}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}this._hasAnnotationEditors&&this.externalServices.reportTelemetry({type:"editing",data:{type:"save"}})},downloadOrSave(e={}){this.pdfDocument?.annotationStorage.size>0?this.save(e):this.download(e)},async _exportWithAnnotations(){if(this._saveInProgress)throw new Error("Already downloading");this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();try{this._ensureDownloadComplete();const e=await this.pdfDocument.saveDocument();return new Blob([e],{type:"application/pdf"})}catch(e){throw new Error(`Error when saving the document: ${e.message}`)}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}},async _exportWithoutAnnotations(){try{this._ensureDownloadComplete();const e=await this.pdfDocument.getData();return new Blob([e],{type:"application/pdf"})}catch(e){throw new Error(`Error when saving the document: ${e.message}`)}},async export(){return this.pdfDocument?.annotationStorage.size>0?this._exportWithAnnotations():this._exportWithoutAnnotations()},openInExternalApp(){this.downloadOrSave({openInExternalApp:!0})},_documentError(e,t=null){this._unblockDocumentLoadEvent();this._otherError(e,t);this.eventBus.dispatch("documenterror",{source:this,message:e,reason:t?.message??null})},_otherError(e,t=null){const i=[`PDF.js v${r.version||"?"} (build: ${r.build||"?"})`];if(t){i.push(`Message: ${t.message}`);if(t.stack)i.push(`Stack: ${t.stack}`);else{t.filename&&i.push(`File: ${t.filename}`);t.lineNumber&&i.push(`Line: ${t.lineNumber}`)}}console.error(`${e}\n\n${i.join("\n")}`)},progress(e){if(!this.loadingBar||this.downloadComplete)return;const t=Math.round(100*e);if(!(t<=this.loadingBar.percent)){this.loadingBar.percent=t;(this.pdfDocument?.loadingParams.disableAutoFetch??o.AppOptions.get("disableAutoFetch"))&&this.loadingBar.setDisableAutoFetch()}},load(e){this.pdfDocument=e;e.getDownloadInfo().then((({length:e})=>{this._contentLength=e;this.downloadComplete=!0;this.loadingBar?.hide();a.then((()=>{this.eventBus?.dispatch("documentloaded",{source:this})}))}));const t=e.getPageLayout().catch((()=>{})),i=e.getPageMode().catch((()=>{})),n=e.getOpenAction().catch((()=>{}));this.toolbar?.setPagesCount(e.numPages,!1);this.secondaryToolbar?.setPagesCount(e.numPages);this.pdfLinkService.setDocument(e);this.pdfDocumentProperties?.setDocument(e);const r=this.pdfViewer;r.setDocument(e);const{firstPagePromise:a,onePageRendered:l,pagesPromise:h}=r;this.pdfThumbnailViewer?.setDocument(e);const d=(this.store=new M.ViewHistory(e.fingerprints[0])).getMultiple({page:null,zoom:s.DEFAULT_SCALE_VALUE,scrollLeft:"0",scrollTop:"0",rotation:null,sidebarView:s.SidebarView.UNKNOWN,scrollMode:s.ScrollMode.UNKNOWN,spreadMode:s.SpreadMode.UNKNOWN}).catch((()=>{}));a.then((a=>{this.loadingBar?.setWidth(this.appConfig.viewerContainer);this._initializeAnnotationStorageCallbacks(e);Promise.all([s.animationStarted,d,t,i,n]).then((async([t,i,n,a,l])=>{const d=o.AppOptions.get("viewOnLoad");this._initializePdfHistory({fingerprint:e.fingerprints[0],viewOnLoad:d,initialDest:l?.dest});const c=this.initialBookmark,u=o.AppOptions.get("defaultZoomValue");let p=u?`zoom=${u}`:null,g=null,f=o.AppOptions.get("sidebarViewOnLoad"),m=o.AppOptions.get("scrollModeOnLoad"),w=o.AppOptions.get("spreadModeOnLoad");if(i?.page&&d!==B.INITIAL){p=`page=${i.page}&zoom=${u||i.zoom},${i.scrollLeft},${i.scrollTop}`;g=parseInt(i.rotation,10);f===s.SidebarView.UNKNOWN&&(f=0|i.sidebarView);m===s.ScrollMode.UNKNOWN&&(m=0|i.scrollMode);w===s.SpreadMode.UNKNOWN&&(w=0|i.spreadMode)}a&&f===s.SidebarView.UNKNOWN&&(f=(0,s.apiPageModeToSidebarView)(a));if(n&&m===s.ScrollMode.UNKNOWN&&w===s.SpreadMode.UNKNOWN){w=(0,s.apiPageLayoutToViewerModes)(n).spreadMode}this.setInitialView(p,{rotation:g,sidebarView:f,scrollMode:m,spreadMode:w});this.eventBus.dispatch("documentinit",{source:this});this.isViewerEmbedded||r.focus();await Promise.race([h,new Promise((e=>{setTimeout(e,D)}))]);if((c||p)&&!r.hasEqualPageSizes){this.initialBookmark=c;r.currentScaleValue=r.currentScaleValue;this.setInitialView(p)}})).catch((()=>{this.setInitialView()})).then((function(){r.update()}))}));h.then((()=>{this._unblockDocumentLoadEvent();this._initializeAutoPrint(e,n)}),(e=>{k.onError&&k.onError(e);this.l10n.get("pdfjs-loading-error").then((t=>{this._documentError(t,{message:e?.message})}))}));l.then((t=>{this.externalServices.reportTelemetry({type:"pageInfo",timestamp:t.timestamp});this.pdfOutlineViewer&&e.getOutline().then((t=>{e===this.pdfDocument&&this.pdfOutlineViewer.render({outline:t,pdfDocument:e})}));this.pdfAttachmentViewer&&e.getAttachments().then((t=>{e===this.pdfDocument&&this.pdfAttachmentViewer.render({attachments:t})}));this.pdfLayerViewer&&r.optionalContentConfigPromise.then((t=>{e===this.pdfDocument&&this.pdfLayerViewer.render({optionalContentConfig:t,pdfDocument:e})}))}));this._initializePageLabels(e);this._initializeMetadata(e)},async _scriptingDocProperties(e){if(!this.documentInfo){await new Promise((e=>{this.eventBus._on("metadataloaded",e,{once:!0})}));if(e!==this.pdfDocument)return null}if(!this._contentLength){await new Promise((e=>{this.eventBus._on("documentloaded",e,{once:!0})}));if(e!==this.pdfDocument)return null}return{...this.documentInfo,baseURL:this.baseUrl,filesize:this._contentLength,filename:this._docFilename,metadata:this.metadata?.getRaw(),authors:this.metadata?.get("dc:creator"),numPages:this.pagesCount,URL:this.url}},async _initializeAutoPrint(e,t){const[i,n]=await Promise.all([t,this.pdfViewer.enableScripting?null:e.getJSActions()]);if(e!==this.pdfDocument)return;let r="Print"===i?.action;if(n){globalThis.ngxConsole.warn("Warning: JavaScript support is not enabled");for(const e in n){if(r)break;switch(e){case"WillClose":case"WillSave":case"DidSave":case"WillPrint":case"DidPrint":continue}r=n[e].some((e=>s.AutoPrintRegExp.test(e)))}}r&&this.triggerPrinting()},async _initializeMetadata(e){const{info:t,metadata:i,contentDispositionFilename:n,contentLength:s}=await e.getMetadata();if(e!==this.pdfDocument)return;this.documentInfo=t;this.metadata=i;this._contentDispositionFilename??=n;this._contentLength??=s;const o=window.PDFViewerApplicationOptions;(!o||o.get("verbosity")>0)&&globalThis.ngxConsole.log(`PDF ${e.fingerprints[0]} [${t.PDFFormatVersion} ${(t.Producer||"-").trim()} / ${(t.Creator||"-").trim()}] (PDF.js: ${r.version||"?"} [${r.build||"?"}])  modified by ngx-extended-pdf-viewer ${a.ngxExtendedPdfViewerVersion}`);let l=t.Title;const h=i?.get("dc:title");h&&("Untitled"===h||/[\uFFF0-\uFFFF]/g.test(h)||(l=h));l?this.setTitle(`${l} - ${this._contentDispositionFilename||this._title}`):this._contentDispositionFilename&&this.setTitle(this._contentDispositionFilename);!t.IsXFAPresent||t.IsAcroFormPresent||e.isPureXfa?!t.IsAcroFormPresent&&!t.IsXFAPresent||this.pdfViewer.renderForms||console.warn("Warning: Interactive form support is not enabled"):e.loadingParams.enableXfa?globalThis.ngxConsole.warn("Warning: XFA Foreground documents are not supported"):globalThis.ngxConsole.warn("Warning: XFA support is not enabled");t.IsSignaturesPresent&&console.warn("Warning: Digital signatures validation is not supported");this.eventBus.dispatch("metadataloaded",{source:this})},async _initializePageLabels(e){const t=await e.getPageLabels();if(e!==this.pdfDocument)return;if(!t||o.AppOptions.get("disablePageLabels"))return;const i=t.length;let n=0,s=0;for(let e=0;e<i;e++){const i=t[e];if(i===(e+1).toString())n++;else{if(""!==i)break;s++}}if(n>=i||s>=i)return;const{pdfViewer:r,pdfThumbnailViewer:a,toolbar:l}=this;r.setPageLabels(t);a?.setPageLabels(t);l?.setPagesCount(i,!0);l?.setPageNumber(r.currentPageNumber,r.currentPageLabel)},_initializePdfHistory({fingerprint:e,viewOnLoad:t,initialDest:i=null}){if(this.pdfHistory){this.pdfHistory.initialize({fingerprint:e,resetHistory:t===B.INITIAL,updateUrl:o.AppOptions.get("historyUpdateUrl")});if(this.pdfHistory.initialBookmark){this.initialBookmark=this.pdfHistory.initialBookmark;this.initialRotation=this.pdfHistory.initialRotation}if(i&&!this.initialBookmark&&t===B.UNKNOWN){this.initialBookmark=JSON.stringify(i);this.pdfHistory.push({explicitDest:i,pageNumber:null})}}},_initializeAnnotationStorageCallbacks(e){if(e!==this.pdfDocument)return;const{annotationStorage:t}=e;t.onSetModified=()=>{window.addEventListener("beforeunload",beforeUnload);this._annotationStorageModified=!0};t.onResetModified=()=>{window.removeEventListener("beforeunload",beforeUnload);delete this._annotationStorageModified};t.onAnnotationEditor=e=>{this._hasAnnotationEditors=!!e;this.setTitle();e&&this.externalServices.reportTelemetry({type:"editing",data:{type:e}})}},setInitialView(e,{rotation:t,sidebarView:i,scrollMode:n,spreadMode:r}={}){const setRotation=e=>{(0,s.isValidRotation)(e)&&(this.pdfViewer.pagesRotation=e)};this.isInitialViewSet=!0;this.pdfSidebar?.setInitialView(i);((e,t)=>{(0,s.isValidScrollMode)(e)&&(this.pdfViewer.scrollMode=e);(0,s.isValidSpreadMode)(t)&&(this.pdfViewer.spreadMode=t)})(n,r);if(this.initialBookmark){setRotation(this.initialRotation);delete this.initialRotation;this.pdfLinkService.setHash(this.initialBookmark);this.initialBookmark=null}else if(e){setRotation(t);this.pdfLinkService.setHash(e)}this.toolbar?.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel);this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber);if(!this.pdfViewer.currentScaleValue){const e=PDFViewerApplicationOptions.get("defaultZoomValue");e&&(this.pdfViewer.currentScaleValue=e)}},_cleanup(){if(this.pdfDocument){this.pdfViewer.cleanup();this.pdfThumbnailViewer?.cleanup();this.pdfDocument.cleanup(o.AppOptions.get("fontExtraProperties"))}},forceRendering(){this.pdfRenderingQueue.printing=!!this.printService;this.pdfRenderingQueue.isThumbnailViewEnabled=this.pdfSidebar?.visibleView===s.SidebarView.THUMBS;this.pdfRenderingQueue.renderHighestPriority()},beforePrint(){this._printAnnotationStoragePromise=this.pdfScriptingManager.dispatchWillPrint().catch((()=>{})).then((()=>this.pdfDocument?.annotationStorage.print));if(this.printService)return;if(!this.supportsPrinting){this.l10n.get("pdfjs-printing-not-supported").then((e=>{this._otherError(e)}));return}if(!this.pdfViewer.pageViewsReady){this.l10n.get("pdfjs-printing-not-ready").then((e=>{window.alert(e)}));return}const e=this.pdfViewer.getPagesOverview(),t=this.appConfig.printContainer,i=o.AppOptions.get("printResolution"),n=this.pdfViewer.optionalContentConfigPromise,s=F.instance.createPrintService(this.pdfDocument,e,t,i,n,this._printAnnotationStoragePromise,this.pdfViewer.eventBus);this.printService=s;this.forceRendering();this.setTitle();s.layout();this._hasAnnotationEditors&&this.externalServices.reportTelemetry({type:"editing",data:{type:"print"}})},afterPrint(){if(this._printAnnotationStoragePromise){this._printAnnotationStoragePromise.then((()=>{this.pdfScriptingManager.dispatchDidPrint()}));this._printAnnotationStoragePromise=null}if(this.printService){this.printService.destroy();this.printService=null;this.pdfDocument?.annotationStorage.resetModified()}this.forceRendering();this.setTitle()},rotatePages(e){this.pdfViewer.pagesRotation+=e},requestPresentationMode(){this.pdfPresentationMode?.request()},triggerPrinting(){this.supportsPrinting&&window.printPDF()},bindEvents(){const{eventBus:e,_boundEvents:t}=this;t.beforePrint=this.beforePrint.bind(this);t.afterPrint=this.afterPrint.bind(this);e._on("resize",webViewerResize);e._on("hashchange",webViewerHashchange);e._on("beforeprint",t.beforePrint);e._on("afterprint",t.afterPrint);e._on("pagerender",webViewerPageRender);e._on("pagerendered",webViewerPageRendered);e._on("updateviewarea",webViewerUpdateViewarea);e._on("pagechanging",webViewerPageChanging);e._on("scalechanging",webViewerScaleChanging);e._on("rotationchanging",webViewerRotationChanging);e._on("sidebarviewchanged",webViewerSidebarViewChanged);e._on("pagemode",webViewerPageMode);e._on("namedaction",webViewerNamedAction);e._on("presentationmodechanged",webViewerPresentationModeChanged);e._on("presentationmode",webViewerPresentationMode);e._on("switchannotationeditormode",webViewerSwitchAnnotationEditorMode);e._on("switchannotationeditorparams",webViewerSwitchAnnotationEditorParams);e._on("print",webViewerPrint);e._on("download",webViewerDownload);e._on("openinexternalapp",webViewerOpenInExternalApp);e._on("firstpage",webViewerFirstPage);e._on("lastpage",webViewerLastPage);e._on("nextpage",webViewerNextPage);e._on("previouspage",webViewerPreviousPage);e._on("zoomin",webViewerZoomIn);e._on("zoomout",webViewerZoomOut);e._on("zoomreset",webViewerZoomReset);e._on("pagenumberchanged",webViewerPageNumberChanged);e._on("scalechanged",webViewerScaleChanged);e._on("rotatecw",webViewerRotateCw);e._on("rotateccw",webViewerRotateCcw);e._on("optionalcontentconfig",webViewerOptionalContentConfig);e._on("switchscrollmode",webViewerSwitchScrollMode);e._on("scrollmodechanged",webViewerScrollModeChanged);e._on("switchspreadmode",webViewerSwitchSpreadMode);e._on("spreadmodechanged",webViewerSpreadModeChanged);e._on("documentproperties",webViewerDocumentProperties);e._on("findfromurlhash",webViewerFindFromUrlHash);e._on("updatefindmatchescount",webViewerUpdateFindMatchesCount);e._on("updatefindcontrolstate",webViewerUpdateFindControlState);if(o.AppOptions.get("pdfBug")){t.reportPageStatsPDFBug=reportPageStatsPDFBug;e._on("pagerendered",t.reportPageStatsPDFBug);e._on("pagechanging",t.reportPageStatsPDFBug)}e._on("fileinputchange",webViewerFileInputChange);e._on("openfile",webViewerOpenFile)},bindWindowEvents(){const{eventBus:e,_boundEvents:t}=this;!function addWindowResolutionChange(e=null){e&&webViewerResolutionChange(e);const i=window.matchMedia(`(resolution: ${window.devicePixelRatio||1}dppx)`);i.addEventListener("change",addWindowResolutionChange,{once:!0});t.removeWindowResolutionChange||=function(){i.removeEventListener("change",addWindowResolutionChange);t.removeWindowResolutionChange=null}}();t.windowResize=()=>{e.dispatch("resize",{source:window})};t.windowHashChange=()=>{e.dispatch("hashchange",{source:window,hash:document.location.hash.substring(1)})};t.windowBeforePrint=()=>{e.dispatch("beforeprint",{source:window})};t.windowAfterPrint=()=>{e.dispatch("afterprint",{source:window})};t.windowUpdateFromSandbox=t=>{e.dispatch("updatefromsandbox",{source:window,detail:t.detail})};window.addEventListener("visibilitychange",webViewerVisibilityChange);const i=document.getElementById("viewerContainer");i?.addEventListener("wheel",webViewerWheel,{passive:!1});const n=document.getElementById("mainContainer");n?.addEventListener("touchstart",webViewerTouchStart,{passive:!1});n?.addEventListener("touchmove",webViewerTouchMove,{passive:!1});n?.addEventListener("touchend",webViewerTouchEnd,{passive:!1});window.addEventListener("click",webViewerClick);window.addEventListener("keydown",webViewerKeyDown);window.addEventListener("keyup",webViewerKeyUp);window.addEventListener("resize",t.windowResize);window.addEventListener("hashchange",t.windowHashChange);window.addEventListener("beforeprint",t.windowBeforePrint);window.addEventListener("afterprint",t.windowAfterPrint);window.addEventListener("updatefromsandbox",t.windowUpdateFromSandbox)},unbindEvents(){const{eventBus:e,_boundEvents:t}=this;e._off("resize",webViewerResize);e._off("hashchange",webViewerHashchange);e._off("beforeprint",t.beforePrint);e._off("afterprint",t.afterPrint);e._off("pagerender",webViewerPageRender);e._off("pagerendered",webViewerPageRendered);e._off("updateviewarea",webViewerUpdateViewarea);e._off("pagechanging",webViewerPageChanging);e._off("scalechanging",webViewerScaleChanging);e._off("rotationchanging",webViewerRotationChanging);e._off("sidebarviewchanged",webViewerSidebarViewChanged);e._off("pagemode",webViewerPageMode);e._off("namedaction",webViewerNamedAction);e._off("presentationmodechanged",webViewerPresentationModeChanged);e._off("presentationmode",webViewerPresentationMode);e._off("print",webViewerPrint);e._off("download",webViewerDownload);e._off("openinexternalapp",webViewerOpenInExternalApp);e._off("firstpage",webViewerFirstPage);e._off("lastpage",webViewerLastPage);e._off("nextpage",webViewerNextPage);e._off("previouspage",webViewerPreviousPage);e._off("zoomin",webViewerZoomIn);e._off("zoomout",webViewerZoomOut);e._off("zoomreset",webViewerZoomReset);e._off("pagenumberchanged",webViewerPageNumberChanged);e._off("scalechanged",webViewerScaleChanged);e._off("rotatecw",webViewerRotateCw);e._off("rotateccw",webViewerRotateCcw);e._off("optionalcontentconfig",webViewerOptionalContentConfig);e._off("switchscrollmode",webViewerSwitchScrollMode);e._off("scrollmodechanged",webViewerScrollModeChanged);e._off("switchspreadmode",webViewerSwitchSpreadMode);e._off("spreadmodechanged",webViewerSpreadModeChanged);e._off("documentproperties",webViewerDocumentProperties);e._off("findfromurlhash",webViewerFindFromUrlHash);e._off("updatefindmatchescount",webViewerUpdateFindMatchesCount);e._off("updatefindcontrolstate",webViewerUpdateFindControlState);if(t.reportPageStatsPDFBug){e._off("pagerendered",t.reportPageStatsPDFBug);e._off("pagechanging",t.reportPageStatsPDFBug);t.reportPageStatsPDFBug=null}e._off("fileinputchange",webViewerFileInputChange);e._off("openfile",webViewerOpenFile);t.beforePrint=null;t.afterPrint=null},unbindWindowEvents(){const{_boundEvents:e}=this;window.removeEventListener("visibilitychange",webViewerVisibilityChange);window.removeEventListener("wheel",webViewerWheel,{passive:!1});const t=document.getElementById("mainContainer");if(t){t.removeEventListener("touchstart",webViewerTouchStart,{passive:!1});t.removeEventListener("touchmove",webViewerTouchMove,{passive:!1});t.removeEventListener("touchend",webViewerTouchEnd,{passive:!1})}window.removeEventListener("click",webViewerClick);window.removeEventListener("keydown",webViewerKeyDown);window.removeEventListener("keyup",webViewerKeyUp);window.removeEventListener("resize",e.windowResize);window.removeEventListener("hashchange",e.windowHashChange);window.removeEventListener("beforeprint",e.windowBeforePrint);window.removeEventListener("afterprint",e.windowAfterPrint);window.removeEventListener("updatefromsandbox",e.windowUpdateFromSandbox);e.removeWindowResolutionChange?.();e.windowResize=null;e.windowHashChange=null;e.windowBeforePrint=null;e.windowAfterPrint=null;e.windowUpdateFromSandbox=null},_accumulateTicks(e,t){(this[t]>0&&e<0||this[t]<0&&e>0)&&(this[t]=0);this[t]+=e;const i=Math.trunc(this[t]);this[t]-=i;return i},_accumulateFactor(e,t,i){if(1===t)return 1;(this[i]>1&&t<1||this[i]<1&&t>1)&&(this[i]=1);const n=Math.floor(e*t*this[i]*100)/(100*e);this[i]=t/n;return n},_centerAtPos(e,t,i){const{pdfViewer:n}=this,s=n.currentScale/e-1;if(0!==s){const[e,r]=n.containerTopLeft;n.container.scrollLeft+=(t-r)*s;n.container.scrollTop+=(i-e)*s}},_unblockDocumentLoadEvent(){document.blockUnblockOnload?.(!1);this._unblockDocumentLoadEvent=()=>{}},get scriptingReady(){return this.pdfScriptingManager.ready}};{const R=["null","http://mozilla.github.io","https://mozilla.github.io"];var validateFileURL=function(e){if(e)try{const t=new URL(window.location.href).origin||"null";if(R.includes(t))return;if(new URL(e,window.location.href).origin!==t)throw new Error("file origin does not match viewer's")}catch(e){k.onError&&k.onError(e);k.l10n.get("pdfjs-loading-error").then((t=>{k._documentError(t,{message:e?.message})}));throw e}}}async function loadFakeWorker(){r.GlobalWorkerOptions.workerSrc||=o.AppOptions.get("workerSrc");"Function"===r.GlobalWorkerOptions.workerSrc.constructor.name&&(r.GlobalWorkerOptions.workerSrc=r.GlobalWorkerOptions.workerSrc())}async function loadPDFBug(e){}function reportPageStatsPDFBug({pageNumber:e}){if(!globalThis.Stats?.enabled)return;const t=k.pdfViewer.getPageView(e-1);globalThis.Stats.add(e,t?.pdfPage?.stats)}function webViewerPageRender({pageNumber:e}){e===k.page&&k.toolbar?.updateLoadingIndicatorState(!0)}function webViewerPageRendered({pageNumber:e,error:t}){e===k.page&&k.toolbar?.updateLoadingIndicatorState(!1);if(k.pdfSidebar?.visibleView===s.SidebarView.THUMBS){const t=k.pdfViewer.getPageView(e-1),i=k.pdfThumbnailViewer?.getThumbnail(e-1);t&&i?.setImage(t)}t&&k.l10n.get("pdfjs-rendering-error").then((e=>{k._otherError(e,t)}))}function webViewerPageMode({mode:e}){let t;switch(e){case"thumbs":t=s.SidebarView.THUMBS;break;case"bookmarks":case"outline":t=s.SidebarView.OUTLINE;break;case"attachments":t=s.SidebarView.ATTACHMENTS;break;case"layers":t=s.SidebarView.LAYERS;break;case"none":t=s.SidebarView.NONE;break;default:globalThis.ngxConsole.error('Invalid "pagemode" hash parameter: '+e);return}k.pdfSidebar?.switchView(t,!0)}function webViewerNamedAction(e){switch(e.action){case"GoToPage":k.appConfig.toolbar?.pageNumber.select();break;case"Find":k.supportsIntegratedFind||k?.findBar.toggle();break;case"Print":k.triggerPrinting();break;case"SaveAs":k.downloadOrSave()}}function webViewerPresentationModeChanged(e){k.pdfViewer.presentationModeState=e.state}function webViewerSidebarViewChanged({view:e}){k.pdfRenderingQueue.isThumbnailViewEnabled=e===s.SidebarView.THUMBS;k.isInitialViewSet&&k.store?.set("sidebarView",e).catch((()=>{}))}function webViewerUpdateViewarea({location:e}){if(k.isInitialViewSet){const t={};void 0===e.pageNumber&&null===e.pageNumber||(t.page=e.pageNumber);e.scale&&(t.zoom=e.scale);e.left&&(t.scrollLeft=e.left);e.top&&(t.scrollTop=e.top);void 0===e.rotation&&null===e.rotation||(t.rotation=e.rotation);k.store?.setMultiple(t).catch((()=>{}))}if(k.appConfig.secondaryToolbar){const t=k.pdfLinkService.getAnchorUrl(e.pdfOpenParams);k.appConfig.secondaryToolbar.viewBookmarkButton.href=t}}function webViewerScrollModeChanged(e){k.isInitialViewSet&&!k.pdfViewer.isInPresentationMode&&k.store?.set("scrollMode",e.mode).catch((()=>{}))}function webViewerSpreadModeChanged(e){k.isInitialViewSet&&!k.pdfViewer.isInPresentationMode&&k.store?.set("spreadMode",e.mode).catch((()=>{}))}function webViewerResize(){const{pdfDocument:e,pdfViewer:t,pdfRenderingQueue:i}=k;if(i.printing&&window.matchMedia("print").matches)return;if(!e)return;const n=t.currentScaleValue;"auto"!==n&&"page-fit"!==n&&"page-width"!==n||(t.currentScaleValue=n);t.update()}function webViewerHashchange(e){const t=e.hash;t&&(k.isInitialViewSet?k.pdfHistory?.popStateInProgress||k.pdfLinkService.setHash(t):k.initialBookmark=t)}var webViewerFileInputChange=function(e){if(k.pdfViewer?.isInPresentationMode)return;const t=e.fileInput.files[0];k.open({url:URL.createObjectURL(t),originalUrl:t.name});globalThis.setNgxExtendedPdfViewerSource&&globalThis.setNgxExtendedPdfViewerSource(t.name??URL.createObjectURL(t))},webViewerOpenFile=function(e){k.appConfig.openFileInput.click()};function webViewerPresentationMode(){k.requestPresentationMode()}function webViewerSwitchAnnotationEditorMode(e){k.pdfViewer.annotationEditorMode=e}function webViewerSwitchAnnotationEditorParams(e){k.pdfViewer.annotationEditorParams=e}function webViewerPrint(){k.triggerPrinting()}function webViewerDownload(){k.downloadOrSave()}function webViewerOpenInExternalApp(){k.openInExternalApp()}function webViewerFirstPage(){k.page=1}function webViewerLastPage(){k.page=k.pagesCount}function webViewerNextPage(){k.pdfViewer.nextPage()}function webViewerPreviousPage(){k.pdfViewer.previousPage()}function webViewerZoomIn(){k.zoomIn()}function webViewerZoomOut(){k.zoomOut()}function webViewerZoomReset(){k.zoomReset()}function webViewerPageNumberChanged(e){const t=k.pdfViewer;""!==e.value&&k.pdfLinkService.goToPage(e.value);e.value!==t.currentPageNumber.toString()&&e.value!==t.currentPageLabel&&k.toolbar?.setPageNumber(t.currentPageNumber,t.currentPageLabel)}function webViewerScaleChanged(e){k.pdfViewer.currentScaleValue=e.value}function webViewerRotateCw(){k.rotatePages(90)}function webViewerRotateCcw(){k.rotatePages(-90)}function webViewerOptionalContentConfig(e){k.pdfViewer.optionalContentConfigPromise=e.promise}function webViewerSwitchScrollMode(e){k.pdfViewer.scrollMode=e.mode}function webViewerSwitchSpreadMode(e){k.pdfViewer.spreadMode=e.mode}function webViewerDocumentProperties(){k.pdfDocumentProperties?.open()}function webViewerFindFromUrlHash(e){k.eventBus.dispatch("find",{source:e.source,type:"",query:e.query,caseSensitive:!1,entireWord:!1,highlightAll:!0,findPrevious:!1,matchDiacritics:!0})}function webViewerUpdateFindMatchesCount({matchesCount:e}){k.supportsIntegratedFind?k.externalServices.updateFindMatchesCount(e):k.findBar.updateResultsCount(e)}function webViewerUpdateFindControlState({state:e,previous:t,matchesCount:i,rawQuery:n}){k.supportsIntegratedFind?k.externalServices.updateFindControlState({result:e,findPrevious:t,matchesCount:i,rawQuery:n}):k.findBar?.updateUIState(e,t,i)}function webViewerScaleChanging(e){k.toolbar?.setPageScale(e.presetValue,e.scale);k.pdfViewer.update()}function webViewerRotationChanging(e){k.pdfThumbnailViewer&&(k.pdfThumbnailViewer.pagesRotation=e.pagesRotation);k.forceRendering();k.pdfViewer.currentPageNumber=e.pageNumber}function webViewerPageChanging({pageNumber:e,pageLabel:t}){k.toolbar?.setPageNumber(e,t);k.secondaryToolbar?.setPageNumber(e);k.pdfSidebar?.visibleView===s.SidebarView.THUMBS&&k.pdfThumbnailViewer?.scrollThumbnailIntoView(e);const i=k.pdfViewer.getPageView(e-1);k.toolbar?.updateLoadingIndicatorState(i?.renderingState===s.RenderingStates.RUNNING);const n=document.getElementById("pageNumber");if(n){const e=new CustomEvent("page-change");n.dispatchEvent(e)}}function webViewerResolutionChange(e){k.pdfViewer.refresh()}function webViewerVisibilityChange(e){"visible"===document.visibilityState&&setZoomDisabledTimeout()}let V=null;function setZoomDisabledTimeout(){V&&clearTimeout(V);V=setTimeout((function(){V=null}),N)}function webViewerWheel(e){const t=document.getElementById("viewerContainer");if(t.parentNode.querySelector(":hover")!==t)return;const{pdfViewer:i,supportsMouseWheelZoomCtrlKey:n,supportsMouseWheelZoomMetaKey:r,supportsPinchToZoom:a}=k;if(i.isInPresentationMode)return;const o=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(window.isKeyIgnored&&window.isKeyIgnored(o,"WHEEL"))return;const l=e.deltaMode;let h=Math.exp(-e.deltaY/100);const d=e.ctrlKey&&!k._isCtrlKeyDown&&l===WheelEvent.DOM_DELTA_PIXEL&&0===e.deltaX&&(Math.abs(h-1)<.05||!1)&&0===e.deltaZ;if(d||e.ctrlKey&&n||e.metaKey&&r){e.preventDefault();if(V||"hidden"===document.visibilityState||k.overlayManager.active)return;const t=i.currentScale;if(d&&a){h=k._accumulateFactor(t,h,"_wheelUnusedFactor");if(h<1)k.zoomOut(null,h);else{if(!(h>1))return;k.zoomIn(null,h)}}else{const t=(0,s.normalizeWheelEventDirection)(e);let i=0;if(l===WheelEvent.DOM_DELTA_LINE||l===WheelEvent.DOM_DELTA_PAGE)i=Math.abs(t)>=1?Math.sign(t):k._accumulateTicks(t,"_wheelUnusedTicks");else{const e=30;i=k._accumulateTicks(t/e,"_wheelUnusedTicks")}if(i<0)k.zoomOut(-i);else{if(!(i>0))return;k.zoomIn(i)}}k._centerAtPos(t,e.clientX,e.clientY)}else setZoomDisabledTimeout()}function webViewerTouchStart(e){if(k.pdfViewer.isInPresentationMode||e.touches.length<2)return;e.preventDefault();if(2!==e.touches.length||k.overlayManager.active){k._touchInfo=null;return}let[t,i]=e.touches;t.identifier>i.identifier&&([t,i]=[i,t]);k._touchInfo={touch0X:t.pageX,touch0Y:t.pageY,touch1X:i.pageX,touch1Y:i.pageY}}function webViewerTouchMove(e){if(!k._touchInfo||2!==e.touches.length)return;const{pdfViewer:t,_touchInfo:i,supportsPinchToZoom:n}=k;let[s,r]=e.touches;s.identifier>r.identifier&&([s,r]=[r,s]);const{pageX:a,pageY:o}=s,{pageX:l,pageY:h}=r,{touch0X:d,touch0Y:c,touch1X:u,touch1Y:p}=i;if(Math.abs(d-a)<=1&&Math.abs(c-o)<=1&&Math.abs(u-l)<=1&&Math.abs(p-h)<=1)return;i.touch0X=a;i.touch0Y=o;i.touch1X=l;i.touch1Y=h;if(d===a&&c===o){const e=u-a,t=p-o,i=l-a,n=h-o,s=e*n-t*i;if(Math.abs(s)>.02*Math.hypot(e,t)*Math.hypot(i,n))return}else if(u===l&&p===h){const e=d-l,t=c-h,i=a-l,n=o-h,s=e*n-t*i;if(Math.abs(s)>.02*Math.hypot(e,t)*Math.hypot(i,n))return}else{if((a-d)*(l-u)+(o-c)*(h-p)>=0)return}e.preventDefault();const g=Math.hypot(a-l,o-h)||1,f=Math.hypot(d-u,c-p)||1,m=t.currentScale;if(n){const e=k._accumulateFactor(m,g/f,"_touchUnusedFactor");if(e<1)k.zoomOut(null,e);else{if(!(e>1))return;k.zoomIn(null,e)}}else{const e=30,t=k._accumulateTicks((g-f)/e,"_touchUnusedTicks");if(t<0)k.zoomOut(-t);else{if(!(t>0))return;k.zoomIn(t)}}k._centerAtPos(m,(a+l)/2,(o+h)/2)}function webViewerTouchEnd(e){if(k._touchInfo){e.preventDefault();k._touchInfo=null;k._touchUnusedTicks=0;k._touchUnusedFactor=1}}function webViewerClick(e){if(!k.secondaryToolbar?.isOpen)return;const t=k.appConfig;if(k.pdfViewer.containsElement(e.target)||t.toolbar?.container.contains(e.target)&&e.target!==t.secondaryToolbar?.toggleButton){if(e.target&&e.target.parentElement===t.secondaryToolbar.toggleButton)return;if(e.target&&e.target.parentElement&&e.target.parentElement.parentElement===t.secondaryToolbar.toggleButton)return;k.secondaryToolbar.close()}}function webViewerKeyUp(e){"Control"===e.key&&(k._isCtrlKeyDown=!1)}function webViewerKeyDown(e){k._isCtrlKeyDown="Control"===e.key;if(k.overlayManager.active)return;const{eventBus:t,pdfViewer:i}=k,n=i.isInPresentationMode;let r=!1,a=!1;const o=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(window.isKeyIgnored&&window.isKeyIgnored(o,e.keyCode))return;if(1===o||8===o||5===o||12===o)switch(e.keyCode){case 70:if(!k.supportsIntegratedFind&&!e.shiftKey){k.findBar?.open();r=!0}break;case 71:if(!k.supportsIntegratedFind){const{state:e}=k.findController;if(e){const i={source:window,type:"again",findPrevious:5===o||12===o};t.dispatch("find",{...e,...i})}r=!0}break;case 61:case 107:case 187:case 171:k.zoomIn();r=!0;break;case 173:case 109:case 189:k.zoomOut();r=!0;break;case 48:case 96:if(!n){setTimeout((function(){k.zoomReset()}));r=!1}break;case 38:if(n||k.page>1){k.page=1;r=!0;a=!0}break;case 40:if(n||k.page<k.pagesCount){k.page=k.pagesCount;r=!0;a=!0}}if(1===o||8===o)switch(e.keyCode){case 83:t.dispatch("download",{source:window});r=!0;break;case 79:t.dispatch("openfile",{source:window});r=!0}if(3===o||10===o)switch(e.keyCode){case 80:k.requestPresentationMode();r=!0;k.externalServices.reportTelemetry({type:"buttons",data:{id:"presentationModeKeyboard"}});break;case 71:if(k.appConfig.toolbar){k.appConfig.toolbar.pageNumber.select();r=!0}}if(r){a&&!n&&i.focus();e.preventDefault();return}const l=(0,s.getActiveOrFocusedElement)(),h=l?.tagName.toUpperCase();if("INPUT"!==h&&"TEXTAREA"!==h&&"SELECT"!==h&&("BUTTON"!==h||13!==e.keyCode&&32!==e.keyCode)&&!l?.isContentEditable||27===e.keyCode){if(0===o){let t=0,o=!1;switch(e.keyCode){case 38:case 33:i.isVerticalScrollbarEnabled&&(o=!0);t=-1;break;case 8:n||(o=!0);t=-1;break;case 37:i.isHorizontalScrollbarEnabled&&(o=!0);case 75:case 80:t=-1;break;case 27:if(k.secondaryToolbar?.isOpen){k.secondaryToolbar.close();r=!0}if(!k.supportsIntegratedFind&&k.findBar?.opened){k.findBar.close();r=!0}break;case 40:case 34:i.isVerticalScrollbarEnabled&&(o=!0);t=1;break;case 13:case 32:n||(o=!0);t=1;break;case 39:i.isHorizontalScrollbarEnabled&&(o=!0);case 74:case 78:t=1;break;case 36:if(n||k.page>1){k.page=1;r=!0;a=!0}break;case 35:if(n||k.page<k.pagesCount){k.page=k.pagesCount;r=!0;a=!0}break;case 83:k.pdfCursorTools?.switchTool(s.CursorTool.SELECT);break;case 72:k.pdfCursorTools?.switchTool(s.CursorTool.HAND);break;case 82:k.rotatePages(90);break;case 115:k.pdfSidebar?.toggle()}if(0!==t&&(!o||"page-fit"===i.currentScaleValue)){t>0?i.nextPage():i.previousPage();r=!0}}if(4===o)switch(e.keyCode){case 13:case 32:if(!n&&"page-fit"!==i.currentScaleValue)break;i.previousPage();r=!0;break;case 82:k.rotatePages(-90)}a&&!i.containsElement(l)&&i.focus();r&&e.preventDefault()}}function beforeUnload(e){e.preventDefault();e.returnValue="";return!1}const F={instance:{supportsPrinting:!1,createPrintService(){throw new Error("Not implemented: createPrintService")}}};n()}catch(O){n(O)}}))},8961:(e,t,i)=>{i.d(t,{AppOptions:()=>AppOptions,OptionKind:()=>s,compatibilityParams:()=>n});const n=Object.create(null);{const e=navigator.userAgent||"",t=navigator.platform||"",i=navigator.maxTouchPoints||1,s=/Android/.test(e),r=/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&i>1;!function checkCanvasSizeLimitation(){(r||s)&&(n.maxCanvasPixels=5242880)}()}const s={BROWSER:1,VIEWER:2,API:4,WORKER:8,PREFERENCE:128},r={canvasMaxAreaInBytes:{value:-1,kind:s.BROWSER+s.API},isInAutomation:{value:!1,kind:s.BROWSER},supportsDocumentFonts:{value:!0,kind:s.BROWSER},supportsIntegratedFind:{value:!1,kind:s.BROWSER},supportsMouseWheelZoomCtrlKey:{value:!0,kind:s.BROWSER},supportsMouseWheelZoomMetaKey:{value:!0,kind:s.BROWSER},supportsPinchToZoom:{value:!0,kind:s.BROWSER},annotationEditorMode:{value:0,kind:s.VIEWER+s.PREFERENCE},annotationMode:{value:2,kind:s.VIEWER+s.PREFERENCE},cursorToolOnLoad:{value:0,kind:s.VIEWER+s.PREFERENCE},defaultZoomDelay:{value:400,kind:s.VIEWER+s.PREFERENCE},defaultZoomValue:{value:"",kind:s.VIEWER+s.PREFERENCE},disableHistory:{value:!1,kind:s.VIEWER},disablePageLabels:{value:!1,kind:s.VIEWER+s.PREFERENCE},enableHighlightEditor:{value:!1,kind:s.VIEWER+s.PREFERENCE},enablePermissions:{value:!1,kind:s.VIEWER+s.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:s.VIEWER+s.PREFERENCE},enableScripting:{value:!0,kind:s.VIEWER+s.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:s.VIEWER},externalLinkTarget:{value:0,kind:s.VIEWER+s.PREFERENCE},highlightEditorColors:{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",kind:s.VIEWER+s.PREFERENCE},historyUpdateUrl:{value:!1,kind:s.VIEWER+s.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:s.VIEWER+s.PREFERENCE},imageResourcesPath:{value:"./images/",kind:s.VIEWER},maxCanvasPixels:{value:16777216,kind:s.VIEWER},forcePageColors:{value:!1,kind:s.VIEWER+s.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:s.VIEWER+s.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:s.VIEWER+s.PREFERENCE},pdfBugEnabled:{value:!1,kind:s.VIEWER+s.PREFERENCE},printResolution:{value:150,kind:s.VIEWER},removePageBorders:{value:!1,kind:s.VIEWER+s.PREFERENCE},sidebarViewOnLoad:{value:-1,kind:s.VIEWER+s.PREFERENCE},scrollModeOnLoad:{value:-1,kind:s.VIEWER+s.PREFERENCE},spreadModeOnLoad:{value:-1,kind:s.VIEWER+s.PREFERENCE},textLayerMode:{value:1,kind:s.VIEWER+s.PREFERENCE},viewOnLoad:{value:0,kind:s.VIEWER+s.PREFERENCE},cMapPacked:{value:!0,kind:s.API},cMapUrl:{value:"../web/cmaps/",kind:s.API},disableAutoFetch:{value:!1,kind:s.API+s.PREFERENCE},disableFontFace:{value:!1,kind:s.API+s.PREFERENCE},disableRange:{value:!1,kind:s.API+s.PREFERENCE},disableStream:{value:!1,kind:s.API+s.PREFERENCE},docBaseUrl:{value:"",kind:s.API},enableXfa:{value:!0,kind:s.API+s.PREFERENCE},fontExtraProperties:{value:!1,kind:s.API},isEvalSupported:{value:!0,kind:s.API},isOffscreenCanvasSupported:{value:!0,kind:s.API},maxImageSize:{value:-1,kind:s.API},pdfBug:{value:!1,kind:s.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:s.API},verbosity:{value:1,kind:s.API},workerPort:{value:null,kind:s.WORKER},workerSrc:{value:"./assets/pdf.worker.mjs",kind:s.WORKER}};r.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:s.VIEWER};r.sandboxBundleSrc={value:"../build/pdf.sandbox.mjs",kind:s.VIEWER};r.viewerCssTheme={value:0,kind:s.VIEWER+s.PREFERENCE};r.disablePreferences={value:!1,kind:s.VIEWER};r.locale={value:navigator.language||"en-US",kind:s.VIEWER};const a=Object.create(null);if(globalThis.pdfDefaultOptions)for(const e in globalThis.pdfDefaultOptions)a[e]=globalThis.pdfDefaultOptions[e];class AppOptions{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=a[e];if(void 0!==t)return t;const i=r[e];return void 0!==i?n[e]??i.value:void 0}static getAll(e=null){const t=Object.create(null);for(const i in r){const s=r[i];if(e&&!(e&s.kind))continue;const o=a[i];t[i]=void 0!==o?o:n[i]??s.value}return t}static set(e,t){a[e]=t}static setAll(e,t=!1){if(t){if(this.get("disablePreferences"))return;Object.keys(a).length&&console.warn('setAll: The Preferences may override manually set AppOptions; please use the "disablePreferences"-option in order to prevent that.')}for(const t in e)a[t]=e[t]}static remove(e){delete a[e]}}},9415:(e,t,i)=>{i.d(t,{BaseTreeViewer:()=>BaseTreeViewer});var n=i(4927);const s="selected";class BaseTreeViewer{constructor(e){if(this.constructor===BaseTreeViewer)throw new Error("Cannot initialize BaseTreeViewer.");this.container=e.container;this.eventBus=e.eventBus;this._l10n=e.l10n;this.reset()}reset(){this._pdfDocument=null;this._lastToggleIsShow=!0;this._currentTreeItem=null;this.container.textContent="";this.container.classList.remove("treeWithDeepNesting")}_dispatchEvent(e){throw new Error("Not implemented: _dispatchEvent")}_bindLink(e,t){throw new Error("Not implemented: _bindLink")}_normalizeTextContent(e){return(0,n.removeNullCharacters)(e,!0)||"–"}_addToggleButton(e,t=!1){const i=document.createElement("div");i.className="treeItemToggler";t&&i.classList.add("treeItemsHidden");i.onclick=t=>{t.stopPropagation();i.classList.toggle("treeItemsHidden");if(t.shiftKey){const t=!i.classList.contains("treeItemsHidden");this._toggleTreeItem(e,t)}};e.prepend(i)}_toggleTreeItem(e,t=!1){this._l10n.pause();this._lastToggleIsShow=t;for(const i of e.querySelectorAll(".treeItemToggler"))i.classList.toggle("treeItemsHidden",!t);this._l10n.resume()}_toggleAllTreeItems(){this._toggleTreeItem(this.container,!this._lastToggleIsShow)}_finishRendering(e,t,i=!1){if(i){this.container.classList.add("treeWithDeepNesting");this._lastToggleIsShow=!e.querySelector(".treeItemsHidden")}this._l10n.pause();this.container.append(e);this._l10n.resume();this._dispatchEvent(t)}render(e){throw new Error("Not implemented: render")}_updateCurrentTreeItem(e=null){if(this._currentTreeItem){this._currentTreeItem.classList.remove(s);this._currentTreeItem=null}if(e){e.classList.add(s);this._currentTreeItem=e}}_scrollToCurrentTreeItem(e){if(!e)return;this._l10n.pause();let t=e.parentNode;for(;t&&t!==this.container;){if(t.classList.contains("treeItem")){const e=t.firstElementChild;e?.classList.remove("treeItemsHidden")}t=t.parentNode}this._l10n.resume();this._updateCurrentTreeItem(e);this.container.scrollTo(e.offsetLeft,e.offsetTop+-100)}}},4397:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{DownloadManager:()=>DownloadManager});var s=i(1869),r=e([s]);s=(r.then?(await r)():r)[0];function download(e,t){const i=document.createElement("a");if(!i.click)throw new Error('DownloadManager: "a.click()" is not supported.');i.href=e;i.target="_parent";"download"in i&&(i.download=t);(document.body||document.documentElement).append(i);i.click();i.remove()}class DownloadManager{#N=new WeakMap;downloadUrl(e,t,i){(0,s.createValidAbsoluteUrl)(e,"http://example.com")?download(e+"#pdfjs.action=download",t):globalThis.ngxConsole.error(`downloadUrl - not a valid URL: ${e}`)}downloadData(e,t,i){download(URL.createObjectURL(new Blob([e],{type:i})),t)}openOrDownloadData(e,t,i=null){const n=(0,s.isPdfFile)(t),r=n?"application/pdf":"";if(n){let t=this.#N.get(e);if(!t){t=URL.createObjectURL(new Blob([e],{type:r}));this.#N.set(e,t)}try{window.open(t);return!0}catch(i){globalThis.ngxConsole.error(`openOrDownloadData: ${i}`);URL.revokeObjectURL(t);this.#N.delete(e)}}this.downloadData(e,t,r);return!1}download(e,t,i,n){download(URL.createObjectURL(e),i)}}n()}catch(a){n(a)}}))},758:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{DrawLayerBuilder:()=>DrawLayerBuilder});var s=i(1869),r=e([s]);s=(r.then?(await r)():r)[0];class DrawLayerBuilder{#L=null;constructor(e){this.pageIndex=e.pageIndex}async render(e="display"){"display"!==e||this.#L||this._cancelled||(this.#L=new s.DrawLayer({pageIndex:this.pageIndex}))}cancel(){this._cancelled=!0;if(this.#L){this.#L.destroy();this.#L=null}}setParent(e){this.#L?.setParent(e)}getDrawLayer(){return this.#L}}n()}catch(e){n(e)}}))},6554:(e,t,i)=>{i.d(t,{AutomationEventBus:()=>AutomationEventBus,EventBus:()=>EventBus,waitOnEventOrTimeout:()=>waitOnEventOrTimeout});const n={EVENT:"event",TIMEOUT:"timeout"};function waitOnEventOrTimeout({target:e,name:t,delay:i=0}){return new Promise((function(s,r){if("object"!=typeof e||!t||"string"!=typeof t||!(Number.isInteger(i)&&i>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function handler(i){e instanceof EventBus?e._off(t,a):e.removeEventListener(t,a);l&&clearTimeout(l);s(i)}const a=handler.bind(null,n.EVENT);e instanceof EventBus?e._on(t,a):e.addEventListener(t,a);const o=handler.bind(null,n.TIMEOUT),l=setTimeout(o,i)}))}class EventBus{#B=Object.create(null);on(e,t,i=null){this._on(e,t,{external:!0,once:i?.once})}off(e,t,i=null){this._off(e,t,{external:!0,once:i?.once})}dispatch(e,t){const i=this.#B[e];if(!i||0===i.length)return;let n;for(const{listener:s,external:r,once:a}of i.slice(0)){a&&this._off(e,s);r?(n||=[]).push(s):s(t)}if(n){for(const e of n)e(t);n=null}}_on(e,t,i=null){(this.#B[e]||=[]).push({listener:t,external:!0===i?.external,once:!0===i?.once})}_off(e,t,i=null){const n=this.#B[e];if(n)for(let e=0,i=n.length;e<i;e++)if(n[e].listener===t){n.splice(e,1);return}}}class AutomationEventBus extends EventBus{dispatch(e,t){throw new Error("Not implemented: AutomationEventBus.dispatch")}}},9170:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{GenericScripting:()=>GenericScripting});var s=i(1869),r=e([s]);s=(r.then?(await r)():r)[0];class GenericScripting{constructor(e){"Function"===e?.constructor?.name&&(e=e());this._ready=new Promise(((t,i)=>{import(e).then((e=>{t(e.QuickJSSandbox())})).catch(i)}))}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout((()=>t.dispatchEvent(e)),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}n()}catch(e){n(e)}}))},1546:(e,t,i)=>{i.a(e,(async(e,t)=>{try{var n=i(39),s=i(8961),r=i(216),a=i(4397),o=i(450),l=i(9170),h=e([n,a,o,l]);[n,a,o,l]=h.then?(await h)():h;class GenericPreferences extends r.BasePreferences{async _writeToStorage(e){try{localStorage.setItem("pdfjs.preferences",JSON.stringify(e))}catch(e){}}async _readFromStorage(e){try{return{prefs:JSON.parse(localStorage.getItem("pdfjs.preferences"))}}catch(e){return{}}}}class GenericExternalServices extends n.DefaultExternalServices{static createDownloadManager(){return new a.DownloadManager}static createPreferences(){return new GenericPreferences}static async createL10n(){return new o.GenericL10n(s.AppOptions.get("locale"))}static createScripting(){return new l.GenericScripting(s.AppOptions.get("sandboxBundleSrc"))}}n.PDFViewerApplication.externalServices=GenericExternalServices;t()}catch(e){t(e)}}))},450:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{GenericL10n:()=>GenericL10n});var s=i(8759),r=i(8275),a=i(1869),o=i(4065),l=e([a]);a=(l.then?(await l)():l)[0];class GenericL10n extends o.L10n{constructor(e){super({lang:e});this._setL10n(new r.DOMLocalization([],GenericL10n.#k.bind(GenericL10n,"en-us",this.getLanguage())))}static async*#k(e,t){const{baseURL:i,paths:n}=await this.#V(),s=[t];if(e!==t){const i=t.split("-",1)[0];i!==t&&s.push(i);s.push(e)}for(const e of s){const t=await this.#F(e,i,n);t&&(yield t)}}static async#F(e,t,i){const n=i[e];if(!n)return null;const r=new URL(n,t),o=await(0,a.fetchData)(r,"text"),l=new s.FluentResource(o),h=new s.FluentBundle(e),d=h.addResource(l);d.length&&console.error("L10n errors",d);return h}static async#V(){const{href:e}=document.querySelector('link[type="application/l10n"]'),t=await(0,a.fetchData)(e,"json");return{baseURL:e.replace(/[^/]*$/,"")||"./",paths:t}}}n()}catch(e){n(e)}}))},6143:(e,t,i)=>{i.d(t,{GrabToPan:()=>GrabToPan});const n="grab-to-pan-grab";class GrabToPan{constructor({element:e}){this.element=e;this.document=e.ownerDocument;this.activate=this.activate.bind(this);this.deactivate=this.deactivate.bind(this);this.toggle=this.toggle.bind(this);this._onMouseDown=this.#R.bind(this);this._onMouseMove=this.#O.bind(this);this._endPan=this.#H.bind(this);(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}activate(){if(!this.active){this.active=!0;this.element.addEventListener("mousedown",this._onMouseDown);this.element.classList.add(n)}}deactivate(){if(this.active){this.active=!1;this.element.removeEventListener("mousedown",this._onMouseDown);this._endPan();this.element.classList.remove(n)}}toggle(){this.active?this.deactivate():this.activate()}ignoreTarget(e){return!!document.querySelector(".stf__item")||e.matches("a[href], a[href] *, input, textarea, button, button *, select, option")}#R(e){if(0!==e.button||this.ignoreTarget(e.target))return;if(e.originalTarget)try{e.originalTarget.tagName}catch{return}this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=e.clientX;this.clientYStart=e.clientY;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-x"))return;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-y"))return;this.document.addEventListener("mousemove",this._onMouseMove,!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);e.preventDefault();e.stopPropagation();const t=document.activeElement;t&&!t.contains(e.target)&&t.blur()}#O(e){this.element.removeEventListener("scroll",this._endPan,!0);if(!(1&e.buttons)){this._endPan();return}const t=e.clientX-this.clientXStart,i=e.clientY-this.clientYStart;this.element.scrollTo({top:this.scrollTopStart-i,left:this.scrollLeftStart-t,behavior:"instant"});this.overlay.parentNode||document.body.append(this.overlay)}#H(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onMouseMove,!0);this.document.removeEventListener("mouseup",this._endPan,!0);this.overlay.remove()}}function isOverPerfectScrollbar(e,t,i){const n=document.getElementsByClassName(i);if(n&&1===n.length){var{top:s,right:r,bottom:a,left:o}=n[0].getBoundingClientRect();if(t>=s&&t<=a&&e<=r&&e>=o)return!0}return!1}},4065:(e,t,i)=>{i.d(t,{L10n:()=>L10n});class L10n{#U;#z;#j;constructor({lang:e,isRTL:t},i=null){this.#z=L10n.#W(e);this.#j=i;this.#U=t??L10n.#$(this.#z)?"rtl":"ltr"}_setL10n(e){this.#j=e}getLanguage(){return this.#z}getDirection(){return this.#U}async get(e,t=null,i){if(Array.isArray(e)){e=e.map((e=>({id:e})));return(await this.#j.formatMessages(e)).map((e=>e.value))}const n=await this.#j.formatMessages([{id:e,args:t}]);return n?.[0].value||i}async translate(e){try{this.#j.connectRoot(e);await this.#j.translateRoots()}catch{}}pause(){this.#j.pauseObserving()}resume(){this.#j.resumeObserving()}static#W(e){return{en:"en-us",es:"es-es",fy:"fy-nl",ga:"ga-ie",gu:"gu-in",hi:"hi-in",hy:"hy-am",nb:"nb-no",ne:"ne-np",nn:"nn-no",pa:"pa-in",pt:"pt-pt",sv:"sv-se",zh:"zh-cn"}[e=e?.toLowerCase()||"en-us"]||e}static#$(e){const t=e.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(t)}}},7910:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{NullL10n:()=>h});var s=i(1869),r=i(8759),a=i(8275),o=i(4065),l=e([s]);s=(l.then?(await l)():l)[0];class ConstL10n extends o.L10n{constructor(e){super({lang:e});this._setL10n(new a.DOMLocalization([],ConstL10n.#k.bind(ConstL10n,e)))}static async*#k(e){const t=new r.FluentResource("pdfjs-previous-button =\n    .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n    .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n    .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n    .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n    .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n    .title = Zoom\npdfjs-presentation-mode-button =\n    .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n    .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n    .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n    .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n    .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n    .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-open-in-app-button =\n    .title = Open in app\npdfjs-open-in-app-button-label = Open in app\npdfjs-tools-button =\n    .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n    .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n    .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n    .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n    .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n    .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n    .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n    .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n    .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n    .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n    .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n    .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n    .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n    .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n    .title = Document Properties…\npdfjs-document-properties-button-label = Document Properties…\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-kb = { $size_kb } KB ({ $size_b } bytes)\npdfjs-document-properties-mb = { $size_mb } MB ({ $size_b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-string = { $date }, { $time }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } × { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } × { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printing…\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-toggle-sidebar-button =\n    .title = Toggle Sidebar\npdfjs-toggle-sidebar-notification-button =\n    .title = Toggle Sidebar (document contains outline/attachments/layers)\npdfjs-toggle-sidebar-button-label = Toggle Sidebar\npdfjs-document-outline-button =\n    .title = Show Document Outline (double-click to expand/collapse all items)\npdfjs-document-outline-button-label = Document Outline\npdfjs-attachments-button =\n    .title = Show Attachments\npdfjs-attachments-button-label = Attachments\npdfjs-layers-button =\n    .title = Show Layers (double-click to reset all layers to the default state)\npdfjs-layers-button-label = Layers\npdfjs-thumbs-button =\n    .title = Show Thumbnails\npdfjs-thumbs-button-label = Thumbnails\npdfjs-current-outline-item-button =\n    .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n    .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n    .title = Page { $page }\npdfjs-thumb-page-canvas =\n    .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n    .title = Find\n    .placeholder = Find in document…\npdfjs-find-previous-button =\n    .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n    .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n    { $total ->\n        [one] { $current } of { $total } match\n       *[other] { $current } of { $total } matches\n    }\npdfjs-find-match-count-limit =\n    { $limit ->\n        [one] More than { $limit } match\n       *[other] More than { $limit } matches\n    }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n    .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-string = { $date }, { $time }\npdfjs-text-annotation-type =\n    .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n    .title = Text\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n    .title = Draw\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n    .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n    .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-editor-remove-ink-button =\n    .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n    .title = Remove text\npdfjs-editor-remove-stamp-button =\n    .title = Remove image\npdfjs-editor-remove-highlight-button =\n    .title = Remove highlight\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n    .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-free-text =\n    .aria-label = Text Editor\npdfjs-free-text-default-content = Start typing…\npdfjs-ink =\n    .aria-label = Draw Editor\npdfjs-ink-canvas =\n    .aria-label = User-created image\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can’t see the image or when it doesn’t load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n    .placeholder = For example, “A young man sits down at a table to eat a meal”\npdfjs-editor-resizer-label-top-left = Top left corner — resize\npdfjs-editor-resizer-label-top-middle = Top middle — resize\npdfjs-editor-resizer-label-top-right = Top right corner — resize\npdfjs-editor-resizer-label-middle-right = Middle right — resize\npdfjs-editor-resizer-label-bottom-right = Bottom right corner — resize\npdfjs-editor-resizer-label-bottom-middle = Bottom middle — resize\npdfjs-editor-resizer-label-bottom-left = Bottom left corner — resize\npdfjs-editor-resizer-label-middle-left = Middle left — resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n    .title = Change color\npdfjs-editor-colorpicker-dropdown =\n    .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n    .title = Yellow\npdfjs-editor-colorpicker-green =\n    .title = Green\npdfjs-editor-colorpicker-blue =\n    .title = Blue\npdfjs-editor-colorpicker-pink =\n    .title = Pink\npdfjs-editor-colorpicker-red =\n    .title = Red"),i=new r.FluentBundle(e),n=i.addResource(t);n.length&&console.error("L10n errors",n);yield i}static get instance(){return(0,s.shadow)(this,"instance",new ConstL10n("en-us"))}}const h={getLanguage:()=>ConstL10n.instance.getLanguage(),getDirection:()=>ConstL10n.instance.getDirection(),get:async(e,t=null,i)=>ConstL10n.instance.get(e,t,i),translate:async e=>ConstL10n.instance.translate(e),pause:()=>ConstL10n.instance.pause(),resume:()=>ConstL10n.instance.resume()};n()}catch(e){n(e)}}))},5318:(e,t,i)=>{i.d(t,{ngxExtendedPdfViewerVersion:()=>n});const n="19.0.5"},1996:(e,t,i)=>{i.d(t,{OverlayManager:()=>OverlayManager});class OverlayManager{#G=new WeakMap;#K=null;get active(){return this.#K}async register(e,t=!1){if("object"!=typeof e)throw new Error("Not enough parameters.");if(this.#G.has(e))throw new Error("The overlay is already registered.");this.#G.set(e,{canForceClose:t});e.addEventListener("cancel",(e=>{this.#K=null}))}async open(e){if(!this.#G.has(e))throw new Error("The overlay does not exist.");if(this.#K){if(this.#K===e)throw new Error("The overlay is already active.");if(!this.#G.get(e).canForceClose)throw new Error("Another overlay is currently active.");await this.close()}this.#K=e;e.showModal();e.classList.remove("hidden")}async close(e=this.#K){if(!this.#G.has(e))throw new Error("The overlay does not exist.");if(!this.#K)throw new Error("The overlay is currently not active.");if(this.#K!==e)throw new Error("Another overlay is currently active.");e.close();this.#K=null}}},658:(e,t,i)=>{i.d(t,{PageFlip:()=>PageFlip});class Page{constructor(e,t){this.state={angle:0,area:[],position:{x:0,y:0},hardAngle:0,hardDrawingAngle:0};this.createdDensity=t;this.nowDrawingDensity=this.createdDensity;this.render=e}setDensity(e){this.createdDensity=e;this.nowDrawingDensity=e}setDrawingDensity(e){this.nowDrawingDensity=e}setPosition(e){this.state.position=e}setAngle(e){this.state.angle=e}setArea(e){this.state.area=e}setHardDrawingAngle(e){this.state.hardDrawingAngle=e}setHardAngle(e){this.state.hardAngle=e;this.state.hardDrawingAngle=e}setOrientation(e){this.orientation=e}getDrawingDensity(){return this.nowDrawingDensity}getDensity(){return this.createdDensity}getHardAngle(){return this.state.hardAngle}}class ImagePage extends Page{constructor(e,t,i){super(e,i);this.image=null;this.isLoad=!1;this.loadingAngle=0;this.image=new Image;this.image.src=t}draw(e){const t=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,i=canvas.getContext("2d",t),n=this.render.convertToGlobal(this.state.position),s=this.render.getRect().pageWidth,r=this.render.getRect().height;i.save();i.translate(n.x,n.y);i.beginPath();for(let e of this.state.area)if(null!==e){e=this.render.convertToGlobal(e);i.lineTo(e.x-n.x,e.y-n.y)}i.rotate(this.state.angle);i.clip();this.isLoad?i.drawImage(this.image,0,0,s,r):this.drawLoader(i,{x:0,y:0},s,r);i.restore()}simpleDraw(e){const t=this.render.getRect(),i=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,n=canvas.getContext("2d",i),s=t.pageWidth,r=t.height,a=1===e?t.left+t.pageWidth:t.left,o=t.top;this.isLoad?n.drawImage(this.image,a,o,s,r):this.drawLoader(n,{x:a,y:o},s,r)}drawLoader(e,t,i,n){e.beginPath();e.strokeStyle="rgb(200, 200, 200)";e.fillStyle="rgb(255, 255, 255)";e.lineWidth=1;e.rect(t.x+1,t.y+1,i-1,n-1);e.stroke();e.fill();const s={x:t.x+i/2,y:t.y+n/2};e.beginPath();e.lineWidth=10;e.arc(s.x,s.y,20,this.loadingAngle,3*Math.PI/2+this.loadingAngle);e.stroke();e.closePath();this.loadingAngle+=.07;this.loadingAngle>=2*Math.PI&&(this.loadingAngle=0)}load(){this.isLoad||(this.image.onload=()=>{this.isLoad=!0})}newTemporaryCopy(){return this}getTemporaryCopy(){return this}hideTemporaryCopy(){}}class PageCollection{constructor(e,t){this.pages=[];this.currentPageIndex=0;this.currentSpreadIndex=0;this.landscapeSpread=[];this.portraitSpread=[];this.render=t;this.app=e;this.currentPageIndex=0;this.isShowCover=this.app.getSettings().showCover}destroy(){this.pages=[]}createSpread(){this.landscapeSpread=[];this.portraitSpread=[];for(let e=0;e<this.pages.length;e++)this.portraitSpread.push([e]);let e=0;if(this.isShowCover){this.pages[0].setDensity("hard");this.landscapeSpread.push([e]);e++}for(let t=e;t<this.pages.length;t+=2)if(t<this.pages.length-1)this.landscapeSpread.push([t,t+1]);else{this.landscapeSpread.push([t]);this.pages[t].setDensity("hard")}}getSpread(){return"landscape"===this.render.getOrientation()?this.landscapeSpread:this.portraitSpread}getSpreadIndexByPage(e){const t=this.getSpread();for(let i=0;i<t.length;i++)if(e===t[i][0]||e===t[i][1])return i;return null}getPageCount(){return this.pages.length}getPages(){return this.pages}getPage(e){if(e>=0&&e<this.pages.length)return this.pages[e];throw new Error("Invalid page number")}nextBy(e){const t=this.pages.indexOf(e);return t<this.pages.length-1?this.pages[t+1]:null}prevBy(e){const t=this.pages.indexOf(e);return t>0?this.pages[t-1]:null}getFlippingPage(e){const t=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===e?this.pages[t].newTemporaryCopy():this.pages[t-1];{const i=0===e?this.getSpread()[t+1]:this.getSpread()[t-1];return 1===i.length||0===e?this.pages[i[0]]:this.pages[i[1]]}}getBottomPage(e){const t=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===e?this.pages[t+1]:this.pages[t-1];{const i=0===e?this.getSpread()[t+1]:this.getSpread()[t-1];return 1===i.length?this.pages[i[0]]:0===e?this.pages[i[1]]:this.pages[i[0]]}}showNext(){if(this.currentSpreadIndex<this.getSpread().length){this.currentSpreadIndex++;this.showSpread()}}showPrev(){if(this.currentSpreadIndex>0){this.currentSpreadIndex--;this.showSpread()}}getCurrentPageIndex(){return this.currentPageIndex}show(e=null){null===e&&(e=this.currentPageIndex);if(e<0||e>=this.pages.length)return;const t=this.getSpreadIndexByPage(e);if(null!==t){this.currentSpreadIndex=t;this.showSpread()}}getCurrentSpreadIndex(){return this.currentSpreadIndex}setCurrentSpreadIndex(e){if(!(e>=0&&e<this.getSpread().length))throw new Error("Invalid page");this.currentSpreadIndex=e}showSpread(){const e=this.getSpread()[this.currentSpreadIndex];if(2===e.length){this.render.setLeftPage(this.pages[e[0]]);this.render.setRightPage(this.pages[e[1]])}else if("landscape"===this.render.getOrientation())if(e[0]===this.pages.length-1){this.render.setLeftPage(this.pages[e[0]]);this.render.setRightPage(null)}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[e[0]])}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[e[0]])}this.currentPageIndex=e[0];this.app.updatePageIndex(this.currentPageIndex)}}class ImagePageCollection extends PageCollection{constructor(e,t,i){super(e,t);this.imagesHref=i}load(){for(const e of this.imagesHref){const t=new ImagePage(this.render,e,"soft");t.load();this.pages.push(t)}this.createSpread()}}class Helper{static GetDistanceBetweenTwoPoint(e,t){return null===e||null===t?1/0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}static GetSegmentLength(e){return Helper.GetDistanceBetweenTwoPoint(e[0],e[1])}static GetAngleBetweenTwoLine(e,t){const i=e[0].y-e[1].y,n=t[0].y-t[1].y,s=e[1].x-e[0].x,r=t[1].x-t[0].x;return Math.acos((i*n+s*r)/(Math.sqrt(i*i+s*s)*Math.sqrt(n*n+r*r)))}static PointInRect(e,t){return null===t?null:t.x>=e.left&&t.x<=e.width+e.left&&t.y>=e.top&&t.y<=e.top+e.height?t:null}static GetRotatedPoint(e,t,i){return{x:e.x*Math.cos(i)+e.y*Math.sin(i)+t.x,y:e.y*Math.cos(i)-e.x*Math.sin(i)+t.y}}static LimitPointToCircle(e,t,i){if(Helper.GetDistanceBetweenTwoPoint(e,i)<=t)return i;const n=e.x,s=e.y,r=i.x,a=i.y;let o=Math.sqrt(Math.pow(t,2)*Math.pow(n-r,2)/(Math.pow(n-r,2)+Math.pow(s-a,2)))+n;i.x<0&&(o*=-1);let l=(o-n)*(s-a)/(n-r)+s;n-r+s===0&&(l=t);return{x:o,y:l}}static GetIntersectBetweenTwoSegment(e,t,i){return Helper.PointInRect(e,Helper.GetIntersectBeetwenTwoLine(t,i))}static GetIntersectBeetwenTwoLine(e,t){const i=e[0].y-e[1].y,n=t[0].y-t[1].y,s=e[1].x-e[0].x,r=t[1].x-t[0].x,a=e[0].x*e[1].y-e[1].x*e[0].y,o=t[0].x*t[1].y-t[1].x*t[0].y,l=i*o-n*a,h=s*o-r*a,d=-(a*r-o*s)/(i*r-n*s),c=-(i*o-n*a)/(i*r-n*s);if(isFinite(d)&&isFinite(c))return{x:d,y:c};if(Math.abs(l-h)<.1)throw new Error("Segment included");return null}static GetCordsFromTwoPoint(e,t){const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y),s=Math.max(i,n),r=[e];function getCord(e,t,i,n,s){return t>e?e+s*(i/n):t<e?e-s*(i/n):e}for(let a=1;a<=s;a+=1)r.push({x:getCord(e.x,t.x,i,s,a),y:getCord(e.y,t.y,n,s,a)});return r}}class HTMLPage extends Page{constructor(e,t,i){super(e,i);this.copiedElement=null;this.temporaryCopy=null;this.isLoad=!1;this.element=t;this.element.classList.add("stf__item");this.element.classList.add("--"+i)}newTemporaryCopy(){if("hard"===this.nowDrawingDensity)return this;if(null===this.temporaryCopy){this.copiedElement=this.element.cloneNode(!0);this.element.parentElement.appendChild(this.copiedElement);this.temporaryCopy=new HTMLPage(this.render,this.copiedElement,this.nowDrawingDensity)}return this.getTemporaryCopy()}getTemporaryCopy(){return this.temporaryCopy}hideTemporaryCopy(){if(null!==this.temporaryCopy){this.copiedElement.remove();this.copiedElement=null;this.temporaryCopy=null}}draw(e){const t=e||this.nowDrawingDensity,i=this.render.convertToGlobal(this.state.position),n=this.render.getRect().pageWidth,s=this.render.getRect().height;this.element.classList.remove("--simple");const r=`\n            position: absolute;\n            display: block;\n            z-index: ${this.element.style.zIndex};\n            left: 0;\n            top: 0;\n            width: ${n}px;\n            height: ${s}px;\n        `;"hard"===t?this.drawHard(r):this.drawSoft(i,r)}drawHard(e=""){const t=this.render.getRect().left+this.render.getRect().width/2,i=this.state.hardDrawingAngle,n=e+"\n                backface-visibility: hidden;\n                -webkit-backface-visibility: hidden;\n                clip-path: none;\n                -webkit-clip-path: none;\n            "+(0===this.orientation?`transform-origin: ${this.render.getRect().pageWidth}px 0;\n                   transform: translate3d(0, 0, 0) rotateY(${i}deg);`:`transform-origin: 0 0;\n                   transform: translate3d(${t}px, 0, 0) rotateY(${i}deg);`);this.element.style.cssText=n}drawSoft(e,t=""){let i="polygon( ";for(const e of this.state.area)if(null!==e){let t=1===this.render.getDirection()?{x:-e.x+this.state.position.x,y:e.y-this.state.position.y}:{x:e.x-this.state.position.x,y:e.y-this.state.position.y};t=Helper.GetRotatedPoint(t,{x:0,y:0},this.state.angle);i+=t.x+"px "+t.y+"px, "}i=i.slice(0,-2);i+=")";const n=t+`transform-origin: 0 0; clip-path: ${i}; -webkit-clip-path: ${i};`+(this.render.isSafari()&&0===this.state.angle?`transform: translate(${e.x}px, ${e.y}px);`:`transform: translate3d(${e.x}px, ${e.y}px, 0) rotate(${this.state.angle}rad);`);this.element.style.cssText=n}simpleDraw(e){const t=this.render.getRect(),i=t.pageWidth,n=t.height,s=1===e?t.left+t.pageWidth:t.left,r=t.top;this.element.classList.add("--simple");this.element.style.cssText=`\n            position: absolute;\n            display: block;\n            height: ${n}px;\n            left: ${s}px;\n            top: ${r}px;\n            width: ${i}px;\n            z-index: ${this.render.getSettings().startZIndex+1};`}getElement(){return this.element}load(){this.isLoad=!0}setOrientation(e){super.setOrientation(e);this.element.classList.remove("--left","--right");this.element.classList.add(1===e?"--right":"--left")}setDrawingDensity(e){this.element.classList.remove("--soft","--hard");this.element.classList.add("--"+e);super.setDrawingDensity(e)}}class HTMLPageCollection extends PageCollection{constructor(e,t,i,n){super(e,t);this.element=i;this.pagesElement=n}load(){for(const e of this.pagesElement){const t=new HTMLPage(this.render,e,"hard"===e.dataset.density?"hard":"soft");t.load();this.pages.push(t)}this.createSpread()}}class FlipCalculation{constructor(e,t,i,n){this.direction=e;this.corner=t;this.topIntersectPoint=null;this.sideIntersectPoint=null;this.bottomIntersectPoint=null;this.pageWidth=parseInt(i,10);this.pageHeight=parseInt(n,10)}calc(e){try{this.position=this.calcAngleAndPosition(e);this.calculateIntersectPoint(this.position);return!0}catch(e){return!1}}getFlippingClipArea(){const e=[];let t=!1;e.push(this.rect.topLeft);e.push(this.topIntersectPoint);if(null===this.sideIntersectPoint)t=!0;else{e.push(this.sideIntersectPoint);null===this.bottomIntersectPoint&&(t=!1)}e.push(this.bottomIntersectPoint);(t||"bottom"===this.corner)&&e.push(this.rect.bottomLeft);return e}getBottomClipArea(){const e=[];e.push(this.topIntersectPoint);if("top"===this.corner)e.push({x:this.pageWidth,y:0});else{null!==this.topIntersectPoint&&e.push({x:this.pageWidth,y:0});e.push({x:this.pageWidth,y:this.pageHeight})}null!==this.sideIntersectPoint?Helper.GetDistanceBetweenTwoPoint(this.sideIntersectPoint,this.topIntersectPoint)>=10&&e.push(this.sideIntersectPoint):"top"===this.corner&&e.push({x:this.pageWidth,y:this.pageHeight});e.push(this.bottomIntersectPoint);e.push(this.topIntersectPoint);return e}getAngle(){return 0===this.direction?-this.angle:this.angle}getRect(){return this.rect}getPosition(){return this.position}getActiveCorner(){return 0===this.direction?this.rect.topLeft:this.rect.topRight}getDirection(){return this.direction}getFlippingProgress(){return Math.abs((this.position.x-this.pageWidth)/(2*this.pageWidth)*100)}getCorner(){return this.corner}getBottomPagePosition(){return 1===this.direction?{x:this.pageWidth,y:0}:{x:0,y:0}}getShadowStartPoint(){return"top"===this.corner?this.topIntersectPoint:null!==this.sideIntersectPoint?this.sideIntersectPoint:this.topIntersectPoint}getShadowAngle(){const e=Helper.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(),[{x:0,y:0},{x:this.pageWidth,y:0}]);return 0===this.direction?e:Math.PI-e}calcAngleAndPosition(e){let t=e;this.updateAngleAndGeometry(t);t="top"===this.corner?this.checkPositionAtCenterLine(t,{x:0,y:0},{x:0,y:this.pageHeight}):this.checkPositionAtCenterLine(t,{x:0,y:this.pageHeight},{x:0,y:0});if(Math.abs(t.x-this.pageWidth)<1&&Math.abs(t.y)<1)throw new Error("Point is too small");return t}updateAngleAndGeometry(e){this.angle=this.calculateAngle(e);this.rect=this.getPageRect(e)}calculateAngle(e){const t=this.pageWidth-e.x+1,i="bottom"===this.corner?this.pageHeight-e.y:e.y;let n=2*Math.acos(t/Math.sqrt(i*i+t*t));i<0&&(n=-n);const s=Math.PI-n;if(!isFinite(n)||s>=0&&s<.003)throw new Error("The G point is too small");"bottom"===this.corner&&(n=-n);return n}getPageRect(e){return"top"===this.corner?this.getRectFromBasePoint([{x:0,y:0},{x:this.pageWidth,y:0},{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}],e):this.getRectFromBasePoint([{x:0,y:-this.pageHeight},{x:this.pageWidth,y:-this.pageHeight},{x:0,y:0},{x:this.pageWidth,y:0}],e)}getRectFromBasePoint(e,t){return{topLeft:this.getRotatedPoint(e[0],t),topRight:this.getRotatedPoint(e[1],t),bottomLeft:this.getRotatedPoint(e[2],t),bottomRight:this.getRotatedPoint(e[3],t)}}getRotatedPoint(e,t){return{x:e.x*Math.cos(this.angle)+e.y*Math.sin(this.angle)+t.x,y:e.y*Math.cos(this.angle)-e.x*Math.sin(this.angle)+t.y}}calculateIntersectPoint(e){const t={left:-1,top:-1,width:this.pageWidth+2,height:this.pageHeight+2};if("top"===this.corner){this.topIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.bottomLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}else{this.topIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.topLeft,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.topLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}}checkPositionAtCenterLine(e,t,i){let n=e;const s=Helper.LimitPointToCircle(t,this.pageWidth,n);if(n!==s){n=s;this.updateAngleAndGeometry(n)}const r=Math.sqrt(Math.pow(this.pageWidth,2)+Math.pow(this.pageHeight,2));let a=this.rect.bottomRight,o=this.rect.topLeft;if("bottom"===this.corner){a=this.rect.topRight;o=this.rect.bottomLeft}if(a.x<=0){const e=Helper.LimitPointToCircle(i,r,o);if(e!==n){n=e;this.updateAngleAndGeometry(n)}}return n}getSegmentToShadowLine(){const e=this.getShadowStartPoint();return[e,e!==this.sideIntersectPoint&&null!==this.sideIntersectPoint?this.sideIntersectPoint:this.bottomIntersectPoint]}}class Flip{constructor(e,t){this.flippingPage=null;this.bottomPage=null;this.calc=null;this.state="read";this.render=e;this.app=t}fold(e){this.setState("user_fold");null===this.calc&&this.start(e);this.do(this.render.convertToPage(e))}flip(e){if(this.app.getSettings().disableFlipByClick&&!this.isPointOnCorners(e))return;null!==this.calc&&this.render.finishAnimation();if(!this.start(e))return;const t=this.getBoundsRect();this.setState("flipping");const i=t.height/10,n="bottom"===this.calc.getCorner()?t.height-i:i,s="bottom"===this.calc.getCorner()?t.height:0;this.calc.calc({x:t.pageWidth-i,y:n});this.animateFlippingTo({x:t.pageWidth-i,y:n},{x:-t.pageWidth,y:s},!0)}start(e){this.reset();const t=this.render.convertToBook(e),i=this.getBoundsRect(),n=this.getDirectionByPoint(t),s=t.y>=i.height/2?"bottom":"top";if(!this.checkDirection(n))return!1;try{this.flippingPage=this.app.getPageCollection().getFlippingPage(n);this.bottomPage=this.app.getPageCollection().getBottomPage(n);if("landscape"===this.render.getOrientation())if(1===n){const e=this.app.getPageCollection().nextBy(this.flippingPage);if(null!==e&&this.flippingPage.getDensity()!==e.getDensity()){this.flippingPage.setDrawingDensity("hard");e.setDrawingDensity("hard")}}else{const e=this.app.getPageCollection().prevBy(this.flippingPage);if(null!==e&&this.flippingPage.getDensity()!==e.getDensity()){this.flippingPage.setDrawingDensity("hard");e.setDrawingDensity("hard")}}this.render.setDirection(n);this.calc=new FlipCalculation(n,s,i.pageWidth.toString(10),i.height.toString(10));return!0}catch(e){return!1}}do(e){if(null!==this.calc&&this.calc.calc(e)){const e=this.calc.getFlippingProgress();this.bottomPage.setArea(this.calc.getBottomClipArea());this.bottomPage.setPosition(this.calc.getBottomPagePosition());this.bottomPage.setAngle(0);this.bottomPage.setHardAngle(0);this.flippingPage.setArea(this.calc.getFlippingClipArea());this.flippingPage.setPosition(this.calc.getActiveCorner());this.flippingPage.setAngle(this.calc.getAngle());0===this.calc.getDirection()?this.flippingPage.setHardAngle(90*(200-2*e)/100):this.flippingPage.setHardAngle(-90*(200-2*e)/100);this.render.setPageRect(this.calc.getRect());this.render.setBottomPage(this.bottomPage);this.render.setFlippingPage(this.flippingPage);this.render.setShadowData(this.calc.getShadowStartPoint(),this.calc.getShadowAngle(),e,this.calc.getDirection())}}flipToPage(e,t){const i=this.app.getPageCollection().getCurrentSpreadIndex(),n=this.app.getPageCollection().getSpreadIndexByPage(e);try{if(n>i){this.app.getPageCollection().setCurrentSpreadIndex(n-1);this.flipNext(t)}if(n<i){this.app.getPageCollection().setCurrentSpreadIndex(n+1);this.flipPrev(t)}}catch(e){}}flipNext(e){this.flip({x:this.render.getRect().left+2*this.render.getRect().pageWidth-10,y:"top"===e?1:this.render.getRect().height-2})}flipPrev(e){this.flip({x:10,y:"top"===e?1:this.render.getRect().height-2})}stopMove(){if(null===this.calc)return;const e=this.calc.getPosition(),t=this.getBoundsRect(),i="bottom"===this.calc.getCorner()?t.height:0;e.x<=0?this.animateFlippingTo(e,{x:-t.pageWidth,y:i},!0):this.animateFlippingTo(e,{x:t.pageWidth,y:i},!1)}showCorner(e){if(!this.checkState("read","fold_corner"))return;const t=this.getBoundsRect(),i=t.pageWidth;if(this.isPointOnCorners(e))if(null===this.calc){if(!this.start(e))return;this.setState("fold_corner");this.calc.calc({x:i-1,y:1});const n=50,s="bottom"===this.calc.getCorner()?t.height-1:1,r="bottom"===this.calc.getCorner()?t.height-n:n;this.animateFlippingTo({x:i-1,y:s},{x:i-n,y:r},!1,!1)}else this.do(this.render.convertToPage(e));else{this.setState("read");this.render.finishAnimation();this.stopMove()}}animateFlippingTo(e,t,i,n=!0){const s=Helper.GetCordsFromTwoPoint(e,t),r=[];for(const e of s)r.push((()=>this.do(e)));const a=this.getAnimationDuration(s.length);this.render.startAnimation(r,a,(()=>{if(this.calc){i&&(1===this.calc.getDirection()?this.app.turnToPrevPage():this.app.turnToNextPage());if(n){this.render.setBottomPage(null);this.render.setFlippingPage(null);this.render.clearShadow();this.setState("read");this.reset()}}}))}getCalculation(){return this.calc}getState(){return this.state}setState(e){if(this.state!==e){this.app.updateState(e);this.state=e}}getDirectionByPoint(e){const t=this.getBoundsRect();if("portrait"===this.render.getOrientation()){if(e.x-t.pageWidth<=t.width/5)return 1}else if(e.x<t.width/2)return 1;return 0}getAnimationDuration(e){const t=this.app.getSettings().flippingTime;return e>=1e3?t:e/1e3*t}checkDirection(e){return 0===e?this.app.getCurrentPageIndex()<this.app.getPageCount()-1:this.app.getCurrentPageIndex()>=1}reset(){this.calc=null;this.flippingPage=null;this.bottomPage=null}getBoundsRect(){return this.render.getRect()}checkState(...e){for(const t of e)if(this.state===t)return!0;return!1}isPointOnCorners(e){const t=this.getBoundsRect(),i=t.pageWidth,n=Math.sqrt(Math.pow(i,2)+Math.pow(t.height,2))/5,s=this.render.convertToBook(e);return s.x>0&&s.y>0&&s.x<t.width&&s.y<t.height&&(s.x<n||s.x>t.width-n)&&(s.y<n||s.y>t.height-n)}}class Render{constructor(e,t){this.leftPage=null;this.rightPage=null;this.flippingPage=null;this.bottomPage=null;this.direction=null;this.orientation=null;this.shadow=null;this.animation=null;this.pageRect=null;this.boundsRect=null;this.timer=0;this.safari=!1;this.setting=t;this.app=e;const i=new RegExp("Version\\/[\\d\\.]+.*Safari/");this.safari=null!==i.exec(window.navigator.userAgent)}render(e){if(null!==this.animation){const t=Math.round((e-this.animation.startedAt)/this.animation.durationFrame);if(t<this.animation.frames.length)this.animation.frames[t]();else{this.animation.onAnimateEnd();this.animation=null}}this.timer=e;this.drawFrame()}start(){this.update();const loop=e=>{window.ngxZone.runOutsideAngular((()=>{this.render(e);requestAnimationFrame(loop)}))};window.ngxZone.runOutsideAngular((()=>{requestAnimationFrame(loop)}))}startAnimation(e,t,i){this.finishAnimation();this.animation={frames:e,duration:t,durationFrame:t/e.length,onAnimateEnd:i,startedAt:this.timer}}finishAnimation(){if(null!==this.animation){this.animation.frames[this.animation.frames.length-1]();null!==this.animation.onAnimateEnd&&this.animation.onAnimateEnd()}this.animation=null}update(){this.boundsRect=null;const e=this.calculateBoundsRect();if(this.orientation!==e){this.orientation=e;this.app.updateOrientation(e)}}calculateBoundsRect(){let e="landscape";const t=this.getBlockWidth(),i=t/2,n=this.getBlockHeight()/2,s=this.setting.width/this.setting.height;let r=this.setting.width,a=this.setting.height,o=i-r;if("stretch"===this.setting.size){t<2*this.setting.minWidth&&this.app.getSettings().usePortrait&&(e="portrait");r="portrait"===e?this.getBlockWidth():this.getBlockWidth()/2;r>this.setting.maxWidth&&(r=this.setting.maxWidth);a=r/s;if(a>this.getBlockHeight()){a=this.getBlockHeight();r=a*s}o="portrait"===e?i-r/2-r:i-r}else if(t<2*r&&this.app.getSettings().usePortrait){e="portrait";o=i-r/2-r}this.boundsRect={left:o,top:n-a/2,width:2*r,height:a,pageWidth:r};return e}setShadowData(e,t,i,n){if(!this.app.getSettings().drawShadow)return;const s=100*this.getSettings().maxShadowOpacity;this.shadow={pos:e,angle:t,width:3*this.getRect().pageWidth/4*i/100,opacity:(100-i)*s/100/100,direction:n,progress:2*i}}clearShadow(){this.shadow=null}getBlockWidth(){return this.app.getUI().getDistElement().offsetWidth}getBlockHeight(){return this.app.getUI().getDistElement().offsetHeight}getDirection(){return this.direction}getRect(){null===this.boundsRect&&this.calculateBoundsRect();return this.boundsRect}getSettings(){return this.app.getSettings()}getOrientation(){return this.orientation}setPageRect(e){this.pageRect=e}setDirection(e){this.direction=e}setRightPage(e){null!==e&&e.setOrientation(1);this.rightPage=e}setLeftPage(e){null!==e&&e.setOrientation(0);this.leftPage=e}setBottomPage(e){null!==e&&e.setOrientation(1===this.direction?0:1);this.bottomPage=e}setFlippingPage(e){null!==e&&e.setOrientation(0===this.direction&&"portrait"!==this.orientation?0:1);this.flippingPage=e}convertToBook(e){const t=this.getRect();return{x:e.x-t.left,y:e.y-t.top}}isSafari(){return this.safari}convertToPage(e,t){t||(t=this.direction);const i=this.getRect();return{x:0===t?e.x-i.left-i.width/2:i.width/2-e.x+i.left,y:e.y-i.top}}convertToGlobal(e,t){t||(t=this.direction);if(null==e)return null;const i=this.getRect();return{x:0===t?e.x+i.left+i.width/2:i.width/2-e.x+i.left,y:e.y+i.top}}convertRectToGlobal(e,t){t||(t=this.direction);return{topLeft:this.convertToGlobal(e.topLeft,t),topRight:this.convertToGlobal(e.topRight,t),bottomLeft:this.convertToGlobal(e.bottomLeft,t),bottomRight:this.convertToGlobal(e.bottomRight,t)}}}class CanvasRender extends Render{constructor(e,t,i){super(e,t);this.canvas=i;const n=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0;canvas.getContext("2d",n)}getContext(){return this.ctx}reload(){}drawFrame(){this.clear();"portrait"!==this.orientation&&null!=this.leftPage&&this.leftPage.simpleDraw(0);null!=this.rightPage&&this.rightPage.simpleDraw(1);null!=this.bottomPage&&this.bottomPage.draw();this.drawBookShadow();null!=this.flippingPage&&this.flippingPage.draw();if(null!=this.shadow){this.drawOuterShadow();this.drawInnerShadow()}const e=this.getRect();if("portrait"===this.orientation){this.ctx.beginPath();this.ctx.rect(e.left+e.pageWidth,e.top,e.width,e.height);this.ctx.clip()}}drawBookShadow(){const e=this.getRect();this.ctx.save();this.ctx.beginPath();const t=e.width/20;this.ctx.rect(e.left,e.top,e.width,e.height);const i={x:e.left+e.width/2-t/2,y:0};this.ctx.translate(i.x,i.y);const n=this.ctx.createLinearGradient(0,0,t,0);n.addColorStop(0,"rgba(0, 0, 0, 0)");n.addColorStop(.4,"rgba(0, 0, 0, 0.2)");n.addColorStop(.49,"rgba(0, 0, 0, 0.1)");n.addColorStop(.5,"rgba(0, 0, 0, 0.5)");n.addColorStop(.51,"rgba(0, 0, 0, 0.4)");n.addColorStop(1,"rgba(0, 0, 0, 0)");this.ctx.clip();this.ctx.fillStyle=n;this.ctx.fillRect(0,0,t,2*e.height);this.ctx.restore()}drawOuterShadow(){const e=this.getRect();this.ctx.save();this.ctx.beginPath();this.ctx.rect(e.left,e.top,e.width,e.height);const t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y});this.ctx.translate(t.x,t.y);this.ctx.rotate(Math.PI+this.shadow.angle+Math.PI/2);const i=this.ctx.createLinearGradient(0,0,this.shadow.width,0);if(0===this.shadow.direction){this.ctx.translate(0,-100);i.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")");i.addColorStop(1,"rgba(0, 0, 0, 0)")}else{this.ctx.translate(-this.shadow.width,-100);i.addColorStop(0,"rgba(0, 0, 0, 0)");i.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")")}this.ctx.clip();this.ctx.fillStyle=i;this.ctx.fillRect(0,0,this.shadow.width,2*e.height);this.ctx.restore()}drawInnerShadow(){const e=this.getRect();this.ctx.save();this.ctx.beginPath();const t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),i=this.convertRectToGlobal(this.pageRect);this.ctx.moveTo(i.topLeft.x,i.topLeft.y);this.ctx.lineTo(i.topRight.x,i.topRight.y);this.ctx.lineTo(i.bottomRight.x,i.bottomRight.y);this.ctx.lineTo(i.bottomLeft.x,i.bottomLeft.y);this.ctx.translate(t.x,t.y);this.ctx.rotate(Math.PI+this.shadow.angle+Math.PI/2);const n=3*this.shadow.width/4,s=this.ctx.createLinearGradient(0,0,n,0);if(0===this.shadow.direction){this.ctx.translate(-n,-100);s.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(.9,"rgba(0, 0, 0, 0.05)");s.addColorStop(.7,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(0,"rgba(0, 0, 0, 0)")}else{this.ctx.translate(0,-100);s.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(.1,"rgba(0, 0, 0, 0.05)");s.addColorStop(.3,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(1,"rgba(0, 0, 0, 0)")}this.ctx.clip();this.ctx.fillStyle=s;this.ctx.fillRect(0,0,n,2*e.height);this.ctx.restore()}clear(){this.ctx.fillStyle="white";this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}}class UI{constructor(e,t,i){this.touchPoint=null;this.swipeTimeout=250;this.onResize=()=>{this.update()};this.onMouseDown=e=>{if(this.checkTarget(e.target)){const t=this.getMousePos(e.clientX,e.clientY);this.app.startUserTouch(t);e.preventDefault()}};this.onTouchStart=e=>{if(this.checkTarget(e.target)&&e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);this.touchPoint={point:i,time:Date.now()};setTimeout((()=>{null!==this.touchPoint&&this.app.startUserTouch(i)}),this.swipeTimeout);this.app.getSettings().mobileScrollSupport||e.preventDefault()}};this.onMouseUp=e=>{const t=this.getMousePos(e.clientX,e.clientY);this.app.userStop(t)};this.onMouseMove=e=>{const t=this.getMousePos(e.clientX,e.clientY);this.app.userMove(t,!1)};this.onTouchMove=e=>{if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);if(this.app.getSettings().mobileScrollSupport){null!==this.touchPoint&&(Math.abs(this.touchPoint.point.x-i.x)>10||"read"!==this.app.getState())&&e.cancelable&&this.app.userMove(i,!0);"read"!==this.app.getState()&&e.preventDefault()}else this.app.userMove(i,!0)}};this.onTouchEnd=e=>{if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);let n=!1;if(null!==this.touchPoint){const e=i.x-this.touchPoint.point.x,t=Math.abs(i.y-this.touchPoint.point.y);if(Math.abs(e)>this.swipeDistance&&t<2*this.swipeDistance&&Date.now()-this.touchPoint.time<this.swipeTimeout){e>0?this.app.flipPrev(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom"):this.app.flipNext(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom");n=!0}this.touchPoint=null}this.app.userStop(i,n)}};this.parentElement=e;e.classList.add("stf__parent");e.insertAdjacentHTML("afterbegin",'<div class="stf__wrapper"></div>');this.wrapper=e.querySelector(".stf__wrapper");this.app=t;const n=this.app.getSettings().usePortrait?1:2;e.style.minWidth=i.minWidth*n+"px";e.style.minHeight=i.minHeight+"px";if("fixed"===i.size){e.style.minWidth=i.width*n+"px";e.style.minHeight=i.height+"px"}if(i.autoSize){e.style.width="100%";e.style.maxWidth=2*i.maxWidth+"px"}e.style.display="block";window.addEventListener("resize",this.onResize,!1);this.swipeDistance=i.swipeDistance}destroy(){this.app.getSettings().useMouseEvents&&this.removeHandlers();this.distElement.remove();this.wrapper.remove()}getDistElement(){return this.distElement}getWrapper(){return this.wrapper}setOrientationStyle(e){this.wrapper.classList.remove("--portrait","--landscape");if("portrait"===e){this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/this.app.getSettings().width*100+"%");this.wrapper.classList.add("--portrait")}else{this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/(2*this.app.getSettings().width)*100+"%");this.wrapper.classList.add("--landscape")}this.update()}removeHandlers(){window.removeEventListener("resize",this.onResize);this.distElement.removeEventListener("mousedown",this.onMouseDown);this.distElement.removeEventListener("touchstart",this.onTouchStart);window.removeEventListener("mousemove",this.onMouseMove);window.removeEventListener("touchmove",this.onTouchMove);window.removeEventListener("mouseup",this.onMouseUp);window.removeEventListener("touchend",this.onTouchEnd)}setHandlers(){window.addEventListener("resize",this.onResize,!1);if(this.app.getSettings().useMouseEvents){this.distElement.addEventListener("mousedown",this.onMouseDown);this.distElement.addEventListener("touchstart",this.onTouchStart);window.addEventListener("mousemove",this.onMouseMove);window.addEventListener("touchmove",this.onTouchMove,{passive:!this.app.getSettings().mobileScrollSupport});window.addEventListener("mouseup",this.onMouseUp);window.addEventListener("touchend",this.onTouchEnd)}}getMousePos(e,t){const i=this.distElement.getBoundingClientRect();return{x:e-i.left,y:t-i.top}}checkTarget(e){return!this.app.getSettings().clickEventForward||!["a","button"].includes(e.tagName.toLowerCase())}}class HTMLUI extends UI{constructor(e,t,i,n){super(e,t,i);this.wrapper.insertAdjacentHTML("afterbegin",'<div class="stf__block"></div>');this.distElement=e.querySelector(".stf__block");this.items=n;for(const e of n)this.distElement.appendChild(e);this.setHandlers()}clear(){for(const e of this.items)this.parentElement.appendChild(e)}updateItems(e){this.removeHandlers();this.distElement.innerHTML="";for(const t of e)this.distElement.appendChild(t);this.items=e;this.setHandlers()}update(){this.app.getRender().update()}}class CanvasUI extends UI{constructor(e,t,i){super(e,t,i);this.wrapper.innerHTML='<canvas class="stf__canvas"></canvas>';this.canvas=e.querySelectorAll("canvas")[0];this.distElement=this.canvas;this.resizeCanvas();this.setHandlers()}resizeCanvas(){const e=getComputedStyle(this.canvas),t=parseInt(e.getPropertyValue("width"),10),i=parseInt(e.getPropertyValue("height"),10);this.canvas.width=t;this.canvas.height=i}getCanvas(){return this.canvas}update(){this.resizeCanvas();this.app.getRender().update()}}class EventObject{constructor(){this.events=new Map}on(e,t){this.events.has(e)?this.events.get(e).push(t):this.events.set(e,[t]);return this}off(e){this.events.delete(e)}trigger(e,t,i=null){if(this.events.has(e))for(const n of this.events.get(e))n({data:i,object:t})}}class HTMLRender extends Render{constructor(e,t,i){super(e,t);this.outerShadow=null;this.innerShadow=null;this.hardShadow=null;this.hardInnerShadow=null;this.element=i;this.createShadows()}createShadows(){this.element.insertAdjacentHTML("beforeend",'<div class="stf__outerShadow"></div>\n             <div class="stf__innerShadow"></div>\n             <div class="stf__hardShadow"></div>\n             <div class="stf__hardInnerShadow"></div>');this.outerShadow=this.element.querySelector(".stf__outerShadow");this.innerShadow=this.element.querySelector(".stf__innerShadow");this.hardShadow=this.element.querySelector(".stf__hardShadow");this.hardInnerShadow=this.element.querySelector(".stf__hardInnerShadow")}clearShadow(){super.clearShadow();this.outerShadow.style.cssText="display: none";this.innerShadow.style.cssText="display: none";this.hardShadow.style.cssText="display: none";this.hardInnerShadow.style.cssText="display: none"}reload(){this.element.querySelector(".stf__outerShadow")||this.createShadows()}drawHardInnerShadow(){const e=this.getRect(),t=this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress;let i=(100-t)*(2.5*e.pageWidth)/100+20;i>e.pageWidth&&(i=e.pageWidth);let n=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+5).toString(10)};\n            width: ${i}px;\n            height: ${e.height}px;\n            background: linear-gradient(to right,\n                rgba(0, 0, 0, ${this.shadow.opacity*t/100}) 5%,\n                rgba(0, 0, 0, 0) 100%);\n            left: ${e.left+e.width/2}px;\n            transform-origin: 0 0;\n        `;n+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0);":"transform: translate3d(0, 0, 0) rotateY(180deg);";this.hardInnerShadow.style.cssText=n}drawHardOuterShadow(){const e=this.getRect();let t=(100-(this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress))*(2.5*e.pageWidth)/100+20;t>e.pageWidth&&(t=e.pageWidth);let i=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+4).toString(10)};\n            width: ${t}px;\n            height: ${e.height}px;\n            background: linear-gradient(to left, rgba(0, 0, 0, ${this.shadow.opacity}) 5%, rgba(0, 0, 0, 0) 100%);\n            left: ${e.left+e.width/2}px;\n            transform-origin: 0 0;\n        `;i+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0) rotateY(180deg);":"transform: translate3d(0, 0, 0);";this.hardShadow.style.cssText=i}drawInnerShadow(){const e=this.getRect(),t=3*this.shadow.width/4,i=0===this.getDirection()?t:0,n=0===this.getDirection()?"to left":"to right",s=this.convertToGlobal(this.shadow.pos),r=this.shadow.angle+3*Math.PI/2,a=[this.pageRect.topLeft,this.pageRect.topRight,this.pageRect.bottomRight,this.pageRect.bottomLeft];let o="polygon( ";for(const e of a){let t=1===this.getDirection()?{x:-e.x+this.shadow.pos.x,y:e.y-this.shadow.pos.y}:{x:e.x-this.shadow.pos.x,y:e.y-this.shadow.pos.y};t=Helper.GetRotatedPoint(t,{x:i,y:100},r);o+=t.x+"px "+t.y+"px, "}o=o.slice(0,-2);o+=")";const l=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+10).toString(10)};\n            width: ${t}px;\n            height: ${2*e.height}px;\n            background: linear-gradient(${n},\n                rgba(0, 0, 0, ${this.shadow.opacity}) 5%,\n                rgba(0, 0, 0, 0.05) 15%,\n                rgba(0, 0, 0, ${this.shadow.opacity}) 35%,\n                rgba(0, 0, 0, 0) 100%);\n            transform-origin: ${i}px 100px;\n            transform: translate3d(${s.x-i}px, ${s.y-100}px, 0) rotate(${r}rad);\n            clip-path: ${o};\n            -webkit-clip-path: ${o};\n        `;this.innerShadow.style.cssText=l}drawOuterShadow(){const e=this.getRect(),t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),i=this.shadow.angle+3*Math.PI/2,n=1===this.getDirection()?this.shadow.width:0,s=0===this.getDirection()?"to right":"to left",r=[{x:0,y:0},{x:e.pageWidth,y:0},{x:e.pageWidth,y:e.height},{x:0,y:e.height}];let a="polygon( ";for(const e of r)if(null!==e){let t=1===this.getDirection()?{x:-e.x+this.shadow.pos.x,y:e.y-this.shadow.pos.y}:{x:e.x-this.shadow.pos.x,y:e.y-this.shadow.pos.y};t=Helper.GetRotatedPoint(t,{x:n,y:100},i);a+=t.x+"px "+t.y+"px, "}a=a.slice(0,-2);a+=")";const o=`\n            display: block;\n            z-index: ${(this.getSettings().startZIndex+10).toString(10)};\n            width: ${this.shadow.width}px;\n            height: ${2*e.height}px;\n            background: linear-gradient(${s}, rgba(0, 0, 0, ${this.shadow.opacity}), rgba(0, 0, 0, 0));\n            transform-origin: ${n}px 100px;\n            transform: translate3d(${t.x-n}px, ${t.y-100}px, 0) rotate(${i}rad);\n            clip-path: ${a};\n            -webkit-clip-path: ${a};\n        `;this.outerShadow.style.cssText=o}drawLeftPage(){if("portrait"!==this.orientation&&null!==this.leftPage)if(1===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){if(this.flippingPage.getHardAngle()<-90){this.leftPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.leftPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.leftPage.draw(this.flippingPage.getDrawingDensity())}else this.leftPage.getElement().style.display="none"}else this.leftPage.simpleDraw(0)}drawRightPage(){if(null!==this.rightPage)if(0===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){if(this.flippingPage.getHardAngle()>90){this.rightPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.rightPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.rightPage.draw(this.flippingPage.getDrawingDensity())}else this.rightPage.getElement().style.display="none"}else this.rightPage.simpleDraw(1)}drawBottomPage(){if(null===this.bottomPage)return;const e=null!=this.flippingPage?this.flippingPage.getDrawingDensity():null;if("portrait"!==this.orientation||1!==this.direction){this.bottomPage.getElement().style.zIndex=(this.getSettings().startZIndex+3).toString(10);this.bottomPage.draw(e)}}drawFrame(){if(null!==this.flippingPage){if(this.flippingPage.getHardAngle()===this.lastAngle)return;this.lastAngle=this.flippingPage.getHardAngle()}else this.lastAngle=-1234;this.clear();this.drawLeftPage();this.drawRightPage();this.drawBottomPage();if(null!=this.flippingPage){if(this.flippingPage.state.hardDrawingAngle<=90){this.flippingPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.flippingPage.draw()}else this.flippingPage.getElement().style.display="none"}if(null!=this.shadow&&null!==this.flippingPage)if("soft"===this.flippingPage.getDrawingDensity()){this.drawOuterShadow();this.drawInnerShadow()}else{this.drawHardOuterShadow();this.drawHardInnerShadow()}}clear(){for(const e of this.app.getPageCollection().getPages()){if(e!==this.leftPage&&e!==this.rightPage&&e!==this.flippingPage&&e!==this.bottomPage){const t=e.getElement().style;"none"!==t.display&&(t.cssText="display: none")}e.getTemporaryCopy()!==this.flippingPage&&e.hideTemporaryCopy()}}update(){super.update();null!==this.rightPage&&this.rightPage.setOrientation(1);null!==this.leftPage&&this.leftPage.setOrientation(0)}}class Settings{constructor(){this._default={startPage:0,size:"fixed",width:0,height:0,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,drawShadow:!0,flippingTime:1e3,usePortrait:!0,startZIndex:0,autoSize:!0,maxShadowOpacity:1,showCover:!1,mobileScrollSupport:!0,swipeDistance:30,clickEventForward:!0,useMouseEvents:!0,showPageCorners:!0,disableFlipByClick:!1}}getSettings(e){const t=this._default;Object.assign(t,e);if("stretch"!==t.size&&"fixed"!==t.size)throw new Error('Invalid size type. Available only "fixed" and "stretch" value');if(t.width<=0||t.height<=0)throw new Error("Invalid width or height");if(t.flippingTime<=0)throw new Error("Invalid flipping time");if("stretch"===t.size){t.minWidth<=0&&(t.minWidth=100);t.maxWidth<t.minWidth&&(t.maxWidth=2e3);t.minHeight<=0&&(t.minHeight=100);t.maxHeight<t.minHeight&&(t.maxHeight=2e3)}else{t.minWidth=t.width;t.maxWidth=t.width;t.minHeight=t.height;t.maxHeight=t.height}return t}}!function styleInject(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css";"top"===i&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s);s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}(".stf__parent {\n  position: relative;\n  display: block;\n  box-sizing: border-box;\n  transform: translateZ(0);\n\n  -ms-touch-action: pan-y;\n  touch-action: pan-y;\n}\n\n.sft__wrapper {\n  position: relative;\n  width: 100%;\n  box-sizing: border-box;\n}\n\n.stf__parent canvas {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  left: 0;\n  top: 0;\n}\n\n.stf__block {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  box-sizing: border-box;\n  perspective: 2000px;\n}\n\n.stf__item {\n  display: none;\n  position: absolute;\n  transform-style: preserve-3d;\n}\n\n.stf__outerShadow {\n  position: absolute;\n  left: 0;\n  top: 0;\n}\n\n.stf__innerShadow {\n  position: absolute;\n  left: 0;\n  top: 0;\n}\n\n.stf__hardShadow {\n  position: absolute;\n  left: 0;\n  top: 0;\n}\n\n.stf__hardInnerShadow {\n  position: absolute;\n  left: 0;\n  top: 0;\n}");class PageFlip extends EventObject{constructor(e,t){super();this.isUserTouch=!1;this.isUserMove=!1;this.setting=null;this.pages=null;this.setting=(new Settings).getSettings(t);this.block=e}destroy(){this.ui.destroy()}update(){this.render.update();this.pages.show()}loadFromImages(e){this.ui=new CanvasUI(this.block,this,this.setting);const t=this.ui.getCanvas();this.render=new CanvasRender(this,this.setting,t);this.flipController=new Flip(this.render,this);this.pages=new ImagePageCollection(this,this.render,e);this.pages.load();this.render.start();this.pages.show(this.setting.startPage);setTimeout((()=>{this.ui.update();this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})}),1)}loadFromHTML(e){this.ui=new HTMLUI(this.block,this,this.setting,e);this.render=new HTMLRender(this,this.setting,this.ui.getDistElement());this.flipController=new Flip(this.render,this);this.pages=new HTMLPageCollection(this,this.render,this.ui.getDistElement(),e);this.pages.load();this.render.start();this.pages.show(this.setting.startPage);setTimeout((()=>{this.ui.update();this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})}),1)}updateFromImages(e){const t=this.pages.getCurrentPageIndex();this.pages.destroy();this.pages=new ImagePageCollection(this,this.render,e);this.pages.load();this.pages.show(t);this.trigger("update",this,{page:t,mode:this.render.getOrientation()})}updateFromHtml(e){const t=this.pages.getCurrentPageIndex();this.pages.destroy();this.pages=new HTMLPageCollection(this,this.render,this.ui.getDistElement(),e);this.pages.load();this.ui.updateItems(e);this.render.reload();this.pages.show(t);this.trigger("update",this,{page:t,mode:this.render.getOrientation()})}clear(){this.pages.destroy();this.ui.clear()}turnToPrevPage(){this.pages.showPrev()}turnToNextPage(){this.pages.showNext()}turnToPage(e){this.pages.show(e)}flipNext(e="top"){this.flipController.flipNext(e)}flipPrev(e="top"){this.flipController.flipPrev(e)}flip(e,t="top"){this.flipController.flipToPage(e,t)}updateState(e){this.trigger("changeState",this,e)}updatePageIndex(e){this.trigger("flip",this,e)}updateOrientation(e){this.ui.setOrientationStyle(e);this.update();this.trigger("changeOrientation",this,e)}getPageCount(){return this.pages.getPageCount()}getCurrentPageIndex(){return this.pages.getCurrentPageIndex()}getPage(e){return this.pages.getPage(e)}getRender(){return this.render}getFlipController(){return this.flipController}getOrientation(){return this.render.getOrientation()}getBoundsRect(){return this.render.getRect()}getSettings(){return this.setting}getUI(){return this.ui}getState(){return this.flipController.getState()}getPageCollection(){return this.pages}startUserTouch(e){this.mousePosition=e;this.isUserTouch=!0;this.isUserMove=!1}userMove(e,t){if(this.isUserTouch||t||!this.setting.showPageCorners){if(this.isUserTouch&&Helper.GetDistanceBetweenTwoPoint(this.mousePosition,e)>5){this.isUserMove=!0;this.flipController.fold(e)}}else this.flipController.showCorner(e)}userStop(e,t=!1){if(this.isUserTouch){this.isUserTouch=!1;t||(this.isUserMove?this.flipController.stopMove():this.flipController.flip(e))}}}},6329:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PasswordPrompt:()=>PasswordPrompt});var s=i(1869),r=e([s]);s=(r.then?(await r)():r)[0];class PasswordPrompt{#Z=null;#q=null;#X=null;constructor(e,t,i=!1){this.dialog=e.dialog;this.label=e.label;this.input=e.input;this.submitButton=e.submitButton;this.cancelButton=e.cancelButton;this.overlayManager=t;this._isViewerEmbedded=i;this.submitButton.addEventListener("click",this.#Q.bind(this));this.cancelButton.addEventListener("click",this.close.bind(this));this.input.addEventListener("keydown",(e=>{13===e.keyCode&&this.#Q()}));this.overlayManager.register(this.dialog,!0);this.dialog.addEventListener("close",this.#Y.bind(this))}async open(){this.#Z&&await this.#Z.promise;this.#Z=new s.PromiseCapability;try{await this.overlayManager.open(this.dialog);this.input.type="password";this.input.focus()}catch(e){this.#Z.resolve();throw e}const e=this.#X===s.PasswordResponses.INCORRECT_PASSWORD;this._isViewerEmbedded&&!e||this.input.focus();this.label.setAttribute("data-l10n-id","pdfjs-password-"+(e?"invalid":"label"))}async close(){if(this.overlayManager.active===this.dialog){this.overlayManager.close(this.dialog);this.input.value="";this.input.type="hidden"}}#Q(){const e=this.input.value;e?.length>0&&this.#J(e)}#Y(){this.#J(new Error("PasswordPrompt cancelled."));this.#Z.resolve()}#J(e){if(this.#q){this.close();this.input.value="";this.#q(e);this.#q=null}}async setUpdateCallback(e,t){this.#Z&&await this.#Z.promise;this.#q=e;this.#X=t}}n()}catch(e){n(e)}}))},716:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFAttachmentViewer:()=>PDFAttachmentViewer});var s=i(1869),r=i(9415),a=i(6554),o=e([s]);s=(o.then?(await o)():o)[0];class PDFAttachmentViewer extends r.BaseTreeViewer{constructor(e){super(e);this.downloadManager=e.downloadManager;this.eventBus._on("fileattachmentannotation",this.#ee.bind(this))}reset(e=!1){super.reset();this._attachments=null;e||(this._renderedCapability=new s.PromiseCapability);this._pendingDispatchEvent=!1}async _dispatchEvent(e){this._renderedCapability.resolve();if(0===e&&!this._pendingDispatchEvent){this._pendingDispatchEvent=!0;await(0,a.waitOnEventOrTimeout)({target:this.eventBus,name:"annotationlayerrendered",delay:1e3});if(!this._pendingDispatchEvent)return}this._pendingDispatchEvent=!1;this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:e})}_bindLink(e,{content:t,filename:i}){e.onclick=()=>{this.downloadManager.openOrDownloadData(t,i);return!1}}render({attachments:e,keepRenderedCapability:t=!1}){this._attachments&&this.reset(t);this._attachments=e||null;if(!e){this._dispatchEvent(0);return}const i=document.createDocumentFragment();let n=0;for(const t in e){const r=e[t],a=r.content,o=(0,s.getFilenameFromUrl)(r.filename,!0),l=document.createElement("div");l.className="treeItem";const h=document.createElement("a");this._bindLink(h,{content:a,filename:o});h.textContent=this._normalizeTextContent(o);l.append(h);i.append(l);n++}this._finishRendering(i,n)}#ee({filename:e,content:t}){const i=this._renderedCapability.promise;i.then((()=>{if(i!==this._renderedCapability.promise)return;const n=this._attachments||Object.create(null);for(const t in n)if(e===t)return;n[e]={filename:e,content:t};this.render({attachments:n,keepRenderedCapability:!0})}))}}n()}catch(e){n(e)}}))},3611:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFCursorTools:()=>PDFCursorTools});var s=i(1869),r=i(4927),a=i(6143),o=e([s]);s=(o.then?(await o)():o)[0];class PDFCursorTools{#K=r.CursorTool.SELECT;#te=null;constructor({container:e,eventBus:t,cursorToolOnLoad:i=r.CursorTool.SELECT}){this.container=e;this.eventBus=t;this.#ie();Promise.resolve().then((()=>{this.switchTool(i)}))}get activeTool(){return this.#K}switchTool(e){if(null!==this.#te)return;if(e===this.#K)return;const disableActiveTool=()=>{switch(this.#K){case r.CursorTool.SELECT:break;case r.CursorTool.HAND:this._handTool.deactivate();case r.CursorTool.ZOOM:}};switch(e){case r.CursorTool.SELECT:disableActiveTool();break;case r.CursorTool.HAND:disableActiveTool();this._handTool.activate();break;case r.CursorTool.ZOOM:default:globalThis.ngxConsole.error(`switchTool: "${e}" is an unsupported value.`);return}this.#K=e;this.eventBus.dispatch("cursortoolchanged",{source:this,tool:e})}#ie(){this.eventBus._on("switchcursortool",(e=>{this.switchTool(e.tool)}));let e=s.AnnotationEditorType.NONE,t=r.PresentationModeState.NORMAL;const disableActive=()=>{const e=this.#K;this.switchTool(r.CursorTool.SELECT);this.#te??=e},enableActive=()=>{const i=this.#te;if(null!==i&&e===s.AnnotationEditorType.NONE&&t===r.PresentationModeState.NORMAL){this.#te=null;this.switchTool(i)}};this.eventBus._on("secondarytoolbarreset",(i=>{if(null!==this.#te){e=s.AnnotationEditorType.NONE;t=r.PresentationModeState.NORMAL;enableActive()}}));this.eventBus._on("annotationeditormodechanged",(({mode:t})=>{e=t;t===s.AnnotationEditorType.NONE?enableActive():disableActive()}));this.eventBus._on("presentationmodechanged",(({state:e})=>{t=e;e===r.PresentationModeState.NORMAL?enableActive():e===r.PresentationModeState.FULLSCREEN&&disableActive()}))}get _handTool(){return(0,s.shadow)(this,"_handTool",new a.GrabToPan({element:this.container}))}}n()}catch(e){n(e)}}))},6312:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFDocumentProperties:()=>PDFDocumentProperties});var s=i(4927),r=i(1869),a=e([r]);r=(a.then?(await a)():a)[0];const o="-",l=["en-us","en-lr","my"],h={"8.5x11":"letter","8.5x14":"legal"},d={"297x420":"a-three","210x297":"a-four"};function getPageName(e,t,i){return i[`${t?e.width:e.height}x${t?e.height:e.width}`]}class PDFDocumentProperties{#ne=null;constructor({dialog:e,fields:t,closeButton:i},n,s,r,a){this.dialog=e;this.fields=t;this.overlayManager=n;this.l10n=r;this._fileNameLookup=a;this.eventBus=s;this.#se();i.addEventListener("click",this.close.bind(this));this.overlayManager.register(this.dialog);s._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));s._on("rotationchanging",(e=>{this._pagesRotation=e.pagesRotation}));this._isNonMetricLocale=l.includes(r.getLanguage())}async open(){await Promise.all([this.overlayManager.open(this.dialog),this._dataAvailableCapability.promise]);this.eventBus.dispatch("propertiesdialogopen",this);const e=this._currentPageNumber,t=this._pagesRotation;if(this.#ne&&e===this.#ne._currentPageNumber&&t===this.#ne._pagesRotation){this.#re();return}const{info:i,contentLength:n}=await this.pdfDocument.getMetadata(),[r,a,o,l,h,d]=await Promise.all([this._fileNameLookup(),this.#ae(n),this.#oe(i.CreationDate),this.#oe(i.ModDate),this.pdfDocument.getPage(e).then((e=>this.#le((0,s.getPageSizeInches)(e),t))),this.#he(i.IsLinearized)]);this.#ne=Object.freeze({fileName:r,fileSize:a,title:i.Title,author:i.Author,subject:i.Subject,keywords:i.Keywords,creationDate:o,modificationDate:l,creator:i.Creator,producer:i.Producer,version:i.PDFFormatVersion,pageCount:this.pdfDocument.numPages,pageSize:h,linearized:d,_currentPageNumber:e,_pagesRotation:t});this.#re();const{length:c}=await this.pdfDocument.getDownloadInfo();if(n===c)return;const u=Object.assign(Object.create(null),this.#ne);u.fileSize=await this.#ae(c);this.#ne=Object.freeze(u);this.#re()}async close(){this.overlayManager.close(this.dialog);this.eventBus.dispatch("propertiesdialogclose",this)}setDocument(e){if(this.pdfDocument){this.#se();this.#re(!0)}if(e){this.pdfDocument=e;this._dataAvailableCapability.resolve()}}#se(){this.pdfDocument=null;this.#ne=null;this._dataAvailableCapability=new r.PromiseCapability;this._currentPageNumber=1;this._pagesRotation=0}#re(e=!1){if(!e&&this.#ne){if(this.overlayManager.active===this.dialog)for(const e in this.fields){const t=this.#ne[e];this.fields[e].textContent=t||0===t?t:o}}else for(const e in this.fields)this.fields[e].textContent=o}async#ae(e=0){const t=e/1024,i=t/1024;if(t)return this.l10n.get("pdfjs-document-properties-"+(i>=1?"mb":"kb"),{size_mb:i>=1&&(+i.toPrecision(3)).toLocaleString(),size_kb:i<1&&(+t.toPrecision(3)).toLocaleString(),size_b:e.toLocaleString()})}async#le(e,t){if(!e)return;t%180!=0&&(e={width:e.height,height:e.width});const i=(0,s.isPortraitOrientation)(e);let n={width:Math.round(100*e.width)/100,height:Math.round(100*e.height)/100},r={width:Math.round(25.4*e.width*10)/10,height:Math.round(25.4*e.height*10)/10},a=getPageName(n,i,h)||getPageName(r,i,d);if(!(a||Number.isInteger(r.width)&&Number.isInteger(r.height))){const t={width:25.4*e.width,height:25.4*e.height},s={width:Math.round(r.width),height:Math.round(r.height)};if(Math.abs(t.width-s.width)<.1&&Math.abs(t.height-s.height)<.1){a=getPageName(s,i,d);if(a){n={width:Math.round(s.width/25.4*100)/100,height:Math.round(s.height/25.4*100)/100};r=s}}}const[{width:o,height:l},c,u,p]=await Promise.all([this._isNonMetricLocale?n:r,this.l10n.get("pdfjs-document-properties-page-size-unit-"+(this._isNonMetricLocale?"inches":"millimeters")),a&&this.l10n.get(`pdfjs-document-properties-page-size-name-${a}`),this.l10n.get("pdfjs-document-properties-page-size-orientation-"+(i?"portrait":"landscape"))]);return this.l10n.get(`pdfjs-document-properties-page-size-dimension-${u?"name-":""}string`,{width:o.toLocaleString(),height:l.toLocaleString(),unit:c,name:u,orientation:p})}async#oe(e){const t=r.PDFDateString.toDateObject(e);if(t)return this.l10n.get("pdfjs-document-properties-date-string",{date:t.toLocaleDateString(),time:t.toLocaleTimeString()})}#he(e){return this.l10n.get("pdfjs-document-properties-linearized-"+(e?"yes":"no"))}}n()}catch(c){n(c)}}))},1795:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFFindBar:()=>PDFFindBar});var s=i(3557),r=i(4927),a=e([s]);s=(a.then?(await a)():a)[0];const o=1e3;class PDFFindBar{#de=new ResizeObserver(this.#ce.bind(this));constructor(e,t){this.opened=!1;this.bar=e.bar;this.toggleButton=e.toggleButton;this.findField=e.findField;this.highlightAll=e.highlightAllCheckbox;this.currentPage=e.findCurrentPageCheckbox;this.pageRange=e.findPageRangeField;this.caseSensitive=e.caseSensitiveCheckbox;this.matchDiacritics=e.matchDiacriticsCheckbox;this.entireWord=e.entireWordCheckbox;this.findMsg=e.findMsg;this.findResultsCount=e.findResultsCount;this.findPreviousButton=e.findPreviousButton;this.findNextButton=e.findNextButton;this.eventBus=t;this.toggleButton.addEventListener("click",(()=>{this.toggle()}));this.findField.addEventListener("input",(()=>{this.dispatchEvent("")}));this.bar.addEventListener("keydown",(e=>{switch(e.keyCode){case 13:e.target===this.findField&&this.dispatchEvent("again",e.shiftKey);break;case 27:this.close()}}));this.findPreviousButton.addEventListener("click",(()=>{this.dispatchEvent("again",!0)}));this.findNextButton.addEventListener("click",(()=>{this.dispatchEvent("again",!1)}));this.highlightAll.addEventListener("click",(()=>{this.dispatchEvent("highlightallchange")}));this.caseSensitive.addEventListener("click",(()=>{this.dispatchEvent("casesensitivitychange")}));this.entireWord.addEventListener("click",(()=>{this.dispatchEvent("entirewordchange")}));this.matchDiacritics?.addEventListener("click",(()=>{this.dispatchEvent("diacriticmatchingchange")}))}reset(){this.updateUIState()}dispatchEvent(e,t=!1){this.eventBus.dispatch("find",{source:this,type:e,query:this.findField.value,caseSensitive:this.caseSensitive.checked,entireWord:this.entireWord.checked,highlightAll:this.highlightAll.checked,findPrevious:t,matchDiacritics:this.matchDiacritics.checked})}updateUIState(e,t,i){const{findField:n,findMsg:r}=this;let a="",o="";switch(e){case s.FindState.FOUND:break;case s.FindState.PENDING:o="pending";break;case s.FindState.NOT_FOUND:a="pdfjs-find-not-found";o="notFound";break;case s.FindState.WRAPPED:a="pdfjs-find-reached-"+(t?"top":"bottom")}n.setAttribute("data-status",o);n.setAttribute("aria-invalid",e===s.FindState.NOT_FOUND);r.setAttribute("data-status",o);if(a)r.setAttribute("data-l10n-id",a);else{r.removeAttribute("data-l10n-id");r.textContent=""}this.updateResultsCount(i)}updateResultsCount({current:e=0,total:t=0}={}){const{findResultsCount:i}=this;if(t>0){const n=o;i.setAttribute("data-l10n-id","pdfjs-find-match-count"+(t>n?"-limit":""));i.setAttribute("data-l10n-args",JSON.stringify({limit:n,current:e,total:t}))}else{i.removeAttribute("data-l10n-id");i.textContent=""}}open(){if(!this.opened){this.#de.observe(this.bar.parentNode);this.#de.observe(this.bar);this.opened=!0;(0,r.toggleExpandedBtn)(this.toggleButton,!0,this.bar)}this.findField.select();this.findField.focus();this.dispatchEvent("");this.eventBus.dispatch("findbaropen",{source:this})}close(){if(this.opened){this.#de.disconnect();this.opened=!1;(0,r.toggleExpandedBtn)(this.toggleButton,!1,this.bar);this.eventBus.dispatch("findbarclose",{source:this})}}toggle(){this.opened?this.close():this.open()}#ce(e){const{bar:t}=this;t.classList.remove("wrapContainers");t.clientHeight>t.firstElementChild.clientHeight&&t.classList.add("wrapContainers")}}n()}catch(e){n(e)}}))},3557:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{FindState:()=>l,PDFFindController:()=>PDFFindController});var s=i(4927),r=i(6839),a=i(1869),o=e([a]);a=(o.then?(await o)():o)[0];const l={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},h=250,d=-50,c=-400,u={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},p=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let g;const f=/\p{M}+/gu,m=/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu,w=/([^\p{M}])\p{M}*$/u,b=/^\p{M}*([^\p{M}])/u,v=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,y=new Map,P="[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]",S=new Map;let E=null,_=null;function normalize(e){const t=[];let i,n;for(;null!==(i=v.exec(e));){let{index:e}=i;for(const n of i[0]){let i=y.get(n);if(!i){i=n.normalize("NFD").length;y.set(n,i)}t.push([i,e++])}}if(0===t.length&&E)n=E;else if(t.length>0&&_)n=_;else{const e=`([${Object.keys(u).join("")}])|([${(0,r.getNormalizeWithNFKC)()}])|(${"(?:゙|゚)"}\\n)|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(${"(?:\\p{Ideographic}|[぀-ヿ])"}\\n)|(\\n)`;n=0===t.length?E=new RegExp(e+"|(\\u0000)","gum"):_=new RegExp(e+`|(${P})`,"gum")}const s=[];for(;null!==(i=f.exec(e));)s.push([i[0].length,i.index]);let a=e.normalize("NFD");const o=[[0,0]];let l=0,h=0,d=0,c=0,p=0,g=!1;a=a.replace(n,((e,i,n,r,a,f,m,w,b,v)=>{v-=c;if(i){const e=u[i],t=e.length;for(let e=1;e<t;e++)o.push([v-d+e,d-e]);d-=t-1;return e}if(n){let e=S.get(n);if(!e){e=n.normalize("NFKC");S.set(n,e)}const t=e.length;for(let e=1;e<t;e++)o.push([v-d+e,d-e]);d-=t-1;return e}if(r){g=!0;if(v+p===s[l]?.[1])++l;else{o.push([v-1-d+1,d-1]);d-=1;c+=1}o.push([v-d+1,d]);c+=1;p+=1;return r.charAt(0)}if(a){const e=a.endsWith("\n"),t=e?a.length-2:a.length;g=!0;let i=t;if(v+p===s[l]?.[1]){i-=s[l][0];++l}for(let e=1;e<=i;e++)o.push([v-1-d+e,d-e]);d-=i;c+=i;if(e){v+=t-1;o.push([v-d+1,1+d]);d+=1;c+=1;p+=1;return a.slice(0,t)}return a}if(f){const e=f.length-2;o.push([v-d+e,1+d]);d+=1;c+=1;p+=1;return f.slice(0,-2)}if(m){const e=m.length-1;o.push([v-d+e,d]);c+=1;p+=1;return m.slice(0,-1)}if(w){o.push([v-d+1,d-1]);d-=1;c+=1;p+=1;return" "}if(v+p===t[h]?.[1]){const e=t[h][0]-1;++h;for(let t=1;t<=e;t++)o.push([v-(d-t),d-t]);d-=e;c+=e}return b}));o.push([a.length,d]);return[a,o,g]}function getOriginalIndex(e,t,i){if(!e)return[t,i];const n=t,r=t+i-1;let a=(0,s.binarySearchFirstItem)(e,(e=>e[0]>=n));e[a][0]>n&&--a;let o=(0,s.binarySearchFirstItem)(e,(e=>e[0]>=r),a);e[o][0]>r&&--o;const l=n+e[a][1];return[l,r+e[o][1]+1-l]}class PDFFindController{#ue=null;#pe=!0;#ge=0;constructor({linkService:e,eventBus:t,updateMatchesCountOnProgress:i=!0,pageViewMode:n}){this._linkService=e;this._eventBus=t;this.#pe=i;this._pageViewMode=n;this.onIsPageVisible=null;this.#se();t._on("find",this.#fe.bind(this));t._on("findbarclose",this.#me.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this.#ue}setDocument(e){this._pdfDocument&&this.#se();if(e){this._pdfDocument=e;this._firstPageCapability.resolve()}}#fe(e){if(!e)return;const t=this._pdfDocument,{type:i}=e;(null===this.#ue||this.#we(e))&&(this._dirtyMatch=!0);this.#ue=e;if("highlightallchange"!==i)this.#t(l.PENDING);else{const e=this._pageMatches.some((e=>e.length>0)),t=!this.state?.query||e;this.#t(t?l.FOUND:l.NOT_FOUND)}this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this.#be();const e=!this._highlightMatches,n=!!this._findTimeout;if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(i)if(this._dirtyMatch)this.#ve();else if("again"===i){this.#ve();e&&this.#ue.highlightAll&&this.#ye()}else if("highlightallchange"===i){n?this.#ve():this._highlightMatches=!0;this.#ye()}else this.#ve();else this._findTimeout=setTimeout((()=>{this.#ve();this._findTimeout=null}),h)}))}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:i=-1,matchIndex:n=-1}){if(!this._scrollMatches||!e)return;if(-1===n||n!==this._selected.matchIdx)return;if(-1===i||i!==this._selected.pageIdx)return;this._scrollMatches=!1;const r={top:d,left:t+c};(0,s.scrollIntoView)(e,r,!0,"infinite-scroll"===this._pageViewMode)}#se(){this._highlightMatches=!1;this._scrollMatches=!1;this._pdfDocument=null;this._pageMatches=[];this._pageMatchesLength=[];this.#ge=0;this.#ue=null;this._selected={pageIdx:-1,matchIdx:-1};this._offset={pageIdx:null,matchIdx:null,wrapped:!1};this._extractTextPromises=[];this._pageContents=[];this._pageDiffs=[];this._hasDiacritics=[];this._matchesCountTotal=0;this._pagesToSearch=null;this._pendingFindMatches=new Set;this._resumePageIdx=null;this._dirtyMatch=!1;clearTimeout(this._findTimeout);this._findTimeout=null;this._firstPageCapability=new a.PromiseCapability}get#Pe(){const{query:e}=this.#ue;if("string"==typeof e){if(e!==this._rawQuery){this._rawQuery=e;[this._normalizedQuery]=normalize(e)}return this._normalizedQuery}return(e||[]).filter((e=>!!e)).map((e=>normalize(e)[0]))}#we(e){const t=e.query,i=this.#ue.query,n=typeof t;if(n!==typeof i)return!0;if("string"===n){if(t!==i)return!0}else if(JSON.stringify(t)!==JSON.stringify(i))return!0;switch(e.type){case"again":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!(this.onIsPageVisible?.(e)??1);case"highlightallchange":return!1}return!0}#Se(e,t,i){let n=e.slice(0,t).match(w);if(n){const i=e.charCodeAt(t),s=n[1].charCodeAt(0);if((0,r.getCharacterType)(i)===(0,r.getCharacterType)(s))return!1}n=e.slice(t+i).match(b);if(n){const s=e.charCodeAt(t+i-1),a=n[1].charCodeAt(0);if((0,r.getCharacterType)(s)===(0,r.getCharacterType)(a))return!1}return!0}#Ee(e,t,i,n){const s=this._pageMatches[i]=[],r=this._pageMatchesLength[i]=[];if(!e)return;const a=this._pageDiffs[i];let o;for(;null!==(o=e.exec(n));){if(t&&!this.#Se(n,o.index,o[0].length))continue;const[e,i]=getOriginalIndex(a,o.index,o[0].length);if(i){s.push(e);r.push(i)}}}#_e(e,t){const{matchDiacritics:i}=this.#ue;let n=!1;const s="[ ]*";(e=e.replaceAll(m,((e,s,r,a,o,l)=>{if(s)return`[ ]*\\${s}[ ]*`;if(r)return`[ ]*${r}[ ]*`;if(a)return"[ ]+";if(i)return o||l;if(o)return p.has(o.charCodeAt(0))?o:"";if(t){n=!0;return`${l}\\p{M}*`}return l}))).endsWith(s)&&(e=e.slice(0,e.length-4));if(i&&t){g||=String.fromCharCode(...p);n=!0;e=`${e}(?=[${g}]|[^\\p{M}]|$)`}return[n,e]}#Ce(e){let t=this.#Pe;if(0===t.length)return;const{caseSensitive:i,entireWord:n}=this.#ue,s=this._pageContents[e],r=this._hasDiacritics[e];let a=!1;"string"==typeof t?[a,t]=this.#_e(t,r):t=t.sort().reverse().map((e=>{const[t,i]=this.#_e(e,r);a||=t;return`(${i})`})).join("|");t=t?new RegExp(t,`g${a?"u":""}${i?"":"i"}`):null;this.#Ee(t,n,e,s);this.#ue.highlightAll&&this.#xe(e);if(this._resumePageIdx===e){this._resumePageIdx=null;this.#Te()}const o=this._pageMatches[e].length;this._matchesCountTotal+=o;this.#pe?o>0&&this.#Le():++this.#ge===this._linkService.pagesCount&&this.#Le()}#be(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();const t={disableNormalization:!0};for(let i=0,n=this._linkService.pagesCount;i<n;i++){const n=new a.PromiseCapability;this._extractTextPromises[i]=n.promise;e=e.then((()=>this._pdfDocument.getPage(i+1).then((e=>e.getTextContent(t))).then((e=>{const t=[];for(const i of e.items){t.push(i.str);i.hasEOL&&t.push("\n")}[this._pageContents[i],this._pageDiffs[i],this._hasDiacritics[i]]=normalize(t.join(""));n.resolve()}),(e=>{console.error(`Unable to get text content for page ${i+1}`,e);this._pageContents[i]="";this._pageDiffs[i]=null;this._hasDiacritics[i]=!1;n.resolve()}))))}}#xe(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1);this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}#ye(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#ve(){const e=this.#ue.findPrevious,t=this._linkService.page-1,i=this._linkService.pagesCount;this._highlightMatches=!0;if(this._dirtyMatch){this._dirtyMatch=!1;this._selected.pageIdx=this._selected.matchIdx=-1;this._offset.pageIdx=t;this._offset.matchIdx=null;this._offset.wrapped=!1;this._resumePageIdx=null;this._pageMatches.length=0;this._pageMatchesLength.length=0;this.#ge=0;this._matchesCountTotal=0;this.#ye();for(let e=0;e<i;e++)if(!this._pendingFindMatches.has(e)){this._pendingFindMatches.add(e);this._extractTextPromises[e].then((()=>{this._pendingFindMatches.delete(e);this.#Ce(e)}))}}if(0===this.#Pe.length){this.#t(l.FOUND);return}if(this._resumePageIdx)return;const n=this._offset;this._pagesToSearch=i;if(null!==n.matchIdx){const t=this._pageMatches[n.pageIdx].length;if(!e&&n.matchIdx+1<t||e&&n.matchIdx>0){n.matchIdx=e?n.matchIdx-1:n.matchIdx+1;this.#Ie(!0);return}this.#Me(e)}this.#Te()}#Ae(e){const t=this._offset,i=e.length,n=this.#ue.findPrevious;if(i){t.matchIdx=n?i-1:0;this.#Ie(!0);return!0}this.#Me(n);if(t.wrapped){t.matchIdx=null;if(this._pagesToSearch<0){this.#Ie(!1);return!0}}return!1}#Te(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;e=this._pageMatches[t];if(!e){this._resumePageIdx=t;break}}while(!this.#Ae(e))}#Me(e){const t=this._offset,i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1;t.matchIdx=null;this._pagesToSearch--;if(t.pageIdx>=i||t.pageIdx<0){t.pageIdx=e?i-1:0;t.wrapped=!0}}#Ie(e=!1){let t=l.NOT_FOUND;const i=this._offset.wrapped;this._offset.wrapped=!1;if(e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx;this._selected.matchIdx=this._offset.matchIdx;t=i?l.WRAPPED:l.FOUND;-1!==e&&e!==this._selected.pageIdx&&this.#xe(e)}this.#t(t,this.#ue.findPrevious);if(-1!==this._selected.pageIdx){this._scrollMatches=!0;this.#xe(this._selected.pageIdx)}}#me(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{if(this._pdfDocument&&(!t||this._pdfDocument===t)){if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(this._resumePageIdx){this._resumePageIdx=null;this._dirtyMatch=!0}this.#t(l.FOUND);this._highlightMatches=!1;this.#ye()}}))}#De(){const{pageIdx:e,matchIdx:t}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)i+=this._pageMatches[t]?.length||0;i+=t+1}(i<1||i>n)&&(i=n=0);return{current:i,total:n}}#Le(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#De()})}#t(e,t=!1){(this.#pe||this.#ge===this._linkService.pagesCount&&e!==l.PENDING)&&this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this.#De(),rawQuery:this.#ue?.query??null})}}n()}catch(C){n(C)}}))},6839:(e,t,i)=>{i.d(t,{getCharacterType:()=>getCharacterType,getNormalizeWithNFKC:()=>getNormalizeWithNFKC});const n={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};function getCharacterType(e){return function isAlphabeticalScript(e){return e<11904}(e)?function isAscii(e){return 0==(65408&e)}(e)?function isAsciiSpace(e){return 32===e||9===e||13===e||10===e}(e)?n.SPACE:function isAsciiAlpha(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function isAsciiDigit(e){return e>=48&&e<=57}(e)||95===e?n.ALPHA_LETTER:n.PUNCT:function isThai(e){return 3584==(65408&e)}(e)?n.THAI_LETTER:160===e?n.SPACE:n.ALPHA_LETTER:function isHan(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e)?n.HAN_LETTER:function isKatakana(e){return e>=12448&&e<=12543}(e)?n.KATAKANA_LETTER:function isHiragana(e){return e>=12352&&e<=12447}(e)?n.HIRAGANA_LETTER:function isHalfwidthKatakana(e){return e>=65376&&e<=65439}(e)?n.HALFWIDTH_KATAKANA_LETTER:n.ALPHA_LETTER}let s;function getNormalizeWithNFKC(){s||=" ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩";return s}},6418:(e,t,i)=>{i.d(t,{PDFHistory:()=>PDFHistory});var n=i(4927),s=i(6554);function getCurrentHash(){return document.location.hash}class PDFHistory{constructor({linkService:e,eventBus:t}){this.linkService=e;this.eventBus=t;this._initialized=!1;this._fingerprint="";this.reset();this._boundEvents=null;this.eventBus._on("pagesinit",(()=>{this._isPagesLoaded=!1;this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount}),{once:!0})}))}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:i=!1}){if(!e||"string"!=typeof e){globalThis.ngxConsole.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const n=""!==this._fingerprint&&this._fingerprint!==e;this._fingerprint=e;this._updateUrl=!0===i;this._initialized=!0;this._bindEvents();const s=window.history.state;this._popStateInProgress=!1;this._blockHashChange=0;this._currentHash=getCurrentHash();this._numPositionUpdates=0;this._uid=this._maxUid=0;this._destination=null;this._position=null;if(!this._isValidState(s,!0)||t){const{hash:e,page:i,rotation:s}=this._parseCurrentHash(!0);if(!e||n||t){this._pushOrReplaceState(null,!0);return}this._pushOrReplaceState({hash:e,page:i,rotation:s},!0);return}const r=s.destination;this._updateInternalState(r,s.uid,!0);void 0!==r.rotation&&(this._initialRotation=r.rotation);if(r.dest){this._initialBookmark=JSON.stringify(r.dest);this._destination.page=null}else r.hash?this._initialBookmark=r.hash:r.page&&(this._initialBookmark=`page=${r.page}`)}reset(){if(this._initialized){this._pageHide();this._initialized=!1;this._unbindEvents()}if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._initialBookmark=null;this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:i}){if(!this._initialized)return;if(e&&"string"!=typeof e){globalThis.ngxConsole.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);return}if(!Array.isArray(t)){globalThis.ngxConsole.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}if(!this._isValidPage(i)&&(null!==i||this._destination)){globalThis.ngxConsole.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);return}const s=e||JSON.stringify(t);if(!s)return;let r=!1;if(this._destination&&(function isDestHashesEqual(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;if(e===t)return!0;if((0,n.parseQueryString)(e).get("nameddest")===t)return!0;return!1}(this._destination.hash,s)||function isDestArraysEqual(e,t){function isEntryEqual(e,t){if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"==typeof e&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!isEntryEqual(e[i],t[i]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(!isEntryEqual(e[i],t[i]))return!1;return!0}(this._destination.dest,t))){if(this._destination.page)return;r=!0}if(!this._popStateInProgress||r){this._pushOrReplaceState({dest:t,hash:s,page:i,rotation:this.linkService.rotation},r);if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}pushPage(e){if(this._initialized)if(this._isValidPage(e)){if(this._destination?.page!==e&&!this._popStateInProgress){this._pushOrReplaceState({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation});if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}else globalThis.ngxConsole.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`)}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){const i=t||!this._destination,n={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:e};this._updateInternalState(e,n.uid);let s;if(this._updateUrl&&e?.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(s=`${t}#${e.hash}`)}i?window.history.replaceState(n,"",s):window.history.pushState(n,"",s)}_tryPushCurrentPosition(e=!1){if(!this._position)return;let t=this._position;if(e){t=Object.assign(Object.create(null),this._position);t.temporary=!0}if(!this._destination){this._pushOrReplaceState(t);return}if(this._destination.temporary){this._pushOrReplaceState(t,!0);return}if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}this._pushOrReplaceState(t,i)}_isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}_isValidState(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&(null!==e.destination&&"object"==typeof e.destination)}_updateInternalState(e,t,i=!1){if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}i&&e?.temporary&&delete e.temporary;this._destination=e;this._uid=t;this._maxUid=Math.max(this._maxUid,t);this._numPositionUpdates=0}_parseCurrentHash(e=!1){const t=unescape(getCurrentHash()).substring(1),i=(0,n.parseQueryString)(t),s=i.get("nameddest")||"";let r=0|i.get("page");(!this._isValidPage(r)||e&&s.length>0)&&(r=null);return{hash:t,page:r,rotation:this.linkService.rotation}}_updateViewarea({location:e}){if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation};if(!this._popStateInProgress){this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++;this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0);this._updateViewareaTimeout=null}),1e3)}}_popState({state:e}){const t=getCurrentHash(),i=this._currentHash!==t;this._currentHash=t;if(!e){this._uid++;const{hash:e,page:t,rotation:i}=this._parseCurrentHash();this._pushOrReplaceState({hash:e,page:t,rotation:i},!0);return}if(!this._isValidState(e))return;this._popStateInProgress=!0;if(i){this._blockHashChange++;(0,s.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--}))}const r=e.destination;this._updateInternalState(r,e.uid,!0);(0,n.isValidRotation)(r.rotation)&&(this.linkService.rotation=r.rotation);r.dest?this.linkService.goToDestination(r.dest):r.hash?this.linkService.setHash(r.hash):r.page&&(this.linkService.page=r.page);Promise.resolve().then((()=>{this._popStateInProgress=!1}))}_pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}_bindEvents(){if(!this._boundEvents){this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)};this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea);window.addEventListener("popstate",this._boundEvents.popState);window.addEventListener("pagehide",this._boundEvents.pageHide)}}_unbindEvents(){if(this._boundEvents){this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea);window.removeEventListener("popstate",this._boundEvents.popState);window.removeEventListener("pagehide",this._boundEvents.pageHide);this._boundEvents=null}}}},3706:(e,t,i)=>{i.d(t,{PDFLayerViewer:()=>PDFLayerViewer});var n=i(9415);class PDFLayerViewer extends n.BaseTreeViewer{constructor(e){super(e);this.eventBus._on("optionalcontentconfigchanged",(e=>{this.#Ne(e.promise)}));this.eventBus._on("resetlayers",(()=>{this.#Ne()}));this.eventBus._on("togglelayerstree",this._toggleAllTreeItems.bind(this))}reset(){super.reset();this._optionalContentConfig=null;this._optionalContentHash=null}_dispatchEvent(e){this.eventBus.dispatch("layersloaded",{source:this,layersCount:e})}_bindLink(e,{groupId:t,input:i}){const setVisibility=()=>{this._optionalContentConfig.setVisibility(t,i.checked);this._optionalContentHash=this._optionalContentConfig.getHash();this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(this._optionalContentConfig)})};e.onclick=t=>{if(t.target===i){setVisibility();return!0}if(t.target!==e)return!0;i.checked=!i.checked;setVisibility();return!1}}async _setNestedName(e,{name:t=null}){if("string"!=typeof t){e.textContent=await this._l10n.get("pdfjs-additional-layers");e.style.fontStyle="italic"}else e.textContent=this._normalizeTextContent(t)}_addToggleButton(e,{name:t=null}){super._addToggleButton(e,null===t)}_toggleAllTreeItems(){this._optionalContentConfig&&super._toggleAllTreeItems()}render({optionalContentConfig:e,pdfDocument:t}){this._optionalContentConfig&&this.reset();this._optionalContentConfig=e||null;this._pdfDocument=t||null;const i=e?.getOrder();if(!i){this._dispatchEvent(0);return}this._optionalContentHash=e.getHash();const n=document.createDocumentFragment(),s=[{parent:n,groups:i}];let r=0,a=!1;for(;s.length>0;){const t=s.shift();for(const i of t.groups){const n=document.createElement("div");n.className="treeItem";const o=document.createElement("a");n.append(o);if("object"==typeof i){a=!0;this._addToggleButton(n,i);this._setNestedName(o,i);const e=document.createElement("div");e.className="treeItems";n.append(e);s.push({parent:e,groups:i.order})}else{const t=e.getGroup(i),n=document.createElement("input");this._bindLink(o,{groupId:i,input:n});n.type="checkbox";n.checked=t.visible;const s=document.createElement("label");s.textContent=this._normalizeTextContent(t.name);s.append(n);o.append(s);r++}t.parent.append(n)}}this._finishRendering(n,r,a)}async#Ne(e=null){if(!this._optionalContentConfig)return;const t=this._pdfDocument,i=await(e||t.getOptionalContentConfig());if(t===this._pdfDocument){if(e){if(i.getHash()===this._optionalContentHash)return}else this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(i)});this.render({optionalContentConfig:i,pdfDocument:this._pdfDocument})}}}},3234:(e,t,i)=>{i.d(t,{LinkTarget:()=>s,PDFLinkService:()=>PDFLinkService,SimpleLinkService:()=>SimpleLinkService});var n=i(4927);const s={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};function addLinkAttributes(e,{url:t,target:i,rel:n,enabled:r=!0}={}){if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');if(r)e.href=e.title=t;else{e.href="";e.title=`Disabled: ${t}`;e.onclick=()=>!1}let a="";switch(i){case s.NONE:break;case s.SELF:a="_self";break;case s.BLANK:a="_blank";break;case s.PARENT:a="_parent";break;case s.TOP:a="_top"}e.target=a;e.rel="string"==typeof n?n:"noopener noreferrer nofollow"}class PDFLinkService{#Be=new Map;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}={}){this.eventBus=e;this.externalLinkTarget=t;this.externalLinkRel=i;this.externalLinkEnabled=!0;this._ignoreDestinationZoom=n;this.baseUrl=null;this.pdfDocument=null;this.pdfViewer=null;this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t;this.pdfDocument=e;this.#Be.clear()}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfViewer.currentPageNumber}set page(e){this.pdfViewer.currentPageNumber=e}get rotation(){return this.pdfViewer.pagesRotation}set rotation(e){this.pdfViewer.pagesRotation=e}get isInPresentationMode(){return this.pdfViewer.isInPresentationMode}#ke(e,t=null,i){const n=i[0];let s;if("object"==typeof n&&null!==n){s=this._cachedPageNumber(n);if(!s){this.pdfDocument.getPageIndex(n).then((s=>{this.cachePageRef(s+1,n);this.#ke(e,t,i)})).catch((()=>{globalThis.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid page reference, for dest="${e}".`)}));return}}else{if(!Number.isInteger(n)){globalThis.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid destination reference, for dest="${e}".`);return}s=n+1}if(!s||s<1||s>this.pagesCount)globalThis.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${s}" is not a valid page number, for dest="${e}".`);else{if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:s})}this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom})}}async goToDestination(e){if(!this.pdfDocument)return;let t,i;if("string"==typeof e){t=e;i=await this.pdfDocument.getDestination(e)}else{t=null;i=await e}Array.isArray(i)?this.#ke(e,t,i):globalThis.ngxConsole.error(`PDFLinkService.goToDestination: "${i}" is not a valid destination array, for dest="${e}".`)}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;if(Number.isInteger(t)&&t>0&&t<=this.pagesCount){if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.pushPage(t)}if("book"===this.pdfViewer.pageViewMode){if(this.pdfViewer.pageFlip){this.pdfViewer.ensureAdjacentPagesAreLoaded();const e=this.pdfViewer.currentPageNumber-this.pdfViewer.currentPageNumber%2,i=t-t%2;e===i-2?this.pdfViewer.pageFlip.flipNext():e===i+2?this.pdfViewer.pageFlip.flipPrev():this.pdfViewer.pageFlip.turnToPage(t-1)}}else this.pdfViewer.scrollPageIntoView({pageNumber:t})}else globalThis.ngxConsole.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t,i=!1){addLinkAttributes(e,{url:t,target:i?s.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return this.baseUrl?this.baseUrl+e:e}setHash(e){if(!this.pdfDocument)return;let t,i;if(e.includes("=")){const s=(0,n.parseQueryString)(e);if(s.has("search")){const e=s.get("search").replaceAll('"',""),t="true"===s.get("phrase");this.eventBus.dispatch("findfromurlhash",{source:this,query:t?e:e.match(/\S+/g)})}s.has("page")&&(t=0|s.get("page")||1);if(s.has("zoom")){const e=s.get("zoom").split(","),t=e[0],n=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?i=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?i=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?globalThis.ngxConsole.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:globalThis.ngxConsole.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):i=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,n?n/100:t]}i?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:i,allowNegativeOffset:!0}):t&&(this.page=t);s.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:s.get("pagemode")});s.has("nameddest")&&this.goToDestination(s.get("nameddest"))}else{i=unescape(e);try{i=JSON.parse(i);Array.isArray(i)||(i=i.toString())}catch{}"string"==typeof i||PDFLinkService.#Ve(i)?this.goToDestination(i):console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":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}this.eventBus.dispatch("namedaction",{source:this,action:e})}async executeSetOCGState(e){const t=this.pdfDocument,i=await this.pdfViewer.optionalContentConfigPromise;if(t!==this.pdfDocument)return;let n;for(const t of e.state){switch(t){case"ON":case"OFF":case"Toggle":n=t;continue}switch(n){case"ON":i.setVisibility(t,!0);break;case"OFF":i.setVisibility(t,!1);break;case"Toggle":const e=i.getGroup(t);e&&i.setVisibility(t,!e.visible)}}this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i)}cachePageRef(e,t){if(!t)return;const i=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;this.#Be.set(i,e)}_cachedPageNumber(e){if(!e)return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#Be.get(t)||null}static#Ve(e){if(!Array.isArray(e))return!1;const t=e.length;if(t<2)return!1;const i=e[0];if(!("object"==typeof i&&Number.isInteger(i.num)&&Number.isInteger(i.gen)||Number.isInteger(i)&&i>=0))return!1;const n=e[1];if("object"!=typeof n||"string"!=typeof n.name)return!1;let s=!0;switch(n.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;s=!1;break;default:return!1}for(let i=2;i<t;i++){const t=e[i];if(!("number"==typeof t||s&&null===t))return!1}return!0}}class SimpleLinkService{constructor(){this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}get isInPresentationMode(){return!1}async goToDestination(e){}goToPage(e){}addLinkAttributes(e,t,i=!1){addLinkAttributes(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}executeSetOCGState(e){}cachePageRef(e,t){}}},1141:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFOutlineViewer:()=>PDFOutlineViewer});var s=i(9415),r=i(1869),a=i(4927),o=e([r]);r=(o.then?(await o)():o)[0];class PDFOutlineViewer extends s.BaseTreeViewer{constructor(e){super(e);this.linkService=e.linkService;this.downloadManager=e.downloadManager;this.eventBus._on("toggleoutlinetree",this._toggleAllTreeItems.bind(this));this.eventBus._on("currentoutlineitem",this._currentOutlineItem.bind(this));this.eventBus._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount;this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded)}));this.eventBus._on("sidebarviewchanged",(e=>{this._sidebarView=e.view}))}reset(){super.reset();this._outline=null;this._pageNumberToDestHashCapability=null;this._currentPageNumber=1;this._isPagesLoaded=null;this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(!1);this._currentOutlineItemCapability=null}_dispatchEvent(e){this._currentOutlineItemCapability=new r.PromiseCapability;0===e||this._pdfDocument?.loadingParams.disableAutoFetch?this._currentOutlineItemCapability.resolve(!1):null!==this._isPagesLoaded&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded);this.eventBus.dispatch("outlineloaded",{source:this,outlineCount:e,currentOutlineItemPromise:this._currentOutlineItemCapability.promise})}_bindLink(e,{url:t,newWindow:i,action:n,attachment:s,dest:r,setOCGState:a}){const{linkService:o}=this;if(t)o.addLinkAttributes(e,t,i);else if(n){e.href=o.getAnchorUrl("");e.onclick=()=>{o.executeNamedAction(n);return!1}}else if(s){e.href=o.getAnchorUrl("");e.onclick=()=>{this.downloadManager.openOrDownloadData(s.content,s.filename);return!1}}else if(a){e.href=o.getAnchorUrl("");e.onclick=()=>{o.executeSetOCGState(a);return!1}}else{e.href=o.getDestinationHash(r);e.onclick=e=>{this._updateCurrentTreeItem(e.target.parentNode);r&&o.goToDestination(r);return!1}}}_setStyles(e,{bold:t,italic:i}){t&&(e.style.fontWeight="bold");i&&(e.style.fontStyle="italic")}_addToggleButton(e,{count:t,items:i}){let n=!1;if(t<0){let e=i.length;if(e>0){const t=[...i];for(;t.length>0;){const{count:i,items:n}=t.shift();if(i>0&&n.length>0){e+=n.length;t.push(...n)}}}Math.abs(t)===e&&(n=!0)}super._addToggleButton(e,n)}_toggleAllTreeItems(){this._outline&&super._toggleAllTreeItems()}render({outline:e,pdfDocument:t}){this._outline&&this.reset();this._outline=e||null;this._pdfDocument=t||null;if(!e){this._dispatchEvent(0);return}const i=document.createDocumentFragment(),n=[{parent:i,items:e}];let s=0,r=!1;for(;n.length>0;){const e=n.shift();for(const t of e.items){const i=document.createElement("div");i.className="treeItem";const a=document.createElement("a");this._bindLink(a,t);this._setStyles(a,t);a.textContent=this._normalizeTextContent(t.title);i.append(a);if(t.items.length>0){r=!0;this._addToggleButton(i,t);const e=document.createElement("div");e.className="treeItems";i.append(e);n.push({parent:e,items:t.items})}e.parent.append(i);s++}}this._finishRendering(i,s,r)}async _currentOutlineItem(){if(!this._isPagesLoaded)throw new Error("_currentOutlineItem: All pages have not been loaded.");if(!this._outline||!this._pdfDocument)return;const e=await this._getPageNumberToDestHash(this._pdfDocument);if(e){this._updateCurrentTreeItem(null);if(this._sidebarView===a.SidebarView.OUTLINE)for(let t=this._currentPageNumber;t>0;t--){const i=e.get(t);if(!i)continue;const n=this.container.querySelector(`a[href="${i}"]`);if(n){this._scrollToCurrentTreeItem(n.parentNode);break}}}}async _getPageNumberToDestHash(e){if(this._pageNumberToDestHashCapability)return this._pageNumberToDestHashCapability.promise;this._pageNumberToDestHashCapability=new r.PromiseCapability;const t=new Map,i=new Map,n=[{nesting:0,items:this._outline}];for(;n.length>0;){const s=n.shift(),r=s.nesting;for(const{dest:a,items:o}of s.items){let s,l;if("string"==typeof a){s=await e.getDestination(a);if(e!==this._pdfDocument)return null}else s=a;if(Array.isArray(s)){const[n]=s;if("object"==typeof n&&null!==n){l=this.linkService._cachedPageNumber(n);if(!l)try{l=await e.getPageIndex(n)+1;if(e!==this._pdfDocument)return null;this.linkService.cachePageRef(l,n)}catch{}}else Number.isInteger(n)&&(l=n+1);if(Number.isInteger(l)&&(!t.has(l)||r>i.get(l))){const e=this.linkService.getDestinationHash(a);t.set(l,e);i.set(l,r)}}o.length>0&&n.push({nesting:r+1,items:o})}}this._pageNumberToDestHashCapability.resolve(t.size>0?t:null);return this._pageNumberToDestHashCapability.promise}}n()}catch(e){n(e)}}))},6732:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFPageView:()=>PDFPageView});var s=i(1869),r=i(4927),a=i(2640),o=i(6735),l=i(8961),h=i(758),d=i(7910),c=(i(3234),i(7498)),u=i(4630),p=i(1483),g=i(3266),f=i(4274),m=i(1013),w=i(8012),b=e([s,a,o,h,d,m,w]);[s,a,o,h,d,m,w]=b.then?(await b)():b;const v=l.compatibilityParams.maxCanvasPixels||16777216,y=null;class PDFPageView{#Fe=s.AnnotationMode.ENABLE_FORMS;#Re=!1;#Oe=null;#He=null;#Ue=null;#ze=null;#je=r.RenderingStates.INITIAL;#We=r.TextLayerMode.ENABLE;#$e={directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0};#Ge=new WeakMap;constructor(e){const t=e.container,i=e.defaultViewport;this.id=e.id;this.renderingId="page"+this.id;this.#Oe=e.layerProperties||y;this.pdfPage=null;this.pageLabel=null;this.rotation=0;this.scale=e.scale||r.DEFAULT_SCALE;this.viewport=i;this.pdfPageRotate=i.rotation;this._optionalContentConfigPromise=e.optionalContentConfigPromise||null;this.#We=e.textLayerMode??r.TextLayerMode.ENABLE;this.#Fe=e.annotationMode??s.AnnotationMode.ENABLE_FORMS;this.imageResourcesPath=e.imageResourcesPath||"";this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0;this.maxCanvasPixels=e.maxCanvasPixels??v;this.pageColors=e.pageColors||null;this.eventBus=e.eventBus;this.renderingQueue=e.renderingQueue;this.l10n=e.l10n||d.NullL10n;this.renderTask=null;this.resume=null;this._isStandalone=!this.renderingQueue?.hasViewer();this._container=t;this._annotationCanvasMap=null;this.annotationLayer=null;this.annotationEditorLayer=null;this.textLayer=null;this.zoomLayer=null;this.xfaLayer=null;this.structTreeLayer=null;this.drawLayer=null;const n=document.createElement("div");n.className="page";n.setAttribute("data-page-number",this.id);n.setAttribute("role","region");n.setAttribute("data-l10n-id","pdfjs-page-landmark");n.setAttribute("data-l10n-args",JSON.stringify({page:this.id}));this.div=n;this.#Ke();t?.append(n);if(this._isStandalone){t?.style.setProperty("--scale-factor",this.scale*s.PixelsPerInch.PDF_TO_CSS_UNITS);const{optionalContentConfigPromise:i}=e;i&&i.then((e=>{i===this._optionalContentConfigPromise&&(this.#$e.initialOptionalContent=e.hasInitialVisibility)}));this.l10n===d.NullL10n&&this.l10n.translate(this.div)}}get renderingState(){return this.#je}set renderingState(e){if(e!==this.#je){this.#je=e;if(this.#He){clearTimeout(this.#He);this.#He=null}switch(e){case r.RenderingStates.PAUSED:this.div.classList.remove("loading");break;case r.RenderingStates.RUNNING:this.div.classList.add("loadingIcon");this.#He=setTimeout((()=>{this.div.classList.add("loading");this.#He=null}),0);break;case r.RenderingStates.INITIAL:case r.RenderingStates.FINISHED:this.div.classList.remove("loadingIcon","loading")}}}#Ke(){const{viewport:e}=this;if(this.pdfPage){if(this.#Ue===e.rotation)return;this.#Ue=e.rotation}(0,s.setLayerDimensions)(this.div,e,!0,!1)}setPdfPage(e){!this._isStandalone||"CanvasText"!==this.pageColors?.foreground&&"Canvas"!==this.pageColors?.background||this._container?.style.setProperty("--hcm-highlight-filter",e.filterFactory.addHighlightHCMFilter("CanvasText","Canvas","HighlightText","Highlight"));this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*s.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:t});this.#Ke();this.reset()}destroy(){this.reset();this.pdfPage?.cleanup()}get _textHighlighter(){return(0,s.shadow)(this,"_textHighlighter",new f.TextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#Oe.findController}))}async#Ze(){let e=null;try{await this.annotationLayer.render(this.viewport,"display")}catch(t){console.error(`#renderAnnotationLayer: "${t}".`);e=t}finally{this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:e})}}async#qe(){let e=null;try{await this.annotationEditorLayer.render(this.viewport,"display")}catch(t){console.error(`#renderAnnotationEditorLayer: "${t}".`);e=t}finally{this.eventBus.dispatch("annotationeditorlayerrendered",{source:this,pageNumber:this.id,error:e})}}async#Xe(){try{await this.drawLayer.render("display")}catch(e){console.error(`#renderDrawLayer: "${e}".`)}}async#Qe(){let e=null;try{const e=await this.xfaLayer.render(this.viewport,"display");e?.textDivs&&this._textHighlighter&&this.#Ye(e.textDivs)}catch(t){console.error(`#renderXfaLayer: "${t}".`);e=t}finally{if(this.xfaLayer?.div){this.l10n.pause();this.div.append(this.xfaLayer.div);this.l10n.resume()}this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:e})}}async#Je(){const{pdfPage:e,textLayer:t,viewport:i}=this;if(!t)return;let n=null;try{if(!t.renderingDone){const i=e.streamTextContent({includeMarkedContent:!0,disableNormalization:!0});t.setTextContentSource(i)}await t.render(i)}catch(e){if(e instanceof s.AbortException)return;console.error(`#renderTextLayer: "${e}".`);n=e}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.id,numTextDivs:t.numTextDivs,error:n});this.#et()}async#et(){if(!this.textLayer)return;this.structTreeLayer||=new c.StructTreeLayerBuilder;const e=await(this.structTreeLayer.renderingDone?null:this.pdfPage.getStructTree()),t=this.structTreeLayer?.render(e);if(t){this.l10n.pause();this.canvas?.append(t);this.l10n.resume()}this.structTreeLayer?.show()}async#Ye(e){const t=await this.pdfPage.getTextContent(),i=[];for(const e of t.items)i.push(e.str);this._textHighlighter.setTextMapping(e,i);this._textHighlighter.enable()}_resetZoomLayer(e=!1){if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.#Ge.delete(t);t.width=0;t.height=0;e&&this.zoomLayer.remove();this.zoomLayer=null}reset({keepZoomLayer:e=!1,keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:n=!1,keepTextLayer:s=!1}={}){this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:i,keepXfaLayer:n,keepTextLayer:s});this.renderingState=r.RenderingStates.INITIAL;const a=this.div,o=a.childNodes,l=e&&this.zoomLayer||null,h=t&&this.annotationLayer?.div||null,d=i&&this.annotationEditorLayer?.div||null,c=n&&this.xfaLayer?.div||null,u=s&&this.textLayer?.div||null;for(let e=o.length-1;e>=0;e--){const t=o[e];switch(t){case l:case h:case d:case c:case u:continue}t.remove()}a.removeAttribute("data-loaded");h&&this.annotationLayer.hide();d&&this.annotationEditorLayer.hide();c&&this.xfaLayer.hide();u&&this.textLayer.hide();this.structTreeLayer?.hide();if(!l){if(this.canvas){this.#Ge.delete(this.canvas);this.canvas.width=0;this.canvas.height=0;delete this.canvas}this._resetZoomLayer()}}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:i=null,drawingDelay:n=-1}){this.scale=e||this.scale;"number"==typeof t&&(this.rotation=t);if(i instanceof Promise){this._optionalContentConfigPromise=i;i.then((e=>{i===this._optionalContentConfigPromise&&(this.#$e.initialOptionalContent=e.hasInitialVisibility)}))}this.#$e.directDrawing=!0;const a=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:this.scale*s.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:a});this.#Ke();this._isStandalone&&this._container?.style.setProperty("--scale-factor",this.viewport.scale);if(this.canvas){let e=!1;if(this.#Re)if(0===this.maxCanvasPixels)e=!0;else if(this.maxCanvasPixels>0){const{width:t,height:i}=this.viewport,{sx:n,sy:s}=this.outputScale;e=(Math.floor(t)*n|0)*(Math.floor(i)*s|0)>this.maxCanvasPixels}const t=!e&&n>=0&&n<1e3;if(t||e){if(t&&this.renderingState!==r.RenderingStates.FINISHED){this.cancelRendering({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:n});this.renderingState=r.RenderingStates.FINISHED;this.#$e.directDrawing=!1}this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!t,hideTextLayer:t});if(t)return;this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this.#ze});return}if(!this.zoomLayer&&!this.canvas.hidden){this.zoomLayer=this.canvas.parentNode;this.zoomLayer.style.position="absolute"}}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild});this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:s=0}={}){if(this.renderTask){this.renderTask.cancel(s);this.renderTask=null}this.resume=null;if(this.textLayer&&(!n||!this.textLayer.div)){this.textLayer.cancel();this.textLayer=null}this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null);if(this.annotationLayer&&(!e||!this.annotationLayer.div)){this.annotationLayer.cancel();this.annotationLayer=null;this._annotationCanvasMap=null}if(this.annotationEditorLayer&&(!t||!this.annotationEditorLayer.div)){if(this.drawLayer){this.drawLayer.cancel();this.drawLayer=null}this.annotationEditorLayer.cancel();this.annotationEditorLayer=null}if(this.xfaLayer&&(!i||!this.xfaLayer.div)){this.xfaLayer.cancel();this.xfaLayer=null;this._textHighlighter?.disable()}}cssTransform({target:e,redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:n=!1,redrawTextLayer:s=!1,hideTextLayer:r=!1}){if(!e.hasAttribute("zooming")){e.setAttribute("zooming",!0);const{style:t}=e;t.width=t.height=""}const a=this.#Ge.get(e);if(this.viewport!==a){const t=this.viewport.rotation-a.rotation,i=Math.abs(t);let n=1,s=1;if(90===i||270===i){const{width:e,height:t}=this.viewport;n=t/e;s=e/t}e.style.transform=`rotate(${t}deg) scale(${n}, ${s})`}t&&this.annotationLayer&&this.#Ze();if(i&&this.annotationEditorLayer){this.drawLayer&&this.#Xe();this.#qe()}n&&this.xfaLayer&&this.#Qe();if(this.textLayer)if(r){this.textLayer.hide();this.structTreeLayer?.hide()}else s&&this.#Je()}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}async#tt(e,t=null){e===this.renderTask&&(this.renderTask=null);if(t instanceof s.RenderingCancelledException)this.#ze=null;else{this.#ze=t;this.renderingState=r.RenderingStates.FINISHED;this._resetZoomLayer(!0);this.#$e.regularAnnotations=!e.separateAnnots;this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this.#ze});if(t)throw t}}async draw(){if(this.renderingState!==r.RenderingStates.INITIAL){globalThis.ngxConsole.error("Must be in new state before drawing");this.reset()}const{div:e,l10n:t,pageColors:i,pdfPage:n,viewport:l}=this;if(!n){this.renderingState=r.RenderingStates.FINISHED;throw new Error("pdfPage is not loaded")}this.renderingState=r.RenderingStates.RUNNING;const d=document.createElement("div");d.classList.add("canvasWrapper");e.append(d);if(!this.textLayer&&this.#We!==r.TextLayerMode.DISABLE&&!n.isPureXfa){this._accessibilityManager||=new u.TextAccessibilityManager;this.textLayer=new m.TextLayerBuilder({highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,enablePermissions:this.#We===r.TextLayerMode.ENABLE_PERMISSIONS});this.textLayer.onAppend=e=>{this.l10n.pause();this.div.append(e);this.l10n.resume()}}if(!this.annotationLayer&&this.#Fe!==s.AnnotationMode.DISABLE){const{annotationStorage:t,downloadManager:i,enableScripting:r,fieldObjectsPromise:a,hasJSActionsPromise:l,linkService:h}=this.#Oe;this._annotationCanvasMap||=new Map;this.annotationLayer=new o.AnnotationLayerBuilder({pageDiv:e,pdfPage:n,annotationStorage:t,imageResourcesPath:this.imageResourcesPath,renderForms:this.#Fe===s.AnnotationMode.ENABLE_FORMS,linkService:h,downloadManager:i,enableScripting:r,hasJSActionsPromise:l,fieldObjectsPromise:a,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager})}let{width:c,height:f}=l;const b=document.createElement("canvas");b.setAttribute("role","presentation");b.hidden=!0;const v=!(!i?.background||!i?.foreground);let showCanvas=e=>{if(!v||e){b.hidden=!1;showCanvas=null}};d.append(b);this.canvas=b;const y=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1},P=b.getContext("2d",y),S=this.outputScale=new r.OutputScale;if(0===this.maxCanvasPixels){const e=1/this.scale;S.sx*=e;S.sy*=e;this.#Re=!0}else if(this.maxCanvasPixels>0){const e=c*f,t=Math.sqrt(this.maxCanvasPixels/e);if(S.sx>t||S.sy>t){S.sx=t;S.sy=t;this.#Re=!0}else this.#Re=!1}const E=(0,r.approximateFraction)(S.sx),_=(0,r.approximateFraction)(S.sy);c=(0,r.roundToDivide)(c*S.sx,E[0]);f=(0,r.roundToDivide)(f*S.sy,_[0]);let C=1;if((c>=4096||f>=4096)&&(this.maxWidth||!p.default.test({width:c,height:f}))){const e=this.determineMaxDimensions();C=Math.max(c/e,f/e);if(C>1){const e=Math.floor(100*this.scale/C)/100;C=this.scale/e;l.width/=C;l.height/=C;(0,g.warn)(`Page ${this.id}: Reduced the maximum zoom to ${e} because the browser can't render larger canvases.`)}else C=1}b.width=(0,r.roundToDivide)(l.width*S.sx,E[0]);b.height=(0,r.roundToDivide)(l.height*S.sy,_[0]);const{style:x}=b;x.width=(0,r.roundToDivide)(l.width,E[1])+"px";x.height=(0,r.roundToDivide)(l.height,_[1])+"px";this.#Ge.set(b,l);const T={canvasContext:P,transform:S.scaled?[S.sx,0,0,S.sy,0,0]:null,viewport:l,annotationMode:this.#Fe,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:i},L=this.renderTask=this.pdfPage.render(T);L.onContinue=e=>{showCanvas?.(!1);if(!this.renderingQueue||this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=r.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=r.RenderingStates.RUNNING;e()}}};const I=L.promise.then((async()=>{showCanvas?.(!0);await this.#tt(L);this.#Je();this.annotationLayer&&await this.#Ze();const{annotationEditorUIManager:i}=this.#Oe;if(i){this.drawLayer||=new h.DrawLayerBuilder({pageIndex:this.id});await this.#Xe();this.drawLayer.setParent(d);this.annotationEditorLayer||(this.annotationEditorLayer=new a.AnnotationEditorLayerBuilder({uiManager:i,pageDiv:e,pdfPage:n,l10n:t,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer()}));this.#qe()}}),(e=>{e instanceof s.RenderingCancelledException||showCanvas?.(!0);return this.#tt(L,e)}));if(n.isPureXfa){if(!this.xfaLayer){const{annotationStorage:e,linkService:t}=this.#Oe;this.xfaLayer=new w.XfaLayerBuilder({pdfPage:n,annotationStorage:e,linkService:t})}this.#Qe()}e.setAttribute("data-loaded",!0);this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id});return I}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id}));null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}determineMaxDimensions(){if(this.maxWidth)return this.maxWidth;const e=[4096,8192,10836,11180,11402,14188,16384];for(const t of e)if(!p.default.test({width:t+1,height:t+1})){this.maxWidth=t;return this.maxWidth}return 16384}get thumbnailCanvas(){const{directDrawing:e,initialOptionalContent:t,regularAnnotations:i}=this.#$e;return e&&t&&i?this.canvas:null}}n()}catch(e){n(e)}}))},323:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFPresentationMode:()=>PDFPresentationMode});var s=i(4927),r=i(1869),a=e([r]);r=(a.then?(await a)():a)[0];const o=3e3,l="pdfPresentationMode",h="pdfPresentationModeControls",d=50,c=.1,u=50,p=Math.PI/6;class PDFPresentationMode{#ue=s.PresentationModeState.UNKNOWN;#it=null;constructor({container:e,pdfViewer:t,eventBus:i}){this.container=e;this.pdfViewer=t;this.eventBus=i;this.contextMenuOpen=!1;this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0;this.touchSwipeState=null}async request(){const{container:e,pdfViewer:t}=this;if(this.active||!t.pagesCount||!e.requestFullscreen)return!1;this.#nt();this.#st(s.PresentationModeState.CHANGING);const i=e.requestFullscreen();this.#it={pageNumber:t.currentPageNumber,scaleValue:t.currentScaleValue,scrollMode:t.scrollMode,spreadMode:null,annotationEditorMode:null};if(!(t.spreadMode===s.SpreadMode.NONE||t.pageViewsReady&&t.hasEqualPageSizes)){console.warn("Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes.");this.#it.spreadMode=t.spreadMode}t.annotationEditorMode!==r.AnnotationEditorType.DISABLE&&(this.#it.annotationEditorMode=t.annotationEditorMode);try{await i;t.focus();return!0}catch{this.#rt();this.#st(s.PresentationModeState.NORMAL)}return!1}get active(){return this.#ue===s.PresentationModeState.CHANGING||this.#ue===s.PresentationModeState.FULLSCREEN}#at(e){if(!this.active)return;e.preventDefault();const t=(0,s.normalizeWheelEventDelta)(e),i=Date.now(),n=this.mouseScrollTimeStamp;if(!(i>n&&i-n<d)){(this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&this.#ot();this.mouseScrollDelta+=t;if(Math.abs(this.mouseScrollDelta)>=c){const e=this.mouseScrollDelta;this.#ot();(e>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}}}#st(e){this.#ue=e;this.eventBus.dispatch("presentationmodechanged",{source:this,state:e})}#lt(){this.#st(s.PresentationModeState.FULLSCREEN);this.container.classList.add(l);setTimeout((()=>{this.pdfViewer.scrollMode=s.ScrollMode.PAGE;null!==this.#it.spreadMode&&(this.pdfViewer.spreadMode=s.SpreadMode.NONE);this.pdfViewer.currentPageNumber=this.#it.pageNumber;this.pdfViewer.currentScaleValue="page-fit";null!==this.#it.annotationEditorMode&&(this.pdfViewer.annotationEditorMode={mode:r.AnnotationEditorType.NONE})}),0);this.#ht();this.#dt();this.contextMenuOpen=!1;window.getSelection().removeAllRanges()}#ct(){const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(l);setTimeout((()=>{this.#rt();this.#st(s.PresentationModeState.NORMAL);this.pdfViewer.scrollMode=this.#it.scrollMode;null!==this.#it.spreadMode&&(this.pdfViewer.spreadMode=this.#it.spreadMode);this.pdfViewer.currentScaleValue=this.#it.scaleValue;this.pdfViewer.currentPageNumber=e;null!==this.#it.annotationEditorMode&&(this.pdfViewer.annotationEditorMode={mode:this.#it.annotationEditorMode});this.#it=null}),0);this.#ut();this.#pt();this.#ot();this.contextMenuOpen=!1}_prepareFullscreenMode(){const e=document.getElementsByClassName("zoom")[0].parentElement,t=e.parentElement;this.ngxContainer=t;for(let i=0;i<t.childElementCount;i++)t.children.item(i)===e&&(this.ngxContainerIndex=i);t.removeChild(e);document.body.append(e);const i=document.body.children;for(let t=0;t<i.length;t++){const n=i.item(t);n!==e&&n instanceof HTMLElement&&n.classList.add("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.add("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.add("hidden-by-fullscreen")}_tidyUpFullscreenMode(){if(this.ngxContainer){const e=document.getElementsByClassName("zoom")[0].parentElement;document.body.removeChild(e);this.ngxContainerIndex>=this.ngxContainer.childElementCount?this.ngxContainer.append(e):this.ngxContainer.insertBefore(e,this.ngxContainer.children.item(this.ngxContainerIndex));this.ngxContainer=void 0;const t=document.body.children;for(let i=0;i<t.length;i++){const n=t.item(i);n!==e&&n instanceof HTMLElement&&n.classList.contains("hidden-by-fullscreen")&&n.classList.remove("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.remove("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.remove("hidden-by-fullscreen")}}#gt(e){if(this.contextMenuOpen){this.contextMenuOpen=!1;e.preventDefault()}else if(!(0!==e.button||e.target.href&&e.target.parentNode?.hasAttribute("data-internal-link"))){e.preventDefault();e.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()}}#ft(){this.contextMenuOpen=!0}#dt(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(h);this.controlsTimeout=setTimeout((()=>{this.container.classList.remove(h);delete this.controlsTimeout}),o)}#pt(){if(this.controlsTimeout){clearTimeout(this.controlsTimeout);this.container.classList.remove(h);delete this.controlsTimeout}}#ot(){this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0}#mt(e){if(this.active)if(e.touches.length>1)this.touchSwipeState=null;else switch(e.type){case"touchstart":this.touchSwipeState={startX:e.touches[0].pageX,startY:e.touches[0].pageY,endX:e.touches[0].pageX,endY:e.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=e.touches[0].pageX;this.touchSwipeState.endY=e.touches[0].pageY;e.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;let t=0;const i=this.touchSwipeState.endX-this.touchSwipeState.startX,n=this.touchSwipeState.endY-this.touchSwipeState.startY,s=Math.abs(Math.atan2(n,i));Math.abs(i)>u&&(s<=p||s>=Math.PI-p)?t=i:Math.abs(n)>u&&Math.abs(s-Math.PI/2)<=p&&(t=n);t>0?this.pdfViewer.previousPage():t<0&&this.pdfViewer.nextPage()}}#ht(){this.showControlsBind=this.#dt.bind(this);this.mouseDownBind=this.#gt.bind(this);this.mouseWheelBind=this.#at.bind(this);this.resetMouseScrollStateBind=this.#ot.bind(this);this.contextMenuBind=this.#ft.bind(this);this.touchSwipeBind=this.#mt.bind(this);window.addEventListener("mousemove",this.showControlsBind);window.addEventListener("mousedown",this.mouseDownBind);window.addEventListener("wheel",this.mouseWheelBind,{passive:!1});window.addEventListener("keydown",this.resetMouseScrollStateBind);window.addEventListener("contextmenu",this.contextMenuBind);window.addEventListener("touchstart",this.touchSwipeBind);window.addEventListener("touchmove",this.touchSwipeBind);window.addEventListener("touchend",this.touchSwipeBind)}#ut(){window.removeEventListener("mousemove",this.showControlsBind);window.removeEventListener("mousedown",this.mouseDownBind);window.removeEventListener("wheel",this.mouseWheelBind,{passive:!1});window.removeEventListener("keydown",this.resetMouseScrollStateBind);window.removeEventListener("contextmenu",this.contextMenuBind);window.removeEventListener("touchstart",this.touchSwipeBind);window.removeEventListener("touchmove",this.touchSwipeBind);window.removeEventListener("touchend",this.touchSwipeBind);delete this.showControlsBind;delete this.mouseDownBind;delete this.mouseWheelBind;delete this.resetMouseScrollStateBind;delete this.contextMenuBind;delete this.touchSwipeBind}#wt(){document.fullscreenElement?this.#lt():this.#ct()}#nt(){this.fullscreenChangeBind=this.#wt.bind(this);window.addEventListener("fullscreenchange",this.fullscreenChangeBind)}#rt(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind);delete this.fullscreenChangeBind}}n()}catch(e){n(e)}}))},1834:(e,t,i)=>{i.a(e,(async(e,t)=>{try{var n=i(1869),s=i(39),r=i(1483),a=i(4552),o=i(3266),l=e([n,s,a]);[n,s,a]=l.then?(await l)():l;let h=null,d=null,c=null;function renderPage(e,t,i,s,a,l,d){const c=h.scratchCanvas;let u=a/n.PixelsPerInch.PDF,p=1;const g=Math.floor(s.width*u),f=Math.floor(s.height*u);if(g>=4096||f>=4096){if(!r.default.test({width:g,height:f})){const e=determineMaxDimensions();p=.95*Math.min(e/g,e/f)}(0,o.warn)("Page "+i+": Reduced the [printResolution] to "+Math.floor(a*p)+" because the browser can't render larger canvases. If you see blank page in the print preview, reduce [printResolution] manually to a lower value.")}u*=p;c.width=Math.floor(s.width*u);c.height=Math.floor(s.height*u);const m=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,w=c.getContext("2d",m);w.save();w.fillStyle="rgb(255, 255, 255)";w.fillRect(0,0,c.width,c.height);w.restore();return Promise.all([t.getPage(i),d]).then((function([e,t]){const i={canvasContext:w,transform:[u,0,0,u,0,0],viewport:e.getViewport({scale:1,rotation:s.rotation}),intent:"print",annotationMode:n.AnnotationMode.ENABLE_STORAGE,optionalContentConfigPromise:l,printAnnotationStorage:t};return e.render(i).promise}))}function determineMaxDimensions(){const e=[4096,8192,10836,11180,11402,14188,16384];for(let t of e)if(!r.default.test({width:t+1,height:t+1}))return t;return 16384}class PDFPrintService{constructor(e,t,i,n,s=null,r=null,a){this.pdfDocument=e;this.pagesOverview=t;this.printContainer=i;this._printResolution=n||150;this._optionalContentConfigPromise=s||e.getOptionalContentConfig();this._printAnnotationStoragePromise=r||Promise.resolve();this.currentPage=-1;this.scratchCanvas=document.createElement("canvas");this.eventBus=a}layout(){this.throwIfInactive();const e=document.querySelector("body");e.setAttribute("data-pdfjsprinting",!0);document.querySelector("html").setAttribute("data-pdfjsprinting",!0);const{width:t,height:i}=this.pagesOverview[0];this.pagesOverview.every((e=>e.width===t&&e.height===i))||globalThis.ngxConsole.warn("Not all pages have the same size. The printed result may be incorrect!");this.pageStyleSheet=document.createElement("style");this.pageStyleSheet.textContent=`@page { size: ${t}pt ${i}pt;}`;e.append(this.pageStyleSheet)}destroy(){if(h!==this)return;this.printContainer.textContent="";document.querySelector("body").removeAttribute("data-pdfjsprinting");document.querySelector("html").removeAttribute("data-pdfjsprinting");if(this.pageStyleSheet){this.pageStyleSheet.remove();this.pageStyleSheet=null}this.scratchCanvas.width=this.scratchCanvas.height=0;this.scratchCanvas=null;h=null;ensureOverlay().then((function(){c.active===d&&c.close(d)}))}renderPages(){if(this.pdfDocument.isPureXfa){(0,a.getXfaHtmlForPrinting)(this.printContainer,this.pdfDocument);return Promise.resolve()}const e=this.pagesOverview.length,renderNextPage=(t,i)=>{this.throwIfInactive();for(;;){++this.currentPage;if(this.currentPage>=e)break;if(!window.isInPDFPrintRange||window.isInPDFPrintRange(this.currentPage))break}if(this.currentPage>=e){renderProgress(window.filteredPageCount|e,window.filteredPageCount|e,this.eventBus);t();return}const n=this.currentPage;renderProgress(n,window.filteredPageCount|e,this.eventBus);renderPage(0,this.pdfDocument,n+1,this.pagesOverview[n],this._printResolution,this._optionalContentConfigPromise,this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then((function(){renderNextPage(t,i)}),i)};return new Promise(renderNextPage)}useRenderedPage(){this.throwIfInactive();const e=document.createElement("img"),t=this.scratchCanvas;"toBlob"in t?t.toBlob((function(t){e.src=URL.createObjectURL(t)})):e.src=t.toDataURL();const i=document.createElement("div");i.className="printedPage";i.append(e);this.printContainer.append(i);return new Promise((function(t,i){e.onload=t;e.onerror=i}))}performPrint(){this.throwIfInactive();return new Promise((e=>{setTimeout((()=>{if(!this.active){e();return}u.call(window);const t=navigator.platform&&["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document;setTimeout(e,t?1500:20)}),0)}))}get active(){return this===h}throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}}const u=window.print;window.printPDF=function printPdf(){if(s.PDFViewerApplication.enablePrint)if(h)globalThis.ngxConsole.warn("Ignored window.printPDF() because of a pending print job.");else{ensureOverlay().then((function(){h&&c.open(d)}));try{dispatchEvent("beforeprint")}finally{if(!h){globalThis.ngxConsole.error("Expected print service to be initialized.");ensureOverlay().then((function(){c.active===d&&c.close(d)}));return}const e=h;h.renderPages().then((function(){const t=document.getElementById("printServiceDialog");t&&t.classList.add("hidden");return e.performPrint()})).catch((function(){})).then((function(){e.active&&abort()}))}}};function dispatchEvent(e){const t=new CustomEvent(e,{bubbles:!1,cancelable:!1,detail:"custom"});window.dispatchEvent(t)}function abort(){if(h){h.destroy();dispatchEvent("afterprint")}}function renderProgress(e,t,i){d=document.getElementById("printServiceDialog");const n=Math.round(100*e/t),s=d.querySelector("progress"),r=d.querySelector(".relative-progress");s.value=n;r.setAttribute("data-l10n-args",JSON.stringify({progress:n}));i.dispatch("progress",{source:this,type:"print",total:t,page:e,percent:100*e/t})}window.addEventListener("keydown",(function(e){if(80===e.keyCode&&(e.ctrlKey||e.metaKey)&&!e.altKey&&(!e.shiftKey||window.chrome||window.opera)){window.print();e.preventDefault();e.stopImmediatePropagation()}}),!0);if("onbeforeprint"in window){const stopPropagationIfNeeded=function(e){"custom"!==e.detail&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",stopPropagationIfNeeded);window.addEventListener("afterprint",stopPropagationIfNeeded)}let p;function ensureOverlay(){if(!p){c=s.PDFViewerApplication.overlayManager;if(!c)throw new Error("The overlay manager has not yet been initialized.");d=document.getElementById("printServiceDialog");p=c.register(d,!0);document.getElementById("printCancel").onclick=abort;d.addEventListener("close",abort)}return p}s.PDFPrintServiceFactory.instance={supportsPrinting:!0,createPrintService(e,t,i,n,s,r,a){if(h)throw new Error("The print service is created and active.");h=new PDFPrintService(e,t,i,n,s,r,a);return h}};t()}catch(g){t(g)}}))},5119:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFRenderingQueue:()=>PDFRenderingQueue});var s=i(1869),r=i(4927),a=e([s]);s=(a.then?(await a)():a)[0];const o=3e4;class PDFRenderingQueue{constructor(){this.pdfViewer=null;this.pdfThumbnailViewer=null;this.onIdle=null;this.highestPriorityPage=null;this.idleTimeout=null;this.printing=!1;this.isThumbnailViewEnabled=!1;Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}renderHighestPriority(e){if(this.idleTimeout){clearTimeout(this.idleTimeout);this.idleTimeout=null}this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),o))}getHighestPriority(e,t,i,n=!1){const s=e.views,r=s.length;if(0===r)return null;for(let e=0;e<r;e++){const t=s[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>r){const n=e.ids;for(let e=1,s=o-a;e<s;e++){const s=i?a+e:o-e;if(n.has(s))continue;const r=t[s-1];if(!this.isViewFinished(r))return r}}let l=i?o:a-2,h=t[l];if(h&&!this.isViewFinished(h))return h;if(n){l+=i?1:-1;h=t[l];if(h&&!this.isViewFinished(h))return h}return null}isViewFinished(e){return e.renderingState===r.RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case r.RenderingStates.FINISHED:return!1;case r.RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId;e.resume();break;case r.RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case r.RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId;e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof s.RenderingCancelledException||globalThis.ngxConsole.error(`renderView: "${e}"`)}))}return!0}}n()}catch(e){n(e)}}))},2599:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFScriptingManager:()=>PDFScriptingManager});var s=i(4927),r=i(1869),a=e([r]);r=(a.then?(await a)():a)[0];class PDFScriptingManager{#bt=null;#vt=null;#yt=null;#h=null;#Pt=null;#St=null;#Et=null;#_t=!1;#Ct=null;#xt=null;constructor({eventBus:e,externalServices:t=null,docProperties:i=null}){this.#h=e;this.#Pt=t;this.#yt=i}setViewer(e){this.#Et=e}async setDocument(e){this.#St&&await this.#Tt();this.#St=e;if(!e)return;const[t,i,n]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(t||n){if(e===this.#St){try{this.#Ct=this.#Lt()}catch(e){globalThis.ngxConsole.error(`setDocument: "${e.message}".`);await this.#Tt();return}this._internalEvents.set("updatefromsandbox",(e=>{e?.source===window&&this.#It(e.detail)}));this._internalEvents.set("dispatcheventinsandbox",(e=>{this.#Ct?.dispatchEventInSandbox(e.detail)}));this._internalEvents.set("pagechanging",(({pageNumber:e,previous:t})=>{if(e!==t){this.#Mt(t);this.#At(e)}}));this._internalEvents.set("pagerendered",(({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this.#Et.currentPageNumber&&this.#At(e)}));this._internalEvents.set("pagesdestroy",(async()=>{await this.#Mt(this.#Et.currentPageNumber);await(this.#Ct?.dispatchEventInSandbox({id:"doc",name:"WillClose"}));this.#bt?.resolve()}));for(const[e,t]of this._internalEvents)this.#h._on(e,t);try{const s=await this.#yt(e);if(e!==this.#St)return;await this.#Ct.createSandbox({objects:t,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...s,actions:n}});this.#h.dispatch("sandboxcreated",{source:this})}catch(e){globalThis.ngxConsole.error(`setDocument: "${e.message}".`);await this.#Tt();return}await(this.#Ct?.dispatchEventInSandbox({id:"doc",name:"Open"}));await this.#At(this.#Et.currentPageNumber,!0);Promise.resolve().then((()=>{e===this.#St&&(this.#_t=!0)}))}}else await this.#Tt()}async dispatchWillSave(){return this.#Ct?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){return this.#Ct?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){if(this.#Ct){await(this.#xt?.promise);this.#xt=new r.PromiseCapability;try{await this.#Ct.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(e){this.#xt.resolve();this.#xt=null;throw e}await this.#xt.promise}}async dispatchDidPrint(){return this.#Ct?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){return this.#vt?.promise||null}get ready(){return this.#_t}get _internalEvents(){return(0,r.shadow)(this,"_internalEvents",new Map)}get _pageOpenPending(){return(0,r.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,r.shadow)(this,"_visitedPages",new Map)}async#It(e){const t=this.#Et,i=t.isInPresentationMode||t.isChangingPresentationMode,{id:n,siblings:r,command:a,value:o}=e;if(!n){switch(a){case"clear":globalThis.ngxConsole.clear();break;case"error":globalThis.ngxConsole.error(o);break;case"layout":if(!i){const e=(0,s.apiPageLayoutToViewerModes)(o);t.spreadMode=e.spreadMode}break;case"page-num":t.currentPageNumber=o+1;break;case"print":await t.pagesPromise;this.#h.dispatch("print",{source:this});break;case"println":globalThis.ngxConsole.log(o);break;case"zoom":i||(t.currentScaleValue=o);break;case"SaveAs":this.#h.dispatch("download",{source:this});break;case"FirstPage":t.currentPageNumber=1;break;case"LastPage":t.currentPageNumber=t.pagesCount;break;case"NextPage":t.nextPage();break;case"PrevPage":t.previousPage();break;case"ZoomViewIn":i||t.increaseScale();break;case"ZoomViewOut":i||t.decreaseScale();break;case"WillPrintFinished":this.#xt?.resolve();this.#xt=null}return}if(i&&e.focus)return;delete e.id;delete e.siblings;const l=r?[n,...r]:[n];for(const t of l){const i=document.querySelector(`[data-element-id="${t}"]`);i?i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):this.#St?.annotationStorage.setValue(t,e)}}async#At(e,t=!1){const i=this.#St,n=this._visitedPages;t&&(this.#bt=new r.PromiseCapability);if(!this.#bt)return;const a=this.#Et.getPageView(e-1);if(a?.renderingState!==s.RenderingStates.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);const o=(async()=>{const t=await(n.has(e)?null:a.pdfPage?.getJSActions());i===this.#St&&await(this.#Ct?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();n.set(e,o)}async#Mt(e){const t=this.#St,i=this._visitedPages;if(!this.#bt)return;if(this._pageOpenPending.has(e))return;const n=i.get(e);if(n){i.set(e,null);await n;t===this.#St&&await(this.#Ct?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e}))}}#Lt(){this.#vt=new r.PromiseCapability;if(this.#Ct)throw new Error("#initScripting: Scripting already exists.");return this.#Pt.createScripting()}async#Tt(){if(this.#Ct){if(this.#bt){await Promise.race([this.#bt.promise,new Promise((e=>{setTimeout(e,1e3)}))]).catch((()=>{}));this.#bt=null}this.#St=null;try{await this.#Ct.destroySandbox()}catch{}this.#xt?.reject(new Error("Scripting destroyed."));this.#xt=null;for(const[e,t]of this._internalEvents)this.#h._off(e,t);this._internalEvents.clear();this._pageOpenPending.clear();this._visitedPages.clear();this.#Ct=null;this.#_t=!1;this.#vt?.resolve()}else{this.#St=null;this.#vt?.resolve()}}}n()}catch(e){n(e)}}))},4487:(e,t,i)=>{i.d(t,{PDFSidebar:()=>PDFSidebar});var n=i(4927);const s="sidebarResizing",r="pdfSidebarNotification";class PDFSidebar{#$=!1;#Dt=this.#Nt.bind(this);#Bt=this.#kt.bind(this);#Vt=null;#Ft=null;constructor({elements:e,eventBus:t,l10n:i}){this.isOpen=!1;this.active=n.SidebarView.THUMBS;this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;this.onToggled=null;this.onUpdateThumbnails=null;this.outerContainer=e.outerContainer;this.sidebarContainer=e.sidebarContainer;this.toggleButton=e.toggleButton;this.resizer=e.resizer;this.thumbnailButton=e.thumbnailButton;this.outlineButton=e.outlineButton;this.attachmentsButton=e.attachmentsButton;this.layersButton=e.layersButton;this.thumbnailView=e.thumbnailView;this.outlineView=e.outlineView;this.attachmentsView=e.attachmentsView;this.layersView=e.layersView;this._currentOutlineItemButton=e.currentOutlineItemButton;this.eventBus=t;this.#$="rtl"===i.getDirection();this.#ie()}reset(){this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;this.#Rt(!0);this.switchView(n.SidebarView.THUMBS);this.outlineButton.disabled=!1;this.attachmentsButton.disabled=!1;this.layersButton.disabled=!1;this.outlineButton.hidden=!1;this.attachmentsButton.hidden=!1;this.layersButton.hidden=!1;this._currentOutlineItemButton.disabled=!0}get visibleView(){return this.isOpen?this.active:n.SidebarView.NONE}setInitialView(e=n.SidebarView.NONE){if(!this.isInitialViewSet){this.isInitialViewSet=!0;if(e!==n.SidebarView.NONE&&e!==n.SidebarView.UNKNOWN){this.switchView(e,!0);this.isInitialEventDispatched||this.#Ot()}else this.#Ot()}}switchView(e,t=!1){const i=e!==this.active;let s=!1;switch(e){case n.SidebarView.NONE:this.isOpen&&this.close();return;case n.SidebarView.THUMBS:this.isOpen&&i&&(s=!0);break;case n.SidebarView.OUTLINE:if(this.outlineButton.disabled)return;break;case n.SidebarView.ATTACHMENTS:if(this.attachmentsButton.disabled)return;break;case n.SidebarView.LAYERS:if(this.layersButton.disabled)return;break;default:globalThis.ngxConsole.error(`PDFSidebar.switchView: "${e}" is not a valid view.`);return}this.active=e;(0,n.toggleCheckedBtn)(this.thumbnailButton,e===n.SidebarView.THUMBS,this.thumbnailView);(0,n.toggleCheckedBtn)(this.outlineButton,e===n.SidebarView.OUTLINE,this.outlineView);(0,n.toggleCheckedBtn)(this.attachmentsButton,e===n.SidebarView.ATTACHMENTS,this.attachmentsView);(0,n.toggleCheckedBtn)(this.layersButton,e===n.SidebarView.LAYERS,this.layersView);if(!t||this.isOpen){if(s){this.onUpdateThumbnails();this.onToggled()}i&&this.#Ot()}else this.open()}open(){if(!this.isOpen){this.isOpen=!0;(0,n.toggleExpandedBtn)(this.toggleButton,!0);this.outerContainer.classList.add("sidebarMoving","sidebarOpen");this.active===n.SidebarView.THUMBS&&this.onUpdateThumbnails();this.onToggled();this.#Ot();this.#Rt()}}close(e=null){if(this.isOpen){this.isOpen=!1;(0,n.toggleExpandedBtn)(this.toggleButton,!1);this.outerContainer.classList.add("sidebarMoving");this.outerContainer.classList.remove("sidebarOpen");this.onToggled();this.#Ot();e?.detail>0&&this.toggleButton.blur()}}toggle(e=null){this.isOpen?this.close(e):this.open()}#Ot(){this.isInitialViewSet&&(this.isInitialEventDispatched||=!0);this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}#Ht(){this.toggleButton.setAttribute("data-l10n-id","pdfjs-toggle-sidebar-notification-button");this.isOpen||this.toggleButton.classList.add(r)}#Rt(e=!1){(this.isOpen||e)&&this.toggleButton.classList.remove(r);e&&this.toggleButton.setAttribute("data-l10n-id","pdfjs-toggle-sidebar-button")}#ie(){this.sidebarContainer.addEventListener("transitionend",(e=>{if(e.target===this.sidebarContainer){this.outerContainer.classList.remove("sidebarMoving");this.eventBus.dispatch("resize",{source:this})}}));this.toggleButton.addEventListener("click",(e=>{this.toggle(e)}));this.thumbnailButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.THUMBS)}));this.outlineButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.OUTLINE)}));this.outlineButton.addEventListener("dblclick",(()=>{this.eventBus.dispatch("toggleoutlinetree",{source:this})}));this.attachmentsButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.ATTACHMENTS)}));this.layersButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.LAYERS)}));this.layersButton.addEventListener("dblclick",(()=>{this.eventBus.dispatch("resetlayers",{source:this})}));this._currentOutlineItemButton.addEventListener("click",(()=>{this.eventBus.dispatch("currentoutlineitem",{source:this})}));const onTreeLoaded=(e,t,i)=>{t.disabled=!e;t.hidden=!e;e?this.#Ht():this.active===i&&this.switchView(n.SidebarView.THUMBS)};this.eventBus._on("outlineloaded",(e=>{onTreeLoaded(e.outlineCount,this.outlineButton,n.SidebarView.OUTLINE);e.enableCurrentOutlineItemButton&&e.currentOutlineItemPromise&&e.currentOutlineItemPromise.then((e=>{this.isInitialViewSet&&(this._currentOutlineItemButton.disabled=!e)}))}));this.eventBus._on("attachmentsloaded",(e=>{onTreeLoaded(e.attachmentsCount,this.attachmentsButton,n.SidebarView.ATTACHMENTS)}));this.eventBus._on("layersloaded",(e=>{onTreeLoaded(e.layersCount,this.layersButton,n.SidebarView.LAYERS)}));this.eventBus._on("presentationmodechanged",(e=>{e.state===n.PresentationModeState.NORMAL&&this.visibleView===n.SidebarView.THUMBS&&this.onUpdateThumbnails()}));this.resizer.addEventListener("mousedown",(e=>{if(0===e.button){this.outerContainer.classList.add(s);window.addEventListener("mousemove",this.#Dt);window.addEventListener("mouseup",this.#Bt)}}));this.eventBus._on("resize",(e=>{if(e.source!==window)return;this.#Vt=null;if(!this.#Ft)return;if(!this.isOpen){this.#Ut(this.#Ft);return}this.outerContainer.classList.add(s);const t=this.#Ut(this.#Ft);Promise.resolve().then((()=>{this.outerContainer.classList.remove(s);t&&this.eventBus.dispatch("resize",{source:this})}))}))}get outerContainerWidth(){return this.#Vt||=this.outerContainer.clientWidth}#Ut(e=0){const t=Math.floor(this.outerContainerWidth/2);e>t&&(e=t);e<200&&(e=200);if(e===this.#Ft)return!1;this.#Ft=e;n.docStyle.setProperty("--sidebar-width",`${e}px`);return!0}#Nt(e){let t=e.clientX;this.#$&&(t=this.outerContainerWidth-t);this.#Ut(t)}#kt(e){this.outerContainer.classList.remove(s);this.eventBus.dispatch("resize",{source:this});window.removeEventListener("mousemove",this.#Dt);window.removeEventListener("mouseup",this.#Bt)}}},3346:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFThumbnailView:()=>PDFThumbnailView,TempImageFactory:()=>TempImageFactory});var s=i(4927),r=i(1869),a=e([r]);r=(a.then?(await a)():a)[0];const o=2,l=3,h=98;class TempImageFactory{static#zt=null;static getCanvas(e,t){const i=this.#zt||=document.createElement("canvas");i.width=e;i.height=t;const n=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1},s=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,r=i.getContext("2d",n);r.save();r.fillStyle="rgb(255, 255, 255)";r.fillRect(0,0,e,t);r.restore();return[i,i.getContext("2d",s)]}static destroyCanvas(){const e=this.#zt;if(e){e.width=0;e.height=0}this.#zt=null}}class PDFThumbnailView{constructor({container:e,eventBus:t,id:i,defaultViewport:n,optionalContentConfigPromise:r,linkService:a,renderingQueue:o,pageColors:l}){this.id=i;this.renderingId="thumbnail"+i;this.pageLabel=null;this.pdfPage=null;this.rotation=0;this.viewport=n;this.pdfPageRotate=n.rotation;this._optionalContentConfigPromise=r||null;this.pageColors=l||null;this.eventBus=t;this.linkService=a;this.renderingQueue=o;this.eventBus=t;this.renderTask=null;this.renderingState=s.RenderingStates.INITIAL;this.resume=null;window.pdfThumbnailGenerator?this._placeholderImg=window.pdfThumbnailGenerator(this,a,i,e,this.#jt):this.createThumbnail(this,a,i,e,this.#jt)}createThumbnail(e,t,i,n,s){const r=document.createElement("a");r.href=t.getAnchorUrl("#page="+i);r.setAttribute("data-l10n-id","pdfjs-thumb-page-title");r.setAttribute("data-l10n-args",this.#jt);r.onclick=function(){t.goToPage(i);return!1};this.anchor=r;const a=document.createElement("div");a.className="thumbnail";a.setAttribute("data-page-number",this.id);this.div=a;this.#Wt();const o=document.createElement("div");o.className="thumbnailImage";this._placeholderImg=o;a.append(o);r.append(a);n.append(r)}#Wt(){const{width:e,height:t}=this.viewport,i=e/t;this.canvasWidth=h;this.canvasHeight=this.canvasWidth/i|0;this.scale=this.canvasWidth/e;const{style:n}=this.div;n.setProperty("--thumbnail-width",`${this.canvasWidth}px`);n.setProperty("--thumbnail-height",`${this.canvasHeight}px`)}setPdfPage(e){this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:1,rotation:t});this.reset()}reset(){this.cancelRendering();this.renderingState=s.RenderingStates.INITIAL;this.div.removeAttribute("data-loaded");this.image?.replaceWith(this._placeholderImg);this.#Wt();if(this.image){this.image.removeAttribute("src");delete this.image}}update({rotation:e=null}){"number"==typeof e&&(this.rotation=e);const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:t});this.reset()}cancelRendering(){if(this.renderTask){this.renderTask.cancel();this.renderTask=null}this.resume=null}_getPageDrawContext(e=1){const t=document.createElement("canvas"),i=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1},n=t.getContext("2d",i),r=new s.OutputScale;t.width=e*this.canvasWidth*r.sx|0;t.height=e*this.canvasHeight*r.sy|0;return{ctx:n,canvas:t,transform:r.scaled?[r.sx,0,0,r.sy,0,0]:null}}_convertCanvasToImage(e){if(this.renderingState!==s.RenderingStates.FINISHED)throw new Error("_convertCanvasToImage: Rendering has not finished.");const t=this._reduceImage(e),i=document.createElement("img");i.className="thumbnailImage";i.setAttribute("data-l10n-id","pdfjs-thumb-page-canvas");i.setAttribute("data-l10n-args",this.#jt);i.src=t.toDataURL();this.image=i;this.div.setAttribute("data-loaded",!0);this._placeholderImg.replaceWith(i);t.width=0;t.height=0}async#tt(e,t,i=null){e===this.renderTask&&(this.renderTask=null);if(!(i instanceof r.RenderingCancelledException)){this.renderingState=s.RenderingStates.FINISHED;this._convertCanvasToImage(t);if(i)throw i;this.eventBus.dispatch("thumbnailRendered",this.id)}}async draw(){if(this.renderingState!==s.RenderingStates.INITIAL){globalThis.ngxConsole.error("Must be in new state before drawing");return}const{pdfPage:e}=this;if(!e){this.renderingState=s.RenderingStates.FINISHED;throw new Error("pdfPage is not loaded")}this.renderingState=s.RenderingStates.RUNNING;const{ctx:t,canvas:i,transform:n}=this._getPageDrawContext(o),r={canvasContext:t,transform:n,viewport:this.viewport.clone({scale:o*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,pageColors:this.pageColors},a=this.renderTask=e.render(r);a.onContinue=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=s.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=s.RenderingStates.RUNNING;e()}}};const l=a.promise.then((()=>this.#tt(a,i)),(e=>this.#tt(a,i,e)));l.finally((()=>{i.width=0;i.height=0;this.eventBus.dispatch("thumbnailrendered",{source:this,pageNumber:this.id,pdfPage:this.pdfPage})}));return l}setImage(e){if(this.renderingState!==s.RenderingStates.INITIAL)return;const{thumbnailCanvas:t,pdfPage:i,scale:n}=e;if(t){this.pdfPage||this.setPdfPage(i);if(!(n<this.scale)){this.renderingState=s.RenderingStates.FINISHED;this._convertCanvasToImage(t)}}}_reduceImage(e){const{ctx:t,canvas:i}=this._getPageDrawContext();if(e.width<=2*i.width){t.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height);return i}let n=i.width<<l,s=i.height<<l;const[r,a]=TempImageFactory.getCanvas(n,s);for(;n>e.width||s>e.height;){n>>=1;s>>=1}a.drawImage(e,0,0,e.width,e.height,0,0,n,s);for(;n>2*i.width;){a.drawImage(r,0,0,n,s,0,0,n>>1,s>>1);n>>=1;s>>=1}t.drawImage(r,0,0,n,s,0,0,i.width,i.height);return i}get#jt(){return JSON.stringify({page:this.pageLabel??this.id})}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;this.anchor.setAttribute("data-l10n-args",this.#jt);this.renderingState===s.RenderingStates.FINISHED&&this.image?.setAttribute("data-l10n-args",this.#jt)}}n()}catch(e){n(e)}}))},3510:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFThumbnailViewer:()=>PDFThumbnailViewer});var s=i(4927),r=i(3346),a=e([r]);r=(a.then?(await a)():a)[0];const o=-19,l="selected";class PDFThumbnailViewer{constructor({container:e,eventBus:t,linkService:i,renderingQueue:n,pageColors:r}){this.container=e;this.eventBus=t;this.linkService=i;this.renderingQueue=n;this.pageColors=r||null;this.scroll=(0,s.watchScroll)(this.container,this._scrollUpdated.bind(this));this._resetView()}_scrollUpdated(){this.renderingQueue.renderHighestPriority()}getThumbnail(e){return this._thumbnails[e]}_getVisibleThumbs(){return(0,s.getVisibleElements)({scrollEl:this.container,views:this._thumbnails})}scrollThumbnailIntoView(e){if(!this.pdfDocument)return;const t=this._thumbnails[e-1];if(!t){globalThis.ngxConsole.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');return}if(e!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(l);t.div.classList.add(l)}const{first:i,last:n,views:r}=this._getVisibleThumbs();if(r.length>0){let a=!1;if(e<=i.id||e>=n.id)a=!0;else for(const{id:t,percent:i}of r)if(t===e){a=i<100;break}a&&(0,s.scrollIntoView)(t.div,{top:o})}this._currentPageNumber=e}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,s.isValidRotation)(e))throw new Error("Invalid thumbnails rotation angle.");if(!this.pdfDocument)return;if(this._pagesRotation===e)return;this._pagesRotation=e;const t={rotation:e};for(const e of this._thumbnails)e.update(t)}cleanup(){for(const e of this._thumbnails)e.renderingState!==s.RenderingStates.FINISHED&&e.reset();r.TempImageFactory.destroyCanvas()}_resetView(){this._thumbnails=[];this._currentPageNumber=1;this._pageLabels=null;this._pagesRotation=0;this.container.textContent=""}setDocument(e){this.initialized=!1;if(this.pdfDocument){this._cancelRendering();this._resetView()}this.pdfDocument=e;if(!e)return;if(this.initialized)return;this.initialized=!0;const t=e.getPage(1),i=e.getOptionalContentConfig();t.then((t=>{const n=e.numPages,s=t.getViewport({scale:1});for(let e=1;e<=n;++e){const t=new r.PDFThumbnailView({container:this.container,eventBus:this.eventBus,id:e,defaultViewport:s.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,pageColors:this.pageColors,eventBus:this.eventBus});this._thumbnails.push(t)}this._thumbnails[0]?.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].div.classList.add(l)})).catch((e=>{globalThis.ngxConsole.error("Unable to initialize thumbnail viewer",e)}))}_cancelRendering(){for(const e of this._thumbnails)e.cancelRendering()}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;globalThis.ngxConsole.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._thumbnails.length;e<t;e++)this._thumbnails[e].setPageLabel(this._pageLabels?.[e]??null)}}async#$t(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(t);return t}catch(e){globalThis.ngxConsole.error("Unable to get page for thumb view",e);return null}}#Gt(e){return 1===e.first?.id||e.last?.id!==this._thumbnails.length&&this.scroll.down}forceRendering(){const e=this._getVisibleThumbs(),t=this.#Gt(e),i=this.renderingQueue.getHighestPriority(e,this._thumbnails,t);if(i){this.#$t(i).then((()=>{this.renderingQueue.renderView(i)}));return!0}return!1}stopRendering(){this._cancelRendering()}}n()}catch(e){n(e)}}))},9290:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFViewer:()=>PDFViewer,PagesCountLimit:()=>p});var s=i(1869),r=i(4927),a=i(7910),o=i(658),l=i(6732),h=i(5119),d=i(3234),c=e([s,a,l,h]);[s,a,l,h]=c.then?(await c)():c;const u=10,p={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};function isValidAnnotationEditorMode(e){return Object.values(s.AnnotationEditorType).includes(e)&&e!==s.AnnotationEditorType.DISABLE}class PDFPageViewBuffer{#Kt=new Set;#Zt=0;constructor(e){this.#Zt=e}push(e){const t=this.#Kt;t.has(e)&&t.delete(e);t.add(e);t.size>this.#Zt&&this.#qt()}resize(e,t=null){this.#Zt=e;const i=this.#Kt;if(t){const e=i.size;let n=1;for(const s of i){if(t.has(s.id)){i.delete(s);i.add(s)}if(++n>e)break}}for(;i.size>this.#Zt;)this.#qt()}has(e){return this.#Kt.has(e)}[Symbol.iterator](){return this.#Kt.keys()}#qt(){const e=this.#Kt.keys().next().value;e?.destroy();this.#Kt.delete(e)}}class PDFViewer{#Xt=null;#Qt=null;#Yt=null;#Jt=s.AnnotationEditorType.NONE;#ei=null;#Fe=s.AnnotationMode.ENABLE_FORMS;#ti=null;#ii=null;#ni=!1;#si=!1;#ri=null;#ai=!1;#oi=0;#de=new ResizeObserver(this.#ce.bind(this));#li=null;#hi=null;#di=null;#We=r.TextLayerMode.ENABLE;#ci=void 0;#ui="multiple";constructor(e){const t="4.0.844";if(s.version!==t)throw new Error(`The API version "${s.version}" does not match the Viewer version "${t}".`);this.container=e.container;this.viewer=e.viewer||e.container.firstElementChild;this.pageViewMode=e.pageViewMode||"multiple";if("DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.#de.observe(this.container);this.eventBus=e.eventBus;this.linkService=e.linkService||new d.SimpleLinkService;this.downloadManager=e.downloadManager||null;this.findController=e.findController||null;this.#Qt=e.altTextManager||null;this.findController&&(this.findController.onIsPageVisible=e=>this._getVisiblePages().ids.has(e));this._scriptingManager=e.scriptingManager||null;this.#We=e.textLayerMode??r.TextLayerMode.ENABLE;this.#Fe=e.annotationMode??s.AnnotationMode.ENABLE_FORMS;this.#Jt=e.annotationEditorMode??s.AnnotationEditorType.NONE;this.#Yt=e.annotationEditorHighlightColors||null;this.imageResourcesPath=e.imageResourcesPath||"";this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1;this.removePageBorders=e.removePageBorders||!1;this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0;this.maxCanvasPixels=e.maxCanvasPixels;this.l10n=e.l10n||a.NullL10n;this.#ni=e.enablePermissions||!1;this.pageColors=e.pageColors||null;this.defaultRenderingQueue=!e.renderingQueue;if(this.defaultRenderingQueue){this.renderingQueue=new h.PDFRenderingQueue;this.renderingQueue.setViewer(this)}else this.renderingQueue=e.renderingQueue;this.scroll=(0,r.watchScroll)(this.container,this._scrollUpdate.bind(this));this.presentationModeState=r.PresentationModeState.UNKNOWN;this._onBeforeDraw=this._onAfterDraw=null;this._resetView();this.removePageBorders&&this.viewer.classList.add("removePageBorders");this.#pi();this.eventBus._on("thumbnailrendered",(({pageNumber:e,pdfPage:t})=>{const i=this._pages[e-1];this.#Xt.has(i)||t?.cleanup()}));this.l10n===a.NullL10n&&this.l10n.translate(this.container)}get pageViewMode(){return this.#ui}set pageViewMode(e){if(this.#ui!==e){this.#ui=e;if(!this.#ci&&"infinite-scroll"===e){this.#ci=this.#gi(this.container.offsetParent);this.#ci&&(0,r.watchScroll)(this.#ci,this._scrollUpdate.bind(this))}}}#gi(e){for(;e;){if(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.parentElement}return null}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}getCachedPageViews(){return new Set(this.#Xt)}get pageViewsReady(){return this._pagesCapability.settled&&this._pages.every((e=>e?.pdfPage))}get renderForms(){return this.#Fe===s.AnnotationMode.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");if(!this.pdfDocument)return;const t=Math.abs(this._currentPageNumber-e)<=2;this._setCurrentPageNumber(e,!0)||globalThis.ngxConsole.error(`currentPageNumber: "${e}" is not a valid page.`);if(this.pageFlip){t?this.pageFlip.flip(e-1):this.pageFlip.turnToPage(e-1);this.ensureAdjacentPagesAreLoaded()}}hidePagesDependingOnpageViewMode(){"book"===this.pageViewMode&&(this.pageFlip||setTimeout((()=>{if(!this.pageFlip){const e=this._pages[0].div,t=e.parentElement,i=t.parentElement;i.style.width=2*e.clientWidth+"px";i.style.overflow="hidden";i.style.marginLeft="auto";i.style.marginRight="auto";this.pageFlip=new o.PageFlip(t,{width:e.clientWidth,height:e.clientHeight,showCover:!0,size:"fixed"});this.pageFlip.loadFromHTML(document.querySelectorAll(".page"));this.pageFlip.on("flip",(e=>{this._currentPageNumber!==e.data+1&&this._setCurrentPageNumber(e.data+1,!1)}))}}),100))}async _setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e){t&&this.#fi();return!0}if(!(0<e&&e<=this.pagesCount))return!1;const i=this._currentPageNumber;this._currentPageNumber=e;this.hidePagesDependingOnpageViewMode();if("book"===this.pageViewMode||"infinite-scroll"===this.pageViewMode){const e=this._pages[this.currentPageNumber-1];if(e.div.parentElement.classList.contains("spread"))e.div.parentElement.childNodes.forEach((async e=>{const t=Number(e.getAttribute("data-page-number")),i=this._pages[t-1];await this.#$t(i);this.renderingQueue.renderView(i);e.style.display="inline-block"}));else{await this.#$t(e);this.renderingQueue.renderView(e);"book"===this.#ui&&this.ensureAdjacentPagesAreLoaded()}}this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:i});t&&this.#fi();return!0}addPageToRenderQueue(e=0){if(e>=0&&e<=this._pages.length-1){const t=this._pages[e];if(t.renderingState===r.RenderingStates.INITIAL){this.#$t(t).then((()=>{this.renderingQueue.renderView(t)}));return!0}}return!1}async ensureAdjacentPagesAreLoaded(){const e=[0,1,-1,2,-2,-3];let t=0;this.currentPageNumber%2==1&&(t=-1);let i=!1;for(const n of e){const e=this.currentPageNumber+n+t;if(e>=0&&e<this._pages.length)try{const t=this._pages[e];await this.#$t(t);if(this._pages.some((e=>e.renderingState===r.RenderingStates.RUNNING||e.renderingState===r.RenderingStates.PAUSED))||i){const loader=()=>this.adjacentPagesRenderer(loader,e);this.eventBus._on("pagerendered",loader);this.eventBus._on("thumbnailRendered",loader)}else i=this.adjacentPagesRenderer(null,e)}catch(t){console.log("Exception during pre-rendering page "+e,t)}}}adjacentPagesRenderer(e,t){if(this._pages.find((e=>e.renderingState===r.RenderingStates.RUNNING)))return!0;const i=this._pages.find((e=>e.renderingState===r.RenderingStates.PAUSED));if(i){this.renderingQueue.renderView(i);return!0}if(e){this.eventBus._off("pagerendered",e);this.eventBus._off("thumbnailRendered",e)}if(t>=0&&t<this._pages.length){const e=this._pages[t];if(e.renderingState===r.RenderingStates.INITIAL){this.renderingQueue.renderView(e);return!0}}return!1}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const i=this._pageLabels.indexOf(e);i>=0&&(t=i+1)}this._setCurrentPageNumber(t,!0)||globalThis.ngxConsole.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==r.UNKNOWN_SCALE?this._currentScale:r.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#mi(e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this.#mi(e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,r.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;(e%=360)<0&&(e+=360);if(this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber;this.refresh(!0,{rotation:e});this._currentScaleValue&&this.#mi(this._currentScaleValue,{noScroll:!0});this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:e,pageNumber:t});this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){const e=this;return(0,s.shadow)(this,"_layerProperties",{get annotationEditorUIManager(){return e.#ei},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}})}#wi(e){const t={annotationEditorMode:this.#Jt,annotationMode:this.#Fe,textLayerMode:this.#We};if(!e)return t;e.includes(s.PermissionFlag.COPY)||this.#We!==r.TextLayerMode.ENABLE||(t.textLayerMode=r.TextLayerMode.ENABLE_PERMISSIONS);e.includes(s.PermissionFlag.MODIFY_CONTENTS)||(t.annotationEditorMode=s.AnnotationEditorType.DISABLE);e.includes(s.PermissionFlag.MODIFY_ANNOTATIONS)||e.includes(s.PermissionFlag.FILL_INTERACTIVE_FORMS)||this.#Fe!==s.AnnotationMode.ENABLE_FORMS||(t.annotationMode=s.AnnotationMode.ENABLE);return t}#bi(){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return Promise.resolve();const e=new Promise((e=>{this.#hi=()=>{if("hidden"===document.visibilityState){e();document.removeEventListener("visibilitychange",this.#hi);this.#hi=null}};document.addEventListener("visibilitychange",this.#hi)}));return Promise.race([this._onePageRenderedCapability.promise,e])}async getAllText(){const e=[],t=[];for(let i=1,n=this.pdfDocument.numPages;i<=n;++i){if(this.#ai)return null;t.length=0;const n=await this.pdfDocument.getPage(i),{items:s}=await n.getTextContent();for(const e of s){e.str&&t.push(e.str);e.hasEOL&&t.push("\n")}e.push((0,r.removeNullCharacters)(t.join("")))}return e.join("\n")}#vi(e,t){const i=document.getSelection(),{focusNode:n,anchorNode:s}=i;if(s&&n&&i.containsNode(this.#ri)){if(this.#si||e===r.TextLayerMode.ENABLE_PERMISSIONS){t.preventDefault();t.stopPropagation();return}this.#si=!0;const i=this.container.style.cursor;this.container.style.cursor="wait";const interruptCopy=e=>this.#ai="Escape"===e.key;window.addEventListener("keydown",interruptCopy);this.getAllText().then((async e=>{null!==e&&await navigator.clipboard.writeText(e)})).catch((e=>{console.warn(`Something goes wrong when extracting the text: ${e.message}`)})).finally((()=>{this.#si=!1;this.#ai=!1;window.removeEventListener("keydown",interruptCopy);this.container.style.cursor=i}));t.preventDefault();t.stopPropagation()}}setDocument(e){if(this.pdfDocument){this.eventBus.dispatch("pagesdestroy",{source:this});this._cancelRendering();this._resetView();this.findController?.setDocument(null);this._scriptingManager?.setDocument(null);if(this.#ei){this.#ei.destroy();this.#ei=null}}this.pdfDocument=e;if(!e)return;const t=e.numPages,i=e.getPage(1),n=e.getOptionalContentConfig(),a=this.#ni?e.getPermissions():Promise.resolve();if(t>p.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=r.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:t})}),(()=>{}));this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this.#Xt.push(t)};this.eventBus._on("pagerender",this._onBeforeDraw);this._onAfterDraw=e=>{if(!e.cssTransform&&!this._onePageRenderedCapability.settled){this._onePageRenderedCapability.resolve({timestamp:e.timestamp});this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null;if(this.#hi){document.removeEventListener("visibilitychange",this.#hi);this.#hi=null}}};this.eventBus._on("pagerendered",this._onAfterDraw);Promise.all([i,a]).then((([i,a])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(i);this._optionalContentConfigPromise=n;const{annotationEditorMode:o,annotationMode:h,textLayerMode:d}=this.#wi(a);if(d!==r.TextLayerMode.DISABLE){const e=this.#ri=document.createElement("div");e.id="hiddenCopyElement";this.viewer.before(e)}if(o!==s.AnnotationEditorType.DISABLE){const t=o;if(e.isPureXfa)console.warn("Warning: XFA-editing is not implemented.");else if(isValidAnnotationEditorMode(t)){this.#ei=new s.AnnotationEditorUIManager(this.container,this.viewer,this.#Qt,this.eventBus,e,this.pageColors,this.#Yt);this.eventBus.dispatch("annotationeditoruimanager",{source:this,uiManager:this.#ei});t!==s.AnnotationEditorType.NONE&&this.#ei.updateMode(t)}else console.error(`Invalid AnnotationEditor mode: ${t}`)}const c=this._scrollMode===r.ScrollMode.PAGE?null:this.viewer,u=this.currentScale,g=i.getViewport({scale:u*s.PixelsPerInch.PDF_TO_CSS_UNITS});this.viewer.style.setProperty("--scale-factor",g.scale);"CanvasText"!==this.pageColors?.foreground&&"Canvas"!==this.pageColors?.background||this.viewer.style.setProperty("--hcm-highlight-filter",e.filterFactory.addHighlightHCMFilter("CanvasText","Canvas","HighlightText","Highlight"));for(let e=1;e<=t;++e){const t=new l.PDFPageView({container:c,eventBus:this.eventBus,id:e,scale:u,defaultViewport:g.clone(),optionalContentConfigPromise:n,renderingQueue:this.renderingQueue,textLayerMode:d,annotationMode:h,imageResourcesPath:this.imageResourcesPath,removePageBorders:this.removePageBorders,useOnlyCssZoom:this.useOnlyCssZoom,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n,layerProperties:this._layerProperties});this._pages.push(t)}const f=this._pages[0];if(f){f.setPdfPage(i);this.linkService.cachePageRef(1,i.ref)}this._scrollMode===r.ScrollMode.PAGE?this.#yi():this._spreadMode!==r.SpreadMode.NONE&&this._updateSpreadMode();this.#bi().then((async()=>{this.findController?.setDocument(e);this._scriptingManager?.setDocument(e);if(this.#ri){this.#ii=this.#vi.bind(this,d);document.addEventListener("copy",this.#ii)}this.#ei&&this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:this.#Jt});if(e.loadingParams.disableAutoFetch||t>p.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let i=t-1;if(i<=0)this._pagesCapability.resolve();else{"book"===this.#ui&&await this.ensureAdjacentPagesAreLoaded();for(let n=2;n<=t;++n){if(this._pages[n-1])continue;const t=e.getPage(n).then((e=>{const t=this._pages[n-1];t.pdfPage||t.setPdfPage(e);this.linkService.cachePageRef(n,e.ref);0==--i&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${n} to initialize viewer`,e);0==--i&&this._pagesCapability.resolve()}));n%p.PAUSE_EAGER_PAGE_INIT==0&&await t}}}));this.hidePagesDependingOnpageViewMode();this.eventBus.dispatch("pagesinit",{source:this});e.getMetadata().then((({info:t})=>{e===this.pdfDocument&&t.Language&&(this.viewer.lang=t.Language)}));this.defaultRenderingQueue&&this.update()})).catch((e=>{globalThis.ngxConsole.error("Unable to initialize viewer",e);this._pagesCapability.reject(e)}))}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;globalThis.ngxConsole.error("setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[];this._currentPageNumber=1;this._currentScale=r.UNKNOWN_SCALE;this._currentScaleValue=null;this._pageLabels=null;const e=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||u;this.#Xt=new PDFPageViewBuffer(e);this._location=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._firstPageCapability=new s.PromiseCapability;this._onePageRenderedCapability=new s.PromiseCapability;this._pagesCapability=new s.PromiseCapability;this._scrollMode=r.ScrollMode.VERTICAL;this._previousScrollMode=r.ScrollMode.UNKNOWN;this._spreadMode=r.SpreadMode.NONE;this.#li={previousPageNumber:1,scrollDown:!0,pages:[]};if(this._onBeforeDraw){this.eventBus._off("pagerender",this._onBeforeDraw);this._onBeforeDraw=null}if(this._onAfterDraw){this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null}if(this.#hi){document.removeEventListener("visibilitychange",this.#hi);this.#hi=null}this.viewer.textContent="";this._updateScrollMode();this.viewer.removeAttribute("lang");if(this.#ri){document.removeEventListener("copy",this.#ii);this.#ii=null;this.#ri.remove();this.#ri=null}}#yi(){if(this._scrollMode!==r.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=this.#li,i=this.viewer;i.textContent="";t.pages.length=0;if(this._spreadMode!==r.SpreadMode.NONE||this.isInPresentationMode){const n=new Set,s=this._spreadMode-1;if(-1===s)n.add(e-1);else if(e%2!==s){n.add(e-1);n.add(e)}else{n.add(e-2);n.add(e-1)}const r=document.createElement("div");r.className="spread";if(this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage";r.append(e)}for(const e of n){const i=this._pages[e];if(i){r.append(i.div);t.pages.push(i)}}i.append(r)}else{const n=this._pages[e-1];i.append(n.div);t.pages.push(n)}t.scrollDown=e>=t.previousPageNumber;t.previousPageNumber=e}_scrollUpdate(){0!==this.pagesCount&&this.update()}scrollPagePosIntoView(e,t){const i=this._pages[e-1].div;if(t){const n={...t};if("string"==typeof n.top&&n.top.endsWith("%")){const e=Number(n.top.replace("%","")),t=this.viewer.querySelector(".page")?.clientHeight;let s=i.clientHeight?i.clientHeight:t;const r=this.viewer.parentElement.clientHeight;s=Math.max(0,s-r);n.top=e*s/100}if("string"==typeof n.left&&n.left.endsWith("%")){const e=Number(n.left.replace("%","")),t=this.viewer.querySelector(".page")?.clientWidth,s=i.clientWidth?i.clientWidth:t;n.left=e*s/100}this.#Pi({div:i,id:e},n)}else this.#Pi({pageDiv:i,pageNumber:e})}#Pi(e,t=null){if(!e)return;const{div:i,id:n}=e;this._currentPageNumber!==n&&this._setCurrentPageNumber(n);if(this._scrollMode===r.ScrollMode.PAGE){this.#yi();this.update()}if(!t&&!this.isInPresentationMode){const e=i.offsetLeft+i.clientLeft,n=e+i.clientWidth,{scrollLeft:s,clientWidth:a}=this.container;(this._scrollMode===r.ScrollMode.HORIZONTAL||e<s||n>s+a)&&(t={left:0,top:0})}(0,r.scrollIntoView)(i,t,!1,"infinite-scroll"===this.pageViewMode);!this._currentScaleValue&&this._location&&(this._location=null)}#Si(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}#Ei(e,t,{noScroll:i=!1,preset:n=!1,drawingDelay:r=-1}){const a=isNaN(Number(this.currentScale))?void 0:Number(this.currentScale),o=this.currentScaleValue;this._currentScaleValue=t.toString();if(this.#Si(e)){n&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t,previousScale:a,previousPresetValue:o});return}this.viewer.style.setProperty("--scale-factor",e*s.PixelsPerInch.PDF_TO_CSS_UNITS);const l=r>=0&&r<1e3;this.refresh(!0,{scale:e,drawingDelay:l?r:-1});l&&(this.#di=setTimeout((()=>{this.#di=null;this.refresh()}),r));this._currentScale=e;if(!i){let e,t=this._currentPageNumber;if(this._location&&!this.isInPresentationMode&&!this.isChangingPresentationMode){t=this._location.pageNumber;e=[null,{name:"XYZ"},this._location.left,this._location.top,null]}this.scrollPageIntoView({pageNumber:t,destArray:e,allowNegativeOffset:!0})}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:n?t:void 0,previousScale:a,previousPresetValue:o});this.defaultRenderingQueue&&this.update()}get#_i(){return this._spreadMode!==r.SpreadMode.NONE&&this._scrollMode!==r.ScrollMode.HORIZONTAL?2:1}#mi(e,t){e||(e="auto");let i=parseFloat(e);if(this._currentScale!==i)if(i>0){t.preset=!1;this.#Ei(i,e,t)}else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let s=r.SCROLLBAR_PADDING,a=r.VERTICAL_PADDING;if(this.isInPresentationMode){s=a=4;this._spreadMode!==r.SpreadMode.NONE&&(s*=2)}else this.removePageBorders?s=a=0:this._scrollMode===r.ScrollMode.HORIZONTAL&&([s,a]=[a,s]);const o=(this.container.clientWidth-s)/n.width*n.scale/this.#_i,l=(this.container.clientHeight-a)/n.height*n.scale;switch(e){case"page-actual":i=1;break;case"page-width":i=o;break;case"page-height":i=l;break;case"page-fit":i=Math.min(o,l);break;case"auto":const t=(0,r.isPortraitOrientation)(n)?o:Math.min(l,o);i=Math.min(r.MAX_AUTO_SCALE,t);break;default:globalThis.ngxConsole.error(`#setScale: "${e}" is an unknown zoom value.`);return}t.preset=!0;this.#Ei(i,e,t)}}#fi(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#mi(this._currentScaleValue,{noScroll:!0});this.#Pi(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:n=!1}){if(!this.pdfDocument)return;const a=Number.isInteger(e)&&this._pages[e-1];if(!a){console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!t){this._setCurrentPageNumber(e,!0);return}let o,l,h=0,d=0,c=0,u=0;const p=a.rotation%180!=0,g=(p?a.height:a.width)/a.scale/s.PixelsPerInch.PDF_TO_CSS_UNITS,f=(p?a.width:a.height)/a.scale/s.PixelsPerInch.PDF_TO_CSS_UNITS;let m=0;switch(t[1].name){case"XYZ":h=t[2];d=t[3];m=t[4];h=null!==h?h:0;d=null!==d?d:f;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":d=t[2];m="page-width";if(null===d&&this._location){h=this._location.left;d=this._location.top}else("number"!=typeof d||d<0)&&(d=f);break;case"FitV":case"FitBV":h=t[2];c=g;u=f;m="page-height";break;case"FitR":h=t[2];d=t[3];c=t[4]-h;u=t[5]-d;let e=r.SCROLLBAR_PADDING,i=r.VERTICAL_PADDING;this.removePageBorders&&(e=i=0);o=(this.container.clientWidth-e)/c/s.PixelsPerInch.PDF_TO_CSS_UNITS;l=(this.container.clientHeight-i)/u/s.PixelsPerInch.PDF_TO_CSS_UNITS;m=Math.min(Math.abs(o),Math.abs(l));break;default:console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`);return}n||(m&&m!==this._currentScale?this.currentScaleValue=m:this._currentScale===r.UNKNOWN_SCALE&&(this.currentScaleValue=r.DEFAULT_SCALE_VALUE));this.#$t(a).then((()=>{this.renderingQueue.renderView(a);"single"===this.pageViewMode&&this.currentPageNumber!==e&&(this.currentPageNumber=e)}));if("page-fit"===m&&!t[4]){this.#Pi(a);return}const w=[a.viewport.convertToViewportPoint(h,d),a.viewport.convertToViewportPoint(h+c,d+u)];let b=Math.min(w[0][0],w[1][0]),v=Math.min(w[0][1],w[1][1]);if(!i){b=Math.max(b,0);v=Math.max(v,0)}this.#Pi(a,{left:b,top:v})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===t?Math.round(1e4*t)/100:i,s=e.id,r=this._pages[s-1],a=this.container,o=r.getPagePoint(a.scrollLeft-e.x,a.scrollTop-e.y),l=Math.round(o[0]),h=Math.round(o[1]);let d=`#page=${s}`;this.isInPresentationMode||(d+=`&zoom=${n},${l},${h}`);this._location={pageNumber:s,scale:n,top:h,left:l,rotation:this._pagesRotation,pdfOpenParams:d}}update(){this.scrollMode===r.ScrollMode.PAGE?this.viewer.classList.add("singlePageView"):this.viewer.classList.remove("singlePageView");const e=this._getVisiblePages(),t=e.views,i=t.length;if(0===i)return;const n=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||u,s=Math.max(n,2*i+1);this.#Xt.resize(s,e.ids);this.renderingQueue.renderHighestPriority(e);const a=this._spreadMode===r.SpreadMode.NONE&&(this._scrollMode===r.ScrollMode.PAGE||this._scrollMode===r.ScrollMode.VERTICAL),o=this._currentPageNumber;let l=!1;for(const e of t){if(e.percent<100)break;if(e.id===o&&a){l=!0;break}}if(this.scrollMode!==r.ScrollMode.PAGE){this._setCurrentPageNumber(l?o:t[0].id);this._updateLocation(e.first);this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}this.hidePagesDependingOnpageViewMode()}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===r.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===r.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===r.ScrollMode.PAGE?this.#li.pages:this._pages,t=this._scrollMode===r.ScrollMode.HORIZONTAL,i=t&&this._isContainerRtl;return(0,r.getVisibleElements)({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}cleanup(){for(const e of this._pages)e.renderingState!==r.RenderingStates.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#$t(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(t);this.linkService._cachedPageNumber?.(t.ref)||this.linkService.cachePageRef(e.id,t.ref);return t}catch(e){console.error("Unable to get page for page view",e);return null}}#Gt(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case r.ScrollMode.PAGE:return this.#li.scrollDown;case r.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(e){const t=e||this._getVisiblePages(),i=this.#Gt(t),n=this._spreadMode!==r.SpreadMode.NONE&&this._scrollMode!==r.ScrollMode.HORIZONTAL,s=this.renderingQueue.getHighestPriority(t,this._pages,i,n);if(s){this.#$t(s).then((()=>{this.renderingQueue.renderView(s)}));return!0}return!1}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,i=this._pages.length;t<i;++t){const i=this._pages[t];if(i.width!==e.width||i.height!==e.height)return!1}return!0}getPagesOverview(){let e;return this._pages.map((t=>{const i=t.pdfPage.getViewport({scale:1}),n=(0,r.isPortraitOrientation)(i);if(void 0===e)e=n;else if(this.enablePrintAutoRotate&&n!==e)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.rotation}}))}get optionalContentConfigPromise(){if(!this.pdfDocument)return Promise.resolve(null);if(!this._optionalContentConfigPromise){console.error("optionalContentConfigPromise: Not initialized yet.");return this.pdfDocument.getOptionalContentConfig()}return this._optionalContentConfigPromise}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);if(this.pdfDocument&&this._optionalContentConfigPromise){this._optionalContentConfigPromise=e;this.refresh(!1,{optionalContentConfigPromise:e});this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e})}}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,r.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);if(!(this.pagesCount>p.FORCE_SCROLL_MODE_PAGE)){this._previousScrollMode=this._scrollMode;this._scrollMode=e;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e});this._updateScrollMode(this._currentPageNumber)}}}_updateScrollMode(e=null){const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===r.ScrollMode.HORIZONTAL);i.classList.toggle("scrollWrapped",t===r.ScrollMode.WRAPPED);if(this.pdfDocument&&e){t===r.ScrollMode.PAGE?this.#yi():this._previousScrollMode===r.ScrollMode.PAGE&&this._updateSpreadMode();this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#mi(this._currentScaleValue,{noScroll:!0});this._setCurrentPageNumber(e,!0);this.update()}}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,r.isValidSpreadMode)(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e;this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e});this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;if(this._scrollMode===r.ScrollMode.PAGE)this.#yi();else{t.textContent="";if(this._spreadMode===r.SpreadMode.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let n=null;for(let s=0,r=i.length;s<r;++s){if(null===n){n=document.createElement("div");n.className="spread";t.append(n)}else if(s%2===e){n=n.cloneNode(!1);t.append(n)}n.append(i[s].div)}}}this.hidePagesDependingOnpageViewMode();if(e){this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#mi(this._currentScaleValue,{noScroll:!0});this._setCurrentPageNumber(e,!0);this.update()}}_getPageAdvance(e,t=!1){if("book"===this.pageViewMode)return 2;switch(this._scrollMode){case r.ScrollMode.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:e,y:t,percent:s,widthPercent:r}of i){if(0===s||r<100)continue;let i=n.get(t);i||n.set(t,i||=[]);i.push(e)}for(const i of n.values()){const n=i.indexOf(e);if(-1===n)continue;const s=i.length;if(1===s)break;if(t)for(let t=n-1,s=0;t>=s;t--){const n=i[t],s=i[t+1]-1;if(n<s)return e-s}else for(let t=n+1,r=s;t<r;t++){const n=i[t],s=i[t-1]+1;if(n>s)return s-e}if(t){const t=i[0];if(t<e)return e-t+1}else{const t=i[s-1];if(t>e)return t-e+1}break}break}case r.ScrollMode.HORIZONTAL:break;case r.ScrollMode.PAGE:case r.ScrollMode.VERTICAL:{if(this._spreadMode===r.SpreadMode.NONE)break;const i=this._spreadMode-1;if(t&&e%2!==i)break;if(!t&&e%2===i)break;const{views:n}=this._getVisiblePages(),s=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of n)if(e===s){if(t>0&&100===i)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const i=this._getPageAdvance(e,!1)||1;this.currentPageNumber=Math.min(e+i,t);return!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;this.currentPageNumber=Math.max(e-t,1);return!0}increaseScale({drawingDelay:e,scaleFactor:t,steps:i}={}){if(!this.pdfDocument)return;let n=this._currentScale;if(t>1)n=Math.round(n*t*100)/100;else{i??=1;do{n=Math.ceil(10*(n*r.DEFAULT_SCALE_DELTA).toFixed(2))/10}while(--i>0&&n<r.MAX_SCALE)}let s=Number(PDFViewerApplicationOptions.get("maxZoom"));s||(s=r.MAX_SCALE);this.#mi(Math.min(s,n),{noScroll:!1,drawingDelay:e})}decreaseScale({drawingDelay:e,scaleFactor:t,steps:i}={}){if(!this.pdfDocument)return;let n=this._currentScale;if(t>0&&t<1)n=Math.round(n*t*100)/100;else{i??=1;do{n=Math.floor(10*(n/r.DEFAULT_SCALE_DELTA).toFixed(2))/10}while(--i>0&&n>r.MIN_SCALE)}let s=Number(PDFViewerApplicationOptions.get("minZoom"));s||(s=r.MIN_SCALE);this.#mi(Math.max(s,n),{noScroll:!1,drawingDelay:e})}#pi(e=this.container.clientHeight){if(e!==this.#oi){this.#oi=e;r.docStyle.setProperty("--viewer-container-height",`${e}px`)}}#ce(e){for(const t of e)if(t.target===this.container){this.#pi(Math.floor(t.borderBoxSize[0].blockSize));this.#ti=null;break}}get containerTopLeft(){return this.#ti||=[this.container.offsetTop,this.container.offsetLeft]}get annotationEditorMode(){return this.#ei?this.#Jt:s.AnnotationEditorType.DISABLE}set annotationEditorMode({mode:e,editId:t=null,isFromKeyboard:i=!1}){if(!this.#ei)throw new Error("The AnnotationEditor is not enabled.");if(this.#Jt!==e){if(!isValidAnnotationEditorMode(e))throw new Error(`Invalid AnnotationEditor mode: ${e}`);if(this.pdfDocument){this.#Jt=e;this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e});this.#ei.updateMode(e,t,i)}}}set annotationEditorParams({type:e,value:t}){if(!this.#ei)throw new Error("The AnnotationEditor is not enabled.");this.#ei.updateParams(e,t)}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(const e of this._pages)e.update(t);if(null!==this.#di){clearTimeout(this.#di);this.#di=null}e||this.update()}}getSerializedAnnotations(){const e=this.pdfDocument.annotationStorage.getAll();if(e){return Object.values(e).map((e=>e.serialize()))}return null}addEditorAnnotation(e){Array.isArray(e)||(e=[e]);this.#ei.addSerializedEditor(e,!0,!0,!1)}removeEditorAnnotations(e=(()=>!0)){this.#ei.removeEditors(e)}destroyBookMode(){if(this.pageFlip){this.pageFlip.destroy();this.pageFlip=null}}stopRendering(){this._cancelRendering()}}n()}catch(g){n(g)}}))},1869:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{AbortException:()=>e,AnnotationEditorLayer:()=>s,AnnotationEditorParamsType:()=>r,AnnotationEditorType:()=>a,AnnotationEditorUIManager:()=>o,AnnotationLayer:()=>l,AnnotationMode:()=>h,ColorPicker:()=>u,DOMSVGFactory:()=>g,DrawLayer:()=>f,FeatureTest:()=>m,GlobalWorkerOptions:()=>S,InvalidPDFException:()=>_,MissingPDFException:()=>T,PDFDateString:()=>B,PasswordResponses:()=>D,PermissionFlag:()=>V,PixelsPerInch:()=>F,PromiseCapability:()=>R,RenderingCancelledException:()=>O,UnexpectedResponseException:()=>j,XfaLayer:()=>Z,build:()=>d,createValidAbsoluteUrl:()=>p,fetchData:()=>w,getDocument:()=>b,getFilenameFromUrl:()=>v,getPdfFilenameFromUrl:()=>y,getXfaPageViewport:()=>P,isPdfFile:()=>x,noContextMenu:()=>L,normalizeUnicode:()=>I,renderTextLayer:()=>H,setLayerDimensions:()=>U,shadow:()=>z,updateTextLayer:()=>W,version:()=>K});globalThis.pdfjsLib||await globalThis.pdfjsLibPromise;const{AbortException:e,AnnotationEditorLayer:s,AnnotationEditorParamsType:r,AnnotationEditorType:a,AnnotationEditorUIManager:o,AnnotationLayer:l,AnnotationMode:h,build:d,CMapCompressionType:c,ColorPicker:u,createValidAbsoluteUrl:p,DOMSVGFactory:g,DrawLayer:f,FeatureTest:m,fetchData:w,getDocument:b,getFilenameFromUrl:v,getPdfFilenameFromUrl:y,getXfaPageViewport:P,GlobalWorkerOptions:S,ImageKind:E,InvalidPDFException:_,isDataScheme:C,isPdfFile:x,MissingPDFException:T,noContextMenu:L,normalizeUnicode:I,OPS:M,Outliner:A,PasswordResponses:D,PDFDataRangeTransport:N,PDFDateString:B,PDFWorker:k,PermissionFlag:V,PixelsPerInch:F,PromiseCapability:R,RenderingCancelledException:O,renderTextLayer:H,setLayerDimensions:U,shadow:z,UnexpectedResponseException:j,updateTextLayer:W,Util:$,VerbosityLevel:G,version:K,XfaLayer:Z}=globalThis.pdfjsLib;n()}catch(e){n(e)}}),1)},216:(e,t,i)=>{i.d(t,{BasePreferences:()=>BasePreferences});var n=i(8961);class BasePreferences{#Ci=Object.freeze({annotationEditorMode:0,annotationMode:2,cursorToolOnLoad:0,defaultZoomDelay:400,defaultZoomValue:"",disablePageLabels:!1,enableHighlightEditor:!1,enablePermissions:!1,enablePrintAutoRotate:!0,enableScripting:!0,externalLinkTarget:0,highlightEditorColors:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",historyUpdateUrl:!1,ignoreDestinationZoom:!1,forcePageColors:!1,pageColorsBackground:"Canvas",pageColorsForeground:"CanvasText",pdfBugEnabled:!1,removePageBorders:!1,sidebarViewOnLoad:-1,scrollModeOnLoad:-1,spreadModeOnLoad:-1,textLayerMode:1,viewOnLoad:0,disableAutoFetch:!1,disableFontFace:!1,disableRange:!1,disableStream:!1,enableXfa:!0,viewerCssTheme:0});#xi=Object.create(null);#Ti=null;constructor(){if(this.constructor===BasePreferences)throw new Error("Cannot initialize BasePreferences.");this.#Ti=this._readFromStorage(this.#Ci).then((({browserPrefs:e,prefs:t})=>{const i={canvasMaxAreaInBytes:-1,isInAutomation:!1,supportsDocumentFonts:!0,supportsIntegratedFind:!1,supportsMouseWheelZoomCtrlKey:!0,supportsMouseWheelZoomMetaKey:!0,supportsPinchToZoom:!0},s=Object.create(null);for(const[t,n]of Object.entries(i)){const i=e?.[t];s[t]=typeof i==typeof n?i:n}for(const[e,i]of Object.entries(this.#Ci)){const n=t?.[e];s[e]=this.#xi[e]=typeof n==typeof i?n:i}n.AppOptions.setAll(s,!0)}))}async _writeToStorage(e){throw new Error("Not implemented: _writeToStorage")}async _readFromStorage(e){throw new Error("Not implemented: _readFromStorage")}async reset(){await this.#Ti;const e=this.#xi;this.#xi=Object.create(null);return this._writeToStorage(this.#Ci).catch((t=>{this.#xi=e;throw t}))}async set(e,t){await this.#Ti;const i=this.#Ci[e],n=this.#xi;if(void 0===i)throw new Error(`Set preference: "${e}" is undefined.`);if(void 0===t)throw new Error("Set preference: no value is specified.");const s=typeof t,r=typeof i;if(s!==r){if("number"!==s||"string"!==r)throw new Error(`Set preference: "${t}" is a ${s}, expected a ${r}.`);t=t.toString()}else if("number"===s&&!Number.isInteger(t))throw new Error(`Set preference: "${t}" must be an integer.`);this.#xi[e]=t;return this._writeToStorage(this.#xi).catch((e=>{this.#xi=n;throw e}))}async get(e){await this.#Ti;const t=this.#Ci[e];if(void 0===t)throw new Error(`Get preference: "${e}" is undefined.`);return this.#xi[e]??t}get initializedPromise(){return this.#Ti}}},4552:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{getXfaHtmlForPrinting:()=>getXfaHtmlForPrinting});var s=i(1869),r=i(3234),a=i(8012),o=e([s,a]);[s,a]=o.then?(await o)():o;function getXfaHtmlForPrinting(e,t){const i=t.allXfaHtml,n=new r.SimpleLinkService,o=Math.round(100*s.PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const r of i.children){const i=document.createElement("div");i.className="xfaPrintedPage";e.append(i);const l=new a.XfaLayerBuilder({pdfPage:null,annotationStorage:t.annotationStorage,linkService:n,xfaHtml:r}),h=(0,s.getXfaPageViewport)(r,{scale:o});l.render(h,"print");i.append(l.div)}}n()}catch(l){n(l)}}))},1544:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{SecondaryToolbar:()=>SecondaryToolbar});var s=i(4927),r=i(9290),a=e([r]);r=(a.then?(await a)():a)[0];class SecondaryToolbar{#Li;constructor(e,t){this.#Li=e;const i=[{element:e.presentationModeButton,eventName:"presentationmode",close:!0},{element:e.printButton,eventName:"print",close:!0},{element:e.downloadButton,eventName:"download",close:!0},{element:e.viewBookmarkButton,eventName:null,close:!0},{element:e.firstPageButton,eventName:"firstpage",close:!0},{element:e.lastPageButton,eventName:"lastpage",close:!0},{element:e.pageRotateCwButton,eventName:"rotatecw",close:!1},{element:e.pageRotateCcwButton,eventName:"rotateccw",close:!1},{element:e.cursorSelectToolButton,eventName:"switchcursortool",eventDetails:{tool:s.CursorTool.SELECT},close:!0},{element:e.cursorHandToolButton,eventName:"switchcursortool",eventDetails:{tool:s.CursorTool.HAND},close:!0},{element:e.scrollPageButton,eventName:"switchscrollmode",eventDetails:{mode:s.ScrollMode.PAGE},close:!0},{element:e.scrollVerticalButton,eventName:"switchscrollmode",eventDetails:{mode:s.ScrollMode.VERTICAL},close:!0},{element:e.scrollHorizontalButton,eventName:"switchscrollmode",eventDetails:{mode:s.ScrollMode.HORIZONTAL},close:!0},{element:e.scrollWrappedButton,eventName:"switchscrollmode",eventDetails:{mode:s.ScrollMode.WRAPPED},close:!0},{element:e.spreadNoneButton,eventName:"switchspreadmode",eventDetails:{mode:s.SpreadMode.NONE},close:!0},{element:e.spreadOddButton,eventName:"switchspreadmode",eventDetails:{mode:s.SpreadMode.ODD},close:!0},{element:e.spreadEvenButton,eventName:"switchspreadmode",eventDetails:{mode:s.SpreadMode.EVEN},close:!0},{element:e.documentPropertiesButton,eventName:"documentproperties",close:!0}];i.push({element:e.openFileButton,eventName:"openfile",close:!0});this.eventBus=t;this.opened=!1;this.#M(i);this.reset()}get isOpen(){return this.opened}setPageNumber(e){this.pageNumber=e;this.#t()}setPagesCount(e){this.pagesCount=e;this.#t()}reset(){this.pageNumber=0;this.pagesCount=0;this.#t();this.#Ii({mode:s.ScrollMode.VERTICAL});this.#Mi({mode:s.SpreadMode.NONE})}#t(){const{firstPageButton:e,lastPageButton:t,pageRotateCwButton:i,pageRotateCcwButton:n}=this.#Li;e.disabled=this.pageNumber<=1;t.disabled=this.pageNumber>=this.pagesCount;i.disabled=0===this.pagesCount;n.disabled=0===this.pagesCount}#M(e){const{eventBus:t}=this,{toggleButton:i}=this.#Li;i.addEventListener("click",this.toggle.bind(this));for(const{element:i,eventName:n,close:s,eventDetails:r}of e)i.addEventListener("click",(e=>{null!==n&&t.dispatch(n,{source:this,...r});s&&this.close();t.dispatch("reporttelemetry",{source:this,details:{type:"buttons",data:{id:i.id}}})}));t._on("cursortoolchanged",this.#Ai.bind(this));t._on("scrollmodechanged",this.#Ii.bind(this));t._on("spreadmodechanged",this.#Mi.bind(this))}#Ai({tool:e}){const{cursorSelectToolButton:t,cursorHandToolButton:i}=this.#Li;(0,s.toggleCheckedBtn)(t,e===s.CursorTool.SELECT);(0,s.toggleCheckedBtn)(i,e===s.CursorTool.HAND)}#Ii({mode:e}){const{scrollPageButton:t,scrollVerticalButton:i,scrollHorizontalButton:n,scrollWrappedButton:a,spreadNoneButton:o,spreadOddButton:l,spreadEvenButton:h}=this.#Li;(0,s.toggleCheckedBtn)(t,e===s.ScrollMode.PAGE);(0,s.toggleCheckedBtn)(i,e===s.ScrollMode.VERTICAL);(0,s.toggleCheckedBtn)(n,e===s.ScrollMode.HORIZONTAL);(0,s.toggleCheckedBtn)(a,e===s.ScrollMode.WRAPPED);const d=this.pagesCount>r.PagesCountLimit.FORCE_SCROLL_MODE_PAGE;t.disabled=d;i.disabled=d;n.disabled=d;a.disabled=d;const c=e===s.ScrollMode.HORIZONTAL;o.disabled=c;l.disabled=c;h.disabled=c}#Mi({mode:e}){const{spreadNoneButton:t,spreadOddButton:i,spreadEvenButton:n}=this.#Li;(0,s.toggleCheckedBtn)(t,e===s.SpreadMode.NONE);(0,s.toggleCheckedBtn)(i,e===s.SpreadMode.ODD);(0,s.toggleCheckedBtn)(n,e===s.SpreadMode.EVEN)}open(){if(this.opened)return;this.opened=!0;const{toggleButton:e,toolbar:t}=this.#Li;(0,s.toggleExpandedBtn)(e,!0,t)}close(){if(!this.opened)return;this.opened=!1;const{toggleButton:e,toolbar:t}=this.#Li;(0,s.toggleExpandedBtn)(e,!1,t)}toggle(){this.opened?this.close():this.open()}}n()}catch(e){n(e)}}))},7498:(e,t,i)=>{i.d(t,{StructTreeLayerBuilder:()=>StructTreeLayerBuilder});var n=i(4927);const s={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},r=/^H(\d+)$/;class StructTreeLayerBuilder{#Di=void 0;get renderingDone(){return void 0!==this.#Di}render(e){if(void 0!==this.#Di)return this.#Di;const t=this.#Ni(e);t?.classList.add("structTree");return this.#Di=t}hide(){this.#Di&&!this.#Di.hidden&&(this.#Di.hidden=!0)}show(){this.#Di?.hidden&&(this.#Di.hidden=!1)}#Bi(e,t){const{alt:i,id:s,lang:r}=e;void 0!==i&&t.setAttribute("aria-label",(0,n.removeNullCharacters)(i));void 0!==s&&t.setAttribute("aria-owns",s);void 0!==r&&t.setAttribute("lang",(0,n.removeNullCharacters)(r,!0))}#Ni(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:i}=e,n=i.match(r);if(n){t.setAttribute("role","heading");t.setAttribute("aria-level",n[1])}else s[i]&&t.setAttribute("role",s[i])}this.#Bi(e,t);if(e.children)if(1===e.children.length&&"id"in e.children[0])this.#Bi(e.children[0],t);else for(const i of e.children)t.append(this.#Ni(i));return t}}},4630:(e,t,i)=>{i.d(t,{TextAccessibilityManager:()=>TextAccessibilityManager});var n=i(4927);class TextAccessibilityManager{#ki=!1;#Vi=null;#Fi=new Map;#Ri=new Map;setTextMapping(e){this.#Vi=e}static#Oi(e,t){const i=e.getBoundingClientRect(),n=t.getBoundingClientRect();if(0===i.width&&0===i.height)return 1;if(0===n.width&&0===n.height)return-1;const s=i.y,r=i.y+i.height,a=i.y+i.height/2,o=n.y,l=n.y+n.height,h=n.y+n.height/2;if(a<=o&&h>=r)return-1;if(h<=s&&a>=l)return 1;return i.x+i.width/2-(n.x+n.width/2)}enable(){if(this.#ki)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#Vi)throw new Error("Text divs and strings have not been set.");this.#ki=!0;this.#Vi=this.#Vi.slice();this.#Vi.sort(TextAccessibilityManager.#Oi);if(this.#Fi.size>0){const e=this.#Vi;for(const[t,i]of this.#Fi){document.getElementById(t)?this.#Hi(t,e[i]):this.#Fi.delete(t)}}for(const[e,t]of this.#Ri)this.addPointerInTextLayer(e,t);this.#Ri.clear()}disable(){if(this.#ki){this.#Ri.clear();this.#Vi=null;this.#ki=!1}}removePointerInTextLayer(e){if(!this.#ki){this.#Ri.delete(e);return}const t=this.#Vi;if(!t||0===t.length)return;const{id:i}=e,n=this.#Fi.get(i);if(void 0===n)return;const s=t[n];this.#Fi.delete(i);let r=s.getAttribute("aria-owns");if(r?.includes(i)){r=r.split(" ").filter((e=>e!==i)).join(" ");if(r)s.setAttribute("aria-owns",r);else{s.removeAttribute("aria-owns");s.setAttribute("role","presentation")}}}#Hi(e,t){const i=t.getAttribute("aria-owns");i?.includes(e)||t.setAttribute("aria-owns",i?`${i} ${e}`:e);t.removeAttribute("role")}addPointerInTextLayer(e,t){const{id:i}=e;if(!i)return null;if(!this.#ki){this.#Ri.set(e,t);return null}t&&this.removePointerInTextLayer(e);const s=this.#Vi;if(!s||0===s.length)return null;const r=(0,n.binarySearchFirstItem)(s,(t=>TextAccessibilityManager.#Oi(e,t)<0)),a=Math.max(0,r-1),o=s[a];this.#Hi(i,o);this.#Fi.set(i,a);const l=o.parentNode;return l?.classList.contains("markedContent")?l.id:null}moveElementInDOM(e,t,i,s){const r=this.addPointerInTextLayer(i,s);if(!e.hasChildNodes()){e.append(t);return r}const a=Array.from(e.childNodes).filter((e=>e!==t));if(0===a.length)return r;const o=i||t,l=(0,n.binarySearchFirstItem)(a,(e=>TextAccessibilityManager.#Oi(o,e)<0));0===l?a[0].before(t):a[l-1].after(t);return r}}},4274:(e,t,i)=>{i.d(t,{TextHighlighter:()=>TextHighlighter});class TextHighlighter{constructor({findController:e,eventBus:t,pageIndex:i}){this.findController=e;this.matches=[];this.eventBus=t;this.pageIdx=i;this._onUpdateTextLayerMatches=null;this.textDivs=null;this.textContentItemsStr=null;this.enabled=!1}setTextMapping(e,t){this.textDivs=e;this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(!this.enabled){this.enabled=!0;if(!this._onUpdateTextLayerMatches){this._onUpdateTextLayerMatches=e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()};this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)}this._updateMatches()}}disable(){if(this.enabled){this.enabled=!1;if(this._onUpdateTextLayerMatches){this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches);this._onUpdateTextLayerMatches=null}this._updateMatches(!0)}}_convertMatches(e,t){if(!e)return[];const{textContentItemsStr:i}=this;let n=0,s=0;const r=i.length-1,a=[];for(let o=0,l=e.length;o<l;o++){let l=e[o];for(;n!==r&&l>=s+i[n].length;){s+=i[n].length;n++}n===i.length&&globalThis.ngxConsole.error("Could not find a matching mapping");const h={begin:{divIdx:n,offset:l-s}};l+=t[o];for(;n!==r&&l>s+i[n].length;){s+=i[n].length;n++}h.end={divIdx:n,offset:l-s};a.push(h)}return a}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this,r=i===t.selected.pageIdx,a=t.selected.matchIdx;let o=null;const l={divIdx:-1,offset:void 0};function beginText(e,t){const i=e.divIdx;s[i].textContent="";return appendTextToDiv(i,0,e.offset,t)}function appendTextToDiv(e,t,i,r){let a=s[e];if(a.nodeType===Node.TEXT_NODE){const t=document.createElement("span");a.before(t);t.append(a);s[e]=t;a=t}const o=n[e].substring(t,i),l=document.createTextNode(o);if(r){const e=document.createElement("span");e.className=`${r} appended`;e.append(l);a.append(e);return r.includes("selected")?e.offsetLeft:0}a.append(l);return 0}let h=a,d=h+1;if(t.state.highlightAll){h=0;d=e.length}else if(!r)return;let c=-1,u=-1;for(let n=h;n<d;n++){const h=e[n],d=h.begin;if(d.divIdx===c&&d.offset===u)continue;c=d.divIdx;u=d.offset;const p=h.end,g=r&&n===a,f=g?" selected":"";let m=0;if(o&&d.divIdx===o.divIdx)appendTextToDiv(o.divIdx,o.offset,d.offset);else{null!==o&&appendTextToDiv(o.divIdx,o.offset,l.offset);beginText(d)}if(d.divIdx===p.divIdx)m=appendTextToDiv(d.divIdx,d.offset,p.offset,"highlight"+f);else{m=appendTextToDiv(d.divIdx,d.offset,l.offset,"highlight begin"+f);for(let e=d.divIdx+1,t=p.divIdx;e<t;e++)s[e].className="highlight middle"+f;beginText(p,"highlight end"+f)}o=p;g&&t.scrollMatchIntoView({element:s[d.divIdx],selectedLeft:m,pageIndex:i,matchIndex:a})}o&&appendTextToDiv(o.divIdx,o.offset,l.offset)}_updateMatches(e=!1){if(!this.enabled&&!e)return;const{findController:t,matches:i,pageIdx:n}=this,{textContentItemsStr:s,textDivs:r}=this;let a=-1;for(const e of i){for(let t=Math.max(a,e.begin.divIdx),i=e.end.divIdx;t<=i;t++){const e=r[t];e.textContent=s[t];e.className=""}a=e.end.divIdx+1}if(!t?.highlightMatches||e)return;const o=t.pageMatches[n]||null,l=t.pageMatchesLength[n]||null;this.matches=this._convertMatches(o,l);this._renderMatches(this.matches)}}},1013:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{TextLayerBuilder:()=>TextLayerBuilder});var s=i(1869),r=i(4927),a=e([s]);s=(a.then?(await a)():a)[0];class TextLayerBuilder{#ni=!1;#Ui=0;#zi=0;#ji=null;constructor({highlighter:e=null,accessibilityManager:t=null,isOffscreenCanvasSupported:i=!0,enablePermissions:n=!1}){this.textContentItemsStr=[];this.renderingDone=!1;this.textDivs=[];this.textDivProperties=new WeakMap;this.textLayerRenderTask=null;this.highlighter=e;this.accessibilityManager=t;this.isOffscreenCanvasSupported=i;this.#ni=!0===n;this.onAppend=null;this.div=document.createElement("div");this.div.className="textLayer"}#Wi(){this.renderingDone=!0;const e=document.createElement("div");e.className="endOfContent";this.div.append(e);this.#$i()}get numTextDivs(){return this.textDivs.length}async render(e){if(!this.#ji)throw new Error('No "textContentSource" parameter specified.');const t=e.scale*(globalThis.devicePixelRatio||1),{rotation:i}=e;if(this.renderingDone){const n=i!==this.#Ui,r=t!==this.#zi;if(n||r){this.hide();(0,s.updateTextLayer)({container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,mustRescale:r,mustRotate:n});this.#zi=t;this.#Ui=i}this.show()}else{this.cancel();this.highlighter?.setTextMapping(this.textDivs,this.textContentItemsStr);this.accessibilityManager?.setTextMapping(this.textDivs);this.textLayerRenderTask=(0,s.renderTextLayer)({textContentSource:this.#ji,container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,textContentItemsStr:this.textContentItemsStr,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported});await this.textLayerRenderTask.promise;this.#Wi();this.#zi=t;this.#Ui=i;this.onAppend(this.div);this.highlighter?.enable();this.accessibilityManager?.enable()}}hide(){if(!this.div.hidden&&this.renderingDone){this.highlighter?.disable();this.div.hidden=!0}}show(){if(this.div.hidden&&this.renderingDone){this.div.hidden=!1;this.highlighter?.enable()}}cancel(){if(this.textLayerRenderTask){this.textLayerRenderTask.cancel();this.textLayerRenderTask=null}this.highlighter?.disable();this.accessibilityManager?.disable();this.textContentItemsStr.length=0;this.textDivs.length=0;this.textDivProperties=new WeakMap}setTextContentSource(e){this.cancel();this.#ji=e}#$i(){const{div:e}=this;e.addEventListener("mousedown",(t=>{const i=e.querySelector(".endOfContent");if(!i)return;let n=t.target!==e;n&&="none"!==getComputedStyle(i).getPropertyValue("-moz-user-select");if(n){const n=e.getBoundingClientRect(),s=Math.max(0,(t.pageY-n.top)/n.height);i.style.top=(100*s).toFixed(2)+"%"}i.classList.add("active")}));e.addEventListener("mouseup",(()=>{const t=e.querySelector(".endOfContent");if(t){t.style.top="";t.classList.remove("active")}}));e.addEventListener("copy",(e=>{if(!this.#ni){const t=document.getSelection();e.clipboardData.setData("text/plain",(0,r.removeNullCharacters)((0,s.normalizeUnicode)(t.toString())))}e.preventDefault();e.stopPropagation()}))}}n()}catch(e){n(e)}}))},276:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{Toolbar:()=>Toolbar});var s=i(1869),r=i(4927),a=e([s]);s=(a.then?(await a)():a)[0];class Toolbar{#Li;constructor(e,t){this.#Li=e;this.eventBus=t;const i=[{element:e.previous,eventName:"previouspage"},{element:e.next,eventName:"nextpage"},{element:e.zoomIn,eventName:"zoomin"},{element:e.zoomOut,eventName:"zoomout"},{element:e.print,eventName:"print"},{element:e.presentationModeButton,eventName:"presentationmode"},{element:e.download,eventName:"download"},{element:e.editorFreeTextButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:t}=e.editorFreeTextButton;return t.contains("toggled")?s.AnnotationEditorType.NONE:s.AnnotationEditorType.FREETEXT}}},{element:e.editorHighlightButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:t}=e.editorHighlightButton;return t.contains("toggled")?s.AnnotationEditorType.NONE:s.AnnotationEditorType.HIGHLIGHT}}},{element:e.editorInkButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:t}=e.editorInkButton;return t.contains("toggled")?s.AnnotationEditorType.NONE:s.AnnotationEditorType.INK}}},{element:e.editorStampButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:t}=e.editorStampButton;return t.contains("toggled")?s.AnnotationEditorType.NONE:s.AnnotationEditorType.STAMP}}}];this.#M(i);e.editorHighlightColorPicker&&t._on("annotationeditoruimanager",(({uiManager:t})=>{this.#Gi(t,e.editorHighlightColorPicker)}),{once:!0});this.reset()}#Gi(e,t){const i=new s.ColorPicker({uiManager:e});e.setMainHighlightColorPicker(i);t.append(i.renderMainDropdown())}setPageNumber(e,t){this.pageNumber=e;this.pageLabel=t;this.#t(!1)}setPagesCount(e,t){this.pagesCount=e;this.hasPageLabels=t;this.#t(!0)}setPageScale(e,t){this.pageScaleValue=(e||t).toString();this.pageScale=t;this.#t(!1)}reset(){this.pageNumber=0;this.pageLabel=null;this.hasPageLabels=!1;this.pagesCount=0;const e=PDFViewerApplicationOptions.get("defaultZoomValue");if(e){this.pageScaleValue=e;Number(e)&&(this.pageScale=Number(e))}else{this.pageScaleValue=r.DEFAULT_SCALE_VALUE;this.pageScale=r.DEFAULT_SCALE}this.#t(!0);this.updateLoadingIndicatorState();this.#Ki({mode:s.AnnotationEditorType.DISABLE})}#M(e){const{eventBus:t}=this,{pageNumber:i,scaleSelect:n}=this.#Li,r=this;for(const{element:i,eventName:n,eventDetails:s}of e)i.addEventListener("click",(e=>{null!==n&&t.dispatch(n,{source:this,...s,isFromKeyboard:0===e.detail})}));i.addEventListener("click",(function(){this.select()}));i.addEventListener("change",(function(){t.dispatch("pagenumberchanged",{source:r,value:this.value})}));n.addEventListener("change",(function(){"custom"!==this.value&&t.dispatch("scalechanged",{source:r,value:this.value})}));n.addEventListener("click",(function({target:e}){this.value===r.pageScaleValue&&"OPTION"===e.tagName.toUpperCase()&&this.blur()}));n.oncontextmenu=s.noContextMenu;t._on("annotationeditormodechanged",this.#Ki.bind(this))}#Ki({mode:e}){const{editorFreeTextButton:t,editorFreeTextParamsToolbar:i,editorHighlightButton:n,editorHighlightParamsToolbar:a,editorInkButton:o,editorInkParamsToolbar:l,editorStampButton:h,editorStampParamsToolbar:d}=this.#Li;(0,r.toggleCheckedBtn)(t,e===s.AnnotationEditorType.FREETEXT,i);(0,r.toggleCheckedBtn)(n,e===s.AnnotationEditorType.HIGHLIGHT,a);(0,r.toggleCheckedBtn)(o,e===s.AnnotationEditorType.INK,l);(0,r.toggleCheckedBtn)(h,e===s.AnnotationEditorType.STAMP,d);const c=e===s.AnnotationEditorType.DISABLE;t.disabled=c;n.disabled=c;o.disabled=c;h.disabled=c}#t(e=!1){const{pageNumber:t,pagesCount:i,pageScaleValue:n,pageScale:s}=this,a=this.#Li;if(e){if(this.hasPageLabels){a.pageNumber.type="text";a.numPages.setAttribute("data-l10n-id","pdfjs-page-of-pages")}else{a.pageNumber.type="number";a.numPages.setAttribute("data-l10n-id","pdfjs-of-pages");a.numPages.setAttribute("data-l10n-args",JSON.stringify({pagesCount:i}))}a.pageNumber.max=i}if(this.hasPageLabels){a.pageNumber.value=this.pageLabel;a.numPages.setAttribute("data-l10n-args",JSON.stringify({pageNumber:t,pagesCount:i}))}else a.pageNumber.value=t;a.previous.disabled=t<=1;a.next.disabled=t>=i;a.zoomOut.disabled=s<=r.MIN_SCALE;a.zoomIn.disabled=s>=r.MAX_SCALE;let o=!1;if(a.scaleSelect.options)for(const e of a.scaleSelect.options)if(e.value===n){e.selected=!0;o=!0}else e.selected=!1;if(!o){a.customScaleOption.selected=!0;a.customScaleOption.setAttribute("data-l10n-args",JSON.stringify({scale:Math.round(1e4*s)/100}))}this.eventBus.dispatch("updateuistate",{source:this,widget:"Toolbar",pageNumber:t,pagesCount:i,pageScaleValue:n,pageScale:s})}updateLoadingIndicatorState(e=!1){const{pageNumber:t}=this.#Li;t.classList.toggle("loading",e)}}n()}catch(e){n(e)}}))},4927:(e,t,i)=>{i.d(t,{AutoPrintRegExp:()=>v,CursorTool:()=>b,DEFAULT_SCALE:()=>s,DEFAULT_SCALE_DELTA:()=>r,DEFAULT_SCALE_VALUE:()=>n,MAX_AUTO_SCALE:()=>h,MAX_SCALE:()=>o,MIN_SCALE:()=>a,OutputScale:()=>OutputScale,PresentationModeState:()=>p,ProgressBar:()=>ProgressBar,RenderingStates:()=>u,SCROLLBAR_PADDING:()=>d,ScrollMode:()=>m,SidebarView:()=>g,SpreadMode:()=>w,TextLayerMode:()=>f,UNKNOWN_SCALE:()=>l,VERTICAL_PADDING:()=>c,animationStarted:()=>P,apiPageLayoutToViewerModes:()=>apiPageLayoutToViewerModes,apiPageModeToSidebarView:()=>apiPageModeToSidebarView,approximateFraction:()=>approximateFraction,binarySearchFirstItem:()=>binarySearchFirstItem,docStyle:()=>S,getActiveOrFocusedElement:()=>getActiveOrFocusedElement,getPageSizeInches:()=>getPageSizeInches,getVisibleElements:()=>getVisibleElements,isPortraitOrientation:()=>isPortraitOrientation,isValidRotation:()=>isValidRotation,isValidScrollMode:()=>isValidScrollMode,isValidSpreadMode:()=>isValidSpreadMode,normalizeWheelEventDelta:()=>normalizeWheelEventDelta,normalizeWheelEventDirection:()=>normalizeWheelEventDirection,parseQueryString:()=>parseQueryString,removeNullCharacters:()=>removeNullCharacters,roundToDivide:()=>roundToDivide,scrollIntoView:()=>scrollIntoView,toggleCheckedBtn:()=>toggleCheckedBtn,toggleExpandedBtn:()=>toggleExpandedBtn,watchScroll:()=>watchScroll});const n="auto",s=1,r=1.1,a=.1,o=10,l=0,h=1.25,d=40,c=5,u={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},p={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},g={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4},f={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2},m={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},w={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2},b={SELECT:0,HAND:1,ZOOM:2},v=/\bprint\s*\(/;class OutputScale{constructor(){const e=window.devicePixelRatio||1;this.sx=e;this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}}function scrollIntoView(e,t,i=!1,n=!1){if(e.classList.contains("stf__item")||e.parentElement?.classList.contains("stf__item")||e.parentElement?.parentElement?.classList.contains("stf__item"))return;let s=e.offsetParent;if(!s){globalThis.ngxConsole.error("offsetParent is not set -- cannot scroll");return}let r=e.offsetTop+e.clientTop,a=e.offsetLeft+e.clientLeft;for(;s.clientHeight===s.scrollHeight&&s.clientWidth===s.scrollWidth||i&&(s.classList.contains("markedContent")||"hidden"===getComputedStyle(s).overflow);){r+=s.offsetTop;a+=s.offsetLeft;s=s.offsetParent;if(!s){if(n&&document.body.clientHeight>r){r-=32;window.scrollTo(window.scrollX,r)}return}}if(t){void 0!==t.top&&(r+=t.top);if(void 0!==t.left){a+=t.left;s.scrollLeft=a}}else if(function isDivInViewport(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}(e))return;s.scrollTop=r}function watchScroll(e,t){const debounceScroll=function(s){n||(n=window.requestAnimationFrame((function viewAreaElementScrolled(){n=null;const s=e.scrollLeft,r=i.lastX;s!==r&&(i.right=s>r);i.lastX=s;const a=e.scrollTop,o=i.lastY;a!==o&&(i.down=a>o);i.lastY=a;t(i)})))},i={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:debounceScroll};let n=null;e.addEventListener("scroll",debounceScroll,!0);return i}function parseQueryString(e){const t=new Map;for(const[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t}const y=/[\x00-\x1F]/g;function removeNullCharacters(e,t=!1){return y.test(e)?t?e.replaceAll(y,(e=>"\0"===e?"":" ")):e.replaceAll("\0",""):e}function binarySearchFirstItem(e,t,i=0){let n=i,s=e.length-1;if(s<0||!t(e[s]))return e.length;if(t(e[n]))return n;for(;n<s;){const i=n+s>>1;t(e[i])?s=i:n=i+1}return n}function approximateFraction(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let n,s=0,r=1,a=1,o=1;for(;;){const e=s+a,t=r+o;if(t>8)break;if(i<=e/t){a=e;o=t}else{s=e;r=t}}n=i-s/r<a/o-i?i===e?[s,r]:[r,s]:i===e?[a,o]:[o,a];return n}function roundToDivide(e,t){const i=e%t;return 0===i?e:Math.round(e-i+t)}function getPageSizeInches({view:e,userUnit:t,rotate:i}){const[n,s,r,a]=e,o=i%180!=0,l=(r-n)/72*t,h=(a-s)/72*t;return{width:o?h:l,height:o?l:h}}function getVisibleElements({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:n=!1,rtl:s=!1}){const r=e.scrollTop,a=r+e.clientHeight,o=e.scrollLeft,l=o+e.clientWidth;const h=[],d=new Set,c=t.length;let u=binarySearchFirstItem(t,n?function isElementNextAfterViewHorizontally(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return s?i<l:n>o}:function isElementBottomAfterViewTop(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});u>0&&u<c&&!n&&(u=function backtrackBeforeAllVisibleElements(e,t,i){if(e<2)return e;let n=t[e].div,s=n.offsetTop+n.clientTop;if(s>=i){n=t[e-1].div;s=n.offsetTop+n.clientTop}for(let i=e-2;i>=0;--i){n=t[i].div;if(n.offsetTop+n.clientTop+n.clientHeight<=s)break;e=i}return e}(u,t,r));let p=n?l:-1;for(let e=u;e<c;e++){const i=t[e],s=i.div,c=s.offsetLeft+s.clientLeft,u=s.offsetTop+s.clientTop,g=s.clientWidth,f=s.clientHeight,m=c+g,w=u+f;if(-1===p)w>=a&&(p=w);else if((n?c:u)>p)break;if(w<=r||u>=a||m<=o||c>=l)continue;const b=Math.max(0,r-u)+Math.max(0,w-a),v=(g-(Math.max(0,o-c)+Math.max(0,m-l)))/g,y=(f-b)/f*v*100|0;h.push({id:i.id,x:c,y:u,view:i,percent:y,widthPercent:100*v|0});d.add(i.id)}const g=h[0],f=h.at(-1);i&&h.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id}));return{first:g,last:f,views:h,ids:d}}function normalizeWheelEventDirection(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t);return t}function normalizeWheelEventDelta(e){const t=e.deltaMode;let i=normalizeWheelEventDirection(e);t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30);return i}function isValidRotation(e){return Number.isInteger(e)&&e%90==0}function isValidScrollMode(e){return Number.isInteger(e)&&Object.values(m).includes(e)&&e!==m.UNKNOWN}function isValidSpreadMode(e){return Number.isInteger(e)&&Object.values(w).includes(e)&&e!==w.UNKNOWN}function isPortraitOrientation(e){return e.width<=e.height}const P=new Promise((function(e){window.ngxZone.runOutsideAngular((()=>{window.requestAnimationFrame(e)}))})),S=document.documentElement.style;class ProgressBar{#Zi=null;#qi=null;#Xi=0;#Qi=null;#Yi=!0;constructor(e){this.#Zi=e.classList;this.#Qi=e.style}get percent(){return this.#Xi}set percent(e){this.#Xi=function clamp(e,t,i){return Math.min(Math.max(e,t),i)}(e,0,100);if(isNaN(e))this.#Zi.add("indeterminate");else{this.#Zi.remove("indeterminate");this.#Qi.setProperty("--progressBar-percent",`${this.#Xi}%`)}}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&this.#Qi.setProperty("--progressBar-end-offset",`${t}px`)}setDisableAutoFetch(e=5e3){if(!isNaN(this.#Xi)){this.#qi&&clearTimeout(this.#qi);this.show();this.#qi=setTimeout((()=>{this.#qi=null;this.hide()}),e)}}hide(){if(this.#Yi){this.#Yi=!1;this.#Zi.add("hidden")}}show(){if(!this.#Yi){this.#Yi=!0;this.#Zi.remove("hidden")}}}function getActiveOrFocusedElement(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;){e=t.shadowRoot;t=e.activeElement||e.querySelector(":focus")}return t}function apiPageLayoutToViewerModes(e){let t=m.VERTICAL,i=w.NONE;switch(e){case"SinglePage":t=m.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=m.PAGE;case"TwoColumnLeft":i=w.ODD;break;case"TwoPageRight":t=m.PAGE;case"TwoColumnRight":i=w.EVEN}return{scrollMode:t,spreadMode:i}}function apiPageModeToSidebarView(e){switch(e){case"UseNone":return g.NONE;case"UseThumbs":return g.THUMBS;case"UseOutlines":return g.OUTLINE;case"UseAttachments":return g.ATTACHMENTS;case"UseOC":return g.LAYERS}return g.NONE}function toggleCheckedBtn(e,t,i=null){e.classList.toggle("toggled",t);e.setAttribute("aria-checked",t);i?.classList.toggle("hidden",!t)}function toggleExpandedBtn(e,t,i=null){e.classList.toggle("toggled",t);e.setAttribute("aria-expanded",t);i?.classList.toggle("hidden",!t)}},1096:(e,t,i)=>{i.d(t,{ViewHistory:()=>ViewHistory});var n=i(8961);class ViewHistory{constructor(e,t=20){this.fingerprint=e;this.cacheSize=t;this._initializedPromise=this._readFromStorage().then((e=>{const t=JSON.parse(e||"{}");let i=-1;if(Array.isArray(t.files)){for(;t.files.length>=this.cacheSize;)t.files.shift();for(let e=0,n=t.files.length;e<n;e++){if(t.files[e].fingerprint===this.fingerprint){i=e;break}}}else t.files=[];-1===i&&(i=t.files.push({fingerprint:this.fingerprint})-1);this.file=t.files[i];this.database=t}))}async _writeToStorage(){if(n.AppOptions.get("disableHistory"))return;const e=JSON.stringify(this.database);try{localStorage.setItem("pdfjs.history",e)}catch(e){}}async _readFromStorage(){if(!n.AppOptions.get("disableHistory"))try{return localStorage.getItem("pdfjs.history")}catch(e){return}}async set(e,t){await this._initializedPromise;this.file[e]=t;return this._writeToStorage()}async setMultiple(e){await this._initializedPromise;for(const t in e)this.file[t]=e[t];return this._writeToStorage()}async get(e,t){await this._initializedPromise;const i=this.file[e];return void 0!==i?i:t}async getMultiple(e){await this._initializedPromise;const t=Object.create(null);for(const i in e){const n=this.file[i];t[i]=void 0!==n?n:e[i]}return t}}},6400:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{PDFViewerApplication:()=>h.PDFViewerApplication,PDFViewerApplicationConstants:()=>c,PDFViewerApplicationOptions:()=>o.AppOptions});var s=i(1546),r=i(1834),a=i(4927),o=i(8961),l=i(3234),h=i(39),d=e([s,r,h]);[s,r,h]=d.then?(await d)():d;const c={LinkTarget:l.LinkTarget,RenderingStates:a.RenderingStates,ScrollMode:a.ScrollMode,SpreadMode:a.SpreadMode};window.PDFViewerApplication=h.PDFViewerApplication;window.PDFViewerApplicationConstants=c;window.PDFViewerApplicationOptions=o.AppOptions;HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator]);"function"!=typeof window.CustomEvent&&(window.CustomEvent=function CustomEvent(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};const i=document.createEvent("CustomEvent");i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail);return i});function webViewerLoad(){const e={appContainer:document.body,mainContainer:document.getElementById("viewerContainer"),viewerContainer:document.getElementById("viewer"),toolbar:{container:document.getElementById("toolbarViewer"),numPages:document.getElementById("numPages"),pageNumber:document.getElementById("pageNumber"),scaleSelect:document.getElementById("scaleSelect"),customScaleOption:document.getElementById("customScaleOption"),previous:document.getElementById("previous"),next:document.getElementById("next"),zoomIn:document.getElementById("zoomIn"),zoomOut:document.getElementById("zoomOut"),viewFind:document.getElementById("viewFind"),print:document.getElementById("print"),editorFreeTextButton:document.getElementById("editorFreeText"),editorFreeTextParamsToolbar:document.getElementById("editorFreeTextParamsToolbar"),editorHighlightButton:document.getElementById("editorHighlight"),editorHighlightParamsToolbar:document.getElementById("editorHighlightParamsToolbar"),editorHighlightColorPicker:document.getElementById("editorHighlightColorPicker"),editorInkButton:document.getElementById("editorInk"),editorInkParamsToolbar:document.getElementById("editorInkParamsToolbar"),editorStampButton:document.getElementById("editorStamp"),presentationModeButton:document.getElementById("presentationMode"),editorStampParamsToolbar:document.getElementById("editorStampParamsToolbar"),download:document.getElementById("download")},secondaryToolbar:{toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggle"),presentationModeButton:document.getElementById("secondaryPresentationMode"),openFileButton:document.getElementById("secondaryOpenFile"),printButton:document.getElementById("secondaryPrint"),downloadButton:document.getElementById("secondaryDownload"),viewBookmarkButton:document.getElementById("viewBookmark"),firstPageButton:document.getElementById("firstPage"),lastPageButton:document.getElementById("lastPage"),pageRotateCwButton:document.getElementById("pageRotateCw"),pageRotateCcwButton:document.getElementById("pageRotateCcw"),cursorSelectToolButton:document.getElementById("cursorSelectTool"),cursorHandToolButton:document.getElementById("cursorHandTool"),scrollPageButton:document.getElementById("scrollPage"),scrollVerticalButton:document.getElementById("scrollVertical"),scrollHorizontalButton:document.getElementById("scrollHorizontal"),scrollWrappedButton:document.getElementById("scrollWrapped"),spreadNoneButton:document.getElementById("spreadNone"),spreadOddButton:document.getElementById("spreadOdd"),spreadEvenButton:document.getElementById("spreadEven"),documentPropertiesButton:document.getElementById("documentProperties")},sidebar:{outerContainer:document.getElementById("outerContainer"),sidebarContainer:document.getElementById("sidebarContainer"),toggleButton:document.getElementById("sidebarToggle"),resizer:document.getElementById("sidebarResizer"),thumbnailButton:document.getElementById("viewThumbnail"),outlineButton:document.getElementById("viewOutline"),attachmentsButton:document.getElementById("viewAttachments"),layersButton:document.getElementById("viewLayers"),thumbnailView:document.getElementById("thumbnailView"),outlineView:document.getElementById("outlineView"),attachmentsView:document.getElementById("attachmentsView"),layersView:document.getElementById("layersView"),currentOutlineItemButton:document.getElementById("currentOutlineItem")},findBar:{bar:document.getElementById("findbar"),toggleButton:document.getElementById("viewFind"),findField:document.getElementById("findInput"),highlightAllCheckbox:document.getElementById("findHighlightAll"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),matchDiacriticsCheckbox:document.getElementById("findMatchDiacritics"),entireWordCheckbox:document.getElementById("findEntireWord"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findPreviousButton:document.getElementById("findPrevious"),findNextButton:document.getElementById("findNext")},passwordOverlay:{dialog:document.getElementById("passwordDialog"),label:document.getElementById("passwordText"),input:document.getElementById("password"),submitButton:document.getElementById("passwordSubmit"),cancelButton:document.getElementById("passwordCancel")},documentProperties:{dialog:document.getElementById("documentPropertiesDialog"),closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"),creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField"),pageSize:document.getElementById("pageSizeField"),linearized:document.getElementById("linearizedField")}},altTextDialog:{dialog:document.getElementById("altTextDialog"),optionDescription:document.getElementById("descriptionButton"),optionDecorative:document.getElementById("decorativeButton"),textarea:document.getElementById("descriptionTextarea"),cancelButton:document.getElementById("altTextCancel"),saveButton:document.getElementById("altTextSave")},annotationEditorParams:{editorFreeTextFontSize:document.getElementById("editorFreeTextFontSize"),editorFreeTextColor:document.getElementById("editorFreeTextColor"),editorInkColor:document.getElementById("editorInkColor"),editorInkThickness:document.getElementById("editorInkThickness"),editorInkOpacity:document.getElementById("editorInkOpacity"),editorStampAddImage:document.getElementById("editorStampAddImage")},printContainer:document.getElementById("printContainer"),openFileInput:document.getElementById("fileInput"),debuggerScriptPath:"./debugger.mjs"},t=new CustomEvent("webviewerloaded",{bubbles:!0,cancelable:!0,detail:{source:window}});try{parent.document.dispatchEvent(t)}catch(e){console.error(`webviewerloaded: ${e}`);document.dispatchEvent(t)}h.PDFViewerApplication.run(e)}document.blockUnblockOnload?.(!0);window.webViewerLoad=webViewerLoad;n()}catch(u){n(u)}}))},8012:(e,t,i)=>{i.a(e,(async(e,n)=>{try{i.d(t,{XfaLayerBuilder:()=>XfaLayerBuilder});var s=i(1869),r=e([s]);s=(r.then?(await r)():r)[0];class XfaLayerBuilder{constructor({pdfPage:e,annotationStorage:t=null,linkService:i,xfaHtml:n=null}){this.pdfPage=e;this.annotationStorage=t;this.linkService=i;this.xfaHtml=n;this.div=null;this._cancelled=!1}async render(e,t="display"){if("print"===t){const i={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};this.div=document.createElement("div");i.div=this.div;return s.XfaLayer.render(i)}const i=await this.pdfPage.getXfa();if(this._cancelled||!i)return{textDivs:[]};const n={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};if(this.div)return s.XfaLayer.update(n);this.div=document.createElement("div");n.div=this.div;return s.XfaLayer.render(n)}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}n()}catch(e){n(e)}}))}},r={};function __webpack_require__(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}};s[e](i,i.exports,__webpack_require__);return i.exports}e="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",t="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",i="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",n=e=>{if(e&&e.d<1){e.d=1;e.forEach((e=>e.r--));e.forEach((e=>e.r--?e.r++:e()))}},__webpack_require__.a=(s,r,a)=>{var o;a&&((o=[]).d=-1);var l,h,d,c=new Set,u=s.exports,p=new Promise(((e,t)=>{d=t;h=e}));p[t]=u;p[e]=e=>(o&&e(o),c.forEach(e),p.catch((e=>{})));s.exports=p;r((s=>{l=(s=>s.map((s=>{if(null!==s&&"object"==typeof s){if(s[e])return s;if(s.then){var r=[];r.d=0;s.then((e=>{a[t]=e;n(r)}),(e=>{a[i]=e;n(r)}));var a={};a[e]=e=>e(r);return a}}var o={};o[e]=e=>{};o[t]=s;return o})))(s);var r,getResult=()=>l.map((e=>{if(e[i])throw e[i];return e[t]})),a=new Promise((t=>{(r=()=>t(getResult)).r=0;var fnQueue=e=>e!==o&&!c.has(e)&&(c.add(e),e&&!e.d&&(r.r++,e.push(r)));l.map((t=>t[e](fnQueue)))}));return r.r?a:getResult()}),(e=>(e?d(p[i]=e):h(u),n(o))));o&&o.d<0&&(o.d=0)};__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})};__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var a=__webpack_require__(6400),o=(a=await a).PDFViewerApplication,l=a.PDFViewerApplicationConstants,h=a.PDFViewerApplicationOptions;export{o as PDFViewerApplication,l as PDFViewerApplicationConstants,h as PDFViewerApplicationOptions};