PageSourceSearch

https://www.topology.com.tw/pdfjs/web/viewer.mjs

js topology.com.tw collected 2026-10-05 04:09:54 UTC 530,283 bytes, 15,397 lines download raw bytes

vendor: 8,895 bytes, lines 1-320
1/**
2 * @licstart The following is the entire license notice for the
3 * JavaScript code in this page
4 *
5 * Copyright 2023 Mozilla Foundation
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 * @licend The above is the entire license notice for the
20 * JavaScript code in this page
21 */
22
23/******/ var __webpack_modules__ = ({
24
25/***/ 588:
26/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
27
28
29// EXPORTS
30__webpack_require__.d(__webpack_exports__, {
31  FluentBundle: () => (/* reexport */ FluentBundle),
32  FluentResource: () => (/* reexport */ FluentResource)
33});
34
35// UNUSED EXPORTS: FluentDateTime, FluentNone, FluentNumber, FluentType
36
37;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/types.js
38class FluentType {
39  constructor(value) {
40    this.value = value;
41  }
42  valueOf() {
43    return this.value;
44  }
45}
46class FluentNone extends FluentType {
47  constructor(value = "???") {
48    super(value);
49  }
50  toString(scope) {
51    return `{${this.value}}`;
52  }
53}
54class FluentNumber extends FluentType {
55  constructor(value, opts = {}) {
56    super(value);
57    this.opts = opts;
58  }
59  toString(scope) {
60    try {
61      const nf = scope.memoizeIntlObject(Intl.NumberFormat, this.opts);
62      return nf.format(this.value);
63    } catch (err) {
64      scope.reportError(err);
65      return this.value.toString(10);
66    }
67  }
68}
69class FluentDateTime extends FluentType {
70  constructor(value, opts = {}) {
71    super(value);
72    this.opts = opts;
73  }
74  toString(scope) {
75    try {
76      const dtf = scope.memoizeIntlObject(Intl.DateTimeFormat, this.opts);
77      return dtf.format(this.value);
78    } catch (err) {
79      scope.reportError(err);
80      return new Date(this.value).toISOString();
81    }
82  }
83}
84;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/resolver.js
85
86const MAX_PLACEABLES = 100;
87const FSI = "\u2068";
88const PDI = "\u2069";
89function match(scope, selector, key) {
90  if (key === selector) {
91    return true;
92  }
93  if (key instanceof FluentNumber && selector instanceof FluentNumber && key.value === selector.value) {
94    return true;
95  }
96  if (selector instanceof FluentNumber && typeof key === "string") {
97    let category = scope.memoizeIntlObject(Intl.PluralRules, selector.opts).select(selector.value);
98    if (key === category) {
99      return true;
100    }
101  }
102  return false;
103}
104function getDefault(scope, variants, star) {
105  if (variants[star]) {
106    return resolvePattern(scope, variants[star].value);
107  }
108  scope.reportError(new RangeError("No default"));
109  return new FluentNone();
110}
111function getArguments(scope, args) {
112  const positional = [];
113  const named = Object.create(null);
114  for (const arg of args) {
115    if (arg.type === "narg") {
116      named[arg.name] = resolveExpression(scope, arg.value);
117    } else {
118      positional.push(resolveExpression(scope, arg));
119    }
120  }
121  return {
122    positional,
123    named
124  };
125}
126function resolveExpression(scope, expr) {
127  switch (expr.type) {
128    case "str":
129      return expr.value;
130    case "num":
131      return new FluentNumber(expr.value, {
132        minimumFractionDigits: expr.precision
133      });
134    case "var":
135      return resolveVariableReference(scope, expr);
136    case "mesg":
137      return resolveMessageReference(scope, expr);
138    case "term":
139      return resolveTermReference(scope, expr);
140    case "func":
141      return resolveFunctionReference(scope, expr);
142    case "select":
143      return resolveSelectExpression(scope, expr);
144    default:
145      return new FluentNone();
146  }
147}
148function resolveVariableReference(scope, {
149  name
150}) {
151  let arg;
152  if (scope.params) {
153    if (Object.prototype.hasOwnProperty.call(scope.params, name)) {
154      arg = scope.params[name];
155    } else {
156      return new FluentNone(`$${name}`);
157    }
158  } else if (scope.args && Object.prototype.hasOwnProperty.call(scope.args, name)) {
159    arg = scope.args[name];
160  } else {
161    scope.reportError(new ReferenceError(`Unknown variable: $${name}`));
162    return new FluentNone(`$${name}`);
163  }
164  if (arg instanceof FluentType) {
165    return arg;
166  }
167  switch (typeof arg) {
168    case "string":
169      return arg;
170    case "number":
171      return new FluentNumber(arg);
172    case "object":
173      if (arg instanceof Date) {
174        return new FluentDateTime(arg.getTime());
175      }
176    default:
177      scope.reportError(new TypeError(`Variable type not supported: $${name}, ${typeof arg}`));
178      return new FluentNone(`$${name}`);
179  }
180}
181function resolveMessageReference(scope, {
182  name,
183  attr
184}) {
185  const message = scope.bundle._messages.get(name);
186  if (!message) {
187    scope.reportError(new ReferenceError(`Unknown message: ${name}`));
188    return new FluentNone(name);
189  }
190  if (attr) {
191    const attribute = message.attributes[attr];
192    if (attribute) {
193      return resolvePattern(scope, attribute);
194    }
195    scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`));
196    return new FluentNone(`${name}.${attr}`);
197  }
198  if (message.value) {
199    return resolvePattern(scope, message.value);
200  }
201  scope.reportError(new ReferenceError(`No value: ${name}`));
202  return new FluentNone(name);
203}
204function resolveTermReference(scope, {
205  name,
206  attr,
207  args
208}) {
209  const id = `-${name}`;
210  const term = scope.bundle._terms.get(id);
211  if (!term) {
212    scope.reportError(new ReferenceError(`Unknown term: ${id}`));
213    return new FluentNone(id);
214  }
215  if (attr) {
216    const attribute = term.attributes[attr];
217    if (attribute) {
218      scope.params = getArguments(scope, args).named;
219      const resolved = resolvePattern(scope, attribute);
220      scope.params = null;
221      return resolved;
222    }
223    scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`));
224    return new FluentNone(`${id}.${attr}`);
225  }
226  scope.params = getArguments(scope, args).named;
227  const resolved = resolvePattern(scope, term.value);
228  scope.params = null;
229  return resolved;
230}
231function resolveFunctionReference(scope, {
232  name,
233  args
234}) {
235  let func = scope.bundle._functions[name];
236  if (!func) {
237    scope.reportError(new ReferenceError(`Unknown function: ${name}()`));
238    return new FluentNone(`${name}()`);
239  }
240  if (typeof func !== "function") {
241    scope.reportError(new TypeError(`Function ${name}() is not callable`));
242    return new FluentNone(`${name}()`);
243  }
244  try {
245    let resolved = getArguments(scope, args);
246    return func(resolved.positional, resolved.named);
247  } catch (err) {
248    scope.reportError(err);
249    return new FluentNone(`${name}()`);
250  }
251}
252function resolveSelectExpression(scope, {
253  selector,
254  variants,
255  star
256}) {
257  let sel = resolveExpression(scope, selector);
258  if (sel instanceof FluentNone) {
259    return getDefault(scope, variants, star);
260  }
261  for (const variant of variants) {
262    const key = resolveExpression(scope, variant.key);
263    if (match(scope, sel, key)) {
264      return resolvePattern(scope, variant.value);
265    }
266  }
267  return getDefault(scope, variants, star);
268}
269function resolveComplexPattern(scope, ptn) {
270  if (scope.dirty.has(ptn)) {
271    scope.reportError(new RangeError("Cyclic reference"));
272    return new FluentNone();
273  }
274  scope.dirty.add(ptn);
275  const result = [];
276  const useIsolating = scope.bundle._useIsolating && ptn.length > 1;
277  for (const elem of ptn) {
278    if (typeof elem === "string") {
279      result.push(scope.bundle._transform(elem));
280      continue;
281    }
282    scope.placeables++;
283    if (scope.placeables > MAX_PLACEABLES) {
284      scope.dirty.delete(ptn);
285      throw new RangeError(`Too many placeables expanded: ${scope.placeables}, ` + `max allowed is ${MAX_PLACEABLES}`);
286    }
287    if (useIsolating) {
288      result.push(FSI);
289    }
290    result.push(resolveExpression(scope, elem).toString(scope));
291    if (useIsolating) {
292      result.push(PDI);
293    }
294  }
295  scope.dirty.delete(ptn);
296  return result.join("");
297}
298function resolvePattern(scope, value) {
299  if (typeof value === "string") {
300    return scope.bundle._transform(value);
301  }
302  return resolveComplexPattern(scope, value);
303}
304;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/scope.js
305class Scope {
306  constructor(bundle, errors, args) {
307    this.dirty = new WeakSet();
308    this.params = null;
309    this.placeables = 0;
310    this.bundle = bundle;
311    this.errors = errors;
312    this.args = args;
313  }
314  reportError(error) {
315    if (!this.errors || !(error instanceof Error)) {
316      throw error;
317    }
318    this.errors.push(error);
319  }
320  memoizeIntlObject(ctor, opts) {
321    let cache = this.bundle._intls.get(ctor);
322    if (!cache) {
323      cache = {};
324      this.bundle._intls.set(ctor, cache);
325    }
326    let id = JSON.stringify(opts);
327    if (!cache[id]) {
328      cache[id] = new ctor(this.bundle.locales, opts);
329    }
330    return cache[id];
331  }
332}
333;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/builtins.js
334
335function values(opts, allowed) {
336  const unwrapped = Object.create(null);
337  for (const [name, opt] of Object.entries(opts)) {
338    if (allowed.includes(name)) {
339      unwrapped[name] = opt.valueOf();
340    }
341  }
342  return unwrapped;
343}
344const NUMBER_ALLOWED = ["unitDisplay", "currencyDisplay", "useGrouping", "minimumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits", "minimumSignificantDigits", "maximumSignificantDigits"];
345function NUMBER(args, opts) {
346  let arg = args[0];
347  if (arg instanceof FluentNone) {
348    return new FluentNone(`NUMBER(${arg.valueOf()})`);
349  }
350  if (arg instanceof FluentNumber) {
351    return new FluentNumber(arg.valueOf(), {
352      ...arg.opts,
353      ...values(opts, NUMBER_ALLOWED)
354    });
355  }
356  if (arg instanceof FluentDateTime) {
357    return new FluentNumber(arg.valueOf(), {
358      ...values(opts, NUMBER_ALLOWED)
359    });
360  }
361  throw new TypeError("Invalid argument to NUMBER");
362}
363const DATETIME_ALLOWED = ["dateStyle", "timeStyle", "fractionalSecondDigits", "dayPeriod", "hour12", "weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName"];
364function DATETIME(args, opts) {
365  let arg = args[0];
366  if (arg instanceof FluentNone) {
367    return new FluentNone(`DATETIME(${arg.valueOf()})`);
368  }
369  if (arg instanceof FluentDateTime) {
370    return new FluentDateTime(arg.valueOf(), {
371      ...arg.opts,
372      ...values(opts, DATETIME_ALLOWED)
373    });
374  }
375  if (arg instanceof FluentNumber) {
376    return new FluentDateTime(arg.valueOf(), {
377      ...values(opts, DATETIME_ALLOWED)
378    });
379  }
380  throw new TypeError("Invalid argument to DATETIME");
381}
382;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/memoizer.js
383const cache = new Map();
384function getMemoizerForLocale(locales) {
385  const stringLocale = Array.isArray(locales) ? locales.join(" ") : locales;
386  let memoizer = cache.get(stringLocale);
387  if (memoizer === undefined) {
388    memoizer = new Map();
389    cache.set(stringLocale, memoizer);
390  }
391  return memoizer;
392}
393;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/bundle.js
394
395
396
397
398
399class FluentBundle {
400  constructor(locales, {
401    functions,
402    useIsolating = true,
403    transform = v => v
404  } = {}) {
405    this._terms = new Map();
406    this._messages = new Map();
407    this.locales = Array.isArray(locales) ? locales : [locales];
408    this._functions = {
409      NUMBER: NUMBER,
410      DATETIME: DATETIME,
411      ...functions
412    };
413    this._useIsolating = useIsolating;
414    this._transform = transform;
415    this._intls = getMemoizerForLocale(locales);
416  }
417  hasMessage(id) {
418    return this._messages.has(id);
419  }
420  getMessage(id) {
421    return this._messages.get(id);
422  }
423  addResource(res, {
424    allowOverrides = false
425  } = {}) {
426    const errors = [];
427    for (let i = 0; i < res.body.length; i++) {
428      let entry = res.body[i];
429      if (entry.id.startsWith("-")) {
430        if (allowOverrides === false && this._terms.has(entry.id)) {
431          errors.push(new Error(`Attempt to override an existing term: "${entry.id}"`));
432          continue;
433        }
434        this._terms.set(entry.id, entry);
435      } else {
436        if (allowOverrides === false && this._messages.has(entry.id)) {
437          errors.push(new Error(`Attempt to override an existing message: "${entry.id}"`));
438          continue;
439        }
440        this._messages.set(entry.id, entry);
441      }
442    }
443    return errors;
444  }
445  formatPattern(pattern, args = null, errors = null) {
446    if (typeof pattern === "string") {
447      return this._transform(pattern);
448    }
449    let scope = new Scope(this, errors, args);
450    try {
451      let value = resolveComplexPattern(scope, pattern);
452      return value.toString(scope);
453    } catch (err) {
454      if (scope.errors && err instanceof Error) {
455        scope.errors.push(err);
456        return new FluentNone().toString(scope);
457      }
458      throw err;
459    }
460  }
461}
462;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/resource.js
vendor: 7,205 bytes, lines 463-721
463const RE_MESSAGE_START = /^(-?[a-zA-Z][\w-]*) *= */gm;
464const RE_ATTRIBUTE_START = /\.([a-zA-Z][\w-]*) *= */y;
465const RE_VARIANT_START = /\*?\[/y;
466const RE_NUMBER_LITERAL = /(-?[0-9]+(?:\.([0-9]+))?)/y;
467const RE_IDENTIFIER = /([a-zA-Z][\w-]*)/y;
468const RE_REFERENCE = /([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y;
469const RE_FUNCTION_NAME = /^[A-Z][A-Z0-9_-]*$/;
470const RE_TEXT_RUN = /([^{}\n\r]+)/y;
471const RE_STRING_RUN = /([^\\"\n\r]*)/y;
472const RE_STRING_ESCAPE = /\\([\\"])/y;
473const RE_UNICODE_ESCAPE = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y;
474const RE_LEADING_NEWLINES = /^\n+/;
475const RE_TRAILING_SPACES = / +$/;
476const RE_BLANK_LINES = / *\r?\n/g;
477const RE_INDENT = /( *)$/;
478const TOKEN_BRACE_OPEN = /{\s*/y;
479const TOKEN_BRACE_CLOSE = /\s*}/y;
480const TOKEN_BRACKET_OPEN = /\[\s*/y;
481const TOKEN_BRACKET_CLOSE = /\s*] */y;
482const TOKEN_PAREN_OPEN = /\s*\(\s*/y;
483const TOKEN_ARROW = /\s*->\s*/y;
484const TOKEN_COLON = /\s*:\s*/y;
485const TOKEN_COMMA = /\s*,?\s*/y;
486const TOKEN_BLANK = /\s+/y;
487class FluentResource {
488  constructor(source) {
489    this.body = [];
490    RE_MESSAGE_START.lastIndex = 0;
491    let cursor = 0;
492    while (true) {
493      let next = RE_MESSAGE_START.exec(source);
494      if (next === null) {
495        break;
496      }
497      cursor = RE_MESSAGE_START.lastIndex;
498      try {
499        this.body.push(parseMessage(next[1]));
500      } catch (err) {
501        if (err instanceof SyntaxError) {
502          continue;
503        }
504        throw err;
505      }
506    }
507    function test(re) {
508      re.lastIndex = cursor;
509      return re.test(source);
510    }
511    function consumeChar(char, errorClass) {
512      if (source[cursor] === char) {
513        cursor++;
514        return true;
515      }
516      if (errorClass) {
517        throw new errorClass(`Expected ${char}`);
518      }
519      return false;
520    }
521    function consumeToken(re, errorClass) {
522      if (test(re)) {
523        cursor = re.lastIndex;
524        return true;
525      }
526      if (errorClass) {
527        throw new errorClass(`Expected ${re.toString()}`);
528      }
529      return false;
530    }
531    function match(re) {
532      re.lastIndex = cursor;
533      let result = re.exec(source);
534      if (result === null) {
535        throw new SyntaxError(`Expected ${re.toString()}`);
536      }
537      cursor = re.lastIndex;
538      return result;
539    }
540    function match1(re) {
541      return match(re)[1];
542    }
543    function parseMessage(id) {
544      let value = parsePattern();
545      let attributes = parseAttributes();
546      if (value === null && Object.keys(attributes).length === 0) {
547        throw new SyntaxError("Expected message value or attributes");
548      }
549      return {
550        id,
551        value,
552        attributes
553      };
554    }
555    function parseAttributes() {
556      let attrs = Object.create(null);
557      while (test(RE_ATTRIBUTE_START)) {
558        let name = match1(RE_ATTRIBUTE_START);
559        let value = parsePattern();
560        if (value === null) {
561          throw new SyntaxError("Expected attribute value");
562        }
563        attrs[name] = value;
564      }
565      return attrs;
566    }
567    function parsePattern() {
568      let first;
569      if (test(RE_TEXT_RUN)) {
570        first = match1(RE_TEXT_RUN);
571      }
572      if (source[cursor] === "{" || source[cursor] === "}") {
573        return parsePatternElements(first ? [first] : [], Infinity);
574      }
575      let indent = parseIndent();
576      if (indent) {
577        if (first) {
578          return parsePatternElements([first, indent], indent.length);
579        }
580        indent.value = trim(indent.value, RE_LEADING_NEWLINES);
581        return parsePatternElements([indent], indent.length);
582      }
583      if (first) {
584        return trim(first, RE_TRAILING_SPACES);
585      }
586      return null;
587    }
588    function parsePatternElements(elements = [], commonIndent) {
589      while (true) {
590        if (test(RE_TEXT_RUN)) {
591          elements.push(match1(RE_TEXT_RUN));
592          continue;
593        }
594        if (source[cursor] === "{") {
595          elements.push(parsePlaceable());
596          continue;
597        }
598        if (source[cursor] === "}") {
599          throw new SyntaxError("Unbalanced closing brace");
600        }
601        let indent = parseIndent();
602        if (indent) {
603          elements.push(indent);
604          commonIndent = Math.min(commonIndent, indent.length);
605          continue;
606        }
607        break;
608      }
609      let lastIndex = elements.length - 1;
610      let lastElement = elements[lastIndex];
611      if (typeof lastElement === "string") {
612        elements[lastIndex] = trim(lastElement, RE_TRAILING_SPACES);
613      }
614      let baked = [];
615      for (let element of elements) {
616        if (element instanceof Indent) {
617          element = element.value.slice(0, element.value.length - commonIndent);
618        }
619        if (element) {
620          baked.push(element);
621        }
622      }
623      return baked;
624    }
625    function parsePlaceable() {
626      consumeToken(TOKEN_BRACE_OPEN, SyntaxError);
627      let selector = parseInlineExpression();
628      if (consumeToken(TOKEN_BRACE_CLOSE)) {
629        return selector;
630      }
631      if (consumeToken(TOKEN_ARROW)) {
632        let variants = parseVariants();
633        consumeToken(TOKEN_BRACE_CLOSE, SyntaxError);
634        return {
635          type: "select",
636          selector,
637          ...variants
638        };
639      }
640      throw new SyntaxError("Unclosed placeable");
641    }
642    function parseInlineExpression() {
643      if (source[cursor] === "{") {
644        return parsePlaceable();
645      }
646      if (test(RE_REFERENCE)) {
647        let [, sigil, name, attr = null] = match(RE_REFERENCE);
648        if (sigil === "$") {
649          return {
650            type: "var",
651            name
652          };
653        }
654        if (consumeToken(TOKEN_PAREN_OPEN)) {
655          let args = parseArguments();
656          if (sigil === "-") {
657            return {
658              type: "term",
659              name,
660              attr,
661              args
662            };
663          }
664          if (RE_FUNCTION_NAME.test(name)) {
665            return {
666              type: "func",
667              name,
668              args
669            };
670          }
671          throw new SyntaxError("Function names must be all upper-case");
672        }
673        if (sigil === "-") {
674          return {
675            type: "term",
676            name,
677            attr,
678            args: []
679          };
680        }
681        return {
682          type: "mesg",
683          name,
684          attr
685        };
686      }
687      return parseLiteral();
688    }
689    function parseArguments() {
690      let args = [];
691      while (true) {
692        switch (source[cursor]) {
693          case ")":
694            cursor++;
695            return args;
696          case undefined:
697            throw new SyntaxError("Unclosed argument list");
698        }
699        args.push(parseArgument());
700        consumeToken(TOKEN_COMMA);
701      }
702    }
703    function parseArgument() {
704      let expr = parseInlineExpression();
705      if (expr.type !== "mesg") {
706        return expr;
707      }
708      if (consumeToken(TOKEN_COLON)) {
709        return {
710          type: "narg",
711          name: expr.name,
712          value: parseLiteral()
713        };
714      }
715      return expr;
716    }
717    function parseVariants() {
718      let variants = [];
719      let count = 0;
720      let star;
721      while (test(RE_VARIANT_START)) {
722        if (consumeChar("*")) {
723          star = count;
724        }
725        let key = parseVariantKey();
726        let value = parsePattern();
727        if (value === null) {
728          throw new SyntaxError("Expected variant value");
729        }
730        variants[count++] = {
731          key,
732          value
733        };
734      }
735      if (count === 0) {
736        return null;
737      }
738      if (star === undefined) {
739        throw new SyntaxError("Expected default variant");
740      }
741      return {
742        variants,
743        star
744      };
745    }
746    function parseVariantKey() {
747      consumeToken(TOKEN_BRACKET_OPEN, SyntaxError);
748      let key;
749      if (test(RE_NUMBER_LITERAL)) {
750        key = parseNumberLiteral();
751      } else {
752        key = {
753          type: "str",
754          value: match1(RE_IDENTIFIER)
755        };
756      }
757      consumeToken(TOKEN_BRACKET_CLOSE, SyntaxError);
758      return key;
759    }
760    function parseLiteral() {
761      if (test(RE_NUMBER_LITERAL)) {
762        return parseNumberLiteral();
763      }
764      if (source[cursor] === '"') {
765        return parseStringLiteral();
766      }
767      throw new SyntaxError("Invalid expression");
768    }
769    function parseNumberLiteral() {
770      let [, value, fraction = ""] = match(RE_NUMBER_LITERAL);
771      let precision = fraction.length;
772      return {
773        type: "num",
774        value: parseFloat(value),
775        precision
776      };
777    }
778    function parseStringLiteral() {
779      consumeChar('"', SyntaxError);
780      let value = "";
781      while (true) {
782        value += match1(RE_STRING_RUN);
783        if (source[cursor] === "\\") {
784          value += parseEscapeSequence();
785          continue;
786        }
787        if (consumeChar('"')) {
788          return {
789            type: "str",
790            value
791          };
792        }
793        throw new SyntaxError("Unclosed string literal");
794      }
795    }
796    function parseEscapeSequence() {
797      if (test(RE_STRING_ESCAPE)) {
798        return match1(RE_STRING_ESCAPE);
799      }
800      if (test(RE_UNICODE_ESCAPE)) {
801        let [, codepoint4, codepoint6] = match(RE_UNICODE_ESCAPE);
802        let codepoint = parseInt(codepoint4 || codepoint6, 16);
803        return codepoint <= 0xd7ff || 0xe000 <= codepoint ? String.fromCodePoint(codepoint) : "�";
804      }
805      throw new SyntaxError("Unknown escape sequence");
806    }
807    function parseIndent() {
808      let start = cursor;
809      consumeToken(TOKEN_BLANK);
810      switch (source[cursor]) {
811        case ".":
812        case "[":
813        case "*":
814        case "}":
815        case undefined:
816          return false;
817        case "{":
818          return makeIndent(source.slice(start, cursor));
819      }
820      if (source[cursor - 1] === " ") {
821        return makeIndent(source.slice(start, cursor));
822      }
823      return false;
824    }
825    function trim(text, re) {
826      return text.replace(re, "");
827    }
828    function makeIndent(blank) {
829      let value = blank.replace(RE_BLANK_LINES, "\n");
830      let length = RE_INDENT.exec(blank)[1].length;
831      return new Indent(value, length);
832    }
833  }
834}
835class Indent {
836  constructor(value, length) {
837    this.value = value;
838    this.length = length;
839  }
840}
841;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/index.js
842
843
844
845
846/***/ }),
847
848/***/ 5273:
849/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
850
851
852// EXPORTS
853__webpack_require__.d(__webpack_exports__, {
854  DOMLocalization: () => (/* reexport */ DOMLocalization)
855});
856
857// UNUSED EXPORTS: Localization
858
859;// CONCATENATED MODULE: ./node_modules/@fluent/dom/esm/overlay.js
860const reOverlay = /<|&#?\w+;/;
861const TEXT_LEVEL_ELEMENTS = {
862  "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"]
863};
864const LOCALIZABLE_ATTRIBUTES = {
865  "http://www.w3.org/1999/xhtml": {
866    global: ["title", "aria-label", "aria-valuetext"],
867    a: ["download"],
868    area: ["download", "alt"],
869    input: ["alt", "placeholder"],
870    menuitem: ["label"],
871    menu: ["label"],
872    optgroup: ["label"],
873    option: ["label"],
874    track: ["label"],
875    img: ["alt"],
876    textarea: ["placeholder"],
877    th: ["abbr"]
878  },
879  "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul": {
880    global: ["accesskey", "aria-label", "aria-valuetext", "label", "title", "tooltiptext"],
881    description: ["value"],
882    key: ["key", "keycode"],
883    label: ["value"],
884    textbox: ["placeholder", "value"]
885  }
886};
887function translateElement(element, translation) {
888  const {
889    value
890  } = translation;
891  if (typeof value === "string") {
892    if (element.localName === "title" && element.namespaceURI === "http://www.w3.org/1999/xhtml") {
893      element.textContent = value;
894    } else if (!reOverlay.test(value)) {
895      element.textContent = value;
896    } else {
897      const templateElement = element.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml", "template");
898      templateElement.innerHTML = value;
899      overlayChildNodes(templateElement.content, element);
900    }
901  }
902  overlayAttributes(translation, element);
903}
904function overlayChildNodes(fromFragment, toElement) {
905  for (const childNode of fromFragment.childNodes) {
906    if (childNode.nodeType === childNode.TEXT_NODE) {
907      continue;
908    }
909    if (childNode.hasAttribute("data-l10n-name")) {
910      const sanitized = getNodeForNamedElement(toElement, childNode);
911      fromFragment.replaceChild(sanitized, childNode);
912      continue;
913    }
914    if (isElementAllowed(childNode)) {
915      const sanitized = createSanitizedElement(childNode);
916      fromFragment.replaceChild(sanitized, childNode);
917      continue;
918    }
919    console.warn(`An element of forbidden type "${childNode.localName}" was found in ` + "the translation. Only safe text-level elements and elements with " + "data-l10n-name are allowed.");
920    fromFragment.replaceChild(createTextNodeFromTextContent(childNode), childNode);
921  }
922  toElement.textContent = "";
923  toElement.appendChild(fromFragment);
924}
925function hasAttribute(attributes, name) {
926  if (!attributes) {
927    return false;
928  }
929  for (let attr of attributes) {
930    if (attr.name === name) {
931      return true;
932    }
933  }
934  return false;
935}
936function overlayAttributes(fromElement, toElement) {
937  const explicitlyAllowed = toElement.hasAttribute("data-l10n-attrs") ? toElement.getAttribute("data-l10n-attrs").split(",").map(i => i.trim()) : null;
938  for (const attr of Array.from(toElement.attributes)) {
939    if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && !hasAttribute(fromElement.attributes, attr.name)) {
940      toElement.removeAttribute(attr.name);
941    }
942  }
943  if (!fromElement.attributes) {
944    return;
945  }
946  for (const attr of Array.from(fromElement.attributes)) {
947    if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && toElement.getAttribute(attr.name) !== attr.value) {
948      toElement.setAttribute(attr.name, attr.value);
949    }
950  }
951}
952function getNodeForNamedElement(sourceElement, translatedChild) {
953  const childName = translatedChild.getAttribute("data-l10n-name");
954  const sourceChild = sourceElement.querySelector(`[data-l10n-name="${childName}"]`);
955  if (!sourceChild) {
956    console.warn(`An element named "${childName}" wasn't found in the source.`);
957    return createTextNodeFromTextContent(translatedChild);
958  }
959  if (sourceChild.localName !== translatedChild.localName) {
960    console.warn(`An element named "${childName}" was found in the translation ` + `but its type ${translatedChild.localName} didn't match the ` + `element found in the source (${sourceChild.localName}).`);
961    return createTextNodeFromTextContent(translatedChild);
962  }
963  sourceElement.removeChild(sourceChild);
964  const clone = sourceChild.cloneNode(false);
965  return shallowPopulateUsing(translatedChild, clone);
966}
967function createSanitizedElement(element) {
968  const clone = element.ownerDocument.createElement(element.localName);
969  return shallowPopulateUsing(element, clone);
970}
971function createTextNodeFromTextContent(element) {
972  return element.ownerDocument.createTextNode(element.textContent);
973}
974function isElementAllowed(element) {
975  const allowed = TEXT_LEVEL_ELEMENTS[element.namespaceURI];
976  return allowed && allowed.includes(element.localName);
977}
978function isAttrNameLocalizable(name, element, explicitlyAllowed = null) {
979  if (explicitlyAllowed && explicitlyAllowed.includes(name)) {
980    return true;
981  }
982  const allowed = LOCALIZABLE_ATTRIBUTES[element.namespaceURI];
983  if (!allowed) {
984    return false;
985  }
986  const attrName = name.toLowerCase();
987  const elemName = element.localName;
988  if (allowed.global.includes(attrName)) {
989    return true;
990  }
991  if (!allowed[elemName]) {
992    return false;
993  }
994  if (allowed[elemName].includes(attrName)) {
995    return true;
996  }
997  if (element.namespaceURI === "http://www.w3.org/1999/xhtml" && elemName === "input" && attrName === "value") {
998    const type = element.type.toLowerCase();
999    if (type === "submit" || type === "button" || type === "reset") {
1000      return true;
1001    }
1002  }
1003  return false;
1004}
1005function shallowPopulateUsing(fromElement, toElement) {
1006  toElement.textContent = fromElement.textContent;
1007  overlayAttributes(fromElement, toElement);
1008  return toElement;
1009}
1010;// CONCATENATED MODULE: ./node_modules/cached-iterable/src/cached_iterable.mjs
1011class CachedIterable extends Array {
1012  static from(iterable) {
1013    if (iterable instanceof this) {
1014      return iterable;
1015    }
1016    return new this(iterable);
1017  }
1018}
1019;// CONCATENATED MODULE: ./node_modules/cached-iterable/src/cached_sync_iterable.mjs
1020
1021class CachedSyncIterable extends CachedIterable {
1022  constructor(iterable) {
1023    super();
1024    if (Symbol.iterator in Object(iterable)) {
1025      this.iterator = iterable[Symbol.iterator]();
1026    } else {
1027      throw new TypeError("Argument must implement the iteration protocol.");
1028    }
1029  }
1030  [Symbol.iterator]() {
1031    const cached = this;
1032    let cur = 0;
1033    return {
1034      next() {
1035        if (cached.length <= cur) {
1036          cached.push(cached.iterator.next());
1037        }
1038        return cached[cur++];
1039      }
1040    };
1041  }
1042  touchNext(count = 1) {
1043    let idx = 0;
1044    while (idx++ < count) {
1045      const last = this[this.length - 1];
1046      if (last && last.done) {
1047        break;
1048      }
1049      this.push(this.iterator.next());
1050    }
1051    return this[this.length - 1];
1052  }
1053}
1054;// CONCATENATED MODULE: ./node_modules/cached-iterable/src/cached_async_iterable.mjs
1055
1056class CachedAsyncIterable extends CachedIterable {
1057  constructor(iterable) {
1058    super();
1059    if (Symbol.asyncIterator in Object(iterable)) {
1060      this.iterator = iterable[Symbol.asyncIterator]();
1061    } else if (Symbol.iterator in Object(iterable)) {
1062      this.iterator = iterable[Symbol.iterator]();
1063    } else {
1064      throw new TypeError("Argument must implement the iteration protocol.");
1065    }
1066  }
1067  [Symbol.asyncIterator]() {
1068    const cached = this;
1069    let cur = 0;
1070    return {
1071      async next() {
1072        if (cached.length <= cur) {
1073          cached.push(cached.iterator.next());
1074        }
1075        return cached[cur++];
1076      }
1077    };
1078  }
1079  async touchNext(count = 1) {
1080    let idx = 0;
1081    while (idx++ < count) {
1082      const last = this[this.length - 1];
1083      if (last && (await last).done) {
1084        break;
1085      }
1086      this.push(this.iterator.next());
1087    }
1088    return this[this.length - 1];
1089  }
1090}
1091;// CONCATENATED MODULE: ./node_modules/cached-iterable/src/index.mjs
1092
1093
1094;// CONCATENATED MODULE: ./node_modules/@fluent/dom/esm/localization.js
1095
1096class Localization {
1097  constructor(resourceIds = [], generateBundles) {
1098    this.resourceIds = resourceIds;
1099    this.generateBundles = generateBundles;
1100    this.onChange(true);
1101  }
1102  addResourceIds(resourceIds, eager = false) {
1103    this.resourceIds.push(...resourceIds);
1104    this.onChange(eager);
1105    return this.resourceIds.length;
1106  }
1107  removeResourceIds(resourceIds) {
1108    this.resourceIds = this.resourceIds.filter(r => !resourceIds.includes(r));
1109    this.onChange();
1110    return this.resourceIds.length;
1111  }
1112  async formatWithFallback(keys, method) {
1113    const translations = [];
1114    let hasAtLeastOneBundle = false;
1115    for await (const bundle of this.bundles) {
1116      hasAtLeastOneBundle = true;
1117      const missingIds = keysFromBundle(method, bundle, keys, translations);
1118      if (missingIds.size === 0) {
1119        break;
1120      }
1121      if (typeof console !== "undefined") {
1122        const locale = bundle.locales[0];
1123        const ids = Array.from(missingIds).join(", ");
1124        console.warn(`[fluent] Missing translations in ${locale}: ${ids}`);
1125      }
1126    }
1127    if (!hasAtLeastOneBundle && typeof console !== "undefined") {
1128      console.warn(`[fluent] Request for keys failed because no resource bundles got generated.
1129  keys: ${JSON.stringify(keys)}.
1130  resourceIds: ${JSON.stringify(this.resourceIds)}.`);
1131    }
1132    return translations;
1133  }
1134  formatMessages(keys) {
1135    return this.formatWithFallback(keys, messageFromBundle);
1136  }
1137  formatValues(keys) {
1138    return this.formatWithFallback(keys, valueFromBundle);
1139  }
1140  async formatValue(id, args) {
1141    const [val] = await this.formatValues([{
1142      id,
1143      args
1144    }]);
1145    return val;
1146  }
1147  handleEvent() {
1148    this.onChange();
1149  }
1150  onChange(eager = false) {
1151    this.bundles = CachedAsyncIterable.from(this.generateBundles(this.resourceIds));
1152    if (eager) {
1153      this.bundles.touchNext(2);
1154    }
1155  }
1156}
1157function valueFromBundle(bundle, errors, message, args) {
1158  if (message.value) {
1159    return bundle.formatPattern(message.value, args, errors);
1160  }
1161  return null;
1162}
1163function messageFromBundle(bundle, errors, message, args) {
1164  const formatted = {
1165    value: null,
1166    attributes: null
1167  };
1168  if (message.value) {
1169    formatted.value = bundle.formatPattern(message.value, args, errors);
1170  }
1171  let attrNames = Object.keys(message.attributes);
1172  if (attrNames.length > 0) {
1173    formatted.attributes = new Array(attrNames.length);
1174    for (let [i, name] of attrNames.entries()) {
1175      let value = bundle.formatPattern(message.attributes[name], args, errors);
1176      formatted.attributes[i] = {
1177        name,
1178        value
1179      };
1180    }
1181  }
1182  return formatted;
1183}
1184function keysFromBundle(method, bundle, keys, translations) {
1185  const messageErrors = [];
1186  const missingIds = new Set();
1187  keys.forEach(({
1188    id,
1189    args
1190  }, i) => {
1191    if (translations[i] !== undefined) {
1192      return;
1193    }
1194    let message = bundle.getMessage(id);
1195    if (message) {
1196      messageErrors.length = 0;
1197      translations[i] = method(bundle, messageErrors, message, args);
1198      if (messageErrors.length > 0 && typeof console !== "undefined") {
1199        const locale = bundle.locales[0];
1200        const errors = messageErrors.join(", ");
1201        console.warn(`[fluent][resolver] errors in ${locale}/${id}: ${errors}.`);
1202      }
1203    } else {
1204      missingIds.add(id);
1205    }
1206  });
1207  return missingIds;
1208}
1209;// CONCATENATED MODULE: ./node_modules/@fluent/dom/esm/dom_localization.js
1210
1211
1212const L10NID_ATTR_NAME = "data-l10n-id";
1213const L10NARGS_ATTR_NAME = "data-l10n-args";
1214const L10N_ELEMENT_QUERY = `[${L10NID_ATTR_NAME}]`;
1215class DOMLocalization extends Localization {
1216  constructor(resourceIds, generateBundles) {
1217    super(resourceIds, generateBundles);
1218    this.roots = new Set();
1219    this.pendingrAF = null;
1220    this.pendingElements = new Set();
1221    this.windowElement = null;
1222    this.mutationObserver = null;
1223    this.observerConfig = {
1224      attributes: true,
1225      characterData: false,
1226      childList: true,
1227      subtree: true,
1228      attributeFilter: [L10NID_ATTR_NAME, L10NARGS_ATTR_NAME]
1229    };
1230  }
1231  onChange(eager = false) {
1232    super.onChange(eager);
1233    if (this.roots) {
1234      this.translateRoots();
1235    }
1236  }
1237  setAttributes(element, id, args) {
1238    element.setAttribute(L10NID_ATTR_NAME, id);
1239    if (args) {
1240      element.setAttribute(L10NARGS_ATTR_NAME, JSON.stringify(args));
1241    } else {
1242      element.removeAttribute(L10NARGS_ATTR_NAME);
1243    }
1244    return element;
1245  }
1246  getAttributes(element) {
1247    return {
1248      id: element.getAttribute(L10NID_ATTR_NAME),
1249      args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null)
1250    };
1251  }
1252  connectRoot(newRoot) {
1253    for (const root of this.roots) {
1254      if (root === newRoot || root.contains(newRoot) || newRoot.contains(root)) {
1255        throw new Error("Cannot add a root that overlaps with existing root.");
1256      }
1257    }
1258    if (this.windowElement) {
1259      if (this.windowElement !== newRoot.ownerDocument.defaultView) {
1260        throw new Error(`Cannot connect a root:
1261          DOMLocalization already has a root from a different window.`);
1262      }
1263    } else {
1264      this.windowElement = newRoot.ownerDocument.defaultView;
1265      this.mutationObserver = new this.windowElement.MutationObserver(mutations => this.translateMutations(mutations));
1266    }
1267    this.roots.add(newRoot);
1268    this.mutationObserver.observe(newRoot, this.observerConfig);
1269  }
1270  disconnectRoot(root) {
1271    this.roots.delete(root);
1272    this.pauseObserving();
1273    if (this.roots.size === 0) {
1274      this.mutationObserver = null;
1275      this.windowElement = null;
1276      this.pendingrAF = null;
1277      this.pendingElements.clear();
1278      return true;
1279    }
1280    this.resumeObserving();
1281    return false;
1282  }
1283  translateRoots() {
1284    const roots = Array.from(this.roots);
1285    return Promise.all(roots.map(root => this.translateFragment(root)));
1286  }
1287  pauseObserving() {
1288    if (!this.mutationObserver) {
1289      return;
1290    }
1291    this.translateMutations(this.mutationObserver.takeRecords());
1292    this.mutationObserver.disconnect();
1293  }
1294  resumeObserving() {
1295    if (!this.mutationObserver) {
1296      return;
1297    }
1298    for (const root of this.roots) {
1299      this.mutationObserver.observe(root, this.observerConfig);
1300    }
1301  }
1302  translateMutations(mutations) {
1303    for (const mutation of mutations) {
1304      switch (mutation.type) {
1305        case "attributes":
1306          if (mutation.target.hasAttribute("data-l10n-id")) {
1307            this.pendingElements.add(mutation.target);
1308          }
1309          break;
1310        case "childList":
1311          for (const addedNode of mutation.addedNodes) {
1312            if (addedNode.nodeType === addedNode.ELEMENT_NODE) {
1313              if (addedNode.childElementCount) {
1314                for (const element of this.getTranslatables(addedNode)) {
1315                  this.pendingElements.add(element);
1316                }
1317              } else if (addedNode.hasAttribute(L10NID_ATTR_NAME)) {
1318                this.pendingElements.add(addedNode);
1319              }
1320            }
1321          }
1322          break;
1323      }
1324    }
1325    if (this.pendingElements.size > 0) {
1326      if (this.pendingrAF === null) {
1327        this.pendingrAF = this.windowElement.requestAnimationFrame(() => {
1328          this.translateElements(Array.from(this.pendingElements));
1329          this.pendingElements.clear();
1330          this.pendingrAF = null;
1331        });
1332      }
1333    }
1334  }
1335  translateFragment(frag) {
1336    return this.translateElements(this.getTranslatables(frag));
1337  }
1338  async translateElements(elements) {
1339    if (!elements.length) {
1340      return undefined;
1341    }
1342    const keys = elements.map(this.getKeysForElement);
1343    const translations = await this.formatMessages(keys);
1344    return this.applyTranslations(elements, translations);
1345  }
1346  applyTranslations(elements, translations) {
1347    this.pauseObserving();
1348    for (let i = 0; i < elements.length; i++) {
1349      if (translations[i] !== undefined) {
1350        translateElement(elements[i], translations[i]);
1351      }
1352    }
1353    this.resumeObserving();
1354  }
1355  getTranslatables(element) {
1356    const nodes = Array.from(element.querySelectorAll(L10N_ELEMENT_QUERY));
1357    if (typeof element.hasAttribute === "function" && element.hasAttribute(L10NID_ATTR_NAME)) {
1358      nodes.push(element);
1359    }
1360    return nodes;
1361  }
1362  getKeysForElement(element) {
1363    return {
1364      id: element.getAttribute(L10NID_ATTR_NAME),
1365      args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null)
1366    };
1367  }
1368}
1369;// CONCATENATED MODULE: ./node_modules/@fluent/dom/esm/index.js
1370
1371
1372
1373/***/ }),
1374
1375/***/ 259:
1376/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
1377
1378__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
1379/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1380/* harmony export */   AltTextManager: () => (/* binding */ AltTextManager)
1381/* harmony export */ });
1382/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
1383var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
1384pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
1385
1386class AltTextManager {
1387  #boundUpdateUIState = this.#updateUIState.bind(this);
1388  #boundSetPosition = this.#setPosition.bind(this);
1389  #boundOnClick = this.#onClick.bind(this);
1390  #currentEditor = null;
1391  #cancelButton;
1392  #dialog;
1393  #eventBus;
1394  #hasUsedPointer = false;
1395  #optionDescription;
1396  #optionDecorative;
1397  #overlayManager;
1398  #saveButton;
1399  #textarea;
1400  #uiManager;
1401  #previousAltText = null;
1402  #svgElement = null;
1403  #rectElement = null;
1404  #container;
1405  #telemetryData = null;
1406  constructor({
1407    dialog,
1408    optionDescription,
1409    optionDecorative,
1410    textarea,
1411    cancelButton,
1412    saveButton
1413  }, container, overlayManager, eventBus) {
1414    this.#dialog = dialog;
1415    this.#optionDescription = optionDescription;
1416    this.#optionDecorative = optionDecorative;
1417    this.#textarea = textarea;
1418    this.#cancelButton = cancelButton;
1419    this.#saveButton = saveButton;
1420    this.#overlayManager = overlayManager;
1421    this.#eventBus = eventBus;
1422    this.#container = container;
1423    dialog.addEventListener("close", this.#close.bind(this));
1424    dialog.addEventListener("contextmenu", event => {
1425      if (event.target !== this.#textarea) {
1426        event.preventDefault();
1427      }
1428    });
1429    cancelButton.addEventListener("click", this.#finish.bind(this));
1430    saveButton.addEventListener("click", this.#save.bind(this));
1431    optionDescription.addEventListener("change", this.#boundUpdateUIState);
1432    optionDecorative.addEventListener("change", this.#boundUpdateUIState);
1433    this.#overlayManager.register(dialog);
1434  }
1435  get _elements() {
1436    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.shadow)(this, "_elements", [this.#optionDescription, this.#optionDecorative, this.#textarea, this.#saveButton, this.#cancelButton]);
1437  }
1438  #createSVGElement() {
1439    if (this.#svgElement) {
1440      return;
1441    }
1442    const svgFactory = new pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.DOMSVGFactory();
1443    const svg = this.#svgElement = svgFactory.createElement("svg");
1444    svg.setAttribute("width", "0");
1445    svg.setAttribute("height", "0");
1446    const defs = svgFactory.createElement("defs");
1447    svg.append(defs);
1448    const mask = svgFactory.createElement("mask");
1449    defs.append(mask);
1450    mask.setAttribute("id", "alttext-manager-mask");
1451    mask.setAttribute("maskContentUnits", "objectBoundingBox");
1452    let rect = svgFactory.createElement("rect");
1453    mask.append(rect);
1454    rect.setAttribute("fill", "white");
1455    rect.setAttribute("width", "1");
1456    rect.setAttribute("height", "1");
1457    rect.setAttribute("x", "0");
1458    rect.setAttribute("y", "0");
1459    rect = this.#rectElement = svgFactory.createElement("rect");
1460    mask.append(rect);
1461    rect.setAttribute("fill", "black");
1462    this.#dialog.append(svg);
1463  }
1464  async editAltText(uiManager, editor) {
1465    if (this.#currentEditor || !editor) {
1466      return;
1467    }
1468    this.#createSVGElement();
1469    this.#hasUsedPointer = false;
1470    for (const element of this._elements) {
1471      element.addEventListener("click", this.#boundOnClick);
1472    }
1473    const {
1474      altText,
1475      decorative
1476    } = editor.altTextData;
1477    if (decorative === true) {
1478      this.#optionDecorative.checked = true;
1479      this.#optionDescription.checked = false;
1480    } else {
1481      this.#optionDecorative.checked = false;
1482      this.#optionDescription.checked = true;
1483    }
1484    this.#previousAltText = this.#textarea.value = altText?.trim() || "";
1485    this.#updateUIState();
1486    this.#currentEditor = editor;
1487    this.#uiManager = uiManager;
1488    this.#uiManager.removeEditListeners();
1489    this.#eventBus._on("resize", this.#boundSetPosition);
1490    try {
1491      await this.#overlayManager.open(this.#dialog);
1492      this.#setPosition();
1493    } catch (ex) {
1494      this.#close();
1495      throw ex;
1496    }
1497  }
1498  #setPosition() {
1499    if (!this.#currentEditor) {
1500      return;
1501    }
1502    const dialog = this.#dialog;
1503    const {
1504      style
1505    } = dialog;
1506    const {
1507      x: containerX,
1508      y: containerY,
1509      width: containerW,
1510      height: containerH
1511    } = this.#container.getBoundingClientRect();
1512    const {
1513      innerWidth: windowW,
1514      innerHeight: windowH
1515    } = window;
1516    const {
1517      width: dialogW,
1518      height: dialogH
1519    } = dialog.getBoundingClientRect();
1520    const {
1521      x,
1522      y,
1523      width,
1524      height
1525    } = this.#currentEditor.getClientDimensions();
1526    const MARGIN = 10;
1527    const isLTR = this.#uiManager.direction === "ltr";
1528    const xs = Math.max(x, containerX);
1529    const xe = Math.min(x + width, containerX + containerW);
1530    const ys = Math.max(y, containerY);
1531    const ye = Math.min(y + height, containerY + containerH);
1532    this.#rectElement.setAttribute("width", `${(xe - xs) / windowW}`);
1533    this.#rectElement.setAttribute("height", `${(ye - ys) / windowH}`);
1534    this.#rectElement.setAttribute("x", `${xs / windowW}`);
1535    this.#rectElement.setAttribute("y", `${ys / windowH}`);
1536    let left = null;
1537    let top = Math.max(y, 0);
1538    top += Math.min(windowH - (top + dialogH), 0);
1539    if (isLTR) {
1540      if (x + width + MARGIN + dialogW < windowW) {
1541        left = x + width + MARGIN;
1542      } else if (x > dialogW + MARGIN) {
1543        left = x - dialogW - MARGIN;
1544      }
1545    } else if (x > dialogW + MARGIN) {
1546      left = x - dialogW - MARGIN;
1547    } else if (x + width + MARGIN + dialogW < windowW) {
1548      left = x + width + MARGIN;
1549    }
1550    if (left === null) {
1551      top = null;
1552      left = Math.max(x, 0);
1553      left += Math.min(windowW - (left + dialogW), 0);
1554      if (y > dialogH + MARGIN) {
1555        top = y - dialogH - MARGIN;
1556      } else if (y + height + MARGIN + dialogH < windowH) {
1557        top = y + height + MARGIN;
1558      }
1559    }
1560    if (top !== null) {
1561      dialog.classList.add("positioned");
1562      if (isLTR) {
1563        style.left = `${left}px`;
1564      } else {
1565        style.right = `${windowW - left - dialogW}px`;
1566      }
1567      style.top = `${top}px`;
1568    } else {
1569      dialog.classList.remove("positioned");
1570      style.left = "";
1571      style.top = "";
1572    }
1573  }
1574  #finish() {
1575    if (this.#overlayManager.active === this.#dialog) {
1576      this.#overlayManager.close(this.#dialog);
1577    }
1578  }
1579  #close() {
1580    this.#currentEditor._reportTelemetry(this.#telemetryData || {
1581      action: "alt_text_cancel",
1582      alt_text_keyboard: !this.#hasUsedPointer
1583    });
1584    this.#telemetryData = null;
1585    this.#removeOnClickListeners();
1586    this.#uiManager?.addEditListeners();
1587    this.#eventBus._off("resize", this.#boundSetPosition);
1588    this.#currentEditor.altTextFinish();
1589    this.#currentEditor = null;
1590    this.#uiManager = null;
1591  }
1592  #updateUIState() {
1593    this.#textarea.disabled = this.#optionDecorative.checked;
1594  }
1595  #save() {
1596    const altText = this.#textarea.value.trim();
1597    const decorative = this.#optionDecorative.checked;
1598    this.#currentEditor.altTextData = {
1599      altText,
1600      decorative
1601    };
1602    this.#telemetryData = {
1603      action: "alt_text_save",
1604      alt_text_description: !!altText,
1605      alt_text_edit: !!this.#previousAltText && this.#previousAltText !== altText,
1606      alt_text_decorative: decorative,
1607      alt_text_keyboard: !this.#hasUsedPointer
1608    };
1609    this.#finish();
1610  }
1611  #onClick(evt) {
1612    if (evt.detail === 0) {
1613      return;
1614    }
1615    this.#hasUsedPointer = true;
1616    this.#removeOnClickListeners();
1617  }
1618  #removeOnClickListeners() {
1619    for (const element of this._elements) {
1620      element.removeEventListener("click", this.#boundOnClick);
1621    }
1622  }
1623  destroy() {
1624    this.#uiManager = null;
1625    this.#finish();
1626    this.#svgElement?.remove();
1627    this.#svgElement = this.#rectElement = null;
1628  }
1629}
1630
1631__webpack_async_result__();
1632} catch(e) { __webpack_async_result__(e); } });
1633
1634/***/ }),
1635
1636/***/ 283:
1637/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
1638
1639__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
1640/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1641/* harmony export */   AnnotationEditorLayerBuilder: () => (/* binding */ AnnotationEditorLayerBuilder)
1642/* harmony export */ });
1643/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
1644/* harmony import */ var web_null_l10n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(410);
1645var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__, web_null_l10n__WEBPACK_IMPORTED_MODULE_1__]);
1646([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__, web_null_l10n__WEBPACK_IMPORTED_MODULE_1__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
1647
1648
1649class AnnotationEditorLayerBuilder {
1650  #annotationLayer = null;
1651  #drawLayer = null;
1652  #onAppend = null;
1653  #textLayer = null;
1654  #uiManager;
1655  constructor(options) {
1656    this.pdfPage = options.pdfPage;
1657    this.accessibilityManager = options.accessibilityManager;
1658    this.l10n = options.l10n;
1659    this.l10n ||= new web_null_l10n__WEBPACK_IMPORTED_MODULE_1__.GenericL10n();
1660    this.annotationEditorLayer = null;
1661    this.div = null;
1662    this._cancelled = false;
1663    this.#uiManager = options.uiManager;
1664    this.#annotationLayer = options.annotationLayer || null;
1665    this.#textLayer = options.textLayer || null;
1666    this.#drawLayer = options.drawLayer || null;
1667    this.#onAppend = options.onAppend || null;
1668  }
1669  async render(viewport, intent = "display") {
1670    if (intent !== "display") {
1671      return;
1672    }
1673    if (this._cancelled) {
1674      return;
1675    }
1676    const clonedViewport = viewport.clone({
1677      dontFlip: true
1678    });
1679    if (this.div) {
1680      this.annotationEditorLayer.update({
1681        viewport: clonedViewport
1682      });
1683      this.show();
1684      return;
1685    }
1686    const div = this.div = document.createElement("div");
1687    div.className = "annotationEditorLayer";
1688    div.hidden = true;
1689    div.dir = this.#uiManager.direction;
1690    this.#onAppend?.(div);
1691    this.annotationEditorLayer = new pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorLayer({
1692      uiManager: this.#uiManager,
1693      div,
1694      accessibilityManager: this.accessibilityManager,
1695      pageIndex: this.pdfPage.pageNumber - 1,
1696      l10n: this.l10n,
1697      viewport: clonedViewport,
1698      annotationLayer: this.#annotationLayer,
1699      textLayer: this.#textLayer,
1700      drawLayer: this.#drawLayer
1701    });
1702    const parameters = {
1703      viewport: clonedViewport,
1704      div,
1705      annotations: null,
1706      intent
1707    };
1708    this.annotationEditorLayer.render(parameters);
1709    this.show();
1710  }
1711  cancel() {
1712    this._cancelled = true;
1713    if (!this.div) {
1714      return;
1715    }
1716    this.annotationEditorLayer.destroy();
1717  }
1718  hide() {
1719    if (!this.div) {
1720      return;
1721    }
1722    this.div.hidden = true;
1723  }
1724  show() {
1725    if (!this.div || this.annotationEditorLayer.isInvisible) {
1726      return;
1727    }
1728    this.div.hidden = false;
1729  }
1730}
1731
1732__webpack_async_result__();
1733} catch(e) { __webpack_async_result__(e); } });
1734
1735/***/ }),
1736
1737/***/ 226:
1738/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
1739
1740__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
1741/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1742/* harmony export */   AnnotationEditorParams: () => (/* binding */ AnnotationEditorParams)
1743/* harmony export */ });
1744/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
1745var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
1746pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
1747
1748class AnnotationEditorParams {
1749  constructor(options, eventBus) {
1750    this.eventBus = eventBus;
1751    this.#bindListeners(options);
1752  }
1753  #bindListeners({
1754    editorFreeTextFontSize,
1755    editorFreeTextColor,
1756    editorInkColor,
1757    editorInkThickness,
1758    editorInkOpacity,
1759    editorStampAddImage,
1760    editorFreeHighlightThickness,
1761    editorHighlightShowAll
1762  }) {
1763    const dispatchEvent = (typeStr, value) => {
1764      this.eventBus.dispatch("switchannotationeditorparams", {
1765        source: this,
1766        type: pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType[typeStr],
1767        value
1768      });
1769    };
1770    editorFreeTextFontSize.addEventListener("input", function () {
1771      dispatchEvent("FREETEXT_SIZE", this.valueAsNumber);
1772    });
1773    editorFreeTextColor.addEventListener("input", function () {
1774      dispatchEvent("FREETEXT_COLOR", this.value);
1775    });
1776    editorInkColor.addEventListener("input", function () {
1777      dispatchEvent("INK_COLOR", this.value);
1778    });
1779    editorInkThickness.addEventListener("input", function () {
1780      dispatchEvent("INK_THICKNESS", this.valueAsNumber);
1781    });
1782    editorInkOpacity.addEventListener("input", function () {
1783      dispatchEvent("INK_OPACITY", this.valueAsNumber);
1784    });
1785    editorStampAddImage.addEventListener("click", () => {
1786      dispatchEvent("CREATE");
1787    });
1788    editorFreeHighlightThickness.addEventListener("input", function () {
1789      dispatchEvent("HIGHLIGHT_THICKNESS", this.valueAsNumber);
1790    });
1791    editorHighlightShowAll.addEventListener("click", function () {
1792      const checked = this.getAttribute("aria-pressed") === "true";
1793      this.setAttribute("aria-pressed", !checked);
1794      dispatchEvent("HIGHLIGHT_SHOW_ALL", !checked);
1795    });
1796    this.eventBus._on("annotationeditorparamschanged", evt => {
1797      for (const [type, value] of evt.details) {
1798        switch (type) {
1799          case pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.FREETEXT_SIZE:
1800            editorFreeTextFontSize.value = value;
1801            break;
1802          case pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.FREETEXT_COLOR:
1803            editorFreeTextColor.value = value;
1804            break;
1805          case pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.INK_COLOR:
1806            editorInkColor.value = value;
1807            break;
1808          case pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.INK_THICKNESS:
1809            editorInkThickness.value = value;
1810            break;
1811          case pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.INK_OPACITY:
1812            editorInkOpacity.value = value;
1813            break;
1814          case pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:
1815            editorFreeHighlightThickness.value = value;
1816            break;
1817          case pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.HIGHLIGHT_FREE:
1818            editorFreeHighlightThickness.disabled = !value;
1819            break;
1820          case pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:
1821            editorHighlightShowAll.setAttribute("aria-pressed", value);
1822            break;
1823        }
1824      }
1825    });
1826  }
1827}
1828
1829__webpack_async_result__();
1830} catch(e) { __webpack_async_result__(e); } });
1831
1832/***/ }),
1833
1834/***/ 2707:
1835/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
1836
1837__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
1838/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1839/* harmony export */   AnnotationLayerBuilder: () => (/* binding */ AnnotationLayerBuilder)
1840/* harmony export */ });
1841/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
1842/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7256);
1843var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
1844pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
1845
1846
1847class AnnotationLayerBuilder {
1848  #onAppend = null;
1849  #onPresentationModeChanged = null;
1850  constructor({
1851    pdfPage,
1852    linkService,
1853    downloadManager,
1854    annotationStorage = null,
1855    imageResourcesPath = "",
1856    renderForms = true,
1857    enableScripting = false,
1858    hasJSActionsPromise = null,
1859    fieldObjectsPromise = null,
1860    annotationCanvasMap = null,
1861    accessibilityManager = null,
1862    onAppend = null
1863  }) {
1864    this.pdfPage = pdfPage;
1865    this.linkService = linkService;
1866    this.downloadManager = downloadManager;
1867    this.imageResourcesPath = imageResourcesPath;
1868    this.renderForms = renderForms;
1869    this.annotationStorage = annotationStorage;
1870    this.enableScripting = enableScripting;
1871    this._hasJSActionsPromise = hasJSActionsPromise || Promise.resolve(false);
1872    this._fieldObjectsPromise = fieldObjectsPromise || Promise.resolve(null);
1873    this._annotationCanvasMap = annotationCanvasMap;
1874    this._accessibilityManager = accessibilityManager;
1875    this.#onAppend = onAppend;
1876    this.annotationLayer = null;
1877    this.div = null;
1878    this._cancelled = false;
1879    this._eventBus = linkService.eventBus;
1880  }
1881  async render(viewport, intent = "display") {
1882    if (this.div) {
1883      if (this._cancelled || !this.annotationLayer) {
1884        return;
1885      }
1886      this.annotationLayer.update({
1887        viewport: viewport.clone({
1888          dontFlip: true
1889        })
1890      });
1891      return;
1892    }
1893    const [annotations, hasJSActions, fieldObjects] = await Promise.all([this.pdfPage.getAnnotations({
1894      intent
1895    }), this._hasJSActionsPromise, this._fieldObjectsPromise]);
1896    if (this._cancelled) {
1897      return;
1898    }
1899    const div = this.div = document.createElement("div");
1900    div.className = "annotationLayer";
1901    this.#onAppend?.(div);
1902    if (annotations.length === 0) {
1903      this.hide();
1904      return;
1905    }
1906    this.annotationLayer = new pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationLayer({
1907      div,
1908      accessibilityManager: this._accessibilityManager,
1909      annotationCanvasMap: this._annotationCanvasMap,
1910      page: this.pdfPage,
1911      viewport: viewport.clone({
1912        dontFlip: true
1913      })
1914    });
1915    await this.annotationLayer.render({
1916      annotations,
1917      imageResourcesPath: this.imageResourcesPath,
1918      renderForms: this.renderForms,
1919      linkService: this.linkService,
1920      downloadManager: this.downloadManager,
1921      annotationStorage: this.annotationStorage,
1922      enableScripting: this.enableScripting,
1923      hasJSActions,
1924      fieldObjects
1925    });
1926    if (this.linkService.isInPresentationMode) {
1927      this.#updatePresentationModeState(_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.FULLSCREEN);
1928    }
1929    if (!this.#onPresentationModeChanged) {
1930      this.#onPresentationModeChanged = evt => {
1931        this.#updatePresentationModeState(evt.state);
1932      };
1933      this._eventBus?._on("presentationmodechanged", this.#onPresentationModeChanged);
1934    }
1935  }
1936  cancel() {
1937    this._cancelled = true;
1938    if (this.#onPresentationModeChanged) {
1939      this._eventBus?._off("presentationmodechanged", this.#onPresentationModeChanged);
1940      this.#onPresentationModeChanged = null;
1941    }
1942  }
1943  hide() {
1944    if (!this.div) {
1945      return;
1946    }
1947    this.div.hidden = true;
1948  }
1949  #updatePresentationModeState(state) {
1950    if (!this.div) {
1951      return;
1952    }
1953    let disableFormElements = false;
1954    switch (state) {
1955      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.FULLSCREEN:
1956        disableFormElements = true;
1957        break;
1958      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.NORMAL:
1959        break;
1960      default:
1961        return;
1962    }
1963    for (const section of this.div.childNodes) {
1964      if (section.hasAttribute("data-internal-link")) {
1965        continue;
1966      }
1967      section.inert = disableFormElements;
1968    }
1969  }
1970}
1971
1972__webpack_async_result__();
1973} catch(e) { __webpack_async_result__(e); } });
1974
1975/***/ }),
1976
1977/***/ 1621:
1978/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
1979
1980__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
1981/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1982/* harmony export */   PDFViewerApplication: () => (/* binding */ PDFViewerApplication)
1983/* harmony export */ });
1984/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
1985/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2603);
1986/* harmony import */ var _app_options_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9840);
1987/* harmony import */ var _event_utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5656);
1988/* harmony import */ var web_external_services__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6750);
1989/* harmony import */ var _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(787);
1990/* harmony import */ var web_alt_text_manager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(259);
1991/* harmony import */ var web_annotation_editor_params__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(226);
1992/* harmony import */ var _caret_browsing_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(3973);
1993/* harmony import */ var web_download_manager__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1544);
1994/* harmony import */ var _overlay_manager_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(6174);
1995/* harmony import */ var _password_prompt_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2690);
1996/* harmony import */ var web_pdf_attachment_viewer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(9251);
1997/* harmony import */ var web_pdf_cursor_tools__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(5993);
1998/* harmony import */ var web_pdf_document_properties__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(164);
1999/* harmony import */ var web_pdf_find_bar__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(2226);
2000/* harmony import */ var _pdf_find_controller_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(9814);
2001/* harmony import */ var _pdf_history_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(8543);
2002/* harmony import */ var web_pdf_layer_viewer__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(4275);
2003/* harmony import */ var web_pdf_outline_viewer__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(5514);
2004/* harmony import */ var web_pdf_presentation_mode__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(8917);
2005/* harmony import */ var web_print_service__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(1144);
2006/* harmony import */ var _pdf_rendering_queue_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(6615);
2007/* harmony import */ var _pdf_scripting_manager_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(5942);
2008/* harmony import */ var web_pdf_sidebar__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(2275);
2009/* harmony import */ var web_pdf_thumbnail_viewer__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(8280);
2010/* harmony import */ var _pdf_viewer_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(6285);
2011/* harmony import */ var web_secondary_toolbar__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(1900);
2012/* harmony import */ var web_toolbar__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(6297);
2013/* harmony import */ var _view_history_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(9226);
2014var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__, web_external_services__WEBPACK_IMPORTED_MODULE_4__, web_alt_text_manager__WEBPACK_IMPORTED_MODULE_6__, web_annotation_editor_params__WEBPACK_IMPORTED_MODULE_7__, web_download_manager__WEBPACK_IMPORTED_MODULE_8__, _password_prompt_js__WEBPACK_IMPORTED_MODULE_9__, web_pdf_attachment_viewer__WEBPACK_IMPORTED_MODULE_10__, web_pdf_cursor_tools__WEBPACK_IMPORTED_MODULE_11__, web_pdf_document_properties__WEBPACK_IMPORTED_MODULE_12__, web_pdf_presentation_mode__WEBPACK_IMPORTED_MODULE_18__, web_print_service__WEBPACK_IMPORTED_MODULE_19__, _pdf_rendering_queue_js__WEBPACK_IMPORTED_MODULE_20__, _pdf_scripting_manager_js__WEBPACK_IMPORTED_MODULE_21__, web_pdf_thumbnail_viewer__WEBPACK_IMPORTED_MODULE_23__, _pdf_viewer_js__WEBPACK_IMPORTED_MODULE_24__, web_secondary_toolbar__WEBPACK_IMPORTED_MODULE_25__, web_toolbar__WEBPACK_IMPORTED_MODULE_26__]);
2015([pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__, web_external_services__WEBPACK_IMPORTED_MODULE_4__, web_alt_text_manager__WEBPACK_IMPORTED_MODULE_6__, web_annotation_editor_params__WEBPACK_IMPORTED_MODULE_7__, web_download_manager__WEBPACK_IMPORTED_MODULE_8__, _password_prompt_js__WEBPACK_IMPORTED_MODULE_9__, web_pdf_attachment_viewer__WEBPACK_IMPORTED_MODULE_10__, web_pdf_cursor_tools__WEBPACK_IMPORTED_MODULE_11__, web_pdf_document_properties__WEBPACK_IMPORTED_MODULE_12__, web_pdf_presentation_mode__WEBPACK_IMPORTED_MODULE_18__, web_print_service__WEBPACK_IMPORTED_MODULE_19__, _pdf_rendering_queue_js__WEBPACK_IMPORTED_MODULE_20__, _pdf_scripting_manager_js__WEBPACK_IMPORTED_MODULE_21__, web_pdf_thumbnail_viewer__WEBPACK_IMPORTED_MODULE_23__, _pdf_viewer_js__WEBPACK_IMPORTED_MODULE_24__, web_secondary_toolbar__WEBPACK_IMPORTED_MODULE_25__, web_toolbar__WEBPACK_IMPORTED_MODULE_26__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047const FORCE_PAGES_LOADED_TIMEOUT = 10000;
2048const WHEEL_ZOOM_DISABLED_TIMEOUT = 1000;
2049const ViewOnLoad = {
2050  UNKNOWN: -1,
2051  PREVIOUS: 0,
2052  INITIAL: 1
2053};
2054const PDFViewerApplication = {
2055  initialBookmark: document.location.hash.substring(1),
2056  _initializedCapability: {
2057    ...Promise.withResolvers(),
2058    settled: false
2059  },
2060  appConfig: null,
2061  pdfDocument: null,
2062  pdfLoadingTask: null,
2063  printService: null,
2064  pdfViewer: null,
2065  pdfThumbnailViewer: null,
2066  pdfRenderingQueue: null,
2067  pdfPresentationMode: null,
2068  pdfDocumentProperties: null,
2069  pdfLinkService: null,
2070  pdfHistory: null,
2071  pdfSidebar: null,
2072  pdfOutlineViewer: null,
2073  pdfAttachmentViewer: null,
2074  pdfLayerViewer: null,
2075  pdfCursorTools: null,
2076  pdfScriptingManager: null,
2077  store: null,
2078  downloadManager: null,
2079  overlayManager: null,
2080  preferences: null,
2081  toolbar: null,
2082  secondaryToolbar: null,
2083  eventBus: null,
2084  l10n: null,
2085  annotationEditorParams: null,
2086  isInitialViewSet: false,
2087  downloadComplete: false,
2088  isViewerEmbedded: window.parent !== window,
2089  url: "",
2090  baseUrl: "",
2091  _downloadUrl: "",
2092  _boundEvents: Object.create(null),
2093  documentInfo: null,
2094  metadata: null,
2095  _contentDispositionFilename: null,
2096  _contentLength: null,
2097  _saveInProgress: false,
2098  _wheelUnusedTicks: 0,
2099  _wheelUnusedFactor: 1,
2100  _touchUnusedTicks: 0,
2101  _touchUnusedFactor: 1,
2102  _PDFBug: null,
2103  _hasAnnotationEditors: false,
2104  _title: document.title,
2105  _printAnnotationStoragePromise: null,
2106  _touchInfo: null,
2107  _isCtrlKeyDown: false,
2108  _nimbusDataPromise: null,
2109  _caretBrowsing: null,
2110  _isScrolling: false,
2111  _lastScrollTop: 0,
2112  _lastScrollLeft: 0,
2113  async initialize(appConfig) {
2114    let l10nPromise;
2115    this.appConfig = appConfig;
2116    try {
2117      await this.preferences.initializedPromise;
2118    } catch (ex) {
2119      console.error(`initialize: "${ex.message}".`);
2120    }
2121    if (_app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("pdfBugEnabled")) {
2122      await this._parseHashParams();
2123    }
2124    let mode;
2125    switch (_app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("viewerCssTheme")) {
2126      case 1:
2127        mode = "is-light";
2128        break;
2129      case 2:
2130        mode = "is-dark";
2131        break;
2132    }
2133    if (mode) {
2134      document.documentElement.classList.add(mode);
2135    }
2136    l10nPromise = this.externalServices.createL10n();
2137    this.l10n = await l10nPromise;
2138    document.getElementsByTagName("html")[0].dir = this.l10n.getDirection();
2139    this.l10n.translate(appConfig.appContainer || document.documentElement);
2140    if (this.isViewerEmbedded && _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("externalLinkTarget") === _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_5__.LinkTarget.NONE) {
2141      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("externalLinkTarget", _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_5__.LinkTarget.TOP);
2142    }
2143    await this._initializeViewerComponents();
2144    this.bindEvents();
2145    this.bindWindowEvents();
2146    this._initializedCapability.settled = true;
2147    this._initializedCapability.resolve();
2148  },
2149  async _parseHashParams() {
2150    const hash = document.location.hash.substring(1);
2151    if (!hash) {
2152      return;
2153    }
2154    const {
2155        mainContainer,
2156        viewerContainer
2157      } = this.appConfig,
2158      params = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.parseQueryString)(hash);
2159    if (params.get("disableworker") === "true") {
2160      try {
2161        await loadFakeWorker();
2162      } catch (ex) {
2163        console.error(`_parseHashParams: "${ex.message}".`);
2164      }
2165    }
2166    if (params.has("disablerange")) {
2167      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("disableRange", params.get("disablerange") === "true");
2168    }
2169    if (params.has("disablestream")) {
2170      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("disableStream", params.get("disablestream") === "true");
2171    }
2172    if (params.has("disableautofetch")) {
2173      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("disableAutoFetch", params.get("disableautofetch") === "true");
2174    }
2175    if (params.has("disablefontface")) {
2176      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("disableFontFace", params.get("disablefontface") === "true");
2177    }
2178    if (params.has("disablehistory")) {
2179      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("disableHistory", params.get("disablehistory") === "true");
2180    }
2181    if (params.has("verbosity")) {
2182      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("verbosity", params.get("verbosity") | 0);
2183    }
2184    if (params.has("textlayer")) {
2185      switch (params.get("textlayer")) {
2186        case "off":
2187          _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("textLayerMode", _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.TextLayerMode.DISABLE);
2188          break;
2189        case "visible":
2190        case "shadow":
2191        case "hover":
2192          viewerContainer.classList.add(`textLayer-${params.get("textlayer")}`);
2193          try {
2194            await loadPDFBug(this);
2195            this._PDFBug.loadCSS();
2196          } catch (ex) {
2197            console.error(`_parseHashParams: "${ex.message}".`);
2198          }
2199          break;
2200      }
2201    }
2202    if (params.has("pdfbug")) {
2203      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("pdfBug", true);
2204      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("fontExtraProperties", true);
2205      const enabled = params.get("pdfbug").split(",");
2206      try {
2207        await loadPDFBug(this);
2208        this._PDFBug.init(mainContainer, enabled);
2209      } catch (ex) {
2210        console.error(`_parseHashParams: "${ex.message}".`);
2211      }
2212    }
2213    if (params.has("locale")) {
2214      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("locale", params.get("locale"));
2215    }
2216  },
2217  async _initializeViewerComponents() {
2218    const {
2219      appConfig,
2220      externalServices,
2221      l10n
2222    } = this;
2223    const eventBus = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("isInAutomation") ? new _event_utils_js__WEBPACK_IMPORTED_MODULE_3__.AutomationEventBus() : new _event_utils_js__WEBPACK_IMPORTED_MODULE_3__.EventBus();
2224    this.eventBus = eventBus;
2225    this.overlayManager = new _overlay_manager_js__WEBPACK_IMPORTED_MODULE_27__.OverlayManager();
2226    const pdfRenderingQueue = new _pdf_rendering_queue_js__WEBPACK_IMPORTED_MODULE_20__.PDFRenderingQueue();
2227    pdfRenderingQueue.onIdle = this._cleanup.bind(this);
2228    this.pdfRenderingQueue = pdfRenderingQueue;
2229    const pdfLinkService = new _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_5__.PDFLinkService({
2230      eventBus,
2231      externalLinkTarget: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("externalLinkTarget"),
2232      externalLinkRel: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("externalLinkRel"),
2233      ignoreDestinationZoom: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("ignoreDestinationZoom")
2234    });
2235    this.pdfLinkService = pdfLinkService;
2236    const downloadManager = this.downloadManager = new web_download_manager__WEBPACK_IMPORTED_MODULE_8__.DownloadManager();
2237    const findController = new _pdf_find_controller_js__WEBPACK_IMPORTED_MODULE_14__.PDFFindController({
2238      linkService: pdfLinkService,
2239      eventBus,
2240      updateMatchesCountOnProgress: true
2241    });
2242    this.findController = findController;
2243    const pdfScriptingManager = new _pdf_scripting_manager_js__WEBPACK_IMPORTED_MODULE_21__.PDFScriptingManager({
2244      eventBus,
2245      externalServices,
2246      docProperties: this._scriptingDocProperties.bind(this)
2247    });
2248    this.pdfScriptingManager = pdfScriptingManager;
2249    const container = appConfig.mainContainer,
2250      viewer = appConfig.viewerContainer;
2251    const annotationEditorMode = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("annotationEditorMode");
2252    const isOffscreenCanvasSupported = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("isOffscreenCanvasSupported") && pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.FeatureTest.isOffscreenCanvasSupported;
2253    const pageColors = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("forcePageColors") || window.matchMedia("(forced-colors: active)").matches ? {
2254      background: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("pageColorsBackgroun
2254d"),
2255      foreground: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("pageColorsForeground")
2256    } : null;
2257    const altTextManager = appConfig.altTextDialog ? new web_alt_text_manager__WEBPACK_IMPORTED_MODULE_6__.AltTextManager(appConfig.altTextDialog, container, this.overlayManager, eventBus) : null;
2258    const pdfViewer = new _pdf_viewer_js__WEBPACK_IMPORTED_MODULE_24__.PDFViewer({
2259      container,
2260      viewer,
2261      eventBus,
2262      renderingQueue: pdfRenderingQueue,
2263      linkService: pdfLinkService,
2264      downloadManager,
2265      altTextManager,
2266      findController,
2267      scriptingManager: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("enableScripting") && pdfScriptingManager,
2268      l10n,
2269      textLayerMode: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("textLayerMode"),
2270      annotationMode: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("annotationMode"),
2271      annotationEditorMode,
2272      annotationEditorHighlightColors: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("highlightEditorColors"),
2273      enableHighlightFloatingButton: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("enableHighlightFloatingButton"),
2274      imageResourcesPath: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("imageResourcesPath"),
2275      enablePrintAutoRotate: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("enablePrintAutoRotate"),
2276      maxCanvasPixels: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("maxCanvasPixels"),
2277      enablePermissions: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("enablePermissions"),
2278      pageColors,
2279      mlManager: this.mlManager
2280    });
2281    this.pdfViewer = pdfViewer;
2282    pdfRenderingQueue.setViewer(pdfViewer);
2283    pdfLinkService.setViewer(pdfViewer);
2284    pdfScriptingManager.setViewer(pdfViewer);
2285    if (appConfig.sidebar?.thumbnailView) {
2286      this.pdfThumbnailViewer = new web_pdf_thumbnail_viewer__WEBPACK_IMPORTED_MODULE_23__.PDFThumbnailViewer({
2287        container: appConfig.sidebar.thumbnailView,
2288        eventBus,
2289        renderingQueue: pdfRenderingQueue,
2290        linkService: pdfLinkService,
2291        pageColors
2292      });
2293      pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);
2294    }
2295    if (!this.isViewerEmbedded && !_app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("disableHistory")) {
2296      this.pdfHistory = new _pdf_history_js__WEBPACK_IMPORTED_MODULE_15__.PDFHistory({
2297        linkService: pdfLinkService,
2298        eventBus
2299      });
2300      pdfLinkService.setHistory(this.pdfHistory);
2301    }
2302    if (!this.supportsIntegratedFind && appConfig.findBar) {
2303      this.findBar = new web_pdf_find_bar__WEBPACK_IMPORTED_MODULE_13__.PDFFindBar(appConfig.findBar, eventBus);
2304    }
2305    if (appConfig.annotationEditorParams) {
2306      if (annotationEditorMode !== pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.AnnotationEditorType.DISABLE) {
2307        if (_app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("enableStampEditor") && isOffscreenCanvasSupported) {
2308          appConfig.toolbar?.editorStampButton?.classList.remove("hidden");
2309        }
2310        const editorHighlightButton = appConfig.toolbar?.editorHighlightButton;
2311        if (editorHighlightButton && _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("enableHighlightEditor")) {
2312          editorHighlightButton.hidden = false;
2313        }
2314        this.annotationEditorParams = new web_annotation_editor_params__WEBPACK_IMPORTED_MODULE_7__.AnnotationEditorParams(appConfig.annotationEditorParams, eventBus);
2315      } else {
2316        for (const id of ["editorModeButtons", "editorModeSeparator"]) {
2317          document.getElementById(id)?.classList.add("hidden");
2318        }
2319      }
2320    }
2321    if (appConfig.documentProperties) {
2322      this.pdfDocumentProperties = new web_pdf_document_properties__WEBPACK_IMPORTED_MODULE_12__.PDFDocumentProperties(appConfig.documentProperties, this.overlayManager, eventBus, l10n, () => this._docFilename);
2323    }
2324    if (appConfig.secondaryToolbar?.cursorHandToolButton) {
2325      this.pdfCursorTools = new web_pdf_cursor_tools__WEBPACK_IMPORTED_MODULE_11__.PDFCursorTools({
2326        container,
2327        eventBus,
2328        cursorToolOnLoad: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("cursorToolOnLoad")
2329      });
2330    }
2331    if (appConfig.toolbar) {
2332      this.toolbar = new web_toolbar__WEBPACK_IMPORTED_MODULE_26__.Toolbar(appConfig.toolbar, eventBus);
2333    }
2334    if (appConfig.secondaryToolbar) {
2335      this.secondaryToolbar = new web_secondary_toolbar__WEBPACK_IMPORTED_MODULE_25__.SecondaryToolbar(appConfig.secondaryToolbar, eventBus);
2336    }
2337    if (this.supportsFullscreen && appConfig.secondaryToolbar?.presentationModeButton) {
2338      this.pdfPresentationMode = new web_pdf_presentation_mode__WEBPACK_IMPORTED_MODULE_18__.PDFPresentationMode({
2339        container,
2340        pdfViewer,
2341        eventBus
2342      });
2343    }
2344    if (appConfig.passwordOverlay) {
2345      this.passwordPrompt = new _password_prompt_js__WEBPACK_IMPORTED_MODULE_9__.PasswordPrompt(appConfig.passwordOverlay, this.overlayManager, this.isViewerEmbedded);
2346    }
2347    if (appConfig.sidebar?.outlineView) {
2348      this.pdfOutlineViewer = new web_pdf_outline_viewer__WEBPACK_IMPORTED_MODULE_17__.PDFOutlineViewer({
2349        container: appConfig.sidebar.outlineView,
2350        eventBus,
2351        l10n,
2352        linkService: pdfLinkService,
2353        downloadManager
2354      });
2355    }
2356    if (appConfig.sidebar?.attachmentsView) {
2357      this.pdfAttachmentViewer = new web_pdf_attachment_viewer__WEBPACK_IMPORTED_MODULE_10__.PDFAttachmentViewer({
2358        container: appConfig.sidebar.attachmentsView,
2359        eventBus,
2360        l10n,
2361        downloadManager
2362      });
2363    }
2364    if (appConfig.sidebar?.layersView) {
2365      this.pdfLayerViewer = new web_pdf_layer_viewer__WEBPACK_IMPORTED_MODULE_16__.PDFLayerViewer({
2366        container: appConfig.sidebar.layersView,
2367        eventBus,
2368        l10n
2369      });
2370    }
2371    if (appConfig.sidebar) {
2372      this.pdfSidebar = new web_pdf_sidebar__WEBPACK_IMPORTED_MODULE_22__.PDFSidebar({
2373        elements: appConfig.sidebar,
2374        eventBus,
2375        l10n
2376      });
2377      this.pdfSidebar.onToggled = this.forceRendering.bind(this);
2378      this.pdfSidebar.onUpdateThumbnails = () => {
2379        for (const pageView of pdfViewer.getCachedPageViews()) {
2380          if (pageView.renderingState === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.FINISHED) {
2381            this.pdfThumbnailViewer.getThumbnail(pageView.id - 1)?.setImage(pageView);
2382          }
2383        }
2384        this.pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber);
2385      };
2386    }
2387  },
2388  async run(config) {
2389    this.preferences = new web_external_services__WEBPACK_IMPORTED_MODULE_4__.Preferences();
2390    await this.initialize(config);
2391    const {
2392      appConfig,
2393      eventBus
2394    } = this;
2395    let file;
2396    const queryString = document.location.search.substring(1);
2397    const params = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.parseQueryString)(queryString);
2398    file = params.get("file") ?? _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("defaultUrl");
2399    validateFileURL(file);
2400    const fileInput = this._openFileInput = document.createElement("input");
2401    fileInput.id = "fileInput";
2402    fileInput.hidden = true;
2403    fileInput.type = "file";
2404    fileInput.value = null;
2405    document.body.append(fileInput);
2406    fileInput.addEventListener("change", function (evt) {
2407      const {
2408        files
2409      } = evt.target;
2410      if (!files || files.length === 0) {
2411        return;
2412      }
2413      eventBus.dispatch("fileinputchange", {
2414        source: this,
2415        fileInput: evt.target
2416      });
2417    });
2418    appConfig.mainContainer.addEventListener("dragover", function (evt) {
2419      evt.preventDefault();
2420      evt.dataTransfer.dropEffect = evt.dataTransfer.effectAllowed === "copy" ? "copy" : "move";
2421    });
2422    appConfig.mainContainer.addEventListener("drop", function (evt) {
2423      evt.preventDefault();
2424      const {
2425        files
2426      } = evt.dataTransfer;
2427      if (!files || files.length === 0) {
2428        return;
2429      }
2430      eventBus.dispatch("fileinputchange", {
2431        source: this,
2432        fileInput: evt.dataTransfer
2433      });
2434    });
2435    if (!_app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("supportsDocumentFonts")) {
2436      _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.set("disableFontFace", true);
2437      this.l10n.get("pdfjs-web-fonts-disabled").then(msg => {
2438        console.warn(msg);
2439      });
2440    }
2441    if (!this.supportsPrinting) {
2442      appConfig.toolbar?.print?.classList.add("hidden");
2443      appConfig.secondaryToolbar?.printButton.classList.add("hidden");
2444    }
2445    if (!this.supportsFullscreen) {
2446      appConfig.secondaryToolbar?.presentationModeButton.classList.add("hidden");
2447    }
2448    if (this.supportsIntegratedFind) {
2449      appConfig.toolbar?.viewFind?.classList.add("hidden");
2450    }
2451    if (file) {
2452      this.open({
2453        url: file
2454      });
2455    } else {
2456      this._hideViewBookmark();
2457    }
2458  },
2459  get externalServices() {
2460    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "externalServices", new web_external_services__WEBPACK_IMPORTED_MODULE_4__.ExternalServices());
2461  },
2462  get mlManager() {
2463    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "mlManager", _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("enableML") === true ? new web_external_services__WEBPACK_IMPORTED_MODULE_4__.MLManager() : null);
2464  },
2465  get initialized() {
2466    return this._initializedCapability.settled;
2467  },
2468  get initializedPromise() {
2469    return this._initializedCapability.promise;
2470  },
2471  zoomIn(steps, scaleFactor) {
2472    if (this.pdfViewer.isInPresentationMode) {
2473      return;
2474    }
2475    this.pdfViewer.increaseScale({
2476      drawingDelay: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("defaultZoomDelay"),
2477      steps,
2478      scaleFactor
2479    });
2480  },
2481  zoomOut(steps, scaleFactor) {
2482    if (this.pdfViewer.isInPresentationMode) {
2483      return;
2484    }
2485    this.pdfViewer.decreaseScale({
2486      drawingDelay: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("defaultZoomDelay"),
2487      steps,
2488      scaleFactor
2489    });
2490  },
2491  zoomReset() {
2492    if (this.pdfViewer.isInPresentationMode) {
2493      return;
2494    }
2495    this.pdfViewer.currentScaleValue = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_SCALE_VALUE;
2496  },
2497  get pagesCount() {
2498    return this.pdfDocument ? this.pdfDocument.numPages : 0;
2499  },
2500  get page() {
2501    return this.pdfViewer.currentPageNumber;
2502  },
2503  set page(val) {
2504    this.pdfViewer.currentPageNumber = val;
2505  },
2506  get supportsPrinting() {
2507    return web_print_service__WEBPACK_IMPORTED_MODULE_19__.PDFPrintServiceFactory.supportsPrinting;
2508  },
2509  get supportsFullscreen() {
2510    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "supportsFullscreen", document.fullscreenEnabled);
2511  },
2512  get supportsPinchToZoom() {
2513    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "supportsPinchToZoom", _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("supportsPinchToZoom"));
2514  },
2515  get supportsIntegratedFind() {
2516    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "supportsIntegratedFind", _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("supportsIntegratedFind"));
2517  },
2518  get loadingBar() {
2519    const barElement = document.getElementById("loadingBar");
2520    const bar = barElement ? new _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ProgressBar(barElement) : null;
2521    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "loadingBar", bar);
2522  },
2523  get supportsMouseWheelZoomCtrlKey() {
2524    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "supportsMouseWheelZoomCtrlKey", _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("supportsMouseWheelZoomCtrlKey"));
2525  },
2526  get supportsMouseWheelZoomMetaKey() {
2527    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "supportsMouseWheelZoomMetaKey", _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("supportsMouseWheelZoomMetaKey"));
2528  },
2529  get supportsCaretBrowsingMode() {
2530    return _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("supportsCaretBrowsingMode");
2531  },
2532  moveCaret(isUp, select) {
2533    this._caretBrowsing ||= new _caret_browsing_js__WEBPACK_IMPORTED_MODULE_28__.CaretBrowsingMode(this.appConfig.mainContainer, this.appConfig.viewerContainer, this.appConfig.toolbar?.container);
2534    this._caretBrowsing.moveCaret(isUp, select);
2535  },
2536  setTitleUsingUrl(url = "", downloadUrl = null) {
2537    this.url = url;
2538    this.baseUrl = url.split("#", 1)[0];
2539    if (downloadUrl) {
2540      this._downloadUrl = downloadUrl === url ? this.baseUrl : downloadUrl.split("#", 1)[0];
2541    }
2542    if ((0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.isDataScheme)(url)) {
2543      this._hideViewBookmark();
2544    }
2545    let title = (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.getPdfFilenameFromUrl)(url, "");
2546    if (!title) {
2547      try {
2548        title = decodeURIComponent((0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.getFilenameFromUrl)(url)) || url;
2549      } catch {
2550        title = url;
2551      }
2552    }
2553    this.setTitle(title);
2554  },
2555  setTitle(title = this._title) {
2556    this._title = title;
2557    if (this.isViewerEmbedded) {
2558      return;
2559    }
2560    const editorIndicator = this._hasAnnotationEditors && !this.pdfRenderingQueue.printing;
2561    document.title = `${editorIndicator ? "* " : ""}${title}`;
2562  },
2563  get _docFilename() {
2564    return this._contentDispositionFilename || (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.getPdfFilenameFromUrl)(this.url);
2565  },
2566  _hideViewBookmark() {
2567    const {
2568      secondaryToolbar
2569    } = this.appConfig;
2570    secondaryToolbar?.viewBookmarkButton.classList.add("hidden");
2571    if (secondaryToolbar?.presentationModeButton.classList.contains("hidden")) {
2572      document.getElementById("viewBookmarkSeparator")?.classList.add("hidden");
2573    }
2574  },
2575  async close() {
2576    this._unblockDocumentLoadEvent();
2577    this._hideViewBookmark();
2578    if (!this.pdfLoadingTask) {
2579      return;
2580    }
2581    if (this.pdfDocument?.annotationStorage.size > 0 && this._annotationStorageModified) {
2582      try {
2583        await this.save();
2584      } catch {}
2585    }
2586    const promises = [];
2587    promises.push(this.pdfLoadingTask.destroy());
2588    this.pdfLoadingTask = null;
2589    if (this.pdfDocument) {
2590      this.pdfDocument = null;
2591      this.pdfThumbnailViewer?.setDocument(null);
2592      this.pdfViewer.setDocument(null);
2593      this.pdfLinkService.setDocument(null);
2594      this.pdfDocumentProperties?.setDocument(null);
2595    }
2596    this.pdfLinkService.externalLinkEnabled = true;
2597    this.store = null;
2598    this.isInitialViewSet = false;
2599    this.downloadComplete = false;
2600    this.url = "";
2601    this.baseUrl = "";
2602    this._downloadUrl = "";
2603    this.documentInfo = null;
2604    this.metadata = null;
2605    this._contentDispositionFilename = null;
2606    this._contentLength = null;
2607    this._saveInProgress = false;
2608    this._hasAnnotationEditors = false;
2609    promises.push(this.pdfScriptingManager.destroyPromise, this.passwordPrompt.close());
2610    this.setTitle();
2611    this.pdfSidebar?.reset();
2612    this.pdfOutlineViewer?.reset();
2613    this.pdfAttachmentViewer?.reset();
2614    this.pdfLayerViewer?.reset();
2615    this.pdfHistory?.reset();
2616    this.findBar?.reset();
2617    this.toolbar?.reset();
2618    this.secondaryToolbar?.reset();
2619    this._PDFBug?.cleanup();
2620    await Promise.all(promises);
2621  },
2622  async open(args) {
2623    if (this.pdfLoadingTask) {
2624      await this.close();
2625    }
2626    const workerParams = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.getAll(_app_options_js__WEBPACK_IMPORTED_MODULE_2__.OptionKind.WORKER);
2627    Object.assign(pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.GlobalWorkerOptions, workerParams);
2628    if (args.url) {
2629      this.setTitleUsingUrl(args.originalUrl || args.url, args.url);
2630    }
2631    const apiParams = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.getAll(_app_options_js__WEBPACK_IMPORTED_MODULE_2__.OptionKind.API);
2632    const loadingTask = (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.getDocument)({
2633      ...apiParams,
2634      ...args
2635    });
2636    this.pdfLoadingTask = loadingTask;
2637    loadingTask.onPassword = (updateCallback, reason) => {
2638      if (this.isViewerEmbedded) {
2639        this._unblockDocumentLoadEvent();
2640      }
2641      this.pdfLinkService.externalLinkEnabled = false;
2642      this.passwordPrompt.setUpdateCallback(updateCallback, reason);
2643      this.passwordPrompt.open();
2644    };
2645    loadingTask.onProgress = ({
2646      loaded,
2647      total
2648    }) => {
2649      this.progress(loaded / total);
2650    };
2651    return loadingTask.promise.then(pdfDocument => {
2652      this.load(pdfDocument);
2653    }, reason => {
2654      if (loadingTask !== this.pdfLoadingTask) {
2655        return undefined;
2656      }
2657      let key = "pdfjs-loading-error";
2658      if (reason instanceof pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.InvalidPDFException) {
2659        key = "pdfjs-invalid-file-error";
2660      } else if (reason instanceof pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.MissingPDFException) {
2661        key = "pdfjs-missing-file-error";
2662      } else if (reason instanceof pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.UnexpectedResponseException) {
2663        key = "pdfjs-unexpected-response-error";
2664      }
2665      return this._documentError(key, {
2666        message: reason.message
2667      }).then(() => {
2668        throw reason;
2669      });
2670    });
2671  },
2672  _ensureDownloadComplete() {
2673    if (this.pdfDocument && this.downloadComplete) {
2674      return;
2675    }
2676    throw new Error("PDF document not downloaded.");
2677  },
2678  async download(options = {}) {
2679    const url = this._downloadUrl,
2680      filename = this._docFilename;
2681    try {
2682      this._ensureDownloadComplete();
2683      const data = await this.pdfDocument.getData();
2684      const blob = new Blob([data], {
2685        type: "application/pdf"
2686      });
2687      await this.downloadManager.download(blob, url, filename, options);
2688    } catch {
2689      await this.downloadManager.downloadUrl(url, filename, options);
2690    }
2691  },
2692  async save(options = {}) {
2693    if (this._saveInProgress) {
2694      return;
2695    }
2696    this._saveInProgress = true;
2697    await this.pdfScriptingManager.dispatchWillSave();
2698    const url = this._downloadUrl,
2699      filename = this._docFilename;
2700    try {
2701      this._ensureDownloadComplete();
2702      const data = await this.pdfDocument.saveDocument();
2703      const blob = new Blob([data], {
2704        type: "application/pdf"
2705      });
2706      await this.downloadManager.download(blob, url, filename, options);
2707    } catch (reason) {
2708      console.error(`Error when saving the document: ${reason.message}`);
2709      await this.download(options);
2710    } finally {
2711      await this.pdfScriptingManager.dispatchDidSave();
2712      this._saveInProgress = false;
2713    }
2714    if (this._hasAnnotationEditors) {
2715      this.externalServices.reportTelemetry({
2716        type: "editing",
2717        data: {
2718          type: "save",
2719          stats: this.pdfDocument?.annotationStorage.editorStats
2720        }
2721      });
2722    }
2723  },
2724  downloadOrSave(options = {}) {
2725    if (this.pdfDocument?.annotationStorage.size > 0) {
2726      this.save(options);
2727    } else {
2728      this.download(options);
2729    }
2730  },
2731  async _documentError(key, moreInfo = null) {
2732    this._unblockDocumentLoadEvent();
2733    const message = await this._otherError(key || "pdfjs-loading-error", moreInfo);
2734    this.eventBus.dispatch("documenterror", {
2735      source: this,
2736      message,
2737      reason: moreInfo?.message ?? null
2738    });
2739  },
2740  async _otherError(key, moreInfo = null) {
2741    const message = await this.l10n.get(key);
2742    const moreInfoText = [`PDF.js v${pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.version || "?"} (build: ${pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.build || "?"})`];
2743    if (moreInfo) {
2744      moreInfoText.push(`Message: ${moreInfo.message}`);
2745      if (moreInfo.stack) {
2746        moreInfoText.push(`Stack: ${moreInfo.stack}`);
2747      } else {
2748        if (moreInfo.filename) {
2749          moreInfoText.push(`File: ${moreInfo.filename}`);
2750        }
2751        if (moreInfo.lineNumber) {
2752          moreInfoText.push(`Line: ${moreInfo.lineNumber}`);
2753        }
2754      }
2755    }
2756    console.error(`${message}\n\n${moreInfoText.join("\n")}`);
2757    return message;
2758  },
2759  progress(level) {
2760    if (!this.loadingBar || this.downloadComplete) {
2761      return;
2762    }
2763    const percent = Math.round(level * 100);
2764    if (percent <= this.loadingBar.percent) {
2765      return;
2766    }
2767    this.loadingBar.percent = percent;
2768    if (this.pdfDocument?.loadingParams.disableAutoFetch ?? _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("disableAutoFetch")) {
2769      this.loadingBar.setDisableAutoFetch();
2770    }
2771  },
2772  load(pdfDocument) {
2773    this.pdfDocument = pdfDocument;
2774    pdfDocument.getDownloadInfo().then(({
2775      length
2776    }) => {
2777      this._contentLength = length;
2778      this.downloadComplete = true;
2779      this.loadingBar?.hide();
2780      firstPagePromise.then(() => {
2781        this.eventBus.dispatch("documentloaded", {
2782          source: this
2783        });
2784      });
2785    });
2786    const pageLayoutPromise = pdfDocument.getPageLayout().catch(() => {});
2787    const pageModePromise = pdfDocument.getPageMode().catch(() => {});
2788    const openActionPromise = pdfDocument.getOpenAction().catch(() => {});
2789    this.toolbar?.setPagesCount(pdfDocument.numPages, false);
2790    this.secondaryToolbar?.setPagesCount(pdfDocument.numPages);
2791    this.pdfLinkService.setDocument(pdfDocument);
2792    this.pdfDocumentProperties?.setDocument(pdfDocument);
2793    const pdfViewer = this.pdfViewer;
2794    pdfViewer.setDocument(pdfDocument);
2795    const {
2796      firstPagePromise,
2797      onePageRendered,
2798      pagesPromise
2799    } = pdfViewer;
2800    this.pdfThumbnailViewer?.setDocument(pdfDocument);
2801    const storedPromise = (this.store = new _view_history_js__WEBPACK_IMPORTED_MODULE_29__.ViewHistory(pdfDocument.fingerprints[0])).getMultiple({
2802      page: null,
2803      zoom: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_SCALE_VALUE,
2804      scrollLeft: "0",
2805      scrollTop: "0",
2806      rotation: null,
2807      sidebarView: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.UNKNOWN,
2808      scrollMode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.UNKNOWN,
2809      spreadMode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.UNKNOWN
2810    }).catch(() => {});
2811    firstPagePromise.then(pdfPage => {
2812      this.loadingBar?.setWidth(this.appConfig.viewerContainer);
2813      this._initializeAnnotationStorageCallbacks(pdfDocument);
2814      Promise.all([_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.animationStarted, storedPromise, pageLayoutPromise, pageModePromise, openActionPromise]).then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => {
2815        const viewOnLoad = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("viewOnLoad");
2816        this._initializePdfHistory({
2817          fingerprint: pdfDocument.fingerprints[0],
2818          viewOnLoad,
2819          initialDest: openAction?.dest
2820        });
2821        const initialBookmark = this.initialBookmark;
2822        const zoom = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("defaultZoomValue");
2823        let hash = zoom ? `zoom=${zoom}` : null;
2824        let rotation = null;
2825        let sidebarView = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("sidebarViewOnLoad");
2826        let scrollMode = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("scrollModeOnLoad");
2827        let spreadMode = _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("spreadModeOnLoad");
2828        if (stored?.page && viewOnLoad !== ViewOnLoad.INITIAL) {
2829          hash = `page=${stored.page}&zoom=${zoom || stored.zoom},` + `${stored.scrollLeft},${stored.scrollTop}`;
2830          rotation = parseInt(stored.rotation, 10);
2831          if (sidebarView === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.UNKNOWN) {
2832            sidebarView = stored.sidebarView | 0;
2833          }
2834          if (scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.UNKNOWN) {
2835            scrollMode = stored.scrollMode | 0;
2836          }
2837          if (spreadMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.UNKNOWN) {
2838            spreadMode = stored.spreadMode | 0;
2839          }
2840        }
2841        if (pageMode && sidebarView === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.UNKNOWN) {
2842          sidebarView = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.apiPageModeToSidebarView)(pageMode);
2843        }
2844        if (pageLayout && scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.UNKNOWN && spreadMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.UNKNOWN) {
2845          const modes = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.apiPageLayoutToViewerModes)(pageLayout);
2846          spreadMode = modes.spreadMode;
2847        }
2848        this.setInitialView(hash, {
2849          rotation,
2850          sidebarView,
2851          scrollMode,
2852          spreadMode
2853        });
2854        this.eventBus.dispatch("documentinit", {
2855          source: this
2856        });
2857        if (!this.isViewerEmbedded) {
2858          pdfViewer.focus();
2859        }
2860        await Promise.race([pagesPromise, new Promise(resolve => {
2861          setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT);
2862        })]);
2863        if (!initialBookmark && !hash) {
2864          return;
2865        }
2866        if (pdfViewer.hasEqualPageSizes) {
2867          return;
2868        }
2869        this.initialBookmark = initialBookmark;
2870        pdfViewer.currentScaleValue = pdfViewer.currentScaleValue;
2871        this.setInitialView(hash);
2872      }).catch(() => {
2873        this.setInitialView();
2874      }).then(function () {
2875        pdfViewer.update();
2876      });
2877    });
2878    pagesPromise.then(() => {
2879      this._unblockDocumentLoadEvent();
2880      this._initializeAutoPrint(pdfDocument, openActionPromise);
2881    }, reason => {
2882      this._documentError("pdfjs-loading-error", {
2883        message: reason.message
2884      });
2885    });
2886    onePageRendered.then(data => {
2887      this.externalServices.reportTelemetry({
2888        type: "pageInfo",
2889        timestamp: data.timestamp
2890      });
2891      if (this.pdfOutlineViewer) {
2892        pdfDocument.getOutline().then(outline => {
2893          if (pdfDocument !== this.pdfDocument) {
2894            return;
2895          }
2896          this.pdfOutlineViewer.render({
2897            outline,
2898            pdfDocument
2899          });
2900        });
2901      }
2902      if (this.pdfAttachmentViewer) {
2903        pdfDocument.getAttachments().then(attachments => {
2904          if (pdfDocument !== this.pdfDocument) {
2905            return;
2906          }
2907          this.pdfAttachmentViewer.render({
2908            attachments
2909          });
2910        });
2911      }
2912      if (this.pdfLayerViewer) {
2913        pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {
2914          if (pdfDocument !== this.pdfDocument) {
2915            return;
2916          }
2917          this.pdfLayerViewer.render({
2918            optionalContentConfig,
2919            pdfDocument
2920          });
2921        });
2922      }
2923    });
2924    this._initializePageLabels(pdfDocument);
2925    this._initializeMetadata(pdfDocument);
2926  },
2927  async _scriptingDocProperties(pdfDocument) {
2928    if (!this.documentInfo) {
2929      await new Promise(resolve => {
2930        this.eventBus._on("metadataloaded", resolve, {
2931          once: true
2932        });
2933      });
2934      if (pdfDocument !== this.pdfDocument) {
2935        return null;
2936      }
2937    }
2938    if (!this._contentLength) {
2939      await new Promise(resolve => {
2940        this.eventBus._on("documentloaded", resolve, {
2941          once: true
2942        });
2943      });
2944      if (pdfDocument !== this.pdfDocument) {
2945        return null;
2946      }
2947    }
2948    return {
2949      ...this.documentInfo,
2950      baseURL: this.baseUrl,
2951      filesize: this._contentLength,
2952      filename: this._docFilename,
2953      metadata: this.metadata?.getRaw(),
2954      authors: this.metadata?.get("dc:creator"),
2955      numPages: this.pagesCount,
2956      URL: this.url
2957    };
2958  },
2959  async _initializeAutoPrint(pdfDocument, openActionPromise) {
2960    const [openAction, jsActions] = await Promise.all([openActionPromise, this.pdfViewer.enableScripting ? null : pdfDocument.getJSActions()]);
2961    if (pdfDocument !== this.pdfDocument) {
2962      return;
2963    }
2964    let triggerAutoPrint = openAction?.action === "Print";
2965    if (jsActions) {
2966      console.warn("Warning: JavaScript support is not enabled");
2967      for (const name in jsActions) {
2968        if (triggerAutoPrint) {
2969          break;
2970        }
2971        switch (name) {
2972          case "WillClose":
2973          case "WillSave":
2974          case "DidSave":
2975          case "WillPrint":
2976          case "DidPrint":
2977            continue;
2978        }
2979        triggerAutoPrint = jsActions[name].some(js => _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.AutoPrintRegExp.test(js));
2980      }
2981    }
2982    if (triggerAutoPrint) {
2983      this.triggerPrinting();
2984    }
2985  },
2986  async _initializeMetadata(pdfDocument) {
2987    const {
2988      info,
2989      metadata,
2990      contentDispositionFilename,
2991      contentLength
2992    } = await pdfDocument.getMetadata();
2993    if (pdfDocument !== this.pdfDocument) {
2994      return;
2995    }
2996    this.documentInfo = info;
2997    this.metadata = metadata;
2998    this._contentDispositionFilename ??= contentDispositionFilename;
2999    this._contentLength ??= contentLength;
3000    console.log(`PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` + `${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` + `(PDF.js: ${pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.version || "?"} [${pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.build || "?"}])`);
3001    let pdfTitle = info.Title;
3002    const metadataTitle = metadata?.get("dc:title");
3003    if (metadataTitle) {
3004      if (metadataTitle !== "Untitled" && !/[\uFFF0-\uFFFF]/g.test(metadataTitle)) {
3005        pdfTitle = metadataTitle;
3006      }
3007    }
3008    if (pdfTitle) {
3009      this.setTitle(`${pdfTitle} - ${this._contentDispositionFilename || this._title}`);
3010    } else if (this._contentDispositionFilename) {
3011      this.setTitle(this._contentDispositionFilename);
3012    }
3013    if (info.IsXFAPresent && !info.IsAcroFormPresent && !pdfDocument.isPureXfa) {
3014      if (pdfDocument.loadingParams.enableXfa) {
3015        console.warn("Warning: XFA Foreground documents are not supported");
3016      } else {
3017        console.warn("Warning: XFA support is not enabled");
3018      }
3019    } else if ((info.IsAcroFormPresent || info.IsXFAPresent) && !this.pdfViewer.renderForms) {
3020      console.warn("Warning: Interactive form support is not enabled");
3021    }
3022    if (info.IsSignaturesPresent) {
3023      console.warn("Warning: Digital signatures validation is not supported");
3024    }
3025    this.eventBus.dispatch("metadataloaded", {
3026      source: this
3027    });
3028  },
3029  async _initializePageLabels(pdfDocument) {
3030    const labels = await pdfDocument.getPageLabels();
3031    if (pdfDocument !== this.pdfDocument) {
3032      return;
3033    }
3034    if (!labels || _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("disablePageLabels")) {
3035      return;
3036    }
3037    const numLabels = labels.length;
3038    let standardLabels = 0,
3039      emptyLabels = 0;
3040    for (let i = 0; i < numLabels; i++) {
3041      const label = labels[i];
3042      if (label === (i + 1).toString()) {
3043        standardLabels++;
3044      } else if (label === "") {
3045        emptyLabels++;
3046      } else {
3047        break;
3048      }
3049    }
3050    if (standardLabels >= numLabels || emptyLabels >= numLabels) {
3051      return;
3052    }
3053    const {
3054      pdfViewer,
3055      pdfThumbnailViewer,
3056      toolbar
3057    } = this;
3058    pdfViewer.setPageLabels(labels);
3059    pdfThumbnailViewer?.setPageLabels(labels);
3060    toolbar?.setPagesCount(numLabels, true);
3061    toolbar?.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);
3062  },
3063  _initializePdfHistory({
3064    fingerprint,
3065    viewOnLoad,
3066    initialDest = null
3067  }) {
3068    if (!this.pdfHistory) {
3069      return;
3070    }
3071    this.pdfHistory.initialize({
3072      fingerprint,
3073      resetHistory: viewOnLoad === ViewOnLoad.INITIAL,
3074      updateUrl: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("historyUpdateUrl")
3075    });
3076    if (this.pdfHistory.initialBookmark) {
3077      this.initialBookmark = this.pdfHistory.initialBookmark;
3078      this.initialRotation = this.pdfHistory.initialRotation;
3079    }
3080    if (initialDest && !this.initialBookmark && viewOnLoad === ViewOnLoad.UNKNOWN) {
3081      this.initialBookmark = JSON.stringify(initialDest);
3082      this.pdfHistory.push({
3083        explicitDest: initialDest,
3084        pageNumber: null
3085      });
3086    }
3087  },
3088  _initializeAnnotationStorageCallbacks(pdfDocument) {
3089    if (pdfDocument !== this.pdfDocument) {
3090      return;
3091    }
3092    const {
3093      annotationStorage
3094    } = pdfDocument;
3095    annotationStorage.onSetModified = () => {
3096      window.addEventListener("beforeunload", beforeUnload);
3097      this._annotationStorageModified = true;
3098    };
3099    annotationStorage.onResetModified = () => {
3100      window.removeEventListener("beforeunload", beforeUnload);
3101      delete this._annotationStorageModified;
3102    };
3103    annotationStorage.onAnnotationEditor = typeStr => {
3104      this._hasAnnotationEditors = !!typeStr;
3105      this.setTitle();
3106    };
3107  },
3108  setInitialView(storedHash, {
3109    rotation,
3110    sidebarView,
3111    scrollMode,
3112    spreadMode
3113  } = {}) {
3114    const setRotation = angle => {
3115      if ((0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.isValidRotation)(angle)) {
3116        this.pdfViewer.pagesRotation = angle;
3117      }
3118    };
3119    const setViewerModes = (scroll, spread) => {
3120      if ((0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.isValidScrollMode)(scroll)) {
3121        this.pdfViewer.scrollMode = scroll;
3122      }
3123      if ((0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.isValidSpreadMode)(spread)) {
3124        this.pdfViewer.spreadMode = spread;
3125      }
3126    };
3127    this.isInitialViewSet = true;
3128    this.pdfSidebar?.setInitialView(sidebarView);
3129    setViewerModes(scrollMode, spreadMode);
3130    if (this.initialBookmark) {
3131      setRotation(this.initialRotation);
3132      delete this.initialRotation;
3133      this.pdfLinkService.setHash(this.initialBookmark);
3134      this.initialBookmark = null;
3135    } else if (storedHash) {
3136      setRotation(rotation);
3137      this.pdfLinkService.setHash(storedHash);
3138    }
3139    this.toolbar?.setPageNumber(this.pdfViewer.currentPageNumber, this.pdfViewer.currentPageLabel);
3140    this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber);
3141    if (!this.pdfViewer.currentScaleValue) {
3142      this.pdfViewer.currentScaleValue = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_SCALE_VALUE;
3143    }
3144  },
3145  _cleanup() {
3146    if (!this.pdfDocument) {
3147      return;
3148    }
3149    this.pdfViewer.cleanup();
3150    this.pdfThumbnailViewer?.cleanup();
3151    this.pdfDocument.cleanup(_app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("fontExtraProperties"));
3152  },
3153  forceRendering() {
3154    this.pdfRenderingQueue.printing = !!this.printService;
3155    this.pdfRenderingQueue.isThumbnailViewEnabled = this.pdfSidebar?.visibleView === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS;
3156    this.pdfRenderingQueue.renderHighestPriority();
3157  },
3158  beforePrint() {
3159    this._printAnnotationStoragePromise = this.pdfScriptingManager.dispatchWillPrint().catch(() => {}).then(() => this.pdfDocument?.annotationStorage.print);
3160    if (this.printService) {
3161      return;
3162    }
3163    if (!this.supportsPrinting) {
3164      this._otherError("pdfjs-printing-not-supported");
3165      return;
3166    }
3167    if (!this.pdfViewer.pageViewsReady) {
3168      this.l10n.get("pdfjs-printing-not-ready").then(msg => {
3169        window.alert(msg);
3170      });
3171      return;
3172    }
3173    this.printService = web_print_service__WEBPACK_IMPORTED_MODULE_19__.PDFPrintServiceFactory.createPrintService({
3174      pdfDocument: this.pdfDocument,
3175      pagesOverview: this.pdfViewer.getPagesOverview(),
3176      printContainer: this.appConfig.printContainer,
3177      printResolution: _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("printResolution"),
3178      printAnnotationStoragePromise: this._printAnnotationStoragePromise
3179    });
3180    this.forceRendering();
3181    this.setTitle();
3182    this.printService.layout();
3183    if (this._hasAnnotationEditors) {
3184      this.externalServices.reportTelemetry({
3185        type: "editing",
3186        data: {
3187          type: "print",
3188          stats: this.pdfDocument?.annotationStorage.editorStats
3189        }
3190      });
3191    }
3192  },
3193  afterPrint() {
3194    if (this._printAnnotationStoragePromise) {
3195      this._printAnnotationStoragePromise.then(() => {
3196        this.pdfScriptingManager.dispatchDidPrint();
3197      });
3198      this._printAnnotationStoragePromise = null;
3199    }
3200    if (this.printService) {
3201      this.printService.destroy();
3202      this.printService = null;
3203      this.pdfDocument?.annotationStorage.resetModified();
3204    }
3205    this.forceRendering();
3206    this.setTitle();
3207  },
3208  rotatePages(delta) {
3209    this.pdfViewer.pagesRotation += delta;
3210  },
3211  requestPresentationMode() {
3212    this.pdfPresentationMode?.request();
3213  },
3214  triggerPrinting() {
3215    if (!this.supportsPrinting) {
3216      return;
3217    }
3218    window.print();
3219  },
3220  bindEvents() {
3221    const {
3222      eventBus,
3223      _boundEvents
3224    } = this;
3225    _boundEvents.beforePrint = this.beforePrint.bind(this);
3226    _boundEvents.afterPrint = this.afterPrint.bind(this);
3227    eventBus._on("resize", webViewerResize);
3228    eventBus._on("hashchange", webViewerHashchange);
3229    eventBus._on("beforeprint", _boundEvents.beforePrint);
3230    eventBus._on("afterprint", _boundEvents.afterPrint);
3231    eventBus._on("pagerender", webViewerPageRender);
3232    eventBus._on("pagerendered", webViewerPageRendered);
3233    eventBus._on("updateviewarea", webViewerUpdateViewarea);
3234    eventBus._on("pagechanging", webViewerPageChanging);
3235    eventBus._on("scalechanging", webViewerScaleChanging);
3236    eventBus._on("rotationchanging", webViewerRotationChanging);
3237    eventBus._on("sidebarviewchanged", webViewerSidebarViewChanged);
3238    eventBus._on("pagemode", webViewerPageMode);
3239    eventBus._on("namedaction", webViewerNamedAction);
3240    eventBus._on("presentationmodechanged", webViewerPresentationModeChanged);
3241    eventBus._on("presentationmode", webViewerPresentationMode);
3242    eventBus._on("switchannotationeditormode", webViewerSwitchAnnotationEditorMode);
3243    eventBus._on("switchannotationeditorparams", webViewerSwitchAnnotationEditorParams);
3244    eventBus._on("print", webViewerPrint);
3245    eventBus._on("download", webViewerDownload);
3246    eventBus._on("firstpage", webViewerFirstPage);
3247    eventBus._on("lastpage", webViewerLastPage);
3248    eventBus._on("nextpage", webViewerNextPage);
3249    eventBus._on("previouspage", webViewerPreviousPage);
3250    eventBus._on("zoomin", webViewerZoomIn);
3251    eventBus._on("zoomout", webViewerZoomOut);
3252    eventBus._on("zoomreset", webViewerZoomReset);
3253    eventBus._on("pagenumberchanged", webViewerPageNumberChanged);
3254    eventBus._on("scalechanged", webViewerScaleChanged);
3255    eventBus._on("rotatecw", webViewerRotateCw);
3256    eventBus._on("rotateccw", webViewerRotateCcw);
3257    eventBus._on("optionalcontentconfig", webViewerOptionalContentConfig);
3258    eventBus._on("switchscrollmode", webViewerSwitchScrollMode);
3259    eventBus._on("scrollmodechanged", webViewerScrollModeChanged);
3260    eventBus._on("switchspreadmode", webViewerSwitchSpreadMode);
3261    eventBus._on("spreadmodechanged", webViewerSpreadModeChanged);
3262    eventBus._on("documentproperties", webViewerDocumentProperties);
3263    eventBus._on("findfromurlhash", webViewerFindFromUrlHash);
3264    eventBus._on("updatefindmatchescount", webViewerUpdateFindMatchesCount);
3265    eventBus._on("updatefindcontrolstate", webViewerUpdateFindControlState);
3266    if (_app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("pdfBug")) {
3267      _boundEvents.reportPageStatsPDFBug = reportPageStatsPDFBug;
3268      eventBus._on("pagerendered", _boundEvents.reportPageStatsPDFBug);
3269      eventBus._on("pagechanging", _boundEvents.reportPageStatsPDFBug);
3270    }
3271    eventBus._on("fileinputchange", webViewerFileInputChange);
3272    eventBus._on("openfile", webViewerOpenFile);
3273  },
3274  bindWindowEvents() {
3275    const {
3276      eventBus,
3277      _boundEvents,
3278      appConfig: {
3279        mainContainer
3280      }
3281    } = this;
3282    function addWindowResolutionChange(evt = null) {
3283      if (evt) {
3284        webViewerResolutionChange(evt);
3285      }
3286      const mediaQueryList = window.matchMedia(`(resolution: ${window.devicePixelRatio || 1}dppx)`);
3287      mediaQueryList.addEventListener("change", addWindowResolutionChange, {
3288        once: true
3289      });
3290      _boundEvents.removeWindowResolutionChange ||= function () {
3291        mediaQueryList.removeEventListener("change", addWindowResolutionChange);
3292        _boundEvents.removeWindowResolutionChange = null;
3293      };
3294    }
3295    addWindowResolutionChange();
3296    _boundEvents.windowResize = () => {
3297      eventBus.dispatch("resize", {
3298        source: window
3299      });
3300    };
3301    _boundEvents.windowHashChange = () => {
3302      eventBus.dispatch("hashchange", {
3303        source: window,
3304        hash: document.location.hash.substring(1)
3305      });
3306    };
3307    _boundEvents.windowBeforePrint = () => {
3308      eventBus.dispatch("beforeprint", {
3309        source: window
3310      });
3311    };
3312    _boundEvents.windowAfterPrint = () => {
3313      eventBus.dispatch("afterprint", {
3314        source: window
3315      });
3316    };
3317    _boundEvents.windowUpdateFromSandbox = event => {
3318      eventBus.dispatch("updatefromsandbox", {
3319        source: window,
3320        detail: event.detail
3321      });
3322    };
3323    window.addEventListener("visibilitychange", webViewerVisibilityChange);
3324    window.addEventListener("wheel", webViewerWheel, {
3325      passive: false
3326    });
3327    window.addEventListener("touchstart", webViewerTouchStart, {
3328      passive: false
3329    });
3330    window.addEventListener("touchmove", webViewerTouchMove, {
3331      passive: false
3332    });
3333    window.addEventListener("touchend", webViewerTouchEnd, {
3334      passive: false
3335    });
3336    window.addEventListener("click", webViewerClick);
3337    window.addEventListener("keydown", webViewerKeyDown);
3338    window.addEventListener("keyup", webViewerKeyUp);
3339    window.addEventListener("resize", _boundEvents.windowResize);
3340    window.addEventListener("hashchange", _boundEvents.windowHashChange);
3341    window.addEventListener("beforeprint", _boundEvents.windowBeforePrint);
3342    window.addEventListener("afterprint", _boundEvents.windowAfterPrint);
3343    window.addEventListener("updatefromsandbox", _boundEvents.windowUpdateFromSandbox);
3344    if (!("onscrollend" in document.documentElement)) {
3345      return;
3346    }
3347    ({
3348      scrollTop: this._lastScrollTop,
3349      scrollLeft: this._lastScrollLeft
3350    } = mainContainer);
3351    const scrollend = _boundEvents.mainContainerScrollend = () => {
3352      ({
3353        scrollTop: this._lastScrollTop,
3354        scrollLeft: this._lastScrollLeft
3355      } = mainContainer);
3356      this._isScrolling = false;
3357      mainContainer.addEventListener("scroll", scroll, {
3358        passive: true
3359      });
3360      mainContainer.removeEventListener("scrollend", scrollend);
3361      mainContainer.removeEventListener("blur", scrollend);
3362    };
3363    const scroll = _boundEvents.mainContainerScroll = () => {
3364      if (this._isCtrlKeyDown || this._lastScrollTop === mainContainer.scrollTop && this._lastScrollLeft === mainContainer.scrollLeft) {
3365        return;
3366      }
3367      mainContainer.removeEventListener("scroll", scroll, {
3368        passive: true
3369      });
3370      this._isScrolling = true;
3371      mainContainer.addEventListener("scrollend", scrollend);
3372      mainContainer.addEventListener("blur", scrollend);
3373    };
3374    mainContainer.addEventListener("scroll", scroll, {
3375      passive: true
3376    });
3377  },
3378  unbindEvents() {
3379    const {
3380      eventBus,
3381      _boundEvents
3382    } = this;
3383    eventBus._off("resize", webViewerResize);
3384    eventBus._off("hashchange", webViewerHashchange);
3385    eventBus._off("beforeprint", _boundEvents.beforePrint);
3386    eventBus._off("afterprint", _boundEvents.afterPrint);
3387    eventBus._off("pagerender", webViewerPageRender);
3388    eventBus._off("pagerendered", webViewerPageRendered);
3389    eventBus._off("updateviewarea", webViewerUpdateViewarea);
3390    eventBus._off("pagechanging", webViewerPageChanging);
3391    eventBus._off("scalechanging", webViewerScaleChanging);
3392    eventBus._off("rotationchanging", webViewerRotationChanging);
3393    eventBus._off("sidebarviewchanged", webViewerSidebarViewChanged);
3394    eventBus._off("pagemode", webViewerPageMode);
3395    eventBus._off("namedaction", webViewerNamedAction);
3396    eventBus._off("presentationmodechanged", webViewerPresentationModeChanged);
3397    eventBus._off("presentationmode", webViewerPresentationMode);
3398    eventBus._off("print", webViewerPrint);
3399    eventBus._off("download", webViewerDownload);
3400    eventBus._off("firstpage", webViewerFirstPage);
3401    eventBus._off("lastpage", webViewerLastPage);
3402    eventBus._off("nextpage", webViewerNextPage);
3403    eventBus._off("previouspage", webViewerPreviousPage);
3404    eventBus._off("zoomin", webViewerZoomIn);
3405    eventBus._off("zoomout", webViewerZoomOut);
3406    eventBus._off("zoomreset", webViewerZoomReset);
3407    eventBus._off("pagenumberchanged", webViewerPageNumberChanged);
3408    eventBus._off("scalechanged", webViewerScaleChanged);
3409    eventBus._off("rotatecw", webViewerRotateCw);
3410    eventBus._off("rotateccw", webViewerRotateCcw);
3411    eventBus._off("optionalcontentconfig", webViewerOptionalContentConfig);
3412    eventBus._off("switchscrollmode", webViewerSwitchScrollMode);
3413    eventBus._off("scrollmodechanged", webViewerScrollModeChanged);
3414    eventBus._off("switchspreadmode", webViewerSwitchSpreadMode);
3415    eventBus._off("spreadmodechanged", webViewerSpreadModeChanged);
3416    eventBus._off("documentproperties", webViewerDocumentProperties);
3417    eventBus._off("findfromurlhash", webViewerFindFromUrlHash);
3418    eventBus._off("updatefindmatchescount", webViewerUpdateFindMatchesCount);
3419    eventBus._off("updatefindcontrolstate", webViewerUpdateFindControlState);
3420    if (_boundEvents.reportPageStatsPDFBug) {
3421      eventBus._off("pagerendered", _boundEvents.reportPageStatsPDFBug);
3422      eventBus._off("pagechanging", _boundEvents.reportPageStatsPDFBug);
3423      _boundEvents.reportPageStatsPDFBug = null;
3424    }
3425    eventBus._off("fileinputchange", webViewerFileInputChange);
3426    eventBus._off("openfile", webViewerOpenFile);
3427    _boundEvents.beforePrint = null;
3428    _boundEvents.afterPrint = null;
3429  },
3430  unbindWindowEvents() {
3431    const {
3432      _boundEvents,
3433      appConfig: {
3434        mainContainer
3435      }
3436    } = this;
3437    window.removeEventListener("visibilitychange", webViewerVisibilityChange);
3438    window.removeEventListener("wheel", webViewerWheel, {
3439      passive: false
3440    });
3441    window.removeEventListener("touchstart", webViewerTouchStart, {
3442      passive: false
3443    });
3444    window.removeEventListener("touchmove", webViewerTouchMove, {
3445      passive: false
3446    });
3447    window.removeEventListener("touchend", webViewerTouchEnd, {
3448      passive: false
3449    });
3450    window.removeEventListener("click", webViewerClick);
3451    window.removeEventListener("keydown", webViewerKeyDown);
3452    window.removeEventListener("keyup", webViewerKeyUp);
3453    window.removeEventListener("resize", _boundEvents.windowResize);
3454    window.removeEventListener("hashchange", _boundEvents.windowHashChange);
3455    window.removeEventListener("beforeprint", _boundEvents.windowBeforePrint);
3456    window.removeEventListener("afterprint", _boundEvents.windowAfterPrint);
3457    window.removeEventListener("updatefromsandbox", _boundEvents.windowUpdateFromSandbox);
3458    mainContainer.removeEventListener("scroll", _boundEvents.mainContainerScroll);
3459    mainContainer.removeEventListener("scrollend", _boundEvents.mainContainerScrollend);
3460    mainContainer.removeEventListener("blur", _boundEvents.mainContainerScrollend);
3461    _boundEvents.removeWindowResolutionChange?.();
3462    _boundEvents.windowResize = null;
3463    _boundEvents.windowHashChange = null;
3464    _boundEvents.windowBeforePrint = null;
3465    _boundEvents.windowAfterPrint = null;
3466    _boundEvents.windowUpdateFromSandbox = null;
3467    _boundEvents.mainContainerScroll = null;
3468    _boundEvents.mainContainerScrollend = null;
3469  },
3470  _accumulateTicks(ticks, prop) {
3471    if (this[prop] > 0 && ticks < 0 || this[prop] < 0 && ticks > 0) {
3472      this[prop] = 0;
3473    }
3474    this[prop] += ticks;
3475    const wholeTicks = Math.trunc(this[prop]);
3476    this[prop] -= wholeTicks;
3477    return wholeTicks;
3478  },
3479  _accumulateFactor(previousScale, factor, prop) {
3480    if (factor === 1) {
3481      return 1;
3482    }
3483    if (this[prop] > 1 && factor < 1 || this[prop] < 1 && factor > 1) {
3484      this[prop] = 1;
3485    }
3486    const newFactor = Math.floor(previousScale * factor * this[prop] * 100) / (100 * previousScale);
3487    this[prop] = factor / newFactor;
3488    return newFactor;
3489  },
3490  _centerAtPos(previousScale, x, y) {
3491    const {
3492      pdfViewer
3493    } = this;
3494    const scaleDiff = pdfViewer.currentScale / previousScale - 1;
3495    if (scaleDiff !== 0) {
3496      const [top, left] = pdfViewer.containerTopLeft;
3497      pdfViewer.container.scrollLeft += (x - left) * scaleDiff;
3498      pdfViewer.container.scrollTop += (y - top) * scaleDiff;
3499    }
3500  },
3501  _unblockDocumentLoadEvent() {
3502    document.blockUnblockOnload?.(false);
3503    this._unblockDocumentLoadEvent = () => {};
3504  },
3505  get scriptingReady() {
3506    return this.pdfScriptingManager.ready;
3507  }
3508};
3509(0,web_external_services__WEBPACK_IMPORTED_MODULE_4__.initCom)(PDFViewerApplication);
3510{
3511  web_print_service__WEBPACK_IMPORTED_MODULE_19__.PDFPrintServiceFactory.initGlobals(PDFViewerApplication);
3512}
3513{
3514  const HOSTED_VIEWER_ORIGINS = ["null", "http://mozilla.github.io", "https://mozilla.github.io"];
3515  var validateFileURL = function (file) {
3516    if (!file) {
3517      return;
3518    }
3519    try {
3520      const viewerOrigin = new URL(window.location.href).origin || "null";
3521      if (HOSTED_VIEWER_ORIGINS.includes(viewerOrigin)) {
3522        return;
3523      }
3524      const fileOrigin = new URL(file, window.location.href).origin;
3525      if (fileOrigin !== viewerOrigin) {
3526        throw new Error("file origin does not match viewer's");
3527      }
3528    } catch (ex) {
3529      PDFViewerApplication._documentError("pdfjs-loading-error", {
3530        message: ex.message
3531      });
3532      throw ex;
3533    }
3534  };
3535}
3536async function loadFakeWorker() {
3537  pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.GlobalWorkerOptions.workerSrc ||= _app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("workerSrc");
3538  await import( /*webpackIgnore: true*/pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.PDFWorker.workerSrc);
3539}
3540async function loadPDFBug(self) {
3541  const {
3542    PDFBug
3543  } = await import( /*webpackIgnore: true*/_app_options_js__WEBPACK_IMPORTED_MODULE_2__.AppOptions.get("debuggerSrc"));
3544  self._PDFBug = PDFBug;
3545}
3546function reportPageStatsPDFBug({
3547  pageNumber
3548}) {
3549  if (!globalThis.Stats?.enabled) {
3550    return;
3551  }
3552  const pageView = PDFViewerApplication.pdfViewer.getPageView(pageNumber - 1);
3553  globalThis.Stats.add(pageNumber, pageView?.pdfPage?.stats);
3554}
3555function webViewerPageRender({
3556  pageNumber
3557}) {
3558  if (pageNumber === PDFViewerApplication.page) {
3559    PDFViewerApplication.toolbar?.updateLoadingIndicatorState(true);
3560  }
3561}
3562function webViewerPageRendered({
3563  pageNumber,
3564  error
3565}) {
3566  if (pageNumber === PDFViewerApplication.page) {
3567    PDFViewerApplication.toolbar?.updateLoadingIndicatorState(false);
3568  }
3569  if (PDFViewerApplication.pdfSidebar?.visibleView === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS) {
3570    const pageView = PDFViewerApplication.pdfViewer.getPageView(pageNumber - 1);
3571    const thumbnailView = PDFViewerApplication.pdfThumbnailViewer?.getThumbnail(pageNumber - 1);
3572    if (pageView) {
3573      thumbnailView?.setImage(pageView);
3574    }
3575  }
3576  if (error) {
3577    PDFViewerApplication._otherError("pdfjs-rendering-error", error);
3578  }
3579}
3580function webViewerPageMode({
3581  mode
3582}) {
3583  let view;
3584  switch (mode) {
3585    case "thumbs":
3586      view = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS;
3587      break;
3588    case "bookmarks":
3589    case "outline":
3590      view = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.OUTLINE;
3591      break;
3592    case "attachments":
3593      view = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.ATTACHMENTS;
3594      break;
3595    case "layers":
3596      view = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.LAYERS;
3597      break;
3598    case "none":
3599      view = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.NONE;
3600      break;
3601    default:
3602      console.error('Invalid "pagemode" hash parameter: ' + mode);
3603      return;
3604  }
3605  PDFViewerApplication.pdfSidebar?.switchView(view, true);
3606}
3607function webViewerNamedAction(evt) {
3608  switch (evt.action) {
3609    case "GoToPage":
3610      PDFViewerApplication.appConfig.toolbar?.pageNumber.select();
3611      break;
3612    case "Find":
3613      if (!PDFViewerApplication.supportsIntegratedFind) {
3614        PDFViewerApplication.findBar?.toggle();
3615      }
3616      break;
3617    case "Print":
3618      PDFViewerApplication.triggerPrinting();
3619      break;
3620    case "SaveAs":
3621      PDFViewerApplication.downloadOrSave();
3622      break;
3623  }
3624}
3625function webViewerPresentationModeChanged(evt) {
3626  PDFViewerApplication.pdfViewer.presentationModeState = evt.state;
3627}
3628function webViewerSidebarViewChanged({
3629  view
3630}) {
3631  PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled = view === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS;
3632  if (PDFViewerApplication.isInitialViewSet) {
3633    PDFViewerApplication.store?.set("sidebarView", view).catch(() => {});
3634  }
3635}
3636function webViewerUpdateViewarea({
3637  location
3638}) {
3639  if (PDFViewerApplication.isInitialViewSet) {
3640    PDFViewerApplication.store?.setMultiple({
3641      page: location.pageNumber,
3642      zoom: location.scale,
3643      scrollLeft: location.left,
3644      scrollTop: location.top,
3645      rotation: location.rotation
3646    }).catch(() => {});
3647  }
3648  if (PDFViewerApplication.appConfig.secondaryToolbar) {
3649    const href = PDFViewerApplication.pdfLinkService.getAnchorUrl(location.pdfOpenParams);
3650    PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href = href;
3651  }
3652}
3653function webViewerScrollModeChanged(evt) {
3654  if (PDFViewerApplication.isInitialViewSet && !PDFViewerApplication.pdfViewer.isInPresentationMode) {
3655    PDFViewerApplication.store?.set("scrollMode", evt.mode).catch(() => {});
3656  }
3657}
3658function webViewerSpreadModeChanged(evt) {
3659  if (PDFViewerApplication.isInitialViewSet && !PDFViewerApplication.pdfViewer.isInPresentationMode) {
3660    PDFViewerApplication.store?.set("spreadMode", evt.mode).catch(() => {});
3661  }
3662}
3663function webViewerResize() {
3664  const {
3665    pdfDocument,
3666    pdfViewer,
3667    pdfRenderingQueue
3668  } = PDFViewerApplication;
3669  if (pdfRenderingQueue.printing && window.matchMedia("print").matches) {
3670    return;
3671  }
3672  if (!pdfDocument) {
3673    return;
3674  }
3675  const currentScaleValue = pdfViewer.currentScaleValue;
3676  if (currentScaleValue === "auto" || currentScaleValue === "page-fit" || currentScaleValue === "page-width") {
3677    pdfViewer.currentScaleValue = currentScaleValue;
3678  }
3679  pdfViewer.update();
3680}
3681function webViewerHashchange(evt) {
3682  const hash = evt.hash;
3683  if (!hash) {
3684    return;
3685  }
3686  if (!PDFViewerApplication.isInitialViewSet) {
3687    PDFViewerApplication.initialBookmark = hash;
3688  } else if (!PDFViewerApplication.pdfHistory?.popStateInProgress) {
3689    PDFViewerApplication.pdfLinkService.setHash(hash);
3690  }
3691}
3692{
3693  var webViewerFileInputChange = function (evt) {
3694    if (PDFViewerApplication.pdfViewer?.isInPresentationMode) {
3695      return;
3696    }
3697    const file = evt.fileInput.files[0];
3698    PDFViewerApplication.open({
3699      url: URL.createObjectURL(file),
3700      originalUrl: file.name
3701    });
3702  };
3703  var webViewerOpenFile = function (evt) {
3704    PDFViewerApplication._openFileInput?.click();
3705  };
3706}
3707function webViewerPresentationMode() {
3708  PDFViewerApplication.requestPresentationMode();
3709}
3710function webViewerSwitchAnnotationEditorMode(evt) {
3711  PDFViewerApplication.pdfViewer.annotationEditorMode = evt;
3712}
3713function webViewerSwitchAnnotationEditorParams(evt) {
3714  PDFViewerApplication.pdfViewer.annotationEditorParams = evt;
3715}
3716function webViewerPrint() {
3717  PDFViewerApplication.triggerPrinting();
3718}
3719function webViewerDownload() {
3720  PDFViewerApplication.downloadOrSave();
3721}
3722function webViewerFirstPage() {
3723  PDFViewerApplication.page = 1;
3724}
3725function webViewerLastPage() {
3726  PDFViewerApplication.page = PDFViewerApplication.pagesCount;
3727}
3728function webViewerNextPage() {
3729  PDFViewerApplication.pdfViewer.nextPage();
3730}
3731function webViewerPreviousPage() {
3732  PDFViewerApplication.pdfViewer.previousPage();
3733}
3734function webViewerZoomIn() {
3735  PDFViewerApplication.zoomIn();
3736}
3737function webViewerZoomOut() {
3738  PDFViewerApplication.zoomOut();
3739}
3740function webViewerZoomReset() {
3741  PDFViewerApplication.zoomReset();
3742}
3743function webViewerPageNumberChanged(evt) {
3744  const pdfViewer = PDFViewerApplication.pdfViewer;
3745  if (evt.value !== "") {
3746    PDFViewerApplication.pdfLinkService.goToPage(evt.value);
3747  }
3748  if (evt.value !== pdfViewer.currentPageNumber.toString() && evt.value !== pdfViewer.currentPageLabel) {
3749    PDFViewerApplication.toolbar?.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);
3750  }
3751}
3752function webViewerScaleChanged(evt) {
3753  PDFViewerApplication.pdfViewer.currentScaleValue = evt.value;
3754}
3755function webViewerRotateCw() {
3756  PDFViewerApplication.rotatePages(90);
3757}
3758function webViewerRotateCcw() {
3759  PDFViewerApplication.rotatePages(-90);
3760}
3761function webViewerOptionalContentConfig(evt) {
3762  PDFViewerApplication.pdfViewer.optionalContentConfigPromise = evt.promise;
3763}
3764function webViewerSwitchScrollMode(evt) {
3765  PDFViewerApplication.pdfViewer.scrollMode = evt.mode;
3766}
3767function webViewerSwitchSpreadMode(evt) {
3768  PDFViewerApplication.pdfViewer.spreadMode = evt.mode;
3769}
3770function webViewerDocumentProperties() {
3771  PDFViewerApplication.pdfDocumentProperties?.open();
3772}
3773function webViewerFindFromUrlHash(evt) {
3774  PDFViewerApplication.eventBus.dispatch("find", {
3775    source: evt.source,
3776    type: "",
3777    query: evt.query,
3778    caseSensitive: false,
3779    entireWord: false,
3780    highlightAll: true,
3781    findPrevious: false,
3782    matchDiacritics: true
3783  });
3784}
3785function webViewerUpdateFindMatchesCount({
3786  matchesCount
3787}) {
3788  if (PDFViewerApplication.supportsIntegratedFind) {
3789    PDFViewerApplication.externalServices.updateFindMatchesCount(matchesCount);
3790  } else {
3791    PDFViewerApplication.findBar?.updateResultsCount(matchesCount);
3792  }
3793}
3794function webViewerUpdateFindControlState({
3795  state,
3796  previous,
3797  matchesCount,
3798  rawQuery
3799}) {
3800  if (PDFViewerApplication.supportsIntegratedFind) {
3801    PDFViewerApplication.externalServices.updateFindControlState({
3802      result: state,
3803      findPrevious: previous,
3804      matchesCount,
3805      rawQuery
3806    });
3807  } else {
3808    PDFViewerApplication.findBar?.updateUIState(state, previous, matchesCount);
3809  }
3810}
3811function webViewerScaleChanging(evt) {
3812  PDFViewerApplication.toolbar?.setPageScale(evt.presetValue, evt.scale);
3813  PDFViewerApplication.pdfViewer.update();
3814}
3815function webViewerRotationChanging(evt) {
3816  if (PDFViewerApplication.pdfThumbnailViewer) {
3817    PDFViewerApplication.pdfThumbnailViewer.pagesRotation = evt.pagesRotation;
3818  }
3819  PDFViewerApplication.forceRendering();
3820  PDFViewerApplication.pdfViewer.currentPageNumber = evt.pageNumber;
3821}
3822function webViewerPageChanging({
3823  pageNumber,
3824  pageLabel
3825}) {
3826  PDFViewerApplication.toolbar?.setPageNumber(pageNumber, pageLabel);
3827  PDFViewerApplication.secondaryToolbar?.setPageNumber(pageNumber);
3828  if (PDFViewerApplication.pdfSidebar?.visibleView === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS) {
3829    PDFViewerApplication.pdfThumbnailViewer?.scrollThumbnailIntoView(pageNumber);
3830  }
3831  const currentPage = PDFViewerApplication.pdfViewer.getPageView(pageNumber - 1);
3832  PDFViewerApplication.toolbar?.updateLoadingIndicatorState(currentPage?.renderingState === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.RUNNING);
3833}
3834function webViewerResolutionChange(evt) {
3835  PDFViewerApplication.pdfViewer.refresh();
3836}
3837function webViewerVisibilityChange(evt) {
3838  if (document.visibilityState === "visible") {
3839    setZoomDisabledTimeout();
3840  }
3841}
3842let zoomDisabledTimeout = null;
3843function setZoomDisabledTimeout() {
3844  if (zoomDisabledTimeout) {
3845    clearTimeout(zoomDisabledTimeout);
3846  }
3847  zoomDisabledTimeout = setTimeout(function () {
3848    zoomDisabledTimeout = null;
3849  }, WHEEL_ZOOM_DISABLED_TIMEOUT);
3850}
3851function webViewerWheel(evt) {
3852  const {
3853    pdfViewer,
3854    supportsMouseWheelZoomCtrlKey,
3855    supportsMouseWheelZoomMetaKey,
3856    supportsPinchToZoom
3857  } = PDFViewerApplication;
3858  if (pdfViewer.isInPresentationMode) {
3859    return;
3860  }
3861  const deltaMode = evt.deltaMode;
3862  let scaleFactor = Math.exp(-evt.deltaY / 100);
3863  const isBuiltInMac = false;
3864  const isPinchToZoom = evt.ctrlKey && !PDFViewerApplication._isCtrlKeyDown && deltaMode === WheelEvent.DOM_DELTA_PIXEL && evt.deltaX === 0 && (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) && evt.deltaZ === 0;
3865  if (isPinchToZoom || evt.ctrlKey && supportsMouseWheelZoomCtrlKey || evt.metaKey && supportsMouseWheelZoomMetaKey) {
3866    evt.preventDefault();
3867    if (PDFViewerApplication._isScrolling || zoomDisabledTimeout || document.visibilityState === "hidden" || PDFViewerApplication.overlayManager.active) {
3868      return;
3869    }
3870    const previousScale = pdfViewer.currentScale;
3871    if (isPinchToZoom && supportsPinchToZoom) {
3872      scaleFactor = PDFViewerApplication._accumulateFactor(previousScale, scaleFactor, "_wheelUnusedFactor");
3873      if (scaleFactor < 1) {
3874        PDFViewerApplication.zoomOut(null, scaleFactor);
3875      } else if (scaleFactor > 1) {
3876        PDFViewerApplication.zoomIn(null, scaleFactor);
3877      } else {
3878        return;
3879      }
3880    } else {
3881      const delta = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.normalizeWheelEventDirection)(evt);
3882      let ticks = 0;
3883      if (deltaMode === WheelEvent.DOM_DELTA_LINE || deltaMode === WheelEvent.DOM_DELTA_PAGE) {
3884        if (Math.abs(delta) >= 1) {
3885          ticks = Math.sign(delta);
3886        } else {
3887          ticks = PDFViewerApplication._accumulateTicks(delta, "_wheelUnusedTicks");
3888        }
3889      } else {
3890        const PIXELS_PER_LINE_SCALE = 30;
3891        ticks = PDFViewerApplication._accumulateTicks(delta / PIXELS_PER_LINE_SCALE, "_wheelUnusedTicks");
3892      }
3893      if (ticks < 0) {
3894        PDFViewerApplication.zoomOut(-ticks);
3895      } else if (ticks > 0) {
3896        PDFViewerApplication.zoomIn(ticks);
3897      } else {
3898        return;
3899      }
3900    }
3901    PDFViewerApplication._centerAtPos(previousScale, evt.clientX, evt.clientY);
3902  }
3903}
3904function webViewerTouchStart(evt) {
3905  if (PDFViewerApplication.pdfViewer.isInPresentationMode || evt.touches.length < 2) {
3906    return;
3907  }
3908  evt.preventDefault();
3909  if (evt.touches.length !== 2 || PDFViewerApplication.overlayManager.active) {
3910    PDFViewerApplication._touchInfo = null;
3911    return;
3912  }
3913  let [touch0, touch1] = evt.touches;
3914  if (touch0.identifier > touch1.identifier) {
3915    [touch0, touch1] = [touch1, touch0];
3916  }
3917  PDFViewerApplication._touchInfo = {
3918    touch0X: touch0.pageX,
3919    touch0Y: touch0.pageY,
3920    touch1X: touch1.pageX,
3921    touch1Y: touch1.pageY
3922  };
3923}
3924function webViewerTouchMove(evt) {
3925  if (!PDFViewerApplication._touchInfo || evt.touches.length !== 2) {
3926    return;
3927  }
3928  const {
3929    pdfViewer,
3930    _touchInfo,
3931    supportsPinchToZoom
3932  } = PDFViewerApplication;
3933  let [touch0, touch1] = evt.touches;
3934  if (touch0.identifier > touch1.identifier) {
3935    [touch0, touch1] = [touch1, touch0];
3936  }
3937  const {
3938    pageX: page0X,
3939    pageY: page0Y
3940  } = touch0;
3941  const {
3942    pageX: page1X,
3943    pageY: page1Y
3944  } = touch1;
3945  const {
3946    touch0X: pTouch0X,
3947    touch0Y: pTouch0Y,
3948    touch1X: pTouch1X,
3949    touch1Y: pTouch1Y
3950  }
3950 = _touchInfo;
3951  if (Math.abs(pTouch0X - page0X) <= 1 && Math.abs(pTouch0Y - page0Y) <= 1 && Math.abs(pTouch1X - page1X) <= 1 && Math.abs(pTouch1Y - page1Y) <= 1) {
3952    return;
3953  }
3954  _touchInfo.touch0X = page0X;
3955  _touchInfo.touch0Y = page0Y;
3956  _touchInfo.touch1X = page1X;
3957  _touchInfo.touch1Y = page1Y;
3958  if (pTouch0X === page0X && pTouch0Y === page0Y) {
3959    const v1X = pTouch1X - page0X;
3960    const v1Y = pTouch1Y - page0Y;
3961    const v2X = page1X - page0X;
3962    const v2Y = page1Y - page0Y;
3963    const det = v1X * v2Y - v1Y * v2X;
3964    if (Math.abs(det) > 0.02 * Math.hypot(v1X, v1Y) * Math.hypot(v2X, v2Y)) {
3965      return;
3966    }
3967  } else if (pTouch1X === page1X && pTouch1Y === page1Y) {
3968    const v1X = pTouch0X - page1X;
3969    const v1Y = pTouch0Y - page1Y;
3970    const v2X = page0X - page1X;
3971    const v2Y = page0Y - page1Y;
3972    const det = v1X * v2Y - v1Y * v2X;
3973    if (Math.abs(det) > 0.02 * Math.hypot(v1X, v1Y) * Math.hypot(v2X, v2Y)) {
3974      return;
3975    }
3976  } else {
3977    const diff0X = page0X - pTouch0X;
3978    const diff1X = page1X - pTouch1X;
3979    const diff0Y = page0Y - pTouch0Y;
3980    const diff1Y = page1Y - pTouch1Y;
3981    const dotProduct = diff0X * diff1X + diff0Y * diff1Y;
3982    if (dotProduct >= 0) {
3983      return;
3984    }
3985  }
3986  evt.preventDefault();
3987  const distance = Math.hypot(page0X - page1X, page0Y - page1Y) || 1;
3988  const pDistance = Math.hypot(pTouch0X - pTouch1X, pTouch0Y - pTouch1Y) || 1;
3989  const previousScale = pdfViewer.currentScale;
3990  if (supportsPinchToZoom) {
3991    const newScaleFactor = PDFViewerApplication._accumulateFactor(previousScale, distance / pDistance, "_touchUnusedFactor");
3992    if (newScaleFactor < 1) {
3993      PDFViewerApplication.zoomOut(null, newScaleFactor);
3994    } else if (newScaleFactor > 1) {
3995      PDFViewerApplication.zoomIn(null, newScaleFactor);
3996    } else {
3997      return;
3998    }
3999  } else {
4000    const PIXELS_PER_LINE_SCALE = 30;
4001    const ticks = PDFViewerApplication._accumulateTicks((distance - pDistance) / PIXELS_PER_LINE_SCALE, "_touchUnusedTicks");
4002    if (ticks < 0) {
4003      PDFViewerApplication.zoomOut(-ticks);
4004    } else if (ticks > 0) {
4005      PDFViewerApplication.zoomIn(ticks);
4006    } else {
4007      return;
4008    }
4009  }
4010  PDFViewerApplication._centerAtPos(previousScale, (page0X + page1X) / 2, (page0Y + page1Y) / 2);
4011}
4012function webViewerTouchEnd(evt) {
4013  if (!PDFViewerApplication._touchInfo) {
4014    return;
4015  }
4016  evt.preventDefault();
4017  PDFViewerApplication._touchInfo = null;
4018  PDFViewerApplication._touchUnusedTicks = 0;
4019  PDFViewerApplication._touchUnusedFactor = 1;
4020}
4021function webViewerClick(evt) {
4022  if (!PDFViewerApplication.secondaryToolbar?.isOpen) {
4023    return;
4024  }
4025  const appConfig = PDFViewerApplication.appConfig;
4026  if (PDFViewerApplication.pdfViewer.containsElement(evt.target) || appConfig.toolbar?.container.contains(evt.target) && evt.target !== appConfig.secondaryToolbar?.toggleButton) {
4027    PDFViewerApplication.secondaryToolbar.close();
4028  }
4029}
4030function webViewerKeyUp(evt) {
4031  if (evt.key === "Control") {
4032    PDFViewerApplication._isCtrlKeyDown = false;
4033  }
4034}
4035function webViewerKeyDown(evt) {
4036  PDFViewerApplication._isCtrlKeyDown = evt.key === "Control";
4037  if (PDFViewerApplication.overlayManager.active) {
4038    return;
4039  }
4040  const {
4041    eventBus,
4042    pdfViewer
4043  } = PDFViewerApplication;
4044  const isViewerInPresentationMode = pdfViewer.isInPresentationMode;
4045  let handled = false,
4046    ensureViewerFocused = false;
4047  const cmd = (evt.ctrlKey ? 1 : 0) | (evt.altKey ? 2 : 0) | (evt.shiftKey ? 4 : 0) | (evt.metaKey ? 8 : 0);
4048  if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {
4049    switch (evt.keyCode) {
4050      case 70:
4051        if (!PDFViewerApplication.supportsIntegratedFind && !evt.shiftKey) {
4052          PDFViewerApplication.findBar?.open();
4053          handled = true;
4054        }
4055        break;
4056      case 71:
4057        if (!PDFViewerApplication.supportsIntegratedFind) {
4058          const {
4059            state
4060          } = PDFViewerApplication.findController;
4061          if (state) {
4062            const newState = {
4063              source: window,
4064              type: "again",
4065              findPrevious: cmd === 5 || cmd === 12
4066            };
4067            eventBus.dispatch("find", {
4068              ...state,
4069              ...newState
4070            });
4071          }
4072          handled = true;
4073        }
4074        break;
4075      case 61:
4076      case 107:
4077      case 187:
4078      case 171:
4079        PDFViewerApplication.zoomIn();
4080        handled = true;
4081        break;
4082      case 173:
4083      case 109:
4084      case 189:
4085        PDFViewerApplication.zoomOut();
4086        handled = true;
4087        break;
4088      case 48:
4089      case 96:
4090        if (!isViewerInPresentationMode) {
4091          setTimeout(function () {
4092            PDFViewerApplication.zoomReset();
4093          });
4094          handled = false;
4095        }
4096        break;
4097      case 38:
4098        if (isViewerInPresentationMode || PDFViewerApplication.page > 1) {
4099          PDFViewerApplication.page = 1;
4100          handled = true;
4101          ensureViewerFocused = true;
4102        }
4103        break;
4104      case 40:
4105        if (isViewerInPresentationMode || PDFViewerApplication.page < PDFViewerApplication.pagesCount) {
4106          PDFViewerApplication.page = PDFViewerApplication.pagesCount;
4107          handled = true;
4108          ensureViewerFocused = true;
4109        }
4110        break;
4111    }
4112  }
4113  if (cmd === 1 || cmd === 8) {
4114    switch (evt.keyCode) {
4115      case 83:
4116        eventBus.dispatch("download", {
4117          source: window
4118        });
4119        handled = true;
4120        break;
4121      case 79:
4122        {
4123          eventBus.dispatch("openfile", {
4124            source: window
4125          });
4126          handled = true;
4127        }
4128        break;
4129    }
4130  }
4131  if (cmd === 3 || cmd === 10) {
4132    switch (evt.keyCode) {
4133      case 80:
4134        PDFViewerApplication.requestPresentationMode();
4135        handled = true;
4136        PDFViewerApplication.externalServices.reportTelemetry({
4137          type: "buttons",
4138          data: {
4139            id: "presentationModeKeyboard"
4140          }
4141        });
4142        break;
4143      case 71:
4144        if (PDFViewerApplication.appConfig.toolbar) {
4145          PDFViewerApplication.appConfig.toolbar.pageNumber.select();
4146          handled = true;
4147        }
4148        break;
4149    }
4150  }
4151  if (handled) {
4152    if (ensureViewerFocused && !isViewerInPresentationMode) {
4153      pdfViewer.focus();
4154    }
4155    evt.preventDefault();
4156    return;
4157  }
4158  const curElement = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.getActiveOrFocusedElement)();
4159  const curElementTagName = curElement?.tagName.toUpperCase();
4160  if (curElementTagName === "INPUT" || curElementTagName === "TEXTAREA" || curElementTagName === "SELECT" || curElementTagName === "BUTTON" && (evt.keyCode === 13 || evt.keyCode === 32) || curElement?.isContentEditable) {
4161    if (evt.keyCode !== 27) {
4162      return;
4163    }
4164  }
4165  if (cmd === 0) {
4166    let turnPage = 0,
4167      turnOnlyIfPageFit = false;
4168    switch (evt.keyCode) {
4169      case 38:
4170        if (PDFViewerApplication.supportsCaretBrowsingMode) {
4171          PDFViewerApplication.moveCaret(true, false);
4172          handled = true;
4173          break;
4174        }
4175      case 33:
4176        if (pdfViewer.isVerticalScrollbarEnabled) {
4177          turnOnlyIfPageFit = true;
4178        }
4179        turnPage = -1;
4180        break;
4181      case 8:
4182        if (!isViewerInPresentationMode) {
4183          turnOnlyIfPageFit = true;
4184        }
4185        turnPage = -1;
4186        break;
4187      case 37:
4188        if (PDFViewerApplication.supportsCaretBrowsingMode) {
4189          return;
4190        }
4191        if (pdfViewer.isHorizontalScrollbarEnabled) {
4192          turnOnlyIfPageFit = true;
4193        }
4194      case 75:
4195      case 80:
4196        turnPage = -1;
4197        break;
4198      case 27:
4199        if (PDFViewerApplication.secondaryToolbar?.isOpen) {
4200          PDFViewerApplication.secondaryToolbar.close();
4201          handled = true;
4202        }
4203        if (!PDFViewerApplication.supportsIntegratedFind && PDFViewerApplication.findBar?.opened) {
4204          PDFViewerApplication.findBar.close();
4205          handled = true;
4206        }
4207        break;
4208      case 40:
4209        if (PDFViewerApplication.supportsCaretBrowsingMode) {
4210          PDFViewerApplication.moveCaret(false, false);
4211          handled = true;
4212          break;
4213        }
4214      case 34:
4215        if (pdfViewer.isVerticalScrollbarEnabled) {
4216          turnOnlyIfPageFit = true;
4217        }
4218        turnPage = 1;
4219        break;
4220      case 13:
4221      case 32:
4222        if (!isViewerInPresentationMode) {
4223          turnOnlyIfPageFit = true;
4224        }
4225        turnPage = 1;
4226        break;
4227      case 39:
4228        if (PDFViewerApplication.supportsCaretBrowsingMode) {
4229          return;
4230        }
4231        if (pdfViewer.isHorizontalScrollbarEnabled) {
4232          turnOnlyIfPageFit = true;
4233        }
4234      case 74:
4235      case 78:
4236        turnPage = 1;
4237        break;
4238      case 36:
4239        if (isViewerInPresentationMode || PDFViewerApplication.page > 1) {
4240          PDFViewerApplication.page = 1;
4241          handled = true;
4242          ensureViewerFocused = true;
4243        }
4244        break;
4245      case 35:
4246        if (isViewerInPresentationMode || PDFViewerApplication.page < PDFViewerApplication.pagesCount) {
4247          PDFViewerApplication.page = PDFViewerApplication.pagesCount;
4248          handled = true;
4249          ensureViewerFocused = true;
4250        }
4251        break;
4252      case 83:
4253        PDFViewerApplication.pdfCursorTools?.switchTool(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.CursorTool.SELECT);
4254        break;
4255      case 72:
4256        PDFViewerApplication.pdfCursorTools?.switchTool(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.CursorTool.HAND);
4257        break;
4258      case 82:
4259        PDFViewerApplication.rotatePages(90);
4260        break;
4261      case 115:
4262        PDFViewerApplication.pdfSidebar?.toggle();
4263        break;
4264    }
4265    if (turnPage !== 0 && (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === "page-fit")) {
4266      if (turnPage > 0) {
4267        pdfViewer.nextPage();
4268      } else {
4269        pdfViewer.previousPage();
4270      }
4271      handled = true;
4272    }
4273  }
4274  if (cmd === 4) {
4275    switch (evt.keyCode) {
4276      case 13:
4277      case 32:
4278        if (!isViewerInPresentationMode && pdfViewer.currentScaleValue !== "page-fit") {
4279          break;
4280        }
4281        pdfViewer.previousPage();
4282        handled = true;
4283        break;
4284      case 38:
4285        PDFViewerApplication.moveCaret(true, true);
4286        handled = true;
4287        break;
4288      case 40:
4289        PDFViewerApplication.moveCaret(false, true);
4290        handled = true;
4291        break;
4292      case 82:
4293        PDFViewerApplication.rotatePages(-90);
4294        break;
4295    }
4296  }
4297  if (!handled && !isViewerInPresentationMode) {
4298    if (evt.keyCode >= 33 && evt.keyCode <= 40 || evt.keyCode === 32 && curElementTagName !== "BUTTON") {
4299      ensureViewerFocused = true;
4300    }
4301  }
4302  if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) {
4303    pdfViewer.focus();
4304  }
4305  if (handled) {
4306    evt.preventDefault();
4307  }
4308}
4309function beforeUnload(evt) {
4310  evt.preventDefault();
4311  evt.returnValue = "";
4312  return false;
4313}
4314function webViewerAnnotationEditorStatesChanged(data) {
4315  PDFViewerApplication.externalServices.updateEditorStates(data);
4316}
4317function webViewerReportTelemetry({
4318  details
4319}) {
4320  PDFViewerApplication.externalServices.reportTelemetry(details);
4321}
4322
4323__webpack_async_result__();
4324} catch(e) { __webpack_async_result__(e); } });
4325
4326/***/ }),
4327
4328/***/ 9840:
4329/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
4330
4331/* harmony export */ __webpack_require__.d(__webpack_exports__, {
4332/* harmony export */   AppOptions: () => (/* binding */ AppOptions),
4333/* harmony export */   OptionKind: () => (/* binding */ OptionKind)
4334/* harmony export */ });
4335{
4336  var compatibilityParams = Object.create(null);
4337  const userAgent = navigator.userAgent || "";
4338  const platform = navigator.platform || "";
4339  const maxTouchPoints = navigator.maxTouchPoints || 1;
4340  const isAndroid = /Android/.test(userAgent);
4341  const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
4342  (function checkCanvasSizeLimitation() {
4343    if (isIOS || isAndroid) {
4344      compatibilityParams.maxCanvasPixels = 5242880;
4345    }
4346  })();
4347}
4348const OptionKind = {
4349  BROWSER: 0x01,
4350  VIEWER: 0x02,
4351  API: 0x04,
4352  WORKER: 0x08,
4353  PREFERENCE: 0x80
4354};
4355const defaultOptions = {
4356  canvasMaxAreaInBytes: {
4357    value: -1,
4358    kind: OptionKind.BROWSER + OptionKind.API
4359  },
4360  isInAutomation: {
4361    value: false,
4362    kind: OptionKind.BROWSER
4363  },
4364  supportsCaretBrowsingMode: {
4365    value: false,
4366    kind: OptionKind.BROWSER
4367  },
4368  supportsDocumentFonts: {
4369    value: true,
4370    kind: OptionKind.BROWSER
4371  },
4372  supportsIntegratedFind: {
4373    value: false,
4374    kind: OptionKind.BROWSER
4375  },
4376  supportsMouseWheelZoomCtrlKey: {
4377    value: true,
4378    kind: OptionKind.BROWSER
4379  },
4380  supportsMouseWheelZoomMetaKey: {
4381    value: true,
4382    kind: OptionKind.BROWSER
4383  },
4384  supportsPinchToZoom: {
4385    value: true,
4386    kind: OptionKind.BROWSER
4387  },
4388  annotationEditorMode: {
4389    value: 0,
4390    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4391  },
4392  annotationMode: {
4393    value: 2,
4394    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4395  },
4396  cursorToolOnLoad: {
4397    value: 0,
4398    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4399  },
4400  debuggerSrc: {
4401    value: "./debugger.mjs",
4402    kind: OptionKind.VIEWER
4403  },
4404  defaultZoomDelay: {
4405    value: 400,
4406    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4407  },
4408  defaultZoomValue: {
4409    value: "",
4410    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4411  },
4412  disableHistory: {
4413    value: false,
4414    kind: OptionKind.VIEWER
4415  },
4416  disablePageLabels: {
4417    value: false,
4418    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4419  },
4420  enableHighlightEditor: {
4421    value: false,
4422    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4423  },
4424  enableHighlightFloatingButton: {
4425    value: false,
4426    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4427  },
4428  enableML: {
4429    value: false,
4430    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4431  },
4432  enablePermissions: {
4433    value: false,
4434    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4435  },
4436  enablePrintAutoRotate: {
4437    value: true,
4438    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4439  },
4440  enableScripting: {
4441    value: true,
4442    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4443  },
4444  enableStampEditor: {
4445    value: true,
4446    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4447  },
4448  externalLinkRel: {
4449    value: "noopener noreferrer nofollow",
4450    kind: OptionKind.VIEWER
4451  },
4452  externalLinkTarget: {
4453    value: 0,
4454    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4455  },
4456  highlightEditorColors: {
4457    value: "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",
4458    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4459  },
4460  historyUpdateUrl: {
4461    value: false,
4462    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4463  },
4464  ignoreDestinationZoom: {
4465    value: false,
4466    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4467  },
4468  imageResourcesPath: {
4469    value: "./images/",
4470    kind: OptionKind.VIEWER
4471  },
4472  maxCanvasPixels: {
4473    value: 2 ** 25,
4474    kind: OptionKind.VIEWER
4475  },
4476  forcePageColors: {
4477    value: false,
4478    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4479  },
4480  pageColorsBackground: {
4481    value: "Canvas",
4482    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4483  },
4484  pageColorsForeground: {
4485    value: "CanvasText",
4486    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4487  },
4488  pdfBugEnabled: {
4489    value: false,
4490    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4491  },
4492  printResolution: {
4493    value: 150,
4494    kind: OptionKind.VIEWER
4495  },
4496  sidebarViewOnLoad: {
4497    value: -1,
4498    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4499  },
4500  scrollModeOnLoad: {
4501    value: -1,
4502    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4503  },
4504  spreadModeOnLoad: {
4505    value: -1,
4506    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4507  },
4508  textLayerMode: {
4509    value: 1,
4510    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4511  },
4512  viewOnLoad: {
4513    value: 0,
4514    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4515  },
4516  cMapPacked: {
4517    value: true,
4518    kind: OptionKind.API
4519  },
4520  cMapUrl: {
4521    value: "../web/cmaps/",
4522    kind: OptionKind.API
4523  },
4524  disableAutoFetch: {
4525    value: false,
4526    kind: OptionKind.API + OptionKind.PREFERENCE
4527  },
4528  disableFontFace: {
4529    value: false,
4530    kind: OptionKind.API + OptionKind.PREFERENCE
4531  },
4532  disableRange: {
4533    value: false,
4534    kind: OptionKind.API + OptionKind.PREFERENCE
4535  },
4536  disableStream: {
4537    value: false,
4538    kind: OptionKind.API + OptionKind.PREFERENCE
4539  },
4540  docBaseUrl: {
4541    value: "",
4542    kind: OptionKind.API
4543  },
4544  enableXfa: {
4545    value: true,
4546    kind: OptionKind.API + OptionKind.PREFERENCE
4547  },
4548  fontExtraProperties: {
4549    value: false,
4550    kind: OptionKind.API
4551  },
4552  isEvalSupported: {
4553    value: true,
4554    kind: OptionKind.API
4555  },
4556  isOffscreenCanvasSupported: {
4557    value: true,
4558    kind: OptionKind.API
4559  },
4560  maxImageSize: {
4561    value: -1,
4562    kind: OptionKind.API
4563  },
4564  pdfBug: {
4565    value: false,
4566    kind: OptionKind.API
4567  },
4568  standardFontDataUrl: {
4569    value: "../web/standard_fonts/",
4570    kind: OptionKind.API
4571  },
4572  verbosity: {
4573    value: 1,
4574    kind: OptionKind.API
4575  },
4576  workerPort: {
4577    value: null,
4578    kind: OptionKind.WORKER
4579  },
4580  workerSrc: {
4581    value: "../build/pdf.worker.mjs",
4582    kind: OptionKind.WORKER
4583  }
4584};
4585{
4586  defaultOptions.defaultUrl = {
4587    value: "compressed.tracemonkey-pldi-09.pdf",
4588    kind: OptionKind.VIEWER
4589  };
4590  defaultOptions.sandboxBundleSrc = {
4591    value: "../build/pdf.sandbox.mjs",
4592    kind: OptionKind.VIEWER
4593  };
4594  defaultOptions.viewerCssTheme = {
4595    value: 0,
4596    kind: OptionKind.VIEWER + OptionKind.PREFERENCE
4597  };
4598}
4599{
4600  defaultOptions.disablePreferences = {
4601    value: false,
4602    kind: OptionKind.VIEWER
4603  };
4604  defaultOptions.locale = {
4605    value: navigator.language || "en-US",
4606    kind: OptionKind.VIEWER
4607  };
4608}
4609const userOptions = Object.create(null);
4610{
4611  for (const name in compatibilityParams) {
4612    userOptions[name] = compatibilityParams[name];
4613  }
4614}
4615class AppOptions {
4616  constructor() {
4617    throw new Error("Cannot initialize AppOptions.");
4618  }
4619  static get(name) {
4620    return userOptions[name] ?? defaultOptions[name]?.value ?? undefined;
4621  }
4622  static getAll(kind = null, defaultOnly = false) {
4623    const options = Object.create(null);
4624    for (const name in defaultOptions) {
4625      const defaultOption = defaultOptions[name];
4626      if (kind && !(kind & defaultOption.kind)) {
4627        continue;
4628      }
4629      options[name] = defaultOnly ? defaultOption.value : userOptions[name] ?? defaultOption.value;
4630    }
4631    return options;
4632  }
4633  static set(name, value) {
4634    userOptions[name] = value;
4635  }
4636  static setAll(options, init = false) {
4637    if (init) {
4638      if (this.get("disablePreferences")) {
4639        return;
4640      }
4641      for (const name in userOptions) {
4642        if (compatibilityParams[name] !== undefined) {
4643          continue;
4644        }
4645        console.warn("setAll: The Preferences may override manually set AppOptions; " + 'please use the "disablePreferences"-option in order to prevent that.');
4646        break;
4647      }
4648    }
4649    for (const name in options) {
4650      userOptions[name] = options[name];
4651    }
4652  }
4653  static remove(name) {
4654    delete userOptions[name];
4655    const val = compatibilityParams[name];
4656    if (val !== undefined) {
4657      userOptions[name] = val;
4658    }
4659  }
4660}
4661
4662
4663/***/ }),
4664
4665/***/ 2961:
4666/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
4667
4668/* harmony export */ __webpack_require__.d(__webpack_exports__, {
4669/* harmony export */   BaseTreeViewer: () => (/* binding */ BaseTreeViewer)
4670/* harmony export */ });
4671/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
4672
4673const TREEITEM_OFFSET_TOP = -100;
4674const TREEITEM_SELECTED_CLASS = "selected";
4675class BaseTreeViewer {
4676  constructor(options) {
4677    if (this.constructor === BaseTreeViewer) {
4678      throw new Error("Cannot initialize BaseTreeViewer.");
4679    }
4680    this.container = options.container;
4681    this.eventBus = options.eventBus;
4682    this._l10n = options.l10n;
4683    this.reset();
4684  }
4685  reset() {
4686    this._pdfDocument = null;
4687    this._lastToggleIsShow = true;
4688    this._currentTreeItem = null;
4689    this.container.textContent = "";
4690    this.container.classList.remove("treeWithDeepNesting");
4691  }
4692  _dispatchEvent(count) {
4693    throw new Error("Not implemented: _dispatchEvent");
4694  }
4695  _bindLink(element, params) {
4696    throw new Error("Not implemented: _bindLink");
4697  }
4698  _normalizeTextContent(str) {
4699    return (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.removeNullCharacters)(str, true) || "\u2013";
4700  }
4701  _addToggleButton(div, hidden = false) {
4702    const toggler = document.createElement("div");
4703    toggler.className = "treeItemToggler";
4704    if (hidden) {
4705      toggler.classList.add("treeItemsHidden");
4706    }
4707    toggler.onclick = evt => {
4708      evt.stopPropagation();
4709      toggler.classList.toggle("treeItemsHidden");
4710      if (evt.shiftKey) {
4711        const shouldShowAll = !toggler.classList.contains("treeItemsHidden");
4712        this._toggleTreeItem(div, shouldShowAll);
4713      }
4714    };
4715    div.prepend(toggler);
4716  }
4717  _toggleTreeItem(root, show = false) {
4718    this._l10n.pause();
4719    this._lastToggleIsShow = show;
4720    for (const toggler of root.querySelectorAll(".treeItemToggler")) {
4721      toggler.classList.toggle("treeItemsHidden", !show);
4722    }
4723    this._l10n.resume();
4724  }
4725  _toggleAllTreeItems() {
4726    this._toggleTreeItem(this.container, !this._lastToggleIsShow);
4727  }
4728  _finishRendering(fragment, count, hasAnyNesting = false) {
4729    if (hasAnyNesting) {
4730      this.container.classList.add("treeWithDeepNesting");
4731      this._lastToggleIsShow = !fragment.querySelector(".treeItemsHidden");
4732    }
4733    this._l10n.pause();
4734    this.container.append(fragment);
4735    this._l10n.resume();
4736    this._dispatchEvent(count);
4737  }
4738  render(params) {
4739    throw new Error("Not implemented: render");
4740  }
4741  _updateCurrentTreeItem(treeItem = null) {
4742    if (this._currentTreeItem) {
4743      this._currentTreeItem.classList.remove(TREEITEM_SELECTED_CLASS);
4744      this._currentTreeItem = null;
4745    }
4746    if (treeItem) {
4747      treeItem.classList.add(TREEITEM_SELECTED_CLASS);
4748      this._currentTreeItem = treeItem;
4749    }
4750  }
4751  _scrollToCurrentTreeItem(treeItem) {
4752    if (!treeItem) {
4753      return;
4754    }
4755    this._l10n.pause();
4756    let currentNode = treeItem.parentNode;
4757    while (currentNode && currentNode !== this.container) {
4758      if (currentNode.classList.contains("treeItem")) {
4759        const toggler = currentNode.firstElementChild;
4760        toggler?.classList.remove("treeItemsHidden");
4761      }
4762      currentNode = currentNode.parentNode;
4763    }
4764    this._l10n.resume();
4765    this._updateCurrentTreeItem(treeItem);
4766    this.container.scrollTo(treeItem.offsetLeft, treeItem.offsetTop + TREEITEM_OFFSET_TOP);
4767  }
4768}
4769
4770
4771/***/ }),
4772
4773/***/ 3973:
4774/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
4775
4776/* harmony export */ __webpack_require__.d(__webpack_exports__, {
4777/* harmony export */   CaretBrowsingMode: () => (/* binding */ CaretBrowsingMode)
4778/* harmony export */ });
4779const PRECISION = 1e-1;
4780class CaretBrowsingMode {
4781  #mainContainer;
4782  #toolBarHeight;
4783  #viewerContainer;
4784  constructor(mainContainer, viewerContainer, toolbarContainer) {
4785    this.#mainContainer = mainContainer;
4786    this.#viewerContainer = viewerContainer;
4787    this.#toolBarHeight = toolbarContainer?.getBoundingClientRect().height ?? 0;
4788  }
4789  #isOnSameLine(rect1, rect2) {
4790    const top1 = rect1.y;
4791    const bot1 = rect1.bottom;
4792    const mid1 = rect1.y + rect1.height / 2;
4793    const top2 = rect2.y;
4794    const bot2 = rect2.bottom;
4795    const mid2 = rect2.y + rect2.height / 2;
4796    return top1 <= mid2 && mid2 <= bot1 || top2 <= mid1 && mid1 <= bot2;
4797  }
4798  #isUnderOver(rect, x, y, isUp) {
4799    const midY = rect.y + rect.height / 2;
4800    return (isUp ? y >= midY : y <= midY) && rect.x - PRECISION <= x && x <= rect.right + PRECISION;
4801  }
4802  #isVisible(rect) {
4803    return rect.top >= this.#toolBarHeight && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
4804  }
4805  #getCaretPosition(selection, isUp) {
4806    const {
4807      focusNode,
4808      focusOffset
4809    } = selection;
4810    const range = document.createRange();
4811    range.setStart(focusNode, focusOffset);
4812    range.setEnd(focusNode, focusOffset);
4813    const rect = range.getBoundingClientRect();
4814    return [rect.x, isUp ? rect.top : rect.bottom];
4815  }
4816  static #caretPositionFromPoint(x, y) {
4817    if (!document.caretPositionFromPoint) {
4818      const {
4819        startContainer: offsetNode,
4820        startOffset: offset
4821      } = document.caretRangeFromPoint(x, y);
4822      return {
4823        offsetNode,
4824        offset
4825      };
4826    }
4827    return document.caretPositionFromPoint(x, y);
4828  }
4829  #setCaretPositionHelper(selection, caretX, select, element, rect) {
4830    rect ||= element.getBoundingClientRect();
4831    if (caretX <= rect.x + PRECISION) {
4832      if (select) {
4833        selection.extend(element.firstChild, 0);
4834      } else {
4835        selection.setPosition(element.firstChild, 0);
4836      }
4837      return;
4838    }
4839    if (rect.right - PRECISION <= caretX) {
4840      const {
4841        lastChild
4842      } = element;
4843      if (select) {
4844        selection.extend(lastChild, lastChild.length);
4845      } else {
4846        selection.setPosition(lastChild, lastChild.length);
4847      }
4848      return;
4849    }
4850    const midY = rect.y + rect.height / 2;
4851    let caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);
4852    let parentElement = caretPosition.offsetNode?.parentElement;
4853    if (parentElement && parentElement !== element) {
4854      const elementsAtPoint = document.elementsFromPoint(caretX, midY);
4855      const savedVisibilities = [];
4856      for (const el of elementsAtPoint) {
4857        if (el === element) {
4858          break;
4859        }
4860        const {
4861          style
4862        } = el;
4863        savedVisibilities.push([el, style.visibility]);
4864        style.visibility = "hidden";
4865      }
4866      caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);
4867      parentElement = caretPosition.offsetNode?.parentElement;
4868      for (const [el, visibility] of savedVisibilities) {
4869        el.style.visibility = visibility;
4870      }
4871    }
4872    if (parentElement !== element) {
4873      if (select) {
4874        selection.extend(element.firstChild, 0);
4875      } else {
4876        selection.setPosition(element.firstChild, 0);
4877      }
4878      return;
4879    }
4880    if (select) {
4881      selection.extend(caretPosition.offsetNode, caretPosition.offset);
4882    } else {
4883      selection.setPosition(caretPosition.offsetNode, caretPosition.offset);
4884    }
4885  }
4886  #setCaretPosition(select, selection, newLineElement, newLineElementRect, caretX) {
4887    if (this.#isVisible(newLineElementRect)) {
4888      this.#setCaretPositionHelper(selection, caretX, select, newLineElement, newLineElementRect);
4889      return;
4890    }
4891    this.#mainContainer.addEventListener("scrollend", this.#setCaretPositionHelper.bind(this, selection, caretX, select, newLineElement, null), {
4892      once: true
4893    });
4894    newLineElement.scrollIntoView();
4895  }
4896  #getNodeOnNextPage(textLayer, isUp) {
4897    while (true) {
4898      const page = textLayer.closest(".page");
4899      const pageNumber = parseInt(page.getAttribute("data-page-number"));
4900      const nextPage = isUp ? pageNumber - 1 : pageNumber + 1;
4901      textLayer = this.#viewerContainer.querySelector(`.page[data-page-number="${nextPage}"] .textLayer`);
4902      if (!textLayer) {
4903        return null;
4904      }
4905      const walker = document.createTreeWalker(textLayer, NodeFilter.SHOW_TEXT);
4906      const node = isUp ? walker.lastChild() : walker.firstChild();
4907      if (node) {
4908        return node;
4909      }
4910    }
4911  }
4912  moveCaret(isUp, select) {
4913    const selection = document.getSelection();
4914    if (selection.rangeCount === 0) {
4915      return;
4916    }
4917    const {
4918      focusNode
4919    } = selection;
4920    const focusElement = focusNode.nodeType !== Node.ELEMENT_NODE ? focusNode.parentElement : focusNode;
4921    const root = focusElement.closest(".textLayer");
4922    if (!root) {
4923      return;
4924    }
4925    const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
4926    walker.currentNode = focusNode;
4927    const focusRect = focusElement.getBoundingClientRect();
4928    let newLineElement = null;
4929    const nodeIterator = (isUp ? walker.previousSibling : walker.nextSibling).bind(walker);
4930    while (nodeIterator()) {
4931      const element = walker.currentNode.parentElement;
4932      if (!this.#isOnSameLine(focusRect, element.getBoundingClientRect())) {
4933        newLineElement = element;
4934        break;
4935      }
4936    }
4937    if (!newLineElement) {
4938      const node = this.#getNodeOnNextPage(root, isUp);
4939      if (!node) {
4940        return;
4941      }
4942      if (select) {
4943        const lastNode = (isUp ? walker.firstChild() : walker.lastChild()) || focusNode;
4944        selection.extend(lastNode, isUp ? 0 : lastNode.length);
4945        const range = document.createRange();
4946        range.setStart(node, isUp ? node.length : 0);
4947        range.setEnd(node, isUp ? node.length : 0);
4948        selection.addRange(range);
4949        return;
4950      }
4951      const [caretX] = this.#getCaretPosition(selection, isUp);
4952      const {
4953        parentElement
4954      } = node;
4955      this.#setCaretPosition(select, selection, parentElement, parentElement.getBoundingClientRect(), caretX);
4956      return;
4957    }
4958    const [caretX, caretY] = this.#getCaretPosition(selection, isUp);
4959    const newLineElementRect = newLineElement.getBoundingClientRect();
4960    if (this.#isUnderOver(newLineElementRect, caretX, caretY, isUp)) {
4961      this.#setCaretPosition(select, selection, newLineElement, newLineElementRect, caretX);
4962      return;
4963    }
4964    while (nodeIterator()) {
4965      const element = walker.currentNode.parentElement;
4966      const elementRect = element.getBoundingClientRect();
4967      if (!this.#isOnSameLine(newLineElementRect, elementRect)) {
4968        break;
4969      }
4970      if (this.#isUnderOver(elementRect, caretX, caretY, isUp)) {
4971        this.#setCaretPosition(select, selection, element, elementRect, caretX);
4972        return;
4973      }
4974    }
4975    this.#setCaretPosition(select, selection, newLineElement, newLineElementRect, caretX);
4976  }
4977}
4978
4979
4980/***/ }),
4981
4982/***/ 1544:
4983/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
4984
4985__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
4986/* harmony export */ __webpack_require__.d(__webpack_exports__, {
4987/* harmony export */   DownloadManager: () => (/* binding */ DownloadManager)
4988/* harmony export */ });
4989/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
4990var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
4991pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
4992
4993function download(blobUrl, filename) {
4994  const a = document.createElement("a");
4995  if (!a.click) {
4996    throw new Error('DownloadManager: "a.click()" is not supported.');
4997  }
4998  a.href = blobUrl;
4999  a.target = "_parent";
5000  if ("download" in a) {
5001    a.download = filename;
5002  }
5003  (document.body || document.documentElement).append(a);
5004  a.click();
5005  a.remove();
5006}
5007class DownloadManager {
5008  #openBlobUrls = new WeakMap();
5009  downloadUrl(url, filename, _options) {
5010    if (!(0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.createValidAbsoluteUrl)(url, "http://example.com")) {
5011      console.error(`downloadUrl - not a valid URL: ${url}`);
5012      return;
5013    }
5014    download(url + "#pdfjs.action=download", filename);
5015  }
5016  downloadData(data, filename, contentType) {
5017    const blobUrl = URL.createObjectURL(new Blob([data], {
5018      type: contentType
5019    }));
5020    download(blobUrl, filename);
5021  }
5022  openOrDownloadData(data, filename, dest = null) {
5023    const isPdfData = (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.isPdfFile)(filename);
5024    const contentType = isPdfData ? "application/pdf" : "";
5025    if (isPdfData) {
5026      let blobUrl = this.#openBlobUrls.get(data);
5027      if (!blobUrl) {
5028        blobUrl = URL.createObjectURL(new Blob([data], {
5029          type: contentType
5030        }));
5031        this.#openBlobUrls.set(data, blobUrl);
5032      }
5033      let viewerUrl;
5034      viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename);
5035      if (dest) {
5036        viewerUrl += `#${escape(dest)}`;
5037      }
5038      try {
5039        window.open(viewerUrl);
5040        return true;
5041      } catch (ex) {
5042        console.error(`openOrDownloadData: ${ex}`);
5043        URL.revokeObjectURL(blobUrl);
5044        this.#openBlobUrls.delete(data);
5045      }
5046    }
5047    this.downloadData(data, filename, contentType);
5048    return false;
5049  }
5050  download(blob, url, filename, _options) {
5051    const blobUrl = URL.createObjectURL(blob);
5052    download(blobUrl, filename);
5053  }
5054}
5055
5056__webpack_async_result__();
5057} catch(e) { __webpack_async_result__(e); } });
5058
5059/***/ }),
5060
5061/***/ 3088:
5062/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
5063
5064__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
5065/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5066/* harmony export */   DrawLayerBuilder: () => (/* binding */ DrawLayerBuilder)
5067/* harmony export */ });
5068/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
5069var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
5070pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
5071
5072class DrawLayerBuilder {
5073  #drawLayer = null;
5074  constructor(options) {
5075    this.pageIndex = options.pageIndex;
5076  }
5077  async render(intent = "display") {
5078    if (intent !== "display" || this.#drawLayer || this._cancelled) {
5079      return;
5080    }
5081    this.#drawLayer = new pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.DrawLayer({
5082      pageIndex: this.pageIndex
5083    });
5084  }
5085  cancel() {
5086    this._cancelled = true;
5087    if (!this.#drawLayer) {
5088      return;
5089    }
5090    this.#drawLayer.destroy();
5091    this.#drawLayer = null;
5092  }
5093  setParent(parent) {
5094    this.#drawLayer?.setParent(parent);
5095  }
5096  getDrawLayer() {
5097    return this.#drawLayer;
5098  }
5099}
5100
5101__webpack_async_result__();
5102} catch(e) { __webpack_async_result__(e); } });
5103
5104/***/ }),
5105
5106/***/ 5656:
5107/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
5108
5109/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5110/* harmony export */   AutomationEventBus: () => (/* binding */ AutomationEventBus),
5111/* harmony export */   EventBus: () => (/* binding */ EventBus),
5112/* harmony export */   waitOnEventOrTimeout: () => (/* binding */ waitOnEventOrTimeout)
5113/* harmony export */ });
5114/* unused harmony export WaitOnType */
5115const WaitOnType = {
5116  EVENT: "event",
5117  TIMEOUT: "timeout"
5118};
5119async function waitOnEventOrTimeout({
5120  target,
5121  name,
5122  delay = 0
5123}) {
5124  if (typeof target !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && delay >= 0)) {
5125    throw new Error("waitOnEventOrTimeout - invalid parameters.");
5126  }
5127  const {
5128    promise,
5129    resolve
5130  } = Promise.withResolvers();
5131  function handler(type) {
5132    if (target instanceof EventBus) {
5133      target._off(name, eventHandler);
5134    } else {
5135      target.removeEventListener(name, eventHandler);
5136    }
5137    if (timeout) {
5138      clearTimeout(timeout);
5139    }
5140    resolve(type);
5141  }
5142  const eventHandler = handler.bind(null, WaitOnType.EVENT);
5143  if (target instanceof EventBus) {
5144    target._on(name, eventHandler);
5145  } else {
5146    target.addEventListener(name, eventHandler);
5147  }
5148  const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
5149  const timeout = setTimeout(timeoutHandler, delay);
5150  return promise;
5151}
5152class EventBus {
5153  #listeners = Object.create(null);
5154  on(eventName, listener, options = null) {
5155    this._on(eventName, listener, {
5156      external: true,
5157      once: options?.once
5158    });
5159  }
5160  off(eventName, listener, options = null) {
5161    this._off(eventName, listener, {
5162      external: true,
5163      once: options?.once
5164    });
5165  }
5166  dispatch(eventName, data) {
5167    const eventListeners = this.#listeners[eventName];
5168    if (!eventListeners || eventListeners.length === 0) {
5169      return;
5170    }
5171    let externalListeners;
5172    for (const {
5173      listener,
5174      external,
5175      once
5176    } of eventListeners.slice(0)) {
5177      if (once) {
5178        this._off(eventName, listener);
5179      }
5180      if (external) {
5181        (externalListeners ||= []).push(listener);
5182        continue;
5183      }
5184      listener(data);
5185    }
5186    if (externalListeners) {
5187      for (const listener of externalListeners) {
5188        listener(data);
5189      }
5190      externalListeners = null;
5191    }
5192  }
5193  _on(eventName, listener, options = null) {
5194    const eventListeners = this.#listeners[eventName] ||= [];
5195    eventListeners.push({
5196      listener,
5197      external: options?.external === true,
5198      once: options?.once === true
5199    });
5200  }
5201  _off(eventName, listener, options = null) {
5202    const eventListeners = this.#listeners[eventName];
5203    if (!eventListeners) {
5204      return;
5205    }
5206    for (let i = 0, ii = eventListeners.length; i < ii; i++) {
5207      if (eventListeners[i].listener === listener) {
5208        eventListeners.splice(i, 1);
5209        return;
5210      }
5211    }
5212  }
5213}
5214class AutomationEventBus extends EventBus {
5215  dispatch(eventName, data) {
5216    throw new Error("Not implemented: AutomationEventBus.dispatch");
5217  }
5218}
5219
5220
5221/***/ }),
5222
5223/***/ 4290:
5224/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
5225
5226/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5227/* harmony export */   BaseExternalServices: () => (/* binding */ BaseExternalServices)
5228/* harmony export */ });
5229class BaseExternalServices {
5230  constructor() {
5231    if (this.constructor === BaseExternalServices) {
5232      throw new Error("Cannot initialize BaseExternalServices.");
5233    }
5234  }
5235  updateFindControlState(data) {}
5236  updateFindMatchesCount(data) {}
5237  initPassiveLoading() {}
5238  reportTelemetry(data) {}
5239  async createL10n() {
5240    throw new Error("Not implemented: createL10n");
5241  }
5242  createScripting() {
5243    throw new Error("Not implemented: createScripting");
5244  }
5245  updateEditorStates(data) {
5246    throw new Error("Not implemented: updateEditorStates");
5247  }
5248  async getNimbusExperimentData() {}
5249}
5250
5251
5252/***/ }),
5253
5254/***/ 289:
5255/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
5256
5257__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
5258/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5259/* harmony export */   GenericScripting: () => (/* binding */ GenericScripting)
5260/* harmony export */ });
5261/* unused harmony export docProperties */
5262/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
5263var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
5264pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
5265
5266async function docProperties(pdfDocument) {
5267  const url = "",
5268    baseUrl = url.split("#", 1)[0];
5269  let {
5270    info,
5271    metadata,
5272    contentDispositionFilename,
5273    contentLength
5274  } = await pdfDocument.getMetadata();
5275  if (!contentLength) {
5276    const {
5277      length
5278    } = await pdfDocument.getDownloadInfo();
5279    contentLength = length;
5280  }
5281  return {
5282    ...info,
5283    baseURL: baseUrl,
5284    filesize: contentLength,
5285    filename: contentDispositionFilename || getPdfFilenameFromUrl(url),
5286    metadata: metadata?.getRaw(),
5287    authors: metadata?.get("dc:creator"),
5288    numPages: pdfDocument.numPages,
5289    URL: url
5290  };
5291}
5292class GenericScripting {
5293  constructor(sandboxBundleSrc) {
5294    this._ready = new Promise((resolve, reject) => {
5295      const sandbox = import( /*webpackIgnore: true*/sandboxBundleSrc);
5296      sandbox.then(pdfjsSandbox => {
5297        resolve(pdfjsSandbox.QuickJSSandbox());
5298      }).catch(reject);
5299    });
5300  }
5301  async createSandbox(data) {
5302    const sandbox = await this._ready;
5303    sandbox.create(data);
5304  }
5305  async dispatchEventInSandbox(event) {
5306    const sandbox = await this._ready;
5307    setTimeout(() => sandbox.dispatchEvent(event), 0);
5308  }
5309  async destroySandbox() {
5310    const sandbox = await this._ready;
5311    sandbox.nukeSandbox();
5312  }
5313}
5314
5315__webpack_async_result__();
5316} catch(e) { __webpack_async_result__(e); } });
5317
5318/***/ }),
5319
5320/***/ 6750:
5321/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
5322
5323__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
5324/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5325/* harmony export */   ExternalServices: () => (/* binding */ ExternalServices),
5326/* harmony export */   MLManager: () => (/* binding */ MLManager),
5327/* harmony export */   Preferences: () => (/* binding */ Preferences),
5328/* harmony export */   initCom: () => (/* binding */ initCom)
5329/* harmony export */ });
5330/* harmony import */ var _app_options_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9840);
5331/* harmony import */ var _external_services_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4290);
5332/* harmony import */ var _preferences_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8224);
5333/* harmony import */ var _genericl10n_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(410);
5334/* harmony import */ var _generic_scripting_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(289);
5335var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_genericl10n_js__WEBPACK_IMPORTED_MODULE_2__, _generic_scripting_js__WEBPACK_IMPORTED_MODULE_3__]);
5336([_genericl10n_js__WEBPACK_IMPORTED_MODULE_2__, _generic_scripting_js__WEBPACK_IMPORTED_MODULE_3__] 
5336= __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
5337
5338
5339
5340
5341
5342function initCom(app) {}
5343class Preferences extends _preferences_js__WEBPACK_IMPORTED_MODULE_1__.BasePreferences {
5344  async _writeToStorage(prefObj) {
5345    localStorage.setItem("pdfjs.preferences", JSON.stringify(prefObj));
5346  }
5347  async _readFromStorage(prefObj) {
5348    return {
5349      prefs: JSON.parse(localStorage.getItem("pdfjs.preferences"))
5350    };
5351  }
5352}
5353class ExternalServices extends _external_services_js__WEBPACK_IMPORTED_MODULE_4__.BaseExternalServices {
5354  async createL10n() {
5355    return new _genericl10n_js__WEBPACK_IMPORTED_MODULE_2__.GenericL10n(_app_options_js__WEBPACK_IMPORTED_MODULE_0__.AppOptions.get("locale"));
5356  }
5357  createScripting() {
5358    return new _generic_scripting_js__WEBPACK_IMPORTED_MODULE_3__.GenericScripting(_app_options_js__WEBPACK_IMPORTED_MODULE_0__.AppOptions.get("sandboxBundleSrc"));
5359  }
5360}
5361class MLManager {
5362  async guess() {
5363    return null;
5364  }
5365}
5366
5367__webpack_async_result__();
5368} catch(e) { __webpack_async_result__(e); } });
5369
5370/***/ }),
5371
5372/***/ 410:
5373/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
5374
5375__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
5376/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5377/* harmony export */   GenericL10n: () => (/* binding */ GenericL10n)
5378/* harmony export */ });
5379/* harmony import */ var fluent_bundle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(588);
5380/* harmony import */ var fluent_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5273);
5381/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2603);
5382/* harmony import */ var _l10n_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4693);
5383var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_2__]);
5384pdfjs_lib__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
5385
5386
5387
5388
5389function createBundle(lang, text) {
5390  const resource = new fluent_bundle__WEBPACK_IMPORTED_MODULE_0__.FluentResource(text);
5391  const bundle = new fluent_bundle__WEBPACK_IMPORTED_MODULE_0__.FluentBundle(lang);
5392  const errors = bundle.addResource(resource);
5393  if (errors.length) {
5394    console.error("L10n errors", errors);
5395  }
5396  return bundle;
5397}
5398class GenericL10n extends _l10n_js__WEBPACK_IMPORTED_MODULE_3__.L10n {
5399  constructor(lang) {
5400    super({
5401      lang
5402    });
5403    const generateBundles = !lang ? GenericL10n.#generateBundlesFallback.bind(GenericL10n, this.getLanguage()) : GenericL10n.#generateBundles.bind(GenericL10n, "en-us", this.getLanguage());
5404    this._setL10n(new fluent_dom__WEBPACK_IMPORTED_MODULE_1__.DOMLocalization([], generateBundles));
5405  }
5406  static async *#generateBundles(defaultLang, baseLang) {
5407    const {
5408      baseURL,
5409      paths
5410    } = await this.#getPaths();
5411    const langs = [baseLang];
5412    if (defaultLang !== baseLang) {
5413      const shortLang = baseLang.split("-", 1)[0];
5414      if (shortLang !== baseLang) {
5415        langs.push(shortLang);
5416      }
5417      langs.push(defaultLang);
5418    }
5419    for (const lang of langs) {
5420      const bundle = await this.#createBundle(lang, baseURL, paths);
5421      if (bundle) {
5422        yield bundle;
5423      }
5424      if (lang === "en-us") {
5425        yield this.#createBundleFallback(lang);
5426      }
5427    }
5428  }
5429  static async #createBundle(lang, baseURL, paths) {
5430    const path = paths[lang];
5431    if (!path) {
5432      return null;
5433    }
5434    const url = new URL(path, baseURL);
5435    const text = await (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_2__.fetchData)(url, "text");
5436    return createBundle(lang, text);
5437  }
5438  static async #getPaths() {
5439    try {
5440      const {
5441        href
5442      } = document.querySelector(`link[type="application/l10n"]`);
5443      const paths = await (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_2__.fetchData)(href, "json");
5444      return {
5445        baseURL: href.replace(/[^/]*$/, "") || "./",
5446        paths
5447      };
5448    } catch {}
5449    return {
5450      baseURL: "./",
5451      paths: Object.create(null)
5452    };
5453  }
5454  static async *#generateBundlesFallback(lang) {
5455    yield this.#createBundleFallback(lang);
5456  }
5457  static async #createBundleFallback(lang) {
5458    const text = "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-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\u2026\npdfjs-document-properties-button-label = Document Properties\u2026\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 } \xD7 { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } \xD7 { $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\u2026\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\u2026\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-highlight-floating-button1 =\n    .title = Highlight\n    .aria-label = Highlight\npdfjs-highlight-floating-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-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n    .title = Change thickness when highlighting items other than text\npdfjs-free-text =\n    .aria-label = Text Editor\npdfjs-free-text-default-content = Start t
5458yping\u2026\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\u2019t see the image or when it doesn\u2019t 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, \u201CA young man sits down at a table to eat a meal\u201D\npdfjs-editor-resizer-label-top-left = Top left corner \u2014 resize\npdfjs-editor-resizer-label-top-middle = Top middle \u2014 resize\npdfjs-editor-resizer-label-top-right = Top right corner \u2014 resize\npdfjs-editor-resizer-label-middle-right = Middle right \u2014 resize\npdfjs-editor-resizer-label-bottom-right = Bottom right corner \u2014 resize\npdfjs-editor-resizer-label-bottom-middle = Bottom middle \u2014 resize\npdfjs-editor-resizer-label-bottom-left = Bottom left corner \u2014 resize\npdfjs-editor-resizer-label-middle-left = Middle left \u2014 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\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n    .title = Show all";
5459    return createBundle(lang, text);
5460  }
5461}
5462
5463__webpack_async_result__();
5464} catch(e) { __webpack_async_result__(e); } });
5465
5466/***/ }),
5467
5468/***/ 2640:
5469/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
5470
5471/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5472/* harmony export */   GrabToPan: () => (/* binding */ GrabToPan)
5473/* harmony export */ });
5474const CSS_CLASS_GRAB = "grab-to-pan-grab";
5475class GrabToPan {
5476  constructor({
5477    element
5478  }) {
5479    this.element = element;
5480    this.document = element.ownerDocument;
5481    this.activate = this.activate.bind(this);
5482    this.deactivate = this.deactivate.bind(this);
5483    this.toggle = this.toggle.bind(this);
5484    this._onMouseDown = this.#onMouseDown.bind(this);
5485    this._onMouseMove = this.#onMouseMove.bind(this);
5486    this._endPan = this.#endPan.bind(this);
5487    const overlay = this.overlay = document.createElement("div");
5488    overlay.className = "grab-to-pan-grabbing";
5489  }
5490  activate() {
5491    if (!this.active) {
5492      this.active = true;
5493      this.element.addEventListener("mousedown", this._onMouseDown, true);
5494      this.element.classList.add(CSS_CLASS_GRAB);
5495    }
5496  }
5497  deactivate() {
5498    if (this.active) {
5499      this.active = false;
5500      this.element.removeEventListener("mousedown", this._onMouseDown, true);
5501      this._endPan();
5502      this.element.classList.remove(CSS_CLASS_GRAB);
5503    }
5504  }
5505  toggle() {
5506    if (this.active) {
5507      this.deactivate();
5508    } else {
5509      this.activate();
5510    }
5511  }
5512  ignoreTarget(node) {
5513    return node.matches("a[href], a[href] *, input, textarea, button, button *, select, option");
5514  }
5515  #onMouseDown(event) {
5516    if (event.button !== 0 || this.ignoreTarget(event.target)) {
5517      return;
5518    }
5519    if (event.originalTarget) {
5520      try {
5521        event.originalTarget.tagName;
5522      } catch {
5523        return;
5524      }
5525    }
5526    this.scrollLeftStart = this.element.scrollLeft;
5527    this.scrollTopStart = this.element.scrollTop;
5528    this.clientXStart = event.clientX;
5529    this.clientYStart = event.clientY;
5530    this.document.addEventListener("mousemove", this._onMouseMove, true);
5531    this.document.addEventListener("mouseup", this._endPan, true);
5532    this.element.addEventListener("scroll", this._endPan, true);
5533    event.preventDefault();
5534    event.stopPropagation();
5535    const focusedElement = document.activeElement;
5536    if (focusedElement && !focusedElement.contains(event.target)) {
5537      focusedElement.blur();
5538    }
5539  }
5540  #onMouseMove(event) {
5541    this.element.removeEventListener("scroll", this._endPan, true);
5542    if (!(event.buttons & 1)) {
5543      this._endPan();
5544      return;
5545    }
5546    const xDiff = event.clientX - this.clientXStart;
5547    const yDiff = event.clientY - this.clientYStart;
5548    this.element.scrollTo({
5549      top: this.scrollTopStart - yDiff,
5550      left: this.scrollLeftStart - xDiff,
5551      behavior: "instant"
5552    });
5553    if (!this.overlay.parentNode) {
5554      document.body.append(this.overlay);
5555    }
5556  }
5557  #endPan() {
5558    this.element.removeEventListener("scroll", this._endPan, true);
5559    this.document.removeEventListener("mousemove", this._onMouseMove, true);
5560    this.document.removeEventListener("mouseup", this._endPan, true);
5561    this.overlay.remove();
5562  }
5563}
5564
5565
5566/***/ }),
5567
5568/***/ 4693:
5569/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
5570
5571/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5572/* harmony export */   L10n: () => (/* binding */ L10n)
5573/* harmony export */ });
5574/* unused harmony export GenericL10n */
5575class L10n {
5576  #dir;
5577  #lang;
5578  #l10n;
5579  constructor({
5580    lang,
5581    isRTL
5582  }, l10n = null) {
5583    this.#lang = L10n.#fixupLangCode(lang);
5584    this.#l10n = l10n;
5585    this.#dir = isRTL ?? L10n.#isRTL(this.#lang) ? "rtl" : "ltr";
5586  }
5587  _setL10n(l10n) {
5588    this.#l10n = l10n;
5589  }
5590  getLanguage() {
5591    return this.#lang;
5592  }
5593  getDirection() {
5594    return this.#dir;
5595  }
5596  async get(ids, args = null, fallback) {
5597    if (Array.isArray(ids)) {
5598      ids = ids.map(id => ({
5599        id
5600      }));
5601      const messages = await this.#l10n.formatMessages(ids);
5602      return messages.map(message => message.value);
5603    }
5604    const messages = await this.#l10n.formatMessages([{
5605      id: ids,
5606      args
5607    }]);
5608    return messages?.[0].value || fallback;
5609  }
5610  async translate(element) {
5611    try {
5612      this.#l10n.connectRoot(element);
5613      await this.#l10n.translateRoots();
5614    } catch {}
5615  }
5616  pause() {
5617    this.#l10n.pauseObserving();
5618  }
5619  resume() {
5620    this.#l10n.resumeObserving();
5621  }
5622  static #fixupLangCode(langCode) {
5623    langCode = langCode?.toLowerCase() || "en-us";
5624    const PARTIAL_LANG_CODES = {
5625      en: "en-us",
5626      es: "es-es",
5627      fy: "fy-nl",
5628      ga: "ga-ie",
5629      gu: "gu-in",
5630      hi: "hi-in",
5631      hy: "hy-am",
5632      nb: "nb-no",
5633      ne: "ne-np",
5634      nn: "nn-no",
5635      pa: "pa-in",
5636      pt: "pt-pt",
5637      sv: "sv-se",
5638      zh: "zh-cn"
5639    };
5640    return PARTIAL_LANG_CODES[langCode] || langCode;
5641  }
5642  static #isRTL(lang) {
5643    const shortCode = lang.split("-", 1)[0];
5644    return ["ar", "he", "fa", "ps", "ur"].includes(shortCode);
5645  }
5646}
5647const GenericL10n = null;
5648
5649
5650/***/ }),
5651
5652/***/ 6174:
5653/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
5654
5655/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5656/* harmony export */   OverlayManager: () => (/* binding */ OverlayManager)
5657/* harmony export */ });
5658class OverlayManager {
5659  #overlays = new WeakMap();
5660  #active = null;
5661  get active() {
5662    return this.#active;
5663  }
5664  async register(dialog, canForceClose = false) {
5665    if (typeof dialog !== "object") {
5666      throw new Error("Not enough parameters.");
5667    } else if (this.#overlays.has(dialog)) {
5668      throw new Error("The overlay is already registered.");
5669    }
5670    this.#overlays.set(dialog, {
5671      canForceClose
5672    });
5673    dialog.addEventListener("cancel", evt => {
5674      this.#active = null;
5675    });
5676  }
5677  async open(dialog) {
5678    if (!this.#overlays.has(dialog)) {
5679      throw new Error("The overlay does not exist.");
5680    } else if (this.#active) {
5681      if (this.#active === dialog) {
5682        throw new Error("The overlay is already active.");
5683      } else if (this.#overlays.get(dialog).canForceClose) {
5684        await this.close();
5685      } else {
5686        throw new Error("Another overlay is currently active.");
5687      }
5688    }
5689    this.#active = dialog;
5690    dialog.showModal();
5691  }
5692  async close(dialog = this.#active) {
5693    if (!this.#overlays.has(dialog)) {
5694      throw new Error("The overlay does not exist.");
5695    } else if (!this.#active) {
5696      throw new Error("The overlay is currently not active.");
5697    } else if (this.#active !== dialog) {
5698      throw new Error("Another overlay is currently active.");
5699    }
5700    dialog.close();
5701    this.#active = null;
5702  }
5703}
5704
5705
5706/***/ }),
5707
5708/***/ 2690:
5709/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
5710
5711__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
5712/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5713/* harmony export */   PasswordPrompt: () => (/* binding */ PasswordPrompt)
5714/* harmony export */ });
5715/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
5716var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
5717pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
5718
5719class PasswordPrompt {
5720  #activeCapability = null;
5721  #updateCallback = null;
5722  #reason = null;
5723  constructor(options, overlayManager, isViewerEmbedded = false) {
5724    this.dialog = options.dialog;
5725    this.label = options.label;
5726    this.input = options.input;
5727    this.submitButton = options.submitButton;
5728    this.cancelButton = options.cancelButton;
5729    this.overlayManager = overlayManager;
5730    this._isViewerEmbedded = isViewerEmbedded;
5731    this.submitButton.addEventListener("click", this.#verify.bind(this));
5732    this.cancelButton.addEventListener("click", this.close.bind(this));
5733    this.input.addEventListener("keydown", e => {
5734      if (e.keyCode === 13) {
5735        this.#verify();
5736      }
5737    });
5738    this.overlayManager.register(this.dialog, true);
5739    this.dialog.addEventListener("close", this.#cancel.bind(this));
5740  }
5741  async open() {
5742    await this.#activeCapability?.promise;
5743    this.#activeCapability = Promise.withResolvers();
5744    try {
5745      await this.overlayManager.open(this.dialog);
5746    } catch (ex) {
5747      this.#activeCapability.resolve();
5748      throw ex;
5749    }
5750    const passwordIncorrect = this.#reason === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PasswordResponses.INCORRECT_PASSWORD;
5751    if (!this._isViewerEmbedded || passwordIncorrect) {
5752      this.input.focus();
5753    }
5754    this.label.setAttribute("data-l10n-id", `pdfjs-password-${passwordIncorrect ? "invalid" : "label"}`);
5755  }
5756  async close() {
5757    if (this.overlayManager.active === this.dialog) {
5758      this.overlayManager.close(this.dialog);
5759    }
5760  }
5761  #verify() {
5762    const password = this.input.value;
5763    if (password?.length > 0) {
5764      this.#invokeCallback(password);
5765    }
5766  }
5767  #cancel() {
5768    this.#invokeCallback(new Error("PasswordPrompt cancelled."));
5769    this.#activeCapability.resolve();
5770  }
5771  #invokeCallback(password) {
5772    if (!this.#updateCallback) {
5773      return;
5774    }
5775    this.close();
5776    this.input.value = "";
5777    this.#updateCallback(password);
5778    this.#updateCallback = null;
5779  }
5780  async setUpdateCallback(updateCallback, reason) {
5781    if (this.#activeCapability) {
5782      await this.#activeCapability.promise;
5783    }
5784    this.#updateCallback = updateCallback;
5785    this.#reason = reason;
5786  }
5787}
5788
5789__webpack_async_result__();
5790} catch(e) { __webpack_async_result__(e); } });
5791
5792/***/ }),
5793
5794/***/ 9251:
5795/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
5796
5797__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
5798/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5799/* harmony export */   PDFAttachmentViewer: () => (/* binding */ PDFAttachmentViewer)
5800/* harmony export */ });
5801/* harmony import */ var _base_tree_viewer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2961);
5802/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2603);
5803/* harmony import */ var _event_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5656);
5804var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__]);
5805pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
5806
5807
5808
5809class PDFAttachmentViewer extends _base_tree_viewer_js__WEBPACK_IMPORTED_MODULE_0__.BaseTreeViewer {
5810  constructor(options) {
5811    super(options);
5812    this.downloadManager = options.downloadManager;
5813    this.eventBus._on("fileattachmentannotation", this.#appendAttachment.bind(this));
5814  }
5815  reset(keepRenderedCapability = false) {
5816    super.reset();
5817    this._attachments = null;
5818    if (!keepRenderedCapability) {
5819      this._renderedCapability = Promise.withResolvers();
5820    }
5821    this._pendingDispatchEvent = false;
5822  }
5823  async _dispatchEvent(attachmentsCount) {
5824    this._renderedCapability.resolve();
5825    if (attachmentsCount === 0 && !this._pendingDispatchEvent) {
5826      this._pendingDispatchEvent = true;
5827      await (0,_event_utils_js__WEBPACK_IMPORTED_MODULE_2__.waitOnEventOrTimeout)({
5828        target: this.eventBus,
5829        name: "annotationlayerrendered",
5830        delay: 1000
5831      });
5832      if (!this._pendingDispatchEvent) {
5833        return;
5834      }
5835    }
5836    this._pendingDispatchEvent = false;
5837    this.eventBus.dispatch("attachmentsloaded", {
5838      source: this,
5839      attachmentsCount
5840    });
5841  }
5842  _bindLink(element, {
5843    content,
5844    filename
5845  }) {
5846    element.onclick = () => {
5847      this.downloadManager.openOrDownloadData(content, filename);
5848      return false;
5849    };
5850  }
5851  render({
5852    attachments,
5853    keepRenderedCapability = false
5854  }) {
5855    if (this._attachments) {
5856      this.reset(keepRenderedCapability);
5857    }
5858    this._attachments = attachments || null;
5859    if (!attachments) {
5860      this._dispatchEvent(0);
5861      return;
5862    }
5863    const fragment = document.createDocumentFragment();
5864    let attachmentsCount = 0;
5865    for (const name in attachments) {
5866      const item = attachments[name];
5867      const content = item.content,
5868        filename = (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.getFilenameFromUrl)(item.filename, true);
5869      const div = document.createElement("div");
5870      div.className = "treeItem";
5871      const element = document.createElement("a");
5872      this._bindLink(element, {
5873        content,
5874        filename
5875      });
5876      element.textContent = this._normalizeTextContent(filename);
5877      div.append(element);
5878      fragment.append(div);
5879      attachmentsCount++;
5880    }
5881    this._finishRendering(fragment, attachmentsCount);
5882  }
5883  #appendAttachment({
5884    filename,
5885    content
5886  }) {
5887    const renderedPromise = this._renderedCapability.promise;
5888    renderedPromise.then(() => {
5889      if (renderedPromise !== this._renderedCapability.promise) {
5890        return;
5891      }
5892      const attachments = this._attachments || Object.create(null);
5893      for (const name in attachments) {
5894        if (filename === name) {
5895          return;
5896        }
5897      }
5898      attachments[filename] = {
5899        filename,
5900        content
5901      };
5902      this.render({
5903        attachments,
5904        keepRenderedCapability: true
5905      });
5906    });
5907  }
5908}
5909
5910__webpack_async_result__();
5911} catch(e) { __webpack_async_result__(e); } });
5912
5913/***/ }),
5914
5915/***/ 5993:
5916/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
5917
5918__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
5919/* harmony export */ __webpack_require__.d(__webpack_exports__, {
5920/* harmony export */   PDFCursorTools: () => (/* binding */ PDFCursorTools)
5921/* harmony export */ });
5922/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
5923/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7256);
5924/* harmony import */ var _grab_to_pan_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2640);
5925var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
5926pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
5927
5928
5929
5930class PDFCursorTools {
5931  #active = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.CursorTool.SELECT;
5932  #prevActive = null;
5933  constructor({
5934    container,
5935    eventBus,
5936    cursorToolOnLoad = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.CursorTool.SELECT
5937  }) {
5938    this.container = container;
5939    this.eventBus = eventBus;
5940    this.#addEventListeners();
5941    Promise.resolve().then(() => {
5942      this.switchTool(cursorToolOnLoad);
5943    });
5944  }
5945  get activeTool() {
5946    return this.#active;
5947  }
5948  switchTool(tool) {
5949    if (this.#prevActive !== null) {
5950      return;
5951    }
5952    if (tool === this.#active) {
5953      return;
5954    }
5955    const disableActiveTool = () => {
5956      switch (this.#active) {
5957        case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.CursorTool.SELECT:
5958          break;
5959        case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.CursorTool.HAND:
5960          this._handTool.deactivate();
5961          break;
5962        case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.CursorTool.ZOOM:
5963      }
5964    };
5965    switch (tool) {
5966      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.CursorTool.SELECT:
5967        disableActiveTool();
5968        break;
5969      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.CursorTool.HAND:
5970        disableActiveTool();
5971        this._handTool.activate();
5972        break;
5973      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.CursorTool.ZOOM:
5974      default:
5975        console.error(`switchTool: "${tool}" is an unsupported value.`);
5976        return;
5977    }
5978    this.#active = tool;
5979    this.eventBus.dispatch("cursortoolchanged", {
5980      source: this,
5981      tool
5982    });
5983  }
5984  #addEventListeners() {
5985    this.eventBus._on("switchcursortool", evt => {
5986      this.switchTool(evt.tool);
5987    });
5988    let annotationEditorMode = pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE,
5989      presentationModeState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.NORMAL;
5990    const disableActive = () => {
5991      const prevActive = this.#active;
5992      this.switchTool(_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.CursorTool.SELECT);
5993      this.#prevActive ??= prevActive;
5994    };
5995    const enableActive = () => {
5996      const prevActive = this.#prevActive;
5997      if (prevActive !== null && annotationEditorMode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE && presentationModeState === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.NORMAL) {
5998        this.#prevActive = null;
5999        this.switchTool(prevActive);
6000      }
6001    };
6002    this.eventBus._on("secondarytoolbarreset", evt => {
6003      if (this.#prevActive !== null) {
6004        annotationEditorMode = pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE;
6005        presentationModeState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.NORMAL;
6006        enableActive();
6007      }
6008    });
6009    this.eventBus._on("annotationeditormodechanged", ({
6010      mode
6011    }) => {
6012      annotationEditorMode = mode;
6013      if (mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE) {
6014        enableActive();
6015      } else {
6016        disableActive();
6017      }
6018    });
6019    this.eventBus._on("presentationmodechanged", ({
6020      state
6021    }) => {
6022      presentationModeState = state;
6023      if (state === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.NORMAL) {
6024        enableActive();
6025      } else if (state === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.FULLSCREEN) {
6026        disableActive();
6027      }
6028    });
6029  }
6030  get _handTool() {
6031    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.shadow)(this, "_handTool", new _grab_to_pan_js__WEBPACK_IMPORTED_MODULE_2__.GrabToPan({
6032      element: this.container
6033    }));
6034  }
6035}
6036
6037__webpack_async_result__();
6038} catch(e) { __webpack_async_result__(e); } });
6039
6040/***/ }),
6041
6042/***/ 164:
6043/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
6044
6045__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
6046/* harmony export */ __webpack_require__.d(__webpack_exports__, {
6047/* harmony export */   PDFDocumentProperties: () => (/* binding */ PDFDocumentProperties)
6048/* harmony export */ });
6049/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
6050/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2603);
6051var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__]);
6052pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
6053
6054
6055const DEFAULT_FIELD_CONTENT = "-";
6056const NON_METRIC_LOCALES = ["en-us", "en-lr", "my"];
6057const US_PAGE_NAMES = {
6058  "8.5x11": "letter",
6059  "8.5x14": "legal"
6060};
6061const METRIC_PAGE_NAMES = {
6062  "297x420": "a-three",
6063  "210x297": "a-four"
6064};
6065function getPageName(size, isPortrait, pageNames) {
6066  const width = isPortrait ? size.width : size.height;
6067  const height = isPortrait ? size.height : size.width;
6068  return pageNames[`${width}x${height}`];
6069}
6070class PDFDocumentProperties {
6071  #fieldData = null;
6072  constructor({
6073    dialog,
6074    fields,
6075    closeButton
6076  }, overlayManager, eventBus, l10n, fileNameLookup) {
6077    this.dialog = dialog;
6078    this.fields = fields;
6079    this.overlayManager = overlayManager;
6080    this.l10n = l10n;
6081    this._fileNameLookup = fileNameLookup;
6082    this.#reset();
6083    closeButton.addEventListener("click", this.close.bind(this));
6084    this.overlayManager.register(this.dialog);
6085    eventBus._on("pagechanging", evt => {
6086      this._currentPageNumber = evt.pageNumber;
6087    });
6088    eventBus._on("rotationchanging", evt => {
6089      this._pagesRotation = evt.pagesRotation;
6090    });
6091    this._isNonMetricLocale = NON_METRIC_LOCALES.includes(l10n.getLanguage());
6092  }
6093  async open() {
6094    await Promise.all([this.overlayManager.open(this.dialog), this._dataAvailableCapability.promise]);
6095    const currentPageNumber = this._currentPageNumber;
6096    const pagesRotation = this._pagesRotation;
6097    if (this.#fieldData && currentPageNumber === this.#fieldData._currentPageNumber && pagesRotation === this.#fieldData._pagesRotation) {
6098      this.#updateUI();
6099      return;
6100    }
6101    const {
6102      info,
6103      contentLength
6104    } = await this.pdfDocument.getMetadata();
6105    const [fileName, fileSize, creationDate, modificationDate, pageSize, isLinearized] = await Promise.all([this._fileNameLookup(), this.#parseFileSize(contentLength), this.#parseDate(info.CreationDate), this.#parseDate(info.ModDate), this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {
6106      return this.#parsePageSize((0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.getPageSizeInches)(pdfPage), pagesRotation);
6107    }), this.#parseLinearization(info.IsLinearized)]);
6108    this.#fieldData = Object.freeze({
6109      fileName,
6110      fileSize,
6111      title: info.Title,
6112      author: info.Author,
6113      subject: info.Subject,
6114      keywords: info.Keywords,
6115      creationDate,
6116      modificationDate,
6117      creator: info.Creator,
6118      producer: info.Producer,
6119      version: info.PDFFormatVersion,
6120      pageCount: this.pdfDocument.numPages,
6121      pageSize,
6122      linearized: isLinearized,
6123      _currentPageNumber: currentPageNumber,
6124      _pagesRotation: pagesRotation
6125    });
6126    this.#updateUI();
6127    const {
6128      length
6129    } = await this.pdfDocument.getDownloadInfo();
6130    if (contentLength === length) {
6131      return;
6132    }
6133    const data = Object.assign(Object.create(null), this.#fieldData);
6134    data.fileSize = await this.#parseFileSize(length);
6135    this.#fieldData = Object.freeze(data);
6136    this.#updateUI();
6137  }
6138  async close() {
6139    this.overlayManager.close(this.dialog);
6140  }
6141  setDocument(pdfDocument) {
6142    if (this.pdfDocument) {
6143      this.#reset();
6144      this.#updateUI(true);
6145    }
6146    if (!pdfDocument) {
6147      return;
6148    }
6149    this.pdfDocument = pdfDocument;
6150    this._dataAvailableCapability.resolve();
6151  }
6152  #reset() {
6153    this.pdfDocument = null;
6154    this.#fieldData = null;
6155    this._dataAvailableCapability = Promise.withResolvers();
6156    this._currentPageNumber = 1;
6157    this._pagesRotation = 0;
6158  }
6159  #updateUI(reset = false) {
6160    if (reset || !this.#fieldData) {
6161      for (const id in this.fields) {
6162        this.fields[id].textContent = DEFAULT_FIELD_CONTENT;
6163      }
6164      return;
6165    }
6166    if (this.overlayManager.active !== this.dialog) {
6167      return;
6168    }
6169    for (const id in this.fields) {
6170      const content = this.#fieldData[id];
6171      this.fields[id].textContent = content || content === 0 ? content : DEFAULT_FIELD_CONTENT;
6172    }
6173  }
6174  async #parseFileSize(fileSize = 0) {
6175    const kb = fileSize / 1024,
6176      mb = kb / 1024;
6177    if (!kb) {
6178      return undefined;
6179    }
6180    return this.l10n.get(`pdfjs-document-properties-${mb >= 1 ? "mb" : "kb"}`, {
6181      size_mb: mb >
6181= 1 && (+mb.toPrecision(3)).toLocaleString(),
6182      size_kb: mb < 1 && (+kb.toPrecision(3)).toLocaleString(),
6183      size_b: fileSize.toLocaleString()
6184    });
6185  }
6186  async #parsePageSize(pageSizeInches, pagesRotation) {
6187    if (!pageSizeInches) {
6188      return undefined;
6189    }
6190    if (pagesRotation % 180 !== 0) {
6191      pageSizeInches = {
6192        width: pageSizeInches.height,
6193        height: pageSizeInches.width
6194      };
6195    }
6196    const isPortrait = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.isPortraitOrientation)(pageSizeInches);
6197    let sizeInches = {
6198      width: Math.round(pageSizeInches.width * 100) / 100,
6199      height: Math.round(pageSizeInches.height * 100) / 100
6200    };
6201    let sizeMillimeters = {
6202      width: Math.round(pageSizeInches.width * 25.4 * 10) / 10,
6203      height: Math.round(pageSizeInches.height * 25.4 * 10) / 10
6204    };
6205    let rawName = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);
6206    if (!rawName && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) {
6207      const exactMillimeters = {
6208        width: pageSizeInches.width * 25.4,
6209        height: pageSizeInches.height * 25.4
6210      };
6211      const intMillimeters = {
6212        width: Math.round(sizeMillimeters.width),
6213        height: Math.round(sizeMillimeters.height)
6214      };
6215      if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) {
6216        rawName = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);
6217        if (rawName) {
6218          sizeInches = {
6219            width: Math.round(intMillimeters.width / 25.4 * 100) / 100,
6220            height: Math.round(intMillimeters.height / 25.4 * 100) / 100
6221          };
6222          sizeMillimeters = intMillimeters;
6223        }
6224      }
6225    }
6226    const [{
6227      width,
6228      height
6229    }, unit, name, orientation] = await Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get(`pdfjs-document-properties-page-size-unit-${this._isNonMetricLocale ? "inches" : "millimeters"}`), rawName && this.l10n.get(`pdfjs-document-properties-page-size-name-${rawName}`), this.l10n.get(`pdfjs-document-properties-page-size-orientation-${isPortrait ? "portrait" : "landscape"}`)]);
6230    return this.l10n.get(`pdfjs-document-properties-page-size-dimension-${name ? "name-" : ""}string`, {
6231      width: width.toLocaleString(),
6232      height: height.toLocaleString(),
6233      unit,
6234      name,
6235      orientation
6236    });
6237  }
6238  async #parseDate(inputDate) {
6239    const dateObject = pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.PDFDateString.toDateObject(inputDate);
6240    if (!dateObject) {
6241      return undefined;
6242    }
6243    return this.l10n.get("pdfjs-document-properties-date-string", {
6244      date: dateObject.toLocaleDateString(),
6245      time: dateObject.toLocaleTimeString()
6246    });
6247  }
6248  #parseLinearization(isLinearized) {
6249    return this.l10n.get(`pdfjs-document-properties-linearized-${isLinearized ? "yes" : "no"}`);
6250  }
6251}
6252
6253__webpack_async_result__();
6254} catch(e) { __webpack_async_result__(e); } });
6255
6256/***/ }),
6257
6258/***/ 2226:
6259/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
6260
6261/* harmony export */ __webpack_require__.d(__webpack_exports__, {
6262/* harmony export */   PDFFindBar: () => (/* binding */ PDFFindBar)
6263/* harmony export */ });
6264/* harmony import */ var _pdf_find_controller_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9814);
6265/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7256);
6266
6267
6268const MATCHES_COUNT_LIMIT = 1000;
6269class PDFFindBar {
6270  #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));
6271  constructor(options, eventBus) {
6272    this.opened = false;
6273    this.bar = options.bar;
6274    this.toggleButton = options.toggleButton;
6275    this.findField = options.findField;
6276    this.highlightAll = options.highlightAllCheckbox;
6277    this.caseSensitive = options.caseSensitiveCheckbox;
6278    this.matchDiacritics = options.matchDiacriticsCheckbox;
6279    this.entireWord = options.entireWordCheckbox;
6280    this.findMsg = options.findMsg;
6281    this.findResultsCount = options.findResultsCount;
6282    this.findPreviousButton = options.findPreviousButton;
6283    this.findNextButton = options.findNextButton;
6284    this.eventBus = eventBus;
6285    this.toggleButton.addEventListener("click", () => {
6286      this.toggle();
6287    });
6288    this.findField.addEventListener("input", () => {
6289      this.dispatchEvent("");
6290    });
6291    this.bar.addEventListener("keydown", e => {
6292      switch (e.keyCode) {
6293        case 13:
6294          if (e.target === this.findField) {
6295            this.dispatchEvent("again", e.shiftKey);
6296          }
6297          break;
6298        case 27:
6299          this.close();
6300          break;
6301      }
6302    });
6303    this.findPreviousButton.addEventListener("click", () => {
6304      this.dispatchEvent("again", true);
6305    });
6306    this.findNextButton.addEventListener("click", () => {
6307      this.dispatchEvent("again", false);
6308    });
6309    this.highlightAll.addEventListener("click", () => {
6310      this.dispatchEvent("highlightallchange");
6311    });
6312    this.caseSensitive.addEventListener("click", () => {
6313      this.dispatchEvent("casesensitivitychange");
6314    });
6315    this.entireWord.addEventListener("click", () => {
6316      this.dispatchEvent("entirewordchange");
6317    });
6318    this.matchDiacritics.addEventListener("click", () => {
6319      this.dispatchEvent("diacriticmatchingchange");
6320    });
6321  }
6322  reset() {
6323    this.updateUIState();
6324  }
6325  dispatchEvent(type, findPrev = false) {
6326    this.eventBus.dispatch("find", {
6327      source: this,
6328      type,
6329      query: this.findField.value,
6330      caseSensitive: this.caseSensitive.checked,
6331      entireWord: this.entireWord.checked,
6332      highlightAll: this.highlightAll.checked,
6333      findPrevious: findPrev,
6334      matchDiacritics: this.matchDiacritics.checked
6335    });
6336  }
6337  updateUIState(state, previous, matchesCount) {
6338    const {
6339      findField,
6340      findMsg
6341    } = this;
6342    let findMsgId = "",
6343      status = "";
6344    switch (state) {
6345      case _pdf_find_controller_js__WEBPACK_IMPORTED_MODULE_0__.FindState.FOUND:
6346        break;
6347      case _pdf_find_controller_js__WEBPACK_IMPORTED_MODULE_0__.FindState.PENDING:
6348        status = "pending";
6349        break;
6350      case _pdf_find_controller_js__WEBPACK_IMPORTED_MODULE_0__.FindState.NOT_FOUND:
6351        findMsgId = "pdfjs-find-not-found";
6352        status = "notFound";
6353        break;
6354      case _pdf_find_controller_js__WEBPACK_IMPORTED_MODULE_0__.FindState.WRAPPED:
6355        findMsgId = `pdfjs-find-reached-${previous ? "top" : "bottom"}`;
6356        break;
6357    }
6358    findField.setAttribute("data-status", status);
6359    findField.setAttribute("aria-invalid", state === _pdf_find_controller_js__WEBPACK_IMPORTED_MODULE_0__.FindState.NOT_FOUND);
6360    findMsg.setAttribute("data-status", status);
6361    if (findMsgId) {
6362      findMsg.setAttribute("data-l10n-id", findMsgId);
6363    } else {
6364      findMsg.removeAttribute("data-l10n-id");
6365      findMsg.textContent = "";
6366    }
6367    this.updateResultsCount(matchesCount);
6368  }
6369  updateResultsCount({
6370    current = 0,
6371    total = 0
6372  } = {}) {
6373    const {
6374      findResultsCount
6375    } = this;
6376    if (total > 0) {
6377      const limit = MATCHES_COUNT_LIMIT;
6378      findResultsCount.setAttribute("data-l10n-id", `pdfjs-find-match-count${total > limit ? "-limit" : ""}`);
6379      findResultsCount.setAttribute("data-l10n-args", JSON.stringify({
6380        limit,
6381        current,
6382        total
6383      }));
6384    } else {
6385      findResultsCount.removeAttribute("data-l10n-id");
6386      findResultsCount.textContent = "";
6387    }
6388  }
6389  open() {
6390    if (!this.opened) {
6391      this.#resizeObserver.observe(this.bar.parentNode);
6392      this.#resizeObserver.observe(this.bar);
6393      this.opened = true;
6394      (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.toggleExpandedBtn)(this.toggleButton, true, this.bar);
6395    }
6396    this.findField.select();
6397    this.findField.focus();
6398  }
6399  close() {
6400    if (!this.opened) {
6401      return;
6402    }
6403    this.#resizeObserver.disconnect();
6404    this.opened = false;
6405    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.toggleExpandedBtn)(this.toggleButton, false, this.bar);
6406    this.eventBus.dispatch("findbarclose", {
6407      source: this
6408    });
6409  }
6410  toggle() {
6411    if (this.opened) {
6412      this.close();
6413    } else {
6414      this.open();
6415    }
6416  }
6417  #resizeObserverCallback(entries) {
6418    const {
6419      bar
6420    } = this;
6421    bar.classList.remove("wrapContainers");
6422    const findbarHeight = bar.clientHeight;
6423    const inputContainerHeight = bar.firstElementChild.clientHeight;
6424    if (findbarHeight > inputContainerHeight) {
6425      bar.classList.add("wrapContainers");
6426    }
6427  }
6428}
6429
6430
6431/***/ }),
6432
6433/***/ 9814:
6434/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
6435
6436
6437// EXPORTS
6438__webpack_require__.d(__webpack_exports__, {
6439  FindState: () => (/* binding */ FindState),
6440  PDFFindController: () => (/* binding */ PDFFindController)
6441});
6442
6443// EXTERNAL MODULE: ./web/ui_utils.js
6444var ui_utils = __webpack_require__(7256);
6445;// CONCATENATED MODULE: ./web/pdf_find_utils.js
6446const CharacterType = {
6447  SPACE: 0,
6448  ALPHA_LETTER: 1,
6449  PUNCT: 2,
6450  HAN_LETTER: 3,
6451  KATAKANA_LETTER: 4,
6452  HIRAGANA_LETTER: 5,
6453  HALFWIDTH_KATAKANA_LETTER: 6,
6454  THAI_LETTER: 7
6455};
6456function isAlphabeticalScript(charCode) {
6457  return charCode < 0x2e80;
6458}
6459function isAscii(charCode) {
6460  return (charCode & 0xff80) === 0;
6461}
6462function isAsciiAlpha(charCode) {
6463  return charCode >= 0x61 && charCode <= 0x7a || charCode >
6463= 0x41 && charCode <= 0x5a;
6464}
6465function isAsciiDigit(charCode) {
6466  return charCode >= 0x30 && charCode <= 0x39;
6467}
6468function isAsciiSpace(charCode) {
6469  return charCode === 0x20 || charCode === 0x09 || charCode === 0x0d || charCode === 0x0a;
6470}
6471function isHan(charCode) {
6472  return charCode >= 0x3400 && charCode <= 0x9fff || charCode >= 0xf900 && charCode <= 0xfaff;
6473}
6474function isKatakana(charCode) {
6475  return charCode >= 0x30a0 && charCode <= 0x30ff;
6476}
6477function isHiragana(charCode) {
6478  return charCode >= 0x3040 && charCode <= 0x309f;
6479}
6480function isHalfwidthKatakana(charCode) {
6481  return charCode >= 0xff60 && charCode <= 0xff9f;
6482}
6483function isThai(charCode) {
6484  return (charCode & 0xff80) === 0x0e00;
6485}
6486function getCharacterType(charCode) {
6487  if (isAlphabeticalScript(charCode)) {
6488    if (isAscii(charCode)) {
6489      if (isAsciiSpace(charCode)) {
6490        return CharacterType.SPACE;
6491      } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5f) {
6492        return CharacterType.ALPHA_LETTER;
6493      }
6494      return CharacterType.PUNCT;
6495    } else if (isThai(charCode)) {
6496      return CharacterType.THAI_LETTER;
6497    } else if (charCode === 0xa0) {
6498      return CharacterType.SPACE;
6499    }
6500    return CharacterType.ALPHA_LETTER;
6501  }
6502  if (isHan(charCode)) {
6503    return CharacterType.HAN_LETTER;
6504  } else if (isKatakana(charCode)) {
6505    return CharacterType.KATAKANA_LETTER;
6506  } else if (isHiragana(charCode)) {
6507    return CharacterType.HIRAGANA_LETTER;
6508  } else if (isHalfwidthKatakana(charCode)) {
6509    return CharacterType.HALFWIDTH_KATAKANA_LETTER;
6510  }
6511  return CharacterType.ALPHA_LETTER;
6512}
6513let NormalizeWithNFKC;
6514function getNormalizeWithNFKC() {
6515  NormalizeWithNFKC ||= ` ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩`;
6516  return NormalizeWithNFKC;
6517}
6518
6519;// CONCATENATED MODULE: ./web/pdf_find_controller.js
6520
6521
6522const FindState = {
6523  FOUND: 0,
6524  NOT_FOUND: 1,
6525  WRAPPED: 2,
6526  PENDING: 3
6527};
6528const FIND_TIMEOUT = 250;
6529const MATCH_SCROLL_OFFSET_TOP = -50;
6530const MATCH_SCROLL_OFFSET_LEFT = -400;
6531const CHARACTERS_TO_NORMALIZE = {
6532  "\u2010": "-",
6533  "\u2018": "'",
6534  "\u2019": "'",
6535  "\u201A": "'",
6536  "\u201B": "'",
6537  "\u201C": '"',
6538  "\u201D": '"',
6539  "\u201E": '"',
6540  "\u201F": '"',
6541  "\u00BC": "1/4",
6542  "\u00BD": "1/2",
6543  "\u00BE": "3/4"
6544};
6545const DIACRITICS_EXCEPTION = new Set([0x3099, 0x309a, 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b, 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714, 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f, 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed, 0x0c56, 0x0f71, 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80, 0x0f74]);
6546let DIACRITICS_EXCEPTION_STR;
6547const DIACRITICS_REG_EXP = /\p{M}+/gu;
6548const SPECIAL_CHARS_REG_EXP = /([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu;
6549const NOT_DIACRITIC_FROM_END_REG_EXP = /([^\p{M}])\p{M}*$/u;
6550const NOT_DIACRITIC_FROM_START_REG_EXP = /^\p{M}*([^\p{M}])/u;
6551const SYLLABLES_REG_EXP = /[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g;
6552const SYLLABLES_LENGTHS = new Map();
6553const FIRST_CHAR_SYLLABLES_REG_EXP = "[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]";
6554const NFKC_CHARS_TO_NORMALIZE = new Map();
6555let noSyllablesRegExp = null;
6556let withSyllablesRegExp = null;
6557function normalize(text) {
6558  const syllablePositions = [];
6559  let m;
6560  while ((m = SYLLABLES_REG_EXP.exec(text)) !== null) {
6561    let {
6562      index
6563    } = m;
6564    for (const char of m[0]) {
6565      let len = SYLLABLES_LENGTHS.get(char);
6566      if (!len) {
6567        len = char.normalize("NFD").length;
6568        SYLLABLES_LENGTHS.set(char, len);
6569      }
6570      syllablePositions.push([len, index++]);
6571    }
6572  }
6573  let normalizationRegex;
6574  if (syllablePositions.length === 0 && noSyllablesRegExp) {
6575    normalizationRegex = noSyllablesRegExp;
6576  } else if (syllablePositions.length > 0 && withSyllablesRegExp) {
6577    normalizationRegex = withSyllablesRegExp;
6578  } else {
6579    const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join("");
6580    const toNormalizeWithNFKC = getNormalizeWithNFKC();
6581    const CJK = "(?:\\p{Ideographic}|[\u3040-\u30FF])";
6582    const HKDiacritics = "(?:\u3099|\u309A)";
6583    const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(${HKDiacritics}\\n)|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(${CJK}\\n)|(\\n)`;
6584    if (syllablePositions.length === 0) {
6585      normalizationRegex = noSyllablesRegExp = new RegExp(regexp + "|(\\u0000)", "gum");
6586    } else {
6587      normalizationRegex = withSyllablesRegExp = new RegExp(regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`, "gum");
6588    }
6589  }
6590  const rawDiacriticsPositions = [];
6591  while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {
6592    rawDiacriticsPositions.push([m[0].length, m.index]);
6593  }
6594  let normalized = text.normalize("NFD");
6595  const positions = [[0, 0]];
6596  let rawDiacriticsIndex = 0;
6597  let syllableIndex = 0;
6598  let shift = 0;
6599  let shiftOrigin = 0;
6600  let eol = 0;
6601  let hasDiacritics = false;
6602  normalized = normalized.replace(normalizationRegex, (match, p1, p2, p3, p4, p5, p6, p7, p8, i) => {
6603    i -= shiftOrigin;
6604    if (p1) {
6605      const replacement = CHARACTERS_TO_NORMALIZE[p1];
6606      const jj = replacement.length;
6607      for (let j = 1; j < jj; j++) {
6608        positions.push([i - shift + j, shift - j]);
6609      }
6610      shift -= jj - 1;
6611      return replacement;
6612    }
6613    if (p2) {
6614      let replacement = NFKC_CHARS_TO_NORMALIZE.get(p2);
6615      if (!replacement) {
6616        replacement = p2.normalize("NFKC");
6617        NFKC_CHARS_TO_NORMALIZE.set(p2, replacement);
6618      }
6619      const jj = replacement.length;
6620      for (let j = 1; j < jj; j++) {
6621        positions.push([i - shift + j, shift - j]);
6622      }
6623      shift -= jj - 1;
6624      return replacement;
6625    }
6626    if (p3) {
6627      hasDiacritics = true;
6628      if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {
6629        ++rawDiacriticsIndex;
6630      } else {
6631        positions.push([i - 1 - shift + 1, shift - 1]);
6632        shift -= 1;
6633        shiftOrigin += 1;
6634      }
6635      positions.push([i - shift + 1, shift]);
6636      shiftOrigin += 1;
6637      eol += 1;
6638      return p3.charAt(0);
6639    }
6640    if (p4) {
6641      const hasTrailingDashEOL = p4.endsWith("\n");
6642      const len = hasTrailingDashEOL ? p4.length - 2 : p4.length;
6643      hasDiacritics = true;
6644      let jj = len;
6645      if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {
6646        jj -= rawDiacriticsPositions[rawDiacriticsIndex][0];
6647        ++rawDiacriticsIndex;
6648      }
6649      for (let j = 1; j <= jj; j++) {
6650        positions.push([i - 1 - shift + j, shift - j]);
6651      }
6652      shift -= jj;
6653      shiftOrigin += jj;
6654      if (hasTrailingDashEOL) {
6655        i += len - 1;
6656        positions.push([i - shift + 1, 1 + shift]);
6657        shift += 1;
6658        shiftOrigin += 1;
6659        eol += 1;
6660        return p4.slice(0, len);
6661      }
6662      return p4;
6663    }
6664    if (p5) {
6665      const len = p5.length - 2;
6666      positions.push([i - shift + len, 1 + shift]);
6667      shift += 1;
6668      shiftOrigin += 1;
6669      eol += 1;
6670      return p5.slice(0, -2);
6671    }
6672    if (p6) {
6673      const len = p6.length - 1;
6674      positions.push([i - shift + len, shift]);
6675      shiftOrigin += 1;
6676      eol += 1;
6677      return p6.slice(0, -1);
6678    }
6679    if (p7) {
6680      positions.push([i - shift + 1, shift - 1]);
6681      shift -= 1;
6682      shiftOrigin += 1;
6683      eol += 1;
6684      return " ";
6685    }
6686    if (i + eol === syllablePositions[syllableIndex]?.[1]) {
6687      const newCharLen = syllablePositions[syllableIndex][0] - 1;
6688      ++syllableIndex;
6689      for (let j = 1; j <= newCharLen; j++) {
6690        positions.push([i - (shift - j), shift - j]);
6691      }
6692      shift -= newCharLen;
6693      shiftOrigin += newCharLen;
6694    }
6695    return p8;
6696  });
6697  positions.push([normalized.length, shift]);
6698  return [normalized, positions, hasDiacritics];
6699}
6700function getOriginalIndex(diffs, pos, len) {
6701  if (!diffs) {
6702    return [pos, len];
6703  }
6704  const start = pos;
6705  const end = pos + len - 1;
6706  let i = (0,ui_utils.binarySearchFirstItem)(diffs, x => x[0] >= start);
6707  if (diffs[i][0] > start) {
6708    --i;
6709  }
6710  let j = (0,ui_utils.binarySearchFirstItem)(diffs, x => x[0] >= end, i);
6711  if (diffs[j][0] > end) {
6712    --j;
6713  }
6714  const oldStart = start + diffs[i][1];
6715  const oldEnd = end + diffs[j][1];
6716  const oldLen = oldEnd + 1 - oldStart;
6717  return [oldStart, oldLen];
6718}
6719class PDFFindController {
6720  #state = null;
6721  #updateMatchesCountOnProgress = true;
6722  #visitedPagesCount = 0;
6723  constructor({
6724    linkService,
6725    eventBus,
6726    updateMatchesCountOnProgress = true
6727  }) {
6728    this._linkService = linkService;
6729    this._eventBus = eventBus;
6730    this.#updateMatchesCountOnProgress = updateMatchesCountOnProgress;
6731    this.onIsPageVisible = null;
6732    this.#reset();
6733    eventBus._on("find", this.#onFind.bind(this));
6734    eventBus._on("findbarclose", this.#onFindBarClose.bind(this));
6735  }
6736  get highlightMatches() {
6737    return this._highlightMatches;
6738  }
6739  get pageMatches() {
6740    return this._pageMatches;
6741  }
6742  get pageMatchesLength() {
6743    return this._pageMatchesLength;
6744  }
6745  get selected() {
6746    return this._selected;
6747  }
6748  get state() {
6749    return this.#state;
6750  }
6751  setDocument(pdfDocument) {
6752    if (this._pdfDocument) {
6753      this.#reset();
6754    }
6755    if (!pdfDocument) {
6756      return;
6757    }
6758    this._pdfDocument = pdfDocument;
6759    this._firstPageCapability.resolve();
6760  }
6761  #onFind(state) {
6762    if (!state) {
6763      return;
6764    }
6765    const pdfDocument = this._pdfDocument;
6766    const {
6767      type
6768    } = state;
6769    if (this.#state === null || this.#shouldDirtyMatch(state)) {
6770      this._dirtyMatch = true;
6771    }
6772    this.#state = state;
6773    if (type !== "highlightallchange") {
6774      this.#updateUIState(FindState.PENDING);
6775    }
6776    this._firstPageCapability.promise.then(() => {
6777      if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) {
6778        return;
6779      }
6780      this.#extractText();
6781      const findbarClosed = !this._highlightMatches;
6782      const pendingTimeout = !!this._findTimeout;
6783      if (this._findTimeout) {
6784        clearTimeout(this._findTimeout);
6785        this._findTimeout = null;
6786      }
6787      if (!type) {
6788        this._findTimeout = setTimeout(() => {
6789          this.#nextMatch();
6790          this._findTimeout = null;
6791        }, FIND_TIMEOUT);
6792      } else if (this._dirtyMatch) {
6793        this.#nextMatch();
6794      } else if (type === "again") {
6795        this.#nextMatch();
6796        if (findbarClosed && this.#state.highlightAll) {
6797          this.#updateAllPages();
6798        }
6799      } else if (type === "highlightallchange") {
6800        if (pendingTimeout) {
6801          this.#nextMatch();
6802        } else {
6803          this._highlightMatches = true;
6804        }
6805        this.#updateAllPages();
6806      } else {
6807        this.#nextMatch();
6808      }
6809    });
6810  }
6811  scrollMatchIntoView({
6812    element = null,
6813    selectedLeft = 0,
6814    pageIndex = -1,
6815    matchIndex = -1
6816  }) {
6817    if (!this._scrollMatches || !element) {
6818      return;
6819    } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {
6820      return;
6821    } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {
6822      return;
6823    }
6824    this._scrollMatches = false;
6825    const spot = {
6826      top: MATCH_SCROLL_OFFSET_TOP,
6827      left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT
6828    };
6829    (0,ui_utils.scrollIntoView)(element, spot, true);
6830  }
6831  #reset() {
6832    this._highlightMatches = false;
6833    this._scrollMatches = false;
6834    this._pdfDocument = null;
6835    this._pageMatches = [];
6836    this._pageMatchesLength = [];
6837    this.#visitedPagesCount = 0;
6838    this.#state = null;
6839    this._selected = {
6840      pageIdx: -1,
6841      matchIdx: -1
6842    };
6843    this._offset = {
6844      pageIdx: null,
6845      matchIdx: null,
6846      wrapped: false
6847    };
6848    this._extractTextPromises = [];
6849    this._pageContents = [];
6850    this._pageDiffs = [];
6851    this._hasDiacritics = [];
6852    this._matchesCountTotal = 0;
6853    this._pagesToSearch = null;
6854    this._pendingFindMatches = new Set();
6855    this._resumePageIdx = null;
6856    this._dirtyMatch = false;
6857    clearTimeout(this._findTimeout);
6858    this._findTimeout = null;
6859    this._firstPageCapability = Promise.withResolvers();
6860  }
6861  get #query() {
6862    const {
6863      query
6864    } = this.#state;
6865    if (typeof query === "string") {
6866      if (query !== this._rawQuery) {
6867        this._rawQuery = query;
6868        [this._normalizedQuery] = normalize(query);
6869      }
6870      return this._normalizedQuery;
6871    }
6872    return (query || []).filter(q => !!q).map(q => normalize(q)[0]);
6873  }
6874  #shouldDirtyMatch(state) {
6875    const newQuery = state.query,
6876      prevQuery = this.#state.query;
6877    const newType = typeof newQuery,
6878      prevType = typeof prevQuery;
6879    if (newType !== prevType) {
6880      return true;
6881    }
6882    if (newType === "string") {
6883      if (newQuery !== prevQuery) {
6884        return true;
6885      }
6886    } else if (JSON.stringify(newQuery) !== JSON.stringify(prevQuery)) {
6887      return true;
6888    }
6889    switch (state.type) {
6890      case "again":
6891        const pageNumber = this._selected.pageIdx + 1;
6892        const linkService = this._linkService;
6893        return pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !(this.onIsPageVisible?.(pageNumber) ?? true);
6894      case "highlightallchange":
6895        return false;
6896    }
6897    return true;
6898  }
6899  #isEntireWord(content, startIdx, length) {
6900    let match = content.slice(0, startIdx).match(NOT_DIACRITIC_FROM_END_REG_EXP);
6901    if (match) {
6902      const first = content.charCodeAt(startIdx);
6903      const limit = match[1].charCodeAt(0);
6904      if (getCharacterType(first) === getCharacterType(limit)) {
6905        return false;
6906      }
6907    }
6908    match = content.slice(startIdx + length).match(NOT_DIACRITIC_FROM_START_REG_EXP);
6909    if (match) {
6910      const last = content.charCodeAt(startIdx + length - 1);
6911      const limit = match[1].charCodeAt(0);
6912      if (getCharacterType(last) === getCharacterType(limit)) {
6913        return false;
6914      }
6915    }
6916    return true;
6917  }
6918  #calculateRegExpMatch(query, entireWord, pageIndex, pageContent) {
6919    const matches = this._pageMatches[pageIndex] = [];
6920    const matchesLength = this._pageMatchesLength[pageIndex] = [];
6921    if (!query) {
6922      return;
6923    }
6924    const diffs = this._pageDiffs[pageIndex];
6925    let match;
6926    while ((match = query.exec(pageContent)) !== null) {
6927      if (entireWord && !this.#isEntireWord(pageContent, match.index, match[0].length)) {
6928        continue;
6929      }
6930      const [matchPos, matchLen] = getOriginalIndex(diffs, match.index, match[0].length);
6931      if (matchLen) {
6932        matches.push(matchPos);
6933        matchesLength.push(matchLen);
6934      }
6935    }
6936  }
6937  #convertToRegExpString(query, hasDiacritics) {
6938    const {
6939      matchDiacritics
6940    } = this.#state;
6941    let isUnicode = false;
6942    query = query.replaceAll(SPECIAL_CHARS_REG_EXP, (match, p1, p2, p3, p4, p5) => {
6943      if (p1) {
6944        return `[ ]*\\${p1}[ ]*`;
6945      }
6946      if (p2) {
6947        return `[ ]*${p2}[ ]*`;
6948      }
6949      if (p3) {
6950        return "[ ]+";
6951      }
6952      if (matchDiacritics) {
6953        return p4 || p5;
6954      }
6955      if (p4) {
6956        return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : "";
6957      }
6958      if (hasDiacritics) {
6959        isUnicode = true;
6960        return `${p5}\\p{M}*`;
6961      }
6962      return p5;
6963    });
6964    const trailingSpaces = "[ ]*";
6965    if (query.endsWith(trailingSpaces)) {
6966      query = query.slice(0, query.length - trailingSpaces.length);
6967    }
6968    if (matchDiacritics) {
6969      if (hasDiacritics) {
6970        DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(...DIACRITICS_EXCEPTION);
6971        isUnicode = true;
6972        query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\p{M}]|$)`;
6973      }
6974    }
6975    return [isUnicode, query];
6976  }
6977  #calculateMatch(pageIndex) {
6978    let query = this.#query;
6979    if (query.length === 0) {
6980      return;
6981    }
6982    const {
6983      caseSensitive,
6984      entireWord
6985    } = this.#state;
6986    const pageContent = this._pageContents[pageIndex];
6987    const hasDiacritics = this._hasDiacritics[pageIndex];
6988    let isUnicode = false;
6989    if (typeof query === "string") {
6990      [isUnicode, query] = this.#convertToRegExpString(query, hasDiacritics);
6991    } else {
6992      query = query.sort().reverse().map(q => {
6993        const [isUnicodePart, queryPart] = this.#convertToRegExpString(q, hasDiacritics);
6994        isUnicode ||= isUnicodePart;
6995        return `(${queryPart})`;
6996      }).join("|");
6997    }
6998    const flags = `g${isUnicode ? "u" : ""}${caseSensitive ? "" : "i"}`;
6999    query = query ? new RegExp(query, flags) : null;
7000    this.#calculateRegExpMatch(query, entireWord, pageIndex, pageContent);
7001    if (this.#state.highlightAll) {
7002      this.#updatePage(pageIndex);
7003    }
7004    if (this._resumePageIdx === pageIndex) {
7005      this._resumePageIdx = null;
7006      this.#nextPageMatch();
7007    }
7008    const pageMatchesCount = this._pageMatches[pageIndex].length;
7009    this._matchesCountTotal += pageMatchesCount;
7010    if (this.#updateMatchesCountOnProgress) {
7011      if (pageMatchesCount > 0) {
7012        this.#updateUIResultsCount();
7013      }
7014    } else if (++this.#visitedPagesCount === this._linkService.pagesCount) {
7015      this.#updateUIResultsCount();
7016    }
7017  }
7018  #extractText() {
7019    if (this._extractTextPromises.length > 0) {
7020      return;
7021    }
7022    let deferred = Promise.resolve();
7023    const textOptions = {
7024      disableNormalization: true
7025    };
7026    for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {
7027      const {
7028        promise,
7029        resolve
7030      } = Promise.withResolvers();
7031      this._extractTextPromises[i] = promise;
7032      deferred = deferred.then(() => {
7033        return this._pdfDocument.getPage(i + 1).then(pdfPage => pdfPage.getTextContent(textOptions)).then(textContent => {
7034          const strBuf = [];
7035          for (const textItem of textContent.items) {
7036            strBuf.push(textItem.str);
7037            if (textItem.hasEOL) {
7038              strBuf.push("\n");
7039            }
7040          }
7041          [this._pageContents[i], this._pageDiffs[i], this._hasDiacritics[i]] = normalize(strBuf.join(""));
7042          resolve();
7043        }, reason => {
7044          console.error(`Unable to get text content for page ${i + 1}`, reason);
7045          this._pageContents[i] = "";
7046          this._pageDiffs[i] = null;
7047          this._hasDiacritics[i] = false;
7048          resolve();
7049        });
7050      });
7051    }
7052  }
7053  #updatePage(index) {
7054    if (this._scrollMatches && this._selected.pageIdx === index) {
7055      this._linkService.page = index + 1;
7056    }
7057    this._eventBus.dispatch("updatetextlayermatches", {
7058      source: this,
7059      pageIndex: index
7060    });
7061  }
7062  #updateAllPages() {
7063    this._eventBus.dispatch("updatetextlayermatches", {
7064      source: this,
7065      pageIndex: -1
7066    });
7067  }
7068  #nextMatch() {
7069    const previous = this.#state.findPrevious;
7070    const currentPageIndex = this._linkService.page - 1;
7071    const numPages = this._linkService.pagesCount;
7072    this._highlightMatches = true;
7073    if (this._dirtyMatch) {
7074      this._dirtyMatch = false;
7075      this._selected.pageIdx = this._selected.matchIdx = -1;
7076      this._offset.pageIdx = currentPageIndex;
7077      this._offset.matchIdx = null;
7078      this._offset.wrapped = false;
7079      this._resumePageIdx = null;
7080      this._pageMatches.length = 0;
7081      this._pageMatchesLength.length = 0;
7082      this.#visitedPagesCount = 0;
7083      this._matchesCountTotal = 0;
7084      this.#updateAllPages();
7085      for (let i = 0; i < numPages; i++) {
7086        if (this._pendingFindMatches.has(i)) {
7087          continue;
7088        }
7089        this._pendingFindMatches.add(i);
7090        this._extractTextPromises[i].then(() => {
7091          this._pendingFindMatches.delete(i);
7092          this.#calculateMatch(i);
7093        });
7094      }
7095    }
7096    const query = this.#query;
7097    if (query.length === 0) {
7098      this.#updateUIState(FindState.FOUND);
7099      return;
7100    }
7101    if (this._resumePageIdx) {
7102      return;
7103    }
7104    const offset = this._offset;
7105    this._pagesToSearch = numPages;
7106    if (offset.matchIdx !== null) {
7107      const numPageMatches = this._pageMatches[offset.pageIdx].length;
7108      if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) {
7109        offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;
7110        this.#updateMatch(true);
7111        return;
7112      }
7113      this.#advanceOffsetPage(previous);
7114    }
7115    this.#nextPageMatch();
7116  }
7117  #matchesReady(matches) {
7118    const offset = this._offset;
7119    const numMatches = matches.length;
7120    const previous = this.#state.findPrevious;
7121    if (numMatches) {
7122      offset.matchIdx = previous ? numMatches - 1 : 0;
7123      this.#updateMatch(true);
7124      return true;
7125    }
7126    this.#advanceOffsetPage(previous);
7127    if (offset.wrapped) {
7128      offset.matchIdx = null;
7129      if (this._pagesToSearch < 0) {
7130        this.#updateMatch(false);
7131        return true;
7132      }
7133    }
7134    return false;
7135  }
7136  #nextPageMatch() {
7137    if (this._resumePageIdx !== null) {
7138      console.error("There can only be one pending page.");
7139    }
7140    let matches = null;
7141    do {
7142      const pageIdx = this._offset.pageIdx;
7143      matches = this._pageMatches[pageIdx];
7144      if (!matches) {
7145        this._resumePageIdx = pageIdx;
7146        break;
7147      }
7148    } while (!this.#matchesReady(matches));
7149  }
7150  #advanceOffsetPage(previous) {
7151    const offset = this._offset;
7152    const numPages = this._linkService.pagesCount;
7153    offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
7154    offset.matchIdx = null;
7155    this._pagesToSearch--;
7156    if (offset.pageIdx >= numPages || offset.pageIdx < 0) {
7157      offset.pageIdx = previous ? numPages - 1 : 0;
7158      offset.wrapped = true;
7159    }
7160  }
7161  #updateMatch(found = false) {
7162    let state = FindState.NOT_FOUND;
7163    const wrapped = this._offset.wrapped;
7164    this._offset.wrapped = false;
7165    if (found) {
7166      const previousPage = this._selected.pageIdx;
7167      this._selected.pageIdx = this._offset.pageIdx;
7168      this._selected.matchIdx = this._offset.matchIdx;
7169      state = wrapped ? FindState.WRAPPED : FindState.FOUND;
7170      if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {
7171        this.#updatePage(previousPage);
7172      }
7173    }
7174    this.#updateUIState(state, this.#state.findPrevious);
7175    if (this._selected.pageIdx !== -1) {
7176      this._scrollMatches = true;
7177      this.#updatePage(this._selected.pageIdx);
7178    }
7179  }
7180  #onFindBarClose(evt) {
7181    const pdfDocument = this._pdfDocument;
7182    this._firstPageCapability.promise.then(() => {
7183      if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) {
7184        return;
7185      }
7186      if (this._findTimeout) {
7187        clearTimeout(this._findTimeout);
7188        this._findTimeout = null;
7189      }
7190      if (this._resumePageIdx) {
7191        this._resumePageIdx = null;
7192        this._dirtyMatch = true;
7193      }
7194      this.#updateUIState(FindState.FOUND);
7195      this._highlightMatches = false;
7196      this.#updateAllPages();
7197    });
7198  }
7199  #requestMatchesCount() {
7200    const {
7201      pageIdx,
7202      matchIdx
7203    } = this._selected;
7204    let current = 0,
7205      total = this._matchesCountTotal;
7206    if (matchIdx !== -1) {
7207      for (let i = 0; i < pageIdx; i++) {
7208        current += this._pageMatches[i]?.length || 0;
7209      }
7210      current += matchIdx + 1;
7211    }
7212    if (current < 1 || current > total) {
7213      current = total = 0;
7214    }
7215    return {
7216      current,
7217      total
7218    };
7219  }
7220  #updateUIResultsCount() {
7221    this._eventBus.dispatch("updatefindmatchescount", {
7222      source: this,
7223      matchesCount: this.#requestMatchesCount()
7224    });
7225  }
7226  #updateUIState(state, previous = false) {
7227    if (!this.#updateMatchesCountOnProgress && (this.#visitedPagesCount !== this._linkService.pagesCount || state === FindState.PENDING)) {
7228      return;
7229    }
7230    this._eventBus.dispatch("updatefindcontrolstate", {
7231      source: this,
7232      state,
7233      previous,
7234      matchesCount: this.#requestMatchesCount(),
7235      rawQuery: this.#state?.query ?? null
7236    });
7237  }
7238}
7239
7240
7241/***/ }),
7242
7243/***/ 8543:
7244/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7245
7246/* harmony export */ __webpack_require__.d(__webpack_exports__, {
7247/* harmony export */   PDFHistory: () => (/* binding */ PDFHistory)
7248/* harmony export */ });
7249/* unused harmony exports isDestArraysEqual, isDestHashesEqual */
7250/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
7251/* harmony import */ var _event_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5656);
7252
7253
7254const HASH_CHANGE_TIMEOUT = 1000;
7255const POSITION_UPDATED_THRESHOLD = 50;
7256const UPDATE_VIEWAREA_TIMEOUT = 1000;
7257function getCurrentHash() {
7258  return document.location.hash;
7259}
7260class PDFHistory {
7261  constructor({
7262    linkService,
7263    eventBus
7264  }) {
7265    this.linkService = linkService;
7266    this.eventBus = eventBus;
7267    this._initialized = false;
7268    this._fingerprint = "";
7269    this.reset();
7270    this._boundEvents = null;
7271    this.eventBus._on("pagesinit", () => {
7272      this._isPagesLoaded = false;
7273      this.eventBus._on("pagesloaded", evt => {
7274        this._isPagesLoaded = !!evt.pagesCount;
7275      }, {
7276        once: true
7277      });
7278    });
7279  }
7280  initialize({
7281    fingerprint,
7282    resetHistory = false,
7283    updateUrl = false
7284  }) {
7285    if (!fingerprint || typeof fingerprint !== "string") {
7286      console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');
7287      return;
7288    }
7289    if (this._initialized) {
7290      this.reset();
7291    }
7292    const reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint;
7293    this._fingerprint = fingerprint;
7294    this._updateUrl = updateUrl === true;
7295    this._initialized = true;
7296    this._bindEvents();
7297    const state = window.history.state;
7298    this._popStateInProgress = false;
7299    this._blockHashChange = 0;
7300    this._currentHash = getCurrentHash();
7301    this._numPositionUpdates = 0;
7302    this._uid = this._maxUid = 0;
7303    this._destination = null;
7304    this._position = null;
7305    if (!this._isValidState(state, true) || resetHistory) {
7306      const {
7307        hash,
7308        page,
7309        rotation
7310      } = this._parseCurrentHash(true);
7311      if (!hash || reInitialized || resetHistory) {
7312        this._pushOrReplaceState(null, true);
7313        return;
7314      }
7315      this._pushOrReplaceState({
7316        hash,
7317        page,
7318        rotation
7319      }, true);
7320      return;
7321    }
7322    const destination = state.destination;
7323    this._updateInternalState(destination, state.uid, true);
7324    if (destination.rotation !== undefined) {
7325      this._initialRotation = destination.rotation;
7326    }
7327    if (destination.dest) {
7328      this._initialBookmark = JSON.stringify(destination.dest);
7329      this._destination.page = null;
7330    } else if (destination.hash) {
7331      this._initialBookmark = destination.hash;
7332    } else if (destination.page) {
7333      this._initialBookmark = `page=${destination.page}`;
7334    }
7335  }
7336  reset() {
7337    if (this._initialized) {
7338      this._pageHide();
7339      this._initialized = false;
7340      this._unbindEvents();
7341    }
7342    if (this._updateViewareaTimeout) {
7343      clearTimeout(this._updateViewareaTimeout);
7344      this._updateViewareaTimeout = null;
7345    }
7346    this._initialBookmark = null;
7347    this._initialRotation = null;
7348  }
7349  push({
7350    namedDest = null,
7351    explicitDest,
7352    pageNumber
7353  }) {
7354    if (!this._initialized) {
7355      return;
7356    }
7357    if (namedDest && typeof namedDest !== "string") {
7358      console.error("PDFHistory.push: " + `"${namedDest}" is not a valid namedDest parameter.`);
7359      return;
7360    } else if (!Array.isArray(explicitDest)) {
7361      console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`);
7362      return;
7363    } else if (!this._isValidPage(pageNumber)) {
7364      if (pageNumber !== null || this._destination) {
7365        console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`);
7366        return;
7367      }
7368    }
7369    const hash = namedDest || JSON.stringify(explicitDest);
7370    if (!hash) {
7371      return;
7372    }
7373    let forceReplace = false;
7374    if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) {
7375      if (this._destination.page) {
7376        return;
7377      }
7378      forceReplace = true;
7379    }
7380    if (this._popStateInProgress && !forceReplace) {
7381      return;
7382    }
7383    this._pushOrReplaceState({
7384      dest: explicitDest,
7385      hash,
7386      page: pageNumber,
7387      rotation: this.linkService.rotation
7388    }, forceReplace);
7389    if (!this._popStateInProgress) {
7390      this._popStateInProgress = true;
7391      Promise.resolve().then(() => {
7392        this._popStateInProgress = false;
7393      });
7394    }
7395  }
7396  pushPage(pageNumber) {
7397    if (!this._initialized) {
7398      return;
7399    }
7400    if (!this._isValidPage(pageNumber)) {
7401      console.error(`PDFHistory.pushPage: "${pageNumber}" is not a valid page number.`);
7402      return;
7403    }
7404    if (this._destination?.page === pageNumber) {
7405      return;
7406    }
7407    if (this._popStateInProgress) {
7408      return;
7409    }
7410    this._pushOrReplaceState({
7411      dest: null,
7412      hash: `page=${pageNumber}`,
7413      page: pageNumber,
7414      rotation: this.linkService.rotation
7415    });
7416    if (!this._popStateInProgress) {
7417      this._popStateInProgress = true;
7418      Promise.resolve().then(() => {
7419        this._popStateInProgress = false;
7420      });
7421    }
7422  }
7423  pushCurrentPosition() {
7424    if (!this._initialized || this._popStateInProgress) {
7425      return;
7426    }
7427    this._tryPushCurrentPosition();
7428  }
7429  back() {
7430    if (!this._initialized || this._popStateInProgress) {
7431      return;
7432    }
7433    const state = window.history.state;
7434    if (this._isValidState(state) && state.uid > 0) {
7435      window.history.back();
7436    }
7437  }
7438  forward() {
7439    if (!this._initialized || this._popStateInProgress) {
7440      return;
7441    }
7442    const state = window.history.state;
7443    if (this._isValidState(state) && state.uid < this._maxUid) {
7444      window.history.forward();
7445    }
7446  }
7447  get popStateInProgress() {
7448    return this._initialized && (this._popStateInProgress || this._blockHashChange > 0);
7449  }
7450  get initialBookmark() {
7451    return this._initialized ? this._initialBookmark : null;
7452  }
7453  get initialRotation() {
7454    return this._initialized ? this._initialRotation : null;
7455  }
7456  _pushOrReplaceState(destination, forceReplace = false) {
7457    const shouldReplace = forceReplace || !this._destination;
7458    const newState = {
7459      fingerprint: this._fingerprint,
7460      uid: shouldReplace ? this._uid : this._uid + 1,
7461      destination
7462    };
7463    this._updateInternalState(destination, newState.uid);
7464    let newUrl;
7465    if (this._updateUrl && destination?.hash) {
7466      const baseUrl = document.location.href.split("#", 1)[0];
7467      if (!baseUrl.startsWith("file://")) {
7468        newUrl = `${baseUrl}#${destination.hash}`;
7469      }
7470    }
7471    if (shouldReplace) {
7472      window.history.replaceState(newState, "", newUrl);
7473    } else {
7474      window.history.pushState(newState, "", newUrl);
7475    }
7476  }
7477  _tryPushCurrentPosition(temporary = false) {
7478    if (!this._position) {
7479      return;
7480    }
7481    let position = this._position;
7482    if (temporary) {
7483      position = Object.assign(Object.create(null), this._position);
7484      position.temporary = true;
7485    }
7486    if (!this._destination) {
7487      this._pushOrReplaceState(position);
7488      return;
7489    }
7490    if (this._destination.temporary) {
7491      this._pushOrReplaceState(position, true);
7492      return;
7493    }
7494    if (this._destination.hash === position.hash) {
7495      return;
7496    }
7497    if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) {
7498      return;
7499    }
7500    let forceReplace = false;
7501    if (this._destination.page >= position.first && this._destination.page <= position.page) {
7502      if (this._destination.dest !== undefined || !this._destination.first) {
7503        return;
7504      }
7505      forceReplace = true;
7506    }
7507    this._pushOrReplaceState(position, forceReplace);
7508  }
7509  _isValidPage(val) {
7510    return Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount;
7511  }
7512  _isValidState(state, checkReload = false) {
7513    if (!state) {
7514      return false;
7515    }
7516    if (state.fingerprint !== this._fingerprint) {
7517      if (checkReload) {
7518        if (typeof state.fingerprint !== "string" || state.fingerprint.length !== this._fingerprint.length) {
7519          return false;
7520        }
7521        const [perfEntry] = performance.getEntriesByType("navigation");
7522        if (perfEntry?.type !== "reload") {
7523          return false;
7524        }
7525      } else {
7526        return false;
7527      }
7528    }
7529    if (!Number.isInteger(state.uid) || state.uid < 0) {
7530      return false;
7531    }
7532    if (state.destination === null || typeof state.destination !== "object") {
7533      return false;
7534    }
7535    return true;
7536  }
7537  _updateInternalState(destination, uid, removeTemporary = false) {
7538    if (this._updateViewareaTimeout) {
7539      clearTimeout(this._updateViewareaTimeout);
7540      this._updateViewareaTimeout = null;
7541    }
7542    if (removeTemporary && destination?.temporary) {
7543      delete destination.temporary;
7544    }
7545    this._destination = destination;
7546    this._uid = uid;
7547    this._maxUid = Math.max(this._maxUid, uid);
7548    this._numPositionUpdates = 0;
7549  }
7550  _parseCurrentHash(checkNameddest = false) {
7551    const hash = unescape(getCurrentHash()).substring(1);
7552    const params = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.parseQueryString)(h
7552ash);
7553    const nameddest = params.get("nameddest") || "";
7554    let page = params.get("page") | 0;
7555    if (!this._isValidPage(page) || checkNameddest && nameddest.length > 0) {
7556      page = null;
7557    }
7558    return {
7559      hash,
7560      page,
7561      rotation: this.linkService.rotation
7562    };
7563  }
7564  _updateViewarea({
7565    location
7566  }) {
7567    if (this._updateViewareaTimeout) {
7568      clearTimeout(this._updateViewareaTimeout);
7569      this._updateViewareaTimeout = null;
7570    }
7571    this._position = {
7572      hash: location.pdfOpenParams.substring(1),
7573      page: this.linkService.page,
7574      first: location.pageNumber,
7575      rotation: location.rotation
7576    };
7577    if (this._popStateInProgress) {
7578      return;
7579    }
7580    if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) {
7581      this._numPositionUpdates++;
7582    }
7583    if (UPDATE_VIEWAREA_TIMEOUT > 0) {
7584      this._updateViewareaTimeout = setTimeout(() => {
7585        if (!this._popStateInProgress) {
7586          this._tryPushCurrentPosition(true);
7587        }
7588        this._updateViewareaTimeout = null;
7589      }, UPDATE_VIEWAREA_TIMEOUT);
7590    }
7591  }
7592  _popState({
7593    state
7594  }) {
7595    const newHash = getCurrentHash(),
7596      hashChanged = this._currentHash !== newHash;
7597    this._currentHash = newHash;
7598    if (!state) {
7599      this._uid++;
7600      const {
7601        hash,
7602        page,
7603        rotation
7604      } = this._parseCurrentHash();
7605      this._pushOrReplaceState({
7606        hash,
7607        page,
7608        rotation
7609      }, true);
7610      return;
7611    }
7612    if (!this._isValidState(state)) {
7613      return;
7614    }
7615    this._popStateInProgress = true;
7616    if (hashChanged) {
7617      this._blockHashChange++;
7618      (0,_event_utils_js__WEBPACK_IMPORTED_MODULE_1__.waitOnEventOrTimeout)({
7619        target: window,
7620        name: "hashchange",
7621        delay: HASH_CHANGE_TIMEOUT
7622      }).then(() => {
7623        this._blockHashChange--;
7624      });
7625    }
7626    const destination = state.destination;
7627    this._updateInternalState(destination, state.uid, true);
7628    if ((0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.isValidRotation)(destination.rotation)) {
7629      this.linkService.rotation = destination.rotation;
7630    }
7631    if (destination.dest) {
7632      this.linkService.goToDestination(destination.dest);
7633    } else if (destination.hash) {
7634      this.linkService.setHash(destination.hash);
7635    } else if (destination.page) {
7636      this.linkService.page = destination.page;
7637    }
7638    Promise.resolve().then(() => {
7639      this._popStateInProgress = false;
7640    });
7641  }
7642  _pageHide() {
7643    if (!this._destination || this._destination.temporary) {
7644      this._tryPushCurrentPosition();
7645    }
7646  }
7647  _bindEvents() {
7648    if (this._boundEvents) {
7649      return;
7650    }
7651    this._boundEvents = {
7652      updateViewarea: this._updateViewarea.bind(this),
7653      popState: this._popState.bind(this),
7654      pageHide: this._pageHide.bind(this)
7655    };
7656    this.eventBus._on("updateviewarea", this._boundEvents.updateViewarea);
7657    window.addEventListener("popstate", this._boundEvents.popState);
7658    window.addEventListener("pagehide", this._boundEvents.pageHide);
7659  }
7660  _unbindEvents() {
7661    if (!this._boundEvents) {
7662      return;
7663    }
7664    this.eventBus._off("updateviewarea", this._boundEvents.updateViewarea);
7665    window.removeEventListener("popstate", this._boundEvents.popState);
7666    window.removeEventListener("pagehide", this._boundEvents.pageHide);
7667    this._boundEvents = null;
7668  }
7669}
7670function isDestHashesEqual(destHash, pushHash) {
7671  if (typeof destHash !== "string" || typeof pushHash !== "string") {
7672    return false;
7673  }
7674  if (destHash === pushHash) {
7675    return true;
7676  }
7677  const nameddest = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.parseQueryString)(destHash).get("nameddest");
7678  if (nameddest === pushHash) {
7679    return true;
7680  }
7681  return false;
7682}
7683function isDestArraysEqual(firstDest, secondDest) {
7684  function isEntryEqual(first, second) {
7685    if (typeof first !== typeof second) {
7686      return false;
7687    }
7688    if (Array.isArray(first) || Array.isArray(second)) {
7689      return false;
7690    }
7691    if (first !== null && typeof first === "object" && second !== null) {
7692      if (Object.keys(first).length !== Object.keys(second).length) {
7693        return false;
7694      }
7695      for (const key in first) {
7696        if (!isEntryEqual(first[key], second[key])) {
7697          return false;
7698        }
7699      }
7700      return true;
7701    }
7702    return first === second || Number.isNaN(first) && Number.isNaN(second);
7703  }
7704  if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {
7705    return false;
7706  }
7707  if (firstDest.length !== secondDest.length) {
7708    return false;
7709  }
7710  for (let i = 0, ii = firstDest.length; i < ii; i++) {
7711    if (!isEntryEqual(firstDest[i], secondDest[i])) {
7712      return false;
7713    }
7714  }
7715  return true;
7716}
7717
7718
7719/***/ }),
7720
7721/***/ 4275:
7722/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7723
7724/* harmony export */ __webpack_require__.d(__webpack_exports__, {
7725/* harmony export */   PDFLayerViewer: () => (/* binding */ PDFLayerViewer)
7726/* harmony export */ });
7727/* harmony import */ var _base_tree_viewer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2961);
7728
7729class PDFLayerViewer extends _base_tree_viewer_js__WEBPACK_IMPORTED_MODULE_0__.BaseTreeViewer {
7730  constructor(options) {
7731    super(options);
7732    this.eventBus._on("optionalcontentconfigchanged", evt => {
7733      this.#updateLayers(evt.promise);
7734    });
7735    this.eventBus._on("resetlayers", () => {
7736      this.#updateLayers();
7737    });
7738    this.eventBus._on("togglelayerstree", this._toggleAllTreeItems.bind(this));
7739  }
7740  reset() {
7741    super.reset();
7742    this._optionalContentConfig = null;
7743    this._optionalContentHash = null;
7744  }
7745  _dispatchEvent(layersCount) {
7746    this.eventBus.dispatch("layersloaded", {
7747      source: this,
7748      layersCount
7749    });
7750  }
7751  _bindLink(element, {
7752    groupId,
7753    input
7754  }) {
7755    const setVisibility = () => {
7756      this._optionalContentConfig.setVisibility(groupId, input.checked);
7757      this._optionalContentHash = this._optionalContentConfig.getHash();
7758      this.eventBus.dispatch("optionalcontentconfig", {
7759        source: this,
7760        promise: Promise.resolve(this._optionalContentConfig)
7761      });
7762    };
7763    element.onclick = evt => {
7764      if (evt.target === input) {
7765        setVisibility();
7766        return true;
7767      } else if (evt.target !== element) {
7768        return true;
7769      }
7770      input.checked = !input.checked;
7771      setVisibility();
7772      return false;
7773    };
7774  }
7775  async _setNestedName(element, {
7776    name = null
7777  }) {
7778    if (typeof name === "string") {
7779      element.textContent = this._normalizeTextContent(name);
7780      return;
7781    }
7782    element.textContent = await this._l10n.get("pdfjs-additional-layers");
7783    element.style.fontStyle = "italic";
7784  }
7785  _addToggleButton(div, {
7786    name = null
7787  }) {
7788    super._addToggleButton(div, name === null);
7789  }
7790  _toggleAllTreeItems() {
7791    if (!this._optionalContentConfig) {
7792      return;
7793    }
7794    super._toggleAllTreeItems();
7795  }
7796  render({
7797    optionalContentConfig,
7798    pdfDocument
7799  }) {
7800    if (this._optionalContentConfig) {
7801      this.reset();
7802    }
7803    this._optionalContentConfig = optionalContentConfig || null;
7804    this._pdfDocument = pdfDocument || null;
7805    const groups = optionalContentConfig?.getOrder();
7806    if (!groups) {
7807      this._dispatchEvent(0);
7808      return;
7809    }
7810    this._optionalContentHash = optionalContentConfig.getHash();
7811    const fragment = document.createDocumentFragment(),
7812      queue = [{
7813        parent: fragment,
7814        groups
7815      }];
7816    let layersCount = 0,
7817      hasAnyNesting = false;
7818    while (queue.length > 0) {
7819      const levelData = queue.shift();
7820      for (const groupId of levelData.groups) {
7821        const div = document.createElement("div");
7822        div.className = "treeItem";
7823        const element = document.createElement("a");
7824        div.append(element);
7825        if (typeof groupId === "object") {
7826          hasAnyNesting = true;
7827          this._addToggleButton(div, groupId);
7828          this._setNestedName(element, groupId);
7829          const itemsDiv = document.createElement("div");
7830          itemsDiv.className = "treeItems";
7831          div.append(itemsDiv);
7832          queue.push({
7833            parent: itemsDiv,
7834            groups: groupId.order
7835          });
7836        } else {
7837          const group = optionalContentConfig.getGroup(groupId);
7838          const input = document.createElement("input");
7839          this._bindLink(element, {
7840            groupId,
7841            input
7842          });
7843          input.type = "checkbox";
7844          input.checked = group.visible;
7845          const label = document.createElement("label");
7846          label.textContent = this._normalizeTextContent(group.name);
7847          label.append(input);
7848          element.append(label);
7849          layersCount++;
7850        }
7851        levelData.parent.append(div);
7852      }
7853    }
7854    this._finishRendering(fragment, layersCount, hasAnyNesting);
7855  }
7856  async #updateLayers(promise = null) {
7857    if (!this._optionalContentConfig) {
7858      return;
7859    }
7860    const pdfDocument = this._pdfDocument;
7861    const optionalContentConfig = await (promise || pdfDocument.getOptionalContentConfig({
7862      intent: "display"
7863    }));
7864    if (pdfDocument !== this._pdfDocument) {
7865      return;
7866    }
7867    if (promise) {
7868      if (optionalContentConfig.getHash() === this._optionalContentHash) {
7869        return;
7870      }
7871    } else {
7872      this.eventBus.dispatch("optionalcontentconfig", {
7873        source: this,
7874        promise: Promise.resolve(optionalContentConfig)
7875      });
7876    }
7877    this.render({
7878      optionalContentConfig,
7879      pdfDocument: this._pdfDocument
7880    });
7881  }
7882}
7883
7884
7885/***/ }),
7886
7887/***/ 787:
7888/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7889
7890/* harmony export */ __webpack_require__.d(__webpack_exports__, {
7891/* harmony export */   LinkTarget: () => (/* binding */ LinkTarget),
7892/* harmony export */   PDFLinkService: () => (/* binding */ PDFLinkService),
7893/* harmony export */   SimpleLinkService: () => (/* binding */ SimpleLinkService)
7894/* harmony export */ });
7895/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
7896
7897const DEFAULT_LINK_REL = "noopener noreferrer nofollow";
7898const LinkTarget = {
7899  NONE: 0,
7900  SELF: 1,
7901  BLANK: 2,
7902  PARENT: 3,
7903  TOP: 4
7904};
7905function addLinkAttributes(link, {
7906  url,
7907  target,
7908  rel,
7909  enabled = true
7910} = {}) {
7911  if (!url || typeof url !== "string") {
7912    throw new Error('A valid "url" parameter must provided.');
7913  }
7914  if (enabled) {
7915    link.href = link.title = url;
7916  } else {
7917    link.href = "";
7918    link.title = `Disabled: ${url}`;
7919    link.onclick = () => false;
7920  }
7921  let targetStr = "";
7922  switch (target) {
7923    case LinkTarget.NONE:
7924      break;
7925    case LinkTarget.SELF:
7926      targetStr = "_self";
7927      break;
7928    case LinkTarget.BLANK:
7929      targetStr = "_blank";
7930      break;
7931    case LinkTarget.PARENT:
7932      targetStr = "_parent";
7933      break;
7934    case LinkTarget.TOP:
7935      targetStr = "_top";
7936      break;
7937  }
7938  link.target = targetStr;
7939  link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL;
7940}
7941class PDFLinkService {
7942  #pagesRefCache = new Map();
7943  constructor({
7944    eventBus,
7945    externalLinkTarget = null,
7946    externalLinkRel = null,
7947    ignoreDestinationZoom = false
7948  } = {}) {
7949    this.eventBus = eventBus;
7950    this.externalLinkTarget = externalLinkTarget;
7951    this.externalLinkRel = externalLinkRel;
7952    this.externalLinkEnabled = true;
7953    this._ignoreDestinationZoom = ignoreDestinationZoom;
7954    this.baseUrl = null;
7955    this.pdfDocument = null;
7956    this.pdfViewer = null;
7957    this.pdfHistory = null;
7958  }
7959  setDocument(pdfDocument, baseUrl = null) {
7960    this.baseUrl = baseUrl;
7961    this.pdfDocument = pdfDocument;
7962    this.#pagesRefCache.clear();
7963  }
7964  setViewer(pdfViewer) {
7965    this.pdfViewer = pdfViewer;
7966  }
7967  setHistory(pdfHistory) {
7968    this.pdfHistory = pdfHistory;
7969  }
7970  get pagesCount() {
7971    return this.pdfDocument ? this.pdfDocument.numPages : 0;
7972  }
7973  get page() {
7974    return this.pdfViewer.currentPageNumber;
7975  }
7976  set page(value) {
7977    this.pdfViewer.currentPageNumber = value;
7978  }
7979  get rotation() {
7980    return this.pdfViewer.pagesRotation;
7981  }
7982  set rotation(value) {
7983    this.pdfViewer.pagesRotation = value;
7984  }
7985  get isInPresentationMode() {
7986    return this.pdfViewer.isInPresentationMode;
7987  }
7988  #goToDestinationHelper(rawDest, namedDest = null, explicitDest) {
7989    const destRef = explicitDest[0];
7990    let pageNumber;
7991    if (typeof destRef === "object" && destRef !== null) {
7992      pageNumber = this._cachedPageNumber(destRef);
7993      if (!pageNumber) {
7994        this.pdfDocument.getPageIndex(destRef).then(pageIndex => {
7995          this.cachePageRef(pageIndex + 1, destRef);
7996          this.#goToDestinationHelper(rawDest, namedDest, explicitDest);
7997        }).catch(() => {
7998          console.error(`PDFLinkService.#goToDestinationHelper: "${destRef}" is not ` + `a valid page reference, for dest="${rawDest}".`);
7999        });
8000        return;
8001      }
8002    } else if (Number.isInteger(destRef)) {
8003      pageNumber = destRef + 1;
8004    } else {
8005      console.error(`PDFLinkService.#goToDestinationHelper: "${destRef}" is not ` + `a valid destination reference, for dest="${rawDest}".`);
8006      return;
8007    }
8008    if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {
8009      console.error(`PDFLinkService.#goToDestinationHelper: "${pageNumber}" is not ` + `a valid page number, for dest="${rawDest}".`);
8010      return;
8011    }
8012    if (this.pdfHistory) {
8013      this.pdfHistory.pushCurrentPosition();
8014      this.pdfHistory.push({
8015        namedDest,
8016        explicitDest,
8017        pageNumber
8018      });
8019    }
8020    this.pdfViewer.scrollPageIntoView({
8021      pageNumber,
8022      destArray: explicitDest,
8023      ignoreDestinationZoom: this._ignoreDestinationZoom
8024    });
8025  }
8026  async goToDestination(dest) {
8027    if (!this.pdfDocument) {
8028      return;
8029    }
8030    let namedDest, explicitDest;
8031    if (typeof dest === "string") {
8032      namedDest = dest;
8033      explicitDest = await this.pdfDocument.getDestination(dest);
8034    } else {
8035      namedDest = null;
8036      explicitDest = await dest;
8037    }
8038    if (!Array.isArray(explicitDest)) {
8039      console.error(`PDFLinkService.goToDestination: "${explicitDest}" is not ` + `a valid destination array, for dest="${dest}".`);
8040      return;
8041    }
8042    this.#goToDestinationHelper(dest, namedDest, explicitDest);
8043  }
8044  goToPage(val) {
8045    if (!this.pdfDocument) {
8046      return;
8047    }
8048    const pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0;
8049    if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
8050      console.error(`PDFLinkService.goToPage: "${val}" is not a valid page.`);
8051      return;
8052    }
8053    if (this.pdfHistory) {
8054      this.pdfHistory.pushCurrentPosition();
8055      this.pdfHistory.pushPage(pageNumber);
8056    }
8057    this.pdfViewer.scrollPageIntoView({
8058      pageNumber
8059    });
8060  }
8061  addLinkAttributes(link, url, newWindow = false) {
8062    addLinkAttributes(link, {
8063      url,
8064      target: newWindow ? LinkTarget.BLANK : this.externalLinkTarget,
8065      rel: this.externalLinkRel,
8066      enabled: this.externalLinkEnabled
8067    });
8068  }
8069  getDestinationHash(dest) {
8070    if (typeof dest === "string") {
8071      if (dest.length > 0) {
8072        return this.getAnchorUrl("#" + escape(dest));
8073      }
8074    } else if (Array.isArray(dest)) {
8075      const str = JSON.stringify(dest);
8076      if (str.length > 0) {
8077        return this.getAnchorUrl("#" + escape(str));
8078      }
8079    }
8080    return this.getAnchorUrl("");
8081  }
8082  getAnchorUrl(anchor) {
8083    return this.baseUrl ? this.baseUrl + anchor : anchor;
8084  }
8085  setHash(hash) {
8086    if (!this.pdfDocument) {
8087      return;
8088    }
8089    let pageNumber, dest;
8090    if (hash.includes("=")) {
8091      const params = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.parseQueryString)(h
8091ash);
8092      if (params.has("search")) {
8093        const query = params.get("search").replaceAll('"', ""),
8094          phrase = params.get("phrase") === "true";
8095        this.eventBus.dispatch("findfromurlhash", {
8096          source: this,
8097          query: phrase ? query : query.match(/\S+/g)
8098        });
8099      }
8100      if (params.has("page")) {
8101        pageNumber = params.get("page") | 0 || 1;
8102      }
8103      if (params.has("zoom")) {
8104        const zoomArgs = params.get("zoom").split(",");
8105        const zoomArg = zoomArgs[0];
8106        const zoomArgNumber = parseFloat(zoomArg);
8107        if (!zoomArg.includes("Fit")) {
8108          dest = [null, {
8109            name: "XYZ"
8110          }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg];
8111        } else if (zoomArg === "Fit" || zoomArg === "FitB") {
8112          dest = [null, {
8113            name: zoomArg
8114          }];
8115        } else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") {
8116          dest = [null, {
8117            name: zoomArg
8118          }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null];
8119        } else if (zoomArg === "FitR") {
8120          if (zoomArgs.length !== 5) {
8121            console.error('PDFLinkService.setHash: Not enough parameters for "FitR".');
8122          } else {
8123            dest = [null, {
8124              name: zoomArg
8125            }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0];
8126          }
8127        } else {
8128          console.error(`PDFLinkService.setHash: "${zoomArg}" is not a valid zoom value.`);
8129        }
8130      }
8131      if (dest) {
8132        this.pdfViewer.scrollPageIntoView({
8133          pageNumber: pageNumber || this.page,
8134          destArray: dest,
8135          allowNegativeOffset: true
8136        });
8137      } else if (pageNumber) {
8138        this.page = pageNumber;
8139      }
8140      if (params.has("pagemode")) {
8141        this.eventBus.dispatch("pagemode", {
8142          source: this,
8143          mode: params.get("pagemode")
8144        });
8145      }
8146      if (params.has("nameddest")) {
8147        this.goToDestination(params.get("nameddest"));
8148      }
8149      return;
8150    }
8151    dest = unescape(hash);
8152    try {
8153      dest = JSON.parse(dest);
8154      if (!Array.isArray(dest)) {
8155        dest = dest.toString();
8156      }
8157    } catch {}
8158    if (typeof dest === "string" || PDFLinkService.#isValidExplicitDestination(dest)) {
8159      this.goToDestination(dest);
8160      return;
8161    }
8162    console.error(`PDFLinkService.setHash: "${unescape(hash)}" is not a valid destination.`);
8163  }
8164  executeNamedAction(action) {
8165    switch (action) {
8166      case "GoBack":
8167        this.pdfHistory?.back();
8168        break;
8169      case "GoForward":
8170        this.pdfHistory?.forward();
8171        break;
8172      case "NextPage":
8173        this.pdfViewer.nextPage();
8174        break;
8175      case "PrevPage":
8176        this.pdfViewer.previousPage();
8177        break;
8178      case "LastPage":
8179        this.page = this.pagesCount;
8180        break;
8181      case "FirstPage":
8182        this.page = 1;
8183        break;
8184      default:
8185        break;
8186    }
8187    this.eventBus.dispatch("namedaction", {
8188      source: this,
8189      action
8190    });
8191  }
8192  async executeSetOCGState(action) {
8193    const pdfDocument = this.pdfDocument;
8194    const optionalContentConfig = await this.pdfViewer.optionalContentConfigPromise;
8195    if (pdfDocument !== this.pdfDocument) {
8196      return;
8197    }
8198    optionalContentConfig.setOCGState(action);
8199    this.pdfViewer.optionalContentConfigPromise = Promise.resolve(optionalContentConfig);
8200  }
8201  cachePageRef(pageNum, pageRef) {
8202    if (!pageRef) {
8203      return;
8204    }
8205    const refStr = pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;
8206    this.#pagesRefCache.set(refStr, pageNum);
8207  }
8208  _cachedPageNumber(pageRef) {
8209    if (!pageRef) {
8210      return null;
8211    }
8212    const refStr = pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;
8213    return this.#pagesRefCache.get(refStr) || null;
8214  }
8215  static #isValidExplicitDestination(dest) {
8216    if (!Array.isArray(dest)) {
8217      return false;
8218    }
8219    const destLength = dest.length;
8220    if (destLength < 2) {
8221      return false;
8222    }
8223    const page = dest[0];
8224    if (!(typeof page === "object" && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) {
8225      return false;
8226    }
8227    const zoom = dest[1];
8228    if (!(typeof zoom === "object" && typeof zoom.name === "string")) {
8229      return false;
8230    }
8231    let allowNull = true;
8232    switch (zoom.name) {
8233      case "XYZ":
8234        if (destLength !== 5) {
8235          return false;
8236        }
8237        break;
8238      case "Fit":
8239      case "FitB":
8240        return destLength === 2;
8241      case "FitH":
8242      case "FitBH":
8243      case "FitV":
8244      case "FitBV":
8245        if (destLength !== 3) {
8246          return false;
8247        }
8248        break;
8249      case "FitR":
8250        if (destLength !== 6) {
8251          return false;
8252        }
8253        allowNull = false;
8254        break;
8255      default:
8256        return false;
8257    }
8258    for (let i = 2; i < destLength; i++) {
8259      const param = dest[i];
8260      if (!(typeof param === "number" || allowNull && param === null)) {
8261        return false;
8262      }
8263    }
8264    return true;
8265  }
8266}
8267class SimpleLinkService {
8268  constructor() {
8269    this.externalLinkEnabled = true;
8270  }
8271  get pagesCount() {
8272    return 0;
8273  }
8274  get page() {
8275    return 0;
8276  }
8277  set page(value) {}
8278  get rotation() {
8279    return 0;
8280  }
8281  set rotation(value) {}
8282  get isInPresentationMode() {
8283    return false;
8284  }
8285  async goToDestination(dest) {}
8286  goToPage(val) {}
8287  addLinkAttributes(link, url, newWindow = false) {
8288    addLinkAttributes(link, {
8289      url,
8290      enabled: this.externalLinkEnabled
8291    });
8292  }
8293  getDestinationHash(dest) {
8294    return "#";
8295  }
8296  getAnchorUrl(hash) {
8297    return "#";
8298  }
8299  setHash(hash) {}
8300  executeNamedAction(action) {}
8301  executeSetOCGState(action) {}
8302  cachePageRef(pageNum, pageRef) {}
8303}
8304
8305
8306/***/ }),
8307
8308/***/ 5514:
8309/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
8310
8311/* harmony export */ __webpack_require__.d(__webpack_exports__, {
8312/* harmony export */   PDFOutlineViewer: () => (/* binding */ PDFOutlineViewer)
8313/* harmony export */ });
8314/* harmony import */ var _base_tree_viewer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2961);
8315/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7256);
8316
8317
8318class PDFOutlineViewer extends _base_tree_viewer_js__WEBPACK_IMPORTED_MODULE_0__.BaseTreeViewer {
8319  constructor(options) {
8320    super(options);
8321    this.linkService = options.linkService;
8322    this.downloadManager = options.downloadManager;
8323    this.eventBus._on("toggleoutlinetree", this._toggleAllTreeItems.bind(this));
8324    this.eventBus._on("currentoutlineitem", this._currentOutlineItem.bind(this));
8325    this.eventBus._on("pagechanging", evt => {
8326      this._currentPageNumber = evt.pageNumber;
8327    });
8328    this.eventBus._on("pagesloaded", evt => {
8329      this._isPagesLoaded = !!evt.pagesCount;
8330      this._currentOutlineItemCapability?.resolve(this._isPagesLoaded);
8331    });
8332    this.eventBus._on("sidebarviewchanged", evt => {
8333      this._sidebarView = evt.view;
8334    });
8335  }
8336  reset() {
8337    super.reset();
8338    this._outline = null;
8339    this._pageNumberToDestHashCapability = null;
8340    this._currentPageNumber = 1;
8341    this._isPagesLoaded = null;
8342    this._currentOutlineItemCapability?.resolve(false);
8343    this._currentOutlineItemCapability = null;
8344  }
8345  _dispatchEvent(outlineCount) {
8346    this._currentOutlineItemCapability = Promise.withResolvers();
8347    if (outlineCount === 0 || this._pdfDocument?.loadingParams.disableAutoFetch) {
8348      this._currentOutlineItemCapability.resolve(false);
8349    } else if (this._isPagesLoaded !== null) {
8350      this._currentOutlineItemCapability.resolve(this._isPagesLoaded);
8351    }
8352    this.eventBus.dispatch("outlineloaded", {
8353      source: this,
8354      outlineCount,
8355      currentOutlineItemPromise: this._currentOutlineItemCapability.promise
8356    });
8357  }
8358  _bindLink(element, {
8359    url,
8360    newWindow,
8361    action,
8362    attachment,
8363    dest,
8364    setOCGState
8365  }) {
8366    const {
8367      linkService
8368    } = this;
8369    if (url) {
8370      linkService.addLinkAttributes(element, url, newWindow);
8371      return;
8372    }
8373    if (action) {
8374      element.href = linkService.getAnchorUrl("");
8375      element.onclick = () => {
8376        linkService.executeNamedAction(action);
8377        return false;
8378      };
8379      return;
8380    }
8381    if (attachment) {
8382      element.href = linkService.getAnchorUrl("");
8383      element.onclick = () => {
8384        this.downloadManager.openOrDownloadData(attachment.content, attachment.filename);
8385        return false;
8386      };
8387      return;
8388    }
8389    if (setOCGState) {
8390      element.href = linkService.getAnchorUrl("");
8391      element.onclick = () => {
8392        linkService.executeSetOCGState(setOCGState);
8393        return false;
8394      };
8395      return;
8396    }
8397    element.href = linkService.getDestinationHash(dest);
8398    element.onclick = evt => {
8399      this._updateCurrentTreeItem(evt.target.parentNode);
8400      if (dest) {
8401        linkService.goToDestination(dest);
8402      }
8403      return false;
8404    };
8405  }
8406  _setStyles(element, {
8407    bold,
8408    italic
8409  }) {
8410    if (bold) {
8411      element.style.fontWeight = "bold";
8412    }
8413    if (italic) {
8414      element.style.fontStyle = "italic";
8415    }
8416  }
8417  _addToggleButton(div, {
8418    count,
8419    items
8420  }) {
8421    let hidden = false;
8422    if (count < 0) {
8423      let totalCount = items.length;
8424      if (totalCount > 0) {
8425        const queue = [...items];
8426        while (queue.length > 0) {
8427          const {
8428            count: nestedCount,
8429            items: nestedItems
8430          } = queue.shift();
8431          if (nestedCount > 0 && nestedItems.length > 0) {
8432            totalCount += nestedItems.length;
8433            queue.push(...nestedItems);
8434          }
8435        }
8436      }
8437      if (Math.abs(count) === totalCount) {
8438        hidden = true;
8439      }
8440    }
8441    super._addToggleButton(div, hidden);
8442  }
8443  _toggleAllTreeItems() {
8444    if (!this._outline) {
8445      return;
8446    }
8447    super._toggleAllTreeItems();
8448  }
8449  render({
8450    outline,
8451    pdfDocument
8452  }) {
8453    if (this._outline) {
8454      this.reset();
8455    }
8456    this._outline = outline || null;
8457    this._pdfDocument = pdfDocument || null;
8458    if (!outline) {
8459      this._dispatchEvent(0);
8460      return;
8461    }
8462    const fragment = document.createDocumentFragment();
8463    const queue = [{
8464      parent: fragment,
8465      items: outline
8466    }];
8467    let outlineCount = 0,
8468      hasAnyNesting = false;
8469    while (queue.length > 0) {
8470      const levelData = queue.shift();
8471      for (const item of levelData.items) {
8472        const div = document.createElement("div");
8473        div.className = "treeItem";
8474        const element = document.createElement("a");
8475        this._bindLink(element, item);
8476        this._setStyles(element, item);
8477        element.textContent = this._normalizeTextContent(item.title);
8478        div.append(element);
8479        if (item.items.length > 0) {
8480          hasAnyNesting = true;
8481          this._addToggleButton(div, item);
8482          const itemsDiv = document.createElement("div");
8483          itemsDiv.className = "treeItems";
8484          div.append(itemsDiv);
8485          queue.push({
8486            parent: itemsDiv,
8487            items: item.items
8488          });
8489        }
8490        levelData.parent.append(div);
8491        outlineCount++;
8492      }
8493    }
8494    this._finishRendering(fragment, outlineCount, hasAnyNesting);
8495  }
8496  async _currentOutlineItem() {
8497    if (!this._isPagesLoaded) {
8498      throw new Error("_currentOutlineItem: All pages have not been loaded.");
8499    }
8500    if (!this._outline || !this._pdfDocument) {
8501      return;
8502    }
8503    const pageNumberToDestHash = await this._getPageNumberToDestHash(this._pdfDocument);
8504    if (!pageNumberToDestHash) {
8505      return;
8506    }
8507    this._updateCurrentTreeItem(null);
8508    if (this._sidebarView !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SidebarView.OUTLINE) {
8509      return;
8510    }
8511    for (let i = this._currentPageNumber; i > 0; i--) {
8512      const destHash = pageNumberToDestHash.get(i);
8513      if (!destHash) {
8514        continue;
8515      }
8516      const linkElement = this.container.querySelector(`a[href="${destHash}"]`);
8517      if (!linkElement) {
8518        continue;
8519      }
8520      this._scrollToCurrentTreeItem(linkElement.parentNode);
8521      break;
8522    }
8523  }
8524  async _getPageNumberToDestHash(pdfDocument) {
8525    if (this._pageNumberToDestHashCapability) {
8526      return this._pageNumberToDestHashCapability.promise;
8527    }
8528    this._pageNumberToDestHashCapability = Promise.withResolvers();
8529    const pageNumberToDestHash = new Map(),
8530      pageNumberNesting = new Map();
8531    const queue = [{
8532      nesting: 0,
8533      items: this._outline
8534    }];
8535    while (queue.length > 0) {
8536      const levelData = queue.shift(),
8537        currentNesting = levelData.nesting;
8538      for (const {
8539        dest,
8540        items
8541      } of levelData.items) {
8542        let explicitDest, pageNumber;
8543        if (typeof dest === "string") {
8544          explicitDest = await pdfDocument.getDestination(dest);
8545          if (pdfDocument !== this._pdfDocument) {
8546            return null;
8547          }
8548        } else {
8549          explicitDest = dest;
8550        }
8551        if (Array.isArray(explicitDest)) {
8552          const [destRef] = explicitDest;
8553          if (typeof destRef === "object" && destRef !== null) {
8554            pageNumber = this.linkService._cachedPageNumber(destRef);
8555            if (!pageNumber) {
8556              try {
8557                pageNumber = (await pdfDocument.getPageIndex(destRef)) + 1;
8558                if (pdfDocument !== this._pdfDocument) {
8559                  return null;
8560                }
8561                this.linkService.cachePageRef(pageNumber, destRef);
8562              } catch {}
8563            }
8564          } else if (Number.isInteger(destRef)) {
8565            pageNumber = destRef + 1;
8566          }
8567          if (Number.isInteger(pageNumber) && (!pageNumberToDestHash.has(pageNumber) || currentNesting > pageNumberNesting.get(pageNumber))) {
8568            const destHash = this.linkService.getDestinationHash(dest);
8569            pageNumberToDestHash.set(pageNumber, destHash);
8570            pageNumberNesting.set(pageNumber, currentNesting);
8571          }
8572        }
8573        if (items.length > 0) {
8574          queue.push({
8575            nesting: currentNesting + 1,
8576            items
8577          });
8578        }
8579      }
8580    }
8581    this._pageNumberToDestHashCapability.resolve(pageNumberToDestHash.size > 0 ? pageNumberToDestHash : null);
8582    return this._pageNumberToDestHashCapability.promise;
8583  }
8584}
8585
8586
8587/***/ }),
8588
8589/***/ 9966:
8590/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
8591
8592__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
8593/* harmony export */ __webpack_require__.d(__webpack_exports__, {
8594/* harmony export */   PDFPageView: () => (/* binding */ PDFPageView)
8595/* harmony export */ });
8596/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
8597/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7256);
8598/* harmony import */ var _annotation_editor_layer_builder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(283);
8599/* harmony import */ var _annotation_layer_builder_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2707);
8600/* harmony import */ var _app_options_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9840);
8601/* harmony import */ var _draw_layer_builder_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3088);
8602/* harmony import */ var web_null_l10n__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(410);
8603/* harmony import */ var _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(787);
8604/* harmony import */ var _struct_tree_layer_builder_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(6698);
8605/* harmony import */ var _text_accessibility_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(5860);
8606/* harmony import */ var _text_highlighter_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(2027);
8607/* harmony import */ var _text_layer_builder_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(7765);
8608/* harmony import */ var _xfa_layer_builder_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(2973);
8609var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__, _annotation_editor_layer_builder_js__WEBPACK_IMPORTED_MODULE_2__, _annotation_layer_builder_js__WEBPACK_IMPORTED_MODULE_3__, _draw_layer_builder_js__WEBPACK_IMPORTED_MODULE_5__, web_null_l10n__WEBPACK_IMPORTED_MODULE_6__, _text_layer_builder_js__WEBPACK_IMPORTED_MODULE_10__, _xfa_layer_builder_js__WEBPACK_IMPORTED_MODULE_11__]);
8610([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__, _annotation_editor_layer_builder_js__WEBPACK_IMPORTED_MODULE_2__, _annotation_layer_builder_js__WEBPACK_IMPORTED_MODULE_3__, _draw_layer_builder_js__WEBPACK_IMPORTED_MODULE_5__, web_null_l10n__WEBPACK_IMPORTED_MODULE_6__, _text_layer_builder_js__WEBPACK_IMPORTED_MODULE_10__, _xfa_layer_builder_js__WEBPACK_IMPORTED_MODULE_11__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624const DEFAULT_LAYER_PROPERTIES = null;
8625const LAYERS_ORDER = new Map([["canvasWrapper", 0], ["textLayer", 1], ["annotationLayer", 2], ["annotationEditorLayer", 3], ["xfaLayer", 3]]);
8626class PDFPageView {
8627  #annotationMode = pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode.ENABLE_FORMS;
8628  #hasRestrictedScaling = false;
8629  #layerProperties = null;
8630  #loadingId = null;
8631  #previousRotation = null;
8632  #renderError = null;
8633  #renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.INITIAL;
8634  #textLayerMode = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.TextLayerMode.ENABLE;
8635  #useThumbnailCanvas = {
8636    directDrawing: true,
8637    initialOptionalContent: true,
8638    regularAnnotations: true
8639  };
8640  #viewportMap = new WeakMap();
8641  #layers = [null, null, null, null];
8642  constructor(options) {
8643    const container = options.container;
8644    const defaultViewport = options.defaultViewport;
8645    this.id = options.id;
8646    this.renderingId = "page" + this.id;
8647    this.#layerProperties = options.layerProperties || DEFAULT_LAYER_PROPERTIES;
8648    this.pdfPage = null;
8649    this.pageLabel = null;
8650    this.rotation = 0;
8651    this.scale = options.scale || _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SCALE;
8652    this.viewport = defaultViewport;
8653    this.pdfPageRotate = defaultViewport.rotation;
8654    this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
8655    this.#textLayerMode = options.textLayerMode ?? _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.TextLayerMode.ENABLE;
8656    this.#annotationMode = options.annotationMode ?? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode.ENABLE_FORMS;
8657    this.imageResourcesPath = options.imageResourcesPath || "";
8658    this.maxCanvasPixels = options.maxCanvasPixels ?? _app_options_js__WEBPACK_IMPORTED_MODULE_4__.AppOptions.get("maxCanvasPixels");
8659    this.pageColors = options.pageColors || null;
8660    this.eventBus = options.eventBus;
8661    this.renderingQueue = options.renderingQueue;
8662    this.l10n = options.l10n;
8663    this.l10n ||= new web_null_l10n__WEBPACK_IMPORTED_MODULE_6__.GenericL10n();
8664    this.renderTask = null;
8665    this.resume = null;
8666    this._isStandalone = !this.renderingQueue?.hasViewer();
8667    this._container = container;
8668    this._annotationCanvasMap = null;
8669    this.annotationLayer = null;
8670    this.annotationEditorLayer = null;
8671    this.textLayer = null;
8672    this.zoomLayer = null;
8673    this.xfaLayer = null;
8674    this.structTreeLayer = null;
8675    this.drawLayer = null;
8676    const div = document.createElement("div");
8677    div.className = "page";
8678    div.setAttribute("data-page-number", this.id);
8679    div.setAttribute("role", "region");
8680    div.setAttribute("data-l10n-id", "pdfjs-page-landmark");
8681    div.setAttribute("data-l10n-args", JSON.stringify({
8682      page: this.id
8683    }));
8684    this.div = div;
8685    this.#setDimensions();
8686    container?.append(div);
8687    if (this._isStandalone) {
8688      container?.style.setProperty("--scale-factor", this.scale * pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF_TO_CSS_UNITS);
8689      const {
8690        optionalContentConfigPromise
8691      } = options;
8692      if (optionalContentConfigPromise) {
8693        optionalContentConfigPromise.then(optionalContentConfig => {
8694          if (optionalContentConfigPromise !== this._optionalContentConfigPromise) {
8695            return;
8696          }
8697          this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility;
8698        });
8699      }
8700      if (!options.l10n) {
8701        this.l10n.translate(this.div);
8702      }
8703    }
8704  }
8705  #addLayer(div, name) {
8706    const pos = LAYERS_ORDER.get(name);
8707    const oldDiv = this.#layers[pos];
8708    this.#layers[pos] = div;
8709    if (oldDiv) {
8710      oldDiv.replaceWith(div);
8711      return;
8712    }
8713    for (let i = pos - 1; i >= 0; i--) {
8714      const layer = this.#layers[i];
8715      if (layer) {
8716        layer.after(div);
8717        return;
8718      }
8719    }
8720    this.div.prepend(div);
8721  }
8722  get renderingState() {
8723    return this.#renderingState;
8724  }
8725  set renderingState(state) {
8726    if (state === this.#renderingState) {
8727      return;
8728    }
8729    this.#renderingState = state;
8730    if (this.#loadingId) {
8731      clearTimeout(this.#loadingId);
8732      this.#loadingId = null;
8733    }
8734    switch (state) {
8735      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.PAUSED:
8736        this.div.classList.remove("loading");
8737        break;
8738      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.RUNNING:
8739        this.div.classList.add("loadingIcon");
8740        this.#loadingId = setTimeout(() => {
8741          this.div.classList.add("loading");
8742          this.#loadingId = null;
8743        }, 0);
8744        break;
8745      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.INITIAL:
8746      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.FINISHED:
8747        this.div.classList.remove("loadingIcon", "loading");
8748        break;
8749    }
8750  }
8751  #setDimensions() {
8752    const {
8753      viewport
8754    } = this;
8755    if (this.pdfPage) {
8756      if (this.#previousRotation === viewport.rotation) {
8757        return;
8758      }
8759      this.#previousRotation = viewport.rotation;
8760    }
8761    (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.setLayerDimensions)(this.div, viewport, true, false);
8762  }
8763  setPdfPage(pdfPage) {
8764    if (this._isStandalone && (this.pageColors?.foreground === "CanvasText" || this.pageColors?.background === "Canvas")) {
8765      this._container?.style.setProperty("--hcm-highlight-filter", pdfPage.filterFactory.addHighlightHCMFilter("highlight", "CanvasText", "Canvas", "HighlightText", "Highlight"));
8766      this._container?.style.setProperty("--hcm-highlight-selected-filter", pdfPage.filterFactory.addHighlightHCMFilter("highlight_selected", "CanvasText", "Canvas", "HighlightText", "Highlight"));
8767    }
8768    this.pdfPage = pdfPage;
8769    this.pdfPageRotate = pdfPage.rotate;
8770    const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
8771    this.viewport = pdfPage.getViewport({
8772      scale: this.scale * pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF_TO_CSS_UNITS,
8773      rotation: totalRotation
8774    });
8775    this.#setDimensions();
8776    this.reset();
8777  }
8778  destroy() {
8779    this.reset();
8780    this.pdfPage?.cleanup();
8781  }
8782  get _textHighlighter() {
8783    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.shadow)(this, "_textHighlighter", new _text_highlighter_js__WEBPACK_IMPORTED_MODULE_12__.TextHighlighter({
8784      pageIndex: this.id - 1,
8785      eventBus: this.eventBus,
8786      findController: this.#layerProperties.findController
8787    }));
8788  }
8789  async #renderAnnotationLayer() {
8790    let error = null;
8791    try {
8792      await this.annotationLayer.render(this.viewport, "display");
8793    } catch (ex) {
8794      console.error(`#renderAnnotationLayer: "${ex}".`);
8795      error = ex;
8796    } finally {
8797      this.eventBus.dispatch("annotationlayerrendered", {
8798        source: this,
8799        pageNumber: this.id,
8800        error
8801      });
8802    }
8803  }
8804  async #renderAnnotationEditorLayer() {
8805    let error = null;
8806    try {
8807      await this.annotationEditorLayer.render(this.viewport, "display");
8808    } catch (ex) {
8809      console.error(`#renderAnnotationEditorLayer: "${ex}".`);
8810      error = ex;
8811    } finally {
8812      this.eventBus.dispatch("annotationeditorlayerrendered", {
8813        source: this,
8814        pageNumber: this.id,
8815        error
8816      });
8817    }
8818  }
8819  async #renderDrawLayer() {
8820    try {
8821      await this.drawLayer.render("display");
8822    } catch (ex) {
8823      console.error(`#renderDrawLayer: "${ex}".`);
8824    }
8825  }
8826  async #renderXfaLayer() {
8827    let error = null;
8828    try {
8829      const result = await this.xfaLayer.render(this.viewport, "display");
8830      if (result?.textDivs && this._textHighlighter) {
8831        this.#buildXfaTextContentItems(result.textDivs);
8832      }
8833    } catch (ex) {
8834      console.error(`#renderXfaLayer: "${ex}".`);
8835      error = ex;
8836    } finally {
8837      if (this.xfaLayer?.div) {
8838        this.l10n.pause();
8839        this.#addLayer(this.xfaLayer.div, "xfaLayer");
8840        this.l10n.resume();
8841      }
8842      this.eventBus.dispatch("xfalayerrendered", {
8843        source: this,
8844        pageNumber: this.id,
8845        error
8846      });
8847    }
8848  }
8849  async #renderTextLayer() {
8850    const {
8851      pdfPage,
8852      textLayer,
8853      viewport
8854    } = this;
8855    if (!textLayer) {
8856      return;
8857    }
8858    let error = null;
8859    try {
8860      if (!textLayer.renderingDone) {
8861        const readableStream = pdfPage.streamTextContent({
8862          includeMarkedContent: true,
8863          disableNormalization: true
8864        });
8865        textLayer.setTextContentSource(readableStream);
8866      }
8867      await textLayer.render(viewport);
8868    } catch (ex) {
8869      if (ex instanceof pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AbortException) {
8870        return;
8871      }
8872      console.error(`#renderTextLayer: "${ex}".`);
8873      error = ex;
8874    }
8875    this.eventBus.dispatch("textlayerrendered", {
8876      source: this,
8877      pageNumber: this.id,
8878      numTextDivs: textLayer.numTextDivs,
8879      error
8880    });
8881    this.#renderStructTreeLayer();
8882  }
8883  async #renderStructTreeLayer() {
8884    if (!this.textLayer) {
8885      return;
8886    }
8887    this.structTreeLayer ||= new _struct_tree_layer_builder_js__WEBPACK_IMPORTED_MODULE_8__.StructTreeLayerBuilder();
8888    const tree = await (!this.structTreeLayer.renderingDone ? this.pdfPage.getStructTree() : null);
8889    const treeDom = this.structTreeLayer?.render(tree);
8890    if (treeDom) {
8891      this.l10n.pause();
8892      this.canvas?.append(treeDom);
8893      this.l10n.resume();
8894    }
8895    this.structTreeLayer?.show();
8896  }
8897  async #buildXfaTextContentItems(textDivs) {
8898    const text = await this.pdfPage.getTextContent();
8899    const items = [];
8900    for (const item of text.items) {
8901      items.push(item.str);
8902    }
8903    this._textHighlighter.setTextMapping(textDivs, items);
8904    this._textHighlighter.enable();
8905  }
8906  _resetZoomLayer(removeFromDOM = false) {
8907    if (!this.zoomLayer) {
8908      return;
8909    }
8910    const zoomLayerCanvas = this.zoomLayer.firstChild;
8911    this.#viewportMap.delete(zoomLayerCanvas);
8912    zoomLayerCanvas.width = 0;
8913    zoomLayerCanvas.height = 0;
8914    if (removeFromDOM) {
8915      this.zoomLayer.remove();
8916    }
8917    this.zoomLayer = null;
8918  }
8919  reset({
8920    keepZoomLayer = false,
8921    keepAnnotationLayer = false,
8922    keepAnnotationEditorLayer = false,
8923    keepXfaLayer = false,
8924    keepTextLayer = false
8925  } = {}) {
8926    this.cancelRendering({
8927      keepAnnotationLayer,
8928      keepAnnotationEditorLayer,
8929      keepXfaLayer,
8930      keepTextLayer
8931    });
8932    this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.INITIAL;
8933    const div = this.div;
8934    const childNodes = div.childNodes,
8935      zoomLayerNode = keepZoomLayer && this.zoomLayer || null,
8936      annotationLayerNode = keepAnnotationLayer && this.annotationLayer?.div || null,
8937      annotationEditorLayerNode = keepAnnotationEditorLayer && this.annotationEditorLayer?.div || null,
8938      xfaLayerNode = keepXfaLayer && this.xfaLayer?.div || null,
8939      textLayerNode = keepTextLayer && this.textLayer?.div || null;
8940    for (let i = childNodes.length - 1; i >= 0; i--) {
8941      const node = childNodes[i];
8942      switch (node) {
8943        case zoomLayerNode:
8944        case annotationLayerNode:
8945        case annotationEditorLayerNode:
8946        case xfaLayerNode:
8947        case textLayerNode:
8948          continue;
8949      }
8950      node.remove();
8951      const layerIndex = this.#layers.indexOf(node);
8952      if (layerIndex >= 0) {
8953        this.#layers[layerIndex] = null;
8954      }
8955    }
8956    div.removeAttribute("data-loaded");
8957    if (annotationLayerNode) {
8958      this.annotationLayer.hide();
8959    }
8960    if (annotationEditorLayerNode) {
8961      this.annotationEditorLayer.hide();
8962    }
8963    if (xfaLayerNode) {
8964      this.xfaLayer.hide();
8965    }
8966    if (textLayerNode) {
8967      this.textLayer.hide();
8968    }
8969    this.structTreeLayer?.hide();
8970    if (!zoomLayerNode) {
8971      if (this.canvas) {
8972        this.#viewportMap.delete(this.canvas);
8973        this.canvas.width = 0;
8974        this.canvas.height = 0;
8975        delete this.canvas;
8976      }
8977      this._resetZoomLayer();
8978    }
8979  }
8980  update({
8981    scale = 0,
8982    rotation = null,
8983    optionalContentConfigPromise = null,
8984    drawingDelay = -1
8985  }) {
8986    this.scale = scale || this.scale;
8987    if (typeof rotation === "number") {
8988      this.rotation = rotation;
8989    }
8990    if (optionalContentConfigPromise instanceof Promise) {
8991      this._optionalContentConfigPromise = optionalContentConfigPromise;
8992      optionalContentConfigPromise.then(optionalContentConfig => {
8993        if (optionalContentConfigPromise !== this._optionalContentConfigPromise) {
8994          return;
8995        }
8996        this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility;
8997      });
8998    }
8999    this.#useThumbnailCanvas.directDrawing = true;
9000    const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
9001    this.viewport = this.viewport.clone({
9002      scale: this.scale * pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF_TO_CSS_UNITS,
9003      rotation: totalRotation
9004    });
9005    this.#setDimensions();
9006    if (this._isStandalone) {
9007      this._container?.style.setProperty("--scale-factor", this.viewport.scale);
9008    }
9009    if (this.canvas) {
9010      let onlyCssZoom = false;
9011      if (this.#hasRestrictedScaling) {
9012        if (this.maxCanvasPixels === 0) {
9013          onlyCssZoom = true;
9014        } else if (this.maxCanvasPixels > 0) {
9015          const {
9016            width,
9017            height
9018          } = this.viewport;
9019          const {
9020            sx,
9021            sy
9022          } = this.outputScale;
9023          onlyCssZoom = (Math.floor(width) * sx | 0) * (Math.floor(height) * sy | 0) > this.maxCanvasPixels;
9024        }
9025      }
9026      const postponeDrawing = !onlyCssZoom && drawingDelay >= 0 && drawingDelay < 1000;
9027      if (postponeDrawing || onlyCssZoom) {
9028        if (postponeDrawing && this.renderingState !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.FINISHED) {
9029          this.cancelRendering({
9030            keepZoomLayer: true,
9031            keepAnnotationLayer: true,
9032            keepAnnotationEditorLayer: true,
9033            keepXfaLayer: true,
9034            keepTextLayer: true,
9035            cancelExtraDelay: drawingDelay
9036          });
9037          this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.FINISHED;
9038          this.#useThumbnailCanvas.directDrawing = false;
9039        }
9040        this.cssTransform({
9041          target: this.canvas,
9042          redrawAnnotationLayer: true,
9043          redrawAnnotationEditorLayer: true,
9044          redrawXfaLayer: true,
9045          redrawTextLayer: !postponeDrawing,
9046          hideTextLayer: postponeDrawing
9047        });
9048        if (postponeDrawing) {
9049          return;
9050        }
9051        this.eventBus.dispatch("pagerendered", {
9052          source: this,
9053          pageNumber: this.id,
9054          cssTransform: true,
9055          timestamp: performance.now(),
9056          error: this.#renderError
9057        });
9058        return;
9059      }
9060      if (!this.zoomLayer && !this.canvas.hidden) {
9061        this.zoomLayer = this.canvas.parentNode;
9062        this.zoomLayer.style.position = "absolute";
9063      }
9064    }
9065    if (this.zoomLayer) {
9066      this.cssTransform({
9067        target: this.zoomLayer.firstChild
9068      });
9069    }
9070    this.reset({
9071      keepZoomLayer: true,
9072      keepAnnotationLayer: true,
9073      keepAnnotationEditorLayer: true,
9074      keepXfaLayer: true,
9075      keepTextLayer: true
9076    });
9077  }
9078  cancelRendering({
9079    keepAnnotationLayer = false,
9080    keepAnnotationEditorLayer = false,
9081    keepXfaLayer = false,
9082    keepTextLayer = false,
9083    cancelExtraDelay = 0
9084  } = {}) {
9085    if (this.renderTask) {
9086      this.renderTask.cancel(cancelExtraDelay);
9087      this.renderTask = null;
9088    }
9089    this.resume = null;
9090    if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) {
9091      this.textLayer.cancel();
9092      this.textLayer = null;
9093    }
9094    if (this.structTreeLayer && !this.textLayer) {
9095      this.structTreeLayer = null;
9096    }
9097    if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) {
9098      this.annotationLayer.cancel();
9099      this.annotationLayer = null;
9100      this._annotationCanvasMap = null;
9101    }
9102    if (this.annotationEditorLayer && (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)) {
9103      if (this.drawLayer) {
9104        this.drawLayer.cancel();
9105        this.drawLayer = null;
9106      }
9107      this.annotationEditorLayer.cancel();
9108      this.annotationEditorLayer = null;
9109    }
9110    if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {
9111      this.xfaLayer.cancel();
9112      this.xfaLayer = null;
9113      this._textHighlighter?.disable();
9114    }
9115  }
9116  cssTransform({
9117    target,
9118    redrawAnnotationLayer = false,
9119    redrawAnnotationEditorLayer = false,
9120    redrawXfaLayer = false,
9121    redrawTextLayer = false,
9122    hideTextLayer = false
9123  }) {
9124    if (!target.hasAttribute("zooming")) {
9125      target.setAttribute("zooming", true);
9126      const {
9127        style
9128      } = target;
9129      style.width = style.height = "";
9130    }
9131    const originalViewport = this.#viewportMap.get(target);
9132    if (this.viewport !== originalViewport) {
9133      const relativeRotation = this.viewport.rotation - originalViewport.rotation;
9134      const absRotation = Math.abs(relativeRotation);
9135      let scaleX = 1,
9136        scaleY = 1;
9137      if (absRotation === 90 || absRotation === 270) {
9138        const {
9139          width,
9140          height
9141        } = this.viewport;
9142        scaleX = height / width;
9143        scaleY = width / height;
9144      }
9145      target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;
9146    }
9147    if (redrawAnnotationLayer && this.annotationLayer) {
9148      this.#renderAnnotationLayer();
9149    }
9150    if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {
9151      if (this.drawLayer) {
9152        this.#renderDrawLayer();
9153      }
9154      this.#renderAnnotationEditorLayer();
9155    }
9156    if (redrawXfaLayer && this.xfaLayer) {
9157      this.#renderXfaLayer();
9158    }
9159    if (this.textLayer) {
9160      if (hideTextLayer) {
9161        this.textLayer.hide();
9162        this.structTreeLayer?.hide();
9163      } else if (redrawTextLayer) {
9164        this.#renderTextLayer();
9165      }
9166    }
9167  }
9168  get width() {
9169    return this.viewport.width;
9170  }
9171  get height() {
9172    return this.viewport.height;
9173  }
9174  getPagePoint(x, y) {
9175    return this.viewport.convertToPdfPoint(x, y);
9176  }
9177  async #finishRenderTask(renderTask, error = null) {
9178    if (renderTask === this.renderTask) {
9179      this.renderTask = null;
9180    }
9181    if (error instanceof pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.RenderingCancelledException) {
9182      this.#renderError = null;
9183      return;
9184    }
9185    this.#renderError = error;
9186    this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.FINISHED;
9187    this._resetZoomLayer(true);
9188    this.#useThumbnailCanvas.regularAnnotations = !renderTask.separateAnnots;
9189    this.eventBus.dispatch("pagerendered", {
9190      source: this,
9191      pageNumber: this.id,
9192      cssTransform: false,
9193      timestamp: performance.now(),
9194      error: this.#renderError
9195    });
9196    if (error) {
9197      throw error;
9198    }
9199  }
9200  async draw() {
9201    if (this.renderingState !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.INITIAL) {
9202      console.error("Must be in new state before drawing");
9203      this.reset();
9204    }
9205    const {
9206      div,
9207      l10n,
9208      pageColors,
9209      pdfPage,
9210      viewport
9211    } = this;
9212    if (!pdfPage) {
9213      this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.FINISHED;
9214      throw new Error("pdfPage is not loaded");
9215    }
9216    this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.RUNNING;
9217    const canvasWrapper = document.createElement("div");
9218    canvasWrapper.classList.add("canvasWrapper");
9219    canvasWrapper.setAttribute("aria-hidden", true);
9220    this.#addLayer(canvasWrapper, "canvasWrapper");
9221    if (!this.textLayer && this.#textLayerMode !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.TextLayerMode.DISABLE && !pdfPage.isPureXfa) {
9222      this._accessibilityManager ||= new _text_accessibility_js__WEBPACK_IMPORTED_MODULE_9__.TextAccessibilityManager();
9223      this.textLayer = new _text_layer_builder_js__WEBPACK_IMPORTED_MODULE_10__.TextLayerBuilder({
9224        highlighter: this._textHighlighter,
9225        accessibilityManager: this._accessibilityManager,
9226        enablePermissions: this.#textLayerMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.TextLayerMode.ENABLE_PERMISSIONS,
9227        onAppend: textLayerDiv => {
9228          this.l10n.pause();
9229          this.#addLayer(textLayerDiv, "textLayer");
9230          this.l10n.resume();
9231        }
9232      });
9233    }
9234    if (!this.annotationLayer && this.#annotationMode !== pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode.DISABLE) {
9235      const {
9236        annotationStorage,
9237        downloadManager,
9238        enableScripting,
9239        fieldObjectsPromise,
9240        hasJSActionsPromise,
9241        linkService
9242      } = this.#layerProperties;
9243      this._annotationCanvasMap ||= new Map();
9244      this.annotationLayer = new _annotation_layer_builder_js__WEBPACK_IMPORTED_MODULE_3__.AnnotationLayerBuilder({
9245        pdfPage,
9246        annotationStorage,
9247        imageResourcesPath: this.imageResourcesPath,
9248        renderForms: this.#annotationMode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode.ENABLE_FORMS,
9249        linkService,
9250        downloadManager,
9251        enableScripting,
9252        hasJSActionsPromise,
9253        fieldObjectsPromise,
9254        annotationCanvasMap: this._annotationCanvasMap,
9255        accessibilityManager: this._accessibilityManager,
9256        onAppend: annotationLayerDiv => {
9257          this.#addLayer(annotationLayerDiv, "annotationLayer");
9258        }
9259      });
9260    }
9261    const renderContinueCallback = cont => {
9262      showCanvas?.(false);
9263      if (this.renderingQueue && !this.renderingQueue.isHighestPriority(this)) {
9264        this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.PAUSED;
9265        this.resume = () => {
9266          this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.RUNNING;
9267          cont();
9268        };
9269        return;
9270      }
9271      cont();
9272    };
9273    const {
9274      width,
9275      height
9276    } = viewport;
9277    const canvas = document.createElement("canvas");
9278    canvas.setAttribute("role", "presentation");
9279    canvas.hidden = true;
9280    const hasHCM = !!(pageColors?.background && pageColors?.foreground);
9281    let showCanvas = isLastShow => {
9282      if (!hasHCM || isLastShow) {
9283        canvas.hidden = false;
9284        showCanvas = null;
9285      }
9286    };
9287    canvasWrapper.append(canvas);
9288    this.canvas = canvas;
9289    const ctx = canvas.getContext("2d", {
9290      alpha: false
9291    });
9292    const outputScale = this.outputScale = new _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.OutputScale();
9293    if (this.maxCanvasPixels === 0) {
9294      const invScale = 1 / this.scale;
9295      outputScale.sx *= invScale;
9296      outputScale.sy *= invScale;
9297      this.#hasRestrictedScaling = true;
9298    } else if (this.maxCanvasPixels > 0) {
9299      const pixelsInViewport = width * height;
9300      const maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);
9301      if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
9302        outputScale.sx = maxScale;
9303        outputScale.sy = maxScale;
9304        this.#hasRestrictedScaling = true;
9305      } else {
9306        this.#hasRestrictedScaling = false;
9307      }
9308    }
9309    const sfx = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.approximateFraction)(outputScale.sx);
9310    const sfy = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.approximateFraction)(outputScale.sy);
9311    canvas.width = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.roundToDivide)(width * outputScale.sx, sfx[0]);
9312    canvas.height = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.roundToDivide)(height * outputScale.sy, sfy[0]);
9313    const {
9314      style
9315    } = canvas;
9316    style.width = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.roundToDivide)(width, sfx[1]) + "px";
9317    style.height = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.roundToDivide)(height, sfy[1]) + "px";
9318    this.#viewportMap.set(canvas, viewport);
9319    const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;
9320    const renderContext = {
9321      canvasContext: ctx,
9322      transform,
9323      viewport,
9324      annotationMode: this.#annotationMode,
9325      optionalContentConfigPromise: this._optionalContentConfigPromise,
9326      annotationCanvasMap: this._annotationCanvasMap,
9327      pageColors
9328    };
9329    const renderTask = this.renderTask = this.pdfPage.render(renderContext);
9330    renderTask.onContinue = renderContinueCallback;
9331    const resultPromise = renderTask.promise.then(async () => {
9332      showCanvas?.(true);
9333      await this.#finishRenderTask(renderTask);
9334      this.#renderTextLayer();
9335      if (this.annotationLayer) {
9336        await this.#renderAnnotationLayer();
9337      }
9338      const {
9339        annotationEditorUIManager
9340      } = this.#layerProperties;
9341      if (!annotationEditorUIManager) {
9342        return;
9343      }
9344      this.drawLayer ||= new _draw_layer_builder_js__WEBPACK_IMPORTED_MODULE_5__.DrawLayerBuilder({
9345        pageIndex: this.id
9346      });
9347      await this.#renderDrawLayer();
9348      this.drawLayer.setParent(canvasWrapper);
9349      if (!this.annotationEditorLayer) {
9350        this.annotationEditorLayer = new _annotation_editor_layer_builder_js__WEBPACK_IMPORTED_MODULE_2__.AnnotationEditorLayerBuilder({
9351          uiManager: annotationEditorUIManager,
9352          pdfPage,
9353          l10n,
9354          accessibilityManager: this._accessibilityManager,
9355          annotationLayer: this.annotationLayer?.annotationLayer,
9356          textLayer: this.textLayer,
9357          drawLayer: this.drawLayer.getDrawLayer(),
9358          onAppend: annotationEditorLayerDiv => {
9359            this.#addLayer(annotationEditorLayerDiv, "annotationEditorLayer");
9360          }
9361        });
9362      }
9363      this.#renderAnnotationEditorLayer();
9364    }, error => {
9365      if (!(error instanceof pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.RenderingCancelledException)) {
9366        showCanvas?.(true);
9367      }
9368      return this.#finishRenderTask(renderTask, error);
9369    });
9370    if (pdfPage.isPureXfa) {
9371      if (!this.xfaLayer) {
9372        const {
9373          annotationStorage,
9374          linkService
9375        } = this.#layerProperties;
9376        this.xfaLayer = new _xfa_layer_builder_js__WEBPACK_IMPORTED_MODULE_11__.XfaLayerBuilder({
9377          pdfPage,
9378          annotationStorage,
9379          linkService
9380        });
9381      }
9382      this.#renderXfaLayer();
9383    }
9384    div.setAttribute("data-loaded", true);
9385    this.eventBus.dispatch("pagerender", {
9386      source: this,
9387      pageNumber: this.id
9388    });
9389    return resultPromise;
9390  }
9391  setPageLabel(label) {
9392    this.pageLabel = typeof label === "string" ? label : null;
9393    this.div.setAttribute("data-l10n-args", JSON.stringify({
9394      page: this.pageLabel ?? this.id
9395    }));
9396    if (this.pageLabel !== null) {
9397      this.div.setAttribute("data-page-label", this.pageLabel);
9398    } else {
9399      this.div.removeAttribute("data-page-label");
9400    }
9401  }
9402  get thumbnailCanvas() {
9403    const {
9404      directDrawing,
9405      initialOptionalContent,
9406      regularAnnotations
9407    } = this.#useThumbnailCanvas;
9408    return directDrawing && initialOptionalContent && regularAnnotations ? this.canvas : null;
9409  }
9410}
9411
9412__webpack_async_result__();
9413} catch(e) { __webpack_async_result__(e); } });
9414
9415/***/ }),
9416
9417/***/ 8917:
9418/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
9419
9420__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
9421/* harmony export */ __webpack_require__.d(__webpack_exports__, {
9422/* harmony export */   PDFPresentationMode: () => (/* binding */ PDFPresentationMode)
9423/* harmony export */ });
9424/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
9425/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2603);
9426var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__]);
9427pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
9428
9429
9430const DELAY_BEFORE_HIDING_CONTROLS = 3000;
9431const ACTIVE_SELECTOR = "pdfPresentationMode";
9432const CONTROLS_SELECTOR = "pdfPresentationModeControls";
9433const MOUSE_SCROLL_COOLDOWN_TIME = 50;
9434const PAGE_SWITCH_THRESHOLD = 0.1;
9435const SWIPE_MIN_DISTANCE_THRESHOLD = 50;
9436const SWIPE_ANGLE_THRESHOLD = Math.PI / 6;
9437class PDFPresentationMode {
9438  #state = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.PresentationModeState.UNKNOWN;
9439  #args = null;
9440  constructor({
9441    container,
9442    pdfViewer,
9443    eventBus
9444  }) {
9445    this.container = container;
9446    this.pdfViewer = pdfViewer;
9447    this.eventBus = eventBus;
9448    this.contextMenuOpen = false;
9449    this.mouseScrollTimeStamp = 0;
9450    this.mouseScrollDelta = 0;
9451    this.touchSwipeState = null;
9452  }
9453  async request() {
9454    const {
9455      container,
9456      pdfViewer
9457    } = this;
9458    if (this.active || !pdfViewer.pagesCount || !container.requestFullscreen) {
9459      return false;
9460    }
9461    this.#addFullscreenChangeListeners();
9462    this.#notifyStateChange(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.PresentationModeState.CHANGING);
9463    const promise = container.requestFullscreen();
9464    this.#args = {
9465      pageNumber: pdfViewer.currentPageNumber,
9466      scaleValue: pdfViewer.currentScaleValue,
9467      scrollMode: pdfViewer.scrollMode,
9468      spreadMode: null,
9469      annotationEditorMode: null
9470    };
9471    if (pdfViewer.spreadMode !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.NONE && !(pdfViewer.pageViewsReady && pdfViewer.hasEqualPageSizes)) {
9472      console.warn("Ignoring Spread modes when entering PresentationMode, " + "since the document may contain varying page sizes.");
9473      this.#args.spreadMode = pdfViewer.spreadMode;
9474    }
9475    if (pdfViewer.annotationEditorMode !== pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.AnnotationEditorType.DISABLE) {
9476      this.#args.annotationEditorMode = pdfViewer.annotationEditorMode;
9477    }
9478    try {
9479      await promise;
9480      pdfViewer.focus();
9481      return true;
9482    } catch {
9483      this.#removeFullscreenChangeListeners();
9484      this.#notifyStateChange(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.PresentationModeState.NORMAL);
9485    }
9486    return false;
9487  }
9488  get active() {
9489    return this.#state === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.PresentationModeState.CHANGING || this.#state === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.PresentationModeState.FULLSCREEN;
9490  }
9491  #mouseWheel(evt) {
9492    if (!this.active) {
9493      return;
9494    }
9495    evt.preventDefault();
9496    const delta = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.normalizeWheelEventDelta)(evt);
9497    const currentTime = Date.now();
9498    const storedTime = this.mouseScrollTimeStamp;
9499    if (currentTime > storedTime && currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) {
9500      return;
9501    }
9502    if (this.mouseScrollDelta > 0 && delta < 0 || this.mouseScrollDelta < 0 && delta > 0) {
9503      this.#resetMouseScrollState();
9504    }
9505    this.mouseScrollDelta += delta;
9506    if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {
9507      const totalDelta = this.mouseScrollDelta;
9508      this.#resetMouseScrollState();
9509      const success = totalDelta > 0 ? this.pdfViewer.previousPage() : this.pdfViewer.nextPage();
9510      if (success) {
9511        this.mouseScrollTimeStamp = currentTime;
9512      }
9513    }
9514  }
9515  #notifyStateChange(state) {
9516    this.#state = state;
9517    this.eventBus.dispatch("presentationmodechanged", {
9518      source: this,
9519      state
9520    });
9521  }
9522  #enter() {
9523    this.#notifyStateChange(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.PresentationModeState.FULLSCREEN);
9524    this.container.classList.add(ACTIVE_SELECTOR);
9525    setTimeout(() => {
9526      this.pdfViewer.scrollMode = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.PAGE;
9527      if (this.#args.spreadMode !== null) {
9528        this.pdfViewer.spreadMode = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.NONE;
9529      }
9530      this.pdfViewer.currentPageNumber = this.#args.pageNumber;
9531      this.pdfViewer.currentScaleValue = "page-fit";
9532      if (this.#args.annotationEditorMode !== null) {
9533        this.pdfViewer.annotationEditorMode = {
9534          mode: pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.AnnotationEditorType.NONE
9535        };
9536      }
9537    }, 0);
9538    this.#addWindowListeners();
9539    this.#showControls();
9540    this.contextMenuOpen = false;
9541    document.getSelection().empty();
9542  }
9543  #exit() {
9544    const pageNumber = this.pdfViewer.currentPageNumber;
9545    this.container.classList.remove(ACTIVE_SELECTOR);
9546    setTimeout(() => {
9547      this.#removeFullscreenChangeListeners();
9548      this.#notifyStateChange(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.PresentationModeState.NORMAL);
9549      this.pdfViewer.scrollMode = this.#args.scrollMode;
9550      if (this.#args.spreadMode !== null) {
9551        this.pdfViewer.spreadMode = this.#args.spreadMode;
9552      }
9553      this.pdfViewer.currentScaleValue = this.#args.scaleValue;
9554      this.pdfViewer.currentPageNumber = pageNumber;
9555      if (this.#args.annotationEditorMode !== null) {
9556        this.pdfViewer.annotationEditorMode = {
9557          mode: this.#args.annotationEditorMode
9558        };
9559      }
9560      this.#args = null;
9561    }, 0);
9562    this.#removeWindowListeners();
9563    this.#hideControls();
9564    this.#resetMouseScrollState();
9565    this.contextMenuOpen = false;
9566  }
9567  #mouseDown(evt) {
9568    if (this.contextMenuOpen) {
9569      this.contextMenuOpen = false;
9570      evt.preventDefault();
9571      return;
9572    }
9573    if (evt.button !== 0) {
9574      return;
9575    }
9576    if (evt.target.href && evt.target.parentNode?.hasAttribute("data-internal-link")) {
9577      return;
9578    }
9579    evt.preventDefault();
9580    if (evt.shiftKey) {
9581      this.pdfViewer.previousPage();
9582    } else {
9583      this.pdfViewer.nextPage();
9584    }
9585  }
9586  #contextMenu() {
9587    this.contextMenuOpen = true;
9588  }
9589  #showControls() {
9590    if (this.controlsTimeout) {
9591      clearTimeout(this.controlsTimeout);
9592    } else {
9593      this.container.classList.add(CONTROLS_SELECTOR);
9594    }
9595    this.controlsTimeout = setTimeout(() => {
9596      this.container.classList.remove(CONTROLS_SELECTOR);
9597      delete this.controlsTimeout;
9598    }, DELAY_BEFORE_HIDING_CONTROLS);
9599  }
9600  #hideControls() {
9601    if (!this.controlsTimeout) {
9602      return;
9603    }
9604    clearTimeout(this.controlsTimeout);
9605    this.container.classList.remove(CONTROLS_SELECTOR);
9606    delete this.controlsTimeout;
9607  }
9608  #resetMouseScrollState() {
9609    this.mouseScrollTimeStamp = 0;
9610    this.mouseScrollDelta = 0;
9611  }
9612  #touchSwipe(evt) {
9613    if (!this.active) {
9614      return;
9615    }
9616    if (evt.touches.length > 1) {
9617      this.touchSwipeState = null;
9618      return;
9619    }
9620    switch (evt.type) {
9621      case "touchstart":
9622        this.touchSwipeState = {
9623          startX: evt.touches[0].pageX,
9624          startY: evt.touches[0].pageY,
9625          endX: evt.touches[0].pageX,
9626          endY: evt.touches[0].pageY
9627        };
9628        break;
9629      case "touchmove":
9630        if (this.touchSwipeState === null) {
9631          return;
9632        }
9633        this.touchSwipeState.endX = evt.touches[0].pageX;
9634        this.touchSwipeState.endY = evt.touches[0].pageY;
9635        evt.preventDefault();
9636        break;
9637      case "touchend":
9638        if (this.touchSwipeState === null) {
9639          return;
9640        }
9641        let delta = 0;
9642        const dx = this.touchSwipeState.endX - this.touchSwipeState.startX;
9643        const dy = this.touchSwipeState.endY - this.touchSwipeState.startY;
9644        const absAngle = Math.abs(Math.atan2(dy, dx));
9645        if (Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD && (absAngle <= SWIPE_ANGLE_THRESHOLD || absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD)) {
9646          delta = dx;
9647        } else if (Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD && Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD) {
9648          delta = dy;
9649        }
9650        if (delta > 0) {
9651          this.pdfViewer.previousPage();
9652        } else if (delta < 0) {
9653          this.pdfViewer.nextPage();
9654        }
9655        break;
9656    }
9657  }
9658  #addWindowListeners() {
9659    this.showControlsBind = this.#showControls.bind(this);
9660    this.mouseDownBind = this.#mouseDown.bind(this);
9661    this.mouseWheelBind = this.#mouseWheel.bind(this);
9662    this.resetMouseScrollStateBind = this.#resetMouseScrollState.bind(this);
9663    this.contextMenuBind = this.#contextMenu.bind(this);
9664    this.touchSwipeBind = this.#touchSwipe.bind(this);
9665    window.addEventListener("mousemove", this.showControlsBind);
9666    window.addEventListener("mousedown", this.mouseDownBind);
9667    window.addEventListener("wheel", this.mouseWheelBind, {
9668      passive: false
9669    });
9670    window.addEventListener("keydown", this.resetMouseScrollStateBind);
9671    window.addEventListener("contextmenu", this.contextMenuBind);
9672    window.addEventListener("touchstart", this.touchSwipeBind);
9673    window.addEventListener("touchmove", this.touchSwipeBind);
9674    window.addEventListener("touchend", this.touchSwipeBind);
9675  }
9676  #removeWindowListeners() {
9677    window.removeEventListener("mousemove", this.showControlsBind);
9678    window.removeEventListener("mousedown", this.mouseDownBind);
9679    window.removeEventListener("wheel", this.mouseWheelBind, {
9680      passive: false
9681    });
9682    window.removeEventListener("keydown", this.resetMouseScrollStateBind);
9683    window.removeEventListener("contextmenu", this.contextMenuBind);
9684    window.removeEventListener("touchstart", this.touchSwipeBind);
9685    window.removeEventListener("touchmove", this.touchSwipeBind);
9686    window.removeEventListener("touchend", this.touchSwipeBind);
9687    delete this.showControlsBind;
9688    delete this.mouseDownBind;
9689    delete this.mouseWheelBind;
9690    delete this.resetMouseScrollStateBind;
9691    delete this.contextMenuBind;
9692    delete this.touchSwipeBind;
9693  }
9694  #fullscreenChange() {
9695    if (document.fullscreenElement) {
9696      this.#enter();
9697    } else {
9698      this.#exit();
9699    }
9700  }
9701  #addFullscreenChangeListeners() {
9702    this.fullscreenChangeBind = this.#fullscreenChange.bind(this);
9703    window.addEventListener("fullscreenchange", this.fullscreenChangeBind);
9704  }
9705  #removeFullscreenChangeListeners() {
9706    window.removeEventListener("fullscreenchange", this.fullscreenChangeBind);
9707    delete this.fullscreenChangeBind;
9708  }
9709}
9710
9711__webpack_async_result__();
9712} catch(e) { __webpack_async_result__(e); } });
9713
9714/***/ }),
9715
9716/***/ 1144:
9717/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
9718
9719__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
9720/* harmony export */ __webpack_require__.d(__webpack_exports__, {
9721/* harmony export */   PDFPrintServiceFactory: () => (/* binding */ PDFPrintServiceFactory)
9722/* harmony export */ });
9723/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
9724/* harmony import */ var _print_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(659);
9725var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__, _print_utils_js__WEBPACK_IMPORTED_MODULE_1__]);
9726([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__, _print_utils_js__WEBPACK_IMPORTED_MODULE_1__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
9727
9728
9729let activeService = null;
9730let dialog = null;
9731let overlayManager = null;
9732let viewerApp = {
9733  initialized: false
9734};
9735function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size, printResolution, optionalContentConfigPromise, printAnnotationStoragePromise) {
9736  const scratchCanvas = activeService.scratchCanvas;
9737  const PRINT_UNITS = printResolution / pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF;
9738  scratchCanvas.width = Math.floor(size.width * PRINT_UNITS);
9739  scratchCanvas.height = Math.floor(size.height * PRINT_UNITS);
9740  const ctx = scratchCanvas.getContext("2d");
9741  ctx.save();
9742  ctx.fillStyle = "rgb(255, 255, 255)";
9743  ctx.fillRect(0, 0, scratchCanvas.width, scratchCanvas.height);
9744  ctx.restore();
9745  return Promise.all([pdfDocument.getPage(pageNumber), printAnnotationStoragePromise]).then(function ([pdfPage, printAnnotationStorage]) {
9746    const renderContext = {
9747      canvasContext: ctx,
9748      transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
9749      viewport: pdfPage.getViewport({
9750        scale: 1,
9751        rotation: size.rotation
9752      }),
9753      intent: "print",
9754      annotationMode: pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode.ENABLE_STORAGE,
9755      optionalContentConfigPromise,
9756      printAnnotationStorage
9757    };
9758    const renderTask = pdfPage.render(renderContext);
9759    return renderTask.promise.catch(reason => {
9760      if (!(reason instanceof pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.RenderingCancelledException)) {
9761        console.error(reason);
9762      }
9763      throw reason;
9764    });
9765  });
9766}
9767class PDFPrintService {
9768  constructor({
9769    pdfDocument,
9770    pagesOverview,
9771    printContainer,
9772    printResolution,
9773    printAnnotationStoragePromise = null
9774  }) {
9775    this.pdfDocument = pdfDocument;
9776    this.pagesOverview = pagesOverview;
9777    this.printContainer = printContainer;
9778    this._printResolution = printResolution || 150;
9779    this._optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({
9780      intent: "print"
9781    });
9782    this._printAnnotationStoragePromise = printAnnotationStoragePromise || Promise.resolve();
9783    this.currentPage = -1;
9784    this.scratchCanvas = document.createElement("canvas");
9785  }
9786  layout() {
9787    this.throwIfInactive();
9788    const body = document.querySelector("body");
9789    body.setAttribute("data-pdfjsprinting", true);
9790    const {
9791      width,
9792      height
9793    } = this.pagesOverview[0];
9794    const hasEqualPageSizes = this.pagesOverview.every(size => size.width === width && size.height === height);
9795    if (!hasEqualPageSizes) {
9796      console.warn("Not all pages have the same size. The printed result may be incorrect!");
9797    }
9798    this.pageStyleSheet = document.createElement("style");
9799    this.pageStyleSheet.textContent = `@page { size: ${width}pt ${height}pt;}`;
9800    body.append(this.pageStyleSheet);
9801  }
9802  destroy() {
9803    if (activeService !== this) {
9804      return;
9805    }
9806    this.printContainer.textContent = "";
9807    const body = document.querySelector("body");
9808    body.removeAttribute("data-pdfjsprinting");
9809    if (this.pageStyleSheet) {
9810      this.pageStyleSheet.remove();
9811      this.pageStyleSheet = null;
9812    }
9813    this.scratchCanvas.width = this.scratchCanvas.height = 0;
9814    this.scratchCanvas = null;
9815    activeService = null;
9816    ensureOverlay().then(function () {
9817      if (overlayManager.active === dialog) {
9818        overlayManager.close(dialog);
9819      }
9820    });
9821  }
9822  renderPages() {
9823    if (this.pdfDocument.isPureXfa) {
9824      (0,_print_utils_js__WEBPACK_IMPORTED_MODULE_1__.getXfaHtmlForPrinting)(this.printContainer, this.pdfDocument);
9825      return Promise.resolve();
9826    }
9827    const pageCount = this.pagesOverview.length;
9828    const renderNextPage = (resolve, reject) => {
9829      this.throwIfInactive();
9830      if (++this.currentPage >= pageCount) {
9831        renderProgress(pageCount, pageCount);
9832        resolve();
9833        return;
9834      }
9835      const index = this.currentPage;
9836      renderProgress(index, pageCount);
9837      renderPage(this, this.pdfDocument, index + 1, this.pagesOverview[index], this._printResolution, this._optionalContentConfigPromise, this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then(function () {
9838        renderNextPage(resolve, reject);
9839      }, reject);
9840    };
9841    return new Promise(renderNextPage);
9842  }
9843  useRenderedPage() {
9844    this.throwIfInactive();
9845    const img = document.createElement("img");
9846    const scratchCanvas = this.scratchCanvas;
9847    if ("toBlob" in scratchCanvas) {
9848      scratchCanvas.toBlob(function (blob) {
9849        img.src = URL.createObjectURL(blob);
9850      });
9851    } else {
9852      img.src = scratchCanvas.toDataURL();
9853    }
9854    const wrapper = document.createElement("div");
9855    wrapper.className = "printedPage";
9856    wrapper.append(img);
9857    this.printContainer.append(wrapper);
9858    return new Promise(function (resolve, reject) {
9859      img.onload = resolve;
9860      img.onerror = reject;
9861    });
9862  }
9863  performPrint() {
9864    this.throwIfInactive();
9865    return new Promise(resolve => {
9866      setTimeout(() => {
9867        if (!this.active) {
9868          resolve();
9869          return;
9870        }
9871        print.call(window);
9872        setTimeout(resolve, 20);
9873      }, 0);
9874    });
9875  }
9876  get active() {
9877    return this === activeService;
9878  }
9879  throwIfInactive() {
9880    if (!this.active) {
9881      throw new Error("This print request was cancelled or completed.");
9882    }
9883  }
9884}
9885const print = window.print;
9886window.print = function () {
9887  if (activeService) {
9888    console.warn("Ignored window.print() because of a pending print job.");
9889    return;
9890  }
9891  ensureOverlay().then(function () {
9892    if (activeService) {
9893      overlayManager.open(dialog);
9894    }
9895  });
9896  try {
9897    dispatchEvent("beforeprint");
9898  } finally {
9899    if (!activeService) {
9900      console.error("Expected print service to be initialized.");
9901      ensureOverlay().then(function () {
9902        if (overlayManager.active === dialog) {
9903          overlayManager.close(dialog);
9904        }
9905      });
9906      return;
9907    }
9908    const activeServiceOnEntry = activeService;
9909    activeService.renderPages().then(function () {
9910      return activeServiceOnEntry.performPrint();
9911    }).catch(function () {}).then(function () {
9912      if (activeServiceOnEntry.active) {
9913        abort();
9914      }
9915    });
9916  }
9917};
9918function dispatchEvent(eventType) {
9919  const event = new CustomEvent(eventType, {
9920    bubbles: false,
9921    cancelable: false,
9922    detail: "custom"
9923  });
9924  window.dispatchEvent(event);
9925}
9926function abort() {
9927  if (activeService) {
9928    activeService.destroy();
9929    dispatchEvent("afterprint");
9930  }
9931}
9932function renderProgress(index, total) {
9933  dialog ||= document.getElementById("printServiceDialog");
9934  const progress = Math.round(100 * index / total);
9935  const progressBar = dialog.querySelector("progress");
9936  const progressPerc = dialog.querySelector(".relative-progress");
9937  progressBar.value = progress;
9938  progressPerc.setAttribute("data-l10n-args", JSON.stringify({
9939    progress
9940  }));
9941}
9942window.addEventListener("keydown", function (event) {
9943  if (event.keyCode === 80 && (event.ctrlKey || event.metaKey) && !event.altKey && (!event.shiftKey || window.chrome || window.opera)) {
9944    window.print();
9945    event.preventDefault();
9946    event.stopImmediatePropagation();
9947  }
9948}, true);
9949if ("onbeforeprint" in window) {
9950  const stopPropagationIfNeeded = function (event) {
9951    if (event.detail !== "custom") {
9952      event.stopImmediatePropagation();
9953    }
9954  };
9955  window.addEventListener("beforeprint", stopPropagationIfNeeded);
9956  window.addEventListener("afterprint", stopPropagationIfNeeded);
9957}
9958let overlayPromise;
9959function ensureOverlay() {
9960  if (!overlayPromise) {
9961    overlayManager = viewerApp.overlayManager;
9962    if (!overlayManager) {
9963      throw new Error("The overlay manager has not yet been initialized.");
9964    }
9965    dialog ||= document.getElementById("printServiceDialog");
9966    overlayPromise = overlayManager.register(dialog, true);
9967    document.getElementById("printCancel").onclick = abort;
9968    dialog.addEventListener("close", abort);
9969  }
9970  return overlayPromise;
9971}
9972class PDFPrintServiceFactory {
9973  static initGlobals(app) {
9974    viewerApp = app;
9975  }
9976  static get supportsPrinting() {
9977    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.shadow)(this, "supportsPrinting", true);
9978  }
9979  static createPrintService(params) {
9980    if (activeService) {
9981      throw new Error("The print service is created and active.");
9982    }
9983    return activeService = new PDFPrintService(params);
9984  }
9985}
9986
9987__webpack_async_result__();
9988} catch(e) { __webpack_async_result__(e); } });
9989
9990/***/ }),
9991
9992/***/ 6615:
9993/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
9994
9995__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
9996/* harmony export */ __webpack_require__.d(__webpack_exports__, {
9997/* harmony export */   PDFRenderingQueue: () => (/* binding */ PDFRenderingQueue)
9998/* harmony export */ });
9999/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
10000/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7256);
10001var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
10002pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
10003
10004
10005const CLEANUP_TIMEOUT = 30000;
10006class PDFRenderingQueue {
10007  constructor() {
10008    this.pdfViewer = null;
10009    this.pdfThumbnailViewer = null;
10010    this.onIdle = null;
10011    this.highestPriorityPage = null;
10012    this.idleTimeout = null;
10013    this.printing = false;
10014    this.isThumbnailViewEnabled = false;
10015    Object.defineProperty(this, "hasViewer", {
10016      value: () => !!this.pdfViewer
10017    });
10018  }
10019  setViewer(pdfViewer) {
10020    this.pdfViewer = pdfViewer;
10021  }
10022  setThumbnailViewer(pdfThumbnailViewer) {
10023    this.pdfThumbnailViewer = pdfThumbnailViewer;
10024  }
10025  isHighestPriority(view) {
10026    return this.highestPriorityPage === view.renderingId;
10027  }
10028  renderHighestPriority(currentlyVisiblePages) {
10029    if (this.idleTimeout) {
10030      clearTimeout(this.idleTimeout);
10031      this.idleTimeout = null;
10032    }
10033    if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {
10034      return;
10035    }
10036    if (this.isThumbnailViewEnabled && this.pdfThumbnailViewer?.forceRendering()) {
10037      return;
10038    }
10039    if (this.printing) {
10040      return;
10041    }
10042    if (this.onIdle) {
10043      this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);
10044    }
10045  }
10046  getHighestPriority(visible, views, scrolledDown, preRenderExtra = false) {
10047    const visibleViews = visible.views,
10048      numVisible = visibleViews.length;
10049    if (numVisible === 0) {
10050      return null;
10051    }
10052    for (let i = 0; i < numVisible; i++) {
10053      const view = visibleViews[i].view;
10054      if (!this.isViewFinished(view)) {
10055        return view;
10056      }
10057    }
10058    const firstId = visible.first.id,
10059      lastId = visible.last.id;
10060    if (lastId - firstId + 1 > numVisible) {
10061      const visibleIds = visible.ids;
10062      for (let i = 1, ii = lastId - firstId; i < ii; i++) {
10063        const holeId = scrolledDown ? firstId + i : lastId - i;
10064        if (visibleIds.has(holeId)) {
10065          continue;
10066        }
10067        const holeView = views[holeId - 1];
10068        if (!this.isViewFinished(holeView)) {
10069          return holeView;
10070        }
10071      }
10072    }
10073    let preRenderIndex = scrolledDown ? lastId : firstId - 2;
10074    let preRenderView = views[preRenderIndex];
10075    if (preRenderView && !this.isViewFinished(preRenderView)) {
10076      return preRenderView;
10077    }
10078    if (preRenderExtra) {
10079      preRenderIndex += scrolledDown ? 1 : -1;
10080      preRenderView = views[preRenderIndex];
10081      if (preRenderView && !this.isViewFinished(preRenderView)) {
10082        return preRenderView;
10083      }
10084    }
10085    return null;
10086  }
10087  isViewFinished(view) {
10088    return view.renderingState === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.FINISHED;
10089  }
10090  renderView(view) {
10091    switch (view.renderingState) {
10092      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.FINISHED:
10093        return false;
10094      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.PAUSED:
10095        this.highestPriorityPage = view.renderingId;
10096        view.resume();
10097        break;
10098      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.RUNNING:
10099        this.highestPriorityPage = view.renderingId;
10100        break;
10101      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.INITIAL:
10102        this.highestPriorityPage = view.renderingId;
10103        view.draw().finally(() => {
10104          this.renderHighestPriority();
10105        }).catch(reason => {
10106          if (reason instanceof pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.RenderingCancelledException) {
10107            return;
10108          }
10109          console.error(`renderView: "${reason}"`);
10110        });
10111        break;
10112    }
10113    return true;
10114  }
10115}
10116
10117__webpack_async_result__();
10118} catch(e) { __webpack_async_result__(e); } });
10119
10120/***/ }),
10121
10122/***/ 5942:
10123/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
10124
10125__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
10126/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10127/* harmony export */   PDFScriptingManager: () => (/* binding */ PDFScriptingManager)
10128/* harmony export */ });
10129/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
10130/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2603);
10131var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__]);
10132pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
10133
10134
10135class PDFScriptingManager {
10136  #closeCapability = null;
10137  #destroyCapability = null;
10138  #docProperties = null;
10139  #eventBus = null;
10140  #externalServices = null;
10141  #pdfDocument = null;
10142  #pdfViewer = null;
10143  #ready = false;
10144  #scripting = null;
10145  #willPrintCapability = null;
10146  constructor({
10147    eventBus,
10148    externalServices = null,
10149    docProperties = null
10150  }) {
10151    this.#eventBus = eventBus;
10152    this.#externalServices = externalServices;
10153    this.#docProperties = docProperties;
10154  }
10155  setViewer(pdfViewer) {
10156    this.#pdfViewer = pdfViewer;
10157  }
10158  async setDocument(pdfDocument) {
10159    if (this.#pdfDocument) {
10160      await this.#destroyScripting();
10161    }
10162    this.#pdfDocument = pdfDocument;
10163    if (!pdfDocument) {
10164      return;
10165    }
10166    const [objects, calculationOrder, docActions] = await Promise.all([pdfDocument.getFieldObjects(), pdfDocument.getCalculationOrderIds(), pdfDocument.getJSActions()]);
10167    if (!objects && !docActions) {
10168      await this.#destroyScripting();
10169      return;
10170    }
10171    if (pdfDocument !== this.#pdfDocument) {
10172      return;
10173    }
10174    try {
10175      this.#scripting = this.#initScripting();
10176    } catch (error) {
10177      console.error(`setDocument: "${error.message}".`);
10178      await this.#destroyScripting();
10179      return;
10180    }
10181    this._internalEvents.set("updatefromsandbox", event => {
10182      if (event?.source === window) {
10183        this.#updateFromSandbox(event.detail);
10184      }
10185    });
10186    this._internalEvents.set("dispatcheventinsandbox", event => {
10187      this.#scripting?.dispatchEventInSandbox(event.detail);
10188    });
10189    this._internalEvents.set("pagechanging", ({
10190      pageNumber,
10191      previous
10192    }) => {
10193      if (pageNumber === previous) {
10194        return;
10195      }
10196      this.#dispatchPageClose(previous);
10197      this.#dispatchPageOpen(pageNumber);
10198    });
10199    this._internalEvents.set("pagerendered", ({
10200      pageNumber
10201    }) => {
10202      if (!this._pageOpenPending.has(pageNumber)) {
10203        return;
10204      }
10205      if (pageNumber !== this.#pdfViewer.currentPageNumber) {
10206        return;
10207      }
10208      this.#dispatchPageOpen(pageNumber);
10209    });
10210    this._internalEvents.set("pagesdestroy", async () => {
10211      await this.#dispatchPageClose(this.#pdfViewer.currentPageNumber);
10212      await this.#scripting?.dispatchEventInSandbox({
10213        id: "doc",
10214        name: "WillClose"
10215      });
10216      this.#closeCapability?.resolve();
10217    });
10218    for (const [name, listener] of this._internalEvents) {
10219      this.#eventBus._on(name, listener);
10220    }
10221    try {
10222      const docProperties = await this.#docProperties(pdfDocument);
10223      if (pdfDocument !== this.#pdfDocument) {
10224        return;
10225      }
10226      await this.#scripting.createSandbox({
10227        objects,
10228        calculationOrder,
10229        appInfo: {
10230          platform: navigator.platform,
10231          language: navigator.language
10232        },
10233        docInfo: {
10234          ...docProperties,
10235          actions: docActions
10236        }
10237      });
10238      this.#eventBus.dispatch("sandboxcreated", {
10239        source: this
10240      });
10241    } catch (error) {
10242      console.error(`setDocument: "${error.message}".`);
10243      await this.#destroyScripting();
10244      return;
10245    }
10246    await this.#scripting?.dispatchEventInSandbox({
10247      id: "doc",
10248      name: "Open"
10249    });
10250    await this.#dispatchPageOpen(this.#pdfViewer.currentPageNumber, true);
10251    Promise.resolve().then(() => {
10252      if (pdfDocument === this.#pdfDocument) {
10253        this.#ready = true;
10254      }
10255    });
10256  }
10257  async dispatchWillSave() {
10258    return this.#scripting?.dispatchEventInSandbox({
10259      id: "doc",
10260      name: "WillSave"
10261    });
10262  }
10263  async dispatchDidSave() {
10264    return this.#scripting?.dispatchEventInSandbox({
10265      id: "doc",
10266      name: "DidSave"
10267    });
10268  }
10269  async dispatchWillPrint() {
10270    if (!this.#scripting) {
10271      return;
10272    }
10273    await this.#willPrintCapability?.promise;
10274    this.#willPrintCapability = Promise.withResolvers();
10275    try {
10276      await this.#scripting.dispatchEventInSandbox({
10277        id: "doc",
10278        name: "WillPrint"
10279      });
10280    } catch (ex) {
10281      this.#willPrintCapability.resolve();
10282      this.#willPrintCapability = null;
10283      throw ex;
10284    }
10285    await this.#willPrintCapability.promise;
10286  }
10287  async dispatchDidPrint() {
10288    return this.#scripting?.dispatchEventInSandbox({
10289      id: "doc",
10290      name: "DidPrint"
10291    });
10292  }
10293  get destroyPromise() {
10294    return this.#destroyCapability?.promise || null;
10295  }
10296  get ready() {
10297    return this.#ready;
10298  }
10299  get _internalEvents() {
10300    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "_internalEvents", new Map());
10301  }
10302  get _pageOpenPending() {
10303    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "_pageOpenPending", new Set());
10304  }
10305  get _visitedPages() {
10306    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.shadow)(this, "_visitedPages", new Map());
10307  }
10308  async #updateFromSandbox(detail) {
10309    const pdfViewer = this.#pdfViewer;
10310    const isInPresentationMode = pdfViewer.isInPresentationMode || pdfViewer.isChangingPresentationMode;
10311    const {
10312      id,
10313      siblings,
10314      command,
10315      value
10316    } = detail;
10317    if (!id) {
10318      switch (command) {
10319        case "clear":
10320          console.clear();
10321          break;
10322        case "error":
10323          console.error(value);
10324          break;
10325        case "layout":
10326          if (!isInPresentationMode) {
10327            const modes = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.apiPageLayoutToViewerModes)(value);
10328            pdfViewer.spreadMode = modes.spreadMode;
10329          }
10330          break;
10331        case "page-num":
10332          pdfViewer.currentPageNumber = value + 1;
10333          break;
10334        case "print":
10335          await pdfViewer.pagesPromise;
10336          this.#eventBus.dispatch("print", {
10337            source: this
10338          });
10339          break;
10340        case "println":
10341          console.log(value);
10342          break;
10343        case "zoom":
10344          if (!isInPresentationMode) {
10345            pdfViewer.currentScaleValue = value;
10346          }
10347          break;
10348        case "SaveAs":
10349          this.#eventBus.dispatch("download", {
10350            source: this
10351          });
10352          break;
10353        case "FirstPage":
10354          pdfViewer.currentPageNumber = 1;
10355          break;
10356        case "LastPage":
10357          pdfViewer.currentPageNumber = pdfViewer.pagesCount;
10358          break;
10359        case "NextPage":
10360          pdfViewer.nextPage();
10361          break;
10362        case "PrevPage":
10363          pdfViewer.previousPage();
10364          break;
10365        case "ZoomViewIn":
10366          if (!isInPresentationMode) {
10367            pdfViewer.increaseScale();
10368          }
10369          break;
10370        case "ZoomViewOut":
10371          if (!isInPresentationMode) {
10372            pdfViewer.decreaseScale();
10373          }
10374          break;
10375        case "WillPrintFinished":
10376          this.#willPrintCapability?.resolve();
10377          this.#willPrintCapability = null;
10378          break;
10379      }
10380      return;
10381    }
10382    if (isInPresentationMode && detail.focus) {
10383      return;
10384    }
10385    delete detail.id;
10386    delete detail.siblings;
10387    const ids = siblings ? [id, ...siblings] : [id];
10388    for (const elementId of ids) {
10389      const element = document.querySelector(`[data-element-id="${elementId}"]`);
10390      if (element) {
10391        element.dispatchEvent(new CustomEvent("updatefromsandbox", {
10392          detail
10393        }));
10394      } else {
10395        this.#pdfDocument?.annotationStorage.setValue(elementId, detail);
10396      }
10397    }
10398  }
10399  async #dispatchPageOpen(pageNumber, initialize = false) {
10400    const pdfDocument = this.#pdfDocument,
10401      visitedPages = this._visitedPages;
10402    if (initialize) {
10403      this.#closeCapability = Promise.withResolvers();
10404    }
10405    if (!this.#closeCapability) {
10406      return;
10407    }
10408    const pageView = this.#pdfViewer.getPageView(pageNumber - 1);
10409    if (pageView?.renderingState !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.FINISHED) {
10410      this._pageOpenPending.add(pageNumber);
10411      return;
10412    }
10413    this._pageOpenPending.delete(pageNumber);
10414    const actionsPromise = (async () => {
10415      const actions = await (!visitedPages.has(pageNumber) ? pageView.pdfPage?.getJSActions() : null);
10416      if (pdfDocument !== this.#pdfDocument) {
10417        return;
10418      }
10419      await this.#scripting?.dispatchEventInSandbox({
10420        id: "page",
10421        name: "PageOpen",
10422        pageNumber,
10423        actions
10424      });
10425    })();
10426    visitedPages.set(pageNumber, actionsPromise);
10427  }
10428  async #dispatchPageClose(pageNumber) {
10429    const pdfDocument = this.#pdfDocument,
10430      visitedPages = this._visitedPages;
10431    if (!this.#closeCapability) {
10432      return;
10433    }
10434    if (this._pageOpenPending.has(pageNumber)) {
10435      return;
10436    }
10437    const actionsPromise = visitedPages.get(pageNumber);
10438    if (!actionsPromise) {
10439      return;
10440    }
10441    visitedPages.set(pageNumber, null);
10442    await actionsPromise;
10443    if (pdfDocument !== this.#pdfDocument) {
10444      return;
10445    }
10446    await this.#scripting?.dispatchEventInSandbox({
10447      id: "page",
10448      name: "PageClose",
10449      pageNumber
10450    });
10451  }
10452  #initScripting() {
10453    this.#destroyCapability = Promise.withResolvers();
10454    if (this.#scripting) {
10455      throw new Error("#initScripting: Scripting already exists.");
10456    }
10457    return this.#externalServices.createScripting();
10458  }
10459  async #destroyScripting() {
10460    if (!this.#scripting) {
10461      this.#pdfDocument = null;
10462      this.#destroyCapability?.resolve();
10463      return;
10464    }
10465    if (this.#closeCapability) {
10466      await Promise.race([this.#closeCapability.promise, new Promise(resolve => {
10467        setTimeout(resolve, 1000);
10468      })]).catch(() => {});
10469      this.#closeCapability = null;
10470    }
10471    this.#pdfDocument = null;
10472    try {
10473      await this.#scripting.destroySandbox();
10474    } catch {}
10475    this.#willPrintCapability?.reject(new Error("Scripting destroyed."));
10476    this.#willPrintCapability = null;
10477    for (const [name, listener] of this._internalEvents) {
10478      this.#eventBus._off(name, listener);
10479    }
10480    this._internalEvents.clear();
10481    this._pageOpenPending.clear();
10482    this._visitedPages.clear();
10483    this.#scripting = null;
10484    this.#ready = false;
10485    this.#destroyCapability?.resolve();
10486  }
10487}
10488
10489__webpack_async_result__();
10490} catch(e) { __webpack_async_result__(e); } });
10491
10492/***/ }),
10493
10494/***/ 2275:
10495/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
10496
10497/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10498/* harmony export */   PDFSidebar: () => (/* binding */ PDFSidebar)
10499/* harmony export */ });
10500/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
10501
10502const SIDEBAR_WIDTH_VAR = "--sidebar-width";
10503const SIDEBAR_MIN_WIDTH = 200;
10504const SIDEBAR_RESIZING_CLASS = "sidebarResizing";
10505const UI_NOTIFICATION_CLASS = "pdfSidebarNotification";
10506class PDFSidebar {
10507  #isRTL = false;
10508  #mouseMoveBound = this.#mouseMove.bind(this);
10509  #mouseUpBound = this.#mouseUp.bind(this);
10510  #outerContainerWidth = null;
10511  #width = null;
10512  constructor({
10513    elements,
10514    eventBus,
10515    l10n
10516  }) {
10517    this.isOpen = false;
10518    this.active = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS;
10519    this.isInitialViewSet = false;
10520    this.isInitialEventDispatched = false;
10521    this.onToggled = null;
10522    this.onUpdateThumbnails = null;
10523    this.outerContainer = elements.outerContainer;
10524    this.sidebarContainer = elements.sidebarContainer;
10525    this.toggleButton = elements.toggleButton;
10526    this.resizer = elements.resizer;
10527    this.thumbnailButton = elements.thumbnailButton;
10528    this.outlineButton = elements.outlineButton;
10529    this.attachmentsButton = elements.attachmentsButton;
10530    this.layersButton = elements.layersButton;
10531    this.thumbnailView = elements.thumbnailView;
10532    this.outlineView = elements.outlineView;
10533    this.attachmentsView = elements.attachmentsView;
10534    this.layersView = elements.layersView;
10535    this._currentOutlineItemButton = elements.currentOutlineItemButton;
10536    this.eventBus = eventBus;
10537    this.#isRTL = l10n.getDirection() === "rtl";
10538    this.#addEventListeners();
10539  }
10540  reset() {
10541    this.isInitialViewSet = false;
10542    this.isInitialEventDispatched = false;
10543    this.#hideUINotification(true);
10544    this.switchView(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS);
10545    this.outlineButton.disabled = false;
10546    this.attachmentsButton.disabled = false;
10547    this.layersButton.disabled = false;
10548    this._currentOutlineItemButton.disabled = true;
10549  }
10550  get visibleView() {
10551    return this.isOpen ? this.active : _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.NONE;
10552  }
10553  setInitialView(view = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.NONE) {
10554    if (this.isInitialViewSet) {
10555      return;
10556    }
10557    this.isInitialViewSet = true;
10558    if (view === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.NONE || view === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.UNKNOWN) {
10559      this.#dispatchEvent();
10560      return;
10561    }
10562    this.switchView(view, true);
10563    if (!this.isInitialEventDispatched) {
10564      this.#dispatchEvent();
10565    }
10566  }
10567  switchView(view, forceOpen = false) {
10568    const isViewChanged = view !== this.active;
10569    let forceRendering = false;
10570    switch (view) {
10571      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.NONE:
10572        if (this.isOpen) {
10573          this.close();
10574        }
10575        return;
10576      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS:
10577        if (this.isOpen && isViewChanged) {
10578          forceRendering = true;
10579        }
10580        break;
10581      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.OUTLINE:
10582        if (this.outlineButton.disabled) {
10583          return;
10584        }
10585        break;
10586      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.ATTACHMENTS:
10587        if (this.attachmentsButton.disabled) {
10588          return;
10589        }
10590        break;
10591      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.LAYERS:
10592        if (this.layersButton.disabled) {
10593          return;
10594        }
10595        break;
10596      default:
10597        console.error(`PDFSidebar.switchView: "${view}" is not a valid view.`);
10598        return;
10599    }
10600    this.active = view;
10601    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(this.thumbnailButton, view === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS, this.thumbnailView);
10602    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(this.outlineButton, view === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.OUTLINE, this.outlineView);
10603    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(this.attachmentsButton, view === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.ATTACHMENTS, this.attachmentsView);
10604    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(this.layersButton, view === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.LAYERS, this.layersView);
10605    if (forceOpen && !this.isOpen) {
10606      this.open();
10607      return;
10608    }
10609    if (forceRendering) {
10610      this.onUpdateThumbnails();
10611      this.onToggled();
10612    }
10613    if (isViewChanged) {
10614      this.#dispatchEvent();
10615    }
10616  }
10617  open() {
10618    if (this.isOpen) {
10619      return;
10620    }
10621    this.isOpen = true;
10622    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleExpandedBtn)(this.toggleButton, true);
10623    this.outerContainer.classList.add("sidebarMoving", "sidebarOpen");
10624    if (this.active === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS) {
10625      this.onUpdateThumbnails();
10626    }
10627    this.onToggled();
10628    this.#dispatchEvent();
10629    this.#hideUINotification();
10630  }
10631  close(evt = null) {
10632    if (!this.isOpen) {
10633      return;
10634    }
10635    this.isOpen = false;
10636    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleExpandedBtn)(this.toggleButton, false);
10637    this.outerContainer.classList.add("sidebarMoving");
10638    this.outerContainer.classList.remove("sidebarOpen");
10639    this.onToggled();
10640    this.#dispatchEvent();
10641    if (evt?.detail > 0) {
10642      this.toggleButton.blur();
10643    }
10644  }
10645  toggle(evt = null) {
10646    if (this.isOpen) {
10647      this.close(evt);
10648    } else {
10649      this.open();
10650    }
10651  }
10652  #dispatchEvent() {
10653    if (this.isInitialViewSet) {
10654      this.isInitialEventDispatched ||= true;
10655    }
10656    this.eventBus.dispatch("sidebarviewchanged", {
10657      source: this,
10658      view: this.visibleView
10659    });
10660  }
10661  #showUINotification() {
10662    this.toggleButton.setAttribute("data-l10n-id", "pdfjs-toggle-sidebar-notification-button");
10663    if (!this.isOpen) {
10664      this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);
10665    }
10666  }
10667  #hideUINotification(reset = false) {
10668    if (this.isOpen || reset) {
10669      this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);
10670    }
10671    if (reset) {
10672      this.toggleButton.setAttribute("data-l10n-id", "pdfjs-toggle-sidebar-button");
10673    }
10674  }
10675  #addEventListeners() {
10676    this.sidebarContainer.addEventListener("transitionend", evt => {
10677      if (evt.target === this.sidebarContainer) {
10678        this.outerContainer.classList.remove("sidebarMoving");
10679        this.eventBus.dispatch("resize", {
10680          source: this
10681        });
10682      }
10683    });
10684    this.toggleButton.addEventListener("click", evt => {
10685      this.toggle(evt);
10686    });
10687    this.thumbnailButton.addEventListener("click", () => {
10688      this.switchView(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS);
10689    });
10690    this.outlineButton.addEventListener("click", () => {
10691      this.switchView(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.OUTLINE);
10692    });
10693    this.outlineButton.addEventListener("dblclick", () => {
10694      this.eventBus.dispatch("toggleoutlinetree", {
10695        source: this
10696      });
10697    });
10698    this.attachmentsButton.addEventListener("click", () => {
10699      this.switchView(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.ATTACHMENTS);
10700    });
10701    this.layersButton.addEventListener("click", () => {
10702      this.switchView(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.LAYERS);
10703    });
10704    this.layersButton.addEventListener("dblclick", () => {
10705      this.eventBus.dispatch("resetlayers", {
10706        source: this
10707      });
10708    });
10709    this._currentOutlineItemButton.addEventListener("click", () => {
10710      this.eventBus.dispatch("currentoutlineitem", {
10711        source: this
10712      });
10713    });
10714    const onTreeLoaded = (count, button, view) => {
10715      button.disabled = !count;
10716      if (count) {
10717        this.#showUINotification();
10718      } else if (this.active === view) {
10719        this.switchView(_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS);
10720      }
10721    };
10722    this.eventBus._on("outlineloaded", evt => {
10723      onTreeLoaded(evt.outlineCount, this.outlineButton, _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.OUTLINE);
10724      evt.currentOutlineItemPromise.then(enabled => {
10725        if (!this.isInitialViewSet) {
10726          return;
10727        }
10728        this._currentOutlineItemButton.disabled = !enabled;
10729      });
10730    });
10731    this.eventBus._on("attachmentsloaded", evt => {
10732      onTreeLoaded(evt.attachmentsCount, this.attachmentsButton, _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.ATTACHMENTS);
10733    });
10734    this.eventBus._on("layersloaded", evt => {
10735      onTreeLoaded(evt.layersCount, this.layersButton, _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.LAYERS);
10736    });
10737    this.eventBus._on("presentationmodechanged", evt => {
10738      if (evt.state === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.PresentationModeState.NORMAL && this.visibleView === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SidebarView.THUMBS) {
10739        this.onUpdateThumbnails();
10740      }
10741    });
10742    this.resizer.addEventListener("mousedown", evt => {
10743      if (evt.button !== 0) {
10744        return;
10745      }
10746      this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);
10747      window.addEventListener("mousemove", this.#mouseMoveBound);
10748      window.addEventListener("mouseup", this.#mouseUpBound);
10749    });
10750    this.eventBus._on("resize", evt => {
10751      if (evt.source !== window) {
10752        return;
10753      }
10754      this.#outerContainerWidth = null;
10755      if (!this.#width) {
10756        return;
10757      }
10758      if (!this.isOpen) {
10759        this.#updateWidth(this.#width);
10760        return;
10761      }
10762      this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);
10763      const updated = this.#updateWidth(this.#width);
10764      Promise.resolve().then(() => {
10765        this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);
10766        if (updated) {
10767          this.eventBus.dispatch("resize", {
10768            source: this
10769          });
10770        }
10771      });
10772    });
10773  }
10774  get outerContainerWidth() {
10775    return this.#outerContainerWidth ||= this.outerContainer.clientWidth;
10776  }
10777  #updateWidth(width = 0) {
10778    const maxWidth = Math.floor(this.outerContainerWidth / 2);
10779    if (width > maxWidth) {
10780      width = maxWidth;
10781    }
10782    if (width < SIDEBAR_MIN_WIDTH) {
10783      width = SIDEBAR_MIN_WIDTH;
10784    }
10785    if (width === this.#width) {
10786      return false;
10787    }
10788    this.#width = width;
10789    _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.docStyle.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`);
10790    return true;
10791  }
10792  #mouseMove(evt) {
10793    let width = evt.clientX;
10794    if (this.#isRTL) {
10795      width = this.outerContainerWidth - width;
10796    }
10797    this.#updateWidth(width);
10798  }
10799  #mouseUp(evt) {
10800    this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);
10801    this.eventBus.dispatch("resize", {
10802      source: this
10803    });
10804    window.removeEventListener("mousemove", this.#mouseMoveBound);
10805    window.removeEventListener("mouseup", this.#mouseUpBound);
10806  }
10807}
10808
10809
10810/***/ }),
10811
10812/***/ 1123:
10813/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
10814
10815__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
10816/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10817/* harmony export */   PDFThumbnailView: () => (/* binding */ PDFThumbnailView),
10818/* harmony export */   TempImageFactory: () => (/* binding */ TempImageFactory)
10819/* harmony export */ });
10820/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
10821/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2603);
10822var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__]);
10823pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
10824
10825
10826const DRAW_UPSCALE_FACTOR = 2;
10827const MAX_NUM_SCALING_STEPS = 3;
10828const THUMBNAIL_WIDTH = 98;
10829class TempImageFactory {
10830  static #tempCanvas = null;
10831  static getCanvas(width, height) {
10832    const tempCanvas = this.#tempCanvas ||= document.createElement("canvas");
10833    tempCanvas.width = width;
10834    tempCanvas.height = height;
10835    const ctx = tempCanvas.getContext("2d", {
10836      alpha: false
10837    });
10838    ctx.save();
10839    ctx.fillStyle = "rgb(255, 255, 255)";
10840    ctx.fillRect(0, 0, width, height);
10841    ctx.restore();
10842    return [tempCanvas, tempCanvas.getContext("2d")];
10843  }
10844  static destroyCanvas() {
10845    const tempCanvas = this.#tempCanvas;
10846    if (tempCanvas) {
10847      tempCanvas.width = 0;
10848      tempCanvas.height = 0;
10849    }
10850    this.#tempCanvas = null;
10851  }
10852}
10853class PDFThumbnailView {
10854  constructor({
10855    container,
10856    eventBus,
10857    id,
10858    defaultViewport,
10859    optionalContentConfigPromise,
10860    linkService,
10861    renderingQueue,
10862    pageColors
10863  }) {
10864    this.id = id;
10865    this.renderingId = "thumbnail" + id;
10866    this.pageLabel = null;
10867    this.pdfPage = null;
10868    this.rotation = 0;
10869    this.viewport = defaultViewport;
10870    this.pdfPageRotate = defaultViewport.rotation;
10871    this._optionalContentConfigPromise = optionalContentConfigPromise || null;
10872    this.pageColors = pageColors || null;
10873    this.eventBus = eventBus;
10874    this.linkService = linkService;
10875    this.renderingQueue = renderingQueue;
10876    this.renderTask = null;
10877    this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.INITIAL;
10878    this.resume = null;
10879    const anchor = document.createElement("a");
10880    anchor.href = linkService.getAnchorUrl("#page=" + id);
10881    anchor.setAttribute("data-l10n-id", "pdfjs-thumb-page-title");
10882    anchor.setAttribute("data-l10n-args", this.#pageL10nArgs);
10883    anchor.onclick = function () {
10884      linkService.goToPage(id);
10885      return false;
10886    };
10887    this.anchor = anchor;
10888    const div = document.createElement("div");
10889    div.className = "thumbnail";
10890    div.setAttribute("data-page-number", this.id);
10891    this.div = div;
10892    this.#updateDims();
10893    const img = document.createElement("div");
10894    img.className = "thumbnailImage";
10895    this._placeholderImg = img;
10896    div.append(img);
10897    anchor.append(div);
10898    container.append(anchor);
10899  }
10900  #updateDims() {
10901    const {
10902      width,
10903      height
10904    } = this.viewport;
10905    const ratio = width / height;
10906    this.canvasWidth = THUMBNAIL_WIDTH;
10907    this.canvasHeight = this.canvasWidth / ratio | 0;
10908    this.scale = this.canvasWidth / width;
10909    const {
10910      style
10911    } = this.div;
10912    style.setProperty("--thumbnail-width", `${this.canvasWidth}px`);
10913    style.setProperty("--thumbnail-height", `${this.canvasHeight}px`);
10914  }
10915  setPdfPage(pdfPage) {
10916    this.pdfPage = pdfPage;
10917    this.pdfPageRotate = pdfPage.rotate;
10918    const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
10919    this.viewport = pdfPage.getViewport({
10920      scale: 1,
10921      rotation: totalRotation
10922    });
10923    this.reset();
10924  }
10925  reset() {
10926    this.cancelRendering();
10927    this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.INITIAL;
10928    this.div.removeAttribute("data-loaded");
10929    this.image?.replaceWith(this._placeholderImg);
10930    this.#updateDims();
10931    if (this.image) {
10932      this.image.removeAttribute("src");
10933      delete this.image;
10934    }
10935  }
10936  update({
10937    rotation = null
10938  }) {
10939    if (typeof rotation === "number") {
10940      this.rotation = rotation;
10941    }
10942    const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
10943    this.viewport = this.viewport.clone({
10944      scale: 1,
10945      rotation: totalRotation
10946    });
10947    this.reset();
10948  }
10949  cancelRendering() {
10950    if (this.renderTask) {
10951      this.renderTask.cancel();
10952      this.renderTask = null;
10953    }
10954    this.resume = null;
10955  }
10956  #getPageDrawContext(upscaleFactor = 1) {
10957    const canvas = document.createElement("canvas");
10958    const ctx = canvas.getContext("2d", {
10959      alpha: false
10960    });
10961    const outputScale = new _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.OutputScale();
10962    canvas.width = upscaleFactor * this.canvasWidth * outputScale.sx | 0;
10963    canvas.height = upscaleFactor * this.canvasHeight * outputScale.sy | 0;
10964    const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;
10965    return {
10966      ctx,
10967      canvas,
10968      transform
10969    };
10970  }
10971  #convertCanvasToImage(canvas) {
10972    if (this.renderingState !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.FINISHED) {
10973      throw new Error("#convertCanvasToImage: Rendering has not finished.");
10974    }
10975    const reducedCanvas = this.#reduceImage(canvas);
10976    const image = document.createElement("img");
10977    image.className = "thumbnailImage";
10978    image.setAttribute("data-l10n-id", "pdfjs-thumb-page-canvas");
10979    image.setAttribute("data-l10n-args", this.#pageL10nArgs);
10980    image.src = reducedCanvas.toDataURL();
10981    this.image = image;
10982    this.div.setAttribute("data-loaded", true);
10983    this._placeholderImg.replaceWith(image);
10984    reducedCanvas.width = 0;
10985    reducedCanvas.height = 0;
10986  }
10987  async #finishRenderTask(renderTask, canvas, error = null) {
10988    if (renderTask === this.renderTask) {
10989      this.renderTask = null;
10990    }
10991    if (error instanceof pdfjs_lib__WEBPACK_IMPORTED_MODULE_1__.RenderingCancelledException) {
10992      return;
10993    }
10994    this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.FINISHED;
10995    this.#convertCanvasToImage(canvas);
10996    if (error) {
10997      throw error;
10998    }
10999  }
11000  async draw() {
11001    if (this.renderingState !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.INITIAL) {
11002      console.error("Must be in new state before drawing");
11003      return undefined;
11004    }
11005    const {
11006      pdfPage
11007    } = this;
11008    if (!pdfPage) {
11009      this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.FINISHED;
11010      throw new Error("pdfPage is not loaded");
11011    }
11012    this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.RUNNING;
11013    const {
11014      ctx,
11015      canvas,
11016      transform
11017    } = this.#getPageDrawContext(DRAW_UPSCALE_FACTOR);
11018    const drawViewport = this.viewport.clone({
11019      scale: DRAW_UPSCALE_FACTOR * this.scale
11020    });
11021    const renderContinueCallback = cont => {
11022      if (!this.renderingQueue.isHighestPriority(this)) {
11023        this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.PAUSED;
11024        this.resume = () => {
11025          this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.RUNNING;
11026          cont();
11027        };
11028        return;
11029      }
11030      cont();
11031    };
11032    const renderContext = {
11033      canvasContext: ctx,
11034      transform,
11035      viewport: drawViewport,
11036      optionalContentConfigPromise: this._optionalContentConfigPromise,
11037      pageColors: this.pageColors
11038    };
11039    const renderTask = this.renderTask = pdfPage.render(renderContext);
11040    renderTask.onContinue = renderContinueCallback;
11041    const resultPromise = renderTask.promise.then(() => this.#finishRenderTask(renderTask, canvas), error => this.#finishRenderTask(renderTask, canvas, error));
11042    resultPromise.finally(() => {
11043      canvas.width = 0;
11044      canvas.height = 0;
11045      this.eventBus.dispatch("thumbnailrendered", {
11046        source: this,
11047        pageNumber: this.id,
11048        pdfPage: this.pdfPage
11049      });
11050    });
11051    return resultPromise;
11052  }
11053  setImage(pageView) {
11054    if (this.renderingState !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.INITIAL) {
11055      return;
11056    }
11057    const {
11058      thumbnailCanvas: canvas,
11059      pdfPage,
11060      scale
11061    } = pageView;
11062    if (!canvas) {
11063      return;
11064    }
11065    if (!this.pdfPage) {
11066      this.setPdfPage(pdfPage);
11067    }
11068    if (scale < this.scale) {
11069      return;
11070    }
11071    this.renderingState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.FINISHED;
11072    this.#convertCanvasToImage(canvas);
11073  }
11074  #reduceImage(img) {
11075    const {
11076      ctx,
11077      canvas
11078    } = this.#getPageDrawContext();
11079    if (img.width <= 2 * canvas.width) {
11080      ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height);
11081      return canvas;
11082    }
11083    let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;
11084    let reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;
11085    const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(reducedWidth, reducedHeight);
11086    while (reducedWidth > img.width || reducedHeight > img.height) {
11087      reducedWidth >>= 1;
11088      reducedHeight >>= 1;
11089    }
11090    reducedImageCtx.drawImage(img, 0, 0, img.width, img.height, 0, 0, reducedWidth, reducedHeight);
11091    while (reducedWidth > 2 * canvas.width) {
11092      reducedImageCtx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, reducedWidth >> 1, reducedHeight >> 1);
11093      reducedWidth >>= 1;
11094      reducedHeight >>= 1;
11095    }
11096    ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, canvas.width, canvas.height);
11097    return canvas;
11098  }
11099  get #pageL10nArgs() {
11100    return JSON.stringify({
11101      page: this.pageLabel ?? this.id
11102    });
11103  }
11104  setPageLabel(label) {
11105    this.pageLabel = typeof label === "string" ? label : null;
11106    this.anchor.setAttribute("data-l10n-args", this.#pageL10nArgs);
11107    if (this.renderingState !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.FINISHED) {
11108      return;
11109    }
11110    this.image?.setAttribute("data-l10n-args", this.#pageL10nArgs);
11111  }
11112}
11113
11114__webpack_async_result__();
11115} catch(e) { __webpack_async_result__(e); } });
11116
11117/***/ }),
11118
11119/***/ 8280:
11120/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
11121
11122__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
11123/* harmony export */ __webpack_require__.d(__webpack_exports__, {
11124/* harmony export */   PDFThumbnailViewer: () => (/* binding */ PDFThumbnailViewer)
11125/* harmony export */ });
11126/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
11127/* harmony import */ var _pdf_thumbnail_view_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1123);
11128var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_pdf_thumbnail_view_js__WEBPACK_IMPORTED_MODULE_1__]);
11129_pdf_thumbnail_view_js__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
11130
11131
11132const THUMBNAIL_SCROLL_MARGIN = -19;
11133const THUMBNAIL_SELECTED_CLASS = "selected";
11134class PDFThumbnailViewer {
11135  constructor({
11136    container,
11137    eventBus,
11138    linkService,
11139    renderingQueue,
11140    pageColors
11141  }) {
11142    this.container = container;
11143    this.eventBus = eventBus;
11144    this.linkService = linkService;
11145    this.renderingQueue = renderingQueue;
11146    this.pageColors = pageColors || null;
11147    this.scroll = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.watchScroll)(this.container, this.#scrollUpdated.bind(this));
11148    this.#resetView();
11149  }
11150  #scrollUpdated() {
11151    this.renderingQueue.renderHighestPriority();
11152  }
11153  getThumbnail(index) {
11154    return this._thumbnails[index];
11155  }
11156  #getVisibleThumbs() {
11157    return (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.getVisibleElements)({
11158      scrollEl: this.container,
11159      views: this._thumbnails
11160    });
11161  }
11162  scrollThumbnailIntoView(pageNumber) {
11163    if (!this.pdfDocument) {
11164      return;
11165    }
11166    const thumbnailView = this._thumbnails[pageNumber - 1];
11167    if (!thumbnailView) {
11168      console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');
11169      return;
11170    }
11171    if (pageNumber !== this._currentPageNumber) {
11172      const prevThumbnailView = this._thumbnails[this._currentPageNumber - 1];
11173      prevThumbnailView.div.classList.remove(THUMBNAIL_SELECTED_CLASS);
11174      thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
11175    }
11176    const {
11177      first,
11178      last,
11179      views
11180    } = this.#getVisibleThumbs();
11181    if (views.length > 0) {
11182      let shouldScroll = false;
11183      if (pageNumber <= first.id || pageNumber >= last.id) {
11184        shouldScroll = true;
11185      } else {
11186        for (const {
11187          id,
11188          percent
11189        } of views) {
11190          if (id !== pageNumber) {
11191            continue;
11192          }
11193          shouldScroll = percent < 100;
11194          break;
11195        }
11196      }
11197      if (shouldScroll) {
11198        (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.scrollIntoView)(thumbnailView.div, {
11199          top: THUMBNAIL_SCROLL_MARGIN
11200        });
11201      }
11202    }
11203    this._currentPageNumber = pageNumber;
11204  }
11205  get pagesRotation() {
11206    return this._pagesRotation;
11207  }
11208  set pagesRotation(rotation) {
11209    if (!(0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.isValidRotation)(rotation)) {
11210      throw new Error("Invalid thumbnails rotation angle.");
11211    }
11212    if (!this.pdfDocument) {
11213      return;
11214    }
11215    if (this._pagesRotation === rotation) {
11216      return;
11217    }
11218    this._pagesRotation = rotation;
11219    const updateArgs = {
11220      rotation
11221    };
11222    for (const thumbnail of this._thumbnails) {
11223      thumbnail.update(updateArgs);
11224    }
11225  }
11226  cleanup() {
11227    for (const thumbnail of this._thumbnails) {
11228      if (thumbnail.renderingState !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates.FINISHED) {
11229        thumbnail.reset();
11230      }
11231    }
11232    _pdf_thumbnail_view_js__WEBPACK_IMPORTED_MODULE_1__.TempImageFactory.destroyCanvas();
11233  }
11234  #resetView() {
11235    this._thumbnails = [];
11236    this._currentPageNumber = 1;
11237    this._pageLabels = null;
11238    this._pagesRotation = 0;
11239    this.container.textContent = "";
11240  }
11241  setDocument(pdfDocument) {
11242    if (this.pdfDocument) {
11243      this.#cancelRendering();
11244      this.#resetView();
11245    }
11246    this.pdfDocument = pdfDocument;
11247    if (!pdfDocument) {
11248      return;
11249    }
11250    const firstPagePromise = pdfDocument.getPage(1);
11251    const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({
11252      intent: "display"
11253    });
11254    firstPagePromise.then(firstPdfPage => {
11255      const pagesCount = pdfDocument.numPages;
11256      const viewport = firstPdfPage.getViewport({
11257        scale: 1
11258      });
11259      for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
11260        const thumbnail = new _pdf_thumbnail_view_js__WEBPACK_IMPORTED_MODULE_1__.PDFThumbnailView({
11261          container: this.container,
11262          eventBus: this.eventBus,
11263          id: pageNum,
11264          defaultViewport: viewport.clone(),
11265          optionalContentConfigPromise,
11266          linkService: this.linkService,
11267          renderingQueue: this.renderingQueue,
11268          pageColors: this.pageColors
11269        });
11270        this._thumbnails.push(thumbnail);
11271      }
11272      this._thumbnails[0]?.setPdfPage(firstPdfPage);
11273      const thumbnailView = this._thumbnails[this._currentPageNumber - 1];
11274      thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);
11275    }).catch(reason => {
11276      console.error("Unable to initialize thumbnail viewer", reason);
11277    });
11278  }
11279  #cancelRendering() {
11280    for (const thumbnail of this._thumbnails) {
11281      thumbnail.cancelRendering();
11282    }
11283  }
11284  setPageLabels(labels) {
11285    if (!this.pdfDocument) {
11286      return;
11287    }
11288    if (!labels) {
11289      this._pageLabels = null;
11290    } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
11291      this._pageLabels = null;
11292      console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.");
11293    } else {
11294      this._pageLabels = labels;
11295    }
11296    for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {
11297      this._thumbnails[i].setPageLabel(this._pageLabels?.[i] ?? null);
11298    }
11299  }
11300  async #ensurePdfPageLoaded(thumbView) {
11301    if (thumbView.pdfPage) {
11302      return thumbView.pdfPage;
11303    }
11304    try {
11305      const pdfPage = await this.pdfDocument.getPage(thumbView.id);
11306      if (!thumbView.pdfPage) {
11307        thumbView.setPdfPage(pdfPage);
11308      }
11309      return pdfPage;
11310    } catch (reason) {
11311      console.error("Unable to get page for thumb view", reason);
11312      return null;
11313    }
11314  }
11315  #getScrollAhead(visible) {
11316    if (visible.first?.id === 1) {
11317      return true;
11318    } else if (visible.last?.id === this._thumbnails.length) {
11319      return false;
11320    }
11321    return this.scroll.down;
11322  }
11323  forceRendering() {
11324    const visibleThumbs = this.#getVisibleThumbs();
11325    const scrollAhead = this.#getScrollAhead(visibleThumbs);
11326    const thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this._thumbnails, scrollAhead);
11327    if (thumbView) {
11328      this.#ensurePdfPageLoaded(thumbView).then(() => {
11329        this.renderingQueue.renderView(thumbView);
11330      });
11331      return true;
11332    }
11333    return false;
11334  }
11335}
11336
11337__webpack_async_result__();
11338} catch(e) { __webpack_async_result__(e); } });
11339
11340/***/ }),
11341
11342/***/ 6285:
11343/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
11344
11345__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
11346/* harmony export */ __webpack_require__.d(__webpack_exports__, {
11347/* harmony export */   PDFViewer: () => (/* binding */ PDFViewer),
11348/* harmony export */   PagesCountLimit: () => (/* binding */ PagesCountLimit)
11349/* harmony export */ });
11350/* unused harmony export PDFPageViewBuffer */
11351/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
11352/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7256);
11353/* harmony import */ var web_null_l10n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(410);
11354/* harmony import */ var _pdf_page_view_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9966);
11355/* harmony import */ var _pdf_rendering_queue_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6615);
11356/* harmony import */ var _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(787);
11357var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__, web_null_l10n__WEBPACK_IMPORTED_MODULE_2__, _pdf_page_view_js__WEBPACK_IMPORTED_MODULE_3__, _pdf_rendering_queue_js__WEBPACK_IMPORTED_MODULE_4__]);
11358([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__, web_null_l10n__WEBPACK_IMPORTED_MODULE_2__, _pdf_page_view_js__WEBPACK_IMPORTED_MODULE_3__, _pdf_rendering_queue_js__WEBPACK_IMPORTED_MODULE_4__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
11359
11360
11361
11362
11363
11364
11365const DEFAULT_CACHE_SIZE = 10;
11366const PagesCountLimit = {
11367  FORCE_SCROLL_MODE_PAGE: 15000,
11368  FORCE_LAZY_PAGE_INIT: 7500,
11369  PAUSE_EAGER_PAGE_INIT: 250
11370};
11371function isValidAnnotationEditorMode(mode) {
11372  return Object.values(pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType).includes(mode) && mode !== pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.DISABLE;
11373}
11374class PDFPageViewBuffer {
11375  #buf = new Set();
11376  #size = 0;
11377  constructor(size) {
11378    this.#size = size;
11379  }
11380  push(view) {
11381    const buf = this.#buf;
11382    if (buf.has(view)) {
11383      buf.delete(view);
11384    }
11385    buf.add(view);
11386    if (buf.size > this.#size) {
11387      this.#destroyFirstView();
11388    }
11389  }
11390  resize(newSize, idsToKeep = null) {
11391    this.#size = newSize;
11392    const buf = this.#buf;
11393    if (idsToKeep) {
11394      const ii = buf.size;
11395      let i = 1;
11396      for (const view of buf) {
11397        if (idsToKeep.has(view.id)) {
11398          buf.delete(view);
11399          buf.add(view);
11400        }
11401        if (++i > ii) {
11402          break;
11403        }
11404      }
11405    }
11406    while (buf.size > this.#size) {
11407      this.#destroyFirstView();
11408    }
11409  }
11410  has(view) {
11411    return this.#buf.has(view);
11412  }
11413  [Symbol.iterator]() {
11414    return this.#buf.keys();
11415  }
11416  #destroyFirstView() {
11417    const firstView = this.#buf.keys().next().value;
11418    firstView?.destroy();
11419    this.#buf.delete(firstView);
11420  }
11421}
11422class PDFViewer {
11423  #buffer = null;
11424  #altTextManager = null;
11425  #annotationEditorHighlightColors = null;
11426  #annotationEditorMode = pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE;
11427  #annotationEditorUIManager = null;
11428  #annotationMode = pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode.ENABLE_FORMS;
11429  #containerTopLeft = null;
11430  #copyCallbackBound = null;
11431  #enableHighlightFloatingButton = false;
11432  #enablePermissions = false;
11433  #mlManager = null;
11434  #getAllTextInProgress = false;
11435  #hiddenCopyElement = null;
11436  #interruptCopyCondition = false;
11437  #previousContainerHeight = 0;
11438  #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));
11439  #scrollModePageState = null;
11440  #onVisibilityChange = null;
11441  #scaleTimeoutId = null;
11442  #textLayerMode = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.TextLayerMode.ENABLE;
11443  constructor(options) {
11444    const viewerVersion = "4.1.392";
11445    if (pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.version !== viewerVersion) {
11446      throw new Error(`The API version "${pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.version}" does not match the Viewer version "${viewerVersion}".`);
11447    }
11448    this.container = options.container;
11449    this.viewer = options.viewer || options.container.firstElementChild;
11450    if (this.container?.tagName !== "DIV" || this.viewer?.tagName !== "DIV") {
11451      throw new Error("Invalid `container` and/or `viewer` option.");
11452    }
11453    if (this.container.offsetParent && getComputedStyle(this.container).position !== "absolute") {
11454      throw new Error("The `container` must be absolutely positioned.");
11455    }
11456    this.#resizeObserver.observe(this.container);
11457    this.eventBus = options.eventBus;
11458    this.linkService = options.linkService || new _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_5__.SimpleLinkService();
11459    this.downloadManager = options.downloadManager || null;
11460    this.findController = options.findController || null;
11461    this.#altTextManager = options.altTextManager || null;
11462    if (this.findController) {
11463      this.findController.onIsPageVisible = pageNumber => this._getVisiblePages().ids.has(pageNumber);
11464    }
11465    this._scriptingManager = options.scriptingManager || null;
11466    this.#textLayerMode = options.textLayerMode ?? _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.TextLayerMode.ENABLE;
11467    this.#annotationMode = options.annotationMode ?? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode.ENABLE_FORMS;
11468    this.#annotationEditorMode = options.annotationEditorMode ?? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE;
11469    this.#annotationEditorHighlightColors = options.annotationEditorHighlightColors || null;
11470    this.#enableHighlightFloatingButton = options.enableHighlightFloatingButton === true;
11471    this.imageResourcesPath = options.imageResourcesPath || "";
11472    this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
11473    this.removePageBorders = options.removePageBorders || false;
11474    this.maxCanvasPixels = options.maxCanvasPixels;
11475    this.l10n = options.l10n;
11476    this.l10n ||= new web_null_l10n__WEBPACK_IMPORTED_MODULE_2__.GenericL10n();
11477    this.#enablePermissions = options.enablePermissions || false;
11478    this.pageColors = options.pageColors || null;
11479    this.#mlManager = options.mlManager || null;
11480    this.defaultRenderingQueue = !options.renderingQueue;
11481    if (this.defaultRenderingQueue) {
11482      this.renderingQueue = new _pdf_rendering_queue_js__WEBPACK_IMPORTED_MODULE_4__.PDFRenderingQueue();
11483      this.renderingQueue.setViewer(this);
11484    } else {
11485      this.renderingQueue = options.renderingQueue;
11486    }
11487    this.scroll = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.watchScroll)(this.container, this._scrollUpdate.bind(this));
11488    this.presentationModeState = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.UNKNOWN;
11489    this._onBeforeDraw = this._onAfterDraw = null;
11490    this._resetView();
11491    if (this.removePageBorders) {
11492      this.viewer.classList.add("removePageBorders");
11493    }
11494    this.#updateContainerHeightCss();
11495    this.eventBus._on("thumbnailrendered", ({
11496      pageNumber,
11497      pdfPage
11498    }) => {
11499      const pageView = this._pages[pageNumber - 1];
11500      if (!this.#buffer.has(pageView)) {
11501        pdfPage?.cleanup();
11502      }
11503    });
11504    if (!options.l10n) {
11505      this.l10n.translate(this.container);
11506    }
11507  }
11508  get pagesCount() {
11509    return this._pages.length;
11510  }
11511  getPageView(index) {
11512    return this._pages[index];
11513  }
11514  getCachedPageViews() {
11515    return new Set(this.#buffer);
11516  }
11517  get pageViewsReady() {
11518    return this._pages.every(pageView => pageView?.pdfPage);
11519  }
11520  get renderForms() {
11521    return this.#annotationMode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode.ENABLE_FORMS;
11522  }
11523  get enableScripting() {
11524    return !!this._scriptingManager;
11525  }
11526  get currentPageNumber() {
11527    return this._currentPageNumber;
11528  }
11529  set currentPageNumber(val) {
11530    if (!Number.isInteger(val)) {
11531      throw new Error("Invalid page number.");
11532    }
11533    if (!this.pdfDocument) {
11534      return;
11535    }
11536    if (!this._setCurrentPageNumber(val, true)) {
11537      console.error(`currentPageNumber: "${val}" is not a valid page.`);
11538    }
11539  }
11540  _setCurrentPageNumber(val, resetCurrentPageView = false) {
11541    if (this._currentPageNumber === val) {
11542      if (resetCurrentPageView) {
11543        this.#resetCurrentPageView();
11544      }
11545      return true;
11546    }
11547    if (!(0 < val && val <= this.pagesCount)) {
11548      return false;
11549    }
11550    const previous = this._currentPageNumber;
11551    this._currentPageNumber = val;
11552    this.eventBus.dispatch("pagechanging", {
11553      source: this,
11554      pageNumber: val,
11555      pageLabel: this._pageLabels?.[val - 1] ?? null,
11556      previous
11557    });
11558    if (resetCurrentPageView) {
11559      this.#resetCurrentPageView();
11560    }
11561    return true;
11562  }
11563  get currentPageLabel() {
11564    return this._pageLabels?.[this._currentPageNumber - 1] ?? null;
11565  }
11566  set currentPageLabel(val) {
11567    if (!this.pdfDocument) {
11568      return;
11569    }
11570    let page = val | 0;
11571    if (this._pageLabels) {
11572      const i = this._pageLabels.indexOf(val);
11573      if (i >= 0) {
11574        page = i + 1;
11575      }
11576    }
11577    if (!this._setCurrentPageNumber(page, true)) {
11578      console.error(`currentPageLabel: "${val}" is not a valid page.`);
11579    }
11580  }
11581  get currentScale() {
11582    return this._currentScale !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.UNKNOWN_SCALE ? this._currentScale : _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SCALE;
11583  }
11584  set currentScale(val) {
11585    if (isNaN(val)) {
11586      throw new Error("Invalid numeric scale.");
11587    }
11588    if (!this.pdfDocument) {
11589      return;
11590    }
11591    this.#setScale(val, {
11592      noScroll: false
11593    });
11594  }
11595  get currentScaleValue() {
11596    return this._currentScaleValue;
11597  }
11598  set currentScaleValue(val) {
11599    if (!this.pdfDocument) {
11600      return;
11601    }
11602    this.#setScale(val, {
11603      noScroll: false
11604    });
11605  }
11606  get pagesRotation() {
11607    return this._pagesRotation;
11608  }
11609  set pagesRotation(rotation) {
11610    if (!(0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.isValidRotation)(rotation)) {
11611      throw new Error("Invalid pages rotation angle.");
11612    }
11613    if (!this.pdfDocument) {
11614      return;
11615    }
11616    rotation %= 360;
11617    if (rotation < 0) {
11618      rotation += 360;
11619    }
11620    if (this._pagesRotation === rotation) {
11621      return;
11622    }
11623    this._pagesRotation = rotation;
11624    const pageNumber = this._currentPageNumber;
11625    this.refresh(true, {
11626      rotation
11627    });
11628    if (this._currentScaleValue) {
11629      this.#setScale(this._currentScaleValue, {
11630        noScroll: true
11631      });
11632    }
11633    this.eventBus.dispatch("rotationchanging", {
11634      source: this,
11635      pagesRotation: rotation,
11636      pageNumber
11637    });
11638    if (this.defaultRenderingQueue) {
11639      this.update();
11640    }
11641  }
11642  get firstPagePromise() {
11643    return this.pdfDocument ? this._firstPageCapability.promise : null;
11644  }
11645  get onePageRendered() {
11646    return this.pdfDocument ? this._onePageRenderedCapability.promise : null;
11647  }
11648  get pagesPromise() {
11649    return this.pdfDocument ? this._pagesCapability.promise : null;
11650  }
11651  get _layerProperties() {
11652    const self = this;
11653    return (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.shadow)(this, "_layerProperties", {
11654      get annotationEditorUIManager() {
11655        return self.#annotationEditorUIManager;
11656      },
11657      get annotationStorage() {
11658        return self.pdfDocument?.annotationStorage;
11659      },
11660      get downloadManager() {
11661        return self.downloadManager;
11662      },
11663      get enableScripting() {
11664        return !!self._scriptingManager;
11665      },
11666      get fieldObjectsPromise() {
11667        return self.pdfDocument?.getFieldObjects();
11668      },
11669      get findController() {
11670        return self.findController;
11671      },
11672      get hasJSActionsPromise() {
11673        return self.pdfDocument?.hasJSActions();
11674      },
11675      get linkService() {
11676        return self.linkService;
11677      }
11678    });
11679  }
11680  #initializePermissions(permissions) {
11681    const params = {
11682      annotationEditorMode: this.#annotationEditorMode,
11683      annotationMode: this.#annotationMode,
11684      textLayerMode: this.#textLayerMode
11685    };
11686    if (!permissions) {
11687      return params;
11688    }
11689    if (!permissions.includes(pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PermissionFlag.COPY) && this.#textLayerMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.TextLayerMode.ENABLE) {
11690      params.textLayerMode = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.TextLayerMode.ENABLE_PERMISSIONS;
11691    }
11692    if (!permissions.includes(pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PermissionFlag.MODIFY_CONTENTS)) {
11693      params.annotationEditorMode = pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.DISABLE;
11694    }
11695    if (!permissions.includes(pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PermissionFlag.MODIFY_ANNOTATIONS) && !permissions.includes(pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PermissionFlag.FILL_INTERACTIVE_FORMS) && this.#annotationMode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode.ENABLE_FORMS) {
11696      params.annotationMode = pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationMode.ENABLE;
11697    }
11698    return params;
11699  }
11700  async #onePageRenderedOrForceFetch() {
11701    if (document.visibilityState === "hidden" || !this.container.offsetParent || this._getVisiblePages().views.length === 0) {
11702      return;
11703    }
11704    const visibilityChangePromise = new Promise(resolve => {
11705      this.#onVisibilityChange = () => {
11706        if (document.visibilityState !== "hidden") {
11707          return;
11708        }
11709        resolve();
11710      };
11711      document.addEventListener("visibilitychange", this.#onVisibilityChange);
11712    });
11713    await Promise.race([this._onePageRenderedCapability.promise, visibilityChangePromise]);
11714    document.removeEventListener("visibilitychange", this.#onVisibilityChange);
11715    this.#onVisibilityChange = null;
11716  }
11717  async getAllText() {
11718    const texts = [];
11719    const buffer = [];
11720    for (let pageNum = 1, pagesCount = this.pdfDocument.numPages; pageNum <= pagesCount; ++pageNum) {
11721      if (this.#interruptCopyCondition) {
11722        return null;
11723      }
11724      buffer.length = 0;
11725      const page = await this.pdfDocument.getPage(pageNum);
11726      const {
11727        items
11728      } = await page.getTextContent();
11729      for (const item of items) {
11730        if (item.str) {
11731          buffer.push(item.str);
11732        }
11733        if (item.hasEOL) {
11734          buffer.push("\n");
11735        }
11736      }
11737      texts.push((0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.removeNullCharacters)(buffer.join("")));
11738    }
11739    return texts.join("\n");
11740  }
11741  #copyCallback(textLayerMode, event) {
11742    const selection = document.getSelection();
11743    const {
11744      focusNode,
11745      anchorNode
11746    } = selection;
11747    if (anchorNode && focusNode && selection.containsNode(this.#hiddenCopyElement)) {
11748      if (this.#getAllTextInProgress || textLayerMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.TextLayerMode.ENABLE_PERMISSIONS) {
11749        event.preventDefault();
11750        event.stopPropagation();
11751        return;
11752      }
11753      this.#getAllTextInProgress = true;
11754      const savedCursor = this.container.style.cursor;
11755      this.container.style.cursor = "wait";
11756      const interruptCopy = ev => this.#interruptCopyCondition = ev.key === "Escape";
11757      window.addEventListener("keydown", interruptCopy);
11758      this.getAllText().then(async text => {
11759        if (text !== null) {
11760          await navigator.clipboard.writeText(text);
11761        }
11762      }).catch(reason => {
11763        console.warn(`Something goes wrong when extracting the text: ${reason.message}`);
11764      }).finally(() => {
11765        this.#getAllTextInProgress = false;
11766        this.#interruptCopyCondition = false;
11767        window.removeEventListener("keydown", interruptCopy);
11768        this.container.style.cursor = savedCursor;
11769      });
11770      event.preventDefault();
11771      event.stopPropagation();
11772    }
11773  }
11774  setDocument(pdfDocument) {
11775    if (this.pdfDocument) {
11776      this.eventBus.dispatch("pagesdestroy", {
11777        source: this
11778      });
11779      this._cancelRendering();
11780      this._resetView();
11781      this.findController?.setDocument(null);
11782      this._scriptingManager?.setDocument(null);
11783      if (this.#annotationEditorUIManager) {
11784        this.#annotationEditorUIManager.destroy();
11785        this.#annotationEditorUIManager = null;
11786      }
11787    }
11788    this.pdfDocument = pdfDocument;
11789    if (!pdfDocument) {
11790      return;
11791    }
11792    const pagesCount = pdfDocument.numPages;
11793    const firstPagePromise = pdfDocument.getPage(1);
11794    const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({
11795      intent: "display"
11796    });
11797    const permissionsPromise = this.#enablePermissions ? pdfDocument.getPermissions() : Promise.resolve();
11798    if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
11799      console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");
11800      const mode = this._scrollMode = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE;
11801      this.eventBus.dispatch("scrollmodechanged", {
11802        source: this,
11803        mode
11804      });
11805    }
11806    this._pagesCapability.promise.then(() => {
11807      this.eventBus.dispatch("pagesloaded", {
11808        source: this,
11809        pagesCount
11810      });
11811    }, () => {});
11812    this._onBeforeDraw = evt => {
11813      const pageView = this._pages[evt.pageNumber - 1];
11814      if (!pageView) {
11815        return;
11816      }
11817      this.#buffer.push(pageView);
11818    };
11819    this.eventBus._on("pagerender", this._onBeforeDraw);
11820    this._onAfterDraw = evt => {
11821      if (evt.cssTransform) {
11822        return;
11823      }
11824      this._onePageRenderedCapability.resolve({
11825        timestamp: evt.timestamp
11826      });
11827      this.eventBus._off("pagerendered", this._onAfterDraw);
11828      this._onAfterDraw = null;
11829    };
11830    this.eventBus._on("pagerendered", this._onAfterDraw);
11831    Promise.all([firstPagePromise, permissionsPromise]).then(([firstPdfPage, permissions]) => {
11832      if (pdfDocument !== this.pdfDocument) {
11833        return;
11834      }
11835      this._firstPageCapability.resolve(firstPdfPage);
11836      this._optionalContentConfigPromise = optionalContentConfigPromise;
11837      const {
11838        annotationEditorMode,
11839        annotationMode,
11840        textLayerMode
11841      } = this.#initializePermissions(permissions);
11842      if (textLayerMode !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.TextLayerMode.DISABLE) {
11843        const element = this.#hiddenCopyElement = document.createElement("div");
11844        element.id = "hiddenCopyElement";
11845        this.viewer.before(element);
11846      }
11847      if (annotationEditorMode !== pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.DISABLE) {
11848        const mode = annotationEditorMode;
11849        if (pdfDocument.isPureXfa) {
11850          console.warn("Warning: XFA-editing is not implemented.");
11851        } else if (isValidAnnotationEditorMode(mode)) {
11852          this.#annotationEditorUIManager = new pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorUIManager(this.container, this.viewer, this.#altTextManager, this.eventBus, pdfDocument, this.pageColors, this.#annotationEditorHighlightColors, this.#enableHighlightFloatingButton, this.#mlManager);
11853          this.eventBus.dispatch("annotationeditoruimanager", {
11854            source: this,
11855            uiManager: this.#annotationEditorUIManager
11856          });
11857          if (mode !== pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE) {
11858            this.#annotationEditorUIManager.updateMode(mode);
11859          }
11860        } else {
11861          console.error(`Invalid AnnotationEditor mode: ${mode}`);
11862        }
11863      }
11864      const viewerElement = this._scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE ? null : this.viewer;
11865      const scale = this.currentScale;
11866      const viewport = firstPdfPage.getViewport({
11867        scale: scale * pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF_TO_CSS_UNITS
11868      });
11869      this.viewer.style.setProperty("--scale-factor", viewport.scale);
11870      if (this.pageColors?.foreground === "CanvasText" || this.pageColors?.background === "Canvas") {
11871        this.viewer.style.setProperty("--hcm-highlight-filter", pdfDocument.filterFactory.addHighlightHCMFilter("highlight", "CanvasText", "Canvas", "HighlightText", "Highlight"));
11872        this.viewer.style.setProperty("--hcm-highlight-selected-filter", pdfDocument.filterFactory.addHighlightHCMFilter("highlight_selected", "CanvasText", "Canvas", "HighlightText", "ButtonText"));
11873      }
11874      for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
11875        const pageView = new _pdf_page_view_js__WEBPACK_IMPORTED_MODULE_3__.PDFPageView({
11876          container: viewerElement,
11877          eventBus: this.eventBus,
11878          id: pageNum,
11879          scale,
11880          defaultViewport: viewport.clone(),
11881          optionalContentConfigPromise,
11882          renderingQueue: this.renderingQueue,
11883          textLayerMode,
11884          annotationMode,
11885          imageResourcesPath: this.imageResourcesPath,
11886          maxCanvasPixels: this.maxCanvasPixels,
11887          pageColors: this.pageColors,
11888          l10n: this.l10n,
11889          layerProperties: this._layerProperties
11890        });
11891        this._pages.push(pageView);
11892      }
11893      const firstPageView = this._pages[0];
11894      if (firstPageView) {
11895        firstPageView.setPdfPage(firstPdfPage);
11896        this.linkService.cachePageRef(1, firstPdfPage.ref);
11897      }
11898      if (this._scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE) {
11899        this.#ensurePageViewVisible();
11900      } else if (this._spreadMode !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SpreadMode.NONE) {
11901        this._updateSpreadMode();
11902      }
11903      this.#onePageRenderedOrForceFetch().then(async () => {
11904        this.findController?.setDocument(pdfDocument);
11905        this._scriptingManager?.setDocument(pdfDocument);
11906        if (this.#hiddenCopyElement) {
11907          this.#copyCallbackBound = this.#copyCallback.bind(this, textLayerMode);
11908          document.addEventListener("copy", this.#copyCallbackBound);
11909        }
11910        if (this.#annotationEditorUIManager) {
11911          this.eventBus.dispatch("annotationeditormodechanged", {
11912            source: this,
11913            mode: this.#annotationEditorMode
11914          });
11915        }
11916        if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT) {
11917          this._pagesCapability.resolve();
11918          return;
11919        }
11920        let getPagesLeft = pagesCount - 1;
11921        if (getPagesLeft <= 0) {
11922          this._pagesCapability.resolve();
11923          return;
11924        }
11925        for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {
11926          const promise = pdfDocument.getPage(pageNum).then(pdfPage => {
11927            const pageView = this._pages[pageNum - 1];
11928            if (!pageView.pdfPage) {
11929              pageView.setPdfPage(pdfPage);
11930            }
11931            this.linkService.cachePageRef(pageNum, pdfPage.ref);
11932            if (--getPagesLeft === 0) {
11933              this._pagesCapability.resolve();
11934            }
11935          }, reason => {
11936            console.error(`Unable to get page ${pageNum} to initialize viewer`, reason);
11937            if (--getPagesLeft === 0) {
11938              this._pagesCapability.resolve();
11939            }
11940          });
11941          if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) {
11942            await promise;
11943          }
11944        }
11945      });
11946      this.eventBus.dispatch("pagesinit", {
11947        source: this
11948      });
11949      pdfDocument.getMetadata().then(({
11950        info
11951      }) => {
11952        if (pdfDocument !== this.pdfDocument) {
11953          return;
11954        }
11955        if (info.Language) {
11956          this.viewer.lang = info.Language;
11957        }
11958      });
11959      if (this.defaultRenderingQueue) {
11960        this.update();
11961      }
11962    }).catch(reason => {
11963      console.error("Unable to initialize viewer", reason);
11964      this._pagesCapability.reject(reason);
11965    });
11966  }
11967  setPageLabels(labels) {
11968    if (!this.pdfDocument) {
11969      return;
11970    }
11971    if (!labels) {
11972      this._pageLabels = null;
11973    } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
11974      this._pageLabels = null;
11975      console.error(`setPageLabels: Invalid page labels.`);
11976    } else {
11977      this._pageLabels = labels;
11978    }
11979    for (let i = 0, ii = this._pages.length; i < ii; i++) {
11980      this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null);
11981    }
11982  }
11983  _resetView() {
11984    this._pages = [];
11985    this._currentPageNumber = 1;
11986    this._currentScale = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.UNKNOWN_SCALE;
11987    this._currentScaleValue = null;
11988    this._pageLabels = null;
11989    this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
11990    this._location = null;
11991    this._pagesRotation = 0;
11992    this._optionalContentConfigPromise = null;
11993    this._firstPageCapability = Promise.withResolvers();
11994    this._onePageRenderedCapability = Promise.withResolvers();
11995    this._pagesCapability = Promise.withResolvers();
11996    this._scrollMode = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.VERTICAL;
11997    this._previousScrollMode = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.UNKNOWN;
11998    this._spreadMode = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SpreadMode.NONE;
11999    this.#scrollModePageState = {
12000      previousPageNumber: 1,
12001      scrollDown: true,
12002      pages: []
12003    };
12004    if (this._onBeforeDraw) {
12005      this.eventBus._off("pagerender", this._onBeforeDraw);
12006      this._onBeforeDraw = null;
12007    }
12008    if (this._onAfterDraw) {
12009      this.eventBus._off("pagerendered", this._onAfterDraw);
12010      this._onAfterDraw = null;
12011    }
12012    if (this.#onVisibilityChange) {
12013      document.removeEventListener("visibilitychange", this.#onVisibilityChange);
12014      this.#onVisibilityChange = null;
12015    }
12016    this.viewer.textContent = "";
12017    this._updateScrollMode();
12018    this.viewer.removeAttribute("lang");
12019    if (this.#hiddenCopyElement) {
12020      document.removeEventListener("copy", this.#copyCallbackBound);
12021      this.#copyCallbackBound = null;
12022      this.#hiddenCopyElement.remove();
12023      this.#hiddenCopyElement = null;
12024    }
12025  }
12026  #ensurePageViewVisible() {
12027    if (this._scrollMode !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE) {
12028      throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");
12029    }
12030    const pageNumber = this._currentPageNumber,
12031      state = this.#scrollModePageState,
12032      viewer = this.viewer;
12033    viewer.textContent = "";
12034    state.pages.length = 0;
12035    if (this._spreadMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SpreadMode.NONE && !this.isInPresentationMode) {
12036      const pageView = this._pages[pageNumber - 1];
12037      viewer.append(pageView.div);
12038      state.pages.push(pageView);
12039    } else {
12040      const pageIndexSet = new Set(),
12041        parity = this._spreadMode - 1;
12042      if (parity === -1) {
12043        pageIndexSet.add(pageNumber - 1);
12044      } else if (pageNumber % 2 !== parity) {
12045        pageIndexSet.add(pageNumber - 1);
12046        pageIndexSet.add(pageNumber);
12047      } else {
12048        pageIndexSet.add(pageNumber - 2);
12049        pageIndexSet.add(pageNumber - 1);
12050      }
12051      const spread = document.createElement("div");
12052      spread.className = "spread";
12053      if (this.isInPresentationMode) {
12054        const dummyPage = document.createElement("div");
12055        dummyPage.className = "dummyPage";
12056        spread.append(dummyPage);
12057      }
12058      for (const i of pageIndexSet) {
12059        const pageView = this._pages[i];
12060        if (!pageView) {
12061          continue;
12062        }
12063        spread.append(pageView.div);
12064        state.pages.push(pageView);
12065      }
12066      viewer.append(spread);
12067    }
12068    state.scrollDown = pageNumber >= state.previousPageNumber;
12069    state.previousPageNumber = pageNumber;
12070  }
12071  _scrollUpdate() {
12072    if (this.pagesCount === 0) {
12073      return;
12074    }
12075    this.update();
12076  }
12077  #scrollIntoView(pageView, pageSpot = null) {
12078    const {
12079      div,
12080      id
12081    } = pageView;
12082    if (this._currentPageNumber !== id) {
12083      this._setCurrentPageNumber(id);
12084    }
12085    if (this._scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE) {
12086      this.#ensurePageViewVisible();
12087      this.update();
12088    }
12089    if (!pageSpot && !this.isInPresentationMode) {
12090      const left = div.offsetLeft + div.clientLeft,
12091        right = left + div.clientWidth;
12092      const {
12093        scrollLeft,
12094        clientWidth
12095      } = this.container;
12096      if (this._scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + clientWidth) {
12097        pageSpot = {
12098          left: 0,
12099          top: 0
12100        };
12101      }
12102    }
12103    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.scrollIntoView)(div, pageSpot);
12104    if (!this._currentScaleValue && this._location) {
12105      this._location = null;
12106    }
12107  }
12108  #isSameScale(newScale) {
12109    return newScale === this._currentScale || Math.abs(newScale - this._currentScale) < 1e-15;
12110  }
12111  #setScaleUpdatePages(newScale, newValue, {
12112    noScroll = false,
12113    preset = false,
12114    drawingDelay = -1
12115  }) {
12116    this._currentScaleValue = newValue.toString();
12117    if (this.#isSameScale(newScale)) {
12118      if (preset) {
12119        this.eventBus.dispatch("scalechanging", {
12120          source: this,
12121          scale: newScale,
12122          presetValue: newValue
12123        });
12124      }
12125      return;
12126    }
12127    this.viewer.style.setProperty("--scale-factor", newScale * pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF_TO_CSS_UNITS);
12128    const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;
12129    this.refresh(true, {
12130      scale: newScale,
12131      drawingDelay: postponeDrawing ? drawingDelay : -1
12132    });
12133    if (postponeDrawing) {
12134      this.#scaleTimeoutId = setTimeout(() => {
12135        this.#scaleTimeoutId = null;
12136        this.refresh();
12137      }, drawingDelay);
12138    }
12139    this._currentScale = newScale;
12140    if (!noScroll) {
12141      let page = this._currentPageNumber,
12142        dest;
12143      if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) {
12144        page = this._location.pageNumber;
12145        dest = [null, {
12146          name: "XYZ"
12147        }, this._location.left, this._location.top, null];
12148      }
12149      this.scrollPageIntoView({
12150        pageNumber: page,
12151        destArray: dest,
12152        allowNegativeOffset: true
12153      });
12154    }
12155    this.eventBus.dispatch("scalechanging", {
12156      source: this,
12157      scale: newScale,
12158      presetValue: preset ? newValue : undefined
12159    });
12160    if (this.defaultRenderingQueue) {
12161      this.update();
12162    }
12163  }
12164  get #pageWidthScaleFactor() {
12165    if (this._spreadMode !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SpreadMode.NONE && this._scrollMode !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.HORIZONTAL) {
12166      return 2;
12167    }
12168    return 1;
12169  }
12170  #setScale(value, options) {
12171    let scale = parseFloat(value);
12172    if (scale > 0) {
12173      options.preset = false;
12174      this.#setScaleUpdatePages(scale, value, options);
12175    } else {
12176      const currentPage = this._pages[this._currentPageNumber - 1];
12177      if (!currentPage) {
12178        return;
12179      }
12180      let hPadding = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SCROLLBAR_PADDING,
12181        vPadding = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.VERTICAL_PADDING;
12182      if (this.isInPresentationMode) {
12183        hPadding = vPadding = 4;
12184        if (this._spreadMode !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SpreadMode.NONE) {
12185          hPadding *= 2;
12186        }
12187      } else if (this.removePageBorders) {
12188        hPadding = vPadding = 0;
12189      } else if (this._scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.HORIZONTAL) {
12190        [hPadding, vPadding] = [vPadding, hPadding];
12191      }
12192      const pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this.#pageWidthScaleFactor;
12193      const pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale;
12194      switch (value) {
12195        case "page-actual":
12196          scale = 1;
12197          break;
12198        case "page-width":
12199          scale = pageWidthScale;
12200          break;
12201        case "page-height":
12202          scale = pageHeightScale;
12203          break;
12204        case "page-fit":
12205          scale = Math.min(pageWidthScale, pageHeightScale);
12206          break;
12207        case "auto":
12208          const horizontalScale = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.isPortraitOrientation)(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale);
12209          scale = Math.min(_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.MAX_AUTO_SCALE, horizontalScale);
12210          break;
12211        default:
12212          console.error(`#setScale: "${value}" is an unknown zoom value.`);
12213          return;
12214      }
12215      options.preset = true;
12216      this.#setScaleUpdatePages(scale, value, options);
12217    }
12218  }
12219  #resetCurrentPageView() {
12220    const pageView = this._pages[this._currentPageNumber - 1];
12221    if (this.isInPresentationMode) {
12222      this.#setScale(this._currentScaleValue, {
12223        noScroll: true
12224      });
12225    }
12226    this.#scrollIntoView(pageView);
12227  }
12228  pageLabelToPageNumber(label) {
12229    if (!this._pageLabels) {
12230      return null;
12231    }
12232    const i = this._pageLabels.indexOf(label);
12233    if (i < 0) {
12234      return null;
12235    }
12236    return i + 1;
12237  }
12238  scrollPageIntoView({
12239    pageNumber,
12240    destArray = null,
12241    allowNegativeOffset = false,
12242    ignoreDestinationZoom = false
12243  }) {
12244    if (!this.pdfDocument) {
12245      return;
12246    }
12247    const pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1];
12248    if (!pageView) {
12249      console.error(`scrollPageIntoView: "${pageNumber}" is not a valid pageNumber parameter.`);
12250      return;
12251    }
12252    if (this.isInPresentationMode || !destArray) {
12253      this._setCurrentPageNumber(pageNumber, true);
12254      return;
12255    }
12256    let x = 0,
12257      y = 0;
12258    let width = 0,
12259      height = 0,
12260      widthScale,
12261      heightScale;
12262    const changeOrientation = pageView.rotation % 180 !== 0;
12263    const pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF_TO_CSS_UNITS;
12264    const pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF_TO_CSS_UNITS;
12265    let scale = 0;
12266    switch (destArray[1].name) {
12267      case "XYZ":
12268        x = destArray[2];
12269        y = destArray[3];
12270        scale = destArray[4];
12271        x = x !== null ? x : 0;
12272        y = y !== null ? y : pageHeight;
12273        break;
12274      case "Fit":
12275      case "FitB":
12276        scale = "page-fit";
12277        break;
12278      case "FitH":
12279      case "FitBH":
12280        y = destArray[2];
12281        scale = "page-width";
12282        if (y === null && this._location) {
12283          x = this._location.left;
12284          y = this._location.top;
12285        } else if (typeof y !== "number" || y < 0) {
12286          y = pageHeight;
12287        }
12288        break;
12289      case "FitV":
12290      case "FitBV":
12291        x = destArray[2];
12292        width = pageWidth;
12293        height = pageHeight;
12294        scale = "page-height";
12295        break;
12296      case "FitR":
12297        x = destArray[2];
12298        y = destArray[3];
12299        width = destArray[4] - x;
12300        height = destArray[5] - y;
12301        let hPadding = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SCROLLBAR_PADDING,
12302          vPadding = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.VERTICAL_PADDING;
12303        if (this.removePageBorders) {
12304          hPadding = vPadding = 0;
12305        }
12306        widthScale = (this.container.clientWidth - hPadding) / width / pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF_TO_CSS_UNITS;
12307        heightScale = (this.container.clientHeight - vPadding) / height / pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF_TO_CSS_UNITS;
12308        scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
12309        break;
12310      default:
12311        console.error(`scrollPageIntoView: "${destArray[1].name}" is not a valid destination type.`);
12312        return;
12313    }
12314    if (!ignoreDestinationZoom) {
12315      if (scale && scale !== this._currentScale) {
12316        this.currentScaleValue = scale;
12317      } else if (this._currentScale === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.UNKNOWN_SCALE) {
12318        this.currentScaleValue = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SCALE_VALUE;
12319      }
12320    }
12321    if (scale === "page-fit" && !destArray[4]) {
12322      this.#scrollIntoView(pageView);
12323      return;
12324    }
12325    const boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)];
12326    let left = Math.min(boundingRect[0][0], boundingRect[1][0]);
12327    let top = Math.min(boundingRect[0][1], boundingRect[1][1]);
12328    if (!allowNegativeOffset) {
12329      left = Math.max(left, 0);
12330      top = Math.max(top, 0);
12331    }
12332    this.#scrollIntoView(pageView, {
12333      left,
12334      top
12335    });
12336  }
12337  _updateLocation(firstPage) {
12338    const currentScale = this._currentScale;
12339    const currentScaleValue = this._currentScaleValue;
12340    const normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue;
12341    const pageNumber = firstPage.id;
12342    const currentPageView = this._pages[pageNumber - 1];
12343    const container = this.container;
12344    const topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y);
12345    const intLeft = Math.round(topLeft[0]);
12346    const intTop = Math.round(topLeft[1]);
12347    let pdfOpenParams = `#page=${pageNumber}`;
12348    if (!this.isInPresentationMode) {
12349      pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;
12350    }
12351    this._location = {
12352      pageNumber,
12353      scale: normalizedScaleValue,
12354      top: intTop,
12355      left: intLeft,
12356      rotation: this._pagesRotation,
12357      pdfOpenParams
12358    };
12359  }
12360  update() {
12361    const visible = this._getVisiblePages();
12362    const visiblePages = visible.views,
12363      numVisiblePages = visiblePages.length;
12364    if (numVisiblePages === 0) {
12365      return;
12366    }
12367    const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);
12368    this.#buffer.resize(newCacheSize, visible.ids);
12369    this.renderingQueue.renderHighestPriority(visible);
12370    const isSimpleLayout = this._spreadMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SpreadMode.NONE && (this._scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE || this._scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.VERTICAL);
12371    const currentId = this._currentPageNumber;
12372    let stillFullyVisible = false;
12373    for (const page of visiblePages) {
12374      if (page.percent < 100) {
12375        break;
12376      }
12377      if (page.id === currentId && isSimpleLayout) {
12378        stillFullyVisible = true;
12379        break;
12380      }
12381    }
12382    this._setCurrentPageNumber(stillFullyVisible ? currentId : visiblePages[0].id);
12383    this._updateLocation(visible.first);
12384    this.eventBus.dispatch("updateviewarea", {
12385      source: this,
12386      location: this._location
12387    });
12388  }
12389  containsElement(element) {
12390    return this.container.contains(element);
12391  }
12392  focus() {
12393    this.container.focus();
12394  }
12395  get _isContainerRtl() {
12396    return getComputedStyle(this.container).direction === "rtl";
12397  }
12398  get isInPresentationMode() {
12399    return this.presentationModeState === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.FULLSCREEN;
12400  }
12401  get isChangingPresentationMode() {
12402    return this.presentationModeState === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.PresentationModeState.CHANGING;
12403  }
12404  get isHorizontalScrollbarEnabled() {
12405    return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth;
12406  }
12407  get isVerticalScrollbarEnabled() {
12408    return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight;
12409  }
12410  _getVisiblePages() {
12411    const views = this._scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE ? this.#scrollModePageState.pages : this._pages,
12412      horizontal = this._scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.HORIZONTAL,
12413      rtl = horizontal && this._isContainerRtl;
12414    return (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.getVisibleElements)({
12415      scrollEl: this.container,
12416      views,
12417      sortByVisibility: true,
12418      horizontal,
12419      rtl
12420    });
12421  }
12422  cleanup() {
12423    for (const pageView of this._pages) {
12424      if (pageView.renderingState !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.RenderingStates.FINISHED) {
12425        pageView.reset();
12426      }
12427    }
12428  }
12429  _cancelRendering() {
12430    for (const pageView of this._pages) {
12431      pageView.cancelRendering();
12432    }
12433  }
12434  async #ensurePdfPageLoaded(pageView) {
12435    if (pageView.pdfPage) {
12436      return pageView.pdfPage;
12437    }
12438    try {
12439      const pdfPage = await this.pdfDocument.getPage(pageView.id);
12440      if (!pageView.pdfPage) {
12441        pageView.setPdfPage(pdfPage);
12442      }
12443      if (!this.linkService._cachedPageNumber?.(pdfPage.ref)) {
12444        this.linkService.cachePageRef(pageView.id, pdfPage.ref);
12445      }
12446      return pdfPage;
12447    } catch (reason) {
12448      console.error("Unable to get page for page view", reason);
12449      return null;
12450    }
12451  }
12452  #getScrollAhead(visible) {
12453    if (visible.first?.id === 1) {
12454      return true;
12455    } else if (visible.last?.id === this.pagesCount) {
12456      return false;
12457    }
12458    switch (this._scrollMode) {
12459      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE:
12460        return this.#scrollModePageState.scrollDown;
12461      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.HORIZONTAL:
12462        return this.scroll.right;
12463    }
12464    return this.scroll.down;
12465  }
12466  forceRendering(currentlyVisiblePages) {
12467    const visiblePages = currentlyVisiblePages || this._getVisiblePages();
12468    const scrollAhead = this.#getScrollAhead(visiblePages);
12469    const preRenderExtra = this._spreadMode !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SpreadMode.NONE && this._scrollMode !== _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.HORIZONTAL;
12470    const pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead, preRenderExtra);
12471    if (pageView) {
12472      this.#ensurePdfPageLoaded(pageView).then(() => {
12473        this.renderingQueue.renderView(pageView);
12474      });
12475      return true;
12476    }
12477    return false;
12478  }
12479  get hasEqualPageSizes() {
12480    const firstPageView = this._pages[0];
12481    for (let i = 1, ii = this._pages.length; i < ii; ++i) {
12482      const pageView = this._pages[i];
12483      if (pageView.width !== firstPageView.width || pageView.height !== firstPageView.height) {
12484        return false;
12485      }
12486    }
12487    return true;
12488  }
12489  getPagesOverview() {
12490    let initialOrientation;
12491    return this._pages.map(pageView => {
12492      const viewport = pageView.pdfPage.getViewport({
12493        scale: 1
12494      });
12495      const orientation = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.isPortraitOrientation)(viewport);
12496      if (initialOrientation === undefined) {
12497        initialOrientation = orientation;
12498      } else if (this.enablePrintAutoRotate && orientation !== initialOrientation) {
12499        return {
12500          width: viewport.height,
12501          height: viewport.width,
12502          rotation: (viewport.rotation - 90) % 360
12503        };
12504      }
12505      return {
12506        width: viewport.width,
12507        height: viewport.height,
12508        rotation: viewport.rotation
12509      };
12510    });
12511  }
12512  get optionalContentConfigPromise() {
12513    if (!this.pdfDocument) {
12514      return Promise.resolve(null);
12515    }
12516    if (!this._optionalContentConfigPromise) {
12517      console.error("optionalContentConfigPromise: Not initialized yet.");
12518      return this.pdfDocument.getOptionalContentConfig({
12519        intent: "display"
12520      });
12521    }
12522    return this._optionalContentConfigPromise;
12523  }
12524  set optionalContentConfigPromise(promise) {
12525    if (!(promise instanceof Promise)) {
12526      throw new Error(`Invalid optionalContentConfigPromise: ${promise}`);
12527    }
12528    if (!this.pdfDocument) {
12529      return;
12530    }
12531    if (!this._optionalContentConfigPromise) {
12532      return;
12533    }
12534    this._optionalContentConfigPromise = promise;
12535    this.refresh(false, {
12536      optionalContentConfigPromise: promise
12537    });
12538    this.eventBus.dispatch("optionalcontentconfigchanged", {
12539      source: this,
12540      promise
12541    });
12542  }
12543  get scrollMode() {
12544    return this._scrollMode;
12545  }
12546  set scrollMode(mode) {
12547    if (this._scrollMode === mode) {
12548      return;
12549    }
12550    if (!(0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.isValidScrollMode)(mode)) {
12551      throw new Error(`Invalid scroll mode: ${mode}`);
12552    }
12553    if (this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
12554      return;
12555    }
12556    this._previousScrollMode = this._scrollMode;
12557    this._scrollMode = mode;
12558    this.eventBus.dispatch("scrollmodechanged", {
12559      source: this,
12560      mode
12561    });
12562    this._updateScrollMode(this._currentPageNumber);
12563  }
12564  _updateScrollMode(pageNumber = null) {
12565    const scrollMode = this._scrollMode,
12566      viewer = this.viewer;
12567    viewer.classList.toggle("scrollHorizontal", scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.HORIZONTAL);
12568    viewer.classList.toggle("scrollWrapped", scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.WRAPPED);
12569    if (!this.pdfDocument || !pageNumber) {
12570      return;
12571    }
12572    if (scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE) {
12573      this.#ensurePageViewVisible();
12574    } else if (this._previousScrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE) {
12575      this._updateSpreadMode();
12576    }
12577    if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
12578      this.#setScale(this._currentScaleValue, {
12579        noScroll: true
12580      });
12581    }
12582    this._setCurrentPageNumber(pageNumber, true);
12583    this.update();
12584  }
12585  get spreadMode() {
12586    return this._spreadMode;
12587  }
12588  set spreadMode(mode) {
12589    if (this._spreadMode === mode) {
12590      return;
12591    }
12592    if (!(0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.isValidSpreadMode)(mode)) {
12593      throw new Error(`Invalid spread mode: ${mode}`);
12594    }
12595    this._spreadMode = mode;
12596    this.eventBus.dispatch("spreadmodechanged", {
12597      source: this,
12598      mode
12599    });
12600    this._updateSpreadMode(this._currentPageNumber);
12601  }
12602  _updateSpreadMode(pageNumber = null) {
12603    if (!this.pdfDocument) {
12604      return;
12605    }
12606    const viewer = this.viewer,
12607      pages = this._pages;
12608    if (this._scrollMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE) {
12609      this.#ensurePageViewVisible();
12610    } else {
12611      viewer.textContent = "";
12612      if (this._spreadMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SpreadMode.NONE) {
12613        for (const pageView of this._pages) {
12614          viewer.append(pageView.div);
12615        }
12616      } else {
12617        const parity = this._spreadMode - 1;
12618        let spread = null;
12619        for (let i = 0, ii = pages.length; i < ii; ++i) {
12620          if (spread === null) {
12621            spread = document.createElement("div");
12622            spread.className = "spread";
12623            viewer.append(spread);
12624          } else if (i % 2 === parity) {
12625            spread = spread.cloneNode(false);
12626            viewer.append(spread);
12627          }
12628          spread.append(pages[i].div);
12629        }
12630      }
12631    }
12632    if (!pageNumber) {
12633      return;
12634    }
12635    if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
12636      this.#setScale(this._currentScaleValue, {
12637        noScroll: true
12638      });
12639    }
12640    this._setCurrentPageNumber(pageNumber, true);
12641    this.update();
12642  }
12643  _getPageAdvance(currentPageNumber, previous = false) {
12644    switch (this._scrollMode) {
12645      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.WRAPPED:
12646        {
12647          const {
12648              views
12649            } = this._getVisiblePages(),
12650            pageLayout = new Map();
12651          for (const {
12652            id,
12653            y,
12654            percent,
12655            widthPercent
12656          } of views) {
12657            if (percent === 0 || widthPercent < 100) {
12658              continue;
12659            }
12660            let yArray = pageLayout.get(y);
12661            if (!yArray) {
12662              pageLayout.set(y, yArray ||= []);
12663            }
12664            yArray.push(id);
12665          }
12666          for (const yArray of pageLayout.values()) {
12667            const currentIndex = yArray.indexOf(currentPageNumber);
12668            if (currentIndex === -1) {
12669              continue;
12670            }
12671            const numPages = yArray.length;
12672            if (numPages === 1) {
12673              break;
12674            }
12675            if (previous) {
12676              for (let i = currentIndex - 1, ii = 0; i >= ii; i--) {
12677                const currentId = yArray[i],
12678                  expectedId = yArray[i + 1] - 1;
12679                if (currentId < expectedId) {
12680                  return currentPageNumber - expectedId;
12681                }
12682              }
12683            } else {
12684              for (let i = currentIndex + 1, ii = numPages; i < ii; i++) {
12685                const currentId = yArray[i],
12686                  expectedId = yArray[i - 1] + 1;
12687                if (currentId > expectedId) {
12688                  return expectedId - currentPageNumber;
12689                }
12690              }
12691            }
12692            if (previous) {
12693              const firstId = yArray[0];
12694              if (firstId < currentPageNumber) {
12695                return currentPageNumber - firstId + 1;
12696              }
12697            } else {
12698              const lastId = yArray[numPages - 1];
12699              if (lastId > currentPageNumber) {
12700                return lastId - currentPageNumber + 1;
12701              }
12702            }
12703            break;
12704          }
12705          break;
12706        }
12707      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.HORIZONTAL:
12708        {
12709          break;
12710        }
12711      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.PAGE:
12712      case _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.ScrollMode.VERTICAL:
12713        {
12714          if (this._spreadMode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.SpreadMode.NONE) {
12715            break;
12716          }
12717          const parity = this._spreadMode - 1;
12718          if (previous && currentPageNumber % 2 !== parity) {
12719            break;
12720          } else if (!previous && currentPageNumber % 2 === parity) {
12721            break;
12722          }
12723          const {
12724              views
12725            } = this._getVisiblePages(),
12726            expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1;
12727          for (const {
12728            id,
12729            percent,
12730            widthPercent
12731          } of views) {
12732            if (id !== expectedId) {
12733              continue;
12734            }
12735            if (percent > 0 && widthPercent === 100) {
12736              return 2;
12737            }
12738            break;
12739          }
12740          break;
12741        }
12742    }
12743    return 1;
12744  }
12745  nextPage() {
12746    const currentPageNumber = this._currentPageNumber,
12747      pagesCount = this.pagesCount;
12748    if (currentPageNumber >= pagesCount) {
12749      return false;
12750    }
12751    const advance = this._getPageAdvance(currentPageNumber, false) || 1;
12752    this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);
12753    return true;
12754  }
12755  previousPage() {
12756    const currentPageNumber = this._currentPageNumber;
12757    if (currentPageNumber <= 1) {
12758      return false;
12759    }
12760    const advance = this._getPageAdvance(currentPageNumber, true) || 1;
12761    this.currentPageNumber = Math.max(currentPageNumber - advance, 1);
12762    return true;
12763  }
12764  increaseScale({
12765    drawingDelay,
12766    scaleFactor,
12767    steps
12768  } = {}) {
12769    if (!this.pdfDocument) {
12770      return;
12771    }
12772    let newScale = this._currentScale;
12773    if (scaleFactor > 1) {
12774      newScale = Math.round(newScale * scaleFactor * 100) / 100;
12775    } else {
12776      steps ??= 1;
12777      do {
12778        newScale = Math.ceil((newScale * _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;
12779      } while (--steps > 0 && newScale < _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.MAX_SCALE);
12780    }
12781    this.#setScale(Math.min(_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.MAX_SCALE, newScale), {
12782      noScroll: false,
12783      drawingDelay
12784    });
12785  }
12786  decreaseScale({
12787    drawingDelay,
12788    scaleFactor,
12789    steps
12790  } = {}) {
12791    if (!this.pdfDocument) {
12792      return;
12793    }
12794    let newScale = this._currentScale;
12795    if (scaleFactor > 0 && scaleFactor < 1) {
12796      newScale = Math.round(newScale * scaleFactor * 100) / 100;
12797    } else {
12798      steps ??= 1;
12799      do {
12800        newScale = Math.floor((newScale / _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;
12801      } while (--steps > 0 && newScale > _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.MIN_SCALE);
12802    }
12803    this.#setScale(Math.max(_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.MIN_SCALE, newScale), {
12804      noScroll: false,
12805      drawingDelay
12806    });
12807  }
12808  #updateContainerHeightCss(height = this.container.clientHeight) {
12809    if (height !== this.#previousContainerHeight) {
12810      this.#previousContainerHeight = height;
12811      _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.docStyle.setProperty("--viewer-container-height", `${height}px`);
12812    }
12813  }
12814  #resizeObserverCallback(entries) {
12815    for (const entry of entries) {
12816      if (entry.target === this.container) {
12817        this.#updateContainerHeightCss(Math.floor(entry.borderBoxSize[0].blockSize));
12818        this.#containerTopLeft = null;
12819        break;
12820      }
12821    }
12822  }
12823  get containerTopLeft() {
12824    return this.#containerTopLeft ||= [this.container.offsetTop, this.container.offsetLeft];
12825  }
12826  get annotationEditorMode() {
12827    return this.#annotationEditorUIManager ? this.#annotationEditorMode : pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.DISABLE;
12828  }
12829  set annotationEditorMode({
12830    mode,
12831    editId = null,
12832    isFromKeyboard = false
12833  }) {
12834    if (!this.#annotationEditorUIManager) {
12835      throw new Error(`The AnnotationEditor is not enabled.`);
12836    }
12837    if (this.#annotationEditorMode === mode) {
12838      return;
12839    }
12840    if (!isValidAnnotationEditorMode(mode)) {
12841      throw new Error(`Invalid AnnotationEditor mode: ${mode}`);
12842    }
12843    if (!this.pdfDocument) {
12844      return;
12845    }
12846    this.#annotationEditorMode = mode;
12847    this.eventBus.dispatch("annotationeditormodechanged", {
12848      source: this,
12849      mode
12850    });
12851    this.#annotationEditorUIManager.updateMode(mode, editId, isFromKeyboard);
12852  }
12853  set annotationEditorParams({
12854    type,
12855    value
12856  }) {
12857    if (!this.#annotationEditorUIManager) {
12858      throw new Error(`The AnnotationEditor is not enabled.`);
12859    }
12860    this.#annotationEditorUIManager.updateParams(type, value);
12861  }
12862  refresh(noUpdate = false, updateArgs = Object.create(null)) {
12863    if (!this.pdfDocument) {
12864      return;
12865    }
12866    for (const pageView of this._pages) {
12867      pageView.update(updateArgs);
12868    }
12869    if (this.#scaleTimeoutId !== null) {
12870      clearTimeout(this.#scaleTimeoutId);
12871      this.#scaleTimeoutId = null;
12872    }
12873    if (!noUpdate) {
12874      this.update();
12875    }
12876  }
12877}
12878
12879__webpack_async_result__();
12880} catch(e) { __webpack_async_result__(e); } });
12881
12882/***/ }),
12883
12884/***/ 2603:
12885/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
12886
12887__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
12888/* harmony export */ __webpack_require__.d(__webpack_exports__, {
12889/* harmony export */   AbortException: () => (/* binding */ AbortException),
12890/* harmony export */   AnnotationEditorLayer: () => (/* binding */ AnnotationEditorLayer),
12891/* harmony export */   AnnotationEditorParamsType: () => (/* binding */ AnnotationEditorParamsType),
12892/* harmony export */   AnnotationEditorType: () => (/* binding */ AnnotationEditorType),
12893/* harmony export */   AnnotationEditorUIManager: () => (/* binding */ AnnotationEditorUIManager),
12894/* harmony export */   AnnotationLayer: () => (/* binding */ AnnotationLayer),
12895/* harmony export */   AnnotationMode: () => (/* binding */ AnnotationMode),
12896/* harmony export */   ColorPicker: () => (/* binding */ ColorPicker),
12897/* harmony export */   DOMSVGFactory: () => (/* binding */ DOMSVGFactory),
12898/* harmony export */   DrawLayer: () => (/* binding */ DrawLayer),
12899/* harmony export */   FeatureTest: () => (/* binding */ FeatureTest),
12900/* harmony export */   GlobalWorkerOptions: () => (/* binding */ GlobalWorkerOptions),
12901/* harmony export */   InvalidPDFException: () => (/* binding */ InvalidPDFException),
12902/* harmony export */   MissingPDFException: () => (/* binding */ MissingPDFException),
12903/* harmony export */   PDFDateString: () => (/* binding */ PDFDateString),
12904/* harmony export */   PDFWorker: () => (/* binding */ PDFWorker),
12905/* harmony export */   PasswordResponses: () => (/* binding */ PasswordResponses),
12906/* harmony export */   PermissionFlag: () => (/* binding */ PermissionFlag),
12907/* harmony export */   PixelsPerInch: () => (/* binding */ PixelsPerInch),
12908/* harmony export */   RenderingCancelledException: () => (/* binding */ RenderingCancelledException),
12909/* harmony export */   UnexpectedResponseException: () => (/* binding */ UnexpectedResponseException),
12910/* harmony export */   XfaLayer: () => (/* binding */ XfaLayer),
12911/* harmony export */   build: () => (/* binding */ build),
12912/* harmony export */   createValidAbsoluteUrl: () => (/* binding */ createValidAbsoluteUrl),
12913/* harmony export */   fetchData: () => (/* binding */ fetchData),
12914/* harmony export */   getDocument: () => (/* binding */ getDocument),
12915/* harmony export */   getFilenameFromUrl: () => (/* binding */ getFilenameFromUrl),
12916/* harmony export */   getPdfFilenameFromUrl: () => (/* binding */ getPdfFilenameFromUrl),
12917/* harmony export */   getXfaPageViewport: () => (/* binding */ getXfaPageViewport),
12918/* harmony export */   isDataScheme: () => (/* binding */ isDataScheme),
12919/* harmony export */   isPdfFile: () => (/* binding */ isPdfFile),
12920/* harmony export */   noContextMenu: () => (/* binding */ noContextMenu),
12921/* harmony export */   normalizeUnicode: () => (/* binding */ normalizeUnicode),
12922/* harmony export */   renderTextLayer: () => (/* binding */ renderTextLayer),
12923/* harmony export */   setLayerDimensions: () => (/* binding */ setLayerDimensions),
12924/* harmony export */   shadow: () => (/* binding */ shadow),
12925/* harmony export */   updateTextLayer: () => (/* binding */ updateTextLayer),
12926/* harmony export */   version: () => (/* binding */ version)
12927/* harmony export */ });
12928/* unused harmony exports CMapCompressionType, ImageKind, OPS, Outliner, PDFDataRangeTransport, Util, VerbosityLevel */
12929if (!globalThis.pdfjsLib) {
12930  await globalThis.pdfjsLibPromise;
12931}
12932const {
12933  AbortException,
12934  AnnotationEditorLayer,
12935  AnnotationEditorParamsType,
12936  AnnotationEditorType,
12937  AnnotationEditorUIManager,
12938  AnnotationLayer,
12939  AnnotationMode,
12940  build,
12941  CMapCompressionType,
12942  ColorPicker,
12943  createValidAbsoluteUrl,
12944  DOMSVGFactory,
12945  DrawLayer,
12946  FeatureTest,
12947  fetchData,
12948  getDocument,
12949  getFilenameFromUrl,
12950  getPdfFilenameFromUrl,
12951  getXfaPageViewport,
12952  GlobalWorkerOptions,
12953  ImageKind,
12954  InvalidPDFException,
12955  isDataScheme,
12956  isPdfFile,
12957  MissingPDFException,
12958  noContextMenu,
12959  normalizeUnicode,
12960  OPS,
12961  Outliner,
12962  PasswordResponses,
12963  PDFDataRangeTransport,
12964  PDFDateString,
12965  PDFWorker,
12966  PermissionFlag,
12967  PixelsPerInch,
12968  RenderingCancelledException,
12969  renderTextLayer,
12970  setLayerDimensions,
12971  shadow,
12972  UnexpectedResponseException,
12973  updateTextLayer,
12974  Util,
12975  VerbosityLevel,
12976  version,
12977  XfaLayer
12978} = globalThis.pdfjsLib;
12979
12980__webpack_async_result__();
12981} catch(e) { __webpack_async_result__(e); } }, 1);
12982
12983/***/ }),
12984
12985/***/ 8224:
12986/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
12987
12988/* harmony export */ __webpack_require__.d(__webpack_exports__, {
12989/* harmony export */   BasePreferences: () => (/* binding */ BasePreferences)
12990/* harmony export */ });
12991/* harmony import */ var _app_options_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9840);
12992
12993class BasePreferences {
12994  #browserDefaults = Object.freeze({
12995    canvasMaxAreaInBytes: -1,
12996    isInAutomation: false,
12997    supportsCaretBrowsingMode: false,
12998    supportsDocumentFonts: true,
12999    supportsIntegratedFind: false,
13000    supportsMouseWheelZoomCtrlKey: true,
13001    supportsMouseWheelZoomMetaKey: true,
13002    supportsPinchToZoom: true
13003  });
13004  #defaults = Object.freeze({
13005    annotationEditorMode: 0,
13006    annotationMode: 2,
13007    cursorToolOnLoad: 0,
13008    defaultZoomDelay: 400,
13009    defaultZoomValue: "",
13010    disablePageLabels: false,
13011    enableHighlightEditor: false,
13012    enableHighlightFloatingButton: false,
13013    enableML: false,
13014    enablePermissions: false,
13015    enablePrintAutoRotate: true,
13016    enableScripting: true,
13017    enableStampEditor: true,
13018    externalLinkTarget: 0,
13019    highlightEditorColors: "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",
13020    historyUpdateUrl: false,
13021    ignoreDestinationZoom: false,
13022    forcePageColors: false,
13023    pageColorsBackground: "Canvas",
13024    pageColorsForeground: "CanvasText",
13025    pdfBugEnabled: false,
13026    sidebarViewOnLoad: -1,
13027    scrollModeOnLoad: -1,
13028    spreadModeOnLoad: -1,
13029    textLayerMode: 1,
13030    viewOnLoad: 0,
13031    disableAutoFetch: false,
13032    disableFontFace: false,
13033    disableRange: false,
13034    disableStream: false,
13035    enableXfa: true,
13036    viewerCssTheme: 0
13037  });
13038  #prefs = Object.create(null);
13039  #initializedPromise = null;
13040  constructor() {
13041    if (this.constructor === BasePreferences) {
13042      throw new Error("Cannot initialize BasePreferences.");
13043    }
13044    this.#initializedPromise = this._readFromStorage(this.#defaults).then(({
13045      browserPrefs,
13046      prefs
13047    }) => {
13048      const options = Object.create(null);
13049      for (const [name, val] of Object.entries(this.#browserDefaults)) {
13050        const prefVal = browserPrefs?.[name];
13051        options[name] = typeof prefVal === typeof val ? prefVal : val;
13052      }
13053      for (const [name, val] of Object.entries(this.#defaults)) {
13054        const prefVal = prefs?.[name];
13055        options[name] = this.#prefs[name] = typeof prefVal === typeof val ? prefVal : val;
13056      }
13057      _app_options_js__WEBPACK_IMPORTED_MODULE_0__.AppOptions.setAll(options, true);
13058    });
13059  }
13060  async _writeToStorage(prefObj) {
13061    throw new Error("Not implemented: _writeToStorage");
13062  }
13063  async _readFromStorage(prefObj) {
13064    throw new Error("Not implemented: _readFromStorage");
13065  }
13066  #updatePref({
13067    name,
13068    value
13069  }) {
13070    throw new Error("Not implemented: #updatePref");
13071  }
13072  async reset() {
13073    await this.#initializedPromise;
13074    const oldPrefs = structuredClone(this.#prefs);
13075    this.#prefs = Object.create(null);
13076    try {
13077      await this._writeToStorage(this.#defaults);
13078    } catch (reason) {
13079      this.#prefs = oldPrefs;
13080      throw reason;
13081    }
13082  }
13083  async set(name, value) {
13084    await this.#initializedPromise;
13085    const defaultValue = this.#defaults[name],
13086      oldPrefs = structuredClone(this.#prefs);
13087    if (defaultValue === undefined) {
13088      throw new Error(`Set preference: "${name}" is undefined.`);
13089    } else if (value === undefined) {
13090      throw new Error("Set preference: no value is specified.");
13091    }
13092    const valueType = typeof value,
13093      defaultType = typeof defaultValue;
13094    if (valueType !== defaultType) {
13095      if (valueType === "number" && defaultType === "string") {
13096        value = value.toString();
13097      } else {
13098        throw new Error(`Set preference: "${value}" is a ${valueType}, expected a ${defaultType}.`);
13099      }
13100    } else if (valueType === "number" && !Number.isInteger(value)) {
13101      throw new Error(`Set preference: "${value}" must be an integer.`);
13102    }
13103    this.#prefs[name] = value;
13104    try {
13105      await this._writeToStorage(this.#prefs);
13106    } catch (reason) {
13107      this.#prefs = oldPrefs;
13108      throw reason;
13109    }
13110  }
13111  async get(name) {
13112    await this.#initializedPromise;
13113    const defaultValue = this.#defaults[name];
13114    if (defaultValue === undefined) {
13115      throw new Error(`Get preference: "${name}" is undefined.`);
13116    }
13117    return this.#prefs[name] ?? defaultValue;
13118  }
13119  get initializedPromise() {
13120    return this.#initializedPromise;
13121  }
13122}
13123
13124
13125/***/ }),
13126
13127/***/ 659:
13128/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
13129
13130__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
13131/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13132/* harmony export */   getXfaHtmlForPrinting: () => (/* binding */ getXfaHtmlForPrinting)
13133/* harmony export */ });
13134/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
13135/* harmony import */ var _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(787);
13136/* harmony import */ var _xfa_layer_builder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2973);
13137var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__, _xfa_layer_builder_js__WEBPACK_IMPORTED_MODULE_2__]);
13138([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__, _xfa_layer_builder_js__WEBPACK_IMPORTED_MODULE_2__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
13139
13140
13141
13142function getXfaHtmlForPrinting(printContainer, pdfDocument) {
13143  const xfaHtml = pdfDocument.allXfaHtml;
13144  const linkService = new _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_1__.SimpleLinkService();
13145  const scale = Math.round(pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.PixelsPerInch.PDF_TO_CSS_UNITS * 100) / 100;
13146  for (const xfaPage of xfaHtml.children) {
13147    const page = document.createElement("div");
13148    page.className = "xfaPrintedPage";
13149    printContainer.append(page);
13150    const builder = new _xfa_layer_builder_js__WEBPACK_IMPORTED_MODULE_2__.XfaLayerBuilder({
13151      pdfPage: null,
13152      annotationStorage: pdfDocument.annotationStorage,
13153      linkService,
13154      xfaHtml: xfaPage
13155    });
13156    const viewport = (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.getXfaPageViewport)(xfaPage, {
13157      scale
13158    });
13159    builder.render(viewport, "print");
13160    page.append(builder.div);
13161  }
13162}
13163
13164__webpack_async_result__();
13165} catch(e) { __webpack_async_result__(e); } });
13166
13167/***/ }),
13168
13169/***/ 1900:
13170/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
13171
13172__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
13173/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13174/* harmony export */   SecondaryToolbar: () => (/* binding */ SecondaryToolbar)
13175/* harmony export */ });
13176/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
13177/* harmony import */ var _pdf_viewer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6285);
13178var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_pdf_viewer_js__WEBPACK_IMPORTED_MODULE_1__]);
13179_pdf_viewer_js__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
13180
13181
13182class SecondaryToolbar {
13183  #opts;
13184  constructor(options, eventBus) {
13185    this.#opts = options;
13186    const buttons = [{
13187      element: options.presentationModeButton,
13188      eventName: "presentationmode",
13189      close: true
13190    }, {
13191      element: options.printButton,
13192      eventName: "print",
13193      close: true
13194    }, {
13195      element: options.downloadButton,
13196      eventName: "download",
13197      close: true
13198    }, {
13199      element: options.viewBookmarkButton,
13200      eventName: null,
13201      close: true
13202    }, {
13203      element: options.firstPageButton,
13204      eventName: "firstpage",
13205      close: true
13206    }, {
13207      element: options.lastPageButton,
13208      eventName: "lastpage",
13209      close: true
13210    }, {
13211      element: options.pageRotateCwButton,
13212      eventName: "rotatecw",
13213      close: false
13214    }, {
13215      element: options.pageRotateCcwButton,
13216      eventName: "rotateccw",
13217      close: false
13218    }, {
13219      element: options.cursorSelectToolButton,
13220      eventName: "switchcursortool",
13221      eventDetails: {
13222        tool: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.CursorTool.SELECT
13223      },
13224      close: true
13225    }, {
13226      element: options.cursorHandToolButton,
13227      eventName: "switchcursortool",
13228      eventDetails: {
13229        tool: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.CursorTool.HAND
13230      },
13231      close: true
13232    }, {
13233      element: options.scrollPageButton,
13234      eventName: "switchscrollmode",
13235      eventDetails: {
13236        mode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.PAGE
13237      },
13238      close: true
13239    }, {
13240      element: options.scrollVerticalButton,
13241      eventName: "switchscrollmode",
13242      eventDetails: {
13243        mode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.VERTICAL
13244      },
13245      close: true
13246    }, {
13247      element: options.scrollHorizontalButton,
13248      eventName: "switchscrollmode",
13249      eventDetails: {
13250        mode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.HORIZONTAL
13251      },
13252      close: true
13253    }, {
13254      element: options.scrollWrappedButton,
13255      eventName: "switchscrollmode",
13256      eventDetails: {
13257        mode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.WRAPPED
13258      },
13259      close: true
13260    }, {
13261      element: options.spreadNoneButton,
13262      eventName: "switchspreadmode",
13263      eventDetails: {
13264        mode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.NONE
13265      },
13266      close: true
13267    }, {
13268      element: options.spreadOddButton,
13269      eventName: "switchspreadmode",
13270      eventDetails: {
13271        mode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.ODD
13272      },
13273      close: true
13274    }, {
13275      element: options.spreadEvenButton,
13276      eventName: "switchspreadmode",
13277      eventDetails: {
13278        mode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.EVEN
13279      },
13280      close: true
13281    }, {
13282      element: options.documentPropertiesButton,
13283      eventName: "documentproperties",
13284      close: true
13285    }];
13286    buttons.push({
13287      element: options.openFileButton,
13288      eventName: "openfile",
13289      close: true
13290    });
13291    this.eventBus = eventBus;
13292    this.opened = false;
13293    this.#bindListeners(buttons);
13294    this.reset();
13295  }
13296  get isOpen() {
13297    return this.opened;
13298  }
13299  setPageNumber(pageNumber) {
13300    this.pageNumber = pageNumber;
13301    this.#updateUIState();
13302  }
13303  setPagesCount(pagesCount) {
13304    this.pagesCount = pagesCount;
13305    this.#updateUIState();
13306  }
13307  reset() {
13308    this.pageNumber = 0;
13309    this.pagesCount = 0;
13310    this.#updateUIState();
13311    this.#scrollModeChanged({
13312      mode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.VERTICAL
13313    });
13314    this.#spreadModeChanged({
13315      mode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.NONE
13316    });
13317  }
13318  #updateUIState() {
13319    const {
13320      firstPageButton,
13321      lastPageButton,
13322      pageRotateCwButton,
13323      pageRotateCcwButton
13324    } = this.#opts;
13325    firstPageButton.disabled = this.pageNumber <= 1;
13326    lastPageButton.disabled = this.pageNumber >= this.pagesCount;
13327    pageRotateCwButton.disabled = this.pagesCount === 0;
13328    pageRotateCcwButton.disabled = this.pagesCount === 0;
13329  }
13330  #bindListeners(buttons) {
13331    const {
13332      eventBus
13333    } = this;
13334    const {
13335      toggleButton
13336    } = this.#opts;
13337    toggleButton.addEventListener("click", this.toggle.bind(this));
13338    for (const {
13339      element,
13340      eventName,
13341      close,
13342      eventDetails
13343    } of buttons) {
13344      element.addEventListener("click", evt => {
13345        if (eventName !== null) {
13346          eventBus.dispatch(eventName, {
13347            source: this,
13348            ...eventDetails
13349          });
13350        }
13351        if (close) {
13352          this.close();
13353        }
13354        eventBus.dispatch("reporttelemetry", {
13355          source: this,
13356          details: {
13357            type: "buttons",
13358            data: {
13359              id: element.id
13360            }
13361          }
13362        });
13363      });
13364    }
13365    eventBus._on("cursortoolchanged", this.#cursorToolChanged.bind(this));
13366    eventBus._on("scrollmodechanged", this.#scrollModeChanged.bind(this));
13367    eventBus._on("spreadmodechanged", this.#spreadModeChanged.bind(this));
13368  }
13369  #cursorToolChanged({
13370    tool
13371  }) {
13372    const {
13373      cursorSelectToolButton,
13374      cursorHandToolButton
13375    } = this.#opts;
13376    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(cursorSelectToolButton, tool === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.CursorTool.SELECT);
13377    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(cursorHandToolButton, tool === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.CursorTool.HAND);
13378  }
13379  #scrollModeChanged({
13380    mode
13381  }) {
13382    const {
13383      scrollPageButton,
13384      scrollVerticalButton,
13385      scrollHorizontalButton,
13386      scrollWrappedButton,
13387      spreadNoneButton,
13388      spreadOddButton,
13389      spreadEvenButton
13390    } = this.#opts;
13391    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(scrollPageButton, mode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.PAGE);
13392    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(scrollVerticalButton, mode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.VERTICAL);
13393    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(scrollHorizontalButton, mode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.HORIZONTAL);
13394    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(scrollWrappedButton, mode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.WRAPPED);
13395    const forceScrollModePage = this.pagesCount > _pdf_viewer_js__WEBPACK_IMPORTED_MODULE_1__.PagesCountLimit.FORCE_SCROLL_MODE_PAGE;
13396    scrollPageButton.disabled = forceScrollModePage;
13397    scrollVerticalButton.disabled = forceScrollModePage;
13398    scrollHorizontalButton.disabled = forceScrollModePage;
13399    scrollWrappedButton.disabled = forceScrollModePage;
13400    const isHorizontal = mode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode.HORIZONTAL;
13401    spreadNoneButton.disabled = isHorizontal;
13402    spreadOddButton.disabled = isHorizontal;
13403    spreadEvenButton.disabled = isHorizontal;
13404  }
13405  #spreadModeChanged({
13406    mode
13407  }) {
13408    const {
13409      spreadNoneButton,
13410      spreadOddButton,
13411      spreadEvenButton
13412    } = this.#opts;
13413    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(spreadNoneButton, mode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.NONE);
13414    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(spreadOddButton, mode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.ODD);
13415    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleCheckedBtn)(spreadEvenButton, mode === _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode.EVEN);
13416  }
13417  open() {
13418    if (this.opened) {
13419      return;
13420    }
13421    this.opened = true;
13422    const {
13423      toggleButton,
13424      toolbar
13425    } = this.#opts;
13426    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleExpandedBtn)(toggleButton, true, toolbar);
13427  }
13428  close() {
13429    if (!this.opened) {
13430      return;
13431    }
13432    this.opened = false;
13433    const {
13434      toggleButton,
13435      toolbar
13436    } = this.#opts;
13437    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.toggleExpandedBtn)(toggleButton, false, toolbar);
13438  }
13439  toggle() {
13440    if (this.opened) {
13441      this.close();
13442    } else {
13443      this.open();
13444    }
13445  }
13446}
13447
13448__webpack_async_result__();
13449} catch(e) { __webpack_async_result__(e); } });
13450
13451/***/ }),
13452
13453/***/ 6698:
13454/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
13455
13456/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13457/* harmony export */   StructTreeLayerBuilder: () => (/* binding */ StructTreeLayerBuilder)
13458/* harmony export */ });
13459/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
13460
13461const PDF_ROLE_TO_HTML_ROLE = {
13462  Document: null,
13463  DocumentFragment: null,
13464  Part: "group",
13465  Sect: "group",
13466  Div: "group",
13467  Aside: "note",
13468  NonStruct: "none",
13469  P: null,
13470  H: "heading",
13471  Title: null,
13472  FENote: "note",
13473  Sub: "group",
13474  Lbl: null,
13475  Span: null,
13476  Em: null,
13477  Strong: null,
13478  Link: "link",
13479  Annot: "note",
13480  Form: "form",
13481  Ruby: null,
13482  RB: null,
13483  RT: null,
13484  RP: null,
13485  Warichu: null,
13486  WT: null,
13487  WP: null,
13488  L: "list",
13489  LI: "listitem",
13490  LBody: null,
13491  Table: "table",
13492  TR: "row",
13493  TH: "columnheader",
13494  TD: "cell",
13495  THead: "columnheader",
13496  TBody: null,
13497  TFoot: null,
13498  Caption: null,
13499  Figure: "figure",
13500  Formula: null,
13501  Artifact: null
13502};
13503const HEADING_PATTERN = /^H(\d+)$/;
13504class StructTreeLayerBuilder {
13505  #treeDom = undefined;
13506  get renderingDone() {
13507    return this.#treeDom !== undefined;
13508  }
13509  render(structTree) {
13510    if (this.#treeDom !== undefined) {
13511      return this.#treeDom;
13512    }
13513    const treeDom = this.#walk(structTree);
13514    treeDom?.classList.add("structTree");
13515    return this.#treeDom = treeDom;
13516  }
13517  hide() {
13518    if (this.#treeDom && !this.#treeDom.hidden) {
13519      this.#treeDom.hidden = true;
13520    }
13521  }
13522  show() {
13523    if (this.#treeDom?.hidden) {
13524      this.#treeDom.hidden = false;
13525    }
13526  }
13527  #setAttributes(structElement, htmlElement) {
13528    const {
13529      alt,
13530      id,
13531      lang
13532    } = structElement;
13533    if (alt !== undefined) {
13534      htmlElement.setAttribute("aria-label", (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.removeNullCharacters)(alt));
13535    }
13536    if (id !== undefined) {
13537      htmlElement.setAttribute("aria-owns", id);
13538    }
13539    if (lang !== undefined) {
13540      htmlElement.setAttribute("lang", (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.removeNullCharacters)(lang, true));
13541    }
13542  }
13543  #walk(node) {
13544    if (!node) {
13545      return null;
13546    }
13547    const element = document.createElement("span");
13548    if ("role" in node) {
13549      const {
13550        role
13551      } = node;
13552      const match = role.match(HEADING_PATTERN);
13553      if (match) {
13554        element.setAttribute("role", "heading");
13555        element.setAttribute("aria-level", match[1]);
13556      } else if (PDF_ROLE_TO_HTML_ROLE[role]) {
13557        element.setAttribute("role", PDF_ROLE_TO_HTML_ROLE[role]);
13558      }
13559    }
13560    this.#setAttributes(node, element);
13561    if (node.children) {
13562      if (node.children.length === 1 && "id" in node.children[0]) {
13563        this.#setAttributes(node.children[0], element);
13564      } else {
13565        for (const kid of node.children) {
13566          element.append(this.#walk(kid));
13567        }
13568      }
13569    }
13570    return element;
13571  }
13572}
13573
13574
13575/***/ }),
13576
13577/***/ 5860:
13578/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
13579
13580/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13581/* harmony export */   TextAccessibilityManager: () => (/* binding */ TextAccessibilityManager)
13582/* harmony export */ });
13583/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
13584
13585class TextAccessibilityManager {
13586  #enabled = false;
13587  #textChildren = null;
13588  #textNodes = new Map();
13589  #waitingElements = new Map();
13590  setTextMapping(textDivs) {
13591    this.#textChildren = textDivs;
13592  }
13593  static #compareElementPositions(e1, e2) {
13594    const rect1 = e1.getBoundingClientRect();
13595    const rect2 = e2.getBoundingClientRect();
13596    if (rect1.width === 0 && rect1.height === 0) {
13597      return +1;
13598    }
13599    if (rect2.width === 0 && rect2.height === 0) {
13600      return -1;
13601    }
13602    const top1 = rect1.y;
13603    const bot1 = rect1.y + rect1.height;
13604    const mid1 = rect1.y + rect1.height / 2;
13605    const top2 = rect2.y;
13606    const bot2 = rect2.y + rect2.height;
13607    const mid2 = rect2.y + rect2.height / 2;
13608    if (mid1 <= top2 && mid2 >= bot1) {
13609      return -1;
13610    }
13611    if (mid2 <= top1 && mid1 >= bot2) {
13612      return +1;
13613    }
13614    const centerX1 = rect1.x + rect1.width / 2;
13615    const centerX2 = rect2.x + rect2.width / 2;
13616    return centerX1 - centerX2;
13617  }
13618  enable() {
13619    if (this.#enabled) {
13620      throw new Error("TextAccessibilityManager is already enabled.");
13621    }
13622    if (!this.#textChildren) {
13623      throw new Error("Text divs and strings have not been set.");
13624    }
13625    this.#enabled = true;
13626    this.#textChildren = this.#textChildren.slice();
13627    this.#textChildren.sort(TextAccessibilityManager.#compareElementPositions);
13628    if (this.#textNodes.size > 0) {
13629      const textChildren = this.#textChildren;
13630      for (const [id, nodeIndex] of this.#textNodes) {
13631        const element = document.getElementById(id);
13632        if (!element) {
13633          this.#textNodes.delete(id);
13634          continue;
13635        }
13636        this.#addIdToAriaOwns(id, textChildren[nodeIndex]);
13637      }
13638    }
13639    for (const [element, isRemovable] of this.#waitingElements) {
13640      this.addPointerInTextLayer(element, isRemovable);
13641    }
13642    this.#waitingElements.clear();
13643  }
13644  disable() {
13645    if (!this.#enabled) {
13646      return;
13647    }
13648    this.#waitingElements.clear();
13649    this.#textChildren = null;
13650    this.#enabled = false;
13651  }
13652  removePointerInTextLayer(element) {
13653    if (!this.#enabled) {
13654      this.#waitingElements.delete(element);
13655      return;
13656    }
13657    const children = this.#textChildren;
13658    if (!children || children.length === 0) {
13659      return;
13660    }
13661    const {
13662      id
13663    } = element;
13664    const nodeIndex = this.#textNodes.get(id);
13665    if (nodeIndex === undefined) {
13666      return;
13667    }
13668    const node = children[nodeIndex];
13669    this.#textNodes.delete(id);
13670    let owns = node.getAttribute("aria-owns");
13671    if (owns?.includes(id)) {
13672      owns = owns.split(" ").filter(x => x !== id).join(" ");
13673      if (owns) {
13674        node.setAttribute("aria-owns", owns);
13675      } else {
13676        node.removeAttribute("aria-owns");
13677        node.setAttribute("role", "presentation");
13678      }
13679    }
13680  }
13681  #addIdToAriaOwns(id, node) {
13682    const owns = node.getAttribute("aria-owns");
13683    if (!owns?.includes(id)) {
13684      node.setAttribute("aria-owns", owns ? `${owns} ${id}` : id);
13685    }
13686    node.removeAttribute("role");
13687  }
13688  addPointerInTextLayer(element, isRemovable) {
13689    const {
13690      id
13691    } = element;
13692    if (!id) {
13693      return null;
13694    }
13695    if (!this.#enabled) {
13696      this.#waitingElements.set(element, isRemovable);
13697      return null;
13698    }
13699    if (isRemovable) {
13700      this.removePointerInTextLayer(element);
13701    }
13702    const children = this.#textChildren;
13703    if (!children || children.length === 0) {
13704      return null;
13705    }
13706    const index = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.binarySearchFirstItem)(children, node => TextAccessibilityManager.#compareElementPositions(element, node) < 0);
13707    const nodeIndex = Math.max(0, index - 1);
13708    const child = children[nodeIndex];
13709    this.#addIdToAriaOwns(id, child);
13710    this.#textNodes.set(id, nodeIndex);
13711    const parent = child.parentNode;
13712    return parent?.classList.contains("markedContent") ? parent.id : null;
13713  }
13714  moveElementInDOM(container, element, contentElement, isRemovable) {
13715    const id = this.addPointerInTextLayer(contentElement, isRemovable);
13716    if (!container.hasChildNodes()) {
13717      container.append(element);
13718      return id;
13719    }
13720    const children = Array.from(container.childNodes).filter(node =>
13720 node !== element);
13721    if (children.length === 0) {
13722      return id;
13723    }
13724    const elementToCompare = contentElement || element;
13725    const index = (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.binarySearchFirstItem)(children, node => TextAccessibilityManager.#compareElementPositions(elementToCompare, node) < 0);
13726    if (index === 0) {
13727      children[0].before(element);
13728    } else {
13729      children[index - 1].after(element);
13730    }
13731    return id;
13732  }
13733}
13734
13735
13736/***/ }),
13737
13738/***/ 2027:
13739/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
13740
13741/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13742/* harmony export */   TextHighlighter: () => (/* binding */ TextHighlighter)
13743/* harmony export */ });
13744class TextHighlighter {
13745  constructor({
13746    findController,
13747    eventBus,
13748    pageIndex
13749  }) {
13750    this.findController = findController;
13751    this.matches = [];
13752    this.eventBus = eventBus;
13753    this.pageIdx = pageIndex;
13754    this._onUpdateTextLayerMatches = null;
13755    this.textDivs = null;
13756    this.textContentItemsStr = null;
13757    this.enabled = false;
13758  }
13759  setTextMapping(divs, texts) {
13760    this.textDivs = divs;
13761    this.textContentItemsStr = texts;
13762  }
13763  enable() {
13764    if (!this.textDivs || !this.textContentItemsStr) {
13765      throw new Error("Text divs and strings have not been set.");
13766    }
13767    if (this.enabled) {
13768      throw new Error("TextHighlighter is already enabled.");
13769    }
13770    this.enabled = true;
13771    if (!this._onUpdateTextLayerMatches) {
13772      this._onUpdateTextLayerMatches = evt => {
13773        if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {
13774          this._updateMatches();
13775        }
13776      };
13777      this.eventBus._on("updatetextlayermatches", this._onUpdateTextLayerMatches);
13778    }
13779    this._updateMatches();
13780  }
13781  disable() {
13782    if (!this.enabled) {
13783      return;
13784    }
13785    this.enabled = false;
13786    if (this._onUpdateTextLayerMatches) {
13787      this.eventBus._off("updatetextlayermatches", this._onUpdateTextLayerMatches);
13788      this._onUpdateTextLayerMatches = null;
13789    }
13790    this._updateMatches(true);
13791  }
13792  _convertMatches(matches, matchesLength) {
13793    if (!matches) {
13794      return [];
13795    }
13796    const {
13797      textContentItemsStr
13798    } = this;
13799    let i = 0,
13800      iIndex = 0;
13801    const end = textContentItemsStr.length - 1;
13802    const result = [];
13803    for (let m = 0, mm = matches.length; m < mm; m++) {
13804      let matchIdx = matches[m];
13805      while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {
13806        iIndex += textContentItemsStr[i].length;
13807        i++;
13808      }
13809      if (i === textContentItemsStr.length) {
13810        console.error("Could not find a matching mapping");
13811      }
13812      const match = {
13813        begin: {
13814          divIdx: i,
13815          offset: matchIdx - iIndex
13816        }
13817      };
13818      matchIdx += matchesLength[m];
13819      while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {
13820        iIndex += textContentItemsStr[i].length;
13821        i++;
13822      }
13823      match.end = {
13824        divIdx: i,
13825        offset: matchIdx - iIndex
13826      };
13827      result.push(match);
13828    }
13829    return result;
13830  }
13831  _renderMatches(matches) {
13832    if (matches.length === 0) {
13833      return;
13834    }
13835    const {
13836      findController,
13837      pageIdx
13838    } = this;
13839    const {
13840      textContentItemsStr,
13841      textDivs
13842    } = this;
13843    const isSelectedPage = pageIdx === findController.selected.pageIdx;
13844    const selectedMatchIdx = findController.selected.matchIdx;
13845    const highlightAll = findController.state.highlightAll;
13846    let prevEnd = null;
13847    const infinity = {
13848      divIdx: -1,
13849      offset: undefined
13850    };
13851    function beginText(begin, className) {
13852      const divIdx = begin.divIdx;
13853      textDivs[divIdx].textContent = "";
13854      return appendTextToDiv(divIdx, 0, begin.offset, className);
13855    }
13856    function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
13857      let div = textDivs[divIdx];
13858      if (div.nodeType === Node.TEXT_NODE) {
13859        const span = document.createElement("span");
13860        div.before(span);
13861        span.append(div);
13862        textDivs[divIdx] = span;
13863        div = span;
13864      }
13865      const content = textContentItemsStr[divIdx].substring(fromOffset, toOffset);
13866      const node = document.createTextNode(content);
13867      if (className) {
13868        const span = document.createElement("span");
13869        span.className = `${className} appended`;
13870        span.append(node);
13871        div.append(span);
13872        return className.includes("selected") ? span.offsetLeft : 0;
13873      }
13874      div.append(node);
13875      return 0;
13876    }
13877    let i0 = selectedMatchIdx,
13878      i1 = i0 + 1;
13879    if (highlightAll) {
13880      i0 = 0;
13881      i1 = matches.length;
13882    } else if (!isSelectedPage) {
13883      return;
13884    }
13885    let lastDivIdx = -1;
13886    let lastOffset = -1;
13887    for (let i = i0; i < i1; i++) {
13888      const match = matches[i];
13889      const begin = match.begin;
13890      if (begin.divIdx === lastDivIdx && begin.offset === lastOffset) {
13891        continue;
13892      }
13893      lastDivIdx = begin.divIdx;
13894      lastOffset = begin.offset;
13895      const end = match.end;
13896      const isSelected = isSelectedPage && i === selectedMatchIdx;
13897      const highlightSuffix = isSelected ? " selected" : "";
13898      let selectedLeft = 0;
13899      if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {
13900        if (prevEnd !== null) {
13901          appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
13902        }
13903        beginText(begin);
13904      } else {
13905        appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);
13906      }
13907      if (begin.divIdx === end.divIdx) {
13908        selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix);
13909      } else {
13910        selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix);
13911        for (let n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {
13912          textDivs[n0].className = "highlight middle" + highlightSuffix;
13913        }
13914        beginText(end, "highlight end" + highlightSuffix);
13915      }
13916      prevEnd = end;
13917      if (isSelected) {
13918        findController.scrollMatchIntoView({
13919          element: textDivs[begin.divIdx],
13920          selectedLeft,
13921          pageIndex: pageIdx,
13922          matchIndex: selectedMatchIdx
13923        });
13924      }
13925    }
13926    if (prevEnd) {
13927      appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
13928    }
13929  }
13930  _updateMatches(reset = false) {
13931    if (!this.enabled && !reset) {
13932      return;
13933    }
13934    const {
13935      findController,
13936      matches,
13937      pageIdx
13938    } = this;
13939    const {
13940      textContentItemsStr,
13941      textDivs
13942    } = this;
13943    let clearedUntilDivIdx = -1;
13944    for (const match of matches) {
13945      const begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);
13946      for (let n = begin, end = match.end.divIdx; n <= end; n++) {
13947        const div = textDivs[n];
13948        div.textContent = textContentItemsStr[n];
13949        div.className = "";
13950      }
13951      clearedUntilDivIdx = match.end.divIdx + 1;
13952    }
13953    if (!findController?.highlightMatches || reset) {
13954      return;
13955    }
13956    const pageMatches = findController.pageMatches[pageIdx] || null;
13957    const pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;
13958    this.matches = this._convertMatches(pageMatches, pageMatchesLength);
13959    this._renderMatches(this.matches);
13960  }
13961}
13962
13963
13964/***/ }),
13965
13966/***/ 7765:
13967/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
13968
13969__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
13970/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13971/* harmony export */   TextLayerBuilder: () => (/* binding */ TextLayerBuilder)
13972/* harmony export */ });
13973/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
13974/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7256);
13975var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
13976pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
13977
13978
13979class TextLayerBuilder {
13980  #enablePermissions = false;
13981  #onAppend = null;
13982  #rotation = 0;
13983  #scale = 0;
13984  #textContentSource = null;
13985  constructor({
13986    highlighter = null,
13987    accessibilityManager = null,
13988    enablePermissions = false,
13989    onAppend = null
13990  }) {
13991    this.textContentItemsStr = [];
13992    this.renderingDone = false;
13993    this.textDivs = [];
13994    this.textDivProperties = new WeakMap();
13995    this.textLayerRenderTask = null;
13996    this.highlighter = highlighter;
13997    this.accessibilityManager = accessibilityManager;
13998    this.#enablePermissions = enablePermissions === true;
13999    this.#onAppend = onAppend;
14000    this.div = document.createElement("div");
14001    this.div.tabIndex = 0;
14002    this.div.className = "textLayer";
14003  }
14004  #finishRendering() {
14005    this.renderingDone = true;
14006    const endOfContent = document.createElement("div");
14007    endOfContent.className = "endOfContent";
14008    this.div.append(endOfContent);
14009    this.#bindMouse();
14010  }
14011  get numTextDivs() {
14012    return this.textDivs.length;
14013  }
14014  async render(viewport) {
14015    if (!this.#textContentSource) {
14016      throw new Error('No "textContentSource" parameter specified.');
14017    }
14018    const scale = viewport.scale * (globalThis.devicePixelRatio || 1);
14019    const {
14020      rotation
14021    } = viewport;
14022    if (this.renderingDone) {
14023      const mustRotate = rotation !== this.#rotation;
14024      const mustRescale = scale !== this.#scale;
14025      if (mustRotate || mustRescale) {
14026        this.hide();
14027        (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.updateTextLayer)({
14028          container: this.div,
14029          viewport,
14030          textDivs: this.textDivs,
14031          textDivProperties: this.textDivProperties,
14032          mustRescale,
14033          mustRotate
14034        });
14035        this.#scale = scale;
14036        this.#rotation = rotation;
14037      }
14038      this.show();
14039      return;
14040    }
14041    this.cancel();
14042    this.highlighter?.setTextMapping(this.textDivs, this.textContentItemsStr);
14043    this.accessibilityManager?.setTextMapping(this.textDivs);
14044    this.textLayerRenderTask = (0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.renderTextLayer)({
14045      textContentSource: this.#textContentSource,
14046      container: this.div,
14047      viewport,
14048      textDivs: this.textDivs,
14049      textDivProperties: this.textDivProperties,
14050      textContentItemsStr: this.textContentItemsStr
14051    });
14052    await this.textLayerRenderTask.promise;
14053    this.#finishRendering();
14054    this.#scale = scale;
14055    this.#rotation = rotation;
14056    this.#onAppend?.(this.div);
14057    this.highlighter?.enable();
14058    this.accessibilityManager?.enable();
14059  }
14060  hide() {
14061    if (!this.div.hidden && this.renderingDone) {
14062      this.highlighter?.disable();
14063      this.div.hidden = true;
14064    }
14065  }
14066  show() {
14067    if (this.div.hidden && this.renderingDone) {
14068      this.div.hidden = false;
14069      this.highlighter?.enable();
14070    }
14071  }
14072  cancel() {
14073    if (this.textLayerRenderTask) {
14074      this.textLayerRenderTask.cancel();
14075      this.textLayerRenderTask = null;
14076    }
14077    this.highlighter?.disable();
14078    this.accessibilityManager?.disable();
14079    this.textContentItemsStr.length = 0;
14080    this.textDivs.length = 0;
14081    this.textDivProperties = new WeakMap();
14082  }
14083  setTextContentSource(source) {
14084    this.cancel();
14085    this.#textContentSource = source;
14086  }
14087  #bindMouse() {
14088    const {
14089      div
14090    } = this;
14091    div.addEventListener("mousedown", evt => {
14092      const end = div.querySelector(".endOfContent");
14093      if (!end) {
14094        return;
14095      }
14096      let adjustTop = evt.target !== div;
14097      adjustTop &&= getComputedStyle(end).getPropertyValue("-moz-user-select") !== "none";
14098      if (adjustTop) {
14099        const divBounds = div.getBoundingClientRect();
14100        const r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);
14101        end.style.top = (r * 100).toFixed(2) + "%";
14102      }
14103      end.classList.add("active");
14104    });
14105    div.addEventListener("mouseup", () => {
14106      const end = div.querySelector(".endOfContent");
14107      if (!end) {
14108        return;
14109      }
14110      end.style.top = "";
14111      end.classList.remove("active");
14112    });
14113    div.addEventListener("copy", event => {
14114      if (!this.#enablePermissions) {
14115        const selection = document.getSelection();
14116        event.clipboardData.setData("text/plain", (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.removeNullCharacters)((0,pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.normalizeUnicode)(selection.toString())));
14117      }
14118      event.preventDefault();
14119      event.stopPropagation();
14120    });
14121  }
14122}
14123
14124__webpack_async_result__();
14125} catch(e) { __webpack_async_result__(e); } });
14126
14127/***/ }),
14128
14129/***/ 6297:
14130/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
14131
14132__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
14133/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14134/* harmony export */   Toolbar: () => (/* binding */ Toolbar)
14135/* harmony export */ });
14136/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
14137/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7256);
14138var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
14139pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
14140
14141
14142class Toolbar {
14143  #opts;
14144  constructor(options, eventBus) {
14145    this.#opts = options;
14146    this.eventBus = eventBus;
14147    const buttons = [{
14148      element: options.previous,
14149      eventName: "previouspage"
14150    }, {
14151      element: options.next,
14152      eventName: "nextpage"
14153    }, {
14154      element: options.zoomIn,
14155      eventName: "zoomin"
14156    }, {
14157      element: options.zoomOut,
14158      eventName: "zoomout"
14159    }, {
14160      element: options.print,
14161      eventName: "print"
14162    }, {
14163      element: options.download,
14164      eventName: "download"
14165    }, {
14166      element: options.editorFreeTextButton,
14167      eventName: "switchannotationeditormode",
14168      eventDetails: {
14169        get mode() {
14170          const {
14171            classList
14172          } = options.editorFreeTextButton;
14173          return classList.contains("toggled") ? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE : pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.FREETEXT;
14174        }
14175      }
14176    }, {
14177      element: options.editorHighlightButton,
14178      eventName: "switchannotationeditormode",
14179      eventDetails: {
14180        get mode() {
14181          const {
14182            classList
14183          } = options.editorHighlightButton;
14184          return classList.contains("toggled") ? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE : pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.HIGHLIGHT;
14185        }
14186      }
14187    }, {
14188      element: options.editorInkButton,
14189      eventName: "switchannotationeditormode",
14190      eventDetails: {
14191        get mode() {
14192          const {
14193            classList
14194          } = options.editorInkButton;
14195          return classList.contains("toggled") ? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE : pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.INK;
14196        }
14197      }
14198    }, {
14199      element: options.editorStampButton,
14200      eventName: "switchannotationeditormode",
14201      eventDetails: {
14202        get mode() {
14203          const {
14204            classList
14205          } = options.editorStampButton;
14206          return classList.contains("toggled") ? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE : pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.STAMP;
14207        }
14208      }
14209    }];
14210    this.#bindListeners(buttons);
14211    if (options.editorHighlightColorPicker) {
14212      eventBus._on("annotationeditoruimanager", ({
14213        uiManager
14214      }) => {
14215        this.#setAnnotationEditorUIManager(uiManager, options.editorHighlightColorPicker);
14216      }, {
14217        once: true
14218      });
14219    }
14220    eventBus._on("showannotationeditorui", ({
14221      mode
14222    }) => {
14223      switch (mode) {
14224        case pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.HIGHLIGHT:
14225          options.editorHighlightButton.click();
14226          break;
14227      }
14228    });
14229    this.reset();
14230  }
14231  #setAnnotationEditorUIManager(uiManager, parentContainer) {
14232    const colorPicker = new pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.ColorPicker({
14233      uiManager
14234    });
14235    uiManager.setMainHighlightColorPicker(colorPicker);
14236    parentContainer.append(colorPicker.renderMainDropdown());
14237  }
14238  setPageNumber(pageNumber, pageLabel) {
14239    this.pageNumber = pageNumber;
14240    this.pageLabel = pageLabel;
14241    this.#updateUIState(false);
14242  }
14243  setPagesCount(pagesCount, hasPageLabels) {
14244    this.pagesCount = pagesCount;
14245    this.hasPageLabels = hasPageLabels;
14246    this.#updateUIState(true);
14247  }
14248  setPageScale(pageScaleValue, pageScale) {
14249    this.pageScaleValue = (pageScaleValue || pageScale).toString();
14250    this.pageScale = pageScale;
14251    this.#updateUIState(false);
14252  }
14253  reset() {
14254    this.pageNumber = 0;
14255    this.pageLabel = null;
14256    this.hasPageLabels = false;
14257    this.pagesCount = 0;
14258    this.pageScaleValue = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SCALE_VALUE;
14259    this.pageScale = _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SCALE;
14260    this.#updateUIState(true);
14261    this.updateLoadingIndicatorState();
14262    this.#editorModeChanged({
14263      mode: pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.DISABLE
14264    });
14265  }
14266  #bindListeners(buttons) {
14267    const {
14268      eventBus
14269    } = this;
14270    const {
14271      pageNumber,
14272      scaleSelect
14273    } = this.#opts;
14274    const self = this;
14275    for (const {
14276      element,
14277      eventName,
14278      eventDetails
14279    } of buttons) {
14280      element.addEventListener("click", evt => {
14281        if (eventName !== null) {
14282          eventBus.dispatch(eventName, {
14283            source: this,
14284            ...eventDetails,
14285            isFromKeyboard: evt.detail === 0
14286          });
14287        }
14288      });
14289    }
14290    pageNumber.addEventListener("click", function () {
14291      this.select();
14292    });
14293    pageNumber.addEventListener("change", function () {
14294      eventBus.dispatch("pagenumberchanged", {
14295        source: self,
14296        value: this.value
14297      });
14298    });
14299    scaleSelect.addEventListener("change", function () {
14300      if (this.value === "custom") {
14301        return;
14302      }
14303      eventBus.dispatch("scalechanged", {
14304        source: self,
14305        value: this.value
14306      });
14307    });
14308    scaleSelect.addEventListener("click", function ({
14309      target
14310    }) {
14311      if (this.value === self.pageScaleValue && target.tagName.toUpperCase() === "OPTION") {
14312        this.blur();
14313      }
14314    });
14315    scaleSelect.oncontextmenu = pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.noContextMenu;
14316    eventBus._on("annotationeditormodechanged", this.#editorModeChanged.bind(this));
14317  }
14318  #editorModeChanged({
14319    mode
14320  }) {
14321    const {
14322      editorFreeTextButton,
14323      editorFreeTextParamsToolbar,
14324      editorHighlightButton,
14325      editorHighlightParamsToolbar,
14326      editorInkButton,
14327      editorInkParamsToolbar,
14328      editorStampButton,
14329      editorStampParamsToolbar
14330    } = this.#opts;
14331    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.toggleCheckedBtn)(editorFreeTextButton, mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.FREETEXT, editorFreeTextParamsToolbar);
14332    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.toggleCheckedBtn)(editorHighlightButton, mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.HIGHLIGHT, editorHighlightParamsToolbar);
14333    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.toggleCheckedBtn)(editorInkButton, mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.INK, editorInkParamsToolbar);
14334    (0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.toggleCheckedBtn)(editorStampButton, mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.STAMP, editorStampParamsToolbar);
14335    const isDisable = mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.DISABLE;
14336    editorFreeTextButton.disabled = isDisable;
14337    editorHighlightButton.disabled = isDisable;
14338    editorInkButton.disabled = isDisable;
14339    editorStampButton.disabled = isDisable;
14340  }
14341  #updateUIState(resetNumPages = false) {
14342    const {
14343      pageNumber,
14344      pagesCount,
14345      pageScaleValue,
14346      pageScale
14347    } = this;
14348    const opts = this.#opts;
14349    if (resetNumPages) {
14350      if (this.hasPageLabels) {
14351        opts.pageNumber.type = "text";
14352        opts.numPages.setAttribute("data-l10n-id", "pdfjs-page-of-pages");
14353      } else {
14354        opts.pageNumber.type = "number";
14355        opts.numPages.setAttribute("data-l10n-id", "pdfjs-of-pages");
14356        opts.numPages.setAttribute("data-l10n-args", JSON.stringify({
14357          pagesCount
14358        }));
14359      }
14360      opts.pageNumber.max = pagesCount;
14361    }
14362    if (this.hasPageLabels) {
14363      opts.pageNumber.value = this.pageLabel;
14364      opts.numPages.setAttribute("data-l10n-args", JSON.stringify({
14365        pageNumber,
14366        pagesCount
14367      }));
14368    } else {
14369      opts.pageNumber.value = pageNumber;
14370    }
14371    opts.previous.disabled = pageNumber <= 1;
14372    opts.next.disabled = pageNumber >= pagesCount;
14373    opts.zoomOut.disabled = pageScale <= _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.MIN_SCALE;
14374    opts.zoomIn.disabled = pageScale >= _ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.MAX_SCALE;
14375    let predefinedValueFound = false;
14376    for (const option of opts.scaleSelect.options) {
14377      if (option.value !== pageScaleValue) {
14378        option.selected = false;
14379        continue;
14380      }
14381      option.selected = true;
14382      predefinedValueFound = true;
14383    }
14384    if (!predefinedValueFound) {
14385      opts.customScaleOption.selected = true;
14386      opts.customScaleOption.setAttribute("data-l10n-args", JSON.stringify({
14387        scale: Math.round(pageScale * 10000) / 100
14388      }));
14389    }
14390  }
14391  updateLoadingIndicatorState(loading = false) {
14392    const {
14393      pageNumber
14394    } = this.#opts;
14395    pageNumber.classList.toggle("loading", loading);
14396  }
14397}
14398
14399__webpack_async_result__();
14400} catch(e) { __webpack_async_result__(e); } });
14401
14402/***/ }),
14403
14404/***/ 7256:
14405/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
14406
14407/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14408/* harmony export */   AutoPrintRegExp: () => (/* binding */ AutoPrintRegExp),
14409/* harmony export */   CursorTool: () => (/* binding */ CursorTool),
14410/* harmony export */   DEFAULT_SCALE: () => (/* binding */ DEFAULT_SCALE),
14411/* harmony export */   DEFAULT_SCALE_DELTA: () => (/* binding */ DEFAULT_SCALE_DELTA),
14412/* harmony export */   DEFAULT_SCALE_VALUE: () => (/* binding */ DEFAULT_SCALE_VALUE),
14413/* harmony export */   MAX_AUTO_SCALE: () => (/* binding */ MAX_AUTO_SCALE),
14414/* harmony export */   MAX_SCALE: () => (/* binding */ MAX_SCALE),
14415/* harmony export */   MIN_SCALE: () => (/* binding */ MIN_SCALE),
14416/* harmony export */   OutputScale: () => (/* binding */ OutputScale),
14417/* harmony export */   PresentationModeState: () => (/* binding */ PresentationModeState),
14418/* harmony export */   ProgressBar: () => (/* binding */ ProgressBar),
14419/* harmony export */   RenderingStates: () => (/* binding */ RenderingStates),
14420/* harmony export */   SCROLLBAR_PADDING: () => (/* binding */ SCROLLBAR_PADDING),
14421/* harmony export */   ScrollMode: () => (/* binding */ ScrollMode),
14422/* harmony export */   SidebarView: () => (/* binding */ SidebarView),
14423/* harmony export */   SpreadMode: () => (/* binding */ SpreadMode),
14424/* harmony export */   TextLayerMode: () => (/* binding */ TextLayerMode),
14425/* harmony export */   UNKNOWN_SCALE: () => (/* binding */ UNKNOWN_SCALE),
14426/* harmony export */   VERTICAL_PADDING: () => (/* binding */ VERTICAL_PADDING),
14427/* harmony export */   animationStarted: () => (/* binding */ animationStarted),
14428/* harmony export */   apiPageLayoutToViewerModes: () => (/* binding */ apiPageLayoutToViewerModes),
14429/* harmony export */   apiPageModeToSidebarView: () => (/* binding */ apiPageModeToSidebarView),
14430/* harmony export */   approximateFraction: () => (/* binding */ approximateFraction),
14431/* harmony export */   binarySearchFirstItem: () => (/* binding */ binarySearchFirstItem),
14432/* harmony export */   docStyle: () => (/* binding */ docStyle),
14433/* harmony export */   getActiveOrFocusedElement: () => (/* binding */ getActiveOrFocusedElement),
14434/* harmony export */   getPageSizeInches: () => (/* binding */ getPageSizeInches),
14435/* harmony export */   getVisibleElements: () => (/* binding */ getVisibleElements),
14436/* harmony export */   isPortraitOrientation: () => (/* binding */ isPortraitOrientation),
14437/* harmony export */   isValidRotation: () => (/* binding */ isValidRotation),
14438/* harmony export */   isValidScrollMode: () => (/* binding */ isValidScrollMode),
14439/* harmony export */   isValidSpreadMode: () => (/* binding */ isValidSpreadMode),
14440/* harmony export */   normalizeWheelEventDelta: () => (/* binding */ normalizeWheelEventDelta),
14441/* harmony export */   normalizeWheelEventDirection: () => (/* binding */ normalizeWheelEventDirection),
14442/* harmony export */   parseQueryString: () => (/* binding */ parseQueryString),
14443/* harmony export */   removeNullCharacters: () => (/* binding */ removeNullCharacters),
14444/* harmony export */   roundToDivide: () => (/* binding */ roundToDivide),
14445/* harmony export */   scrollIntoView: () => (/* binding */ scrollIntoView),
14446/* harmony export */   toggleCheckedBtn: () => (/* binding */ toggleCheckedBtn),
14447/* harmony export */   toggleExpandedBtn: () => (/* binding */ toggleExpandedBtn),
14448/* harmony export */   watchScroll: () => (/* binding */ watchScroll)
14449/* harmony export */ });
14450/* unused harmony export backtrackBeforeAllVisibleElements */
14451const DEFAULT_SCALE_VALUE = "auto";
14452const DEFAULT_SCALE = 1.0;
14453const DEFAULT_SCALE_DELTA = 1.1;
14454const MIN_SCALE = 0.1;
14455const MAX_SCALE = 10.0;
14456const UNKNOWN_SCALE = 0;
14457const MAX_AUTO_SCALE = 1.25;
14458const SCROLLBAR_PADDING = 40;
14459const VERTICAL_PADDING = 5;
14460const RenderingStates = {
14461  INITIAL: 0,
14462  RUNNING: 1,
14463  PAUSED: 2,
14464  FINISHED: 3
14465};
14466const PresentationModeState = {
14467  UNKNOWN: 0,
14468  NORMAL: 1,
14469  CHANGING: 2,
14470  FULLSCREEN: 3
14471};
14472const SidebarView = {
14473  UNKNOWN: -1,
14474  NONE: 0,
14475  THUMBS: 1,
14476  OUTLINE: 2,
14477  ATTACHMENTS: 3,
14478  LAYERS: 4
14479};
14480const TextLayerMode = {
14481  DISABLE: 0,
14482  ENABLE: 1,
14483  ENABLE_PERMISSIONS: 2
14484};
14485const ScrollMode = {
14486  UNKNOWN: -1,
14487  VERTICAL: 0,
14488  HORIZONTAL: 1,
14489  WRAPPED: 2,
14490  PAGE: 3
14491};
14492const SpreadMode = {
14493  UNKNOWN: -1,
14494  NONE: 0,
14495  ODD: 1,
14496  EVEN: 2
14497};
14498const CursorTool = {
14499  SELECT: 0,
14500  HAND: 1,
14501  ZOOM: 2
14502};
14503const AutoPrintRegExp = /\bprint\s*\(/;
14504class OutputScale {
14505  constructor() {
14506    const pixelRatio = window.devicePixelRatio || 1;
14507    this.sx = pixelRatio;
14508    this.sy = pixelRatio;
14509  }
14510  get scaled() {
14511    return this.sx !== 1 || this.sy !== 1;
14512  }
14513}
14514function scrollIntoView(element, spot, scrollMatches = false) {
14515  let parent = element.offsetParent;
14516  if (!parent) {
14517    console.error("offsetParent is not set -- cannot scroll");
14518    return;
14519  }
14520  let offsetY = element.offsetTop + element.clientTop;
14521  let offsetX = element.offsetLeft + element.clientLeft;
14522  while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || scrollMatches && (parent.classList.contains("markedContent") || getComputedStyle(parent).overflow === "hidden")) {
14523    offsetY += parent.offsetTop;
14524    offsetX += parent.offsetLeft;
14525    parent = parent.offsetParent;
14526    if (!parent) {
14527      return;
14528    }
14529  }
14530  if (spot) {
14531    if (spot.top !== undefined) {
14532      offsetY += spot.top;
14533    }
14534    if (spot.left !== undefined) {
14535      offsetX += spot.left;
14536      parent.scrollLeft = offsetX;
14537    }
14538  }
14539  parent.scrollTop = offsetY;
14540}
14541function watchScroll(viewAreaElement, callback) {
14542  const debounceScroll = function (evt) {
14543    if (rAF) {
14544      return;
14545    }
14546    rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
14547      rAF = null;
14548      const currentX = viewAreaElement.scrollLeft;
14549      const lastX = state.lastX;
14550      if (currentX !== lastX) {
14551        state.right = currentX > lastX;
14552      }
14553      state.lastX = currentX;
14554      const currentY = viewAreaElement.scrollTop;
14555      const lastY = state.lastY;
14556      if (currentY !== lastY) {
14557        state.down = currentY > lastY;
14558      }
14559      state.lastY = currentY;
14560      callback(state);
14561    });
14562  };
14563  const state = {
14564    right: true,
14565    down: true,
14566    lastX: viewAreaElement.scrollLeft,
14567    lastY: viewAreaElement.scrollTop,
14568    _eventHandler: debounceScroll
14569  };
14570  let rAF = null;
14571  viewAreaElement.addEventListener("scroll", debounceScroll, true);
14572  return state;
14573}
14574function parseQueryString(query) {
14575  const params = new Map();
14576  for (const [key, value] of new URLSearchParams(query)) {
14577    params.set(key.toLowerCase(), value);
14578  }
14579  return params;
14580}
14581const InvisibleCharsRegExp = /[\x00-\x1F]/g;
14582function removeNullCharacters(str, replaceInvisible = false) {
14583  if (!InvisibleCharsRegExp.test(str)) {
14584    return str;
14585  }
14586  if (replaceInvisible) {
14587    return str.replaceAll(InvisibleCharsRegExp, m => m === "\x00" ? "" : " ");
14588  }
14589  return str.replaceAll("\x00", "");
14590}
14591function binarySearchFirstItem(items, condition, start = 0) {
14592  let minIndex = start;
14593  let maxIndex = items.length - 1;
14594  if (maxIndex < 0 || !condition(items[maxIndex])) {
14595    return items.length;
14596  }
14597  if (condition(items[minIndex])) {
14598    return minIndex;
14599  }
14600  while (minIndex < maxIndex) {
14601    const currentIndex = minIndex + maxIndex >> 1;
14602    const currentItem = items[currentIndex];
14603    if (condition(currentItem)) {
14604      maxIndex = currentIndex;
14605    } else {
14606      minIndex = currentIndex + 1;
14607    }
14608  }
14609  return minIndex;
14610}
14611function approximateFraction(x) {
14612  if (Math.floor(x) === x) {
14613    return [x, 1];
14614  }
14615  const xinv = 1 / x;
14616  const limit = 8;
14617  if (xinv > limit) {
14618    return [1, limit];
14619  } else if (Math.floor(xinv) === xinv) {
14620    return [1, xinv];
14621  }
14622  const x_ = x > 1 ? xinv : x;
14623  let a = 0,
14624    b = 1,
14625    c = 1,
14626    d = 1;
14627  while (true) {
14628    const p = a + c,
14629      q = b + d;
14630    if (q > limit) {
14631      break;
14632    }
14633    if (x_ <= p / q) {
14634      c = p;
14635      d = q;
14636    } else {
14637      a = p;
14638      b = q;
14639    }
14640  }
14641  let result;
14642  if (x_ - a / b < c / d - x_) {
14643    result = x_ === x ? [a, b] : [b, a];
14644  } else {
14645    result = x_ === x ? [c, d] : [d, c];
14646  }
14647  return result;
14648}
14649function roundToDivide(x, div) {
14650  const r = x % div;
14651  return r === 0 ? x : Math.round(x - r + div);
14652}
14653function getPageSizeInches({
14654  view,
14655  userUnit,
14656  rotate
14657}) {
14658  const [x1, y1, x2, y2] = view;
14659  const changeOrientation = rotate % 180 !== 0;
14660  const width = (x2 - x1) / 72 * userUnit;
14661  const height = (y2 - y1) / 72 * userUnit;
14662  return {
14663    width: changeOrientation ? height : width,
14664    height: changeOrientation ? width : height
14665  };
14666}
14667function backtrackBeforeAllVisibleElements(index, views, top) {
14668  if (index < 2) {
14669    return index;
14670  }
14671  let elt = views[index].div;
14672  let pageTop = elt.offsetTop + elt.clientTop;
14673  if (pageTop >= top) {
14674    elt = views[index - 1].div;
14675    pageTop = elt.offsetTop + elt.clientTop;
14676  }
14677  for (let i = index - 2; i >= 0; --i) {
14678    elt = views[i].div;
14679    if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {
14680      break;
14681    }
14682    index = i;
14683  }
14684  return index;
14685}
14686function getVisibleElements({
14687  scrollEl,
14688  views,
14689  sortByVisibility = false,
14690  horizontal = false,
14691  rtl = false
14692}) {
14693  const top = scrollEl.scrollTop,
14694    bottom = top + scrollEl.clientHeight;
14695  const left = scrollEl.scrollLeft,
14696    right = left + scrollEl.clientWidth;
14697  function isElementBottomAfterViewTop(view) {
14698    const element = view.div;
14699    const elementBottom = element.offsetTop + element.clientTop + element.clientHeight;
14700    return elementBottom > top;
14701  }
14702  function isElementNextAfterViewHorizontally(view) {
14703    const element = view.div;
14704    const elementLeft = element.offsetLeft + element.clientLeft;
14705    const elementRight = elementLeft + element.clientWidth;
14706    return rtl ? elementLeft < right : elementRight > left;
14707  }
14708  const visible = [],
14709    ids = new Set(),
14710    numViews = views.length;
14711  let firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop);
14712  if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) {
14713    firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);
14714  }
14715  let lastEdge = horizontal ? right : -1;
14716  for (let i = firstVisibleElementInd; i < numViews; i++) {
14717    const view = views[i],
14718      element = view.div;
14719    const currentWidth = element.offsetLeft + element.clientLeft;
14720    const currentHeight = element.offsetTop + element.clientTop;
14721    const viewWidth = element.clientWidth,
14722      viewHeight = element.clientHeight;
14723    const viewRight = currentWidth + viewWidth;
14724    const viewBottom = currentHeight + viewHeight;
14725    if (lastEdge === -1) {
14726      if (viewBottom >= bottom) {
14727        lastEdge = viewBottom;
14728      }
14729    } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {
14730      break;
14731    }
14732    if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) {
14733      continue;
14734    }
14735    const hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);
14736    const hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);
14737    const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,
14738      fractionWidth = (viewWidth - hiddenWidth) / viewWidth;
14739    const percent = fractionHeight * fractionWidth * 100 | 0;
14740    visible.push({
14741      id: view.id,
14742      x: currentWidth,
14743      y: currentHeight,
14744      view,
14745      percent,
14746      widthPercent: fractionWidth * 100 | 0
14747    });
14748    ids.add(view.id);
14749  }
14750  const first = visible[0],
14751    last = visible.at(-1);
14752  if (sortByVisibility) {
14753    visible.sort(function (a, b) {
14754      const pc = a.percent - b.percent;
14755      if (Math.abs(pc) > 0.001) {
14756        return -pc;
14757      }
14758      return a.id - b.id;
14759    });
14760  }
14761  return {
14762    first,
14763    last,
14764    views: visible,
14765    ids
14766  };
14767}
14768function normalizeWheelEventDirection(evt) {
14769  let delta = Math.hypot(evt.deltaX, evt.deltaY);
14770  const angle = Math.atan2(evt.deltaY, evt.deltaX);
14771  if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {
14772    delta = -delta;
14773  }
14774  return delta;
14775}
14776function normalizeWheelEventDelta(evt) {
14777  const deltaMode = evt.deltaMode;
14778  let delta = normalizeWheelEventDirection(evt);
14779  const MOUSE_PIXELS_PER_LINE = 30;
14780  const MOUSE_LINES_PER_PAGE = 30;
14781  if (deltaMode === WheelEvent.DOM_DELTA_PIXEL) {
14782    delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;
14783  } else if (deltaMode === WheelEvent.DOM_DELTA_LINE) {
14784    delta /= MOUSE_LINES_PER_PAGE;
14785  }
14786  return delta;
14787}
14788function isValidRotation(angle) {
14789  return Number.isInteger(angle) && angle % 90 === 0;
14790}
14791function isValidScrollMode(mode) {
14792  return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN;
14793}
14794function isValidSpreadMode(mode) {
14795  return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN;
14796}
14797function isPortraitOrientation(size) {
14798  return size.width <= size.height;
14799}
14800const animationStarted = new Promise(function (resolve) {
14801  window.requestAnimationFrame(resolve);
14802});
14803const docStyle = document.documentElement.style;
14804function clamp(v, min, max) {
14805  return Math.min(Math.max(v, min), max);
14806}
14807class ProgressBar {
14808  #classList = null;
14809  #disableAutoFetchTimeout = null;
14810  #percent = 0;
14811  #style = null;
14812  #visible = true;
14813  constructor(bar) {
14814    this.#classList = bar.classList;
14815    this.#style = bar.style;
14816  }
14817  get percent() {
14818    return this.#percent;
14819  }
14820  set percent(val) {
14821    this.#percent = clamp(val, 0, 100);
14822    if (isNaN(val)) {
14823      this.#classList.add("indeterminate");
14824      return;
14825    }
14826    this.#classList.remove("indeterminate");
14827    this.#style.setProperty("--progressBar-percent", `${this.#percent}%`);
14828  }
14829  setWidth(viewer) {
14830    if (!viewer) {
14831      return;
14832    }
14833    const container = viewer.parentNode;
14834    const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
14835    if (scrollbarWidth > 0) {
14836      this.#style.setProperty("--progressBar-end-offset", `${scrollbarWidth}px`);
14837    }
14838  }
14839  setDisableAutoFetch(delay = 5000) {
14840    if (isNaN(this.#percent)) {
14841      return;
14842    }
14843    if (this.#disableAutoFetchTimeout) {
14844      clearTimeout(this.#disableAutoFetchTimeout);
14845    }
14846    this.show();
14847    this.#disableAutoFetchTimeout = setTimeout(() => {
14848      this.#disableAutoFetchTimeout = null;
14849      this.hide();
14850    }, delay);
14851  }
14852  hide() {
14853    if (!this.#visible) {
14854      return;
14855    }
14856    this.#visible = false;
14857    this.#classList.add("hidden");
14858  }
14859  show() {
14860    if (this.#visible) {
14861      return;
14862    }
14863    this.#visible = true;
14864    this.#classList.remove("hidden");
14865  }
14866}
14867function getActiveOrFocusedElement() {
14868  let curRoot = document;
14869  let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
14870  while (curActiveOrFocused?.shadowRoot) {
14871    curRoot = curActiveOrFocused.shadowRoot;
14872    curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
14873  }
14874  return curActiveOrFocused;
14875}
14876function apiPageLayoutToViewerModes(layout) {
14877  let scrollMode = ScrollMode.VERTICAL,
14878    spreadMode = SpreadMode.NONE;
14879  switch (layout) {
14880    case "SinglePage":
14881      scrollMode = ScrollMode.PAGE;
14882      break;
14883    case "OneColumn":
14884      break;
14885    case "TwoPageLeft":
14886      scrollMode = ScrollMode.PAGE;
14887    case "TwoColumnLeft":
14888      spreadMode = SpreadMode.ODD;
14889      break;
14890    case "TwoPageRight":
14891      scrollMode = ScrollMode.PAGE;
14892    case "TwoColumnRight":
14893      spreadMode = SpreadMode.EVEN;
14894      break;
14895  }
14896  return {
14897    scrollMode,
14898    spreadMode
14899  };
14900}
14901function apiPageModeToSidebarView(mode) {
14902  switch (mode) {
14903    case "UseNone":
14904      return SidebarView.NONE;
14905    case "UseThumbs":
14906      return SidebarView.THUMBS;
14907    case "UseOutlines":
14908      return SidebarView.OUTLINE;
14909    case "UseAttachments":
14910      return SidebarView.ATTACHMENTS;
14911    case "UseOC":
14912      return SidebarView.LAYERS;
14913  }
14914  return SidebarView.NONE;
14915}
14916function toggleCheckedBtn(button, toggle, view = null) {
14917  button.classList.toggle("toggled", toggle);
14918  button.setAttribute("aria-checked", toggle);
14919  view?.classList.toggle("hidden", !toggle);
14920}
14921function toggleExpandedBtn(button, toggle, view = null) {
14922  button.classList.toggle("toggled", toggle);
14923  button.setAttribute("aria-expanded", toggle);
14924  view?.classList.toggle("hidden", !toggle);
14925}
14926
14927
14928/***/ }),
14929
14930/***/ 9226:
14931/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
14932
14933/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14934/* harmony export */   ViewHistory: () => (/* binding */ ViewHistory)
14935/* harmony export */ });
14936const DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;
14937class ViewHistory {
14938  constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) {
14939    this.fingerprint = fingerprint;
14940    this.cacheSize = cacheSize;
14941    this._initializedPromise = this._readFromStorage().then(databaseStr => {
14942      const database = JSON.parse(databaseStr || "{}");
14943      let index = -1;
14944      if (!Array.isArray(database.files)) {
14945        database.files = [];
14946      } else {
14947        while (database.files.length >= this.cacheSize) {
14948          database.files.shift();
14949        }
14950        for (let i = 0, ii = database.files.length; i < ii; i++) {
14951          const branch = database.files[i];
14952          if (branch.fingerprint === this.fingerprint) {
14953            index = i;
14954            break;
14955          }
14956        }
14957      }
14958      if (index === -1) {
14959        index = database.files.push({
14960          fingerprint: this.fingerprint
14961        }) - 1;
14962      }
14963      this.file = database.files[index];
14964      this.database = database;
14965    });
14966  }
14967  async _writeToStorage() {
14968    const databaseStr = JSON.stringify(this.database);
14969    localStorage.setItem("pdfjs.history", databaseStr);
14970  }
14971  async _readFromStorage() {
14972    return localStorage.getItem("pdfjs.history");
14973  }
14974  async set(name, val) {
14975    await this._initializedPromise;
14976    this.file[name] = val;
14977    return this._writeToStorage();
14978  }
14979  async setMultiple(properties) {
14980    await this._initializedPromise;
14981    for (const name in properties) {
14982      this.file[name] = properties[name];
14983    }
14984    return this._writeToStorage();
14985  }
14986  async get(name, defaultValue) {
14987    await this._initializedPromise;
14988    const val = this.file[name];
14989    return val !== undefined ? val : defaultValue;
14990  }
14991  async getMultiple(properties) {
14992    await this._initializedPromise;
14993    const values = Object.create(null);
14994    for (const name in properties) {
14995      const val = this.file[name];
14996      values[name] = val !== undefined ? val : properties[name];
14997    }
14998    return values;
14999  }
15000}
15001
15002
15003/***/ }),
15004
15005/***/ 2030:
15006/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
15007
15008__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
15009/* harmony export */ __webpack_require__.d(__webpack_exports__, {
15010/* harmony export */   PDFViewerApplication: () => (/* reexport safe */ _app_js__WEBPACK_IMPORTED_MODULE_3__.PDFViewerApplication),
15011/* harmony export */   PDFViewerApplicationConstants: () => (/* binding */ AppConstants),
15012/* harmony export */   PDFViewerApplicationOptions: () => (/* reexport safe */ _app_options_js__WEBPACK_IMPORTED_MODULE_1__.AppOptions)
15013/* harmony export */ });
15014/* harmony import */ var _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7256);
15015/* harmony import */ var _app_options_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9840);
15016/* harmony import */ var _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(787);
15017/* harmony import */ var _app_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1621);
15018var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_app_js__WEBPACK_IMPORTED_MODULE_3__]);
15019_app_js__WEBPACK_IMPORTED_MODULE_3__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
15020
15021
15022
15023
15024const pdfjsVersion = "4.1.392";
15025const pdfjsBuild = "fcb76a78d";
15026const AppConstants = {
15027  LinkTarget: _pdf_link_service_js__WEBPACK_IMPORTED_MODULE_2__.LinkTarget,
15028  RenderingStates: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.RenderingStates,
15029  ScrollMode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.ScrollMode,
15030  SpreadMode: _ui_utils_js__WEBPACK_IMPORTED_MODULE_0__.SpreadMode
15031};
15032window.PDFViewerApplication = _app_js__WEBPACK_IMPORTED_MODULE_3__.PDFViewerApplication;
15033window.PDFViewerApplicationConstants = AppConstants;
15034window.PDFViewerApplicationOptions = _app_options_js__WEBPACK_IMPORTED_MODULE_1__.AppOptions;
15035function getViewerConfiguration() {
15036  return {
15037    appContainer: document.body,
15038    mainContainer: document.getElementById("viewerContainer"),
15039    viewerContainer: document.getElementById("viewer"),
15040    toolbar: {
15041      container: document.getElementById("toolbarViewer"),
15042      numPages: document.getElementById("numPages"),
15043      pageNumber: document.getElementById("pageNumber"),
15044      scaleSelect: document.getElementById("scaleSelect"),
15045      customScaleOption: document.getElementById("customScaleOption"),
15046      previous: document.getElementById("previous"),
15047      next: document.getElementById("next"),
15048      zoomIn: document.getElementById("zoomIn"),
15049      zoomOut: document.getElementById("zoomOut"),
15050      viewFind: document.getElementById("viewFind"),
15051      print: document.getElementById("print"),
15052      editorFreeTextButton: document.getElementById("editorFreeText"),
15053      editorFreeTextParamsToolbar: document.getElementById("editorFreeTextParamsToolbar"),
15054      editorHighlightButton: document.getElementById("editorHighlight"),
15055      editorHighlightParamsToolbar: document.getElementById("editorHighlightParamsToolbar"),
15056      editorHighlightColorPicker: document.getElementById("editorHighlightColorPicker"),
15057      editorInkButton: document.getElementById("editorInk"),
15058      editorInkParamsToolbar: document.getElementById("editorInkParamsToolbar"),
15059      editorStampButton: document.getElementById("editorStamp"),
15060      editorStampParamsToolbar: document.getElementById("editorStampParamsToolbar"),
15061      download: document.getElementById("download")
15062    },
15063    secondaryToolbar: {
15064      toolbar: document.getElementById("secondaryToolbar"),
15065      toggleButton: document.getElementById("secondaryToolbarToggle"),
15066      presentationModeButton: document.getElementById("presentationMode"),
15067      openFileButton: document.getElementById("secondaryOpenFile"),
15068      printButton: document.getElementById("secondaryPrint"),
15069      downloadButton: document.getElementById("secondaryDownload"),
15070      viewBookmarkButton: document.getElementById("viewBookmark"),
15071      firstPageButton: document.getElementById("firstPage"),
15072      lastPageButton: document.getElementById("lastPage"),
15073      pageRotateCwButton: document.getElementById("pageRotateCw"),
15074      pageRotateCcwButton: document.getElementById("pageRotateCcw"),
15075      cursorSelectToolButton: document.getElementById("cursorSelectTool"),
15076      cursorHandToolButton: document.getElementById("cursorHandTool"),
15077      scrollPageButton: document.getElementById("scrollPage"),
15078      scrollVerticalButton: document.getElementById("scrollVertical"),
15079      scrollHorizontalButton: document.getElementById("scrollHorizontal"),
15080      scrollWrappedButton: document.getElementById("scrollWrapped"),
15081      spreadNoneButton: document.getElementById("spreadNone"),
15082      spreadOddButton: document.getElementById("spreadOdd"),
15083      spreadEvenButton: document.getElementById("spreadEven"),
15084      documentPropertiesButton: document.getElementById("documentProperties")
15085    },
15086    sidebar: {
15087      outerContainer: document.getElementById("outerContainer"),
15088      sidebarContainer: document.getElementById("sidebarContainer"),
15089      toggleButton: document.getElementById("sidebarToggle"),
15090      resizer: document.getElementById("sidebarResizer"),
15091      thumbnailButton: document.getElementById("viewThumbnail"),
15092      outlineButton: document.getElementById("viewOutline"),
15093      attachmentsButton: document.getElementById("viewAttachments"),
15094      layersButton: document.getElementById("viewLayers"),
15095      thumbnailView: document.getElementById("thumbnailView"),
15096      outlineView: document.getElementById("outlineView"),
15097      attachmentsView: document.getElementById("attachmentsView"),
15098      layersView: document.getElementById("layersView"),
15099      currentOutlineItemButton: document.getElementById("currentOutlineItem")
15100    },
15101    findBar: {
15102      bar: document.getElementById("findbar"),
15103      toggleButton: document.getElementById("viewFind"),
15104      findField: document.getElementById("findInput"),
15105      highlightAllCheckbox: document.getElementById("findHighlightAll"),
15106      caseSensitiveCheckbox: document.getElementById("findMatchCase"),
15107      matchDiacriticsCheckbox: document.getElementById("findMatchDiacritics"),
15108      entireWordCheckbox: document.getElementById("findEntireWord"),
15109      findMsg: document.getElementById("findMsg"),
15110      findResultsCount: document.getElementById("findResultsCount"),
15111      findPreviousButton: document.getElementById("findPrevious"),
15112      findNextButton: document.getElementById("findNext")
15113    },
15114    passwordOverlay: {
15115      dialog: document.getElementById("passwordDialog"),
15116      label: document.getElementById("passwordText"),
15117      input: document.getElementById("password"),
15118      submitButton: document.getElementById("passwordSubmit"),
15119      cancelButton: document.getElementById("passwordCancel")
15120    },
15121    documentProperties: {
15122      dialog: document.getElementById("documentPropertiesDialog"),
15123      closeButton: document.getElementById("documentPropertiesClose"),
15124      fields: {
15125        fileName: document.getElementById("fileNameField"),
15126        fileSize: document.getElementById("fileSizeField"),
15127        title: document.getElementById("titleField"),
15128        author: document.getElementById("authorField"),
15129        subject: document.getElementById("subjectField"),
15130        keywords: document.getElementById("keywordsField"),
15131        creationDate: document.getElementById("creationDateField"),
15132        modificationDate: document.getElementById("modificationDateField"),
15133        creator: document.getElementById("creatorField"),
15134        producer: document.getElementById("producerField"),
15135        version: document.getElementById("versionField"),
15136        pageCount: document.getElementById("pageCountField"),
15137        pageSize: document.getElementById("pageSizeField"),
15138        linearized: document.getElementById("linearizedField")
15139      }
15140    },
15141    altTextDialog: {
15142      dialog: document.getElementById("altTextDialog"),
15143      optionDescription: document.getElementById("descriptionButton"),
15144      optionDecorative: document.getElementById("decorativeButton"),
15145      textarea: document.getElementById("descriptionTextarea"),
15146      cancelButton: document.getElementById("altTextCancel"),
15147      saveButton: document.getElementById("altTextSave")
15148    },
15149    annotationEditorParams: {
15150      editorFreeTextFontSize: document.getElementById("editorFreeTextFontSize"),
15151      editorFreeTextColor: document.getElementById("editorFreeTextColor"),
15152      editorInkColor: document.getElementById("editorInkColor"),
15153      editorInkThickness: document.getElementById("editorInkThickness"),
15154      editorInkOpacity: document.getElementById("editorInkOpacity"),
15155      editorStampAddImage: document.getElementById("editorStampAddImage"),
15156      editorFreeHighlightThickness: document.getElementById("editorFreeHighlightThickness"),
15157      editorHighlightShowAll: document.getElementById("editorHighlightShowAll")
15158    },
15159    printContainer: document.getElementById("printContainer")
15160  };
15161}
15162function webViewerLoad() {
15163  const config = getViewerConfiguration();
15164  const event = new CustomEvent("webviewerloaded", {
15165    bubbles: true,
15166    cancelable: true,
15167    detail: {
15168      source: window
15169    }
15170  });
15171  try {
15172    parent.document.dispatchEvent(event);
15173  } catch (ex) {
15174    console.error(`webviewerloaded: ${ex}`);
15175    document.dispatchEvent(event);
15176  }
15177  _app_js__WEBPACK_IMPORTED_MODULE_3__.PDFViewerApplication.run(config);
15178}
15179document.blockUnblockOnload?.(true);
15180if (document.readyState === "interactive" || document.readyState === "complete") {
15181  webViewerLoad();
15182} else {
15183  document.addEventListener("DOMContentLoaded", webViewerLoad, true);
15184}
15185
15186__webpack_async_result__();
15187} catch(e) { __webpack_async_result__(e); } });
15188
15189/***/ }),
15190
15191/***/ 2973:
15192/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
15193
15194__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
15195/* harmony export */ __webpack_require__.d(__webpack_exports__, {
15196/* harmony export */   XfaLayerBuilder: () => (/* binding */ XfaLayerBuilder)
15197/* harmony export */ });
15198/* harmony import */ var pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2603);
15199var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__]);
15200pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
15201
15202class XfaLayerBuilder {
15203  constructor({
15204    pdfPage,
15205    annotationStorage = null,
15206    linkService,
15207    xfaHtml = null
15208  }) {
15209    this.pdfPage = pdfPage;
15210    this.annotationStorage = annotationStorage;
15211    this.linkService = linkService;
15212    this.xfaHtml = xfaHtml;
15213    this.div = null;
15214    this._cancelled = false;
15215  }
15216  async render(viewport, intent = "display") {
15217    if (intent === "print") {
15218      const parameters = {
15219        viewport: viewport.clone({
15220          dontFlip: true
15221        }),
15222        div: this.div,
15223        xfaHtml: this.xfaHtml,
15224        annotationStorage: this.annotationStorage,
15225        linkService: this.linkService,
15226        intent
15227      };
15228      this.div = document.createElement("div");
15229      parameters.div = this.div;
15230      return pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.XfaLayer.render(parameters);
15231    }
15232    const xfaHtml = await this.pdfPage.getXfa();
15233    if (this._cancelled || !xfaHtml) {
15234      return {
15235        textDivs: []
15236      };
15237    }
15238    const parameters = {
15239      viewport: viewport.clone({
15240        dontFlip: true
15241      }),
15242      div: this.div,
15243      xfaHtml,
15244      annotationStorage: this.annotationStorage,
15245      linkService: this.linkService,
15246      intent
15247    };
15248    if (this.div) {
15249      return pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.XfaLayer.update(parameters);
15250    }
15251    this.div = document.createElement("div");
15252    parameters.div = this.div;
15253    return pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.XfaLayer.render(parameters);
15254  }
15255  cancel() {
15256    this._cancelled = true;
15257  }
15258  hide() {
15259    if (!this.div) {
15260      return;
15261    }
15262    this.div.hidden = true;
15263  }
15264}
15265
15266__webpack_async_result__();
15267} catch(e) { __webpack_async_result__(e); } });
15268
15269/***/ })
15270
15271/******/ });
15272/************************************************************************/
15273/******/ // The module cache
15274/******/ var __webpack_module_cache__ = {};
15275/******/ 
15276/******/ // The require function
15277/******/ function __webpack_require__(moduleId) {
15278/******/ 	// Check if module is in cache
15279/******/ 	var cachedModule = __webpack_module_cache__[moduleId];
15280/******/ 	if (cachedModule !== undefined) {
15281/******/ 		return cachedModule.exports;
15282/******/ 	}
15283/******/ 	// Create a new module (and put it into the cache)
15284/******/ 	var module = __webpack_module_cache__[moduleId] = {
15285/******/ 		// no module.id needed
15286/******/ 		// no module.loaded needed
15287/******/ 		exports: {}
15288/******/ 	};
15289/******/ 
15290/******/ 	// Execute the module function
15291/******/ 	__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
15292/******/ 
15293/******/ 	// Return the exports of the module
15294/******/ 	return module.exports;
15295/******/ }
15296/******/ 
15297/************************************************************************/
15298/******/ /* webpack/runtime/async module */
15299/******/ (() => {
15300/******/ 	var webpackQueues = typeof Symbol === "function" ? Symbol("webpack queues") : "__webpack_queues__";
15301/******/ 	var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__";
15302/******/ 	var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";
15303/******/ 	var resolveQueue = (queue) => {
15304/******/ 		if(queue && queue.d < 1) {
15305/******/ 			queue.d = 1;
15306/******/ 			queue.forEach((fn) => (fn.r--));
15307/******/ 			queue.forEach((fn) => (fn.r-- ? fn.r++ : fn()));
15308/******/ 		}
15309/******/ 	}
15310/******/ 	var wrapDeps = (deps) => (deps.map((dep) => {
15311/******/ 		if(dep !== null && typeof dep === "object") {
15312/******/ 			if(dep[webpackQueues]) return dep;
15313/******/ 			if(dep.then) {
15314/******/ 				var queue = [];
15315/******/ 				queue.d = 0;
15316/******/ 				dep.then((r) => {
15317/******/ 					obj[webpackExports] = r;
15318/******/ 					resolveQueue(queue);
15319/******/ 				}, (e) => {
15320/******/ 					obj[webpackError] = e;
15321/******/ 					resolveQueue(queue);
15322/******/ 				});
15323/******/ 				var obj = {};
15324/******/ 				obj[webpackQueues] = (fn) => (fn(queue));
15325/******/ 				return obj;
15326/******/ 			}
15327/******/ 		}
15328/******/ 		var ret = {};
15329/******/ 		ret[webpackQueues] = x => {};
15330/******/ 		ret[webpackExports] = dep;
15331/******/ 		return ret;
15332/******/ 	}));
15333/******/ 	__webpack_require__.a = (module, body, hasAwait) => {
15334/******/ 		var queue;
15335/******/ 		hasAwait && ((queue = []).d = -1);
15336/******/ 		var depQueues = new Set();
15337/******/ 		var exports = module.exports;
15338/******/ 		var currentDeps;
15339/******/ 		var outerResolve;
15340/******/ 		var reject;
15341/******/ 		var promise = new Promise((resolve, rej) => {
15342/******/ 			reject = rej;
15343/******/ 			outerResolve = resolve;
15344/******/ 		});
15345/******/ 		promise[webpackExports] = exports;
15346/******/ 		promise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise["catch"](x => {}));
15347/******/ 		module.exports = promise;
15348/******/ 		body((deps) => {
15349/******/ 			currentDeps = wrapDeps(deps);
15350/******/ 			var fn;
15351/******/ 			var getResult = () => (currentDeps.map((d) => {
15352/******/ 				if(d[webpackError]) throw d[webpackError];
15353/******/ 				return d[webpackExports];
15354/******/ 			}))
15355/******/ 			var promise = new Promise((resolve) => {
15356/******/ 				fn = () => (resolve(getResult));
15357/******/ 				fn.r = 0;
15358/******/ 				var fnQueue = (q) => (q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn))));
15359/******/ 				currentDeps.map((dep) => (dep[webpackQueues](fnQueue)));
15360/******/ 			});
15361/******/ 			return fn.r ? promise : getResult();
15362/******/ 		}, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)));
15363/******/ 		queue && queue.d < 0 && (queue.d = 0);
15364/******/ 	};
15365/******/ })();
15366/******/ 
15367/******/ /* webpack/runtime/define property getters */
15368/******/ (() => {
15369/******/ 	// define getter functions for harmony exports
15370/******/ 	__webpack_require__.d = (exports, definition) => {
15371/******/ 		for(var key in definition) {
15372/******/ 			if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
15373/******/ 				Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
15374/******/ 			}
15375/******/ 		}
15376/******/ 	};
15377/******/ })();
15378/******/ 
15379/******/ /* webpack/runtime/hasOwnProperty shorthand */
15380/******/ (() => {
15381/******/ 	__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
15382/******/ })();
15383/******/ 
15384/************************************************************************/
15385/******/ 
15386/******/ // startup
15387/******/ // Load entry module and return exports
15388/******/ // This entry module used 'module' so it can't be inlined
15389/******/ var __webpack_exports__ = __webpack_require__(2030);
15390/******/ __webpack_exports__ = await __webpack_exports__;
15391/******/ var __webpack_exports__PDFViewerApplication = __webpack_exports__.PDFViewerApplication;
15392/******/ var __webpack_exports__PDFViewerApplicationConstants = __webpack_exports__.PDFViewerApplicationConstants;
15393/******/ var __webpack_exports__PDFViewerApplicationOptions = __webpack_exports__.PDFViewerApplicationOptions;
15394/******/ export { __webpack_exports__PDFViewerApplication as PDFViewerApplication, __webpack_exports__PDFViewerApplicationConstants as PDFViewerApplicationConstants, __webpack_exports__PDFViewerApplicationOptions as PDFViewerApplicationOptions };
15395/******/ 
15396
15397//# sourceMappingURL=viewer.mjs.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.