diff --git a/README.md b/README.md index a3e05cd3..91b3eb16 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d ## Quick start -1. Install dependencies by running `pip3 install --target vendor -r requirements.txt`. +1. Install dependencies by running `pip3 install --target vendor -r requirements.txt` (python3.x) or `pip install --target vendor -r requirements.txt` (python2.7). 2. Execute the command: `python cps.py` (or `nohup python cps.py` - recommended if you want to exit the terminal window) 3. Point your browser to `http://localhost:8083` or `http://localhost:8083/opds` for the OPDS catalog 4. Set `Location of Calibre database` to the path of the folder where your Calibre library (metadata.db) lives, push "submit" button\ diff --git a/cps.py b/cps.py index 7da3f790..3601e4b6 100755 --- a/cps.py +++ b/cps.py @@ -43,9 +43,9 @@ from cps.gdrive import gdrive from cps.editbooks import editbook try: - from cps.kobo import kobo + from cps.kobo import kobo, get_kobo_activated from cps.kobo_auth import kobo_auth - kobo_available = True + kobo_available = get_kobo_activated() except ImportError: kobo_available = False diff --git a/cps/__init__.py b/cps/__init__.py index abcc4cbb..6c241d4f 100755 --- a/cps/__init__.py +++ b/cps/__init__.py @@ -116,14 +116,13 @@ def get_locale(): if user.nickname != 'Guest': # if the account is the guest account bypass the config lang settings return user.locale - preferred = set() + preferred = list() if request.accept_languages: for x in request.accept_languages.values(): try: - preferred.add(str(LC.parse(x.replace('-', '_')))) + preferred.append(str(LC.parse(x.replace('-', '_')))) except (UnknownLocaleError, ValueError) as e: - log.warning('Could not parse locale "%s": %s', x, e) - # preferred.append('en') + log.debug('Could not parse locale "%s": %s', x, e) return negotiate_locale(preferred or ['en'], _BABEL_TRANSLATIONS) diff --git a/cps/admin.py b/cps/admin.py index 7467ec45..54742345 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web) @@ -172,10 +171,7 @@ def update_view_configuration(): _config_int("config_random_books") _config_int("config_books_per_page") _config_int("config_authors_max") - - _config_string("config_restricted_tags") _config_int("config_restricted_column") - _config_string("config_restricted_column_value") if config.config_google_drive_watch_changes_response: config.config_google_drive_watch_changes_response = json.dumps(config.config_google_drive_watch_changes_response) @@ -290,14 +286,14 @@ def edit_restriction(type): ub.session.commit() if element['id'].startswith('d'): if type == 0: # Tags as template - elementlist = config.list_restricted_tags() + elementlist = config.list_denied_tags() elementlist[int(element['id'][1:])]=element['Element'] - config.config_restricted_tags = ','.join(elementlist) + config.config_denied_tags = ','.join(elementlist) config.save() if type == 1: # CustomC - elementlist = config.list_restricted_column_values() + elementlist = config.list_denied_column_values() elementlist[int(element['id'][1:])]=element['Element'] - config.config_restricted_column_value = ','.join(elementlist) + config.config_denied_column_value = ','.join(elementlist) config.save() pass if type == 2: # Tags per user @@ -306,9 +302,9 @@ def edit_restriction(type): usr = ub.session.query(ub.User).filter(ub.User.id == int(usr_id)).first() else: usr = current_user - elementlist = usr.list_restricted_tags() + elementlist = usr.list_denied_tags() elementlist[int(element['id'][1:])]=element['Element'] - usr.restricted_tags = ','.join(elementlist) + usr.denied_tags = ','.join(elementlist) ub.session.commit() if type == 3: # CColumn per user usr_id = os.path.split(request.referrer)[-1] @@ -316,9 +312,9 @@ def edit_restriction(type): usr = ub.session.query(ub.User).filter(ub.User.id == int(usr_id)).first() else: usr = current_user - elementlist = usr.list_restricted_column_values() + elementlist = usr.list_denied_column_values() elementlist[int(element['id'][1:])]=element['Element'] - usr.restricted_column_value = ','.join(elementlist) + usr.denied_column_value = ','.join(elementlist) ub.session.commit() return "" @@ -342,21 +338,20 @@ def restriction_deletion(element, list_func): @login_required @admin_required def add_restriction(type): - log.info("Hit: " + str(type)) element = request.form.to_dict() if type == 0: # Tags as template if 'submit_allow' in element: config.config_allowed_tags = restriction_addition(element, config.list_allowed_tags) config.save() elif 'submit_deny' in element: - config.config_restricted_tags = restriction_addition(element, config.list_restricted_tags) + config.config_denied_tags = restriction_addition(element, config.list_denied_tags) config.save() if type == 1: # CCustom as template if 'submit_allow' in element: - config.config_allowed_column_value = restriction_addition(element, config.list_restricted_column_values) + config.config_allowed_column_value = restriction_addition(element, config.list_denied_column_values) config.save() elif 'submit_deny' in element: - config.config_restricted_column_value = restriction_addition(element, config.list_allowed_column_values) + config.config_denied_column_value = restriction_addition(element, config.list_allowed_column_values) config.save() if type == 2: # Tags per user usr_id = os.path.split(request.referrer)[-1] @@ -368,7 +363,7 @@ def add_restriction(type): usr.allowed_tags = restriction_addition(element, usr.list_allowed_tags) ub.session.commit() elif 'submit_deny' in element: - usr.restricted_tags = restriction_addition(element, usr.list_restricted_tags) + usr.denied_tags = restriction_addition(element, usr.list_denied_tags) ub.session.commit() if type == 3: # CustomC per user usr_id = os.path.split(request.referrer)[-1] @@ -380,7 +375,7 @@ def add_restriction(type): usr.allowed_column_value = restriction_addition(element, usr.list_allowed_column_values) ub.session.commit() elif 'submit_deny' in element: - usr.restricted_column_value = restriction_addition(element, usr.list_restricted_column_values) + usr.denied_column_value = restriction_addition(element, usr.list_denied_column_values) ub.session.commit() return "" @@ -394,14 +389,14 @@ def delete_restriction(type): config.config_allowed_tags = restriction_deletion(element, config.list_allowed_tags) config.save() elif element['id'].startswith('d'): - config.config_restricted_tags = restriction_deletion(element, config.list_restricted_tags) + config.config_denied_tags = restriction_deletion(element, config.list_denied_tags) config.save() elif type == 1: # CustomC as template if element['id'].startswith('a'): config.config_allowed_column_value = restriction_deletion(element, config.list_allowed_column_values) config.save() elif element['id'].startswith('d'): - config.config_restricted_column_value = restriction_deletion(element, config.list_restricted_column_values) + config.config_denied_column_value = restriction_deletion(element, config.list_denied_column_values) config.save() elif type == 2: # Tags per user usr_id = os.path.split(request.referrer)[-1] @@ -413,7 +408,7 @@ def delete_restriction(type): usr.allowed_tags = restriction_deletion(element, usr.list_allowed_tags) ub.session.commit() elif element['id'].startswith('d'): - usr.restricted_tags = restriction_deletion(element, usr.list_restricted_tags) + usr.denied_tags = restriction_deletion(element, usr.list_denied_tags) ub.session.commit() elif type == 3: # Columns per user usr_id = os.path.split(request.referrer)[-1] @@ -425,7 +420,7 @@ def delete_restriction(type): usr.allowed_column_value = restriction_deletion(element, usr.list_allowed_column_values) ub.session.commit() elif element['id'].startswith('d'): - usr.restricted_column_value = restriction_deletion(element, usr.list_restricted_column_values) + usr.denied_column_value = restriction_deletion(element, usr.list_denied_column_values) ub.session.commit() return "" @@ -437,13 +432,13 @@ def delete_restriction(type): def list_restriction(type): if type == 0: # Tags as template restrict = [{'Element': x, 'type':_('deny'), 'id': 'd'+str(i) } - for i,x in enumerate(config.list_restricted_tags()) if x != '' ] + for i,x in enumerate(config.list_denied_tags()) if x != '' ] allow = [{'Element': x, 'type':_('allow'), 'id': 'a'+str(i) } for i,x in enumerate(config.list_allowed_tags()) if x != ''] json_dumps = restrict + allow elif type == 1: # CustomC as template restrict = [{'Element': x, 'type':_('deny'), 'id': 'd'+str(i) } - for i,x in enumerate(config.list_restricted_column_values()) if x != '' ] + for i,x in enumerate(config.list_denied_column_values()) if x != '' ] allow = [{'Element': x, 'type':_('allow'), 'id': 'a'+str(i) } for i,x in enumerate(config.list_allowed_column_values()) if x != ''] json_dumps = restrict + allow @@ -454,7 +449,7 @@ def list_restriction(type): else: usr = current_user restrict = [{'Element': x, 'type':_('deny'), 'id': 'd'+str(i) } - for i,x in enumerate(usr.list_restricted_tags()) if x != '' ] + for i,x in enumerate(usr.list_denied_tags()) if x != '' ] allow = [{'Element': x, 'type':_('allow'), 'id': 'a'+str(i) } for i,x in enumerate(usr.list_allowed_tags()) if x != ''] json_dumps = restrict + allow @@ -465,7 +460,7 @@ def list_restriction(type): else: usr = current_user restrict = [{'Element': x, 'type':_('deny'), 'id': 'd'+str(i) } - for i,x in enumerate(usr.list_restricted_column_values()) if x != '' ] + for i,x in enumerate(usr.list_denied_column_values()) if x != '' ] allow = [{'Element': x, 'type':_('allow'), 'id': 'a'+str(i) } for i,x in enumerate(usr.list_allowed_column_values()) if x != ''] json_dumps = restrict + allow @@ -532,7 +527,7 @@ def _configuration_update_helper(): _config_checkbox_int("config_uploading") _config_checkbox_int("config_anonbrowse") _config_checkbox_int("config_public_reg") - _config_checkbox_int("config_kobo_sync") + reboot_required |= _config_checkbox_int("config_kobo_sync") _config_checkbox_int("config_kobo_proxy") @@ -679,6 +674,7 @@ def new_user(): content = ub.User() languages = speaking_language() translations = [LC('en')] + babel.list_translations() + kobo_support = feature_support['kobo'] and config.config_kobo_sync if request.method == "POST": to_save = request.form.to_dict() content.default_language = to_save["default_language"] @@ -694,7 +690,7 @@ def new_user(): if not to_save["nickname"] or not to_save["email"] or not to_save["password"]: flash(_(u"Please fill out all fields!"), category="error") return render_title_template("user_edit.html", new_user=1, content=content, translations=translations, - registered_oauth=oauth_check, feature_support=feature_support, + registered_oauth=oauth_check, kobo_support=kobo_support, title=_(u"Add new user")) content.password = generate_password_hash(to_save["password"]) existing_user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) == to_save["nickname"].lower())\ @@ -706,7 +702,7 @@ def new_user(): if config.config_public_reg and not check_valid_domain(to_save["email"]): flash(_(u"E-mail is not from valid domain"), category="error") return render_title_template("user_edit.html", new_user=1, content=content, translations=translations, - registered_oauth=oauth_check, feature_support=feature_support, + registered_oauth=oauth_check, kobo_support=kobo_support, title=_(u"Add new user")) else: content.email = to_save["email"] @@ -714,8 +710,12 @@ def new_user(): flash(_(u"Found an existing account for this e-mail address or nickname."), category="error") return render_title_template("user_edit.html", new_user=1, content=content, translations=translations, languages=languages, title=_(u"Add new user"), page="newuser", - feature_support=feature_support, registered_oauth=oauth_check) + kobo_support=kobo_support, registered_oauth=oauth_check) try: + content.allowed_tags = config.config_allowed_tags + content.denied_tags = config.config_denied_tags + content.allowed_column_value = config.config_allowed_column_value + content.denied_column_value = config.config_denied_column_value ub.session.add(content) ub.session.commit() flash(_(u"User '%(user)s' created", user=content.nickname), category="success") @@ -726,13 +726,9 @@ def new_user(): else: content.role = config.config_default_role content.sidebar_view = config.config_default_show - content.restricted_tags = config.config_restricted_tags - content.restricted_column = config.config_restricted_column - content.restricted_column_value = config.config_restricted_column_value - # content.mature_content = bool(config.config_default_show & constants.MATURE_CONTENT) return render_title_template("user_edit.html", new_user=1, content=content, translations=translations, languages=languages, title=_(u"Add new user"), page="newuser", - feature_support=feature_support, registered_oauth=oauth_check) + kobo_support=kobo_support, registered_oauth=oauth_check) @admi.route("/admin/mailsettings") @@ -787,6 +783,7 @@ def edit_user(user_id): downloads = list() languages = speaking_language() translations = babel.list_translations() + [LC('en')] + kobo_support = feature_support['kobo'] and config.config_kobo_sync for book in content.downloads: downloadbook = db.session.query(db.Books).filter(db.Books.id == book.book_id).first() if downloadbook: @@ -832,14 +829,6 @@ def edit_user(user_id): else: content.sidebar_view &= ~constants.DETAIL_RANDOM - # content.mature_content = "Show_mature_content" in to_save - if "restricted_tags" in to_save: - content.restricted_tags = to_save["restricted_tags"] - if "config_restricted_column" in to_save: - content.restricted_tags = to_save["config_restricted_column"] - if "config_restricted_column_value" in to_save: - content.restricted_tags = to_save["config_restricted_column_value"] - if "default_language" in to_save: content.default_language = to_save["default_language"] if "locale" in to_save and to_save["locale"]: @@ -855,7 +844,7 @@ def edit_user(user_id): translations=translations, languages=languages, mail_configured = config.get_mail_server_configured(), - feature_support=feature_support, + kobo_support=kobo_support, new_user=0, content=content, downloads=downloads, @@ -874,7 +863,7 @@ def edit_user(user_id): new_user=0, content=content, downloads=downloads, registered_oauth=oauth_check, - feature_support=feature_support, + kobo_support=kobo_support, title=_(u"Edit User %(nick)s", nick=content.nickname), page="edituser") @@ -894,7 +883,7 @@ def edit_user(user_id): downloads=downloads, registered_oauth=oauth_check, mail_configured=config.get_mail_server_configured(), - feature_support=feature_support, + kobo_support=kobo_support, title=_(u"Edit User %(nick)s", nick=content.nickname), page="edituser") @@ -925,10 +914,12 @@ def view_logfile(): logfiles = {} logfiles[0] = logger.get_logfile(config.config_logfile) logfiles[1] = logger.get_accesslogfile(config.config_access_logfile) - return render_title_template("logviewer.html",title=_(u"Logfile viewer"), - log_enable=bool(config.config_logfile != logger.LOG_TO_STDOUT), + return render_title_template("logviewer.html", + title=_(u"Logfile viewer"), accesslog_enable=config.config_access_log, - logfiles=logfiles, page="logfile") + log_enable=bool(config.config_logfile != logger.LOG_TO_STDOUT), + logfiles=logfiles, + page="logfile") @admi.route("/ajax/log/") diff --git a/cps/config_sql.py b/cps/config_sql.py index bbdda872..46df2d8f 100644 --- a/cps/config_sql.py +++ b/cps/config_sql.py @@ -74,10 +74,10 @@ class _Settings(_Base): config_default_show = Column(SmallInteger, default=38911) config_columns_to_ignore = Column(String) - config_restricted_tags = Column(String, default="") + config_denied_tags = Column(String, default="") config_allowed_tags = Column(String, default="") config_restricted_column = Column(SmallInteger, default=0) - config_restricted_column_value = Column(String, default="") + config_denied_column_value = Column(String, default="") config_allowed_column_value = Column(String, default="") config_use_google_drive = Column(Boolean, default=False) @@ -186,16 +186,16 @@ class _ConfigSQL(object): def show_detail_random(self): return self.show_element_new_user(constants.DETAIL_RANDOM) - def list_restricted_tags(self): - mct = self.config_restricted_tags.split(",") + def list_denied_tags(self): + mct = self.config_denied_tags.split(",") return [t.strip() for t in mct] def list_allowed_tags(self): mct = self.config_allowed_tags.split(",") return [t.strip() for t in mct] - def list_restricted_column_values(self): - mct = self.config_restricted_column_value.split(",") + def list_denied_column_values(self): + mct = self.config_denied_column_value.split(",") return [t.strip() for t in mct] def list_allowed_column_values(self): @@ -341,8 +341,8 @@ def load_configuration(session): session.commit() conf = _ConfigSQL(session) # Migrate from global restrictions to user based restrictions - if bool(conf.config_default_show & constants.MATURE_CONTENT) and conf.config_restricted_tags == "": - conf.config_restricted_tags = conf.config_mature_content_tags + if bool(conf.config_default_show & constants.MATURE_CONTENT) and conf.config_denied_tags == "": + conf.config_denied_tags = conf.config_mature_content_tags conf.save() session.query(ub.User).filter(ub.User.mature_content != True). \ update({"restricted_tags": conf.config_mature_content_tags}, synchronize_session=False) diff --git a/cps/helper.py b/cps/helper.py index a1265f73..772c886a 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -455,7 +455,7 @@ def get_cover_on_failure(use_generic_cover): return None def get_book_cover(book_id): - book = db.session.query(db.Books).filter(db.Books.id == book_id).first() + book = db.session.query(db.Books).filter(db.Books.id == book_id).filter(common_filters()).first() return get_book_cover_internal(book, use_generic_cover_on_failure=True) def get_book_cover_with_uuid(book_uuid, @@ -700,20 +700,17 @@ def common_filters(allow_show_archived=False): lang_filter = db.Books.languages.any(db.Languages.lang_code == current_user.filter_language()) else: lang_filter = true() - negtags_list = current_user.list_restricted_tags() + negtags_list = current_user.list_denied_tags() postags_list = current_user.list_allowed_tags() neg_content_tags_filter = false() if negtags_list == [''] else db.Books.tags.any(db.Tags.name.in_(negtags_list)) pos_content_tags_filter = true() if postags_list == [''] else db.Books.tags.any(db.Tags.name.in_(postags_list)) - # db.session.query(db.Books).filter(db.Books.custom_column_5.any(db.cc_classes[5].value == 'nikto')).first() - # db.session.query(db.Books).filter( - # getattr(db.Books, 'custom_column_' + str(5)).any(db.cc_classes[5].value == 'nikto').first()) if config.config_restricted_column: pos_cc_list = current_user.allowed_column_value.split(',') pos_content_cc_filter = true() if pos_cc_list == [''] else \ getattr(db.Books, 'custom_column_' + str(config.config_restricted_column)).\ any(db.cc_classes[config.config_restricted_column].value.in_(pos_cc_list)) - neg_cc_list = current_user.restricted_column_value.split(',') - neg_content_cc_filter = true() if neg_cc_list == [''] else \ + neg_cc_list = current_user.denied_column_value.split(',') + neg_content_cc_filter = false() if neg_cc_list == [''] else \ getattr(db.Books, 'custom_column_' + str(config.config_restricted_column)).\ any(db.cc_classes[config.config_restricted_column].value.in_(neg_cc_list)) else: @@ -724,7 +721,7 @@ def common_filters(allow_show_archived=False): def tags_filters(): - negtags_list = current_user.list_restricted_tags() + negtags_list = current_user.list_denied_tags() postags_list = current_user.list_allowed_tags() neg_content_tags_filter = false() if negtags_list == [''] else db.Tags.name.in_(negtags_list) pos_content_tags_filter = true() if postags_list == [''] else db.Tags.name.in_(postags_list) @@ -735,7 +732,8 @@ def tags_filters(): # Creates for all stored languages a translated speaking name in the array for the UI def speaking_language(languages=None): if not languages: - languages = db.session.query(db.Languages).all() + languages = db.session.query(db.Languages).join(db.books_languages_link).join(db.Books).filter(common_filters())\ + .group_by(text('books_languages_link.lang_code')).all() for lang in languages: try: cur_l = LC.parse(lang.lang_code) @@ -826,7 +824,7 @@ def get_cc_columns(): cc = [] for col in tmpcc: r = re.compile(config.config_columns_to_ignore) - if r.match(col.label): + if not r.match(col.name): cc.append(col) else: cc = tmpcc diff --git a/cps/kobo.py b/cps/kobo.py index ba1e171e..67d0e8fa 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -45,6 +45,7 @@ import requests from . import config, logger, kobo_auth, db, helper, ub from .services import SyncToken as SyncToken from .web import download_required +from .kobo_auth import requires_kobo_auth KOBO_FORMATS = {"KEPUB": ["KEPUB"], "EPUB": ["EPUB3", "EPUB"]} KOBO_STOREAPI_URL = "https://storeapi.kobo.com" @@ -72,9 +73,11 @@ CONNECTION_SPECIFIC_HEADERS = [ "transfer-encoding", ] +def get_kobo_activated(): + return config.config_kobo_sync -def redirect_or_proxy_request(): - if config.config_kobo_proxy: +def redirect_or_proxy_request(proxy=False): + if config.config_kobo_proxy or proxy == True: if request.method == "GET": return redirect(get_store_url_for_current_request(), 307) else: @@ -100,7 +103,7 @@ def redirect_or_proxy_request(): return make_response(jsonify({})) @kobo.route("/v1/library/sync") -@login_required +@requires_kobo_auth @download_required def HandleSyncRequest(): sync_token = SyncToken.SyncToken.from_headers(request.headers) @@ -214,7 +217,7 @@ def generate_sync_response(request, sync_token, entitlements): @kobo.route("/v1/library//metadata") -@login_required +@requires_kobo_auth @download_required def HandleMetadataRequest(book_uuid): if not current_app.wsgi_app.is_proxied: @@ -367,7 +370,7 @@ def reading_state(book): @kobo.route("//image.jpg") -@login_required +@requires_kobo_auth def HandleCoverImageRequest(book_uuid): log.debug("Cover request received for book %s" % book_uuid) book_cover = helper.get_book_cover_with_uuid( @@ -439,9 +442,13 @@ def handle_404(err): log.debug("Unknown Request received: %s", request.base_url) return redirect_or_proxy_request() +@kobo.route("/v1/auth/device", methods=["POST"]) +def login_auth_token(): + log.info('Auth') + return redirect_or_proxy_request(proxy=True) @kobo.route("/v1/initialization") -@login_required +@requires_kobo_auth def HandleInitRequest(): if not current_app.wsgi_app.is_proxied: log.debug('Kobo: Received unproxied request, changed request port to server port') diff --git a/cps/kobo_auth.py b/cps/kobo_auth.py index edb110ff..5178da69 100644 --- a/cps/kobo_auth.py +++ b/cps/kobo_auth.py @@ -61,13 +61,19 @@ from binascii import hexlify from datetime import datetime from os import urandom -from flask import g, Blueprint, url_for +from flask import g, Blueprint, url_for, abort from flask_login import login_user, login_required from flask_babel import gettext as _ from . import logger, ub, lm from .web import render_title_template +try: + from functools import wraps +except ImportError: + pass # We're not using Python 3 + + log = logger.create() @@ -88,21 +94,24 @@ def get_auth_token(): return None -@lm.request_loader -def load_user_from_kobo_request(request): - auth_token = get_auth_token() - if auth_token is not None: - user = ( - ub.session.query(ub.User) - .join(ub.RemoteAuthToken) - .filter(ub.RemoteAuthToken.auth_token == auth_token).filter(ub.RemoteAuthToken.token_type==1) - .first() - ) - if user is not None: - login_user(user) - return user - log.info("Received Kobo request without a recognizable auth token.") - return +def requires_kobo_auth(f): + @wraps(f) + def inner(*args, **kwargs): + auth_token = get_auth_token() + if auth_token is not None: + user = ( + ub.session.query(ub.User) + .join(ub.RemoteAuthToken) + .filter(ub.RemoteAuthToken.auth_token == auth_token).filter(ub.RemoteAuthToken.token_type==1) + .first() + ) + if user is not None: + login_user(user) + return f(*args, **kwargs) + log.debug("Received Kobo request without a recognizable auth token.") + return abort(401) + return inner + kobo_auth = Blueprint("kobo_auth", __name__, url_prefix="/kobo_auth") diff --git a/cps/oauth_bb.py b/cps/oauth_bb.py index 092473da..5fdb95d8 100644 --- a/cps/oauth_bb.py +++ b/cps/oauth_bb.py @@ -50,7 +50,7 @@ def oauth_required(f): def inner(*args, **kwargs): if config.config_login_type == constants.LOGIN_OAUTH: return f(*args, **kwargs) - if request.is_xhr: + if request.headers.get('X-Requested-With') == 'XMLHttpRequest': data = {'status': 'error', 'message': 'Not Found'} response = make_response(json.dumps(data, ensure_ascii=False)) response.headers["Content-Type"] = "application/json; charset=utf-8" diff --git a/cps/server.py b/cps/server.py index 43792ecd..17422f35 100755 --- a/cps/server.py +++ b/cps/server.py @@ -55,6 +55,7 @@ class WebServer(object): def __init__(self): signal.signal(signal.SIGINT, self._killServer) signal.signal(signal.SIGTERM, self._killServer) + signal.signal(signal.SIGQUIT, self._killServer) self.wsgiserver = None self.access_logger = None @@ -146,7 +147,7 @@ class WebServer(object): self.unix_socket_file = None def _start_tornado(self): - if os.name == 'nt': + if os.name == 'nt' and sys.version_info > (3, 7): import asyncio asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) log.info('Starting Tornado server on %s', _readable_listen_address(self.listen_address, self.listen_port)) @@ -156,7 +157,7 @@ class WebServer(object): max_buffer_size=209700000, ssl_options=self.ssl_args) http_server.listen(self.listen_port, self.listen_address) - self.wsgiserver = IOLoop.instance() + self.wsgiserver = IOLoop.current() self.wsgiserver.start() # wait for stop signal self.wsgiserver.close(True) @@ -197,4 +198,4 @@ class WebServer(object): if _GEVENT: self.wsgiserver.close() else: - self.wsgiserver.add_callback(self.wsgiserver.stop) + self.wsgiserver.add_callback_from_signal(self.wsgiserver.stop) diff --git a/cps/services/__init__.py b/cps/services/__init__.py index 18b49b88..2eb82f0d 100644 --- a/cps/services/__init__.py +++ b/cps/services/__init__.py @@ -41,3 +41,4 @@ try: except ImportError as err: log.debug("cannot import SyncToken, syncing books with Kobo Devices will not work: %s", err) kobo = None + SyncToken = None diff --git a/cps/shelf.py b/cps/shelf.py index dafdfb46..75789367 100644 --- a/cps/shelf.py +++ b/cps/shelf.py @@ -40,17 +40,18 @@ log = logger.create() @shelf.route("/shelf/add//") @login_required def add_to_shelf(shelf_id, book_id): + xhr = request.headers.get('X-Requested-With') == 'XMLHttpRequest' shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first() if shelf is None: log.error("Invalid shelf specified: %s", shelf_id) - if not request.is_xhr: + if not xhr: flash(_(u"Invalid shelf specified"), category="error") return redirect(url_for('web.index')) return "Invalid shelf specified", 400 if not shelf.is_public and not shelf.user_id == int(current_user.id): log.error("User %s not allowed to add a book to %s", current_user, shelf) - if not request.is_xhr: + if not xhr: flash(_(u"Sorry you are not allowed to add a book to the the shelf: %(shelfname)s", shelfname=shelf.name), category="error") return redirect(url_for('web.index')) @@ -58,7 +59,7 @@ def add_to_shelf(shelf_id, book_id): if shelf.is_public and not current_user.role_edit_shelfs(): log.info("User %s not allowed to edit public shelves", current_user) - if not request.is_xhr: + if not xhr: flash(_(u"You are not allowed to edit public shelves"), category="error") return redirect(url_for('web.index')) return "User is not allowed to edit public shelves", 403 @@ -67,7 +68,7 @@ def add_to_shelf(shelf_id, book_id): ub.BookShelf.book_id == book_id).first() if book_in_shelf: log.error("Book %s is already part of %s", book_id, shelf) - if not request.is_xhr: + if not xhr: flash(_(u"Book is already part of the shelf: %(shelfname)s", shelfname=shelf.name), category="error") return redirect(url_for('web.index')) return "Book is already part of the shelf: %s" % shelf.name, 400 @@ -81,7 +82,7 @@ def add_to_shelf(shelf_id, book_id): ins = ub.BookShelf(shelf=shelf.id, book_id=book_id, order=maxOrder + 1) ub.session.add(ins) ub.session.commit() - if not request.is_xhr: + if not xhr: flash(_(u"Book has been added to shelf: %(sname)s", sname=shelf.name), category="success") if "HTTP_REFERER" in request.environ: return redirect(request.environ["HTTP_REFERER"]) @@ -147,10 +148,11 @@ def search_to_shelf(shelf_id): @shelf.route("/shelf/remove//") @login_required def remove_from_shelf(shelf_id, book_id): + xhr = request.headers.get('X-Requested-With') == 'XMLHttpRequest' shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first() if shelf is None: log.error("Invalid shelf specified: %s", shelf_id) - if not request.is_xhr: + if not xhr: return redirect(url_for('web.index')) return "Invalid shelf specified", 400 @@ -169,20 +171,20 @@ def remove_from_shelf(shelf_id, book_id): if book_shelf is None: log.error("Book %s already removed from %s", book_id, shelf) - if not request.is_xhr: + if not xhr: return redirect(url_for('web.index')) return "Book already removed from shelf", 410 ub.session.delete(book_shelf) ub.session.commit() - if not request.is_xhr: + if not xhr: flash(_(u"Book has been removed from shelf: %(sname)s", sname=shelf.name), category="success") return redirect(request.environ["HTTP_REFERER"]) return "", 204 else: log.error("User %s not allowed to remove a book from %s", current_user, shelf) - if not request.is_xhr: + if not xhr: flash(_(u"Sorry you are not allowed to remove a book from this shelf: %(sname)s", sname=shelf.name), category="error") return redirect(url_for('web.index')) @@ -284,8 +286,16 @@ def show_shelf(shelf_type, shelf_id): books_in_shelf = ub.session.query(ub.BookShelf).filter(ub.BookShelf.shelf == shelf_id)\ .order_by(ub.BookShelf.order.asc()).all() - books_list = [ b.book_id for b in books_in_shelf] - result = db.session.query(db.Books).filter(db.Books.id.in_(books_list)).filter(common_filters()).all() + for book in books_in_shelf: + cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).filter(common_filters()).first() + if cur_book: + result.append(cur_book) + else: + cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first() + if not cur_book: + log.info('Not existing book %s in %s deleted', book.book_id, shelf) + ub.session.query(ub.BookShelf).filter(ub.BookShelf.book_id == book.book_id).delete() + ub.session.commit() return render_title_template(page, entries=result, title=_(u"Shelf: '%(name)s'", name=shelf.name), shelf=shelf, page="shelf") else: @@ -315,11 +325,22 @@ def order_shelf(shelf_id): ub.Shelf.id == shelf_id))).first() result = list() if shelf: - books_in_shelf = ub.session.query(ub.BookShelf).filter(ub.BookShelf.shelf == shelf_id) \ + books_in_shelf2 = ub.session.query(ub.BookShelf).filter(ub.BookShelf.shelf == shelf_id) \ .order_by(ub.BookShelf.order.asc()).all() - books_list = [ b.book_id for b in books_in_shelf] - # cover, title, series, name, all author names, - result = db.session.query(db.Books).filter(db.Books.id.in_(books_list)).filter(common_filters()).all() + for book in books_in_shelf2: + cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).filter(common_filters()).first() + if cur_book: + result.append({'title':cur_book.title, + 'id':cur_book.id, + 'author':cur_book.authors, + 'series':cur_book.series, + 'series_index':cur_book.series_index}) + else: + cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first() + result.append({'title':_('Hidden Book'), + 'id':cur_book.id, + 'author':[], + 'series':[]}) return render_title_template('shelf_order.html', entries=result, title=_(u"Change order of Shelf: '%(name)s'", name=shelf.name), shelf=shelf, page="shelforder") diff --git a/cps/static/css/libs/viewer.css b/cps/static/css/libs/viewer.css index 82766d66..5835b309 100644 --- a/cps/static/css/libs/viewer.css +++ b/cps/static/css/libs/viewer.css @@ -230,36 +230,46 @@ z-index: 200; max-width: 20em; background-color: #FFFF99; - box-shadow: 0px 2px 5px #333; + box-shadow: 0px 2px 5px #888; border-radius: 2px; - padding: 0.6em; + padding: 6px; margin-left: 5px; cursor: pointer; font: message-box; + font-size: 9px; word-wrap: break-word; } +.annotationLayer .popup > * { + font-size: 9px; +} + .annotationLayer .popup h1 { - font-size: 1em; - border-bottom: 1px solid #000000; - margin: 0; - padding-bottom: 0.2em; + display: inline-block; +} + +.annotationLayer .popup span { + display: inline-block; + margin-left: 5px; } .annotationLayer .popup p { - margin: 0; - padding-top: 0.2em; + border-top: 1px solid #333; + margin-top: 2px; + padding-top: 2px; } .annotationLayer .highlightAnnotation, .annotationLayer .underlineAnnotation, .annotationLayer .squigglyAnnotation, .annotationLayer .strikeoutAnnotation, +.annotationLayer .freeTextAnnotation, .annotationLayer .lineAnnotation svg line, .annotationLayer .squareAnnotation svg rect, .annotationLayer .circleAnnotation svg ellipse, .annotationLayer .polylineAnnotation svg polyline, .annotationLayer .polygonAnnotation svg polygon, +.annotationLayer .caretAnnotation, .annotationLayer .inkAnnotation svg polyline, .annotationLayer .stampAnnotation, .annotationLayer .fileAttachmentAnnotation { @@ -279,8 +289,9 @@ overflow: visible; border: 9px solid transparent; background-clip: content-box; - -o-border-image: url(images/shadow.png) 9 9 repeat; - border-image: url(images/shadow.png) 9 9 repeat; + -webkit-border-image: url(images/shadow.png) 9 9 repeat; + -o-border-image: url(images/shadow.png) 9 9 repeat; + border-image: url(images/shadow.png) 9 9 repeat; background-color: white; } @@ -543,15 +554,20 @@ select { z-index: 100; border-top: 1px solid #333; - transition-duration: 200ms; - transition-timing-function: ease; + -webkit-transition-duration: 200ms; + + transition-duration: 200ms; + -webkit-transition-timing-function: ease; + transition-timing-function: ease; } html[dir='ltr'] #sidebarContainer { + -webkit-transition-property: left; transition-property: left; left: -200px; left: calc(-1 * var(--sidebar-width)); } html[dir='rtl'] #sidebarContainer { + -webkit-transition-property: right; transition-property: right; right: -200px; right: calc(-1 * var(--sidebar-width)); @@ -563,7 +579,8 @@ html[dir='rtl'] #sidebarContainer { #outerContainer.sidebarResizing #sidebarContainer { /* Improve responsiveness and avoid visual glitches when the sidebar is resized. */ - transition-duration: 0s; + -webkit-transition-duration: 0s; + transition-duration: 0s; /* Prevent e.g. the thumbnails being selected when the sidebar is resized. */ -webkit-user-select: none; -moz-user-select: none; @@ -620,8 +637,10 @@ html[dir='rtl'] #sidebarContent { outline: none; } #viewerContainer:not(.pdfPresentationMode) { - transition-duration: 200ms; - transition-timing-function: ease; + -webkit-transition-duration: 200ms; + transition-duration: 200ms; + -webkit-transition-timing-function: ease; + transition-timing-function: ease; } html[dir='ltr'] #viewerContainer { box-shadow: inset 1px 0 0 hsla(0,0%,100%,.05); @@ -632,15 +651,18 @@ html[dir='rtl'] #viewerContainer { #outerContainer.sidebarResizing #viewerContainer { /* Improve responsiveness and avoid visual glitches when the sidebar is resized. */ - transition-duration: 0s; + -webkit-transition-duration: 0s; + transition-duration: 0s; } html[dir='ltr'] #outerContainer.sidebarOpen #viewerContainer:not(.pdfPresentationMode) { + -webkit-transition-property: left; transition-property: left; left: 200px; left: var(--sidebar-width); } html[dir='rtl'] #outerContainer.sidebarOpen #viewerContainer:not(.pdfPresentationMode) { + -webkit-transition-property: right; transition-property: right; right: 200px; right: var(--sidebar-width); @@ -662,6 +684,8 @@ html[dir='rtl'] #outerContainer.sidebarOpen #viewerContainer:not(.pdfPresentatio width: 100%; height: 32px; background-color: #424242; /* fallback */ + background-image: url(images/texture.png), + -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,30%,.99)), to(hsla(0,0%,25%,.95))); background-image: url(images/texture.png), linear-gradient(hsla(0,0%,30%,.99), hsla(0,0%,25%,.95)); } @@ -697,6 +721,8 @@ html[dir='rtl'] #sidebarResizer { position: relative; height: 32px; background-color: #474747; /* fallback */ + background-image: url(images/texture.png), + -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,32%,.99)), to(hsla(0,0%,27%,.95))); background-image: url(images/texture.png), linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95)); } @@ -733,6 +759,7 @@ html[dir='rtl'] #toolbarContainer, .findbar, .secondaryToolbar { height: 100%; background-color: #ddd; overflow: hidden; + -webkit-transition: width 200ms; transition: width 200ms; } @@ -748,6 +775,7 @@ html[dir='rtl'] #toolbarContainer, .findbar, .secondaryToolbar { #loadingBar .progress.indeterminate { background-color: #999; + -webkit-transition: none; transition: none; } @@ -815,6 +843,9 @@ html[dir='rtl'] .findbar { #findInput::-webkit-input-placeholder { color: hsl(0, 0%, 75%); } +#findInput::-moz-placeholder { + font-style: italic; +} #findInput:-ms-input-placeholder { font-style: italic; } @@ -1006,6 +1037,7 @@ html[dir='rtl'] .splitToolbarButton > .toolbarButton { .splitToolbarButton.toggled > .toolbarButton, .toolbarButton.textButton { background-color: hsla(0,0%,0%,.12); + background-image: -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,100%,.05)), to(hsla(0,0%,100%,0))); background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); background-clip: padding-box; border: 1px solid hsla(0,0%,0%,.35); @@ -1013,9 +1045,12 @@ html[dir='rtl'] .splitToolbarButton > .toolbarButton { box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, 0 0 1px hsla(0,0%,100%,.15) inset, 0 1px 0 hsla(0,0%,100%,.05); + -webkit-transition-property: background-color, border-color, box-shadow; transition-property: background-color, border-color, box-shadow; - transition-duration: 150ms; - transition-timing-function: ease; + -webkit-transition-duration: 150ms; + transition-duration: 150ms; + -webkit-transition-timing-function: ease; + transition-timing-function: ease; } .splitToolbarButton > .toolbarButton:hover, @@ -1072,9 +1107,12 @@ html[dir='rtl'] .splitToolbarButtonSeparator { padding: 12px 0; margin: 1px 0; box-shadow: 0 0 0 1px hsla(0,0%,100%,.03); + -webkit-transition-property: padding; transition-property: padding; - transition-duration: 10ms; - transition-timing-function: ease; + -webkit-transition-duration: 10ms; + transition-duration: 10ms; + -webkit-transition-timing-function: ease; + transition-timing-function: ease; } .toolbarButton, @@ -1094,9 +1132,12 @@ html[dir='rtl'] .splitToolbarButtonSeparator { user-select: none; /* Opera does not support user-select, use <... unselectable="on"> instead */ cursor: default; + -webkit-transition-property: background-color, border-color, box-shadow; transition-property: background-color, border-color, box-shadow; - transition-duration: 150ms; - transition-timing-function: ease; + -webkit-transition-duration: 150ms; + transition-duration: 150ms; + -webkit-transition-timing-function: ease; + transition-timing-function: ease; } html[dir='ltr'] .toolbarButton, @@ -1117,6 +1158,7 @@ html[dir='rtl'] .dropdownToolbarButton { .secondaryToolbarButton:hover, .secondaryToolbarButton:focus { background-color: hsla(0,0%,0%,.12); + background-image: -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,100%,.05)), to(hsla(0,0%,100%,0))); background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); background-clip: padding-box; border: 1px solid hsla(0,0%,0%,.35); @@ -1131,28 +1173,36 @@ html[dir='rtl'] .dropdownToolbarButton { .dropdownToolbarButton:hover:active, .secondaryToolbarButton:hover:active { background-color: hsla(0,0%,0%,.2); + background-image: -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,100%,.05)), to(hsla(0,0%,100%,0))); background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); border-color: hsla(0,0%,0%,.35) hsla(0,0%,0%,.4) hsla(0,0%,0%,.45); box-shadow: 0 1px 1px hsla(0,0%,0%,.1) inset, 0 0 1px hsla(0,0%,0%,.2) inset, 0 1px 0 hsla(0,0%,100%,.05); + -webkit-transition-property: background-color, border-color, box-shadow; transition-property: background-color, border-color, box-shadow; - transition-duration: 10ms; - transition-timing-function: linear; + -webkit-transition-duration: 10ms; + transition-duration: 10ms; + -webkit-transition-timing-function: linear; + transition-timing-function: linear; } .toolbarButton.toggled, .splitToolbarButton.toggled > .toolbarButton.toggled, .secondaryToolbarButton.toggled { background-color: hsla(0,0%,0%,.3); + background-image: -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,100%,.05)), to(hsla(0,0%,100%,0))); background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.45) hsla(0,0%,0%,.5); box-shadow: 0 1px 1px hsla(0,0%,0%,.1) inset, 0 0 1px hsla(0,0%,0%,.2) inset, 0 1px 0 hsla(0,0%,100%,.05); + -webkit-transition-property: background-color, border-color, box-shadow; transition-property: background-color, border-color, box-shadow; - transition-duration: 10ms; - transition-timing-function: linear; + -webkit-transition-duration: 10ms; + transition-duration: 10ms; + -webkit-transition-timing-function: linear; + transition-timing-function: linear; } .toolbarButton.toggled:hover:active, @@ -1493,6 +1543,7 @@ html[dir='rtl'] .verticalToolbarSeparator { border: 1px solid transparent; border-radius: 2px; background-color: hsla(0,0%,100%,.09); + background-image: -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,100%,.05)), to(hsla(0,0%,100%,0))); background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); background-clip: padding-box; border: 1px solid hsla(0,0%,0%,.35); @@ -1503,9 +1554,12 @@ html[dir='rtl'] .verticalToolbarSeparator { font-size: 12px; line-height: 14px; outline-style: none; + -webkit-transition-property: background-color, border-color, box-shadow; transition-property: background-color, border-color, box-shadow; - transition-duration: 150ms; - transition-timing-function: ease; + -webkit-transition-duration: 150ms; + transition-duration: 150ms; + -webkit-transition-timing-function: ease; + transition-timing-function: ease; } .toolbarField[type=checkbox] { @@ -1619,6 +1673,7 @@ a:focus > .thumbnail > .thumbnailSelectionRing > .thumbnailImage, a:focus > .thumbnail > .thumbnailSelectionRing, .thumbnail:hover > .thumbnailSelectionRing { background-color: hsla(0,0%,100%,.15); + background-image: -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,100%,.05)), to(hsla(0,0%,100%,0))); background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); background-clip: padding-box; box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, @@ -1634,6 +1689,7 @@ a:focus > .thumbnail > .thumbnailSelectionRing, .thumbnail.selected > .thumbnailSelectionRing { background-color: hsla(0,0%,100%,.3); + background-image: -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,100%,.05)), to(hsla(0,0%,100%,0))); background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); background-clip: padding-box; box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, @@ -1755,6 +1811,7 @@ html[dir='rtl'] .outlineItemToggler::before { .outlineItem > a:hover, .attachmentsItem > button:hover { background-color: hsla(0,0%,100%,.02); + background-image: -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,100%,.05)), to(hsla(0,0%,100%,0))); background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); background-clip: padding-box; box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, @@ -1766,6 +1823,7 @@ html[dir='rtl'] .outlineItemToggler::before { .outlineItem.selected { background-color: hsla(0,0%,100%,.08); + background-image: -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,100%,.05)), to(hsla(0,0%,100%,0))); background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); background-clip: padding-box; box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, @@ -1850,6 +1908,8 @@ html[dir='rtl'] .outlineItemToggler::before { font-size: 12px; line-height: 14px; background-color: #474747; /* fallback */ + background-image: url(images/texture.png), + -webkit-gradient(linear, left top, left bottom, from(hsla(0,0%,32%,.99)), to(hsla(0,0%,27%,.95))); background-image: url(images/texture.png), linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95)); box-shadow: inset 1px 0 0 hsla(0,0%,100%,.08), diff --git a/cps/static/js/get_meta.js b/cps/static/js/get_meta.js index a453b092..77c53f51 100644 --- a/cps/static/js/get_meta.js +++ b/cps/static/js/get_meta.js @@ -19,7 +19,7 @@ * Google Books api document: https://developers.google.com/books/docs/v1/using * Douban Books api document: https://developers.douban.com/wiki/?title=book_v2 (Chinese Only) */ -/* global _, i18nMsg, tinymce */ +/* global _, i18nMsg, tinymce */ var dbResults = []; var ggResults = []; @@ -55,9 +55,9 @@ $(function () { $(".cover img").attr("src", book.cover); $("#cover_url").val(book.cover); $("#pubdate").val(book.publishedDate); - $("#publisher").val(book.publisher) - if (book.series != undefined) { - $("#series").val(book.series) + $("#publisher").val(book.publisher); + if (typeof book.series !== "undefined") { + $("#series").val(book.series); } } @@ -72,16 +72,18 @@ $(function () { } function formatDate (date) { var d = new Date(date), - month = '' + (d.getMonth() + 1), - day = '' + d.getDate(), + month = "" + (d.getMonth() + 1), + day = "" + d.getDate(), year = d.getFullYear(); - - if (month.length < 2) - month = '0' + month; - if (day.length < 2) - day = '0' + day; - - return [year, month, day].join('-'); + + if (month.length < 2) { + month = "0" + month; + } + if (day.length < 2) { + day = "0" + day; + } + + return [year, month, day].join("-"); } if (ggDone && ggResults.length > 0) { @@ -116,16 +118,17 @@ $(function () { } if (dbDone && dbResults.length > 0) { dbResults.forEach(function(result) { - if (result.series){ - var series_title = result.series.title + var seriesTitle = ""; + if (result.series) { + seriesTitle = result.series.title; } - var date_fomers = result.pubdate.split("-") - var publishedYear = parseInt(date_fomers[0]) - var publishedMonth = parseInt(date_fomers[1]) - var publishedDate = new Date(publishedYear, publishedMonth-1, 1) + var dateFomers = result.pubdate.split("-"); + var publishedYear = parseInt(dateFomers[0]); + var publishedMonth = parseInt(dateFomers[1]); + var publishedDate = new Date(publishedYear, publishedMonth - 1, 1); + + publishedDate = formatDate(publishedDate); - publishedDate = formatDate(publishedDate) - var book = { id: result.id, title: result.title, @@ -137,7 +140,7 @@ $(function () { return tag.title.toLowerCase().replace(/,/g, "_"); }), rating: result.rating.average || 0, - series: series_title || "", + series: seriesTitle || "", cover: result.image, url: "https://book.douban.com/subject/" + result.id, source: { @@ -183,7 +186,7 @@ $(function () { } function dbSearchBook (title) { - apikey="0df993c66c0c636e29ecbb5344252a4a" + var apikey = "0df993c66c0c636e29ecbb5344252a4a"; $.ajax({ url: douban + dbSearch + "?apikey=" + apikey + "&q=" + title + "&fields=all&count=10", type: "GET", @@ -193,7 +196,7 @@ $(function () { dbResults = data.books; }, error: function error() { - $("#meta-info").html("

" + msg.search_error + "!

"+ $("#meta-info")[0].innerHTML) + $("#meta-info").html("

" + msg.search_error + "!

" + $("#meta-info")[0].innerHTML); }, complete: function complete() { dbDone = true; diff --git a/cps/static/js/libs/Sortable.min.js b/cps/static/js/libs/Sortable.min.js index e95d2a30..eba06149 100644 --- a/cps/static/js/libs/Sortable.min.js +++ b/cps/static/js/libs/Sortable.min.js @@ -1,2 +1,2 @@ -/*! Sortable 1.4.2 - MIT | git://github.com/rubaxa/Sortable.git */ -!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():"undefined"!=typeof Package?Sortable=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=r({},b),a[L]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",ignore:"a, img",filter:null,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1};for(var d in c)!(d in b)&&(b[d]=c[d]);V(b);for(var f in this)"_"===f.charAt(0)&&(this[f]=this[f].bind(this));this.nativeDraggable=b.forceFallback?!1:P,e(a,"mousedown",this._onTapStart),e(a,"touchstart",this._onTapStart),this.nativeDraggable&&(e(a,"dragover",this),e(a,"dragenter",this)),T.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a){v&&v.state!==a&&(h(v,"display",a?"none":""),!a&&v.state&&w.insertBefore(v,s),v.state=a)}function c(a,b,c){if(a){c=c||N,b=b.split(".");var d=b.shift().toUpperCase(),e=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");do if(">*"===d&&a.parentNode===c||(""===d||a.nodeName.toUpperCase()==d)&&(!b.length||((" "+a.className+" ").match(e)||[]).length==b.length))return a;while(a!==c&&(a=a.parentNode))}return null}function d(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function e(a,b,c){a.addEventListener(b,c,!1)}function f(a,b,c){a.removeEventListener(b,c,!1)}function g(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(K," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(K," ")}}function h(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return N.defaultView&&N.defaultView.getComputedStyle?c=N.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function i(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;f>e;e++)c(d[e],e);return d}return[]}function j(a,b,c,d,e,f,g){var h=N.createEvent("Event"),i=(a||b[L]).options,j="on"+c.charAt(0).toUpperCase()+c.substr(1);h.initEvent(c,!0,!0),h.to=b,h.from=e||b,h.item=d||b,h.clone=v,h.oldIndex=f,h.newIndex=g,b.dispatchEvent(h),i[j]&&i[j].call(a,h)}function k(a,b,c,d,e,f){var g,h,i=a[L],j=i.options.onMove;return g=N.createEvent("Event"),g.initEvent("move",!0,!0),g.to=b,g.from=a,g.dragged=c,g.draggedRect=d,g.related=e||b,g.relatedRect=f||b.getBoundingClientRect(),a.dispatchEvent(g),j&&(h=j.call(i,g)),h}function l(a){a.draggable=!1}function m(){R=!1}function n(a,b){var c=a.lastElementChild,d=c.getBoundingClientRect();return(b.clientY-(d.top+d.height)>5||b.clientX-(d.right+d.width)>5)&&c}function o(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function p(a){var b=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"!==a.nodeName.toUpperCase()&&b++;return b}function q(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function r(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}var s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J={},K=/\s+/g,L="Sortable"+(new Date).getTime(),M=window,N=M.document,O=M.parseInt,P=!!("draggable"in N.createElement("div")),Q=function(a){return a=N.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents}(),R=!1,S=Math.abs,T=([].slice,[]),U=q(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h=b.scrollSensitivity,i=b.scrollSpeed,j=a.clientX,k=a.clientY,l=window.innerWidth,m=window.innerHeight;if(z!==c&&(y=b.scroll,z=c,y===!0)){y=c;do if(y.offsetWidth=l-j)-(h>=j),g=(h>=m-k)-(h>=k),(f||g)&&(d=M)),(J.vx!==f||J.vy!==g||J.el!==d)&&(J.el=d,J.vx=f,J.vy=g,clearInterval(J.pid),d&&(J.pid=setInterval(function(){d===M?M.scrollTo(M.pageXOffset+f*i,M.pageYOffset+g*i):(g&&(d.scrollTop+=g*i),f&&(d.scrollLeft+=f*i))},24)))}},30),V=function(a){var b=a.group;b&&"object"==typeof b||(b=a.group={name:b}),["pull","put"].forEach(function(a){a in b||(b[a]=!0)}),a.groups=" "+b.name+(b.put.join?" "+b.put.join(" "):"")+" "};return a.prototype={constructor:a,_onTapStart:function(a){var b=this,d=this.el,e=this.options,f=a.type,g=a.touches&&a.touches[0],h=(g||a).target,i=h,k=e.filter;if(!("mousedown"===f&&0!==a.button||e.disabled)&&(h=c(h,e.draggable,d))){if(D=p(h),"function"==typeof k){if(k.call(this,a,h,this))return j(b,i,"filter",h,d,D),void a.preventDefault()}else if(k&&(k=k.split(",").some(function(a){return a=c(i,a.trim(),d),a?(j(b,a,"filter",h,d,D),!0):void 0})))return void a.preventDefault();(!e.handle||c(i,e.handle,d))&&this._prepareDragStart(a,g,h)}},_prepareDragStart:function(a,b,c){var d,f=this,h=f.el,j=f.options,k=h.ownerDocument;c&&!s&&c.parentNode===h&&(G=a,w=h,s=c,t=s.parentNode,x=s.nextSibling,F=j.group,d=function(){f._disableDelayedDrag(),s.draggable=!0,g(s,f.options.chosenClass,!0),f._triggerDragStart(b)},j.ignore.split(",").forEach(function(a){i(s,a.trim(),l)}),e(k,"mouseup",f._onDrop),e(k,"touchend",f._onDrop),e(k,"touchcancel",f._onDrop),j.delay?(e(k,"mouseup",f._disableDelayedDrag),e(k,"touchend",f._disableDelayedDrag),e(k,"touchcancel",f._disableDelayedDrag),e(k,"mousemove",f._disableDelayedDrag),e(k,"touchmove",f._disableDelayedDrag),f._dragStartTimer=setTimeout(d,j.delay)):d())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),f(a,"mouseup",this._disableDelayedDrag),f(a,"touchend",this._disableDelayedDrag),f(a,"touchcancel",this._disableDelayedDrag),f(a,"mousemove",this._disableDelayedDrag),f(a,"touchmove",this._disableDelayedDrag)},_triggerDragStart:function(a){a?(G={target:s,clientX:a.clientX,clientY:a.clientY},this._onDragStart(G,"touch")):this.nativeDraggable?(e(s,"dragend",this),e(w,"dragstart",this._onDragStart)):this._onDragStart(G,!0);try{N.selection?N.selection.empty():window.getSelection().removeAllRanges()}catch(b){}},_dragStarted:function(){w&&s&&(g(s,this.options.ghostClass,!0),a.active=this,j(this,w,"start",s,w,D))},_emulateDragOver:function(){if(H){if(this._lastX===H.clientX&&this._lastY===H.clientY)return;this._lastX=H.clientX,this._lastY=H.clientY,Q||h(u,"display","none");var a=N.elementFromPoint(H.clientX,H.clientY),b=a,c=" "+this.options.group.name,d=T.length;if(b)do{if(b[L]&&b[L].options.groups.indexOf(c)>-1){for(;d--;)T[d]({clientX:H.clientX,clientY:H.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);Q||h(u,"display","")}},_onTouchMove:function(b){if(G){a.active||this._dragStarted(),this._appendGhost();var c=b.touches?b.touches[0]:b,d=c.clientX-G.clientX,e=c.clientY-G.clientY,f=b.touches?"translate3d("+d+"px,"+e+"px,0)":"translate("+d+"px,"+e+"px)";I=!0,H=c,h(u,"webkitTransform",f),h(u,"mozTransform",f),h(u,"msTransform",f),h(u,"transform",f),b.preventDefault()}},_appendGhost:function(){if(!u){var a,b=s.getBoundingClientRect(),c=h(s),d=this.options;u=s.cloneNode(!0),g(u,d.ghostClass,!1),g(u,d.fallbackClass,!0),h(u,"top",b.top-O(c.marginTop,10)),h(u,"left",b.left-O(c.marginLeft,10)),h(u,"width",b.width),h(u,"height",b.height),h(u,"opacity","0.8"),h(u,"position","fixed"),h(u,"zIndex","100000"),h(u,"pointerEvents","none"),d.fallbackOnBody&&N.body.appendChild(u)||w.appendChild(u),a=u.getBoundingClientRect(),h(u,"width",2*b.width-a.width),h(u,"height",2*b.height-a.height)}},_onDragStart:function(a,b){var c=a.dataTransfer,d=this.options;this._offUpEvents(),"clone"==F.pull&&(v=s.cloneNode(!0),h(v,"display","none"),w.insertBefore(v,s)),b?("touch"===b?(e(N,"touchmove",this._onTouchMove),e(N,"touchend",this._onDrop),e(N,"touchcancel",this._onDrop)):(e(N,"mousemove",this._onTouchMove),e(N,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,50)):(c&&(c.effectAllowed="move",d.setData&&d.setData.call(this,c,s)),e(N,"drop",this),setTimeout(this._dragStarted,0))},_onDragOver:function(a){var d,e,f,g=this.el,i=this.options,j=i.group,l=j.put,o=F===j,p=i.sort;if(void 0!==a.preventDefault&&(a.preventDefault(),!i.dragoverBubble&&a.stopPropagation()),I=!0,F&&!i.disabled&&(o?p||(f=!w.contains(s)):F.pull&&l&&(F.name===j.name||l.indexOf&&~l.indexOf(F.name)))&&(void 0===a.rootEl||a.rootEl===this.el)){if(U(a,i,this.el),R)return;if(d=c(a.target,i.draggable,g),e=s.getBoundingClientRect(),f)return b(!0),void(v||x?w.insertBefore(s,v||x):p||w.appendChild(s));if(0===g.children.length||g.children[0]===u||g===a.target&&(d=n(g,a))){if(d){if(d.animated)return;r=d.getBoundingClientRect()}b(o),k(w,g,s,e,d,r)!==!1&&(s.contains(g)||(g.appendChild(s),t=g),this._animate(e,s),d&&this._animate(r,d))}else if(d&&!d.animated&&d!==s&&void 0!==d.parentNode[L]){A!==d&&(A=d,B=h(d),C=h(d.parentNode));var q,r=d.getBoundingClientRect(),y=r.right-r.left,z=r.bottom-r.top,D=/left|right|inline/.test(B.cssFloat+B.display)||"flex"==C.display&&0===C["flex-direction"].indexOf("row"),E=d.offsetWidth>s.offsetWidth,G=d.offsetHeight>s.offsetHeight,H=(D?(a.clientX-r.left)/y:(a.clientY-r.top)/z)>.5,J=d.nextElementSibling,K=k(w,g,s,e,d,r);if(K!==!1){if(R=!0,setTimeout(m,30),b(o),1===K||-1===K)q=1===K;else if(D){var M=s.offsetTop,N=d.offsetTop;q=M===N?d.previousElementSibling===s&&!E||H&&E:N>M}else q=J!==s&&!G||H&&G;s.contains(g)||(q&&!J?g.appendChild(s):d.parentNode.insertBefore(s,q?J:d)),t=s.parentNode,this._animate(e,s),this._animate(r,d)}}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();h(b,"transition","none"),h(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,h(b,"transition","all "+c+"ms"),h(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){h(b,"transition",""),h(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;f(N,"touchmove",this._onTouchMove),f(a,"mouseup",this._onDrop),f(a,"touchend",this._onDrop),f(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(J.pid),clearTimeout(this._dragStartTimer),f(N,"mousemove",this._onTouchMove),this.nativeDraggable&&(f(N,"drop",this),f(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(I&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),u&&u.parentNode.removeChild(u),s&&(this.nativeDraggable&&f(s,"dragend",this),l(s),g(s,this.options.ghostClass,!1),g(s,this.options.chosenClass,!1),w!==t?(E=p(s),E>=0&&(j(null,t,"sort",s,w,D,E),j(this,w,"sort",s,w,D,E),j(null,t,"add",s,w,D,E),j(this,w,"remove",s,w,D,E))):(v&&v.parentNode.removeChild(v),s.nextSibling!==x&&(E=p(s),E>=0&&(j(this,w,"update",s,w,D,E),j(this,w,"sort",s,w,D,E)))),a.active&&((null===E||-1===E)&&(E=D),j(this,w,"end",s,w,D,E),this.save())),w=s=t=u=x=v=y=z=G=H=I=E=A=B=F=a.active=null)},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?s&&(this._onDragOver(a),d(a)):("drop"===b||"dragend"===b)&&this._onDrop(a)},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;f>e;e++)a=d[e],c(a,g.draggable,this.el)&&b.push(a.getAttribute(g.dataIdAttr)||o(a));return b},sort:function(a){var b={},d=this.el;this.toArray().forEach(function(a,e){var f=d.children[e];c(f,this.options.draggable,d)&&(b[a]=f)},this),a.forEach(function(a){b[a]&&(d.removeChild(b[a]),d.appendChild(b[a]))})},save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return c(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;return void 0===b?c[a]:(c[a]=b,void("group"===a&&V(c)))},destroy:function(){var a=this.el;a[L]=null,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),T.splice(T.indexOf(this._onDragOver),1),this._onDrop(),this.el=a=null}},a.utils={on:e,off:f,css:h,find:i,is:function(a,b){return!!c(a,b,a)},extend:r,throttle:q,closest:c,toggleClass:g,index:p},a.create=function(b,c){return new a(b,c)},a.version="1.4.2",a}); \ No newline at end of file +/*! Sortable 1.10.2 - MIT | git://github.com/SortableJS/Sortable.git */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(){return(a=Object.assign||function(t){for(var e=1;e"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function P(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&h(t,e):h(t,e))||o&&t===n)return t;if(t===n)break}while(t=(i=t).host&&i!==document&&i.host.nodeType?i.host:i.parentNode)}var i;return null}var f,p=/\s+/g;function k(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(p," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(p," ")}}function R(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function v(t,e){var n="";if("string"==typeof t)n=t;else do{var o=R(t,"transform");o&&"none"!==o&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function g(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=e.left-n&&r<=e.right+n,i=a>=e.top-n&&a<=e.bottom+n;return n&&o&&i?l=t:void 0}}),l}((t=t.touches?t.touches[0]:t).clientX,t.clientY);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[j]._onDragOver(n)}}}function kt(t){z&&z.parentNode[j]._isOutsideThisEl(t.target)}function Rt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=a({},e),t[j]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ot(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Rt.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var o in O.initializePlugins(this,t,n),n)o in e||(e[o]=n[o]);for(var i in At(e),this)"_"===i.charAt(0)&&"function"==typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&xt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?u(t,"pointerdown",this._onTapStart):(u(t,"mousedown",this._onTapStart),u(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(u(t,"dragover",this),u(t,"dragenter",this)),bt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),a(this,T())}function Xt(t,e,n,o,i,r,a,l){var s,c,u=t[j],d=u.options.onMove;return!window.CustomEvent||w||E?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=n,s.draggedRect=o,s.related=i||e,s.relatedRect=r||X(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),d&&(c=d.call(u,s,a)),c}function Yt(t){t.draggable=!1}function Bt(){Dt=!1}function Ft(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Ht(t){return setTimeout(t,0)}function Lt(t){return clearTimeout(t)}Rt.prototype={constructor:Rt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(ht=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,z):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,t=this.options,i=t.preventOnFilter,r=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,l=(a||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,c=t.filter;if(function(t){St.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var o=e[n];o.checked&&St.push(o)}}(o),!z&&!(/mousedown|pointerdown/.test(r)&&0!==e.button||t.disabled||s.isContentEditable||(l=P(l,t.draggable,o,!1))&&l.animated||Z===l)){if(J=F(l),et=F(l,t.draggable),"function"==typeof c){if(c.call(this,e,l,this))return W({sortable:n,rootEl:s,name:"filter",targetEl:l,toEl:o,fromEl:o}),K("filter",n,{evt:e}),void(i&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some(function(t){if(t=P(s,t.trim(),o,!1))return W({sortable:n,rootEl:t,name:"filter",targetEl:l,fromEl:o,toEl:o}),K("filter",n,{evt:e}),!0})))return void(i&&e.cancelable&&e.preventDefault());t.handle&&!P(s,t.handle,o,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(t,e,n){var o,i=this,r=i.el,a=i.options,l=r.ownerDocument;if(n&&!z&&n.parentNode===r){var s=X(n);if(q=r,G=(z=n).parentNode,V=z.nextSibling,Z=n,ot=a.group,rt={target:Rt.dragged=z,clientX:(e||t).clientX,clientY:(e||t).clientY},ct=rt.clientX-s.left,ut=rt.clientY-s.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,z.style["will-change"]="all",o=function(){K("delayEnded",i,{evt:t}),Rt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!c&&i.nativeDraggable&&(z.draggable=!0),i._triggerDragStart(t,e),W({sortable:i,name:"choose",originalEvent:t}),k(z,a.chosenClass,!0))},a.ignore.split(",").forEach(function(t){g(z,t.trim(),Yt)}),u(l,"dragover",Pt),u(l,"mousemove",Pt),u(l,"touchmove",Pt),u(l,"mouseup",i._onDrop),u(l,"touchend",i._onDrop),u(l,"touchcancel",i._onDrop),c&&this.nativeDraggable&&(this.options.touchStartThreshold=4,z.draggable=!0),K("delayStart",this,{evt:t}),!a.delay||a.delayOnTouchOnly&&!e||this.nativeDraggable&&(E||w))o();else{if(Rt.eventCanceled)return void this._onDrop();u(l,"mouseup",i._disableDelayedDrag),u(l,"touchend",i._disableDelayedDrag),u(l,"touchcancel",i._disableDelayedDrag),u(l,"mousemove",i._delayedDragTouchMoveHandler),u(l,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&u(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(o,a.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){z&&Yt(z),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;d(t,"mouseup",this._disableDelayedDrag),d(t,"touchend",this._disableDelayedDrag),d(t,"touchcancel",this._disableDelayedDrag),d(t,"mousemove",this._delayedDragTouchMoveHandler),d(t,"touchmove",this._delayedDragTouchMoveHandler),d(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?u(document,"pointermove",this._onTouchMove):u(document,e?"touchmove":"mousemove",this._onTouchMove):(u(z,"dragend",this),u(q,"dragstart",this._onDragStart));try{document.selection?Ht(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(vt=!1,q&&z){K("dragStarted",this,{evt:e}),this.nativeDraggable&&u(document,"dragover",kt);var n=this.options;t||k(z,n.dragClass,!1),k(z,n.ghostClass,!0),Rt.active=this,t&&this._appendGhost(),W({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(at){this._lastX=at.clientX,this._lastY=at.clientY,Nt();for(var t=document.elementFromPoint(at.clientX,at.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(at.clientX,at.clientY))!==e;)e=t;if(z.parentNode[j]._isOutsideThisEl(t),e)do{if(e[j]){if(e[j]._onDragOver({clientX:at.clientX,clientY:at.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);It()}},_onTouchMove:function(t){if(rt){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=U&&v(U,!0),a=U&&r&&r.a,l=U&&r&&r.d,s=Ct&>&&b(gt),c=(i.clientX-rt.clientX+o.x)/(a||1)+(s?s[0]-Et[0]:0)/(a||1),u=(i.clientY-rt.clientY+o.y)/(l||1)+(s?s[1]-Et[1]:0)/(l||1);if(!Rt.active&&!vt){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))o.right+10||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+10}(n,a,this)&&!g.animated){if(g===z)return A(!1);if(g&&l===n.target&&(s=g),s&&(i=X(s)),!1!==Xt(q,l,z,o,s,i,n,!!s))return O(),l.appendChild(z),G=l,N(),A(!0)}else if(s.parentNode===l){i=X(s);var v,m,b,y=z.parentNode!==l,w=!function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,a=n?e.left:e.top,l=n?e.right:e.bottom,s=n?e.width:e.height;return o===a||i===l||o+r/2===a+s/2}(z.animated&&z.toRect||o,s.animated&&s.toRect||i,a),E=a?"top":"left",D=Y(s,"top","top")||Y(z,"top","top"),S=D?D.scrollTop:void 0;if(ht!==s&&(m=i[E],yt=!1,wt=!w&&e.invertSwap||y),0!==(v=function(t,e,n,o,i,r,a,l){var s=o?t.clientY:t.clientX,c=o?n.height:n.width,u=o?n.top:n.left,d=o?n.bottom:n.right,h=!1;if(!a)if(l&&pt LOOP_LIMIT) { - warn("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\"")); - break; - } - - dict = dict.get('Parent'); - } - - return values; -} - var Util = function UtilClosure() { function Util() {} @@ -1044,30 +951,6 @@ var Util = function UtilClosure() { }(); exports.Util = Util; -var ROMAN_NUMBER_MAP = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']; - -function toRomanNumerals(number) { - var lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - assert(Number.isInteger(number) && number > 0, 'The number should be a positive integer.'); - var pos, - romanBuf = []; - - while (number >= 1000) { - number -= 1000; - romanBuf.push('M'); - } - - pos = number / 100 | 0; - number %= 100; - romanBuf.push(ROMAN_NUMBER_MAP[pos]); - pos = number / 10 | 0; - number %= 10; - romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); - romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); - var romanStr = romanBuf.join(''); - return lowerCase ? romanStr.toLowerCase() : romanStr; -} - var PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC]; function stringToPDFString(str) { @@ -1121,6 +1004,16 @@ function isArrayBuffer(v) { return _typeof(v) === 'object' && v !== null && v.byteLength !== undefined; } +function isArrayEqual(arr1, arr2) { + if (arr1.length !== arr2.length) { + return false; + } + + return arr1.every(function (element, index) { + return element === arr2[index]; + }); +} + function isSpace(ch) { return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A; } @@ -1252,8 +1145,8 @@ if (!globalScope._pdfjsCompatibilityChecked) { tokens[_key] = arguments[_key]; } - for (var _i = 0; _i < tokens.length; _i++) { - var token = tokens[_i]; + for (var _i = 0, _tokens = tokens; _i < _tokens.length; _i++) { + var token = _tokens[_i]; OriginalDOMTokenListAdd.call(this, token); } }; @@ -1263,8 +1156,8 @@ if (!globalScope._pdfjsCompatibilityChecked) { tokens[_key2] = arguments[_key2]; } - for (var _i2 = 0; _i2 < tokens.length; _i2++) { - var token = tokens[_i2]; + for (var _i2 = 0, _tokens2 = tokens; _i2 < _tokens2.length; _i2++) { + var token = _tokens2[_i2]; OriginalDOMTokenListRemove.call(this, token); } }; @@ -1300,7 +1193,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - __w_pdfjs_require__(35); + __w_pdfjs_require__(36); })(); (function checkStringIncludes() { @@ -1308,7 +1201,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - __w_pdfjs_require__(37); + __w_pdfjs_require__(38); })(); (function checkArrayIncludes() { @@ -1316,7 +1209,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - __w_pdfjs_require__(39); + __w_pdfjs_require__(40); })(); (function checkArrayFrom() { @@ -1324,7 +1217,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - __w_pdfjs_require__(46); + __w_pdfjs_require__(47); })(); (function checkObjectAssign() { @@ -1332,7 +1225,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - __w_pdfjs_require__(69); + __w_pdfjs_require__(70); })(); (function checkMathLog2() { @@ -1340,7 +1233,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - Math.log2 = __w_pdfjs_require__(74); + Math.log2 = __w_pdfjs_require__(75); })(); (function checkNumberIsNaN() { @@ -1348,7 +1241,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - Number.isNaN = __w_pdfjs_require__(76); + Number.isNaN = __w_pdfjs_require__(77); })(); (function checkNumberIsInteger() { @@ -1356,15 +1249,15 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - Number.isInteger = __w_pdfjs_require__(78); + Number.isInteger = __w_pdfjs_require__(79); })(); (function checkPromise() { - if (globalScope.Promise && globalScope.Promise.prototype && globalScope.Promise.prototype.finally) { + if (globalScope.Promise && globalScope.Promise.prototype && globalScope.Promise.prototype["finally"]) { return; } - globalScope.Promise = __w_pdfjs_require__(81); + globalScope.Promise = __w_pdfjs_require__(82); })(); (function checkWeakMap() { @@ -1372,7 +1265,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - globalScope.WeakMap = __w_pdfjs_require__(101); + globalScope.WeakMap = __w_pdfjs_require__(102); })(); (function checkWeakSet() { @@ -1380,7 +1273,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - globalScope.WeakSet = __w_pdfjs_require__(118); + globalScope.WeakSet = __w_pdfjs_require__(119); })(); (function checkStringCodePointAt() { @@ -1388,7 +1281,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - String.codePointAt = __w_pdfjs_require__(122); + String.codePointAt = __w_pdfjs_require__(123); })(); (function checkStringFromCodePoint() { @@ -1396,7 +1289,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - String.fromCodePoint = __w_pdfjs_require__(124); + String.fromCodePoint = __w_pdfjs_require__(125); })(); (function checkSymbol() { @@ -1404,7 +1297,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - __w_pdfjs_require__(126); + __w_pdfjs_require__(127); })(); (function checkStringPadStart() { @@ -1412,7 +1305,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - __w_pdfjs_require__(133); + __w_pdfjs_require__(134); })(); (function checkStringPadEnd() { @@ -1420,7 +1313,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - __w_pdfjs_require__(137); + __w_pdfjs_require__(138); })(); (function checkObjectValues() { @@ -1428,7 +1321,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - Object.values = __w_pdfjs_require__(139); + Object.values = __w_pdfjs_require__(140); })(); } @@ -1451,7 +1344,7 @@ module.exports = typeof window !== 'undefined' && window.Math === Math ? window function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } module.exports = function isNodeJS() { - return (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && process + '' === '[object process]' && !process.versions['nw']; + return (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && process + '' === '[object process]' && !process.versions['nw'] && !process.versions['electron']; }; /***/ }), @@ -1474,13 +1367,13 @@ module.exports = __w_pdfjs_require__(9).String.startsWith; var $export = __w_pdfjs_require__(7); -var toLength = __w_pdfjs_require__(25); +var toLength = __w_pdfjs_require__(28); -var context = __w_pdfjs_require__(27); +var context = __w_pdfjs_require__(30); var STARTS_WITH = 'startsWith'; var $startsWith = ''[STARTS_WITH]; -$export($export.P + $export.F * __w_pdfjs_require__(34)(STARTS_WITH), 'String', { +$export($export.P + $export.F * __w_pdfjs_require__(35)(STARTS_WITH), 'String', { startsWith: function startsWith(searchString) { var that = context(this, searchString, STARTS_WITH); var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)); @@ -1504,7 +1397,7 @@ var hide = __w_pdfjs_require__(10); var redefine = __w_pdfjs_require__(20); -var ctx = __w_pdfjs_require__(23); +var ctx = __w_pdfjs_require__(26); var PROTOTYPE = 'prototype'; @@ -1559,7 +1452,7 @@ if (typeof __g == 'number') __g = global; var core = module.exports = { - version: '2.6.2' + version: '2.6.9' }; if (typeof __e == 'number') __e = core; @@ -1745,8 +1638,9 @@ var has = __w_pdfjs_require__(21); var SRC = __w_pdfjs_require__(22)('src'); +var $toString = __w_pdfjs_require__(23); + var TO_STRING = 'toString'; -var $toString = Function[TO_STRING]; var TPL = ('' + $toString).split(TO_STRING); __w_pdfjs_require__(9).inspectSource = function (it) { @@ -1807,7 +1701,46 @@ module.exports = function (key) { "use strict"; -var aFunction = __w_pdfjs_require__(24); +module.exports = __w_pdfjs_require__(24)('native-function-to-string', Function.toString); + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var core = __w_pdfjs_require__(9); + +var global = __w_pdfjs_require__(8); + +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: core.version, + mode: __w_pdfjs_require__(25) ? 'pure' : 'global', + copyright: '© 2019 Denis Pushkarev (zloirock.ru)' +}); + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = false; + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var aFunction = __w_pdfjs_require__(27); module.exports = function (fn, that, length) { aFunction(fn); @@ -1836,7 +1769,7 @@ module.exports = function (fn, that, length) { }; /***/ }), -/* 24 */ +/* 27 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -1848,13 +1781,13 @@ module.exports = function (it) { }; /***/ }), -/* 25 */ +/* 28 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var toInteger = __w_pdfjs_require__(26); +var toInteger = __w_pdfjs_require__(29); var min = Math.min; @@ -1863,7 +1796,7 @@ module.exports = function (it) { }; /***/ }), -/* 26 */ +/* 29 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -1877,15 +1810,15 @@ module.exports = function (it) { }; /***/ }), -/* 27 */ +/* 30 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var isRegExp = __w_pdfjs_require__(28); +var isRegExp = __w_pdfjs_require__(31); -var defined = __w_pdfjs_require__(33); +var defined = __w_pdfjs_require__(34); module.exports = function (that, searchString, NAME) { if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); @@ -1893,7 +1826,7 @@ module.exports = function (that, searchString, NAME) { }; /***/ }), -/* 28 */ +/* 31 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -1901,9 +1834,9 @@ module.exports = function (that, searchString, NAME) { var isObject = __w_pdfjs_require__(13); -var cof = __w_pdfjs_require__(29); +var cof = __w_pdfjs_require__(32); -var MATCH = __w_pdfjs_require__(30)('match'); +var MATCH = __w_pdfjs_require__(33)('match'); module.exports = function (it) { var isRegExp; @@ -1911,7 +1844,7 @@ module.exports = function (it) { }; /***/ }), -/* 29 */ +/* 32 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -1924,13 +1857,13 @@ module.exports = function (it) { }; /***/ }), -/* 30 */ +/* 33 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var store = __w_pdfjs_require__(31)('wks'); +var store = __w_pdfjs_require__(24)('wks'); var uid = __w_pdfjs_require__(22); @@ -1945,37 +1878,7 @@ var $exports = module.exports = function (name) { $exports.store = store; /***/ }), -/* 31 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var core = __w_pdfjs_require__(9); - -var global = __w_pdfjs_require__(8); - -var SHARED = '__core-js_shared__'; -var store = global[SHARED] || (global[SHARED] = {}); -(module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); -})('versions', []).push({ - version: core.version, - mode: __w_pdfjs_require__(32) ? 'pure' : 'global', - copyright: '© 2019 Denis Pushkarev (zloirock.ru)' -}); - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -module.exports = false; - -/***/ }), -/* 33 */ +/* 34 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -1987,13 +1890,13 @@ module.exports = function (it) { }; /***/ }), -/* 34 */ +/* 35 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var MATCH = __w_pdfjs_require__(30)('match'); +var MATCH = __w_pdfjs_require__(33)('match'); module.exports = function (KEY) { var re = /./; @@ -2011,18 +1914,18 @@ module.exports = function (KEY) { }; /***/ }), -/* 35 */ +/* 36 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(36); +__w_pdfjs_require__(37); module.exports = __w_pdfjs_require__(9).String.endsWith; /***/ }), -/* 36 */ +/* 37 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2030,13 +1933,13 @@ module.exports = __w_pdfjs_require__(9).String.endsWith; var $export = __w_pdfjs_require__(7); -var toLength = __w_pdfjs_require__(25); +var toLength = __w_pdfjs_require__(28); -var context = __w_pdfjs_require__(27); +var context = __w_pdfjs_require__(30); var ENDS_WITH = 'endsWith'; var $endsWith = ''[ENDS_WITH]; -$export($export.P + $export.F * __w_pdfjs_require__(34)(ENDS_WITH), 'String', { +$export($export.P + $export.F * __w_pdfjs_require__(35)(ENDS_WITH), 'String', { endsWith: function endsWith(searchString) { var that = context(this, searchString, ENDS_WITH); var endPosition = arguments.length > 1 ? arguments[1] : undefined; @@ -2048,18 +1951,18 @@ $export($export.P + $export.F * __w_pdfjs_require__(34)(ENDS_WITH), 'String', { }); /***/ }), -/* 37 */ +/* 38 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(38); +__w_pdfjs_require__(39); module.exports = __w_pdfjs_require__(9).String.includes; /***/ }), -/* 38 */ +/* 39 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2067,28 +1970,28 @@ module.exports = __w_pdfjs_require__(9).String.includes; var $export = __w_pdfjs_require__(7); -var context = __w_pdfjs_require__(27); +var context = __w_pdfjs_require__(30); var INCLUDES = 'includes'; -$export($export.P + $export.F * __w_pdfjs_require__(34)(INCLUDES), 'String', { +$export($export.P + $export.F * __w_pdfjs_require__(35)(INCLUDES), 'String', { includes: function includes(searchString) { return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), -/* 39 */ +/* 40 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(40); +__w_pdfjs_require__(41); module.exports = __w_pdfjs_require__(9).Array.includes; /***/ }), -/* 40 */ +/* 41 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2096,7 +1999,7 @@ module.exports = __w_pdfjs_require__(9).Array.includes; var $export = __w_pdfjs_require__(7); -var $includes = __w_pdfjs_require__(41)(true); +var $includes = __w_pdfjs_require__(42)(true); $export($export.P, 'Array', { includes: function includes(el) { @@ -2104,20 +2007,20 @@ $export($export.P, 'Array', { } }); -__w_pdfjs_require__(45)('includes'); +__w_pdfjs_require__(46)('includes'); /***/ }), -/* 41 */ +/* 42 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var toIObject = __w_pdfjs_require__(42); +var toIObject = __w_pdfjs_require__(43); -var toLength = __w_pdfjs_require__(25); +var toLength = __w_pdfjs_require__(28); -var toAbsoluteIndex = __w_pdfjs_require__(44); +var toAbsoluteIndex = __w_pdfjs_require__(45); module.exports = function (IS_INCLUDES) { return function ($this, el, fromIndex) { @@ -2138,41 +2041,41 @@ module.exports = function (IS_INCLUDES) { }; /***/ }), -/* 42 */ +/* 43 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var IObject = __w_pdfjs_require__(43); +var IObject = __w_pdfjs_require__(44); -var defined = __w_pdfjs_require__(33); +var defined = __w_pdfjs_require__(34); module.exports = function (it) { return IObject(defined(it)); }; /***/ }), -/* 43 */ +/* 44 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var cof = __w_pdfjs_require__(29); +var cof = __w_pdfjs_require__(32); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }), -/* 44 */ +/* 45 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var toInteger = __w_pdfjs_require__(26); +var toInteger = __w_pdfjs_require__(29); var max = Math.max; var min = Math.min; @@ -2183,13 +2086,13 @@ module.exports = function (index, length) { }; /***/ }), -/* 45 */ +/* 46 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var UNSCOPABLES = __w_pdfjs_require__(30)('unscopables'); +var UNSCOPABLES = __w_pdfjs_require__(33)('unscopables'); var ArrayProto = Array.prototype; if (ArrayProto[UNSCOPABLES] == undefined) __w_pdfjs_require__(10)(ArrayProto, UNSCOPABLES, {}); @@ -2199,28 +2102,28 @@ module.exports = function (key) { }; /***/ }), -/* 46 */ +/* 47 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(47); +__w_pdfjs_require__(48); -__w_pdfjs_require__(62); +__w_pdfjs_require__(63); module.exports = __w_pdfjs_require__(9).Array.from; /***/ }), -/* 47 */ +/* 48 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var $at = __w_pdfjs_require__(48)(true); +var $at = __w_pdfjs_require__(49)(true); -__w_pdfjs_require__(49)(String, 'String', function (iterated) { +__w_pdfjs_require__(50)(String, 'String', function (iterated) { this._t = String(iterated); this._i = 0; }, function () { @@ -2240,15 +2143,15 @@ __w_pdfjs_require__(49)(String, 'String', function (iterated) { }); /***/ }), -/* 48 */ +/* 49 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var toInteger = __w_pdfjs_require__(26); +var toInteger = __w_pdfjs_require__(29); -var defined = __w_pdfjs_require__(33); +var defined = __w_pdfjs_require__(34); module.exports = function (TO_STRING) { return function (that, pos) { @@ -2263,13 +2166,13 @@ module.exports = function (TO_STRING) { }; /***/ }), -/* 49 */ +/* 50 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var LIBRARY = __w_pdfjs_require__(32); +var LIBRARY = __w_pdfjs_require__(25); var $export = __w_pdfjs_require__(7); @@ -2277,15 +2180,15 @@ var redefine = __w_pdfjs_require__(20); var hide = __w_pdfjs_require__(10); -var Iterators = __w_pdfjs_require__(50); +var Iterators = __w_pdfjs_require__(51); -var $iterCreate = __w_pdfjs_require__(51); +var $iterCreate = __w_pdfjs_require__(52); -var setToStringTag = __w_pdfjs_require__(59); +var setToStringTag = __w_pdfjs_require__(60); -var getPrototypeOf = __w_pdfjs_require__(60); +var getPrototypeOf = __w_pdfjs_require__(61); -var ITERATOR = __w_pdfjs_require__(30)('iterator'); +var ITERATOR = __w_pdfjs_require__(33)('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); var FF_ITERATOR = '@@iterator'; @@ -2368,7 +2271,7 @@ module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE }; /***/ }), -/* 50 */ +/* 51 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2377,21 +2280,21 @@ module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE module.exports = {}; /***/ }), -/* 51 */ +/* 52 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var create = __w_pdfjs_require__(52); +var create = __w_pdfjs_require__(53); var descriptor = __w_pdfjs_require__(19); -var setToStringTag = __w_pdfjs_require__(59); +var setToStringTag = __w_pdfjs_require__(60); var IteratorPrototype = {}; -__w_pdfjs_require__(10)(IteratorPrototype, __w_pdfjs_require__(30)('iterator'), function () { +__w_pdfjs_require__(10)(IteratorPrototype, __w_pdfjs_require__(33)('iterator'), function () { return this; }); @@ -2403,7 +2306,7 @@ module.exports = function (Constructor, NAME, next) { }; /***/ }), -/* 52 */ +/* 53 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2411,11 +2314,11 @@ module.exports = function (Constructor, NAME, next) { var anObject = __w_pdfjs_require__(12); -var dPs = __w_pdfjs_require__(53); +var dPs = __w_pdfjs_require__(54); -var enumBugKeys = __w_pdfjs_require__(57); +var enumBugKeys = __w_pdfjs_require__(58); -var IE_PROTO = __w_pdfjs_require__(56)('IE_PROTO'); +var IE_PROTO = __w_pdfjs_require__(57)('IE_PROTO'); var Empty = function Empty() {}; @@ -2430,7 +2333,7 @@ var _createDict = function createDict() { var iframeDocument; iframe.style.display = 'none'; - __w_pdfjs_require__(58).appendChild(iframe); + __w_pdfjs_require__(59).appendChild(iframe); iframe.src = 'javascript:'; iframeDocument = iframe.contentWindow.document; @@ -2460,7 +2363,7 @@ module.exports = Object.create || function create(O, Properties) { }; /***/ }), -/* 53 */ +/* 54 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2470,7 +2373,7 @@ var dP = __w_pdfjs_require__(11); var anObject = __w_pdfjs_require__(12); -var getKeys = __w_pdfjs_require__(54); +var getKeys = __w_pdfjs_require__(55); module.exports = __w_pdfjs_require__(15) ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); @@ -2487,22 +2390,22 @@ module.exports = __w_pdfjs_require__(15) ? Object.defineProperties : function de }; /***/ }), -/* 54 */ +/* 55 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var $keys = __w_pdfjs_require__(55); +var $keys = __w_pdfjs_require__(56); -var enumBugKeys = __w_pdfjs_require__(57); +var enumBugKeys = __w_pdfjs_require__(58); module.exports = Object.keys || function keys(O) { return $keys(O, enumBugKeys); }; /***/ }), -/* 55 */ +/* 56 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2510,11 +2413,11 @@ module.exports = Object.keys || function keys(O) { var has = __w_pdfjs_require__(21); -var toIObject = __w_pdfjs_require__(42); +var toIObject = __w_pdfjs_require__(43); -var arrayIndexOf = __w_pdfjs_require__(41)(false); +var arrayIndexOf = __w_pdfjs_require__(42)(false); -var IE_PROTO = __w_pdfjs_require__(56)('IE_PROTO'); +var IE_PROTO = __w_pdfjs_require__(57)('IE_PROTO'); module.exports = function (object, names) { var O = toIObject(object); @@ -2536,13 +2439,13 @@ module.exports = function (object, names) { }; /***/ }), -/* 56 */ +/* 57 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var shared = __w_pdfjs_require__(31)('keys'); +var shared = __w_pdfjs_require__(24)('keys'); var uid = __w_pdfjs_require__(22); @@ -2551,7 +2454,7 @@ module.exports = function (key) { }; /***/ }), -/* 57 */ +/* 58 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2560,7 +2463,7 @@ module.exports = function (key) { module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(','); /***/ }), -/* 58 */ +/* 59 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2571,7 +2474,7 @@ var document = __w_pdfjs_require__(8).document; module.exports = document && document.documentElement; /***/ }), -/* 59 */ +/* 60 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2581,7 +2484,7 @@ var def = __w_pdfjs_require__(11).f; var has = __w_pdfjs_require__(21); -var TAG = __w_pdfjs_require__(30)('toStringTag'); +var TAG = __w_pdfjs_require__(33)('toStringTag'); module.exports = function (it, tag, stat) { if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { @@ -2591,7 +2494,7 @@ module.exports = function (it, tag, stat) { }; /***/ }), -/* 60 */ +/* 61 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2599,9 +2502,9 @@ module.exports = function (it, tag, stat) { var has = __w_pdfjs_require__(21); -var toObject = __w_pdfjs_require__(61); +var toObject = __w_pdfjs_require__(62); -var IE_PROTO = __w_pdfjs_require__(56)('IE_PROTO'); +var IE_PROTO = __w_pdfjs_require__(57)('IE_PROTO'); var ObjectProto = Object.prototype; @@ -2617,42 +2520,42 @@ module.exports = Object.getPrototypeOf || function (O) { }; /***/ }), -/* 61 */ +/* 62 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var defined = __w_pdfjs_require__(33); +var defined = __w_pdfjs_require__(34); module.exports = function (it) { return Object(defined(it)); }; /***/ }), -/* 62 */ +/* 63 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var ctx = __w_pdfjs_require__(23); +var ctx = __w_pdfjs_require__(26); var $export = __w_pdfjs_require__(7); -var toObject = __w_pdfjs_require__(61); +var toObject = __w_pdfjs_require__(62); -var call = __w_pdfjs_require__(63); +var call = __w_pdfjs_require__(64); -var isArrayIter = __w_pdfjs_require__(64); +var isArrayIter = __w_pdfjs_require__(65); -var toLength = __w_pdfjs_require__(25); +var toLength = __w_pdfjs_require__(28); -var createProperty = __w_pdfjs_require__(65); +var createProperty = __w_pdfjs_require__(66); -var getIterFn = __w_pdfjs_require__(66); +var getIterFn = __w_pdfjs_require__(67); -$export($export.S + $export.F * !__w_pdfjs_require__(68)(function (iter) { +$export($export.S + $export.F * !__w_pdfjs_require__(69)(function (iter) { Array.from(iter); }), 'Array', { from: function from(arrayLike) { @@ -2684,7 +2587,7 @@ $export($export.S + $export.F * !__w_pdfjs_require__(68)(function (iter) { }); /***/ }), -/* 63 */ +/* 64 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2703,15 +2606,15 @@ module.exports = function (iterator, fn, value, entries) { }; /***/ }), -/* 64 */ +/* 65 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var Iterators = __w_pdfjs_require__(50); +var Iterators = __w_pdfjs_require__(51); -var ITERATOR = __w_pdfjs_require__(30)('iterator'); +var ITERATOR = __w_pdfjs_require__(33)('iterator'); var ArrayProto = Array.prototype; @@ -2720,7 +2623,7 @@ module.exports = function (it) { }; /***/ }), -/* 65 */ +/* 66 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2735,32 +2638,32 @@ module.exports = function (object, index, value) { }; /***/ }), -/* 66 */ +/* 67 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var classof = __w_pdfjs_require__(67); +var classof = __w_pdfjs_require__(68); -var ITERATOR = __w_pdfjs_require__(30)('iterator'); +var ITERATOR = __w_pdfjs_require__(33)('iterator'); -var Iterators = __w_pdfjs_require__(50); +var Iterators = __w_pdfjs_require__(51); module.exports = __w_pdfjs_require__(9).getIteratorMethod = function (it) { if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }), -/* 67 */ +/* 68 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var cof = __w_pdfjs_require__(29); +var cof = __w_pdfjs_require__(32); -var TAG = __w_pdfjs_require__(30)('toStringTag'); +var TAG = __w_pdfjs_require__(33)('toStringTag'); var ARG = cof(function () { return arguments; @@ -2778,13 +2681,13 @@ module.exports = function (it) { }; /***/ }), -/* 68 */ +/* 69 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var ITERATOR = __w_pdfjs_require__(30)('iterator'); +var ITERATOR = __w_pdfjs_require__(33)('iterator'); var SAFE_CLOSING = false; @@ -2825,18 +2728,18 @@ module.exports = function (exec, skipClosing) { }; /***/ }), -/* 69 */ +/* 70 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(70); +__w_pdfjs_require__(71); module.exports = __w_pdfjs_require__(9).Object.assign; /***/ }), -/* 70 */ +/* 71 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2845,25 +2748,27 @@ module.exports = __w_pdfjs_require__(9).Object.assign; var $export = __w_pdfjs_require__(7); $export($export.S + $export.F, 'Object', { - assign: __w_pdfjs_require__(71) + assign: __w_pdfjs_require__(72) }); /***/ }), -/* 71 */ +/* 72 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var getKeys = __w_pdfjs_require__(54); +var DESCRIPTORS = __w_pdfjs_require__(15); + +var getKeys = __w_pdfjs_require__(55); -var gOPS = __w_pdfjs_require__(72); +var gOPS = __w_pdfjs_require__(73); -var pIE = __w_pdfjs_require__(73); +var pIE = __w_pdfjs_require__(74); -var toObject = __w_pdfjs_require__(61); +var toObject = __w_pdfjs_require__(62); -var IObject = __w_pdfjs_require__(43); +var IObject = __w_pdfjs_require__(44); var $assign = Object.assign; module.exports = !$assign || __w_pdfjs_require__(16)(function () { @@ -2891,7 +2796,8 @@ module.exports = !$assign || __w_pdfjs_require__(16)(function () { var key; while (length > j) { - if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; + key = keys[j++]; + if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key]; } } @@ -2899,7 +2805,7 @@ module.exports = !$assign || __w_pdfjs_require__(16)(function () { } : $assign; /***/ }), -/* 72 */ +/* 73 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2908,7 +2814,7 @@ module.exports = !$assign || __w_pdfjs_require__(16)(function () { exports.f = Object.getOwnPropertySymbols; /***/ }), -/* 73 */ +/* 74 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2917,18 +2823,18 @@ exports.f = Object.getOwnPropertySymbols; exports.f = {}.propertyIsEnumerable; /***/ }), -/* 74 */ +/* 75 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(75); +__w_pdfjs_require__(76); module.exports = __w_pdfjs_require__(9).Math.log2; /***/ }), -/* 75 */ +/* 76 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2943,18 +2849,18 @@ $export($export.S, 'Math', { }); /***/ }), -/* 76 */ +/* 77 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(77); +__w_pdfjs_require__(78); module.exports = __w_pdfjs_require__(9).Number.isNaN; /***/ }), -/* 77 */ +/* 78 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2969,18 +2875,18 @@ $export($export.S, 'Number', { }); /***/ }), -/* 78 */ +/* 79 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(79); +__w_pdfjs_require__(80); module.exports = __w_pdfjs_require__(9).Number.isInteger; /***/ }), -/* 79 */ +/* 80 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2989,11 +2895,11 @@ module.exports = __w_pdfjs_require__(9).Number.isInteger; var $export = __w_pdfjs_require__(7); $export($export.S, 'Number', { - isInteger: __w_pdfjs_require__(80) + isInteger: __w_pdfjs_require__(81) }); /***/ }), -/* 80 */ +/* 81 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3008,37 +2914,37 @@ module.exports = function isInteger(it) { }; /***/ }), -/* 81 */ +/* 82 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(82); - -__w_pdfjs_require__(47); - __w_pdfjs_require__(83); -__w_pdfjs_require__(86); +__w_pdfjs_require__(48); + +__w_pdfjs_require__(84); -__w_pdfjs_require__(99); +__w_pdfjs_require__(87); __w_pdfjs_require__(100); +__w_pdfjs_require__(101); + module.exports = __w_pdfjs_require__(9).Promise; /***/ }), -/* 82 */ +/* 83 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var classof = __w_pdfjs_require__(67); +var classof = __w_pdfjs_require__(68); var test = {}; -test[__w_pdfjs_require__(30)('toStringTag')] = 'z'; +test[__w_pdfjs_require__(33)('toStringTag')] = 'z'; if (test + '' != '[object z]') { __w_pdfjs_require__(20)(Object.prototype, 'toString', function toString() { @@ -3047,15 +2953,15 @@ if (test + '' != '[object z]') { } /***/ }), -/* 83 */ +/* 84 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var $iterators = __w_pdfjs_require__(84); +var $iterators = __w_pdfjs_require__(85); -var getKeys = __w_pdfjs_require__(54); +var getKeys = __w_pdfjs_require__(55); var redefine = __w_pdfjs_require__(20); @@ -3063,9 +2969,9 @@ var global = __w_pdfjs_require__(8); var hide = __w_pdfjs_require__(10); -var Iterators = __w_pdfjs_require__(50); +var Iterators = __w_pdfjs_require__(51); -var wks = __w_pdfjs_require__(30); +var wks = __w_pdfjs_require__(33); var ITERATOR = wks('iterator'); var TO_STRING_TAG = wks('toStringTag'); @@ -3122,21 +3028,21 @@ for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++ } /***/ }), -/* 84 */ +/* 85 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var addToUnscopables = __w_pdfjs_require__(45); +var addToUnscopables = __w_pdfjs_require__(46); -var step = __w_pdfjs_require__(85); +var step = __w_pdfjs_require__(86); -var Iterators = __w_pdfjs_require__(50); +var Iterators = __w_pdfjs_require__(51); -var toIObject = __w_pdfjs_require__(42); +var toIObject = __w_pdfjs_require__(43); -module.exports = __w_pdfjs_require__(49)(Array, 'Array', function (iterated, kind) { +module.exports = __w_pdfjs_require__(50)(Array, 'Array', function (iterated, kind) { this._t = toIObject(iterated); this._i = 0; this._k = kind; @@ -3160,7 +3066,7 @@ addToUnscopables('values'); addToUnscopables('entries'); /***/ }), -/* 85 */ +/* 86 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3174,43 +3080,43 @@ module.exports = function (done, value) { }; /***/ }), -/* 86 */ +/* 87 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var LIBRARY = __w_pdfjs_require__(32); +var LIBRARY = __w_pdfjs_require__(25); var global = __w_pdfjs_require__(8); -var ctx = __w_pdfjs_require__(23); +var ctx = __w_pdfjs_require__(26); -var classof = __w_pdfjs_require__(67); +var classof = __w_pdfjs_require__(68); var $export = __w_pdfjs_require__(7); var isObject = __w_pdfjs_require__(13); -var aFunction = __w_pdfjs_require__(24); +var aFunction = __w_pdfjs_require__(27); -var anInstance = __w_pdfjs_require__(87); +var anInstance = __w_pdfjs_require__(88); -var forOf = __w_pdfjs_require__(88); +var forOf = __w_pdfjs_require__(89); -var speciesConstructor = __w_pdfjs_require__(89); +var speciesConstructor = __w_pdfjs_require__(90); -var task = __w_pdfjs_require__(90).set; +var task = __w_pdfjs_require__(91).set; -var microtask = __w_pdfjs_require__(92)(); +var microtask = __w_pdfjs_require__(93)(); -var newPromiseCapabilityModule = __w_pdfjs_require__(93); +var newPromiseCapabilityModule = __w_pdfjs_require__(94); -var perform = __w_pdfjs_require__(94); +var perform = __w_pdfjs_require__(95); -var userAgent = __w_pdfjs_require__(95); +var userAgent = __w_pdfjs_require__(96); -var promiseResolve = __w_pdfjs_require__(96); +var promiseResolve = __w_pdfjs_require__(97); var PROMISE = 'Promise'; var TypeError = global.TypeError; @@ -3228,7 +3134,7 @@ var USE_NATIVE = !!function () { try { var promise = $Promise.resolve(1); - var FakePromise = (promise.constructor = {})[__w_pdfjs_require__(30)('species')] = function (exec) { + var FakePromise = (promise.constructor = {})[__w_pdfjs_require__(33)('species')] = function (exec) { exec(empty, empty); }; @@ -3412,7 +3318,7 @@ if (!USE_NATIVE) { this._n = false; }; - Internal.prototype = __w_pdfjs_require__(97)($Promise.prototype, { + Internal.prototype = __w_pdfjs_require__(98)($Promise.prototype, { then: function then(onFulfilled, onRejected) { var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; @@ -3446,9 +3352,9 @@ $export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); -__w_pdfjs_require__(59)($Promise, PROMISE); +__w_pdfjs_require__(60)($Promise, PROMISE); -__w_pdfjs_require__(98)(PROMISE); +__w_pdfjs_require__(99)(PROMISE); Wrapper = __w_pdfjs_require__(9)[PROMISE]; $export($export.S + $export.F * !USE_NATIVE, PROMISE, { @@ -3464,7 +3370,7 @@ $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); } }); -$export($export.S + $export.F * !(USE_NATIVE && __w_pdfjs_require__(68)(function (iter) { +$export($export.S + $export.F * !(USE_NATIVE && __w_pdfjs_require__(69)(function (iter) { $Promise.all(iter)['catch'](empty); })), PROMISE, { all: function all(iterable) { @@ -3508,7 +3414,7 @@ $export($export.S + $export.F * !(USE_NATIVE && __w_pdfjs_require__(68)(function }); /***/ }), -/* 87 */ +/* 88 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3523,23 +3429,23 @@ module.exports = function (it, Constructor, name, forbiddenField) { }; /***/ }), -/* 88 */ +/* 89 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var ctx = __w_pdfjs_require__(23); +var ctx = __w_pdfjs_require__(26); -var call = __w_pdfjs_require__(63); +var call = __w_pdfjs_require__(64); -var isArrayIter = __w_pdfjs_require__(64); +var isArrayIter = __w_pdfjs_require__(65); var anObject = __w_pdfjs_require__(12); -var toLength = __w_pdfjs_require__(25); +var toLength = __w_pdfjs_require__(28); -var getIterFn = __w_pdfjs_require__(66); +var getIterFn = __w_pdfjs_require__(67); var BREAK = {}; var RETURN = {}; @@ -3565,7 +3471,7 @@ _exports.BREAK = BREAK; _exports.RETURN = RETURN; /***/ }), -/* 89 */ +/* 90 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3573,9 +3479,9 @@ _exports.RETURN = RETURN; var anObject = __w_pdfjs_require__(12); -var aFunction = __w_pdfjs_require__(24); +var aFunction = __w_pdfjs_require__(27); -var SPECIES = __w_pdfjs_require__(30)('species'); +var SPECIES = __w_pdfjs_require__(33)('species'); module.exports = function (O, D) { var C = anObject(O).constructor; @@ -3584,17 +3490,17 @@ module.exports = function (O, D) { }; /***/ }), -/* 90 */ +/* 91 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var ctx = __w_pdfjs_require__(23); +var ctx = __w_pdfjs_require__(26); -var invoke = __w_pdfjs_require__(91); +var invoke = __w_pdfjs_require__(92); -var html = __w_pdfjs_require__(58); +var html = __w_pdfjs_require__(59); var cel = __w_pdfjs_require__(17); @@ -3645,7 +3551,7 @@ if (!setTask || !clearTask) { delete queue[id]; }; - if (__w_pdfjs_require__(29)(process) == 'process') { + if (__w_pdfjs_require__(32)(process) == 'process') { defer = function defer(id) { process.nextTick(ctx(run, id, 1)); }; @@ -3684,7 +3590,7 @@ module.exports = { }; /***/ }), -/* 91 */ +/* 92 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3714,7 +3620,7 @@ module.exports = function (fn, args, that) { }; /***/ }), -/* 92 */ +/* 93 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3722,12 +3628,12 @@ module.exports = function (fn, args, that) { var global = __w_pdfjs_require__(8); -var macrotask = __w_pdfjs_require__(90).set; +var macrotask = __w_pdfjs_require__(91).set; var Observer = global.MutationObserver || global.WebKitMutationObserver; var process = global.process; var Promise = global.Promise; -var isNode = __w_pdfjs_require__(29)(process) == 'process'; +var isNode = __w_pdfjs_require__(32)(process) == 'process'; module.exports = function () { var head, last, notify; @@ -3795,13 +3701,13 @@ module.exports = function () { }; /***/ }), -/* 93 */ +/* 94 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var aFunction = __w_pdfjs_require__(24); +var aFunction = __w_pdfjs_require__(27); function PromiseCapability(C) { var resolve, reject; @@ -3819,7 +3725,7 @@ module.exports.f = function (C) { }; /***/ }), -/* 94 */ +/* 95 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3840,7 +3746,7 @@ module.exports = function (exec) { }; /***/ }), -/* 95 */ +/* 96 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3852,7 +3758,7 @@ var navigator = global.navigator; module.exports = navigator && navigator.userAgent || ''; /***/ }), -/* 96 */ +/* 97 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3862,7 +3768,7 @@ var anObject = __w_pdfjs_require__(12); var isObject = __w_pdfjs_require__(13); -var newPromiseCapability = __w_pdfjs_require__(93); +var newPromiseCapability = __w_pdfjs_require__(94); module.exports = function (C, x) { anObject(C); @@ -3874,7 +3780,7 @@ module.exports = function (C, x) { }; /***/ }), -/* 97 */ +/* 98 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3891,7 +3797,7 @@ module.exports = function (target, src, safe) { }; /***/ }), -/* 98 */ +/* 99 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3903,7 +3809,7 @@ var dP = __w_pdfjs_require__(11); var DESCRIPTORS = __w_pdfjs_require__(15); -var SPECIES = __w_pdfjs_require__(30)('species'); +var SPECIES = __w_pdfjs_require__(33)('species'); module.exports = function (KEY) { var C = global[KEY]; @@ -3916,7 +3822,7 @@ module.exports = function (KEY) { }; /***/ }), -/* 99 */ +/* 100 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3928,9 +3834,9 @@ var core = __w_pdfjs_require__(9); var global = __w_pdfjs_require__(8); -var speciesConstructor = __w_pdfjs_require__(89); +var speciesConstructor = __w_pdfjs_require__(90); -var promiseResolve = __w_pdfjs_require__(96); +var promiseResolve = __w_pdfjs_require__(97); $export($export.P + $export.R, 'Promise', { 'finally': function _finally(onFinally) { @@ -3949,7 +3855,7 @@ $export($export.P + $export.R, 'Promise', { }); /***/ }), -/* 100 */ +/* 101 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3957,9 +3863,9 @@ $export($export.P + $export.R, 'Promise', { var $export = __w_pdfjs_require__(7); -var newPromiseCapability = __w_pdfjs_require__(93); +var newPromiseCapability = __w_pdfjs_require__(94); -var perform = __w_pdfjs_require__(94); +var perform = __w_pdfjs_require__(95); $export($export.S, 'Promise', { 'try': function _try(callbackfn) { @@ -3971,52 +3877,54 @@ $export($export.S, 'Promise', { }); /***/ }), -/* 101 */ +/* 102 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(82); - __w_pdfjs_require__(83); -__w_pdfjs_require__(102); +__w_pdfjs_require__(84); -__w_pdfjs_require__(114); +__w_pdfjs_require__(103); -__w_pdfjs_require__(116); +__w_pdfjs_require__(115); + +__w_pdfjs_require__(117); module.exports = __w_pdfjs_require__(9).WeakMap; /***/ }), -/* 102 */ +/* 103 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var each = __w_pdfjs_require__(103)(0); +var global = __w_pdfjs_require__(8); + +var each = __w_pdfjs_require__(104)(0); var redefine = __w_pdfjs_require__(20); -var meta = __w_pdfjs_require__(107); +var meta = __w_pdfjs_require__(108); -var assign = __w_pdfjs_require__(71); +var assign = __w_pdfjs_require__(72); -var weak = __w_pdfjs_require__(108); +var weak = __w_pdfjs_require__(109); var isObject = __w_pdfjs_require__(13); -var fails = __w_pdfjs_require__(16); +var validate = __w_pdfjs_require__(110); -var validate = __w_pdfjs_require__(109); +var NATIVE_WEAK_MAP = __w_pdfjs_require__(110); +var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; var WEAK_MAP = 'WeakMap'; var getWeak = meta.getWeak; var isExtensible = Object.isExtensible; var uncaughtFrozenStore = weak.ufstore; -var tmp = {}; var InternalMap; var wrapper = function wrapper(get) { @@ -4038,11 +3946,9 @@ var methods = { } }; -var $WeakMap = module.exports = __w_pdfjs_require__(110)(WEAK_MAP, wrapper, methods, weak, true, true); +var $WeakMap = module.exports = __w_pdfjs_require__(111)(WEAK_MAP, wrapper, methods, weak, true, true); -if (fails(function () { - return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; -})) { +if (NATIVE_WEAK_MAP && IS_IE11) { InternalMap = weak.getConstructor(wrapper, WEAK_MAP); assign(InternalMap.prototype, methods); meta.NEED = true; @@ -4064,21 +3970,21 @@ if (fails(function () { } /***/ }), -/* 103 */ +/* 104 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var ctx = __w_pdfjs_require__(23); +var ctx = __w_pdfjs_require__(26); -var IObject = __w_pdfjs_require__(43); +var IObject = __w_pdfjs_require__(44); -var toObject = __w_pdfjs_require__(61); +var toObject = __w_pdfjs_require__(62); -var toLength = __w_pdfjs_require__(25); +var toLength = __w_pdfjs_require__(28); -var asc = __w_pdfjs_require__(104); +var asc = __w_pdfjs_require__(105); module.exports = function (TYPE, $create) { var IS_MAP = TYPE == 1; @@ -4125,20 +4031,20 @@ module.exports = function (TYPE, $create) { }; /***/ }), -/* 104 */ +/* 105 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var speciesConstructor = __w_pdfjs_require__(105); +var speciesConstructor = __w_pdfjs_require__(106); module.exports = function (original, length) { return new (speciesConstructor(original))(length); }; /***/ }), -/* 105 */ +/* 106 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4146,9 +4052,9 @@ module.exports = function (original, length) { var isObject = __w_pdfjs_require__(13); -var isArray = __w_pdfjs_require__(106); +var isArray = __w_pdfjs_require__(107); -var SPECIES = __w_pdfjs_require__(30)('species'); +var SPECIES = __w_pdfjs_require__(33)('species'); module.exports = function (original) { var C; @@ -4167,20 +4073,20 @@ module.exports = function (original) { }; /***/ }), -/* 106 */ +/* 107 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var cof = __w_pdfjs_require__(29); +var cof = __w_pdfjs_require__(32); module.exports = Array.isArray || function isArray(arg) { return cof(arg) == 'Array'; }; /***/ }), -/* 107 */ +/* 108 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4251,29 +4157,29 @@ var meta = module.exports = { }; /***/ }), -/* 108 */ +/* 109 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var redefineAll = __w_pdfjs_require__(97); +var redefineAll = __w_pdfjs_require__(98); -var getWeak = __w_pdfjs_require__(107).getWeak; +var getWeak = __w_pdfjs_require__(108).getWeak; var anObject = __w_pdfjs_require__(12); var isObject = __w_pdfjs_require__(13); -var anInstance = __w_pdfjs_require__(87); +var anInstance = __w_pdfjs_require__(88); -var forOf = __w_pdfjs_require__(88); +var forOf = __w_pdfjs_require__(89); -var createArrayMethod = __w_pdfjs_require__(103); +var createArrayMethod = __w_pdfjs_require__(104); var $has = __w_pdfjs_require__(21); -var validate = __w_pdfjs_require__(109); +var validate = __w_pdfjs_require__(110); var arrayFind = createArrayMethod(5); var arrayFindIndex = createArrayMethod(6); @@ -4347,7 +4253,7 @@ module.exports = { }; /***/ }), -/* 109 */ +/* 110 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4361,7 +4267,7 @@ module.exports = function (it, TYPE) { }; /***/ }), -/* 110 */ +/* 111 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4373,23 +4279,23 @@ var $export = __w_pdfjs_require__(7); var redefine = __w_pdfjs_require__(20); -var redefineAll = __w_pdfjs_require__(97); +var redefineAll = __w_pdfjs_require__(98); -var meta = __w_pdfjs_require__(107); +var meta = __w_pdfjs_require__(108); -var forOf = __w_pdfjs_require__(88); +var forOf = __w_pdfjs_require__(89); -var anInstance = __w_pdfjs_require__(87); +var anInstance = __w_pdfjs_require__(88); var isObject = __w_pdfjs_require__(13); var fails = __w_pdfjs_require__(16); -var $iterDetect = __w_pdfjs_require__(68); +var $iterDetect = __w_pdfjs_require__(69); -var setToStringTag = __w_pdfjs_require__(59); +var setToStringTag = __w_pdfjs_require__(60); -var inheritIfRequired = __w_pdfjs_require__(111); +var inheritIfRequired = __w_pdfjs_require__(112); module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { var Base = global[NAME]; @@ -4470,7 +4376,7 @@ module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { }; /***/ }), -/* 111 */ +/* 112 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4478,7 +4384,7 @@ module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { var isObject = __w_pdfjs_require__(13); -var setPrototypeOf = __w_pdfjs_require__(112).set; +var setPrototypeOf = __w_pdfjs_require__(113).set; module.exports = function (that, target, C) { var S = target.constructor; @@ -4492,7 +4398,7 @@ module.exports = function (that, target, C) { }; /***/ }), -/* 112 */ +/* 113 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4510,7 +4416,7 @@ var check = function check(O, proto) { module.exports = { set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) { try { - set = __w_pdfjs_require__(23)(Function.call, __w_pdfjs_require__(113).f(Object.prototype, '__proto__').set, 2); + set = __w_pdfjs_require__(26)(Function.call, __w_pdfjs_require__(114).f(Object.prototype, '__proto__').set, 2); set(test, []); buggy = !(test instanceof Array); } catch (e) { @@ -4527,17 +4433,17 @@ module.exports = { }; /***/ }), -/* 113 */ +/* 114 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var pIE = __w_pdfjs_require__(73); +var pIE = __w_pdfjs_require__(74); var createDesc = __w_pdfjs_require__(19); -var toIObject = __w_pdfjs_require__(42); +var toIObject = __w_pdfjs_require__(43); var toPrimitive = __w_pdfjs_require__(18); @@ -4556,16 +4462,16 @@ exports.f = __w_pdfjs_require__(15) ? gOPD : function getOwnPropertyDescriptor(O }; /***/ }), -/* 114 */ +/* 115 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(115)('WeakMap'); +__w_pdfjs_require__(116)('WeakMap'); /***/ }), -/* 115 */ +/* 116 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4589,16 +4495,16 @@ module.exports = function (COLLECTION) { }; /***/ }), -/* 116 */ +/* 117 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(117)('WeakMap'); +__w_pdfjs_require__(118)('WeakMap'); /***/ }), -/* 117 */ +/* 118 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4606,11 +4512,11 @@ __w_pdfjs_require__(117)('WeakMap'); var $export = __w_pdfjs_require__(7); -var aFunction = __w_pdfjs_require__(24); +var aFunction = __w_pdfjs_require__(27); -var ctx = __w_pdfjs_require__(23); +var ctx = __w_pdfjs_require__(26); -var forOf = __w_pdfjs_require__(88); +var forOf = __w_pdfjs_require__(89); module.exports = function (COLLECTION) { $export($export.S, COLLECTION, { @@ -4639,38 +4545,38 @@ module.exports = function (COLLECTION) { }; /***/ }), -/* 118 */ +/* 119 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(82); - __w_pdfjs_require__(83); -__w_pdfjs_require__(119); +__w_pdfjs_require__(84); __w_pdfjs_require__(120); __w_pdfjs_require__(121); +__w_pdfjs_require__(122); + module.exports = __w_pdfjs_require__(9).WeakSet; /***/ }), -/* 119 */ +/* 120 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var weak = __w_pdfjs_require__(108); +var weak = __w_pdfjs_require__(109); -var validate = __w_pdfjs_require__(109); +var validate = __w_pdfjs_require__(110); var WEAK_SET = 'WeakSet'; -__w_pdfjs_require__(110)(WEAK_SET, function (get) { +__w_pdfjs_require__(111)(WEAK_SET, function (get) { return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; @@ -4681,36 +4587,36 @@ __w_pdfjs_require__(110)(WEAK_SET, function (get) { }, weak, false, true); /***/ }), -/* 120 */ +/* 121 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(115)('WeakSet'); +__w_pdfjs_require__(116)('WeakSet'); /***/ }), -/* 121 */ +/* 122 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(117)('WeakSet'); +__w_pdfjs_require__(118)('WeakSet'); /***/ }), -/* 122 */ +/* 123 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(123); +__w_pdfjs_require__(124); module.exports = __w_pdfjs_require__(9).String.codePointAt; /***/ }), -/* 123 */ +/* 124 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4718,7 +4624,7 @@ module.exports = __w_pdfjs_require__(9).String.codePointAt; var $export = __w_pdfjs_require__(7); -var $at = __w_pdfjs_require__(48)(false); +var $at = __w_pdfjs_require__(49)(false); $export($export.P, 'String', { codePointAt: function codePointAt(pos) { @@ -4727,18 +4633,18 @@ $export($export.P, 'String', { }); /***/ }), -/* 124 */ +/* 125 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(125); +__w_pdfjs_require__(126); module.exports = __w_pdfjs_require__(9).String.fromCodePoint; /***/ }), -/* 125 */ +/* 126 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4746,7 +4652,7 @@ module.exports = __w_pdfjs_require__(9).String.fromCodePoint; var $export = __w_pdfjs_require__(7); -var toAbsoluteIndex = __w_pdfjs_require__(44); +var toAbsoluteIndex = __w_pdfjs_require__(45); var fromCharCode = String.fromCharCode; var $fromCodePoint = String.fromCodePoint; @@ -4768,20 +4674,20 @@ $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1) }); /***/ }), -/* 126 */ +/* 127 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(127); +__w_pdfjs_require__(128); -__w_pdfjs_require__(82); +__w_pdfjs_require__(83); module.exports = __w_pdfjs_require__(9).Symbol; /***/ }), -/* 127 */ +/* 128 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -4799,45 +4705,49 @@ var $export = __w_pdfjs_require__(7); var redefine = __w_pdfjs_require__(20); -var META = __w_pdfjs_require__(107).KEY; +var META = __w_pdfjs_require__(108).KEY; var $fails = __w_pdfjs_require__(16); -var shared = __w_pdfjs_require__(31); +var shared = __w_pdfjs_require__(24); -var setToStringTag = __w_pdfjs_require__(59); +var setToStringTag = __w_pdfjs_require__(60); var uid = __w_pdfjs_require__(22); -var wks = __w_pdfjs_require__(30); +var wks = __w_pdfjs_require__(33); -var wksExt = __w_pdfjs_require__(128); +var wksExt = __w_pdfjs_require__(129); -var wksDefine = __w_pdfjs_require__(129); +var wksDefine = __w_pdfjs_require__(130); -var enumKeys = __w_pdfjs_require__(130); +var enumKeys = __w_pdfjs_require__(131); -var isArray = __w_pdfjs_require__(106); +var isArray = __w_pdfjs_require__(107); var anObject = __w_pdfjs_require__(12); var isObject = __w_pdfjs_require__(13); -var toIObject = __w_pdfjs_require__(42); +var toObject = __w_pdfjs_require__(62); + +var toIObject = __w_pdfjs_require__(43); var toPrimitive = __w_pdfjs_require__(18); var createDesc = __w_pdfjs_require__(19); -var _create = __w_pdfjs_require__(52); +var _create = __w_pdfjs_require__(53); -var gOPNExt = __w_pdfjs_require__(131); +var gOPNExt = __w_pdfjs_require__(132); -var $GOPD = __w_pdfjs_require__(113); +var $GOPD = __w_pdfjs_require__(114); + +var $GOPS = __w_pdfjs_require__(73); var $DP = __w_pdfjs_require__(11); -var $keys = __w_pdfjs_require__(54); +var $keys = __w_pdfjs_require__(55); var gOPD = $GOPD.f; var dP = $DP.f; @@ -4855,7 +4765,7 @@ var SymbolRegistry = shared('symbol-registry'); var AllSymbols = shared('symbols'); var OPSymbols = shared('op-symbols'); var ObjectProto = Object[PROTOTYPE]; -var USE_NATIVE = typeof $Symbol == 'function'; +var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f; var QObject = global.QObject; var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; var setSymbolDesc = DESCRIPTORS && $fails(function () { @@ -4992,11 +4902,11 @@ if (!USE_NATIVE) { }); $GOPD.f = $getOwnPropertyDescriptor; $DP.f = $defineProperty; - __w_pdfjs_require__(132).f = gOPNExt.f = $getOwnPropertyNames; - __w_pdfjs_require__(73).f = $propertyIsEnumerable; - __w_pdfjs_require__(72).f = $getOwnPropertySymbols; + __w_pdfjs_require__(133).f = gOPNExt.f = $getOwnPropertyNames; + __w_pdfjs_require__(74).f = $propertyIsEnumerable; + $GOPS.f = $getOwnPropertySymbols; - if (DESCRIPTORS && !__w_pdfjs_require__(32)) { + if (DESCRIPTORS && !__w_pdfjs_require__(25)) { redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } @@ -5043,6 +4953,14 @@ $export($export.S + $export.F * !USE_NATIVE, 'Object', { getOwnPropertyNames: $getOwnPropertyNames, getOwnPropertySymbols: $getOwnPropertySymbols }); +var FAILS_ON_PRIMITIVES = $fails(function () { + $GOPS.f(1); +}); +$export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', { + getOwnPropertySymbols: function getOwnPropertySymbols(it) { + return $GOPS.f(toObject(it)); + } +}); $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { var S = $Symbol(); return _stringify([S]) != '[null]' || _stringify({ @@ -5074,16 +4992,16 @@ setToStringTag(Math, 'Math', true); setToStringTag(global.JSON, 'JSON', true); /***/ }), -/* 128 */ +/* 129 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -exports.f = __w_pdfjs_require__(30); +exports.f = __w_pdfjs_require__(33); /***/ }), -/* 129 */ +/* 130 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -5093,9 +5011,9 @@ var global = __w_pdfjs_require__(8); var core = __w_pdfjs_require__(9); -var LIBRARY = __w_pdfjs_require__(32); +var LIBRARY = __w_pdfjs_require__(25); -var wksExt = __w_pdfjs_require__(128); +var wksExt = __w_pdfjs_require__(129); var defineProperty = __w_pdfjs_require__(11).f; @@ -5107,17 +5025,17 @@ module.exports = function (name) { }; /***/ }), -/* 130 */ +/* 131 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var getKeys = __w_pdfjs_require__(54); +var getKeys = __w_pdfjs_require__(55); -var gOPS = __w_pdfjs_require__(72); +var gOPS = __w_pdfjs_require__(73); -var pIE = __w_pdfjs_require__(73); +var pIE = __w_pdfjs_require__(74); module.exports = function (it) { var result = getKeys(it); @@ -5138,7 +5056,7 @@ module.exports = function (it) { }; /***/ }), -/* 131 */ +/* 132 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -5146,9 +5064,9 @@ module.exports = function (it) { function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var toIObject = __w_pdfjs_require__(42); +var toIObject = __w_pdfjs_require__(43); -var gOPN = __w_pdfjs_require__(132).f; +var gOPN = __w_pdfjs_require__(133).f; var toString = {}.toString; var windowNames = (typeof window === "undefined" ? "undefined" : _typeof(window)) == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; @@ -5166,33 +5084,33 @@ module.exports.f = function getOwnPropertyNames(it) { }; /***/ }), -/* 132 */ +/* 133 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var $keys = __w_pdfjs_require__(55); +var $keys = __w_pdfjs_require__(56); -var hiddenKeys = __w_pdfjs_require__(57).concat('length', 'prototype'); +var hiddenKeys = __w_pdfjs_require__(58).concat('length', 'prototype'); exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return $keys(O, hiddenKeys); }; /***/ }), -/* 133 */ +/* 134 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(134); +__w_pdfjs_require__(135); module.exports = __w_pdfjs_require__(9).String.padStart; /***/ }), -/* 134 */ +/* 135 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -5200,28 +5118,29 @@ module.exports = __w_pdfjs_require__(9).String.padStart; var $export = __w_pdfjs_require__(7); -var $pad = __w_pdfjs_require__(135); +var $pad = __w_pdfjs_require__(136); -var userAgent = __w_pdfjs_require__(95); +var userAgent = __w_pdfjs_require__(96); -$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { +var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent); +$export($export.P + $export.F * WEBKIT_BUG, 'String', { padStart: function padStart(maxLength) { return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); } }); /***/ }), -/* 135 */ +/* 136 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var toLength = __w_pdfjs_require__(25); +var toLength = __w_pdfjs_require__(28); -var repeat = __w_pdfjs_require__(136); +var repeat = __w_pdfjs_require__(137); -var defined = __w_pdfjs_require__(33); +var defined = __w_pdfjs_require__(34); module.exports = function (that, maxLength, fillString, left) { var S = String(defined(that)); @@ -5236,15 +5155,15 @@ module.exports = function (that, maxLength, fillString, left) { }; /***/ }), -/* 136 */ +/* 137 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var toInteger = __w_pdfjs_require__(26); +var toInteger = __w_pdfjs_require__(29); -var defined = __w_pdfjs_require__(33); +var defined = __w_pdfjs_require__(34); module.exports = function repeat(count) { var str = String(defined(this)); @@ -5260,18 +5179,18 @@ module.exports = function repeat(count) { }; /***/ }), -/* 137 */ +/* 138 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(138); +__w_pdfjs_require__(139); module.exports = __w_pdfjs_require__(9).String.padEnd; /***/ }), -/* 138 */ +/* 139 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -5279,29 +5198,30 @@ module.exports = __w_pdfjs_require__(9).String.padEnd; var $export = __w_pdfjs_require__(7); -var $pad = __w_pdfjs_require__(135); +var $pad = __w_pdfjs_require__(136); -var userAgent = __w_pdfjs_require__(95); +var userAgent = __w_pdfjs_require__(96); -$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { +var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent); +$export($export.P + $export.F * WEBKIT_BUG, 'String', { padEnd: function padEnd(maxLength) { return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); } }); /***/ }), -/* 139 */ +/* 140 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(140); +__w_pdfjs_require__(141); module.exports = __w_pdfjs_require__(9).Object.values; /***/ }), -/* 140 */ +/* 141 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -5309,7 +5229,7 @@ module.exports = __w_pdfjs_require__(9).Object.values; var $export = __w_pdfjs_require__(7); -var $values = __w_pdfjs_require__(141)(false); +var $values = __w_pdfjs_require__(142)(false); $export($export.S, 'Object', { values: function values(it) { @@ -5318,17 +5238,19 @@ $export($export.S, 'Object', { }); /***/ }), -/* 141 */ +/* 142 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var getKeys = __w_pdfjs_require__(54); +var DESCRIPTORS = __w_pdfjs_require__(15); + +var getKeys = __w_pdfjs_require__(55); -var toIObject = __w_pdfjs_require__(42); +var toIObject = __w_pdfjs_require__(43); -var isEnum = __w_pdfjs_require__(73).f; +var isEnum = __w_pdfjs_require__(74).f; module.exports = function (isEntries) { return function (it) { @@ -5340,7 +5262,9 @@ module.exports = function (isEntries) { var key; while (length > i) { - if (isEnum.call(O, key = keys[i++])) { + key = keys[i++]; + + if (!DESCRIPTORS || isEnum.call(O, key)) { result.push(isEntries ? [key, O[key]] : O[key]); } } @@ -5350,7 +5274,7 @@ module.exports = function (isEntries) { }; /***/ }), -/* 142 */ +/* 143 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -5373,12 +5297,12 @@ module.exports = function (isEntries) { if (isReadableStreamSupported) { exports.ReadableStream = ReadableStream; } else { - exports.ReadableStream = __w_pdfjs_require__(143).ReadableStream; + exports.ReadableStream = __w_pdfjs_require__(144).ReadableStream; } } /***/ }), -/* 143 */ +/* 144 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -6015,7 +5939,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (writer !== undefined) { defaultWriterClosedPromiseReject(writer, stream._storedError); - writer._closedPromise.catch(function () {}); + writer._closedPromise["catch"](function () {}); } } @@ -6063,7 +5987,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera } else if (state === 'erroring') { defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError); - this._readyPromise.catch(function () {}); + this._readyPromise["catch"](function () {}); defaultWriterClosedPromiseInitialize(this); } else if (state === 'closed') { @@ -6074,11 +5998,11 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera var storedError = stream._storedError; defaultWriterReadyPromiseInitializeAsRejected(this, storedError); - this._readyPromise.catch(function () {}); + this._readyPromise["catch"](function () {}); defaultWriterClosedPromiseInitializeAsRejected(this, storedError); - this._closedPromise.catch(function () {}); + this._closedPromise["catch"](function () {}); } } @@ -6248,7 +6172,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera defaultWriterClosedPromiseResetToRejected(writer, error); } - writer._closedPromise.catch(function () {}); + writer._closedPromise["catch"](function () {}); } function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) { @@ -6258,7 +6182,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera defaultWriterReadyPromiseResetToRejected(writer, error); } - writer._readyPromise.catch(function () {}); + writer._readyPromise["catch"](function () {}); } function WritableStreamDefaultWriterGetDesiredSize(writer) { @@ -6382,7 +6306,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera assert(stream._state === 'writable' || stream._state === 'erroring'); _this._started = true; WritableStreamDealWithRejection(stream, r); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } }]); @@ -6498,7 +6422,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera WritableStreamFinishInFlightClose(stream); }, function (reason) { WritableStreamFinishInFlightCloseWithError(stream, reason); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } function WritableStreamDefaultControllerProcessWrite(controller, chunk) { @@ -6519,7 +6443,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); }, function (reason) { WritableStreamFinishInFlightWriteWithError(stream, reason); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } function WritableStreamDefaultControllerGetBackpressure(controller) { @@ -6902,7 +6826,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera return; } - currentWrite = WritableStreamDefaultWriterWrite(writer, value).catch(function () {}); + currentWrite = WritableStreamDefaultWriterWrite(writer, value)["catch"](function () {}); }); }).then(pipeLoop); } @@ -6947,7 +6871,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera } } - pipeLoop().catch(function (err) { + pipeLoop()["catch"](function (err) { currentWrite = Promise.resolve(); rethrowAssertionErrorRejection(err); }); @@ -6963,7 +6887,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (stream._state === 'errored') { action(stream._storedError); } else { - promise.catch(action).catch(rethrowAssertionErrorRejection); + promise["catch"](action)["catch"](rethrowAssertionErrorRejection); } } @@ -6971,7 +6895,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (stream._state === 'closed') { action(); } else { - promise.then(action).catch(rethrowAssertionErrorRejection); + promise.then(action)["catch"](rethrowAssertionErrorRejection); } } @@ -6993,7 +6917,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera return finalize(originalIsError, originalError); }, function (newError) { return finalize(true, newError); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } } @@ -7007,7 +6931,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) { waitForWritesToFinish().then(function () { return finalize(isError, error); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } else { finalize(isError, error); } @@ -7128,7 +7052,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera pull._branch1 = branch1Stream._readableStreamController; pull._branch2 = branch2Stream._readableStreamController; - reader._closedPromise.catch(function (r) { + reader._closedPromise["catch"](function (r) { if (teeState.closedOrErrored === true) { return; } @@ -7329,7 +7253,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera defaultReaderClosedPromiseReject(reader, e); - reader._closedPromise.catch(function () {}); + reader._closedPromise["catch"](function () {}); } function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) { @@ -7580,7 +7504,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera assert(stream._state === 'errored', 'state must be errored'); defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError); - reader._closedPromise.catch(function () {}); + reader._closedPromise["catch"](function () {}); } } @@ -7600,7 +7524,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness')); } - reader._closedPromise.catch(function () {}); + reader._closedPromise["catch"](function () {}); reader._ownerReadableStream._reader = undefined; reader._ownerReadableStream = undefined; @@ -7668,7 +7592,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera ReadableStreamDefaultControllerCallPullIfNeeded(controller); }, function (r) { ReadableStreamDefaultControllerErrorIfNeeded(controller, r); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } _createClass(ReadableStreamDefaultController, [{ @@ -7803,7 +7727,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera return undefined; }, function (e) { ReadableStreamDefaultControllerErrorIfNeeded(controller, e); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); return undefined; } @@ -7998,7 +7922,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (stream._state === 'readable') { ReadableByteStreamControllerError(controller, r); } - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } _createClass(ReadableByteStreamController, [{ @@ -8200,7 +8124,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (controller._controlledReadableStream._state === 'readable') { ReadableByteStreamControllerError(controller, e); } - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); return undefined; } @@ -8931,7 +8855,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera } return Promise.resolve(); - }).catch(function (r) { + })["catch"](function (r) { TransformStreamErrorIfNeeded(transformStream, r); return Promise.reject(transformStream._storedError); }); @@ -9080,7 +9004,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera var transformStream = this; var startResult = InvokeOrNoop(transformer, 'start', [transformStream._transformStreamController]); startPromise_resolve(startResult); - startPromise.catch(function (e) { + startPromise["catch"](function (e) { if (transformStream._errored === false) { transformStream._errored = true; transformStream._storedError = e; @@ -9127,7 +9051,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera }])); /***/ }), -/* 144 */ +/* 145 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -9149,7 +9073,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat if (isURLSupported) { exports.URL = URL; } else { - var PolyfillURL = __w_pdfjs_require__(145).URL; + var PolyfillURL = __w_pdfjs_require__(146).URL; var OriginalURL = __w_pdfjs_require__(3).URL; @@ -9168,7 +9092,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat } /***/ }), -/* 145 */ +/* 146 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -9838,7 +9762,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat })(); /***/ }), -/* 146 */ +/* 147 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -9851,11 +9775,11 @@ exports.getDocument = getDocument; exports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory; exports.build = exports.version = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.LoopbackPort = void 0; -var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(148)); var _util = __w_pdfjs_require__(1); -var _dom_utils = __w_pdfjs_require__(151); +var _display_utils = __w_pdfjs_require__(151); var _font_loader = __w_pdfjs_require__(152); @@ -10029,7 +9953,7 @@ function getDocument(src) { } params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; - params.CMapReaderFactory = params.CMapReaderFactory || _dom_utils.DOMCMapReaderFactory; + params.CMapReaderFactory = params.CMapReaderFactory || _display_utils.DOMCMapReaderFactory; params.ignoreErrors = params.stopAtErrors !== true; params.pdfBug = params.pdfBug === true; var NativeImageDecoderValues = Object.values(_util.NativeImageDecoding); @@ -10095,6 +10019,7 @@ function getDocument(src) { networkStream = new _transport_stream.PDFDataTransportStream({ length: params.length, initialData: params.initialData, + progressiveDone: params.progressiveDone, disableRange: params.disableRange, disableStream: params.disableStream }, rangeTransport); @@ -10116,7 +10041,7 @@ function getDocument(src) { task._transport = transport; messageHandler.send('Ready', null); }); - }).catch(task._capability.reject); + })["catch"](task._capability.reject); return task; } @@ -10128,11 +10053,12 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { if (pdfDataRangeTransport) { source.length = pdfDataRangeTransport.length; source.initialData = pdfDataRangeTransport.initialData; + source.progressiveDone = pdfDataRangeTransport.progressiveDone; } return worker.messageHandler.sendWithPromise('GetDocRequest', { docId: docId, - apiVersion: '2.1.266', + apiVersion: '2.2.228', source: { data: source.data, url: source.url, @@ -10197,7 +10123,7 @@ var PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() { }, { key: "then", value: function then(onFulfilled, onRejected) { - (0, _util.deprecated)('PDFDocumentLoadingTask.then method, ' + 'use the `promise` getter instead.'); + (0, _display_utils.deprecated)('PDFDocumentLoadingTask.then method, ' + 'use the `promise` getter instead.'); return this.promise.then.apply(this.promise, arguments); } }, { @@ -10217,13 +10143,17 @@ var PDFDataRangeTransport = /*#__PURE__*/ function () { function PDFDataRangeTransport(length, initialData) { + var progressiveDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + _classCallCheck(this, PDFDataRangeTransport); this.length = length; this.initialData = initialData; + this.progressiveDone = progressiveDone; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; + this._progressiveDoneListeners = []; this._readyCapability = (0, _util.createPromiseCapability)(); } @@ -10242,6 +10172,11 @@ function () { value: function addProgressiveReadListener(listener) { this._progressiveReadListeners.push(listener); } + }, { + key: "addProgressiveDoneListener", + value: function addProgressiveDoneListener(listener) { + this._progressiveDoneListeners.push(listener); + } }, { key: "onDataRange", value: function onDataRange(begin, chunk) { @@ -10259,8 +10194,8 @@ function () { _iteratorError = err; } finally { try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); } } finally { if (_didIteratorError) { @@ -10271,7 +10206,7 @@ function () { } }, { key: "onDataProgress", - value: function onDataProgress(loaded) { + value: function onDataProgress(loaded, total) { var _this2 = this; this._readyCapability.promise.then(function () { @@ -10282,15 +10217,15 @@ function () { try { for (var _iterator2 = _this2._progressListeners[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var listener = _step2.value; - listener(loaded); + listener(loaded, total); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); + if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) { + _iterator2["return"](); } } finally { if (_didIteratorError2) { @@ -10320,8 +10255,8 @@ function () { _iteratorError3 = err; } finally { try { - if (!_iteratorNormalCompletion3 && _iterator3.return != null) { - _iterator3.return(); + if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) { + _iterator3["return"](); } } finally { if (_didIteratorError3) { @@ -10331,6 +10266,37 @@ function () { } }); } + }, { + key: "onDataProgressiveDone", + value: function onDataProgressiveDone() { + var _this4 = this; + + this._readyCapability.promise.then(function () { + var _iteratorNormalCompletion4 = true; + var _didIteratorError4 = false; + var _iteratorError4 = undefined; + + try { + for (var _iterator4 = _this4._progressiveDoneListeners[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { + var listener = _step4.value; + listener(); + } + } catch (err) { + _didIteratorError4 = true; + _iteratorError4 = err; + } finally { + try { + if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) { + _iterator4["return"](); + } + } finally { + if (_didIteratorError4) { + throw _iteratorError4; + } + } + } + }); + } }, { key: "transportReady", value: function transportReady() { @@ -10354,10 +10320,9 @@ exports.PDFDataRangeTransport = PDFDataRangeTransport; var PDFDocumentProxy = /*#__PURE__*/ function () { - function PDFDocumentProxy(pdfInfo, transport, loadingTask) { + function PDFDocumentProxy(pdfInfo, transport) { _classCallCheck(this, PDFDocumentProxy); - this.loadingTask = loadingTask; this._pdfInfo = pdfInfo; this._transport = transport; } @@ -10387,11 +10352,21 @@ function () { value: function getPageLabels() { return this._transport.getPageLabels(); } + }, { + key: "getPageLayout", + value: function getPageLayout() { + return this._transport.getPageLayout(); + } }, { key: "getPageMode", value: function getPageMode() { return this._transport.getPageMode(); } + }, { + key: "getViewerPreferences", + value: function getViewerPreferences() { + return this._transport.getViewerPreferences(); + } }, { key: "getOpenActionDestination", value: function getOpenActionDestination() { @@ -10462,6 +10437,11 @@ function () { get: function get() { return this._transport.loadingParams; } + }, { + key: "loadingTask", + get: function get() { + return this._transport.loadingTask; + } }]); return PDFDocumentProxy; @@ -10480,7 +10460,7 @@ function () { this.pageIndex = pageIndex; this._pageInfo = pageInfo; this._transport = transport; - this._stats = pdfBug ? new _dom_utils.StatTimer() : _dom_utils.DummyStatTimer; + this._stats = pdfBug ? new _display_utils.StatTimer() : _display_utils.DummyStatTimer; this._pdfBug = pdfBug; this.commonObjs = transport.commonObjs; this.objs = new PDFObjects(); @@ -10501,13 +10481,13 @@ function () { dontFlip = _ref$dontFlip === void 0 ? false : _ref$dontFlip; if (arguments.length > 1 || typeof arguments[0] === 'number') { - (0, _util.deprecated)('getViewport is called with obsolete arguments.'); + (0, _display_utils.deprecated)('getViewport is called with obsolete arguments.'); scale = arguments[0]; rotation = typeof arguments[1] === 'number' ? arguments[1] : this.rotate; dontFlip = typeof arguments[2] === 'boolean' ? arguments[2] : false; } - return new _dom_utils.PageViewport({ + return new _display_utils.PageViewport({ viewBox: this.view, scale: scale, rotation: rotation, @@ -10531,7 +10511,7 @@ function () { }, { key: "render", value: function render(_ref3) { - var _this4 = this; + var _this5 = this; var canvasContext = _ref3.canvasContext, viewport = _ref3.viewport, @@ -10553,7 +10533,7 @@ function () { stats.time('Overall'); this.pendingCleanup = false; var renderingIntent = intent === 'print' ? 'print' : 'display'; - var canvasFactoryInstance = canvasFactory || new _dom_utils.DOMCanvasFactory(); + var canvasFactoryInstance = canvasFactory || new _display_utils.DOMCanvasFactory(); var webGLContext = new _webgl.WebGLContext({ enable: enableWebGL }); @@ -10588,11 +10568,11 @@ function () { intentState.renderTasks.splice(i, 1); } - if (_this4.cleanupAfterRender) { - _this4.pendingCleanup = true; + if (_this5.cleanupAfterRender || renderingIntent === 'print') { + _this5.pendingCleanup = true; } - _this4._tryCleanup(); + _this5._tryCleanup(); if (error) { internalRenderTask.capability.reject(error); @@ -10630,7 +10610,7 @@ function () { intentState.renderTasks.push(internalRenderTask); var renderTask = internalRenderTask.task; intentState.displayReadyCapability.promise.then(function (transparency) { - if (_this4.pendingCleanup) { + if (_this5.pendingCleanup) { complete(); return; } @@ -10638,7 +10618,7 @@ function () { stats.time('Rendering'); internalRenderTask.initializeGraphics(transparency); internalRenderTask.operatorListChanged(); - }).catch(complete); + })["catch"](complete); return renderTask; } }, { @@ -10755,7 +10735,7 @@ function () { var intentState = this.intentStates[intent]; intentState.renderTasks.forEach(function (renderTask) { - var renderCompleted = renderTask.capability.promise.catch(function () {}); + var renderCompleted = renderTask.capability.promise["catch"](function () {}); waitOn.push(renderCompleted); renderTask.cancel(); }); @@ -10791,8 +10771,8 @@ function () { this.objs.clear(); this.annotationsPromise = null; - if (resetStats && this._stats instanceof _dom_utils.StatTimer) { - this._stats = new _dom_utils.StatTimer(); + if (resetStats && this._stats instanceof _display_utils.StatTimer) { + this._stats = new _display_utils.StatTimer(); } this.pendingCleanup = false; @@ -10856,7 +10836,7 @@ function () { }, { key: "stats", get: function get() { - return this._stats instanceof _dom_utils.StatTimer ? this._stats : null; + return this._stats instanceof _display_utils.StatTimer ? this._stats : null; } }]); @@ -10881,7 +10861,7 @@ function () { _createClass(LoopbackPort, [{ key: "postMessage", value: function postMessage(obj, transfers) { - var _this5 = this; + var _this6 = this; function cloneValue(value) { if (_typeof(value) !== 'object' || value === null) { @@ -10946,9 +10926,9 @@ function () { }; this._deferred.then(function () { - _this5._listeners.forEach(function (listener) { + _this6._listeners.forEach(function (listener) { listener.call(this, e); - }, _this5); + }, _this6); }); } }, { @@ -10966,7 +10946,7 @@ function () { }, { key: "terminate", value: function terminate() { - this._listeners = []; + this._listeners.length = 0; } }]); @@ -11016,7 +10996,7 @@ var PDFWorker = function PDFWorkerClosure() { } var loader = fakeWorkerFilesLoader || function () { - return (0, _dom_utils.loadScript)(_getWorkerSrc()).then(function () { + return (0, _display_utils.loadScript)(_getWorkerSrc()).then(function () { return window.pdfjsWorker.WorkerMessageHandler; }); }; @@ -11083,7 +11063,7 @@ var PDFWorker = function PDFWorkerClosure() { }, { key: "_initialize", value: function _initialize() { - var _this6 = this; + var _this7 = this; if (typeof Worker !== 'undefined' && !isWorkerDisabled && !getMainThreadWorkerMessageHandler()) { var workerSrc = _getWorkerSrc(); @@ -11101,15 +11081,15 @@ var PDFWorker = function PDFWorkerClosure() { messageHandler.destroy(); worker.terminate(); - if (_this6.destroyed) { - _this6._readyCapability.reject(new Error('Worker was destroyed')); + if (_this7.destroyed) { + _this7._readyCapability.reject(new Error('Worker was destroyed')); } else { - _this6._setupFakeWorker(); + _this7._setupFakeWorker(); } }; var onWorkerError = function onWorkerError() { - if (!_this6._webWorker) { + if (!_this7._webWorker) { terminateEarly(); } }; @@ -11118,27 +11098,27 @@ var PDFWorker = function PDFWorkerClosure() { messageHandler.on('test', function (data) { worker.removeEventListener('error', onWorkerError); - if (_this6.destroyed) { + if (_this7.destroyed) { terminateEarly(); return; } if (data && data.supportTypedArray) { - _this6._messageHandler = messageHandler; - _this6._port = worker; - _this6._webWorker = worker; + _this7._messageHandler = messageHandler; + _this7._port = worker; + _this7._webWorker = worker; if (!data.supportTransfers) { - _this6.postMessageTransfers = false; + _this7.postMessageTransfers = false; } - _this6._readyCapability.resolve(); + _this7._readyCapability.resolve(); messageHandler.send('configure', { - verbosity: _this6.verbosity + verbosity: _this7.verbosity }); } else { - _this6._setupFakeWorker(); + _this7._setupFakeWorker(); messageHandler.destroy(); worker.terminate(); @@ -11147,7 +11127,7 @@ var PDFWorker = function PDFWorkerClosure() { messageHandler.on('ready', function (data) { worker.removeEventListener('error', onWorkerError); - if (_this6.destroyed) { + if (_this7.destroyed) { terminateEarly(); return; } @@ -11155,12 +11135,12 @@ var PDFWorker = function PDFWorkerClosure() { try { sendTest(); } catch (e) { - _this6._setupFakeWorker(); + _this7._setupFakeWorker(); } }); var sendTest = function sendTest() { - var testObj = new Uint8Array([_this6.postMessageTransfers ? 255 : 0]); + var testObj = new Uint8Array([_this7.postMessageTransfers ? 255 : 0]); try { messageHandler.send('test', testObj, [testObj.buffer]); @@ -11183,7 +11163,7 @@ var PDFWorker = function PDFWorkerClosure() { }, { key: "_setupFakeWorker", value: function _setupFakeWorker() { - var _this7 = this; + var _this8 = this; if (!isWorkerDisabled) { (0, _util.warn)('Setting up fake worker.'); @@ -11191,23 +11171,23 @@ var PDFWorker = function PDFWorkerClosure() { } setupFakeWorkerGlobal().then(function (WorkerMessageHandler) { - if (_this7.destroyed) { - _this7._readyCapability.reject(new Error('Worker was destroyed')); + if (_this8.destroyed) { + _this8._readyCapability.reject(new Error('Worker was destroyed')); return; } var port = new LoopbackPort(); - _this7._port = port; + _this8._port = port; var id = 'fake' + nextFakeWorkerId++; var workerHandler = new _message_handler.MessageHandler(id + '_worker', id, port); WorkerMessageHandler.setup(workerHandler, port); var messageHandler = new _message_handler.MessageHandler(id, id + '_worker', port); - _this7._messageHandler = messageHandler; + _this8._messageHandler = messageHandler; - _this7._readyCapability.resolve(); - }).catch(function (reason) { - _this7._readyCapability.reject(new Error("Setting up fake worker failed: \"".concat(reason.message, "\"."))); + _this8._readyCapability.resolve(); + })["catch"](function (reason) { + _this8._readyCapability.reject(new Error("Setting up fake worker failed: \"".concat(reason.message, "\"."))); }); } }, { @@ -11221,7 +11201,7 @@ var PDFWorker = function PDFWorkerClosure() { this._webWorker = null; } - pdfWorkerPorts.delete(this._port); + pdfWorkerPorts["delete"](this._port); this._port = null; if (this._messageHandler) { @@ -11306,7 +11286,7 @@ function () { _createClass(WorkerTransport, [{ key: "destroy", value: function destroy() { - var _this8 = this; + var _this9 = this; if (this.destroyCapability) { return this.destroyCapability.promise; @@ -11325,24 +11305,24 @@ function () { waitOn.push(page._destroy()); } }); - this.pageCache = []; - this.pagePromises = []; + this.pageCache.length = 0; + this.pagePromises.length = 0; var terminated = this.messageHandler.sendWithPromise('Terminate', null); waitOn.push(terminated); Promise.all(waitOn).then(function () { - _this8.fontLoader.clear(); + _this9.fontLoader.clear(); - if (_this8._networkStream) { - _this8._networkStream.cancelAllRequests(); + if (_this9._networkStream) { + _this9._networkStream.cancelAllRequests(); } - if (_this8.messageHandler) { - _this8.messageHandler.destroy(); + if (_this9.messageHandler) { + _this9.messageHandler.destroy(); - _this8.messageHandler = null; + _this9.messageHandler = null; } - _this8.destroyCapability.resolve(); + _this9.destroyCapability.resolve(); }, this.destroyCapability.reject); return this.destroyCapability.promise; } @@ -11352,20 +11332,20 @@ function () { var messageHandler = this.messageHandler, loadingTask = this.loadingTask; messageHandler.on('GetReader', function (data, sink) { - var _this9 = this; + var _this10 = this; (0, _util.assert)(this._networkStream); this._fullReader = this._networkStream.getFullReader(); this._fullReader.onProgress = function (evt) { - _this9._lastProgress = { + _this10._lastProgress = { loaded: evt.loaded, total: evt.total }; }; sink.onPull = function () { - _this9._fullReader.read().then(function (_ref7) { + _this10._fullReader.read().then(function (_ref7) { var value = _ref7.value, done = _ref7.done; @@ -11376,24 +11356,24 @@ function () { (0, _util.assert)((0, _util.isArrayBuffer)(value)); sink.enqueue(new Uint8Array(value), 1, [value]); - }).catch(function (reason) { + })["catch"](function (reason) { sink.error(reason); }); }; sink.onCancel = function (reason) { - _this9._fullReader.cancel(reason); + _this10._fullReader.cancel(reason); }; }, this); messageHandler.on('ReaderHeadersReady', function (data) { - var _this10 = this; + var _this11 = this; var headersCapability = (0, _util.createPromiseCapability)(); var fullReader = this._fullReader; fullReader.headersReady.then(function () { if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) { - if (_this10._lastProgress && loadingTask.onProgress) { - loadingTask.onProgress(_this10._lastProgress); + if (_this11._lastProgress && loadingTask.onProgress) { + loadingTask.onProgress(_this11._lastProgress); } fullReader.onProgress = function (evt) { @@ -11419,6 +11399,11 @@ function () { var rangeReader = this._networkStream.getRangeReader(data.begin, data.end); + if (!rangeReader) { + sink.close(); + return; + } + sink.onPull = function () { rangeReader.read().then(function (_ref8) { var value = _ref8.value, @@ -11431,7 +11416,7 @@ function () { (0, _util.assert)((0, _util.isArrayBuffer)(value)); sink.enqueue(new Uint8Array(value), 1, [value]); - }).catch(function (reason) { + })["catch"](function (reason) { sink.error(reason); }); }; @@ -11442,19 +11427,18 @@ function () { }, this); messageHandler.on('GetDoc', function (_ref9) { var pdfInfo = _ref9.pdfInfo; - this.numPages = pdfInfo.numPages; - this.pdfDocument = new PDFDocumentProxy(pdfInfo, this, loadingTask); + this._numPages = pdfInfo.numPages; - loadingTask._capability.resolve(this.pdfDocument); + loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this)); }, this); messageHandler.on('PasswordRequest', function (exception) { - var _this11 = this; + var _this12 = this; this._passwordCapability = (0, _util.createPromiseCapability)(); if (loadingTask.onPassword) { var updatePassword = function updatePassword(password) { - _this11._passwordCapability.resolve({ + _this12._passwordCapability.resolve({ password: password }); }; @@ -11516,7 +11500,7 @@ function () { page._renderPageChunk(data.operatorList, data.intent); }, this); messageHandler.on('commonobj', function (data) { - var _this12 = this; + var _this13 = this; if (this.destroyed) { return; @@ -11544,10 +11528,10 @@ function () { var fontRegistry = null; - if (params.pdfBug && _global_scope.default.FontInspector && _global_scope.default.FontInspector.enabled) { + if (params.pdfBug && _global_scope["default"].FontInspector && _global_scope["default"].FontInspector.enabled) { fontRegistry = { registerFont: function registerFont(font, url) { - _global_scope.default['FontInspector'].fontAdded(font, url); + _global_scope["default"]['FontInspector'].fontAdded(font, url); } }; } @@ -11560,17 +11544,18 @@ function () { fontRegistry: fontRegistry }); this.fontLoader.bind(font).then(function () { - _this12.commonObjs.resolve(id, font); + _this13.commonObjs.resolve(id, font); }, function (reason) { messageHandler.sendWithPromise('FontFallback', { id: id - }).finally(function () { - _this12.commonObjs.resolve(id, font); + })["finally"](function () { + _this13.commonObjs.resolve(id, font); }); }); break; case 'FontPath': + case 'FontType3Res': this.commonObjs.resolve(id, exportedData); break; @@ -11580,7 +11565,7 @@ function () { }, this); messageHandler.on('obj', function (data) { if (this.destroyed) { - return; + return undefined; } var _data2 = _slicedToArray(data, 4), @@ -11592,7 +11577,7 @@ function () { var pageProxy = this.pageCache[pageIndex]; if (pageProxy.objs.has(id)) { - return; + return undefined; } switch (type) { @@ -11606,6 +11591,7 @@ function () { img.onerror = function () { reject(new Error('Error during JPEG image loading')); + (0, _display_utils.releaseImageResources)(img); }; img.src = imageData; @@ -11626,6 +11612,8 @@ function () { default: throw new Error("Got unknown object type ".concat(type)); } + + return undefined; }, this); messageHandler.on('DocProgress', function (data) { if (this.destroyed) { @@ -11644,11 +11632,11 @@ function () { return; } - var page = this.pageCache[data.pageNum - 1]; + var page = this.pageCache[data.pageIndex]; var intentState = page.intentStates[data.intent]; if (intentState.displayReadyCapability) { - intentState.displayReadyCapability.reject(data.error); + intentState.displayReadyCapability.reject(new Error(data.error)); } else { throw new Error(data.error); } @@ -11683,8 +11671,8 @@ function () { var img = new Image(); img.onload = function () { - var width = img.width; - var height = img.height; + var width = img.width, + height = img.height; var size = width * height; var rgbaLength = size * 4; var buf = new Uint8ClampedArray(size * components); @@ -11712,10 +11700,16 @@ function () { width: width, height: height }); + (0, _display_utils.releaseImageResources)(img); + tmpCanvas.width = 0; + tmpCanvas.height = 0; + tmpCanvas = null; + tmpCtx = null; }; img.onerror = function () { reject(new Error('JpegDecode failed to load image')); + (0, _display_utils.releaseImageResources)(img); }; img.src = imageUrl; @@ -11752,9 +11746,9 @@ function () { }, { key: "getPage", value: function getPage(pageNumber) { - var _this13 = this; + var _this14 = this; - if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this.numPages) { + if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) { return Promise.reject(new Error('Invalid page request')); } @@ -11767,12 +11761,12 @@ function () { var promise = this.messageHandler.sendWithPromise('GetPage', { pageIndex: pageIndex }).then(function (pageInfo) { - if (_this13.destroyed) { + if (_this14.destroyed) { throw new Error('Transport destroyed'); } - var page = new PDFPageProxy(pageIndex, pageInfo, _this13, _this13._params.pdfBug); - _this13.pageCache[pageIndex] = page; + var page = new PDFPageProxy(pageIndex, pageInfo, _this14, _this14._params.pdfBug); + _this14.pageCache[pageIndex] = page; return page; }); this.pagePromises[pageIndex] = promise; @@ -11783,7 +11777,7 @@ function () { value: function getPageIndex(ref) { return this.messageHandler.sendWithPromise('GetPageIndex', { ref: ref - }).catch(function (reason) { + })["catch"](function (reason) { return Promise.reject(new Error(reason)); }); } @@ -11816,15 +11810,25 @@ function () { value: function getPageLabels() { return this.messageHandler.sendWithPromise('GetPageLabels', null); } + }, { + key: "getPageLayout", + value: function getPageLayout() { + return this.messageHandler.sendWithPromise('GetPageLayout', null); + } }, { key: "getPageMode", value: function getPageMode() { return this.messageHandler.sendWithPromise('GetPageMode', null); } + }, { + key: "getViewerPreferences", + value: function getViewerPreferences() { + return this.messageHandler.sendWithPromise('GetViewerPreferences', null); + } }, { key: "getOpenActionDestination", value: function getOpenActionDestination() { - return this.messageHandler.sendWithPromise('getOpenActionDestination', null); + return this.messageHandler.sendWithPromise('GetOpenActionDestination', null); } }, { key: "getAttachments", @@ -11849,13 +11853,13 @@ function () { }, { key: "getMetadata", value: function getMetadata() { - var _this14 = this; + var _this15 = this; return this.messageHandler.sendWithPromise('GetMetadata', null).then(function (results) { return { info: results[0], metadata: results[1] ? new _metadata.Metadata(results[1]) : null, - contentDispositionFilename: _this14._fullReader ? _this14._fullReader.filename : null + contentDispositionFilename: _this15._fullReader ? _this15._fullReader.filename : null }; }); } @@ -11867,20 +11871,20 @@ function () { }, { key: "startCleanup", value: function startCleanup() { - var _this15 = this; + var _this16 = this; this.messageHandler.sendWithPromise('Cleanup', null).then(function () { - for (var i = 0, ii = _this15.pageCache.length; i < ii; i++) { - var page = _this15.pageCache[i]; + for (var i = 0, ii = _this16.pageCache.length; i < ii; i++) { + var page = _this16.pageCache[i]; if (page) { page.cleanup(); } } - _this15.commonObjs.clear(); + _this16.commonObjs.clear(); - _this15.fontLoader.clear(); + _this16.fontLoader.clear(); }); } }, { @@ -11958,6 +11962,14 @@ function () { }, { key: "clear", value: function clear() { + for (var objId in this._objs) { + var data = this._objs[objId].data; + + if (typeof Image !== 'undefined' && data instanceof Image) { + (0, _display_utils.releaseImageResources)(data); + } + } + this._objs = Object.create(null); } }]); @@ -11983,7 +11995,7 @@ function () { }, { key: "then", value: function then(onFulfilled, onRejected) { - (0, _util.deprecated)('RenderTask.then method, use the `promise` getter instead.'); + (0, _display_utils.deprecated)('RenderTask.then method, use the `promise` getter instead.'); return this.promise.then.apply(this.promise, arguments); } }, { @@ -12058,8 +12070,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { canvasInRendering.add(this._canvas); } - if (this._pdfBug && _global_scope.default.StepperManager && _global_scope.default.StepperManager.enabled) { - this.stepper = _global_scope.default.StepperManager.create(this.pageNumber - 1); + if (this._pdfBug && _global_scope["default"].StepperManager && _global_scope["default"].StepperManager.enabled) { + this.stepper = _global_scope["default"].StepperManager.create(this.pageNumber - 1); this.stepper.init(this.operatorList); this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); } @@ -12096,10 +12108,10 @@ var InternalRenderTask = function InternalRenderTaskClosure() { } if (this._canvas) { - canvasInRendering.delete(this._canvas); + canvasInRendering["delete"](this._canvas); } - this.callback(error || new _dom_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this.pageNumber), 'canvas')); + this.callback(error || new _display_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this.pageNumber), 'canvas')); } }, { key: "operatorListChanged", @@ -12140,14 +12152,14 @@ var InternalRenderTask = function InternalRenderTaskClosure() { }, { key: "_scheduleNext", value: function _scheduleNext() { - var _this16 = this; + var _this17 = this; if (this._useRequestAnimationFrame) { window.requestAnimationFrame(function () { - _this16._nextBound().catch(_this16.cancel.bind(_this16)); + _this17._nextBound()["catch"](_this17.cancel.bind(_this17)); }); } else { - Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this)); + Promise.resolve().then(this._nextBound)["catch"](this.cancel.bind(this)); } } }, { @@ -12155,8 +12167,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { value: function () { var _next2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee() { - return _regenerator.default.wrap(function _callee$(_context) { + _regenerator["default"].mark(function _callee() { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -12177,7 +12189,7 @@ var InternalRenderTask = function InternalRenderTaskClosure() { this.gfx.endDrawing(); if (this._canvas) { - canvasInRendering.delete(this._canvas); + canvasInRendering["delete"](this._canvas); } this.callback(); @@ -12206,20 +12218,11 @@ var InternalRenderTask = function InternalRenderTaskClosure() { return InternalRenderTask; }(); -var version = '2.1.266'; +var version = '2.2.228'; exports.version = version; -var build = '81f5835c'; +var build = 'd7afb74a'; exports.build = build; -/***/ }), -/* 147 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -module.exports = __w_pdfjs_require__(148); - /***/ }), /* 148 */ /***/ (function(module, exports, __w_pdfjs_require__) { @@ -12227,27 +12230,8 @@ module.exports = __w_pdfjs_require__(148); "use strict"; -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var g = function () { - return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; -}() || Function("return this")(); - -var hadRuntime = g.regeneratorRuntime && Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; -var oldRuntime = hadRuntime && g.regeneratorRuntime; -g.regeneratorRuntime = undefined; module.exports = __w_pdfjs_require__(149); -if (hadRuntime) { - g.regeneratorRuntime = oldRuntime; -} else { - try { - delete g.regeneratorRuntime; - } catch (e) { - g.regeneratorRuntime = undefined; - } -} - /***/ }), /* 149 */ /***/ (function(module, exports, __w_pdfjs_require__) { @@ -12257,7 +12241,7 @@ if (hadRuntime) { function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -!function (global) { +var runtime = function (exports) { "use strict"; var Op = Object.prototype; @@ -12267,18 +12251,6 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - var inModule = ( false ? undefined : _typeof(module)) === "object"; - var runtime = global.regeneratorRuntime; - - if (runtime) { - if (inModule) { - module.exports = runtime; - } - - return; - } - - runtime = global.regeneratorRuntime = inModule ? module.exports : {}; function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; @@ -12288,7 +12260,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return generator; } - runtime.wrap = wrap; + exports.wrap = wrap; function tryCatch(fn, obj, arg) { try { @@ -12342,12 +12314,12 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat }); } - runtime.isGeneratorFunction = function (genFun) { + exports.isGeneratorFunction = function (genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; - runtime.mark = function (genFun) { + exports.mark = function (genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { @@ -12362,7 +12334,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return genFun; }; - runtime.awrap = function (arg) { + exports.awrap = function (arg) { return { __await: arg }; @@ -12416,11 +12388,11 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return this; }; - runtime.AsyncIterator = AsyncIterator; + exports.AsyncIterator = AsyncIterator; - runtime.async = function (innerFn, outerFn, self, tryLocsList) { + exports.async = function (innerFn, outerFn, self, tryLocsList) { var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); - return runtime.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { + return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }; @@ -12498,7 +12470,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat context.delegate = null; if (context.method === "throw") { - if (delegate.iterator.return) { + if (delegate.iterator["return"]) { context.method = "return"; context.arg = undefined; maybeInvokeDelegate(delegate, context); @@ -12592,7 +12564,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat this.reset(true); } - runtime.keys = function (object) { + exports.keys = function (object) { var keys = []; for (var key in object) { @@ -12653,7 +12625,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat }; } - runtime.values = values; + exports.values = values; function doneResult() { return { @@ -12831,9 +12803,14 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return ContinueSentinel; } }; -}(function () { - return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; -}() || Function("return this")()); + return exports; +}(( false ? undefined : _typeof(module)) === "object" ? module.exports : {}); + +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + Function("r", "regeneratorRuntime = r")(runtime); +} /* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(150)(module))) /***/ }), @@ -12879,11 +12856,23 @@ Object.defineProperty(exports, "__esModule", { }); exports.addLinkAttributes = addLinkAttributes; exports.getFilenameFromUrl = getFilenameFromUrl; +exports.isFetchSupported = isFetchSupported; +exports.isValidFetchUrl = isValidFetchUrl; exports.loadScript = loadScript; -exports.DummyStatTimer = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0; +exports.deprecated = deprecated; +exports.releaseImageResources = releaseImageResources; +exports.PDFDateString = exports.DummyStatTimer = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(148)); var _util = __w_pdfjs_require__(1); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } @@ -12905,7 +12894,7 @@ function () { key: "create", value: function create(width, height) { if (width <= 0 || height <= 0) { - throw new Error('invalid canvas size'); + throw new Error('Invalid canvas size'); } var canvas = document.createElement('canvas'); @@ -12921,11 +12910,11 @@ function () { key: "reset", value: function reset(canvasAndContext, width, height) { if (!canvasAndContext.canvas) { - throw new Error('canvas is not specified'); + throw new Error('Canvas is not specified'); } if (width <= 0 || height <= 0) { - throw new Error('invalid canvas size'); + throw new Error('Invalid canvas size'); } canvasAndContext.canvas.width = width; @@ -12935,7 +12924,7 @@ function () { key: "destroy", value: function destroy(canvasAndContext) { if (!canvasAndContext.canvas) { - throw new Error('canvas is not specified'); + throw new Error('Canvas is not specified'); } canvasAndContext.canvas.width = 0; @@ -12967,58 +12956,172 @@ function () { _createClass(DOMCMapReaderFactory, [{ key: "fetch", - value: function fetch(_ref2) { - var _this = this; - - var name = _ref2.name; - - if (!this.baseUrl) { - return Promise.reject(new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.')); + value: function (_fetch) { + function fetch(_x) { + return _fetch.apply(this, arguments); } - if (!name) { - return Promise.reject(new Error('CMap name must be specified.')); - } + fetch.toString = function () { + return _fetch.toString(); + }; - return new Promise(function (resolve, reject) { - var url = _this.baseUrl + name + (_this.isCompressed ? '.bcmap' : ''); - var request = new XMLHttpRequest(); - request.open('GET', url, true); + return fetch; + }( + /*#__PURE__*/ + function () { + var _ref3 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee2(_ref2) { + var _this = this; - if (_this.isCompressed) { - request.responseType = 'arraybuffer'; - } + var name, url, compressionType; + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + name = _ref2.name; - request.onreadystatechange = function () { - if (request.readyState !== XMLHttpRequest.DONE) { - return; - } + if (this.baseUrl) { + _context2.next = 3; + break; + } - if (request.status === 200 || request.status === 0) { - var data; + throw new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.'); - if (_this.isCompressed && request.response) { - data = new Uint8Array(request.response); - } else if (!_this.isCompressed && request.responseText) { - data = (0, _util.stringToBytes)(request.responseText); - } + case 3: + if (name) { + _context2.next = 5; + break; + } - if (data) { - resolve({ - cMapData: data, - compressionType: _this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE - }); - return; - } - } + throw new Error('CMap name must be specified.'); - reject(new Error('Unable to load ' + (_this.isCompressed ? 'binary ' : '') + 'CMap at: ' + url)); - }; + case 5: + url = this.baseUrl + name + (this.isCompressed ? '.bcmap' : ''); + compressionType = this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE; - request.send(null); - }); - } - }]); + if (!(isFetchSupported() && isValidFetchUrl(url, document.baseURI))) { + _context2.next = 9; + break; + } + + return _context2.abrupt("return", fetch(url).then( + /*#__PURE__*/ + function () { + var _ref4 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee(response) { + var cMapData; + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (response.ok) { + _context.next = 2; + break; + } + + throw new Error(response.statusText); + + case 2: + if (!_this.isCompressed) { + _context.next = 10; + break; + } + + _context.t0 = Uint8Array; + _context.next = 6; + return response.arrayBuffer(); + + case 6: + _context.t1 = _context.sent; + cMapData = new _context.t0(_context.t1); + _context.next = 15; + break; + + case 10: + _context.t2 = _util.stringToBytes; + _context.next = 13; + return response.text(); + + case 13: + _context.t3 = _context.sent; + cMapData = (0, _context.t2)(_context.t3); + + case 15: + return _context.abrupt("return", { + cMapData: cMapData, + compressionType: compressionType + }); + + case 16: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + + return function (_x3) { + return _ref4.apply(this, arguments); + }; + }())["catch"](function (reason) { + throw new Error("Unable to load ".concat(_this.isCompressed ? 'binary ' : '') + "CMap at: ".concat(url)); + })); + + case 9: + return _context2.abrupt("return", new Promise(function (resolve, reject) { + var request = new XMLHttpRequest(); + request.open('GET', url, true); + + if (_this.isCompressed) { + request.responseType = 'arraybuffer'; + } + + request.onreadystatechange = function () { + if (request.readyState !== XMLHttpRequest.DONE) { + return; + } + + if (request.status === 200 || request.status === 0) { + var cMapData; + + if (_this.isCompressed && request.response) { + cMapData = new Uint8Array(request.response); + } else if (!_this.isCompressed && request.responseText) { + cMapData = (0, _util.stringToBytes)(request.responseText); + } + + if (cMapData) { + resolve({ + cMapData: cMapData, + compressionType: compressionType + }); + return; + } + } + + reject(new Error(request.statusText)); + }; + + request.send(null); + })["catch"](function (reason) { + throw new Error("Unable to load ".concat(_this.isCompressed ? 'binary ' : '') + "CMap at: ".concat(url)); + })); + + case 10: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + return function (_x2) { + return _ref3.apply(this, arguments); + }; + }()) + }]); return DOMCMapReaderFactory; }(); @@ -13060,16 +13163,16 @@ exports.DOMSVGFactory = DOMSVGFactory; var PageViewport = /*#__PURE__*/ function () { - function PageViewport(_ref3) { - var viewBox = _ref3.viewBox, - scale = _ref3.scale, - rotation = _ref3.rotation, - _ref3$offsetX = _ref3.offsetX, - offsetX = _ref3$offsetX === void 0 ? 0 : _ref3$offsetX, - _ref3$offsetY = _ref3.offsetY, - offsetY = _ref3$offsetY === void 0 ? 0 : _ref3$offsetY, - _ref3$dontFlip = _ref3.dontFlip, - dontFlip = _ref3$dontFlip === void 0 ? false : _ref3$dontFlip; + function PageViewport(_ref5) { + var viewBox = _ref5.viewBox, + scale = _ref5.scale, + rotation = _ref5.rotation, + _ref5$offsetX = _ref5.offsetX, + offsetX = _ref5$offsetX === void 0 ? 0 : _ref5$offsetX, + _ref5$offsetY = _ref5.offsetY, + offsetY = _ref5$offsetY === void 0 ? 0 : _ref5$offsetY, + _ref5$dontFlip = _ref5.dontFlip, + dontFlip = _ref5$dontFlip === void 0 ? false : _ref5$dontFlip; _classCallCheck(this, PageViewport); @@ -13142,13 +13245,13 @@ function () { _createClass(PageViewport, [{ key: "clone", value: function clone() { - var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref4$scale = _ref4.scale, - scale = _ref4$scale === void 0 ? this.scale : _ref4$scale, - _ref4$rotation = _ref4.rotation, - rotation = _ref4$rotation === void 0 ? this.rotation : _ref4$rotation, - _ref4$dontFlip = _ref4.dontFlip, - dontFlip = _ref4$dontFlip === void 0 ? false : _ref4$dontFlip; + var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref6$scale = _ref6.scale, + scale = _ref6$scale === void 0 ? this.scale : _ref6$scale, + _ref6$rotation = _ref6.rotation, + rotation = _ref6$rotation === void 0 ? this.rotation : _ref6$rotation, + _ref6$dontFlip = _ref6.dontFlip, + dontFlip = _ref6$dontFlip === void 0 ? false : _ref6$dontFlip; return new PageViewport({ viewBox: this.viewBox.slice(), @@ -13167,11 +13270,11 @@ function () { }, { key: "convertToViewportRectangle", value: function convertToViewportRectangle(rect) { - var tl = _util.Util.applyTransform([rect[0], rect[1]], this.transform); + var topLeft = _util.Util.applyTransform([rect[0], rect[1]], this.transform); - var br = _util.Util.applyTransform([rect[2], rect[3]], this.transform); + var bottomRight = _util.Util.applyTransform([rect[2], rect[3]], this.transform); - return [tl[0], tl[1], br[0], br[1]]; + return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]]; } }, { key: "convertToPdfPoint", @@ -13209,10 +13312,10 @@ exports.LinkTarget = LinkTarget; var LinkTargetStringMap = ['', '_self', '_blank', '_parent', '_top']; function addLinkAttributes(link) { - var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - url = _ref5.url, - target = _ref5.target, - rel = _ref5.rel; + var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + url = _ref7.url, + target = _ref7.target, + rel = _ref7.rel; link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : ''; @@ -13278,22 +13381,59 @@ function () { }, { key: "toString", value: function toString() { - var times = this.times; var out = '', longest = 0; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; - for (var i = 0, ii = times.length; i < ii; ++i) { - var name = times[i]['name']; + try { + for (var _iterator = this.times[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var time = _step.value; + var name = time.name; - if (name.length > longest) { - longest = name.length; + if (name.length > longest) { + longest = name.length; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } } } - for (var _i = 0, _ii = times.length; _i < _ii; ++_i) { - var span = times[_i]; - var duration = span.end - span.start; - out += "".concat(span['name'].padEnd(longest), " ").concat(duration, "ms\n"); + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + + try { + for (var _iterator2 = this.times[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var _time = _step2.value; + var duration = _time.end - _time.start; + out += "".concat(_time.name.padEnd(longest), " ").concat(duration, "ms\n"); + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) { + _iterator2["return"](); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } } return out; @@ -13332,6 +13472,21 @@ function () { exports.DummyStatTimer = DummyStatTimer; +function isFetchSupported() { + return typeof fetch !== 'undefined' && typeof Response !== 'undefined' && 'body' in Response.prototype && typeof ReadableStream !== 'undefined'; +} + +function isValidFetchUrl(url, baseUrl) { + try { + var _ref8 = baseUrl ? new _util.URL(url, baseUrl) : new _util.URL(url), + protocol = _ref8.protocol; + + return protocol === 'http:' || protocol === 'https:'; + } catch (ex) { + return false; + } +} + function loadScript(src) { return new Promise(function (resolve, reject) { var script = document.createElement('script'); @@ -13346,6 +13501,81 @@ function loadScript(src) { }); } +function deprecated(details) { + console.log('Deprecated API usage: ' + details); +} + +function releaseImageResources(img) { + (0, _util.assert)(img instanceof Image, 'Invalid `img` parameter.'); + var url = img.src; + + if (typeof url === 'string' && url.startsWith('blob:') && _util.URL.revokeObjectURL) { + _util.URL.revokeObjectURL(url); + } + + img.removeAttribute('src'); +} + +var pdfDateStringRegex; + +var PDFDateString = +/*#__PURE__*/ +function () { + function PDFDateString() { + _classCallCheck(this, PDFDateString); + } + + _createClass(PDFDateString, null, [{ + key: "toDateObject", + value: function toDateObject(input) { + if (!input || !(0, _util.isString)(input)) { + return null; + } + + if (!pdfDateStringRegex) { + pdfDateStringRegex = new RegExp('^D:' + '(\\d{4})' + '(\\d{2})?' + '(\\d{2})?' + '(\\d{2})?' + '(\\d{2})?' + '(\\d{2})?' + '([Z|+|-])?' + '(\\d{2})?' + '\'?' + '(\\d{2})?' + '\'?'); + } + + var matches = pdfDateStringRegex.exec(input); + + if (!matches) { + return null; + } + + var year = parseInt(matches[1], 10); + var month = parseInt(matches[2], 10); + month = month >= 1 && month <= 12 ? month - 1 : 0; + var day = parseInt(matches[3], 10); + day = day >= 1 && day <= 31 ? day : 1; + var hour = parseInt(matches[4], 10); + hour = hour >= 0 && hour <= 23 ? hour : 0; + var minute = parseInt(matches[5], 10); + minute = minute >= 0 && minute <= 59 ? minute : 0; + var second = parseInt(matches[6], 10); + second = second >= 0 && second <= 59 ? second : 0; + var universalTimeRelation = matches[7] || 'Z'; + var offsetHour = parseInt(matches[8], 10); + offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0; + var offsetMinute = parseInt(matches[9], 10) || 0; + offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0; + + if (universalTimeRelation === '-') { + hour += offsetHour; + minute += offsetMinute; + } else if (universalTimeRelation === '+') { + hour -= offsetHour; + minute -= offsetMinute; + } + + return new Date(Date.UTC(year, month, day, hour, minute, second)); + } + }]); + + return PDFDateString; +}(); + +exports.PDFDateString = PDFDateString; + /***/ }), /* 152 */ /***/ (function(module, exports, __w_pdfjs_require__) { @@ -13358,11 +13588,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.FontLoader = exports.FontFaceObject = void 0; -var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(148)); var _util = __w_pdfjs_require__(1); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -13429,7 +13659,7 @@ function () { key: "clear", value: function clear() { this.nativeFontFaces.forEach(function (nativeFontFace) { - document.fonts.delete(nativeFontFace); + document.fonts["delete"](nativeFontFace); }); this.nativeFontFaces.length = 0; @@ -13443,11 +13673,11 @@ function () { value: function () { var _bind = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(font) { + _regenerator["default"].mark(function _callee(font) { var _this = this; var nativeFontFace, rule; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -13456,7 +13686,7 @@ function () { break; } - return _context.abrupt("return"); + return _context.abrupt("return", undefined); case 2: font.attached = true; @@ -13495,7 +13725,7 @@ function () { throw _context.t0; case 18: - return _context.abrupt("return"); + return _context.abrupt("return", undefined); case 19: rule = font.createFontFaceRule(); @@ -13512,7 +13742,7 @@ function () { break; } - return _context.abrupt("return"); + return _context.abrupt("return", undefined); case 24: return _context.abrupt("return", new Promise(function (resolve) { @@ -13522,6 +13752,9 @@ function () { })); case 25: + return _context.abrupt("return", undefined); + + case 26: case "end": return _context.stop(); } @@ -14207,7 +14440,10 @@ function compileType3Glyph(imgData) { coords.push(p % width1); coords.push(p / width1 | 0); - --count; + + if (!points[p]) { + --count; + } } while (p0 !== p); outlines.push(coords); @@ -14651,16 +14887,32 @@ var CanvasGraphics = function CanvasGraphicsClosure() { if (fnId !== _util.OPS.dependency) { this[fnId].apply(this, argsArray[i]); } else { - var deps = argsArray[i]; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; - for (var n = 0, nn = deps.length; n < nn; n++) { - var depObjId = deps[n]; - var common = depObjId[0] === 'g' && depObjId[1] === '_'; - var objsPool = common ? commonObjs : objs; + try { + for (var _iterator = argsArray[i][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var depObjId = _step.value; + var objsPool = depObjId.startsWith('g_') ? commonObjs : objs; - if (!objsPool.has(depObjId)) { - objsPool.get(depObjId, continueCallback); - return i; + if (!objsPool.has(depObjId)) { + objsPool.get(depObjId, continueCallback); + return i; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } } } } @@ -14725,8 +14977,8 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.lineDashOffset = dashPhase; } }, - setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) {}, - setFlatness: function CanvasGraphics_setFlatness(flatness) {}, + setRenderingIntent: function setRenderingIntent(intent) {}, + setFlatness: function setFlatness(flatness) {}, setGState: function CanvasGraphics_setGState(states) { for (var i = 0, ii = states.length; i < ii; i++) { var state = states[i]; @@ -15207,7 +15459,9 @@ var CanvasGraphics = function CanvasGraphicsClosure() { }, get isFontSubpixelAAEnabled() { - var ctx = this.canvasFactory.create(10, 10).context; + var _this$cachedCanvases$ = this.cachedCanvases.getCanvas('isFontSubpixelAAEnabled', 10, 10), + ctx = _this$cachedCanvases$.context; + ctx.scale(1.5, 1); ctx.fillText('I', 0, 10); var data = ctx.getImageData(0, 0, 10, 10).data; @@ -15234,7 +15488,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { var fontSize = current.fontSize; if (fontSize === 0) { - return; + return undefined; } var ctx = this.ctx; @@ -15660,7 +15914,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.restore(); }, paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) { - var domImage = this.objs.get(objId); + var domImage = this.processingType3 ? this.commonObjs.get(objId) : this.objs.get(objId); if (!domImage) { (0, _util.warn)('Dependent image isn\'t ready yet'); @@ -15769,7 +16023,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } }, paintImageXObject: function CanvasGraphics_paintImageXObject(objId) { - var imgData = this.objs.get(objId); + var imgData = this.processingType3 ? this.commonObjs.get(objId) : this.objs.get(objId); if (!imgData) { (0, _util.warn)('Dependent image isn\'t ready yet'); @@ -15779,7 +16033,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.paintInlineImageXObject(imgData); }, paintImageXObjectRepeat: function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY, positions) { - var imgData = this.objs.get(objId); + var imgData = this.processingType3 ? this.commonObjs.get(objId) : this.objs.get(objId); if (!imgData) { (0, _util.warn)('Dependent image isn\'t ready yet'); @@ -16296,42 +16550,42 @@ var TilingPattern = function TilingPatternClosure() { y0 = bbox[1], x1 = bbox[2], y1 = bbox[3]; - var topLeft = [x0, y0]; - var botRight = [x0 + xstep, y0 + ystep]; - var width = botRight[0] - topLeft[0]; - var height = botRight[1] - topLeft[1]; var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix); var curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform); var combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]]; - width = Math.min(Math.ceil(Math.abs(width * combinedScale[0])), MAX_PATTERN_SIZE); - height = Math.min(Math.ceil(Math.abs(height * combinedScale[1])), MAX_PATTERN_SIZE); - var tmpCanvas = owner.cachedCanvases.getCanvas('pattern', width, height, true); + var dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]); + var dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]); + var tmpCanvas = owner.cachedCanvases.getCanvas('pattern', dimx.size, dimy.size, true); var tmpCtx = tmpCanvas.context; var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx); graphics.groupLevel = owner.groupLevel; this.setFillAndStrokeStyleToContext(graphics, paintType, color); - this.setScale(width, height, xstep, ystep); - this.transformToScale(graphics); - var tmpTranslate = [1, 0, 0, 1, -topLeft[0], -topLeft[1]]; - graphics.transform.apply(graphics, tmpTranslate); + graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0); + graphics.transform(1, 0, 0, 1, -x0, -y0); this.clipBbox(graphics, bbox, x0, y0, x1, y1); graphics.executeOperatorList(operatorList); + this.ctx.transform(1, 0, 0, 1, x0, y0); + this.ctx.scale(1 / dimx.scale, 1 / dimy.scale); return tmpCanvas.canvas; }, - setScale: function TilingPattern_setScale(width, height, xstep, ystep) { - this.scale = [width / xstep, height / ystep]; - }, - transformToScale: function TilingPattern_transformToScale(graphics) { - var scale = this.scale; - var tmpScale = [scale[0], 0, 0, scale[1], 0, 0]; - graphics.transform.apply(graphics, tmpScale); - }, - scaleToContext: function TilingPattern_scaleToContext() { - var scale = this.scale; - this.ctx.scale(1 / scale[0], 1 / scale[1]); + getSizeAndScale: function TilingPattern_getSizeAndScale(step, realOutputSize, scale) { + step = Math.abs(step); + var maxSize = Math.max(MAX_PATTERN_SIZE, realOutputSize); + var size = Math.ceil(step * scale); + + if (size >= maxSize) { + size = maxSize; + } else { + scale = size / step; + } + + return { + scale: scale, + size: size + }; }, clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) { if (Array.isArray(bbox) && bbox.length === 4) { @@ -16369,11 +16623,10 @@ var TilingPattern = function TilingPatternClosure() { } }, getPattern: function TilingPattern_getPattern(ctx, owner) { - var temporaryPatternCanvas = this.createPatternCanvas(owner); ctx = this.ctx; ctx.setTransform.apply(ctx, this.baseTransform); ctx.transform.apply(ctx, this.matrix); - this.scaleToContext(); + var temporaryPatternCanvas = this.createPatternCanvas(owner); return ctx.createPattern(temporaryPatternCanvas, 'repeat'); } }; @@ -16410,11 +16663,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.MessageHandler = MessageHandler; -var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(148)); var _util = __w_pdfjs_require__(1); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -16429,10 +16682,10 @@ function resolveCall(_x, _x2) { function _resolveCall() { _resolveCall = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(fn, args) { + _regenerator["default"].mark(function _callee(fn, args) { var thisArg, _args = arguments; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -16443,7 +16696,7 @@ function _resolveCall() { break; } - return _context.abrupt("return"); + return _context.abrupt("return", undefined); case 3: return _context.abrupt("return", fn.apply(thisArg, args)); @@ -16453,7 +16706,7 @@ function _resolveCall() { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return _resolveCall.apply(this, arguments); } @@ -16495,7 +16748,7 @@ function resolveOrReject(capability, success, reason) { } function finalize(promise) { - return Promise.resolve(promise).catch(function () {}); + return Promise.resolve(promise)["catch"](function () {}); } function MessageHandler(sourceName, targetName, comObj) { @@ -17588,7 +17841,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFDataTransportStream = void 0; -var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(148)); var _util = __w_pdfjs_require__(1); @@ -17598,12 +17851,23 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -var PDFDataTransportStream = function PDFDataTransportStreamClosure() { +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var PDFDataTransportStream = +/*#__PURE__*/ +function () { function PDFDataTransportStream(params, pdfDataRangeTransport) { var _this = this; + _classCallCheck(this, PDFDataTransportStream); + (0, _util.assert)(pdfDataRangeTransport); this._queuedChunks = []; + this._progressiveDone = params.progressiveDone || false; var initialData = params.initialData; if (initialData && initialData.length > 0) { @@ -17626,9 +17890,10 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { }); }); - this._pdfDataRangeTransport.addProgressListener(function (loaded) { + this._pdfDataRangeTransport.addProgressListener(function (loaded, total) { _this._onProgress({ - loaded: loaded + loaded: loaded, + total: total }); }); @@ -17638,11 +17903,16 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { }); }); + this._pdfDataRangeTransport.addProgressiveDoneListener(function () { + _this._onProgressiveDone(); + }); + this._pdfDataRangeTransport.transportReady(); } - PDFDataTransportStream.prototype = { - _onReceiveData: function PDFDataTransportStream_onReceiveData(args) { + _createClass(PDFDataTransportStream, [{ + key: "_onReceiveData", + value: function _onReceiveData(args) { var buffer = new Uint8Array(args.chunk).buffer; if (args.begin === undefined) { @@ -17664,32 +17934,62 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { (0, _util.assert)(found); } - }, - _onProgress: function PDFDataTransportStream_onDataProgress(evt) { - if (this._rangeReaders.length > 0) { + } + }, { + key: "_onProgress", + value: function _onProgress(evt) { + if (evt.total === undefined) { var firstReader = this._rangeReaders[0]; - if (firstReader.onProgress) { + if (firstReader && firstReader.onProgress) { firstReader.onProgress({ loaded: evt.loaded }); } + } else { + var fullReader = this._fullRequestReader; + + if (fullReader && fullReader.onProgress) { + fullReader.onProgress({ + loaded: evt.loaded, + total: evt.total + }); + } } - }, - _removeRangeReader: function PDFDataTransportStream_removeRangeReader(reader) { + } + }, { + key: "_onProgressiveDone", + value: function _onProgressiveDone() { + if (this._fullRequestReader) { + this._fullRequestReader.progressiveDone(); + } + + this._progressiveDone = true; + } + }, { + key: "_removeRangeReader", + value: function _removeRangeReader(reader) { var i = this._rangeReaders.indexOf(reader); if (i >= 0) { this._rangeReaders.splice(i, 1); } - }, - getFullReader: function PDFDataTransportStream_getFullReader() { + } + }, { + key: "getFullReader", + value: function getFullReader() { (0, _util.assert)(!this._fullRequestReader); var queuedChunks = this._queuedChunks; this._queuedChunks = null; - return new PDFDataTransportStreamReader(this, queuedChunks); - }, - getRangeReader: function PDFDataTransportStream_getRangeReader(begin, end) { + return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone); + } + }, { + key: "getRangeReader", + value: function getRangeReader(begin, end) { + if (end <= this._progressiveDataLength) { + return null; + } + var reader = new PDFDataTransportStreamRangeReader(this, begin, end); this._pdfDataRangeTransport.requestDataRange(begin, end); @@ -17697,8 +17997,10 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { this._rangeReaders.push(reader); return reader; - }, - cancelAllRequests: function PDFDataTransportStream_cancelAllRequests(reason) { + } + }, { + key: "cancelAllRequests", + value: function cancelAllRequests(reason) { if (this._fullRequestReader) { this._fullRequestReader.cancel(reason); } @@ -17711,21 +18013,64 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { this._pdfDataRangeTransport.abort(); } - }; + }, { + key: "_progressiveDataLength", + get: function get() { + return this._fullRequestReader ? this._fullRequestReader._loaded : 0; + } + }]); + + return PDFDataTransportStream; +}(); +exports.PDFDataTransportStream = PDFDataTransportStream; + +var PDFDataTransportStreamReader = +/*#__PURE__*/ +function () { function PDFDataTransportStreamReader(stream, queuedChunks) { + var progressiveDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + _classCallCheck(this, PDFDataTransportStreamReader); + this._stream = stream; - this._done = false; + this._done = progressiveDone || false; this._filename = null; this._queuedChunks = queuedChunks || []; + this._loaded = 0; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = this._queuedChunks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var chunk = _step.value; + this._loaded += chunk.byteLength; + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + this._requests = []; this._headersReady = Promise.resolve(); stream._fullRequestReader = this; this.onProgress = null; } - PDFDataTransportStreamReader.prototype = { - _enqueue: function PDFDataTransportStreamReader_enqueue(chunk) { + _createClass(PDFDataTransportStreamReader, [{ + key: "_enqueue", + value: function _enqueue(chunk) { if (this._done) { return; } @@ -17737,38 +18082,20 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { value: chunk, done: false }); - return; + } else { + this._queuedChunks.push(chunk); } - this._queuedChunks.push(chunk); - }, - - get headersReady() { - return this._headersReady; - }, - - get filename() { - return this._filename; - }, - - get isRangeSupported() { - return this._stream._isRangeSupported; - }, - - get isStreamingSupported() { - return this._stream._isStreamingSupported; - }, - - get contentLength() { - return this._stream._contentLength; - }, - - read: function () { + this._loaded += chunk.byteLength; + } + }, { + key: "read", + value: function () { var _read = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee() { + _regenerator["default"].mark(function _callee() { var chunk, requestCapability; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -17814,8 +18141,10 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { } return read; - }(), - cancel: function PDFDataTransportStreamReader_cancel(reason) { + }() + }, { + key: "cancel", + value: function cancel(reason) { this._done = true; this._requests.forEach(function (requestCapability) { @@ -17827,59 +18156,99 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { this._requests = []; } - }; - - function PDFDataTransportStreamRangeReader(stream, begin, end) { - this._stream = stream; - this._begin = begin; - this._end = end; - this._queuedChunk = null; - this._requests = []; - this._done = false; - this.onProgress = null; - } - - PDFDataTransportStreamRangeReader.prototype = { - _enqueue: function PDFDataTransportStreamRangeReader_enqueue(chunk) { + }, { + key: "progressiveDone", + value: function progressiveDone() { if (this._done) { return; } - if (this._requests.length === 0) { - this._queuedChunk = chunk; - } else { - var requestsCapability = this._requests.shift(); - - requestsCapability.resolve({ - value: chunk, - done: false - }); - - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); - - this._requests = []; - } - this._done = true; + } + }, { + key: "headersReady", + get: function get() { + return this._headersReady; + } + }, { + key: "filename", + get: function get() { + return this._filename; + } + }, { + key: "isRangeSupported", + get: function get() { + return this._stream._isRangeSupported; + } + }, { + key: "isStreamingSupported", + get: function get() { + return this._stream._isStreamingSupported; + } + }, { + key: "contentLength", + get: function get() { + return this._stream._contentLength; + } + }]); - this._stream._removeRangeReader(this); - }, - - get isStreamingSupported() { - return false; - }, + return PDFDataTransportStreamReader; +}(); + +var PDFDataTransportStreamRangeReader = +/*#__PURE__*/ +function () { + function PDFDataTransportStreamRangeReader(stream, begin, end) { + _classCallCheck(this, PDFDataTransportStreamRangeReader); + + this._stream = stream; + this._begin = begin; + this._end = end; + this._queuedChunk = null; + this._requests = []; + this._done = false; + this.onProgress = null; + } + + _createClass(PDFDataTransportStreamRangeReader, [{ + key: "_enqueue", + value: function _enqueue(chunk) { + if (this._done) { + return; + } + + if (this._requests.length === 0) { + this._queuedChunk = chunk; + } else { + var requestsCapability = this._requests.shift(); + + requestsCapability.resolve({ + value: chunk, + done: false + }); + + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); + + this._requests = []; + } + + this._done = true; - read: function () { + this._stream._removeRangeReader(this); + } + }, { + key: "read", + value: function () { var _read2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2() { + _regenerator["default"].mark(function _callee2() { var chunk, requestCapability; - return _regenerator.default.wrap(function _callee2$(_context2) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -17926,8 +18295,10 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { } return read; - }(), - cancel: function PDFDataTransportStreamRangeReader_cancel(reason) { + }() + }, { + key: "cancel", + value: function cancel(reason) { this._done = true; this._requests.forEach(function (requestCapability) { @@ -17941,11 +18312,15 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { this._stream._removeRangeReader(this); } - }; - return PDFDataTransportStream; -}(); + }, { + key: "isStreamingSupported", + get: function get() { + return false; + } + }]); -exports.PDFDataTransportStream = PDFDataTransportStream; + return PDFDataTransportStreamRangeReader; +}(); /***/ }), /* 161 */ @@ -18423,7 +18798,7 @@ var _util = __w_pdfjs_require__(1); var _global_scope = _interopRequireDefault(__w_pdfjs_require__(3)); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var renderTextLayer = function renderTextLayerClosure() { var MAX_TEXT_DIVS_TO_RENDER = 100000; @@ -18842,6 +19217,8 @@ var renderTextLayer = function renderTextLayerClosure() { } function TextLayerRenderTask(_ref) { + var _this = this; + var textContent = _ref.textContent, textContentStream = _ref.textContentStream, container = _ref.container, @@ -18856,7 +19233,7 @@ var renderTextLayer = function renderTextLayerClosure() { this._textDivs = textDivs || []; this._textContentItemsStr = textContentItemsStr || []; this._enhanceTextSelection = !!enhanceTextSelection; - this._fontInspectorEnabled = !!(_global_scope.default.FontInspector && _global_scope.default.FontInspector.enabled); + this._fontInspectorEnabled = !!(_global_scope["default"].FontInspector && _global_scope["default"].FontInspector.enabled); this._reader = null; this._layoutTextLastFontSize = null; this._layoutTextLastFontFamily = null; @@ -18867,6 +19244,14 @@ var renderTextLayer = function renderTextLayerClosure() { this._capability = (0, _util.createPromiseCapability)(); this._renderTimer = null; this._bounds = []; + + this._capability.promise["finally"](function () { + if (_this._layoutTextCtx) { + _this._layoutTextCtx.canvas.width = 0; + _this._layoutTextCtx.canvas.height = 0; + _this._layoutTextCtx = null; + } + }); } TextLayerRenderTask.prototype = { @@ -18875,20 +19260,20 @@ var renderTextLayer = function renderTextLayerClosure() { }, cancel: function TextLayer_cancel() { + this._canceled = true; + if (this._reader) { - this._reader.cancel(new _util.AbortException('text layer task cancelled')); + this._reader.cancel(new _util.AbortException('TextLayer task cancelled.')); this._reader = null; } - this._canceled = true; - if (this._renderTimer !== null) { clearTimeout(this._renderTimer); this._renderTimer = null; } - this._capability.reject('canceled'); + this._capability.reject(new Error('TextLayer task cancelled.')); }, _processItems: function _processItems(items, styleCache) { for (var i = 0, len = items.length; i < len; i++) { @@ -18938,7 +19323,7 @@ var renderTextLayer = function renderTextLayerClosure() { textLayerFrag.appendChild(textDiv); }, _render: function TextLayer_render(timeout) { - var _this = this; + var _this2 = this; var capability = (0, _util.createPromiseCapability)(); var styleCache = Object.create(null); @@ -18957,7 +19342,7 @@ var renderTextLayer = function renderTextLayerClosure() { capability.resolve(); } else if (this._textContentStream) { var pump = function pump() { - _this._reader.read().then(function (_ref2) { + _this2._reader.read().then(function (_ref2) { var value = _ref2.value, done = _ref2.done; @@ -18968,7 +19353,7 @@ var renderTextLayer = function renderTextLayerClosure() { Object.assign(styleCache, value.styles); - _this._processItems(value.items, styleCache); + _this2._processItems(value.items, styleCache); pump(); }, capability.reject); @@ -18984,11 +19369,11 @@ var renderTextLayer = function renderTextLayerClosure() { styleCache = null; if (!timeout) { - render(_this); + render(_this2); } else { - _this._renderTimer = setTimeout(function () { - render(_this); - _this._renderTimer = null; + _this2._renderTimer = setTimeout(function () { + render(_this2); + _this2._renderTimer = null; }, timeout); } }, this._capability.reject); @@ -19090,7 +19475,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.AnnotationLayer = void 0; -var _dom_utils = __w_pdfjs_require__(151); +var _display_utils = __w_pdfjs_require__(151); var _util = __w_pdfjs_require__(1); @@ -19160,6 +19545,9 @@ function () { case _util.AnnotationType.POPUP: return new PopupAnnotationElement(parameters); + case _util.AnnotationType.FREETEXT: + return new FreeTextAnnotationElement(parameters); + case _util.AnnotationType.LINE: return new LineAnnotationElement(parameters); @@ -19172,6 +19560,9 @@ function () { case _util.AnnotationType.POLYLINE: return new PolylineAnnotationElement(parameters); + case _util.AnnotationType.CARET: + return new CaretAnnotationElement(parameters); + case _util.AnnotationType.INK: return new InkAnnotationElement(parameters); @@ -19316,6 +19707,7 @@ function () { trigger: trigger, color: data.color, title: data.title, + modificationDate: data.modificationDate, contents: data.contents, hideWrapper: true }); @@ -19352,9 +19744,9 @@ function (_AnnotationElement) { var data = this.data, linkService = this.linkService; var link = document.createElement('a'); - (0, _dom_utils.addLinkAttributes)(link, { + (0, _display_utils.addLinkAttributes)(link, { url: data.url, - target: data.newWindow ? _dom_utils.LinkTarget.BLANK : linkService.externalLinkTarget, + target: data.newWindow ? _display_utils.LinkTarget.BLANK : linkService.externalLinkTarget, rel: linkService.externalLinkRel }); @@ -19719,6 +20111,7 @@ function (_AnnotationElement4) { trigger: parentElement, color: this.data.color, title: this.data.title, + modificationDate: this.data.modificationDate, contents: this.data.contents }); var parentLeft = parseFloat(parentElement.style.left); @@ -19743,6 +20136,7 @@ function () { this.trigger = parameters.trigger; this.color = parameters.color; this.title = parameters.title; + this.modificationDate = parameters.modificationDate; this.contents = parameters.contents; this.hideWrapper = parameters.hideWrapper || false; this.pinned = false; @@ -19767,16 +20161,30 @@ function () { popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0); } - var contents = this._formatContents(this.contents); - var title = document.createElement('h1'); title.textContent = this.title; + popup.appendChild(title); + + var dateObject = _display_utils.PDFDateString.toDateObject(this.modificationDate); + + if (dateObject) { + var modificationDate = document.createElement('span'); + modificationDate.textContent = '{{date}}, {{time}}'; + modificationDate.dataset.l10nId = 'annotation_date_string'; + modificationDate.dataset.l10nArgs = JSON.stringify({ + date: dateObject.toLocaleDateString(), + time: dateObject.toLocaleTimeString() + }); + popup.appendChild(modificationDate); + } + + var contents = this._formatContents(this.contents); + + popup.appendChild(contents); this.trigger.addEventListener('click', this._toggle.bind(this)); this.trigger.addEventListener('mouseover', this._show.bind(this, false)); this.trigger.addEventListener('mouseout', this._hide.bind(this, false)); popup.addEventListener('click', this._hide.bind(this, true)); - popup.appendChild(title); - popup.appendChild(contents); wrapper.appendChild(popup); return wrapper; } @@ -19839,10 +20247,38 @@ function () { return PopupElement; }(); -var LineAnnotationElement = +var FreeTextAnnotationElement = /*#__PURE__*/ function (_AnnotationElement5) { - _inherits(LineAnnotationElement, _AnnotationElement5); + _inherits(FreeTextAnnotationElement, _AnnotationElement5); + + function FreeTextAnnotationElement(parameters) { + _classCallCheck(this, FreeTextAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _possibleConstructorReturn(this, _getPrototypeOf(FreeTextAnnotationElement).call(this, parameters, isRenderable, true)); + } + + _createClass(FreeTextAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = 'freeTextAnnotation'; + + if (!this.data.hasPopup) { + this._createPopup(this.container, null, this.data); + } + + return this.container; + } + }]); + + return FreeTextAnnotationElement; +}(AnnotationElement); + +var LineAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement6) { + _inherits(LineAnnotationElement, _AnnotationElement6); function LineAnnotationElement(parameters) { _classCallCheck(this, LineAnnotationElement); @@ -19880,8 +20316,8 @@ function (_AnnotationElement5) { var SquareAnnotationElement = /*#__PURE__*/ -function (_AnnotationElement6) { - _inherits(SquareAnnotationElement, _AnnotationElement6); +function (_AnnotationElement7) { + _inherits(SquareAnnotationElement, _AnnotationElement7); function SquareAnnotationElement(parameters) { _classCallCheck(this, SquareAnnotationElement); @@ -19921,8 +20357,8 @@ function (_AnnotationElement6) { var CircleAnnotationElement = /*#__PURE__*/ -function (_AnnotationElement7) { - _inherits(CircleAnnotationElement, _AnnotationElement7); +function (_AnnotationElement8) { + _inherits(CircleAnnotationElement, _AnnotationElement8); function CircleAnnotationElement(parameters) { _classCallCheck(this, CircleAnnotationElement); @@ -19962,8 +20398,8 @@ function (_AnnotationElement7) { var PolylineAnnotationElement = /*#__PURE__*/ -function (_AnnotationElement8) { - _inherits(PolylineAnnotationElement, _AnnotationElement8); +function (_AnnotationElement9) { + _inherits(PolylineAnnotationElement, _AnnotationElement9); function PolylineAnnotationElement(parameters) { var _this3; @@ -20032,10 +20468,38 @@ function (_PolylineAnnotationEl) { return PolygonAnnotationElement; }(PolylineAnnotationElement); +var CaretAnnotationElement = +/*#__PURE__*/ +function (_AnnotationElement10) { + _inherits(CaretAnnotationElement, _AnnotationElement10); + + function CaretAnnotationElement(parameters) { + _classCallCheck(this, CaretAnnotationElement); + + var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); + return _possibleConstructorReturn(this, _getPrototypeOf(CaretAnnotationElement).call(this, parameters, isRenderable, true)); + } + + _createClass(CaretAnnotationElement, [{ + key: "render", + value: function render() { + this.container.className = 'caretAnnotation'; + + if (!this.data.hasPopup) { + this._createPopup(this.container, null, this.data); + } + + return this.container; + } + }]); + + return CaretAnnotationElement; +}(AnnotationElement); + var InkAnnotationElement = /*#__PURE__*/ -function (_AnnotationElement9) { - _inherits(InkAnnotationElement, _AnnotationElement9); +function (_AnnotationElement11) { + _inherits(InkAnnotationElement, _AnnotationElement11); function InkAnnotationElement(parameters) { var _this5; @@ -20092,8 +20556,8 @@ function (_AnnotationElement9) { var HighlightAnnotationElement = /*#__PURE__*/ -function (_AnnotationElement10) { - _inherits(HighlightAnnotationElement, _AnnotationElement10); +function (_AnnotationElement12) { + _inherits(HighlightAnnotationElement, _AnnotationElement12); function HighlightAnnotationElement(parameters) { _classCallCheck(this, HighlightAnnotationElement); @@ -20120,8 +20584,8 @@ function (_AnnotationElement10) { var UnderlineAnnotationElement = /*#__PURE__*/ -function (_AnnotationElement11) { - _inherits(UnderlineAnnotationElement, _AnnotationElement11); +function (_AnnotationElement13) { + _inherits(UnderlineAnnotationElement, _AnnotationElement13); function UnderlineAnnotationElement(parameters) { _classCallCheck(this, UnderlineAnnotationElement); @@ -20148,8 +20612,8 @@ function (_AnnotationElement11) { var SquigglyAnnotationElement = /*#__PURE__*/ -function (_AnnotationElement12) { - _inherits(SquigglyAnnotationElement, _AnnotationElement12); +function (_AnnotationElement14) { + _inherits(SquigglyAnnotationElement, _AnnotationElement14); function SquigglyAnnotationElement(parameters) { _classCallCheck(this, SquigglyAnnotationElement); @@ -20176,8 +20640,8 @@ function (_AnnotationElement12) { var StrikeOutAnnotationElement = /*#__PURE__*/ -function (_AnnotationElement13) { - _inherits(StrikeOutAnnotationElement, _AnnotationElement13); +function (_AnnotationElement15) { + _inherits(StrikeOutAnnotationElement, _AnnotationElement15); function StrikeOutAnnotationElement(parameters) { _classCallCheck(this, StrikeOutAnnotationElement); @@ -20204,8 +20668,8 @@ function (_AnnotationElement13) { var StampAnnotationElement = /*#__PURE__*/ -function (_AnnotationElement14) { - _inherits(StampAnnotationElement, _AnnotationElement14); +function (_AnnotationElement16) { + _inherits(StampAnnotationElement, _AnnotationElement16); function StampAnnotationElement(parameters) { _classCallCheck(this, StampAnnotationElement); @@ -20232,8 +20696,8 @@ function (_AnnotationElement14) { var FileAttachmentAnnotationElement = /*#__PURE__*/ -function (_AnnotationElement15) { - _inherits(FileAttachmentAnnotationElement, _AnnotationElement15); +function (_AnnotationElement17) { + _inherits(FileAttachmentAnnotationElement, _AnnotationElement17); function FileAttachmentAnnotationElement(parameters) { var _this6; @@ -20244,12 +20708,12 @@ function (_AnnotationElement15) { var _this6$data$file = _this6.data.file, filename = _this6$data$file.filename, content = _this6$data$file.content; - _this6.filename = (0, _dom_utils.getFilenameFromUrl)(filename); + _this6.filename = (0, _display_utils.getFilenameFromUrl)(filename); _this6.content = content; if (_this6.linkService.eventBus) { _this6.linkService.eventBus.dispatch('fileattachmentannotation', { - source: _assertThisInitialized(_assertThisInitialized(_this6)), + source: _assertThisInitialized(_this6), id: (0, _util.stringToPDFString)(filename), filename: filename, content: content @@ -20316,7 +20780,7 @@ function () { downloadManager: parameters.downloadManager, imageResourcesPath: parameters.imageResourcesPath || '', renderInteractiveForms: parameters.renderInteractiveForms || false, - svgFactory: new _dom_utils.DOMSVGFactory() + svgFactory: new _display_utils.DOMSVGFactory() }); if (element.isRenderable) { @@ -20359,11 +20823,33 @@ exports.SVGGraphics = void 0; var _util = __w_pdfjs_require__(1); -var _dom_utils = __w_pdfjs_require__(151); +var _display_utils = __w_pdfjs_require__(151); var _is_node = _interopRequireDefault(__w_pdfjs_require__(4)); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } + +function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var SVGGraphics = function SVGGraphics() { throw new Error('Not implemented: SVGGraphics'); @@ -20371,13 +20857,105 @@ var SVGGraphics = function SVGGraphics() { exports.SVGGraphics = SVGGraphics; { + var opListToTree = function opListToTree(opList) { + var opTree = []; + var tmp = []; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = opList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var opListElement = _step.value; + + if (opListElement.fn === 'save') { + opTree.push({ + 'fnId': 92, + 'fn': 'group', + 'items': [] + }); + tmp.push(opTree); + opTree = opTree[opTree.length - 1].items; + continue; + } + + if (opListElement.fn === 'restore') { + opTree = tmp.pop(); + } else { + opTree.push(opListElement); + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + return opTree; + }; + + var pf = function pf(value) { + if (Number.isInteger(value)) { + return value.toString(); + } + + var s = value.toFixed(10); + var i = s.length - 1; + + if (s[i] !== '0') { + return s; + } + + do { + i--; + } while (s[i] === '0'); + + return s.substring(0, s[i] === '.' ? i : i + 1); + }; + + var pm = function pm(m) { + if (m[4] === 0 && m[5] === 0) { + if (m[1] === 0 && m[2] === 0) { + if (m[0] === 1 && m[3] === 1) { + return ''; + } + + return "scale(".concat(pf(m[0]), " ").concat(pf(m[3]), ")"); + } + + if (m[0] === m[3] && m[1] === -m[2]) { + var a = Math.acos(m[0]) * 180 / Math.PI; + return "rotate(".concat(pf(a), ")"); + } + } else { + if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) { + return "translate(".concat(pf(m[4]), " ").concat(pf(m[5]), ")"); + } + } + + return "matrix(".concat(pf(m[0]), " ").concat(pf(m[1]), " ").concat(pf(m[2]), " ").concat(pf(m[3]), " ").concat(pf(m[4]), " ") + "".concat(pf(m[5]), ")"); + }; + var SVG_DEFAULTS = { fontStyle: 'normal', fontWeight: 'normal', fillColor: '#000000' }; + var XML_NS = 'http://www.w3.org/XML/1998/namespace'; + var XLINK_NS = 'http://www.w3.org/1999/xlink'; + var LINE_CAP_STYLES = ['butt', 'round', 'square']; + var LINE_JOIN_STYLES = ['miter', 'round', 'bevel']; - var convertImgDataToPng = function convertImgDataToPngClosure() { + var convertImgDataToPng = function () { var PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]); var CHUNK_WRAPPER_SIZE = 12; var crcTable = new Int32Array(256); @@ -20399,8 +20977,8 @@ exports.SVGGraphics = SVGGraphics; function crc32(data, start, end) { var crc = -1; - for (var i = start; i < end; i++) { - var a = (crc ^ data[i]) & 0xff; + for (var _i = start; _i < end; _i++) { + var a = (crc ^ data[_i]) & 0xff; var b = crcTable[a]; crc = crc >>> 8 ^ b; } @@ -20434,8 +21012,8 @@ exports.SVGGraphics = SVGGraphics; var a = 1; var b = 0; - for (var i = start; i < end; ++i) { - a = (a + (data[i] & 0xff)) % 65521; + for (var _i2 = start; _i2 < end; ++_i2) { + a = (a + (data[_i2] & 0xff)) % 65521; b = (b + a) % 65521; } @@ -20443,7 +21021,7 @@ exports.SVGGraphics = SVGGraphics; } function deflateSync(literals) { - if (!(0, _is_node.default)()) { + if (!(0, _is_node["default"])()) { return deflateSyncUncompressed(literals); } @@ -20537,9 +21115,8 @@ exports.SVGGraphics = SVGGraphics; var literals = new Uint8Array((1 + lineSize) * height); var offsetLiterals = 0, offsetBytes = 0; - var y, i; - for (y = 0; y < height; ++y) { + for (var y = 0; y < height; ++y) { literals[offsetLiterals++] = 0; literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals); offsetBytes += lineSize; @@ -20549,10 +21126,10 @@ exports.SVGGraphics = SVGGraphics; if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) { offsetLiterals = 0; - for (y = 0; y < height; y++) { + for (var _y = 0; _y < height; _y++) { offsetLiterals++; - for (i = 0; i < lineSize; i++) { + for (var _i3 = 0; _i3 < lineSize; _i3++) { literals[offsetLiterals++] ^= 0xFF; } } @@ -20579,8 +21156,12 @@ exports.SVGGraphics = SVGGraphics; }; }(); - var SVGExtraState = function SVGExtraStateClosure() { + var SVGExtraState = + /*#__PURE__*/ + function () { function SVGExtraState() { + _classCallCheck(this, SVGExtraState); + this.fontSizeScale = 1; this.fontWeight = SVG_DEFAULTS.fontWeight; this.fontSize = 0; @@ -20588,6 +21169,7 @@ exports.SVGGraphics = SVGGraphics; this.fontMatrix = _util.FONT_IDENTITY_MATRIX; this.leading = 0; this.textRenderingMode = _util.TextRenderingMode.FILL; + this.textMatrixScale = 1; this.x = 0; this.y = 0; this.lineX = 0; @@ -20612,90 +21194,33 @@ exports.SVGGraphics = SVGGraphics; this.maskId = ''; } - SVGExtraState.prototype = { - clone: function SVGExtraState_clone() { + _createClass(SVGExtraState, [{ + key: "clone", + value: function clone() { return Object.create(this); - }, - setCurrentPoint: function SVGExtraState_setCurrentPoint(x, y) { + } + }, { + key: "setCurrentPoint", + value: function setCurrentPoint(x, y) { this.x = x; this.y = y; } - }; + }]); + return SVGExtraState; }(); - exports.SVGGraphics = SVGGraphics = function SVGGraphicsClosure() { - function opListToTree(opList) { - var opTree = []; - var tmp = []; - var opListLen = opList.length; - - for (var x = 0; x < opListLen; x++) { - if (opList[x].fn === 'save') { - opTree.push({ - 'fnId': 92, - 'fn': 'group', - 'items': [] - }); - tmp.push(opTree); - opTree = opTree[opTree.length - 1].items; - continue; - } - - if (opList[x].fn === 'restore') { - opTree = tmp.pop(); - } else { - opTree.push(opList[x]); - } - } - - return opTree; - } - - function pf(value) { - if (Number.isInteger(value)) { - return value.toString(); - } - - var s = value.toFixed(10); - var i = s.length - 1; - - if (s[i] !== '0') { - return s; - } - - do { - i--; - } while (s[i] === '0'); - - return s.substring(0, s[i] === '.' ? i : i + 1); - } - - function pm(m) { - if (m[4] === 0 && m[5] === 0) { - if (m[1] === 0 && m[2] === 0) { - if (m[0] === 1 && m[3] === 1) { - return ''; - } - - return 'scale(' + pf(m[0]) + ' ' + pf(m[3]) + ')'; - } - - if (m[0] === m[3] && m[1] === -m[2]) { - var a = Math.acos(m[0]) * 180 / Math.PI; - return 'rotate(' + pf(a) + ')'; - } - } else { - if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) { - return 'translate(' + pf(m[4]) + ' ' + pf(m[5]) + ')'; - } - } - - return 'matrix(' + pf(m[0]) + ' ' + pf(m[1]) + ' ' + pf(m[2]) + ' ' + pf(m[3]) + ' ' + pf(m[4]) + ' ' + pf(m[5]) + ')'; - } + var clipCount = 0; + var maskCount = 0; + var shadingCount = 0; + exports.SVGGraphics = SVGGraphics = + /*#__PURE__*/ + function () { function SVGGraphics(commonObjs, objs, forceDataSchema) { - this.svgFactory = new _dom_utils.DOMSVGFactory(); + _classCallCheck(this, SVGGraphics); + + this.svgFactory = new _display_utils.DOMSVGFactory(); this.current = new SVGExtraState(); this.transformMatrix = _util.IDENTITY_MATRIX; this.transformStack = []; @@ -20708,71 +21233,95 @@ exports.SVGGraphics = SVGGraphics; this.embeddedFonts = Object.create(null); this.cssStyle = null; this.forceDataSchema = !!forceDataSchema; + this._operatorIdMapping = []; + + for (var op in _util.OPS) { + this._operatorIdMapping[_util.OPS[op]] = op; + } } - var XML_NS = 'http://www.w3.org/XML/1998/namespace'; - var XLINK_NS = 'http://www.w3.org/1999/xlink'; - var LINE_CAP_STYLES = ['butt', 'round', 'square']; - var LINE_JOIN_STYLES = ['miter', 'round', 'bevel']; - var clipCount = 0; - var maskCount = 0; - SVGGraphics.prototype = { - save: function SVGGraphics_save() { + _createClass(SVGGraphics, [{ + key: "save", + value: function save() { this.transformStack.push(this.transformMatrix); var old = this.current; this.extraStack.push(old); this.current = old.clone(); - }, - restore: function SVGGraphics_restore() { + } + }, { + key: "restore", + value: function restore() { this.transformMatrix = this.transformStack.pop(); this.current = this.extraStack.pop(); this.pendingClip = null; this.tgrp = null; - }, - group: function SVGGraphics_group(items) { + } + }, { + key: "group", + value: function group(items) { this.save(); this.executeOpTree(items); this.restore(); - }, - loadDependencies: function SVGGraphics_loadDependencies(operatorList) { + } + }, { + key: "loadDependencies", + value: function loadDependencies(operatorList) { var _this = this; var fnArray = operatorList.fnArray; - var fnArrayLen = fnArray.length; var argsArray = operatorList.argsArray; - for (var i = 0; i < fnArrayLen; i++) { - if (_util.OPS.dependency === fnArray[i]) { - var deps = argsArray[i]; + for (var i = 0, ii = fnArray.length; i < ii; i++) { + if (fnArray[i] !== _util.OPS.dependency) { + continue; + } + + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; - for (var n = 0, nn = deps.length; n < nn; n++) { - var obj = deps[n]; - var common = obj.substring(0, 2) === 'g_'; - var promise; + try { + var _loop = function _loop() { + var obj = _step2.value; + var objsPool = obj.startsWith('g_') ? _this.commonObjs : _this.objs; + var promise = new Promise(function (resolve) { + objsPool.get(obj, resolve); + }); - if (common) { - promise = new Promise(function (resolve) { - _this.commonObjs.get(obj, resolve); - }); - } else { - promise = new Promise(function (resolve) { - _this.objs.get(obj, resolve); - }); - } + _this.current.dependencies.push(promise); + }; - this.current.dependencies.push(promise); + for (var _iterator2 = argsArray[i][Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + _loop(); + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) { + _iterator2["return"](); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } } } } return Promise.all(this.current.dependencies); - }, - transform: function SVGGraphics_transform(a, b, c, d, e, f) { + } + }, { + key: "transform", + value: function transform(a, b, c, d, e, f) { var transformMatrix = [a, b, c, d, e, f]; this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix); this.tgrp = null; - }, - getSVG: function SVGGraphics_getSVG(operatorList, viewport) { + } + }, { + key: "getSVG", + value: function getSVG(operatorList, viewport) { var _this2 = this; this.viewport = viewport; @@ -20782,276 +21331,328 @@ exports.SVGGraphics = SVGGraphics; return this.loadDependencies(operatorList).then(function () { _this2.transformMatrix = _util.IDENTITY_MATRIX; - var opTree = _this2.convertOpList(operatorList); - - _this2.executeOpTree(opTree); + _this2.executeOpTree(_this2.convertOpList(operatorList)); return svgElement; }); - }, - convertOpList: function SVGGraphics_convertOpList(operatorList) { + } + }, { + key: "convertOpList", + value: function convertOpList(operatorList) { + var operatorIdMapping = this._operatorIdMapping; var argsArray = operatorList.argsArray; var fnArray = operatorList.fnArray; - var fnArrayLen = fnArray.length; - var REVOPS = []; var opList = []; - for (var op in _util.OPS) { - REVOPS[_util.OPS[op]] = op; - } - - for (var x = 0; x < fnArrayLen; x++) { - var fnId = fnArray[x]; + for (var i = 0, ii = fnArray.length; i < ii; i++) { + var fnId = fnArray[i]; opList.push({ 'fnId': fnId, - 'fn': REVOPS[fnId], - 'args': argsArray[x] + 'fn': operatorIdMapping[fnId], + 'args': argsArray[i] }); } return opListToTree(opList); - }, - executeOpTree: function SVGGraphics_executeOpTree(opTree) { - var opTreeLen = opTree.length; + } + }, { + key: "executeOpTree", + value: function executeOpTree(opTree) { + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; - for (var x = 0; x < opTreeLen; x++) { - var fn = opTree[x].fn; - var fnId = opTree[x].fnId; - var args = opTree[x].args; + try { + for (var _iterator3 = opTree[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var opTreeElement = _step3.value; + var fn = opTreeElement.fn; + var fnId = opTreeElement.fnId; + var args = opTreeElement.args; + + switch (fnId | 0) { + case _util.OPS.beginText: + this.beginText(); + break; - switch (fnId | 0) { - case _util.OPS.beginText: - this.beginText(); - break; + case _util.OPS.dependency: + break; - case _util.OPS.dependency: - break; + case _util.OPS.setLeading: + this.setLeading(args); + break; - case _util.OPS.setLeading: - this.setLeading(args); - break; + case _util.OPS.setLeadingMoveText: + this.setLeadingMoveText(args[0], args[1]); + break; - case _util.OPS.setLeadingMoveText: - this.setLeadingMoveText(args[0], args[1]); - break; + case _util.OPS.setFont: + this.setFont(args); + break; - case _util.OPS.setFont: - this.setFont(args); - break; + case _util.OPS.showText: + this.showText(args[0]); + break; - case _util.OPS.showText: - this.showText(args[0]); - break; + case _util.OPS.showSpacedText: + this.showText(args[0]); + break; - case _util.OPS.showSpacedText: - this.showText(args[0]); - break; + case _util.OPS.endText: + this.endText(); + break; - case _util.OPS.endText: - this.endText(); - break; + case _util.OPS.moveText: + this.moveText(args[0], args[1]); + break; - case _util.OPS.moveText: - this.moveText(args[0], args[1]); - break; + case _util.OPS.setCharSpacing: + this.setCharSpacing(args[0]); + break; - case _util.OPS.setCharSpacing: - this.setCharSpacing(args[0]); - break; + case _util.OPS.setWordSpacing: + this.setWordSpacing(args[0]); + break; - case _util.OPS.setWordSpacing: - this.setWordSpacing(args[0]); - break; + case _util.OPS.setHScale: + this.setHScale(args[0]); + break; - case _util.OPS.setHScale: - this.setHScale(args[0]); - break; + case _util.OPS.setTextMatrix: + this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); + break; - case _util.OPS.setTextMatrix: - this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); - break; + case _util.OPS.setTextRise: + this.setTextRise(args[0]); + break; - case _util.OPS.setTextRise: - this.setTextRise(args[0]); - break; + case _util.OPS.setTextRenderingMode: + this.setTextRenderingMode(args[0]); + break; - case _util.OPS.setTextRenderingMode: - this.setTextRenderingMode(args[0]); - break; + case _util.OPS.setLineWidth: + this.setLineWidth(args[0]); + break; - case _util.OPS.setLineWidth: - this.setLineWidth(args[0]); - break; + case _util.OPS.setLineJoin: + this.setLineJoin(args[0]); + break; - case _util.OPS.setLineJoin: - this.setLineJoin(args[0]); - break; + case _util.OPS.setLineCap: + this.setLineCap(args[0]); + break; - case _util.OPS.setLineCap: - this.setLineCap(args[0]); - break; + case _util.OPS.setMiterLimit: + this.setMiterLimit(args[0]); + break; - case _util.OPS.setMiterLimit: - this.setMiterLimit(args[0]); - break; + case _util.OPS.setFillRGBColor: + this.setFillRGBColor(args[0], args[1], args[2]); + break; - case _util.OPS.setFillRGBColor: - this.setFillRGBColor(args[0], args[1], args[2]); - break; + case _util.OPS.setStrokeRGBColor: + this.setStrokeRGBColor(args[0], args[1], args[2]); + break; - case _util.OPS.setStrokeRGBColor: - this.setStrokeRGBColor(args[0], args[1], args[2]); - break; + case _util.OPS.setStrokeColorN: + this.setStrokeColorN(args); + break; - case _util.OPS.setDash: - this.setDash(args[0], args[1]); - break; + case _util.OPS.setFillColorN: + this.setFillColorN(args); + break; - case _util.OPS.setGState: - this.setGState(args[0]); - break; + case _util.OPS.shadingFill: + this.shadingFill(args[0]); + break; - case _util.OPS.fill: - this.fill(); - break; + case _util.OPS.setDash: + this.setDash(args[0], args[1]); + break; - case _util.OPS.eoFill: - this.eoFill(); - break; + case _util.OPS.setRenderingIntent: + this.setRenderingIntent(args[0]); + break; - case _util.OPS.stroke: - this.stroke(); - break; + case _util.OPS.setFlatness: + this.setFlatness(args[0]); + break; - case _util.OPS.fillStroke: - this.fillStroke(); - break; + case _util.OPS.setGState: + this.setGState(args[0]); + break; - case _util.OPS.eoFillStroke: - this.eoFillStroke(); - break; + case _util.OPS.fill: + this.fill(); + break; - case _util.OPS.clip: - this.clip('nonzero'); - break; + case _util.OPS.eoFill: + this.eoFill(); + break; - case _util.OPS.eoClip: - this.clip('evenodd'); - break; + case _util.OPS.stroke: + this.stroke(); + break; - case _util.OPS.paintSolidColorImageMask: - this.paintSolidColorImageMask(); - break; + case _util.OPS.fillStroke: + this.fillStroke(); + break; - case _util.OPS.paintJpegXObject: - this.paintJpegXObject(args[0], args[1], args[2]); - break; + case _util.OPS.eoFillStroke: + this.eoFillStroke(); + break; - case _util.OPS.paintImageXObject: - this.paintImageXObject(args[0]); - break; + case _util.OPS.clip: + this.clip('nonzero'); + break; - case _util.OPS.paintInlineImageXObject: - this.paintInlineImageXObject(args[0]); - break; + case _util.OPS.eoClip: + this.clip('evenodd'); + break; - case _util.OPS.paintImageMaskXObject: - this.paintImageMaskXObject(args[0]); - break; + case _util.OPS.paintSolidColorImageMask: + this.paintSolidColorImageMask(); + break; - case _util.OPS.paintFormXObjectBegin: - this.paintFormXObjectBegin(args[0], args[1]); - break; + case _util.OPS.paintJpegXObject: + this.paintJpegXObject(args[0], args[1], args[2]); + break; - case _util.OPS.paintFormXObjectEnd: - this.paintFormXObjectEnd(); - break; + case _util.OPS.paintImageXObject: + this.paintImageXObject(args[0]); + break; - case _util.OPS.closePath: - this.closePath(); - break; + case _util.OPS.paintInlineImageXObject: + this.paintInlineImageXObject(args[0]); + break; - case _util.OPS.closeStroke: - this.closeStroke(); - break; + case _util.OPS.paintImageMaskXObject: + this.paintImageMaskXObject(args[0]); + break; - case _util.OPS.closeFillStroke: - this.closeFillStroke(); - break; + case _util.OPS.paintFormXObjectBegin: + this.paintFormXObjectBegin(args[0], args[1]); + break; - case _util.OPS.closeEOFillStroke: - this.closeEOFillStroke(); - break; + case _util.OPS.paintFormXObjectEnd: + this.paintFormXObjectEnd(); + break; - case _util.OPS.nextLine: - this.nextLine(); - break; + case _util.OPS.closePath: + this.closePath(); + break; - case _util.OPS.transform: - this.transform(args[0], args[1], args[2], args[3], args[4], args[5]); - break; + case _util.OPS.closeStroke: + this.closeStroke(); + break; - case _util.OPS.constructPath: - this.constructPath(args[0], args[1]); - break; + case _util.OPS.closeFillStroke: + this.closeFillStroke(); + break; - case _util.OPS.endPath: - this.endPath(); - break; + case _util.OPS.closeEOFillStroke: + this.closeEOFillStroke(); + break; - case 92: - this.group(opTree[x].items); - break; + case _util.OPS.nextLine: + this.nextLine(); + break; - default: - (0, _util.warn)('Unimplemented operator ' + fn); - break; + case _util.OPS.transform: + this.transform(args[0], args[1], args[2], args[3], args[4], args[5]); + break; + + case _util.OPS.constructPath: + this.constructPath(args[0], args[1]); + break; + + case _util.OPS.endPath: + this.endPath(); + break; + + case 92: + this.group(opTreeElement.items); + break; + + default: + (0, _util.warn)("Unimplemented operator ".concat(fn)); + break; + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) { + _iterator3["return"](); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } } } - }, - setWordSpacing: function SVGGraphics_setWordSpacing(wordSpacing) { + } + }, { + key: "setWordSpacing", + value: function setWordSpacing(wordSpacing) { this.current.wordSpacing = wordSpacing; - }, - setCharSpacing: function SVGGraphics_setCharSpacing(charSpacing) { + } + }, { + key: "setCharSpacing", + value: function setCharSpacing(charSpacing) { this.current.charSpacing = charSpacing; - }, - nextLine: function SVGGraphics_nextLine() { + } + }, { + key: "nextLine", + value: function nextLine() { this.moveText(0, this.current.leading); - }, - setTextMatrix: function SVGGraphics_setTextMatrix(a, b, c, d, e, f) { + } + }, { + key: "setTextMatrix", + value: function setTextMatrix(a, b, c, d, e, f) { var current = this.current; - this.current.textMatrix = this.current.lineMatrix = [a, b, c, d, e, f]; - this.current.x = this.current.lineX = 0; - this.current.y = this.current.lineY = 0; + current.textMatrix = current.lineMatrix = [a, b, c, d, e, f]; + current.textMatrixScale = Math.sqrt(a * a + b * b); + current.x = current.lineX = 0; + current.y = current.lineY = 0; current.xcoords = []; current.tspan = this.svgFactory.createElement('svg:tspan'); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); - current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); + current.tspan.setAttributeNS(null, 'font-size', "".concat(pf(current.fontSize), "px")); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.txtElement = this.svgFactory.createElement('svg:text'); current.txtElement.appendChild(current.tspan); - }, - beginText: function SVGGraphics_beginText() { - this.current.x = this.current.lineX = 0; - this.current.y = this.current.lineY = 0; - this.current.textMatrix = _util.IDENTITY_MATRIX; - this.current.lineMatrix = _util.IDENTITY_MATRIX; - this.current.tspan = this.svgFactory.createElement('svg:tspan'); - this.current.txtElement = this.svgFactory.createElement('svg:text'); - this.current.txtgrp = this.svgFactory.createElement('svg:g'); - this.current.xcoords = []; - }, - moveText: function SVGGraphics_moveText(x, y) { + } + }, { + key: "beginText", + value: function beginText() { + var current = this.current; + current.x = current.lineX = 0; + current.y = current.lineY = 0; + current.textMatrix = _util.IDENTITY_MATRIX; + current.lineMatrix = _util.IDENTITY_MATRIX; + current.textMatrixScale = 1; + current.tspan = this.svgFactory.createElement('svg:tspan'); + current.txtElement = this.svgFactory.createElement('svg:text'); + current.txtgrp = this.svgFactory.createElement('svg:g'); + current.xcoords = []; + } + }, { + key: "moveText", + value: function moveText(x, y) { var current = this.current; - this.current.x = this.current.lineX += x; - this.current.y = this.current.lineY += y; + current.x = current.lineX += x; + current.y = current.lineY += y; current.xcoords = []; current.tspan = this.svgFactory.createElement('svg:tspan'); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); - current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); + current.tspan.setAttributeNS(null, 'font-size', "".concat(pf(current.fontSize), "px")); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); - }, - showText: function SVGGraphics_showText(glyphs) { + } + }, { + key: "showText", + value: function showText(glyphs) { var current = this.current; var font = current.font; var fontSize = current.fontSize; @@ -21064,36 +21665,52 @@ exports.SVGGraphics = SVGGraphics; var wordSpacing = current.wordSpacing; var fontDirection = current.fontDirection; var textHScale = current.textHScale * fontDirection; - var glyphsLength = glyphs.length; var vertical = font.vertical; var widthAdvanceScale = fontSize * current.fontMatrix[0]; - var x = 0, - i; + var x = 0; + var _iteratorNormalCompletion4 = true; + var _didIteratorError4 = false; + var _iteratorError4 = undefined; - for (i = 0; i < glyphsLength; ++i) { - var glyph = glyphs[i]; + try { + for (var _iterator4 = glyphs[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { + var glyph = _step4.value; + + if (glyph === null) { + x += fontDirection * wordSpacing; + continue; + } else if ((0, _util.isNum)(glyph)) { + x += -glyph * fontSize * 0.001; + continue; + } - if (glyph === null) { - x += fontDirection * wordSpacing; - continue; - } else if ((0, _util.isNum)(glyph)) { - x += -glyph * fontSize * 0.001; - continue; - } + var width = glyph.width; + var character = glyph.fontChar; + var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; + var charWidth = width * widthAdvanceScale + spacing * fontDirection; - var width = glyph.width; - var character = glyph.fontChar; - var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; - var charWidth = width * widthAdvanceScale + spacing * fontDirection; + if (!glyph.isInFont && !font.missingFile) { + x += charWidth; + continue; + } - if (!glyph.isInFont && !font.missingFile) { + current.xcoords.push(current.x + x * textHScale); + current.tspan.textContent += character; x += charWidth; - continue; } - - current.xcoords.push(current.x + x * textHScale); - current.tspan.textContent += character; - x += charWidth; + } catch (err) { + _didIteratorError4 = true; + _iteratorError4 = err; + } finally { + try { + if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) { + _iterator4["return"](); + } + } finally { + if (_didIteratorError4) { + throw _iteratorError4; + } + } } if (vertical) { @@ -21105,7 +21722,7 @@ exports.SVGGraphics = SVGGraphics; current.tspan.setAttributeNS(null, 'x', current.xcoords.map(pf).join(' ')); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); - current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); + current.tspan.setAttributeNS(null, 'font-size', "".concat(pf(current.fontSize), "px")); if (current.fontStyle !== SVG_DEFAULTS.fontStyle) { current.tspan.setAttributeNS(null, 'font-style', current.fontStyle); @@ -21132,7 +21749,9 @@ exports.SVGGraphics = SVGGraphics; } if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { - this._setStrokeAttributes(current.tspan); + var lineWidthScale = 1 / (current.textMatrixScale || 1); + + this._setStrokeAttributes(current.tspan, lineWidthScale); } var textMatrix = current.textMatrix; @@ -21142,18 +21761,22 @@ exports.SVGGraphics = SVGGraphics; textMatrix[5] += current.textRise; } - current.txtElement.setAttributeNS(null, 'transform', pm(textMatrix) + ' scale(1, -1)'); + current.txtElement.setAttributeNS(null, 'transform', "".concat(pm(textMatrix), " scale(1, -1)")); current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve'); current.txtElement.appendChild(current.tspan); current.txtgrp.appendChild(current.txtElement); this._ensureTransformGroup().appendChild(current.txtElement); - }, - setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) { + } + }, { + key: "setLeadingMoveText", + value: function setLeadingMoveText(x, y) { this.setLeading(-y); this.moveText(x, y); - }, - addFontStyle: function SVGGraphics_addFontStyle(fontObj) { + } + }, { + key: "addFontStyle", + value: function addFontStyle(fontObj) { if (!this.cssStyle) { this.cssStyle = this.svgFactory.createElement('svg:style'); this.cssStyle.setAttributeNS(null, 'type', 'text/css'); @@ -21161,13 +21784,15 @@ exports.SVGGraphics = SVGGraphics; } var url = (0, _util.createObjectURL)(fontObj.data, fontObj.mimetype, this.forceDataSchema); - this.cssStyle.textContent += '@font-face { font-family: "' + fontObj.loadedName + '";' + ' src: url(' + url + '); }\n'; - }, - setFont: function SVGGraphics_setFont(details) { + this.cssStyle.textContent += "@font-face { font-family: \"".concat(fontObj.loadedName, "\";") + " src: url(".concat(url, "); }\n"); + } + }, { + key: "setFont", + value: function setFont(details) { var current = this.current; var fontObj = this.commonObjs.get(details[0]); var size = details[1]; - this.current.font = fontObj; + current.font = fontObj; if (this.embedFonts && fontObj.data && !this.embeddedFonts[fontObj.loadedName]) { this.addFontStyle(fontObj); @@ -21192,8 +21817,10 @@ exports.SVGGraphics = SVGGraphics; current.tspan = this.svgFactory.createElement('svg:tspan'); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.xcoords = []; - }, - endText: function endText() { + } + }, { + key: "endText", + value: function endText() { var current = this.current; if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement && current.txtElement.hasChildNodes()) { @@ -21201,118 +21828,365 @@ exports.SVGGraphics = SVGGraphics; this.clip('nonzero'); this.endPath(); } - }, - setLineWidth: function SVGGraphics_setLineWidth(width) { + } + }, { + key: "setLineWidth", + value: function setLineWidth(width) { if (width > 0) { this.current.lineWidth = width; } - }, - setLineCap: function SVGGraphics_setLineCap(style) { + } + }, { + key: "setLineCap", + value: function setLineCap(style) { this.current.lineCap = LINE_CAP_STYLES[style]; - }, - setLineJoin: function SVGGraphics_setLineJoin(style) { + } + }, { + key: "setLineJoin", + value: function setLineJoin(style) { this.current.lineJoin = LINE_JOIN_STYLES[style]; - }, - setMiterLimit: function SVGGraphics_setMiterLimit(limit) { + } + }, { + key: "setMiterLimit", + value: function setMiterLimit(limit) { this.current.miterLimit = limit; - }, - setStrokeAlpha: function SVGGraphics_setStrokeAlpha(strokeAlpha) { + } + }, { + key: "setStrokeAlpha", + value: function setStrokeAlpha(strokeAlpha) { this.current.strokeAlpha = strokeAlpha; - }, - setStrokeRGBColor: function SVGGraphics_setStrokeRGBColor(r, g, b) { - var color = _util.Util.makeCssRgb(r, g, b); - - this.current.strokeColor = color; - }, - setFillAlpha: function SVGGraphics_setFillAlpha(fillAlpha) { + } + }, { + key: "setStrokeRGBColor", + value: function setStrokeRGBColor(r, g, b) { + this.current.strokeColor = _util.Util.makeCssRgb(r, g, b); + } + }, { + key: "setFillAlpha", + value: function setFillAlpha(fillAlpha) { this.current.fillAlpha = fillAlpha; - }, - setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) { - var color = _util.Util.makeCssRgb(r, g, b); - - this.current.fillColor = color; + } + }, { + key: "setFillRGBColor", + value: function setFillRGBColor(r, g, b) { + this.current.fillColor = _util.Util.makeCssRgb(r, g, b); this.current.tspan = this.svgFactory.createElement('svg:tspan'); this.current.xcoords = []; - }, - setDash: function SVGGraphics_setDash(dashArray, dashPhase) { + } + }, { + key: "setStrokeColorN", + value: function setStrokeColorN(args) { + this.current.strokeColor = this._makeColorN_Pattern(args); + } + }, { + key: "setFillColorN", + value: function setFillColorN(args) { + this.current.fillColor = this._makeColorN_Pattern(args); + } + }, { + key: "shadingFill", + value: function shadingFill(args) { + var width = this.viewport.width; + var height = this.viewport.height; + + var inv = _util.Util.inverseTransform(this.transformMatrix); + + var bl = _util.Util.applyTransform([0, 0], inv); + + var br = _util.Util.applyTransform([0, height], inv); + + var ul = _util.Util.applyTransform([width, 0], inv); + + var ur = _util.Util.applyTransform([width, height], inv); + + var x0 = Math.min(bl[0], br[0], ul[0], ur[0]); + var y0 = Math.min(bl[1], br[1], ul[1], ur[1]); + var x1 = Math.max(bl[0], br[0], ul[0], ur[0]); + var y1 = Math.max(bl[1], br[1], ul[1], ur[1]); + var rect = this.svgFactory.createElement('svg:rect'); + rect.setAttributeNS(null, 'x', x0); + rect.setAttributeNS(null, 'y', y0); + rect.setAttributeNS(null, 'width', x1 - x0); + rect.setAttributeNS(null, 'height', y1 - y0); + rect.setAttributeNS(null, 'fill', this._makeShadingPattern(args)); + + this._ensureTransformGroup().appendChild(rect); + } + }, { + key: "_makeColorN_Pattern", + value: function _makeColorN_Pattern(args) { + if (args[0] === 'TilingPattern') { + return this._makeTilingPattern(args); + } + + return this._makeShadingPattern(args); + } + }, { + key: "_makeTilingPattern", + value: function _makeTilingPattern(args) { + var color = args[1]; + var operatorList = args[2]; + var matrix = args[3] || _util.IDENTITY_MATRIX; + + var _args$ = _slicedToArray(args[4], 4), + x0 = _args$[0], + y0 = _args$[1], + x1 = _args$[2], + y1 = _args$[3]; + + var xstep = args[5]; + var ystep = args[6]; + var paintType = args[7]; + var tilingId = "shading".concat(shadingCount++); + + var _Util$applyTransform = _util.Util.applyTransform([x0, y0], matrix), + _Util$applyTransform2 = _slicedToArray(_Util$applyTransform, 2), + tx0 = _Util$applyTransform2[0], + ty0 = _Util$applyTransform2[1]; + + var _Util$applyTransform3 = _util.Util.applyTransform([x1, y1], matrix), + _Util$applyTransform4 = _slicedToArray(_Util$applyTransform3, 2), + tx1 = _Util$applyTransform4[0], + ty1 = _Util$applyTransform4[1]; + + var _Util$singularValueDe = _util.Util.singularValueDecompose2dScale(matrix), + _Util$singularValueDe2 = _slicedToArray(_Util$singularValueDe, 2), + xscale = _Util$singularValueDe2[0], + yscale = _Util$singularValueDe2[1]; + + var txstep = xstep * xscale; + var tystep = ystep * yscale; + var tiling = this.svgFactory.createElement('svg:pattern'); + tiling.setAttributeNS(null, 'id', tilingId); + tiling.setAttributeNS(null, 'patternUnits', 'userSpaceOnUse'); + tiling.setAttributeNS(null, 'width', txstep); + tiling.setAttributeNS(null, 'height', tystep); + tiling.setAttributeNS(null, 'x', "".concat(tx0)); + tiling.setAttributeNS(null, 'y', "".concat(ty0)); + var svg = this.svg; + var transformMatrix = this.transformMatrix; + var fillColor = this.current.fillColor; + var strokeColor = this.current.strokeColor; + var bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0); + this.svg = bbox; + this.transformMatrix = matrix; + + if (paintType === 2) { + var cssColor = _util.Util.makeCssRgb.apply(_util.Util, _toConsumableArray(color)); + + this.current.fillColor = cssColor; + this.current.strokeColor = cssColor; + } + + this.executeOpTree(this.convertOpList(operatorList)); + this.svg = svg; + this.transformMatrix = transformMatrix; + this.current.fillColor = fillColor; + this.current.strokeColor = strokeColor; + tiling.appendChild(bbox.childNodes[0]); + this.defs.appendChild(tiling); + return "url(#".concat(tilingId, ")"); + } + }, { + key: "_makeShadingPattern", + value: function _makeShadingPattern(args) { + switch (args[0]) { + case 'RadialAxial': + var shadingId = "shading".concat(shadingCount++); + var colorStops = args[2]; + var gradient; + + switch (args[1]) { + case 'axial': + var point0 = args[3]; + var point1 = args[4]; + gradient = this.svgFactory.createElement('svg:linearGradient'); + gradient.setAttributeNS(null, 'id', shadingId); + gradient.setAttributeNS(null, 'gradientUnits', 'userSpaceOnUse'); + gradient.setAttributeNS(null, 'x1', point0[0]); + gradient.setAttributeNS(null, 'y1', point0[1]); + gradient.setAttributeNS(null, 'x2', point1[0]); + gradient.setAttributeNS(null, 'y2', point1[1]); + break; + + case 'radial': + var focalPoint = args[3]; + var circlePoint = args[4]; + var focalRadius = args[5]; + var circleRadius = args[6]; + gradient = this.svgFactory.createElement('svg:radialGradient'); + gradient.setAttributeNS(null, 'id', shadingId); + gradient.setAttributeNS(null, 'gradientUnits', 'userSpaceOnUse'); + gradient.setAttributeNS(null, 'cx', circlePoint[0]); + gradient.setAttributeNS(null, 'cy', circlePoint[1]); + gradient.setAttributeNS(null, 'r', circleRadius); + gradient.setAttributeNS(null, 'fx', focalPoint[0]); + gradient.setAttributeNS(null, 'fy', focalPoint[1]); + gradient.setAttributeNS(null, 'fr', focalRadius); + break; + + default: + throw new Error("Unknown RadialAxial type: ".concat(args[1])); + } + + var _iteratorNormalCompletion5 = true; + var _didIteratorError5 = false; + var _iteratorError5 = undefined; + + try { + for (var _iterator5 = colorStops[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { + var colorStop = _step5.value; + var stop = this.svgFactory.createElement('svg:stop'); + stop.setAttributeNS(null, 'offset', colorStop[0]); + stop.setAttributeNS(null, 'stop-color', colorStop[1]); + gradient.appendChild(stop); + } + } catch (err) { + _didIteratorError5 = true; + _iteratorError5 = err; + } finally { + try { + if (!_iteratorNormalCompletion5 && _iterator5["return"] != null) { + _iterator5["return"](); + } + } finally { + if (_didIteratorError5) { + throw _iteratorError5; + } + } + } + + this.defs.appendChild(gradient); + return "url(#".concat(shadingId, ")"); + + case 'Mesh': + (0, _util.warn)('Unimplemented pattern Mesh'); + return null; + + case 'Dummy': + return 'hotpink'; + + default: + throw new Error("Unknown IR type: ".concat(args[0])); + } + } + }, { + key: "setDash", + value: function setDash(dashArray, dashPhase) { this.current.dashArray = dashArray; this.current.dashPhase = dashPhase; - }, - constructPath: function SVGGraphics_constructPath(ops, args) { + } + }, { + key: "constructPath", + value: function constructPath(ops, args) { var current = this.current; var x = current.x, y = current.y; - current.path = this.svgFactory.createElement('svg:path'); var d = []; - var opLength = ops.length; - - for (var i = 0, j = 0; i < opLength; i++) { - switch (ops[i] | 0) { - case _util.OPS.rectangle: - x = args[j++]; - y = args[j++]; - var width = args[j++]; - var height = args[j++]; - var xw = x + width; - var yh = y + height; - d.push('M', pf(x), pf(y), 'L', pf(xw), pf(y), 'L', pf(xw), pf(yh), 'L', pf(x), pf(yh), 'Z'); - break; + var j = 0; + var _iteratorNormalCompletion6 = true; + var _didIteratorError6 = false; + var _iteratorError6 = undefined; - case _util.OPS.moveTo: - x = args[j++]; - y = args[j++]; - d.push('M', pf(x), pf(y)); - break; + try { + for (var _iterator6 = ops[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { + var op = _step6.value; + + switch (op | 0) { + case _util.OPS.rectangle: + x = args[j++]; + y = args[j++]; + var width = args[j++]; + var height = args[j++]; + var xw = x + width; + var yh = y + height; + d.push('M', pf(x), pf(y), 'L', pf(xw), pf(y), 'L', pf(xw), pf(yh), 'L', pf(x), pf(yh), 'Z'); + break; - case _util.OPS.lineTo: - x = args[j++]; - y = args[j++]; - d.push('L', pf(x), pf(y)); - break; + case _util.OPS.moveTo: + x = args[j++]; + y = args[j++]; + d.push('M', pf(x), pf(y)); + break; - case _util.OPS.curveTo: - x = args[j + 4]; - y = args[j + 5]; - d.push('C', pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y)); - j += 6; - break; + case _util.OPS.lineTo: + x = args[j++]; + y = args[j++]; + d.push('L', pf(x), pf(y)); + break; - case _util.OPS.curveTo2: - x = args[j + 2]; - y = args[j + 3]; - d.push('C', pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3])); - j += 4; - break; + case _util.OPS.curveTo: + x = args[j + 4]; + y = args[j + 5]; + d.push('C', pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y)); + j += 6; + break; - case _util.OPS.curveTo3: - x = args[j + 2]; - y = args[j + 3]; - d.push('C', pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y)); - j += 4; - break; + case _util.OPS.curveTo2: + x = args[j + 2]; + y = args[j + 3]; + d.push('C', pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3])); + j += 4; + break; - case _util.OPS.closePath: - d.push('Z'); - break; + case _util.OPS.curveTo3: + x = args[j + 2]; + y = args[j + 3]; + d.push('C', pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y)); + j += 4; + break; + + case _util.OPS.closePath: + d.push('Z'); + break; + } + } + } catch (err) { + _didIteratorError6 = true; + _iteratorError6 = err; + } finally { + try { + if (!_iteratorNormalCompletion6 && _iterator6["return"] != null) { + _iterator6["return"](); + } + } finally { + if (_didIteratorError6) { + throw _iteratorError6; + } } } - current.path.setAttributeNS(null, 'd', d.join(' ')); - current.path.setAttributeNS(null, 'fill', 'none'); + d = d.join(' '); - this._ensureTransformGroup().appendChild(current.path); + if (current.path && ops.length > 0 && ops[0] !== _util.OPS.rectangle && ops[0] !== _util.OPS.moveTo) { + d = current.path.getAttributeNS(null, 'd') + d; + } else { + current.path = this.svgFactory.createElement('svg:path'); + + this._ensureTransformGroup().appendChild(current.path); + } + current.path.setAttributeNS(null, 'd', d); + current.path.setAttributeNS(null, 'fill', 'none'); current.element = current.path; current.setCurrentPoint(x, y); - }, - endPath: function SVGGraphics_endPath() { + } + }, { + key: "endPath", + value: function endPath() { + var current = this.current; + current.path = null; + if (!this.pendingClip) { return; } - var current = this.current; - var clipId = 'clippath' + clipCount; - clipCount++; + if (!current.element) { + this.pendingClip = null; + return; + } + + var clipId = "clippath".concat(clipCount++); var clipPath = this.svgFactory.createElement('svg:clipPath'); clipPath.setAttributeNS(null, 'id', clipId); clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); @@ -21336,79 +22210,127 @@ exports.SVGGraphics = SVGGraphics; clipPath.setAttributeNS(null, 'clip-path', current.activeClipUrl); } - current.activeClipUrl = 'url(#' + clipId + ')'; + current.activeClipUrl = "url(#".concat(clipId, ")"); this.tgrp = null; - }, - clip: function SVGGraphics_clip(type) { + } + }, { + key: "clip", + value: function clip(type) { this.pendingClip = type; - }, - closePath: function SVGGraphics_closePath() { + } + }, { + key: "closePath", + value: function closePath() { var current = this.current; if (current.path) { - var d = current.path.getAttributeNS(null, 'd'); - d += 'Z'; + var d = "".concat(current.path.getAttributeNS(null, 'd'), "Z"); current.path.setAttributeNS(null, 'd', d); } - }, - setLeading: function SVGGraphics_setLeading(leading) { + } + }, { + key: "setLeading", + value: function setLeading(leading) { this.current.leading = -leading; - }, - setTextRise: function SVGGraphics_setTextRise(textRise) { + } + }, { + key: "setTextRise", + value: function setTextRise(textRise) { this.current.textRise = textRise; - }, - setTextRenderingMode: function setTextRenderingMode(textRenderingMode) { + } + }, { + key: "setTextRenderingMode", + value: function setTextRenderingMode(textRenderingMode) { this.current.textRenderingMode = textRenderingMode; - }, - setHScale: function SVGGraphics_setHScale(scale) { + } + }, { + key: "setHScale", + value: function setHScale(scale) { this.current.textHScale = scale / 100; - }, - setGState: function SVGGraphics_setGState(states) { - for (var i = 0, ii = states.length; i < ii; i++) { - var state = states[i]; - var key = state[0]; - var value = state[1]; - - switch (key) { - case 'LW': - this.setLineWidth(value); - break; + } + }, { + key: "setRenderingIntent", + value: function setRenderingIntent(intent) {} + }, { + key: "setFlatness", + value: function setFlatness(flatness) {} + }, { + key: "setGState", + value: function setGState(states) { + var _iteratorNormalCompletion7 = true; + var _didIteratorError7 = false; + var _iteratorError7 = undefined; - case 'LC': - this.setLineCap(value); - break; + try { + for (var _iterator7 = states[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { + var _step7$value = _slicedToArray(_step7.value, 2), + key = _step7$value[0], + value = _step7$value[1]; + + switch (key) { + case 'LW': + this.setLineWidth(value); + break; - case 'LJ': - this.setLineJoin(value); - break; + case 'LC': + this.setLineCap(value); + break; - case 'ML': - this.setMiterLimit(value); - break; + case 'LJ': + this.setLineJoin(value); + break; - case 'D': - this.setDash(value[0], value[1]); - break; + case 'ML': + this.setMiterLimit(value); + break; - case 'Font': - this.setFont(value); - break; + case 'D': + this.setDash(value[0], value[1]); + break; - case 'CA': - this.setStrokeAlpha(value); - break; + case 'RI': + this.setRenderingIntent(value); + break; - case 'ca': - this.setFillAlpha(value); - break; + case 'FL': + this.setFlatness(value); + break; - default: - (0, _util.warn)('Unimplemented graphic state ' + key); - break; + case 'Font': + this.setFont(value); + break; + + case 'CA': + this.setStrokeAlpha(value); + break; + + case 'ca': + this.setFillAlpha(value); + break; + + default: + (0, _util.warn)("Unimplemented graphic state operator ".concat(key)); + break; + } + } + } catch (err) { + _didIteratorError7 = true; + _iteratorError7 = err; + } finally { + try { + if (!_iteratorNormalCompletion7 && _iterator7["return"] != null) { + _iterator7["return"](); + } + } finally { + if (_didIteratorError7) { + throw _iteratorError7; + } } } - }, - fill: function SVGGraphics_fill() { + } + }, { + key: "fill", + value: function fill() { var current = this.current; if (current.element) { @@ -21416,8 +22338,10 @@ exports.SVGGraphics = SVGGraphics; current.element.setAttributeNS(null, 'fill-opacity', current.fillAlpha); this.endPath(); } - }, - stroke: function SVGGraphics_stroke() { + } + }, { + key: "stroke", + value: function stroke() { var current = this.current; if (current.element) { @@ -21426,60 +22350,86 @@ exports.SVGGraphics = SVGGraphics; current.element.setAttributeNS(null, 'fill', 'none'); this.endPath(); } - }, - _setStrokeAttributes: function _setStrokeAttributes(element) { + } + }, { + key: "_setStrokeAttributes", + value: function _setStrokeAttributes(element) { + var lineWidthScale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; var current = this.current; + var dashArray = current.dashArray; + + if (lineWidthScale !== 1 && dashArray.length > 0) { + dashArray = dashArray.map(function (value) { + return lineWidthScale * value; + }); + } + element.setAttributeNS(null, 'stroke', current.strokeColor); element.setAttributeNS(null, 'stroke-opacity', current.strokeAlpha); element.setAttributeNS(null, 'stroke-miterlimit', pf(current.miterLimit)); element.setAttributeNS(null, 'stroke-linecap', current.lineCap); element.setAttributeNS(null, 'stroke-linejoin', current.lineJoin); - element.setAttributeNS(null, 'stroke-width', pf(current.lineWidth) + 'px'); - element.setAttributeNS(null, 'stroke-dasharray', current.dashArray.map(pf).join(' ')); - element.setAttributeNS(null, 'stroke-dashoffset', pf(current.dashPhase) + 'px'); - }, - eoFill: function SVGGraphics_eoFill() { + element.setAttributeNS(null, 'stroke-width', pf(lineWidthScale * current.lineWidth) + 'px'); + element.setAttributeNS(null, 'stroke-dasharray', dashArray.map(pf).join(' ')); + element.setAttributeNS(null, 'stroke-dashoffset', pf(lineWidthScale * current.dashPhase) + 'px'); + } + }, { + key: "eoFill", + value: function eoFill() { if (this.current.element) { this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); } this.fill(); - }, - fillStroke: function SVGGraphics_fillStroke() { + } + }, { + key: "fillStroke", + value: function fillStroke() { this.stroke(); this.fill(); - }, - eoFillStroke: function SVGGraphics_eoFillStroke() { + } + }, { + key: "eoFillStroke", + value: function eoFillStroke() { if (this.current.element) { this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); } this.fillStroke(); - }, - closeStroke: function SVGGraphics_closeStroke() { + } + }, { + key: "closeStroke", + value: function closeStroke() { this.closePath(); this.stroke(); - }, - closeFillStroke: function SVGGraphics_closeFillStroke() { + } + }, { + key: "closeFillStroke", + value: function closeFillStroke() { this.closePath(); this.fillStroke(); - }, - closeEOFillStroke: function closeEOFillStroke() { + } + }, { + key: "closeEOFillStroke", + value: function closeEOFillStroke() { this.closePath(); this.eoFillStroke(); - }, - paintSolidColorImageMask: function SVGGraphics_paintSolidColorImageMask() { - var current = this.current; + } + }, { + key: "paintSolidColorImageMask", + value: function paintSolidColorImageMask() { var rect = this.svgFactory.createElement('svg:rect'); rect.setAttributeNS(null, 'x', '0'); rect.setAttributeNS(null, 'y', '0'); rect.setAttributeNS(null, 'width', '1px'); rect.setAttributeNS(null, 'height', '1px'); - rect.setAttributeNS(null, 'fill', current.fillColor); + rect.setAttributeNS(null, 'fill', this.current.fillColor); this._ensureTransformGroup().appendChild(rect); - }, - paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) { + } + }, { + key: "paintJpegXObject", + value: function paintJpegXObject(objId, w, h) { var imgObj = this.objs.get(objId); var imgEl = this.svgFactory.createElement('svg:image'); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src); @@ -21487,21 +22437,25 @@ exports.SVGGraphics = SVGGraphics; imgEl.setAttributeNS(null, 'height', pf(h)); imgEl.setAttributeNS(null, 'x', '0'); imgEl.setAttributeNS(null, 'y', pf(-h)); - imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')'); + imgEl.setAttributeNS(null, 'transform', "scale(".concat(pf(1 / w), " ").concat(pf(-1 / h), ")")); this._ensureTransformGroup().appendChild(imgEl); - }, - paintImageXObject: function SVGGraphics_paintImageXObject(objId) { + } + }, { + key: "paintImageXObject", + value: function paintImageXObject(objId) { var imgData = this.objs.get(objId); if (!imgData) { - (0, _util.warn)('Dependent image isn\'t ready yet'); + (0, _util.warn)("Dependent image with object ID ".concat(objId, " is not ready yet")); return; } this.paintInlineImageXObject(imgData); - }, - paintInlineImageXObject: function SVGGraphics_paintInlineImageXObject(imgData, mask) { + } + }, { + key: "paintInlineImageXObject", + value: function paintInlineImageXObject(imgData, mask) { var width = imgData.width; var height = imgData.height; var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask); @@ -21518,20 +22472,22 @@ exports.SVGGraphics = SVGGraphics; imgEl.setAttributeNS(null, 'y', pf(-height)); imgEl.setAttributeNS(null, 'width', pf(width) + 'px'); imgEl.setAttributeNS(null, 'height', pf(height) + 'px'); - imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / width) + ' ' + pf(-1 / height) + ')'); + imgEl.setAttributeNS(null, 'transform', "scale(".concat(pf(1 / width), " ").concat(pf(-1 / height), ")")); if (mask) { mask.appendChild(imgEl); } else { this._ensureTransformGroup().appendChild(imgEl); } - }, - paintImageMaskXObject: function SVGGraphics_paintImageMaskXObject(imgData) { + } + }, { + key: "paintImageMaskXObject", + value: function paintImageMaskXObject(imgData) { var current = this.current; var width = imgData.width; var height = imgData.height; var fillColor = current.fillColor; - current.maskId = 'mask' + maskCount++; + current.maskId = "mask".concat(maskCount++); var mask = this.svgFactory.createElement('svg:mask'); mask.setAttributeNS(null, 'id', current.maskId); var rect = this.svgFactory.createElement('svg:rect'); @@ -21540,14 +22496,16 @@ exports.SVGGraphics = SVGGraphics; rect.setAttributeNS(null, 'width', pf(width)); rect.setAttributeNS(null, 'height', pf(height)); rect.setAttributeNS(null, 'fill', fillColor); - rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId + ')'); + rect.setAttributeNS(null, 'mask', "url(#".concat(current.maskId, ")")); this.defs.appendChild(mask); this._ensureTransformGroup().appendChild(rect); this.paintInlineImageXObject(imgData, mask); - }, - paintFormXObjectBegin: function SVGGraphics_paintFormXObjectBegin(matrix, bbox) { + } + }, { + key: "paintFormXObjectBegin", + value: function paintFormXObjectBegin(matrix, bbox) { if (Array.isArray(matrix) && matrix.length === 6) { this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); } @@ -21564,9 +22522,13 @@ exports.SVGGraphics = SVGGraphics; this.clip('nonzero'); this.endPath(); } - }, - paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() {}, - _initialize: function _initialize(viewport) { + } + }, { + key: "paintFormXObjectEnd", + value: function paintFormXObjectEnd() {} + }, { + key: "_initialize", + value: function _initialize(viewport) { var svg = this.svgFactory.create(viewport.width, viewport.height); var definitions = this.svgFactory.createElement('svg:defs'); svg.appendChild(definitions); @@ -21576,8 +22538,10 @@ exports.SVGGraphics = SVGGraphics; svg.appendChild(rootGroup); this.svg = rootGroup; return svg; - }, - _ensureClipGroup: function SVGGraphics_ensureClipGroup() { + } + }, { + key: "_ensureClipGroup", + value: function _ensureClipGroup() { if (!this.current.clipGroup) { var clipGroup = this.svgFactory.createElement('svg:g'); clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl); @@ -21586,8 +22550,10 @@ exports.SVGGraphics = SVGGraphics; } return this.current.clipGroup; - }, - _ensureTransformGroup: function SVGGraphics_ensureTransformGroup() { + } + }, { + key: "_ensureTransformGroup", + value: function _ensureTransformGroup() { if (!this.tgrp) { this.tgrp = this.svgFactory.createElement('svg:g'); this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); @@ -21601,7 +22567,8 @@ exports.SVGGraphics = SVGGraphics; return this.tgrp; } - }; + }]); + return SVGGraphics; }(); } @@ -21618,13 +22585,13 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFNodeStream = void 0; -var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(148)); var _util = __w_pdfjs_require__(1); var _network_utils = __w_pdfjs_require__(166); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -21687,20 +22654,24 @@ function () { this.isHttp = this.url.protocol === 'http:' || this.url.protocol === 'https:'; this.isFsUrl = this.url.protocol === 'file:'; this.httpHeaders = this.isHttp && source.httpHeaders || {}; - this._fullRequest = null; + this._fullRequestReader = null; this._rangeRequestReaders = []; } _createClass(PDFNodeStream, [{ key: "getFullReader", value: function getFullReader() { - (0, _util.assert)(!this._fullRequest); - this._fullRequest = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this); - return this._fullRequest; + (0, _util.assert)(!this._fullRequestReader); + this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this); + return this._fullRequestReader; } }, { key: "getRangeReader", value: function getRangeReader(start, end) { + if (end <= this._progressiveDataLength) { + return null; + } + var rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end); this._rangeRequestReaders.push(rangeReader); @@ -21710,8 +22681,8 @@ function () { }, { key: "cancelAllRequests", value: function cancelAllRequests(reason) { - if (this._fullRequest) { - this._fullRequest.cancel(reason); + if (this._fullRequestReader) { + this._fullRequestReader.cancel(reason); } var readers = this._rangeRequestReaders.slice(0); @@ -21720,6 +22691,11 @@ function () { reader.cancel(reason); }); } + }, { + key: "_progressiveDataLength", + get: function get() { + return this._fullRequestReader ? this._fullRequestReader._loaded : 0; + } }]); return PDFNodeStream; @@ -21760,9 +22736,9 @@ function () { value: function () { var _read = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee() { + _regenerator["default"].mark(function _callee() { var chunk, buffer; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -21926,9 +22902,9 @@ function () { value: function () { var _read2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2() { + _regenerator["default"].mark(function _callee2() { var chunk, buffer; - return _regenerator.default.wrap(function _callee2$(_context2) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -22550,9 +23526,9 @@ function getFilenameFromContentDispositionHeader(contentDisposition) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFFetchStream = void 0; +exports.PDFNetworkStream = void 0; -var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(148)); var _util = __w_pdfjs_require__(1); @@ -22570,41 +23546,256 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function createFetchOptions(headers, withCredentials, abortController) { - return { - method: 'GET', - headers: headers, - signal: abortController && abortController.signal, - mode: 'cors', - credentials: withCredentials ? 'include' : 'same-origin', - redirect: 'follow' - }; +; +var OK_RESPONSE = 200; +var PARTIAL_CONTENT_RESPONSE = 206; + +function getArrayBuffer(xhr) { + var data = xhr.response; + + if (typeof data !== 'string') { + return data; + } + + var array = (0, _util.stringToBytes)(data); + return array.buffer; } -var PDFFetchStream = +var NetworkManager = /*#__PURE__*/ function () { - function PDFFetchStream(source) { - _classCallCheck(this, PDFFetchStream); + function NetworkManager(url, args) { + _classCallCheck(this, NetworkManager); - this.source = source; - this.isHttp = /^https?:/i.test(source.url); - this.httpHeaders = this.isHttp && source.httpHeaders || {}; + this.url = url; + args = args || {}; + this.isHttp = /^https?:/i.test(url); + this.httpHeaders = this.isHttp && args.httpHeaders || {}; + this.withCredentials = args.withCredentials || false; + + this.getXhr = args.getXhr || function NetworkManager_getXhr() { + return new XMLHttpRequest(); + }; + + this.currXhrId = 0; + this.pendingRequests = Object.create(null); + } + + _createClass(NetworkManager, [{ + key: "requestRange", + value: function requestRange(begin, end, listeners) { + var args = { + begin: begin, + end: end + }; + + for (var prop in listeners) { + args[prop] = listeners[prop]; + } + + return this.request(args); + } + }, { + key: "requestFull", + value: function requestFull(listeners) { + return this.request(listeners); + } + }, { + key: "request", + value: function request(args) { + var xhr = this.getXhr(); + var xhrId = this.currXhrId++; + var pendingRequest = this.pendingRequests[xhrId] = { + xhr: xhr + }; + xhr.open('GET', this.url); + xhr.withCredentials = this.withCredentials; + + for (var property in this.httpHeaders) { + var value = this.httpHeaders[property]; + + if (typeof value === 'undefined') { + continue; + } + + xhr.setRequestHeader(property, value); + } + + if (this.isHttp && 'begin' in args && 'end' in args) { + xhr.setRequestHeader('Range', "bytes=".concat(args.begin, "-").concat(args.end - 1)); + pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE; + } else { + pendingRequest.expectedStatus = OK_RESPONSE; + } + + xhr.responseType = 'arraybuffer'; + + if (args.onError) { + xhr.onerror = function (evt) { + args.onError(xhr.status); + }; + } + + xhr.onreadystatechange = this.onStateChange.bind(this, xhrId); + xhr.onprogress = this.onProgress.bind(this, xhrId); + pendingRequest.onHeadersReceived = args.onHeadersReceived; + pendingRequest.onDone = args.onDone; + pendingRequest.onError = args.onError; + pendingRequest.onProgress = args.onProgress; + xhr.send(null); + return xhrId; + } + }, { + key: "onProgress", + value: function onProgress(xhrId, evt) { + var pendingRequest = this.pendingRequests[xhrId]; + + if (!pendingRequest) { + return; + } + + if (pendingRequest.onProgress) { + pendingRequest.onProgress(evt); + } + } + }, { + key: "onStateChange", + value: function onStateChange(xhrId, evt) { + var pendingRequest = this.pendingRequests[xhrId]; + + if (!pendingRequest) { + return; + } + + var xhr = pendingRequest.xhr; + + if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) { + pendingRequest.onHeadersReceived(); + delete pendingRequest.onHeadersReceived; + } + + if (xhr.readyState !== 4) { + return; + } + + if (!(xhrId in this.pendingRequests)) { + return; + } + + delete this.pendingRequests[xhrId]; + + if (xhr.status === 0 && this.isHttp) { + if (pendingRequest.onError) { + pendingRequest.onError(xhr.status); + } + + return; + } + + var xhrStatus = xhr.status || OK_RESPONSE; + var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE; + + if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) { + if (pendingRequest.onError) { + pendingRequest.onError(xhr.status); + } + + return; + } + + var chunk = getArrayBuffer(xhr); + + if (xhrStatus === PARTIAL_CONTENT_RESPONSE) { + var rangeHeader = xhr.getResponseHeader('Content-Range'); + var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader); + pendingRequest.onDone({ + begin: parseInt(matches[1], 10), + chunk: chunk + }); + } else if (chunk) { + pendingRequest.onDone({ + begin: 0, + chunk: chunk + }); + } else if (pendingRequest.onError) { + pendingRequest.onError(xhr.status); + } + } + }, { + key: "hasPendingRequests", + value: function hasPendingRequests() { + for (var xhrId in this.pendingRequests) { + return true; + } + + return false; + } + }, { + key: "getRequestXhr", + value: function getRequestXhr(xhrId) { + return this.pendingRequests[xhrId].xhr; + } + }, { + key: "isPendingRequest", + value: function isPendingRequest(xhrId) { + return xhrId in this.pendingRequests; + } + }, { + key: "abortAllRequests", + value: function abortAllRequests() { + for (var xhrId in this.pendingRequests) { + this.abortRequest(xhrId | 0); + } + } + }, { + key: "abortRequest", + value: function abortRequest(xhrId) { + var xhr = this.pendingRequests[xhrId].xhr; + delete this.pendingRequests[xhrId]; + xhr.abort(); + } + }]); + + return NetworkManager; +}(); + +var PDFNetworkStream = +/*#__PURE__*/ +function () { + function PDFNetworkStream(source) { + _classCallCheck(this, PDFNetworkStream); + + this._source = source; + this._manager = new NetworkManager(source.url, { + httpHeaders: source.httpHeaders, + withCredentials: source.withCredentials + }); + this._rangeChunkSize = source.rangeChunkSize; this._fullRequestReader = null; this._rangeRequestReaders = []; } - _createClass(PDFFetchStream, [{ + _createClass(PDFNetworkStream, [{ + key: "_onRangeRequestReaderClosed", + value: function _onRangeRequestReaderClosed(reader) { + var i = this._rangeRequestReaders.indexOf(reader); + + if (i >= 0) { + this._rangeRequestReaders.splice(i, 1); + } + } + }, { key: "getFullReader", value: function getFullReader() { (0, _util.assert)(!this._fullRequestReader); - this._fullRequestReader = new PDFFetchStreamReader(this); + this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source); return this._fullRequestReader; } }, { key: "getRangeReader", value: function getRangeReader(begin, end) { - var reader = new PDFFetchStreamRangeReader(this, begin, end); + var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end); + reader.onClosed = this._onRangeRequestReaderClosed.bind(this); this._rangeRequestReaders.push(reader); @@ -22625,137 +23816,184 @@ function () { } }]); - return PDFFetchStream; + return PDFNetworkStream; }(); -exports.PDFFetchStream = PDFFetchStream; +exports.PDFNetworkStream = PDFNetworkStream; -var PDFFetchStreamReader = +var PDFNetworkStreamFullRequestReader = /*#__PURE__*/ function () { - function PDFFetchStreamReader(stream) { - var _this = this; - - _classCallCheck(this, PDFFetchStreamReader); + function PDFNetworkStreamFullRequestReader(manager, source) { + _classCallCheck(this, PDFNetworkStreamFullRequestReader); - this._stream = stream; - this._reader = null; - this._loaded = 0; - this._filename = null; - var source = stream.source; - this._withCredentials = source.withCredentials; - this._contentLength = source.length; - this._headersCapability = (0, _util.createPromiseCapability)(); + this._manager = manager; + var args = { + onHeadersReceived: this._onHeadersReceived.bind(this), + onDone: this._onDone.bind(this), + onError: this._onError.bind(this), + onProgress: this._onProgress.bind(this) + }; + this._url = source.url; + this._fullRequestId = manager.requestFull(args); + this._headersReceivedCapability = (0, _util.createPromiseCapability)(); this._disableRange = source.disableRange || false; + this._contentLength = source.length; this._rangeChunkSize = source.rangeChunkSize; if (!this._rangeChunkSize && !this._disableRange) { this._disableRange = true; } - if (typeof AbortController !== 'undefined') { - this._abortController = new AbortController(); - } - - this._isStreamingSupported = !source.disableStream; - this._isRangeSupported = !source.disableRange; - this._headers = new Headers(); - - for (var property in this._stream.httpHeaders) { - var value = this._stream.httpHeaders[property]; - - if (typeof value === 'undefined') { - continue; - } - - this._headers.append(property, value); - } - - var url = source.url; - fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) { - if (!(0, _network_utils.validateResponseStatus)(response.status)) { - throw (0, _network_utils.createResponseStatusError)(response.status, url); - } + this._isStreamingSupported = false; + this._isRangeSupported = false; + this._cachedChunks = []; + this._requests = []; + this._done = false; + this._storedError = undefined; + this._filename = null; + this.onProgress = null; + } - _this._reader = response.body.getReader(); + _createClass(PDFNetworkStreamFullRequestReader, [{ + key: "_onHeadersReceived", + value: function _onHeadersReceived() { + var fullRequestXhrId = this._fullRequestId; - _this._headersCapability.resolve(); + var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId); var getResponseHeader = function getResponseHeader(name) { - return response.headers.get(name); + return fullRequestXhr.getResponseHeader(name); }; var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ getResponseHeader: getResponseHeader, - isHttp: _this._stream.isHttp, - rangeChunkSize: _this._rangeChunkSize, - disableRange: _this._disableRange + isHttp: this._manager.isHttp, + rangeChunkSize: this._rangeChunkSize, + disableRange: this._disableRange }), allowRangeRequests = _validateRangeRequest.allowRangeRequests, suggestedLength = _validateRangeRequest.suggestedLength; - _this._isRangeSupported = allowRangeRequests; - _this._contentLength = suggestedLength || _this._contentLength; - _this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); + if (allowRangeRequests) { + this._isRangeSupported = true; + } - if (!_this._isStreamingSupported && _this._isRangeSupported) { - _this.cancel(new _util.AbortException('streaming is disabled')); + this._contentLength = suggestedLength || this._contentLength; + this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); + + if (this._isRangeSupported) { + this._manager.abortRequest(fullRequestXhrId); } - }).catch(this._headersCapability.reject); - this.onProgress = null; - } - _createClass(PDFFetchStreamReader, [{ + this._headersReceivedCapability.resolve(); + } + }, { + key: "_onDone", + value: function _onDone(args) { + if (args) { + if (this._requests.length > 0) { + var requestCapability = this._requests.shift(); + + requestCapability.resolve({ + value: args.chunk, + done: false + }); + } else { + this._cachedChunks.push(args.chunk); + } + } + + this._done = true; + + if (this._cachedChunks.length > 0) { + return; + } + + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); + + this._requests = []; + } + }, { + key: "_onError", + value: function _onError(status) { + var url = this._url; + var exception = (0, _network_utils.createResponseStatusError)(status, url); + this._storedError = exception; + + this._headersReceivedCapability.reject(exception); + + this._requests.forEach(function (requestCapability) { + requestCapability.reject(exception); + }); + + this._requests = []; + this._cachedChunks = []; + } + }, { + key: "_onProgress", + value: function _onProgress(data) { + if (this.onProgress) { + this.onProgress({ + loaded: data.loaded, + total: data.lengthComputable ? data.total : this._contentLength + }); + } + } + }, { key: "read", value: function () { var _read = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee() { - var _ref, value, done, buffer; - - return _regenerator.default.wrap(function _callee$(_context) { + _regenerator["default"].mark(function _callee() { + var chunk, requestCapability; + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: - _context.next = 2; - return this._headersCapability.promise; - - case 2: - _context.next = 4; - return this._reader.read(); + if (!this._storedError) { + _context.next = 2; + break; + } - case 4: - _ref = _context.sent; - value = _ref.value; - done = _ref.done; + throw this._storedError; - if (!done) { - _context.next = 9; + case 2: + if (!(this._cachedChunks.length > 0)) { + _context.next = 5; break; } + chunk = this._cachedChunks.shift(); return _context.abrupt("return", { - value: value, - done: done + value: chunk, + done: false }); - case 9: - this._loaded += value.byteLength; - - if (this.onProgress) { - this.onProgress({ - loaded: this._loaded, - total: this._contentLength - }); + case 5: + if (!this._done) { + _context.next = 7; + break; } - buffer = new Uint8Array(value).buffer; return _context.abrupt("return", { - value: buffer, - done: false + value: undefined, + done: true }); - case 13: + case 7: + requestCapability = (0, _util.createPromiseCapability)(); + + this._requests.push(requestCapability); + + return _context.abrupt("return", requestCapability.promise); + + case 10: case "end": return _context.stop(); } @@ -22772,29 +24010,30 @@ function () { }, { key: "cancel", value: function cancel(reason) { - if (this._reader) { - this._reader.cancel(reason); - } + this._done = true; - if (this._abortController) { - this._abortController.abort(); + this._headersReceivedCapability.reject(reason); + + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); + + this._requests = []; + + if (this._manager.isPendingRequest(this._fullRequestId)) { + this._manager.abortRequest(this._fullRequestId); } - } - }, { - key: "headersReady", - get: function get() { - return this._headersCapability.promise; + + this._fullRequestReader = null; } }, { key: "filename", get: function get() { return this._filename; } - }, { - key: "contentLength", - get: function get() { - return this._contentLength; - } }, { key: "isRangeSupported", get: function get() { @@ -22805,110 +24044,127 @@ function () { get: function get() { return this._isStreamingSupported; } + }, { + key: "contentLength", + get: function get() { + return this._contentLength; + } + }, { + key: "headersReady", + get: function get() { + return this._headersReceivedCapability.promise; + } }]); - return PDFFetchStreamReader; + return PDFNetworkStreamFullRequestReader; }(); -var PDFFetchStreamRangeReader = +var PDFNetworkStreamRangeRequestReader = /*#__PURE__*/ function () { - function PDFFetchStreamRangeReader(stream, begin, end) { - var _this2 = this; - - _classCallCheck(this, PDFFetchStreamRangeReader); + function PDFNetworkStreamRangeRequestReader(manager, begin, end) { + _classCallCheck(this, PDFNetworkStreamRangeRequestReader); - this._stream = stream; - this._reader = null; - this._loaded = 0; - var source = stream.source; - this._withCredentials = source.withCredentials; - this._readCapability = (0, _util.createPromiseCapability)(); - this._isStreamingSupported = !source.disableStream; + this._manager = manager; + var args = { + onDone: this._onDone.bind(this), + onProgress: this._onProgress.bind(this) + }; + this._requestId = manager.requestRange(begin, end, args); + this._requests = []; + this._queuedChunk = null; + this._done = false; + this.onProgress = null; + this.onClosed = null; + } - if (typeof AbortController !== 'undefined') { - this._abortController = new AbortController(); + _createClass(PDFNetworkStreamRangeRequestReader, [{ + key: "_close", + value: function _close() { + if (this.onClosed) { + this.onClosed(this); + } } + }, { + key: "_onDone", + value: function _onDone(data) { + var chunk = data.chunk; - this._headers = new Headers(); - - for (var property in this._stream.httpHeaders) { - var value = this._stream.httpHeaders[property]; + if (this._requests.length > 0) { + var requestCapability = this._requests.shift(); - if (typeof value === 'undefined') { - continue; + requestCapability.resolve({ + value: chunk, + done: false + }); + } else { + this._queuedChunk = chunk; } - this._headers.append(property, value); - } + this._done = true; - var rangeStr = begin + '-' + (end - 1); + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); - this._headers.append('Range', 'bytes=' + rangeStr); + this._requests = []; - var url = source.url; - fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) { - if (!(0, _network_utils.validateResponseStatus)(response.status)) { - throw (0, _network_utils.createResponseStatusError)(response.status, url); + this._close(); + } + }, { + key: "_onProgress", + value: function _onProgress(evt) { + if (!this.isStreamingSupported && this.onProgress) { + this.onProgress({ + loaded: evt.loaded + }); } - - _this2._readCapability.resolve(); - - _this2._reader = response.body.getReader(); - }); - this.onProgress = null; - } - - _createClass(PDFFetchStreamRangeReader, [{ + } + }, { key: "read", value: function () { var _read2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2() { - var _ref2, value, done, buffer; - - return _regenerator.default.wrap(function _callee2$(_context2) { + _regenerator["default"].mark(function _callee2() { + var chunk, requestCapability; + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: - _context2.next = 2; - return this._readCapability.promise; + if (!(this._queuedChunk !== null)) { + _context2.next = 4; + break; + } - case 2: - _context2.next = 4; - return this._reader.read(); + chunk = this._queuedChunk; + this._queuedChunk = null; + return _context2.abrupt("return", { + value: chunk, + done: false + }); case 4: - _ref2 = _context2.sent; - value = _ref2.value; - done = _ref2.done; - - if (!done) { - _context2.next = 9; + if (!this._done) { + _context2.next = 6; break; } return _context2.abrupt("return", { - value: value, - done: done + value: undefined, + done: true }); - case 9: - this._loaded += value.byteLength; + case 6: + requestCapability = (0, _util.createPromiseCapability)(); - if (this.onProgress) { - this.onProgress({ - loaded: this._loaded - }); - } + this._requests.push(requestCapability); - buffer = new Uint8Array(value).buffer; - return _context2.abrupt("return", { - value: buffer, - done: false - }); + return _context2.abrupt("return", requestCapability.promise); - case 13: + case 9: case "end": return _context2.stop(); } @@ -22925,22 +24181,31 @@ function () { }, { key: "cancel", value: function cancel(reason) { - if (this._reader) { - this._reader.cancel(reason); - } + this._done = true; - if (this._abortController) { - this._abortController.abort(); + this._requests.forEach(function (requestCapability) { + requestCapability.resolve({ + value: undefined, + done: true + }); + }); + + this._requests = []; + + if (this._manager.isPendingRequest(this._requestId)) { + this._manager.abortRequest(this._requestId); } + + this._close(); } }, { key: "isStreamingSupported", get: function get() { - return this._isStreamingSupported; + return false; } }]); - return PDFFetchStreamRangeReader; + return PDFNetworkStreamRangeRequestReader; }(); /***/ }), @@ -22953,645 +24218,405 @@ function () { Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFNetworkStream = PDFNetworkStream; -exports.NetworkManager = NetworkManager; +exports.PDFFetchStream = void 0; -var _regenerator = _interopRequireDefault(__w_pdfjs_require__(147)); +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(148)); var _util = __w_pdfjs_require__(1); var _network_utils = __w_pdfjs_require__(166); -var _global_scope = _interopRequireDefault(__w_pdfjs_require__(3)); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -; -var OK_RESPONSE = 200; -var PARTIAL_CONTENT_RESPONSE = 206; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function NetworkManager(url, args) { - this.url = url; - args = args || {}; - this.isHttp = /^https?:/i.test(url); - this.httpHeaders = this.isHttp && args.httpHeaders || {}; - this.withCredentials = args.withCredentials || false; +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - this.getXhr = args.getXhr || function NetworkManager_getXhr() { - return new XMLHttpRequest(); - }; +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - this.currXhrId = 0; - this.pendingRequests = Object.create(null); - this.loadedRequests = Object.create(null); +function createFetchOptions(headers, withCredentials, abortController) { + return { + method: 'GET', + headers: headers, + signal: abortController && abortController.signal, + mode: 'cors', + credentials: withCredentials ? 'include' : 'same-origin', + redirect: 'follow' + }; } -function getArrayBuffer(xhr) { - var data = xhr.response; +var PDFFetchStream = +/*#__PURE__*/ +function () { + function PDFFetchStream(source) { + _classCallCheck(this, PDFFetchStream); - if (typeof data !== 'string') { - return data; + this.source = source; + this.isHttp = /^https?:/i.test(source.url); + this.httpHeaders = this.isHttp && source.httpHeaders || {}; + this._fullRequestReader = null; + this._rangeRequestReaders = []; } - var array = (0, _util.stringToBytes)(data); - return array.buffer; -} + _createClass(PDFFetchStream, [{ + key: "getFullReader", + value: function getFullReader() { + (0, _util.assert)(!this._fullRequestReader); + this._fullRequestReader = new PDFFetchStreamReader(this); + return this._fullRequestReader; + } + }, { + key: "getRangeReader", + value: function getRangeReader(begin, end) { + if (end <= this._progressiveDataLength) { + return null; + } -var supportsMozChunked = function supportsMozChunkedClosure() { - try { - var x = new XMLHttpRequest(); - x.open('GET', _global_scope.default.location.href); - x.responseType = 'moz-chunked-arraybuffer'; - return x.responseType === 'moz-chunked-arraybuffer'; - } catch (e) { - return false; - } -}(); + var reader = new PDFFetchStreamRangeReader(this, begin, end); -NetworkManager.prototype = { - requestRange: function NetworkManager_requestRange(begin, end, listeners) { - var args = { - begin: begin, - end: end - }; + this._rangeRequestReaders.push(reader); - for (var prop in listeners) { - args[prop] = listeners[prop]; + return reader; } + }, { + key: "cancelAllRequests", + value: function cancelAllRequests(reason) { + if (this._fullRequestReader) { + this._fullRequestReader.cancel(reason); + } - return this.request(args); - }, - requestFull: function NetworkManager_requestFull(listeners) { - return this.request(listeners); - }, - request: function NetworkManager_request(args) { - var xhr = this.getXhr(); - var xhrId = this.currXhrId++; - var pendingRequest = this.pendingRequests[xhrId] = { - xhr: xhr - }; - xhr.open('GET', this.url); - xhr.withCredentials = this.withCredentials; - - for (var property in this.httpHeaders) { - var value = this.httpHeaders[property]; + var readers = this._rangeRequestReaders.slice(0); - if (typeof value === 'undefined') { - continue; - } - - xhr.setRequestHeader(property, value); - } - - if (this.isHttp && 'begin' in args && 'end' in args) { - var rangeStr = args.begin + '-' + (args.end - 1); - xhr.setRequestHeader('Range', 'bytes=' + rangeStr); - pendingRequest.expectedStatus = 206; - } else { - pendingRequest.expectedStatus = 200; + readers.forEach(function (reader) { + reader.cancel(reason); + }); } - - var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData; - - if (useMozChunkedLoading) { - xhr.responseType = 'moz-chunked-arraybuffer'; - pendingRequest.onProgressiveData = args.onProgressiveData; - pendingRequest.mozChunked = true; - } else { - xhr.responseType = 'arraybuffer'; + }, { + key: "_progressiveDataLength", + get: function get() { + return this._fullRequestReader ? this._fullRequestReader._loaded : 0; } + }]); - if (args.onError) { - xhr.onerror = function (evt) { - args.onError(xhr.status); - }; - } + return PDFFetchStream; +}(); - xhr.onreadystatechange = this.onStateChange.bind(this, xhrId); - xhr.onprogress = this.onProgress.bind(this, xhrId); - pendingRequest.onHeadersReceived = args.onHeadersReceived; - pendingRequest.onDone = args.onDone; - pendingRequest.onError = args.onError; - pendingRequest.onProgress = args.onProgress; - xhr.send(null); - return xhrId; - }, - onProgress: function NetworkManager_onProgress(xhrId, evt) { - var pendingRequest = this.pendingRequests[xhrId]; +exports.PDFFetchStream = PDFFetchStream; - if (!pendingRequest) { - return; - } +var PDFFetchStreamReader = +/*#__PURE__*/ +function () { + function PDFFetchStreamReader(stream) { + var _this = this; - if (pendingRequest.mozChunked) { - var chunk = getArrayBuffer(pendingRequest.xhr); - pendingRequest.onProgressiveData(chunk); - } + _classCallCheck(this, PDFFetchStreamReader); - var onProgress = pendingRequest.onProgress; + this._stream = stream; + this._reader = null; + this._loaded = 0; + this._filename = null; + var source = stream.source; + this._withCredentials = source.withCredentials || false; + this._contentLength = source.length; + this._headersCapability = (0, _util.createPromiseCapability)(); + this._disableRange = source.disableRange || false; + this._rangeChunkSize = source.rangeChunkSize; - if (onProgress) { - onProgress(evt); + if (!this._rangeChunkSize && !this._disableRange) { + this._disableRange = true; } - }, - onStateChange: function NetworkManager_onStateChange(xhrId, evt) { - var pendingRequest = this.pendingRequests[xhrId]; - if (!pendingRequest) { - return; + if (typeof AbortController !== 'undefined') { + this._abortController = new AbortController(); } - var xhr = pendingRequest.xhr; + this._isStreamingSupported = !source.disableStream; + this._isRangeSupported = !source.disableRange; + this._headers = new Headers(); - if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) { - pendingRequest.onHeadersReceived(); - delete pendingRequest.onHeadersReceived; - } + for (var property in this._stream.httpHeaders) { + var value = this._stream.httpHeaders[property]; - if (xhr.readyState !== 4) { - return; - } + if (typeof value === 'undefined') { + continue; + } - if (!(xhrId in this.pendingRequests)) { - return; + this._headers.append(property, value); } - delete this.pendingRequests[xhrId]; - - if (xhr.status === 0 && this.isHttp) { - if (pendingRequest.onError) { - pendingRequest.onError(xhr.status); + var url = source.url; + fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) { + if (!(0, _network_utils.validateResponseStatus)(response.status)) { + throw (0, _network_utils.createResponseStatusError)(response.status, url); } - return; - } - - var xhrStatus = xhr.status || OK_RESPONSE; - var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE; + _this._reader = response.body.getReader(); - if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) { - if (pendingRequest.onError) { - pendingRequest.onError(xhr.status); - } + _this._headersCapability.resolve(); - return; - } + var getResponseHeader = function getResponseHeader(name) { + return response.headers.get(name); + }; - this.loadedRequests[xhrId] = true; - var chunk = getArrayBuffer(xhr); + var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ + getResponseHeader: getResponseHeader, + isHttp: _this._stream.isHttp, + rangeChunkSize: _this._rangeChunkSize, + disableRange: _this._disableRange + }), + allowRangeRequests = _validateRangeRequest.allowRangeRequests, + suggestedLength = _validateRangeRequest.suggestedLength; - if (xhrStatus === PARTIAL_CONTENT_RESPONSE) { - var rangeHeader = xhr.getResponseHeader('Content-Range'); - var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader); - var begin = parseInt(matches[1], 10); - pendingRequest.onDone({ - begin: begin, - chunk: chunk - }); - } else if (pendingRequest.onProgressiveData) { - pendingRequest.onDone(null); - } else if (chunk) { - pendingRequest.onDone({ - begin: 0, - chunk: chunk - }); - } else if (pendingRequest.onError) { - pendingRequest.onError(xhr.status); - } - }, - hasPendingRequests: function NetworkManager_hasPendingRequests() { - for (var xhrId in this.pendingRequests) { - return true; - } + _this._isRangeSupported = allowRangeRequests; + _this._contentLength = suggestedLength || _this._contentLength; + _this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); - return false; - }, - getRequestXhr: function NetworkManager_getXhr(xhrId) { - return this.pendingRequests[xhrId].xhr; - }, - isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) { - return !!this.pendingRequests[xhrId].onProgressiveData; - }, - isPendingRequest: function NetworkManager_isPendingRequest(xhrId) { - return xhrId in this.pendingRequests; - }, - isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) { - return xhrId in this.loadedRequests; - }, - abortAllRequests: function NetworkManager_abortAllRequests() { - for (var xhrId in this.pendingRequests) { - this.abortRequest(xhrId | 0); - } - }, - abortRequest: function NetworkManager_abortRequest(xhrId) { - var xhr = this.pendingRequests[xhrId].xhr; - delete this.pendingRequests[xhrId]; - xhr.abort(); + if (!_this._isStreamingSupported && _this._isRangeSupported) { + _this.cancel(new _util.AbortException('Streaming is disabled.')); + } + })["catch"](this._headersCapability.reject); + this.onProgress = null; } -}; -function PDFNetworkStream(source) { - this._source = source; - this._manager = new NetworkManager(source.url, { - httpHeaders: source.httpHeaders, - withCredentials: source.withCredentials - }); - this._rangeChunkSize = source.rangeChunkSize; - this._fullRequestReader = null; - this._rangeRequestReaders = []; -} + _createClass(PDFFetchStreamReader, [{ + key: "read", + value: function () { + var _read = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee() { + var _ref, value, done, buffer; -PDFNetworkStream.prototype = { - _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) { - var i = this._rangeRequestReaders.indexOf(reader); + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return this._headersCapability.promise; - if (i >= 0) { - this._rangeRequestReaders.splice(i, 1); - } - }, - getFullReader: function PDFNetworkStream_getFullReader() { - (0, _util.assert)(!this._fullRequestReader); - this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source); - return this._fullRequestReader; - }, - getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) { - var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end); - reader.onClosed = this._onRangeRequestReaderClosed.bind(this); + case 2: + _context.next = 4; + return this._reader.read(); - this._rangeRequestReaders.push(reader); + case 4: + _ref = _context.sent; + value = _ref.value; + done = _ref.done; - return reader; - }, - cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) { - if (this._fullRequestReader) { - this._fullRequestReader.cancel(reason); - } + if (!done) { + _context.next = 9; + break; + } - var readers = this._rangeRequestReaders.slice(0); + return _context.abrupt("return", { + value: value, + done: done + }); - readers.forEach(function (reader) { - reader.cancel(reason); - }); - } -}; + case 9: + this._loaded += value.byteLength; -function PDFNetworkStreamFullRequestReader(manager, source) { - this._manager = manager; - var args = { - onHeadersReceived: this._onHeadersReceived.bind(this), - onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this), - onDone: this._onDone.bind(this), - onError: this._onError.bind(this), - onProgress: this._onProgress.bind(this) - }; - this._url = source.url; - this._fullRequestId = manager.requestFull(args); - this._headersReceivedCapability = (0, _util.createPromiseCapability)(); - this._disableRange = source.disableRange || false; - this._contentLength = source.length; - this._rangeChunkSize = source.rangeChunkSize; - - if (!this._rangeChunkSize && !this._disableRange) { - this._disableRange = true; - } - - this._isStreamingSupported = false; - this._isRangeSupported = false; - this._cachedChunks = []; - this._requests = []; - this._done = false; - this._storedError = undefined; - this._filename = null; - this.onProgress = null; -} + if (this.onProgress) { + this.onProgress({ + loaded: this._loaded, + total: this._contentLength + }); + } -PDFNetworkStreamFullRequestReader.prototype = { - _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() { - var fullRequestXhrId = this._fullRequestId; + buffer = new Uint8Array(value).buffer; + return _context.abrupt("return", { + value: buffer, + done: false + }); - var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId); + case 13: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); - var getResponseHeader = function getResponseHeader(name) { - return fullRequestXhr.getResponseHeader(name); - }; + function read() { + return _read.apply(this, arguments); + } - var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ - getResponseHeader: getResponseHeader, - isHttp: this._manager.isHttp, - rangeChunkSize: this._rangeChunkSize, - disableRange: this._disableRange - }), - allowRangeRequests = _validateRangeRequest.allowRangeRequests, - suggestedLength = _validateRangeRequest.suggestedLength; + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + if (this._reader) { + this._reader.cancel(reason); + } - if (allowRangeRequests) { - this._isRangeSupported = true; + if (this._abortController) { + this._abortController.abort(); + } } - - this._contentLength = suggestedLength || this._contentLength; - this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); - var networkManager = this._manager; - - if (networkManager.isStreamingRequest(fullRequestXhrId)) { - this._isStreamingSupported = true; - } else if (this._isRangeSupported) { - networkManager.abortRequest(fullRequestXhrId); + }, { + key: "headersReady", + get: function get() { + return this._headersCapability.promise; } - - this._headersReceivedCapability.resolve(); - }, - _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) { - if (this._requests.length > 0) { - var requestCapability = this._requests.shift(); - - requestCapability.resolve({ - value: chunk, - done: false - }); - } else { - this._cachedChunks.push(chunk); + }, { + key: "filename", + get: function get() { + return this._filename; } - }, - _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) { - if (args) { - this._onProgressiveData(args.chunk); + }, { + key: "contentLength", + get: function get() { + return this._contentLength; } - - this._done = true; - - if (this._cachedChunks.length > 0) { - return; + }, { + key: "isRangeSupported", + get: function get() { + return this._isRangeSupported; } - - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); - - this._requests = []; - }, - _onError: function PDFNetworkStreamFullRequestReader_onError(status) { - var url = this._url; - var exception = (0, _network_utils.createResponseStatusError)(status, url); - this._storedError = exception; - - this._headersReceivedCapability.reject(exception); - - this._requests.forEach(function (requestCapability) { - requestCapability.reject(exception); - }); - - this._requests = []; - this._cachedChunks = []; - }, - _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) { - if (this.onProgress) { - this.onProgress({ - loaded: data.loaded, - total: data.lengthComputable ? data.total : this._contentLength - }); + }, { + key: "isStreamingSupported", + get: function get() { + return this._isStreamingSupported; } - }, - - get filename() { - return this._filename; - }, - - get isRangeSupported() { - return this._isRangeSupported; - }, - - get isStreamingSupported() { - return this._isStreamingSupported; - }, - - get contentLength() { - return this._contentLength; - }, - - get headersReady() { - return this._headersReceivedCapability.promise; - }, - - read: function () { - var _read = _asyncToGenerator( - /*#__PURE__*/ - _regenerator.default.mark(function _callee() { - var chunk, requestCapability; - return _regenerator.default.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - if (!this._storedError) { - _context.next = 2; - break; - } - - throw this._storedError; - - case 2: - if (!(this._cachedChunks.length > 0)) { - _context.next = 5; - break; - } - - chunk = this._cachedChunks.shift(); - return _context.abrupt("return", { - value: chunk, - done: false - }); - - case 5: - if (!this._done) { - _context.next = 7; - break; - } - - return _context.abrupt("return", { - value: undefined, - done: true - }); + }]); - case 7: - requestCapability = (0, _util.createPromiseCapability)(); + return PDFFetchStreamReader; +}(); - this._requests.push(requestCapability); +var PDFFetchStreamRangeReader = +/*#__PURE__*/ +function () { + function PDFFetchStreamRangeReader(stream, begin, end) { + var _this2 = this; - return _context.abrupt("return", requestCapability.promise); + _classCallCheck(this, PDFFetchStreamRangeReader); - case 10: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); + this._stream = stream; + this._reader = null; + this._loaded = 0; + var source = stream.source; + this._withCredentials = source.withCredentials || false; + this._readCapability = (0, _util.createPromiseCapability)(); + this._isStreamingSupported = !source.disableStream; - function read() { - return _read.apply(this, arguments); + if (typeof AbortController !== 'undefined') { + this._abortController = new AbortController(); } - return read; - }(), - cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) { - this._done = true; - - this._headersReceivedCapability.reject(reason); - - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); - - this._requests = []; - - if (this._manager.isPendingRequest(this._fullRequestId)) { - this._manager.abortRequest(this._fullRequestId); - } + this._headers = new Headers(); - this._fullRequestReader = null; - } -}; + for (var property in this._stream.httpHeaders) { + var value = this._stream.httpHeaders[property]; -function PDFNetworkStreamRangeRequestReader(manager, begin, end) { - this._manager = manager; - var args = { - onDone: this._onDone.bind(this), - onProgress: this._onProgress.bind(this) - }; - this._requestId = manager.requestRange(begin, end, args); - this._requests = []; - this._queuedChunk = null; - this._done = false; - this.onProgress = null; - this.onClosed = null; -} + if (typeof value === 'undefined') { + continue; + } -PDFNetworkStreamRangeRequestReader.prototype = { - _close: function PDFNetworkStreamRangeRequestReader_close() { - if (this.onClosed) { - this.onClosed(this); + this._headers.append(property, value); } - }, - _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) { - var chunk = data.chunk; - if (this._requests.length > 0) { - var requestCapability = this._requests.shift(); + this._headers.append('Range', "bytes=".concat(begin, "-").concat(end - 1)); - requestCapability.resolve({ - value: chunk, - done: false - }); - } else { - this._queuedChunk = chunk; - } + var url = source.url; + fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) { + if (!(0, _network_utils.validateResponseStatus)(response.status)) { + throw (0, _network_utils.createResponseStatusError)(response.status, url); + } - this._done = true; + _this2._readCapability.resolve(); - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); + _this2._reader = response.body.getReader(); }); + this.onProgress = null; + } - this._requests = []; - - this._close(); - }, - _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) { - if (!this.isStreamingSupported && this.onProgress) { - this.onProgress({ - loaded: evt.loaded - }); - } - }, + _createClass(PDFFetchStreamRangeReader, [{ + key: "read", + value: function () { + var _read2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee2() { + var _ref2, value, done, buffer; - get isStreamingSupported() { - return false; - }, + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return this._readCapability.promise; - read: function () { - var _read2 = _asyncToGenerator( - /*#__PURE__*/ - _regenerator.default.mark(function _callee2() { - var chunk, requestCapability; - return _regenerator.default.wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - if (!(this._queuedChunk !== null)) { + case 2: _context2.next = 4; - break; - } + return this._reader.read(); - chunk = this._queuedChunk; - this._queuedChunk = null; - return _context2.abrupt("return", { - value: chunk, - done: false - }); + case 4: + _ref2 = _context2.sent; + value = _ref2.value; + done = _ref2.done; - case 4: - if (!this._done) { - _context2.next = 6; - break; - } + if (!done) { + _context2.next = 9; + break; + } - return _context2.abrupt("return", { - value: undefined, - done: true - }); + return _context2.abrupt("return", { + value: value, + done: done + }); - case 6: - requestCapability = (0, _util.createPromiseCapability)(); + case 9: + this._loaded += value.byteLength; - this._requests.push(requestCapability); + if (this.onProgress) { + this.onProgress({ + loaded: this._loaded + }); + } - return _context2.abrupt("return", requestCapability.promise); + buffer = new Uint8Array(value).buffer; + return _context2.abrupt("return", { + value: buffer, + done: false + }); - case 9: - case "end": - return _context2.stop(); + case 13: + case "end": + return _context2.stop(); + } } - } - }, _callee2, this); - })); - - function read() { - return _read2.apply(this, arguments); - } - - return read; - }(), - cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) { - this._done = true; + }, _callee2, this); + })); - this._requests.forEach(function (requestCapability) { - requestCapability.resolve({ - value: undefined, - done: true - }); - }); + function read() { + return _read2.apply(this, arguments); + } - this._requests = []; + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + if (this._reader) { + this._reader.cancel(reason); + } - if (this._manager.isPendingRequest(this._requestId)) { - this._manager.abortRequest(this._requestId); + if (this._abortController) { + this._abortController.abort(); + } + } + }, { + key: "isStreamingSupported", + get: function get() { + return this._isStreamingSupported; } + }]); - this._close(); - } -}; + return PDFFetchStreamRangeReader; +}(); /***/ }) /******/ ]); diff --git a/cps/static/js/libs/pdf.worker.js b/cps/static/js/libs/pdf.worker.js index 8a362bd7..211fbbdc 100644 --- a/cps/static/js/libs/pdf.worker.js +++ b/cps/static/js/libs/pdf.worker.js @@ -2,7 +2,7 @@ * @licstart The following is the entire license notice for the * Javascript code in this page * - * Copyright 2018 Mozilla Foundation + * Copyright 2019 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; -var pdfjsVersion = '2.1.266'; -var pdfjsBuild = '81f5835c'; +var pdfjsVersion = '2.2.228'; +var pdfjsBuild = 'd7afb74a'; var pdfjsCoreWorker = __w_pdfjs_require__(1); @@ -144,17 +144,21 @@ exports.WorkerMessageHandler = exports.WorkerTask = void 0; var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _pdf_manager = __w_pdfjs_require__(151); +var _primitives = __w_pdfjs_require__(151); -var _is_node = _interopRequireDefault(__w_pdfjs_require__(9)); +var _pdf_manager = __w_pdfjs_require__(152); -var _message_handler = __w_pdfjs_require__(189); +var _is_node = _interopRequireDefault(__w_pdfjs_require__(8)); -var _primitives = __w_pdfjs_require__(155); +var _message_handler = __w_pdfjs_require__(191); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _worker_stream = __w_pdfjs_require__(192); + +var _core_utils = __w_pdfjs_require__(154); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -198,141 +202,6 @@ var WorkerTask = function WorkerTaskClosure() { }(); exports.WorkerTask = WorkerTask; - -var PDFWorkerStream = function PDFWorkerStreamClosure() { - function PDFWorkerStream(msgHandler) { - this._msgHandler = msgHandler; - this._contentLength = null; - this._fullRequestReader = null; - this._rangeRequestReaders = []; - } - - PDFWorkerStream.prototype = { - getFullReader: function getFullReader() { - (0, _util.assert)(!this._fullRequestReader); - this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler); - return this._fullRequestReader; - }, - getRangeReader: function getRangeReader(begin, end) { - var reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler); - - this._rangeRequestReaders.push(reader); - - return reader; - }, - cancelAllRequests: function cancelAllRequests(reason) { - if (this._fullRequestReader) { - this._fullRequestReader.cancel(reason); - } - - var readers = this._rangeRequestReaders.slice(0); - - readers.forEach(function (reader) { - reader.cancel(reason); - }); - } - }; - - function PDFWorkerStreamReader(msgHandler) { - var _this = this; - - this._msgHandler = msgHandler; - this._contentLength = null; - this._isRangeSupported = false; - this._isStreamingSupported = false; - - var readableStream = this._msgHandler.sendWithStream('GetReader'); - - this._reader = readableStream.getReader(); - this._headersReady = this._msgHandler.sendWithPromise('ReaderHeadersReady').then(function (data) { - _this._isStreamingSupported = data.isStreamingSupported; - _this._isRangeSupported = data.isRangeSupported; - _this._contentLength = data.contentLength; - }); - } - - PDFWorkerStreamReader.prototype = { - get headersReady() { - return this._headersReady; - }, - - get contentLength() { - return this._contentLength; - }, - - get isStreamingSupported() { - return this._isStreamingSupported; - }, - - get isRangeSupported() { - return this._isRangeSupported; - }, - - read: function read() { - return this._reader.read().then(function (_ref) { - var value = _ref.value, - done = _ref.done; - - if (done) { - return { - value: undefined, - done: true - }; - } - - return { - value: value.buffer, - done: false - }; - }); - }, - cancel: function cancel(reason) { - this._reader.cancel(reason); - } - }; - - function PDFWorkerStreamRangeReader(begin, end, msgHandler) { - this._msgHandler = msgHandler; - this.onProgress = null; - - var readableStream = this._msgHandler.sendWithStream('GetRangeReader', { - begin: begin, - end: end - }); - - this._reader = readableStream.getReader(); - } - - PDFWorkerStreamRangeReader.prototype = { - get isStreamingSupported() { - return false; - }, - - read: function read() { - return this._reader.read().then(function (_ref2) { - var value = _ref2.value, - done = _ref2.done; - - if (done) { - return { - value: undefined, - done: true - }; - } - - return { - value: value.buffer, - done: false - }; - }); - }, - cancel: function cancel(reason) { - this._reader.cancel(reason); - } - }; - return PDFWorkerStream; -}(); - var WorkerMessageHandler = { setup: function setup(handler, port) { var testMessageProcessed = false; @@ -381,8 +250,9 @@ var WorkerMessageHandler = { var terminated = false; var cancelXHRs = null; var WorkerTasks = []; + var verbosity = (0, _util.getVerbosityLevel)(); var apiVersion = docParams.apiVersion; - var workerVersion = '2.1.266'; + var workerVersion = '2.2.228'; if (apiVersion !== workerVersion) { throw new Error("The API version \"".concat(apiVersion, "\" does not match ") + "the Worker version \"".concat(workerVersion, "\".")); @@ -417,10 +287,10 @@ var WorkerMessageHandler = { function _loadDocument() { _loadDocument = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(recoveryMode) { - var _ref6, _ref7, numPages, fingerprint; + _regenerator["default"].mark(function _callee(recoveryMode) { + var _ref4, _ref5, numPages, fingerprint; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -449,10 +319,10 @@ var WorkerMessageHandler = { return Promise.all([pdfManager.ensureDoc('numPages'), pdfManager.ensureDoc('fingerprint')]); case 11: - _ref6 = _context.sent; - _ref7 = _slicedToArray(_ref6, 2); - numPages = _ref7[0]; - fingerprint = _ref7[1]; + _ref4 = _context.sent; + _ref5 = _slicedToArray(_ref4, 2); + numPages = _ref5[0]; + fingerprint = _ref5[1]; return _context.abrupt("return", { numPages: numPages, fingerprint: fingerprint @@ -463,7 +333,7 @@ var WorkerMessageHandler = { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return _loadDocument.apply(this, arguments); } @@ -488,7 +358,7 @@ var WorkerMessageHandler = { cachedChunks = []; try { - pdfStream = new PDFWorkerStream(handler); + pdfStream = new _worker_stream.PDFWorkerStream(handler); } catch (ex) { pdfManagerCapability.reject(ex); return pdfManagerCapability.promise; @@ -516,7 +386,7 @@ var WorkerMessageHandler = { cachedChunks = []; pdfManagerCapability.resolve(pdfManager); cancelXHRs = null; - }).catch(function (reason) { + })["catch"](function (reason) { pdfManagerCapability.reject(reason); cancelXHRs = null; }); @@ -577,7 +447,7 @@ var WorkerMessageHandler = { fullRequest.read().then(readChunk, reject); }); - readPromise.catch(function (e) { + readPromise["catch"](function (e) { pdfManagerCapability.reject(e); cancelXHRs = null; }); @@ -607,7 +477,7 @@ var WorkerMessageHandler = { finishWorkerTask(task); pdfManager.updatePassword(data.password); pdfManagerReady(); - }).catch(function (boundException) { + })["catch"](function (boundException) { finishWorkerTask(task); handler.send('PasswordException', boundException); }.bind(null, e)); @@ -627,7 +497,7 @@ var WorkerMessageHandler = { loadDocument(false).then(onSuccess, function loadFailure(ex) { ensureNotTerminated(); - if (!(ex instanceof _util.XRefParseException)) { + if (!(ex instanceof _core_utils.XRefParseException)) { onFailure(ex); return; } @@ -666,12 +536,12 @@ var WorkerMessageHandler = { handler.on('GetPage', function wphSetupGetPage(data) { return pdfManager.getPage(data.pageIndex).then(function (page) { - return Promise.all([pdfManager.ensure(page, 'rotate'), pdfManager.ensure(page, 'ref'), pdfManager.ensure(page, 'userUnit'), pdfManager.ensure(page, 'view')]).then(function (_ref3) { - var _ref4 = _slicedToArray(_ref3, 4), - rotate = _ref4[0], - ref = _ref4[1], - userUnit = _ref4[2], - view = _ref4[3]; + return Promise.all([pdfManager.ensure(page, 'rotate'), pdfManager.ensure(page, 'ref'), pdfManager.ensure(page, 'userUnit'), pdfManager.ensure(page, 'view')]).then(function (_ref) { + var _ref2 = _slicedToArray(_ref, 4), + rotate = _ref2[0], + ref = _ref2[1], + userUnit = _ref2[2], + view = _ref2[3]; return { rotate: rotate, @@ -683,7 +553,8 @@ var WorkerMessageHandler = { }); }); handler.on('GetPageIndex', function wphSetupGetPageIndex(data) { - var ref = new _primitives.Ref(data.ref.num, data.ref.gen); + var ref = _primitives.Ref.get(data.ref.num, data.ref.gen); + var catalog = pdfManager.pdfDocument.catalog; return catalog.getPageIndex(ref); }); @@ -696,10 +567,16 @@ var WorkerMessageHandler = { handler.on('GetPageLabels', function wphSetupGetPageLabels(data) { return pdfManager.ensureCatalog('pageLabels'); }); + handler.on('GetPageLayout', function wphSetupGetPageLayout(data) { + return pdfManager.ensureCatalog('pageLayout'); + }); handler.on('GetPageMode', function wphSetupGetPageMode(data) { return pdfManager.ensureCatalog('pageMode'); }); - handler.on('getOpenActionDestination', function (data) { + handler.on('GetViewerPreferences', function (data) { + return pdfManager.ensureCatalog('viewerPreferences'); + }); + handler.on('GetOpenActionDestination', function (data) { return pdfManager.ensureCatalog('openActionDestination'); }); handler.on('GetAttachments', function wphSetupGetAttachments(data) { @@ -726,9 +603,9 @@ var WorkerMessageHandler = { handler.on('GetStats', function wphSetupGetStats(data) { return pdfManager.pdfDocument.xref.stats; }); - handler.on('GetAnnotations', function (_ref5) { - var pageIndex = _ref5.pageIndex, - intent = _ref5.intent; + handler.on('GetAnnotations', function (_ref3) { + var pageIndex = _ref3.pageIndex, + intent = _ref3.intent; return pdfManager.getPage(pageIndex).then(function (page) { return page.getAnnotationsData(intent); }); @@ -738,8 +615,7 @@ var WorkerMessageHandler = { pdfManager.getPage(pageIndex).then(function (page) { var task = new WorkerTask('RenderPageRequest: page ' + pageIndex); startWorkerTask(task); - var pageNum = pageIndex + 1; - var start = Date.now(); + var start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; page.getOperatorList({ handler: handler, task: task, @@ -747,7 +623,10 @@ var WorkerMessageHandler = { renderInteractiveForms: data.renderInteractiveForms }).then(function (operatorList) { finishWorkerTask(task); - (0, _util.info)('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength); + + if (start) { + (0, _util.info)("page=".concat(pageIndex + 1, " - getOperatorList: time=") + "".concat(Date.now() - start, "ms, len=").concat(operatorList.totalLength)); + } }, function (e) { finishWorkerTask(task); @@ -779,7 +658,7 @@ var WorkerMessageHandler = { } handler.send('PageError', { - pageNum: pageNum, + pageIndex: pageIndex, error: wrappedException, intent: data.intent }); @@ -796,8 +675,7 @@ var WorkerMessageHandler = { pdfManager.getPage(pageIndex).then(function (page) { var task = new WorkerTask('GetTextContent: page ' + pageIndex); startWorkerTask(task); - var pageNum = pageIndex + 1; - var start = Date.now(); + var start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; page.extractTextContent({ handler: handler, task: task, @@ -806,7 +684,11 @@ var WorkerMessageHandler = { combineTextItems: data.combineTextItems }).then(function () { finishWorkerTask(task); - (0, _util.info)('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms'); + + if (start) { + (0, _util.info)("page=".concat(pageIndex + 1, " - getTextContent: time=") + "".concat(Date.now() - start, "ms")); + } + sink.close(); }, function (reason) { finishWorkerTask(task); @@ -838,6 +720,7 @@ var WorkerMessageHandler = { cancelXHRs(); } + (0, _primitives.clearPrimitiveCaches)(); var waitOn = []; WorkerTasks.forEach(function (task) { waitOn.push(task.finished); @@ -866,7 +749,7 @@ function isMessagePort(maybePort) { return typeof maybePort.postMessage === 'function' && 'onmessage' in maybePort; } -if (typeof window === 'undefined' && !(0, _is_node.default)() && typeof self !== 'undefined' && isMessagePort(self)) { +if (typeof window === 'undefined' && !(0, _is_node["default"])() && typeof self !== 'undefined' && isMessagePort(self)) { WorkerMessageHandler.initializeFromPort(self); } @@ -883,40 +766,12 @@ module.exports = __w_pdfjs_require__(3); /* 3 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; - - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var g = function () { - return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; -}() || Function("return this")(); - -var hadRuntime = g.regeneratorRuntime && Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; -var oldRuntime = hadRuntime && g.regeneratorRuntime; -g.regeneratorRuntime = undefined; -module.exports = __w_pdfjs_require__(4); - -if (hadRuntime) { - g.regeneratorRuntime = oldRuntime; -} else { - try { - delete g.regeneratorRuntime; - } catch (e) { - g.regeneratorRuntime = undefined; - } -} - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - "use strict"; /* WEBPACK VAR INJECTION */(function(module) { function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -!function (global) { +var runtime = function (exports) { "use strict"; var Op = Object.prototype; @@ -926,18 +781,6 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - var inModule = ( false ? undefined : _typeof(module)) === "object"; - var runtime = global.regeneratorRuntime; - - if (runtime) { - if (inModule) { - module.exports = runtime; - } - - return; - } - - runtime = global.regeneratorRuntime = inModule ? module.exports : {}; function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; @@ -947,7 +790,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return generator; } - runtime.wrap = wrap; + exports.wrap = wrap; function tryCatch(fn, obj, arg) { try { @@ -1001,12 +844,12 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat }); } - runtime.isGeneratorFunction = function (genFun) { + exports.isGeneratorFunction = function (genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; - runtime.mark = function (genFun) { + exports.mark = function (genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { @@ -1021,7 +864,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return genFun; }; - runtime.awrap = function (arg) { + exports.awrap = function (arg) { return { __await: arg }; @@ -1075,11 +918,11 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return this; }; - runtime.AsyncIterator = AsyncIterator; + exports.AsyncIterator = AsyncIterator; - runtime.async = function (innerFn, outerFn, self, tryLocsList) { + exports.async = function (innerFn, outerFn, self, tryLocsList) { var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); - return runtime.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { + return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }; @@ -1157,7 +1000,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat context.delegate = null; if (context.method === "throw") { - if (delegate.iterator.return) { + if (delegate.iterator["return"]) { context.method = "return"; context.arg = undefined; maybeInvokeDelegate(delegate, context); @@ -1251,7 +1094,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat this.reset(true); } - runtime.keys = function (object) { + exports.keys = function (object) { var keys = []; for (var key in object) { @@ -1312,7 +1155,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat }; } - runtime.values = values; + exports.values = values; function doneResult() { return { @@ -1490,13 +1333,18 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return ContinueSentinel; } }; -}(function () { - return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; -}() || Function("return this")()); -/* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(5)(module))) + return exports; +}(( false ? undefined : _typeof(module)) === "object" ? module.exports : {}); + +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + Function("r", "regeneratorRuntime = r")(runtime); +} +/* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(4)(module))) /***/ }), -/* 5 */ +/* 4 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -1527,7 +1375,7 @@ module.exports = function (module) { }; /***/ }), -/* 6 */ +/* 5 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -1536,18 +1384,15 @@ module.exports = function (module) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.toRomanNumerals = toRomanNumerals; exports.arrayByteLength = arrayByteLength; exports.arraysToBytes = arraysToBytes; exports.assert = assert; exports.bytesToString = bytesToString; exports.createPromiseCapability = createPromiseCapability; -exports.deprecated = deprecated; -exports.getInheritableProperty = getInheritableProperty; -exports.getLookupTableFactory = getLookupTableFactory; exports.getVerbosityLevel = getVerbosityLevel; exports.info = info; exports.isArrayBuffer = isArrayBuffer; +exports.isArrayEqual = isArrayEqual; exports.isBool = isBool; exports.isEmptyObj = isEmptyObj; exports.isNum = isNum; @@ -1583,9 +1428,9 @@ Object.defineProperty(exports, "URL", { return _url_polyfill.URL; } }); -exports.createObjectURL = exports.FormatError = exports.XRefParseException = exports.XRefEntryException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0; +exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0; -__w_pdfjs_require__(7); +__w_pdfjs_require__(6); var _streams_polyfill = __w_pdfjs_require__(147); @@ -1876,10 +1721,6 @@ function warn(msg) { } } -function deprecated(details) { - console.log('Deprecated API usage: ' + details); -} - function unreachable(msg) { throw new Error(msg); } @@ -1949,19 +1790,6 @@ function shadow(obj, prop, value) { return value; } -function getLookupTableFactory(initializer) { - var lookup; - return function () { - if (initializer) { - lookup = Object.create(null); - initializer(lookup); - initializer = null; - } - - return lookup; - }; -} - var PasswordException = function PasswordExceptionClosure() { function PasswordException(msg, code) { this.name = 'PasswordException'; @@ -2030,47 +1858,6 @@ var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() exports.UnexpectedResponseException = UnexpectedResponseException; -var MissingDataException = function MissingDataExceptionClosure() { - function MissingDataException(begin, end) { - this.begin = begin; - this.end = end; - this.message = 'Missing data [' + begin + ', ' + end + ')'; - } - - MissingDataException.prototype = new Error(); - MissingDataException.prototype.name = 'MissingDataException'; - MissingDataException.constructor = MissingDataException; - return MissingDataException; -}(); - -exports.MissingDataException = MissingDataException; - -var XRefEntryException = function XRefEntryExceptionClosure() { - function XRefEntryException(msg) { - this.message = msg; - } - - XRefEntryException.prototype = new Error(); - XRefEntryException.prototype.name = 'XRefEntryException'; - XRefEntryException.constructor = XRefEntryException; - return XRefEntryException; -}(); - -exports.XRefEntryException = XRefEntryException; - -var XRefParseException = function XRefParseExceptionClosure() { - function XRefParseException(msg) { - this.message = msg; - } - - XRefParseException.prototype = new Error(); - XRefParseException.prototype.name = 'XRefParseException'; - XRefParseException.constructor = XRefParseException; - return XRefParseException; -}(); - -exports.XRefParseException = XRefParseException; - var FormatError = function FormatErrorClosure() { function FormatError(msg) { this.message = msg; @@ -2226,43 +2013,6 @@ function isEvalSupported() { } } -function getInheritableProperty(_ref) { - var dict = _ref.dict, - key = _ref.key, - _ref$getArray = _ref.getArray, - getArray = _ref$getArray === void 0 ? false : _ref$getArray, - _ref$stopWhenFound = _ref.stopWhenFound, - stopWhenFound = _ref$stopWhenFound === void 0 ? true : _ref$stopWhenFound; - var LOOP_LIMIT = 100; - var loopCount = 0; - var values; - - while (dict) { - var value = getArray ? dict.getArray(key) : dict.get(key); - - if (value !== undefined) { - if (stopWhenFound) { - return value; - } - - if (!values) { - values = []; - } - - values.push(value); - } - - if (++loopCount > LOOP_LIMIT) { - warn("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\"")); - break; - } - - dict = dict.get('Parent'); - } - - return values; -} - var Util = function UtilClosure() { function Util() {} @@ -2370,30 +2120,6 @@ var Util = function UtilClosure() { }(); exports.Util = Util; -var ROMAN_NUMBER_MAP = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']; - -function toRomanNumerals(number) { - var lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - assert(Number.isInteger(number) && number > 0, 'The number should be a positive integer.'); - var pos, - romanBuf = []; - - while (number >= 1000) { - number -= 1000; - romanBuf.push('M'); - } - - pos = number / 100 | 0; - number %= 100; - romanBuf.push(ROMAN_NUMBER_MAP[pos]); - pos = number / 10 | 0; - number %= 10; - romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); - romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); - var romanStr = romanBuf.join(''); - return lowerCase ? romanStr.toLowerCase() : romanStr; -} - var PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC]; function stringToPDFString(str) { @@ -2447,6 +2173,16 @@ function isArrayBuffer(v) { return _typeof(v) === 'object' && v !== null && v.byteLength !== undefined; } +function isArrayEqual(arr1, arr2) { + if (arr1.length !== arr2.length) { + return false; + } + + return arr1.every(function (element, index) { + return element === arr2[index]; + }); +} + function isSpace(ch) { return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A; } @@ -2505,7 +2241,7 @@ var createObjectURL = function createObjectURLClosure() { exports.createObjectURL = createObjectURL; /***/ }), -/* 7 */ +/* 6 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2513,12 +2249,12 @@ exports.createObjectURL = createObjectURL; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var globalScope = __w_pdfjs_require__(8); +var globalScope = __w_pdfjs_require__(7); if (!globalScope._pdfjsCompatibilityChecked) { globalScope._pdfjsCompatibilityChecked = true; - var isNodeJS = __w_pdfjs_require__(9); + var isNodeJS = __w_pdfjs_require__(8); var hasDOM = (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object'; @@ -2578,8 +2314,8 @@ if (!globalScope._pdfjsCompatibilityChecked) { tokens[_key] = arguments[_key]; } - for (var _i = 0; _i < tokens.length; _i++) { - var token = tokens[_i]; + for (var _i = 0, _tokens = tokens; _i < _tokens.length; _i++) { + var token = _tokens[_i]; OriginalDOMTokenListAdd.call(this, token); } }; @@ -2589,8 +2325,8 @@ if (!globalScope._pdfjsCompatibilityChecked) { tokens[_key2] = arguments[_key2]; } - for (var _i2 = 0; _i2 < tokens.length; _i2++) { - var token = tokens[_i2]; + for (var _i2 = 0, _tokens2 = tokens; _i2 < _tokens2.length; _i2++) { + var token = _tokens2[_i2]; OriginalDOMTokenListRemove.call(this, token); } }; @@ -2618,7 +2354,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { return; } - __w_pdfjs_require__(10); + __w_pdfjs_require__(9); })(); (function checkStringEndsWith() { @@ -2686,7 +2422,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { })(); (function checkPromise() { - if (globalScope.Promise && globalScope.Promise.prototype && globalScope.Promise.prototype.finally) { + if (globalScope.Promise && globalScope.Promise.prototype && globalScope.Promise.prototype["finally"]) { return; } @@ -2759,7 +2495,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { } /***/ }), -/* 8 */ +/* 7 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2768,7 +2504,7 @@ if (!globalScope._pdfjsCompatibilityChecked) { module.exports = typeof window !== 'undefined' && window.Math === Math ? window : typeof global !== 'undefined' && global.Math === Math ? global : typeof self !== 'undefined' && self.Math === Math ? self : {}; /***/ }), -/* 9 */ +/* 8 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2777,32 +2513,32 @@ module.exports = typeof window !== 'undefined' && window.Math === Math ? window function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } module.exports = function isNodeJS() { - return (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && process + '' === '[object process]' && !process.versions['nw']; + return (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && process + '' === '[object process]' && !process.versions['nw'] && !process.versions['electron']; }; /***/ }), -/* 10 */ +/* 9 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -__w_pdfjs_require__(11); +__w_pdfjs_require__(10); -module.exports = __w_pdfjs_require__(14).String.startsWith; +module.exports = __w_pdfjs_require__(13).String.startsWith; /***/ }), -/* 11 */ +/* 10 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); -var toLength = __w_pdfjs_require__(30); +var toLength = __w_pdfjs_require__(32); -var context = __w_pdfjs_require__(32); +var context = __w_pdfjs_require__(34); var STARTS_WITH = 'startsWith'; var $startsWith = ''[STARTS_WITH]; @@ -2816,21 +2552,21 @@ $export($export.P + $export.F * __w_pdfjs_require__(39)(STARTS_WITH), 'String', }); /***/ }), -/* 12 */ +/* 11 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); -var core = __w_pdfjs_require__(14); +var core = __w_pdfjs_require__(13); -var hide = __w_pdfjs_require__(15); +var hide = __w_pdfjs_require__(14); -var redefine = __w_pdfjs_require__(25); +var redefine = __w_pdfjs_require__(24); -var ctx = __w_pdfjs_require__(28); +var ctx = __w_pdfjs_require__(30); var PROTOTYPE = 'prototype'; @@ -2868,7 +2604,7 @@ $export.R = 128; module.exports = $export; /***/ }), -/* 13 */ +/* 12 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2878,29 +2614,29 @@ var global = module.exports = typeof window != 'undefined' && window.Math == Mat if (typeof __g == 'number') __g = global; /***/ }), -/* 14 */ +/* 13 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var core = module.exports = { - version: '2.6.2' + version: '2.6.9' }; if (typeof __e == 'number') __e = core; /***/ }), -/* 15 */ +/* 14 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var dP = __w_pdfjs_require__(16); +var dP = __w_pdfjs_require__(15); -var createDesc = __w_pdfjs_require__(24); +var createDesc = __w_pdfjs_require__(23); -module.exports = __w_pdfjs_require__(20) ? function (object, key, value) { +module.exports = __w_pdfjs_require__(19) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; @@ -2908,20 +2644,20 @@ module.exports = __w_pdfjs_require__(20) ? function (object, key, value) { }; /***/ }), -/* 16 */ +/* 15 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var anObject = __w_pdfjs_require__(17); +var anObject = __w_pdfjs_require__(16); -var IE8_DOM_DEFINE = __w_pdfjs_require__(19); +var IE8_DOM_DEFINE = __w_pdfjs_require__(18); -var toPrimitive = __w_pdfjs_require__(23); +var toPrimitive = __w_pdfjs_require__(22); var dP = Object.defineProperty; -exports.f = __w_pdfjs_require__(20) ? Object.defineProperty : function defineProperty(O, P, Attributes) { +exports.f = __w_pdfjs_require__(19) ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); @@ -2934,13 +2670,13 @@ exports.f = __w_pdfjs_require__(20) ? Object.defineProperty : function definePro }; /***/ }), -/* 17 */ +/* 16 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); module.exports = function (it) { if (!isObject(it)) throw TypeError(it + ' is not an object!'); @@ -2948,7 +2684,7 @@ module.exports = function (it) { }; /***/ }), -/* 18 */ +/* 17 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -2961,14 +2697,14 @@ module.exports = function (it) { }; /***/ }), -/* 19 */ +/* 18 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -module.exports = !__w_pdfjs_require__(20) && !__w_pdfjs_require__(21)(function () { - return Object.defineProperty(__w_pdfjs_require__(22)('div'), 'a', { +module.exports = !__w_pdfjs_require__(19) && !__w_pdfjs_require__(20)(function () { + return Object.defineProperty(__w_pdfjs_require__(21)('div'), 'a', { get: function get() { return 7; } @@ -2976,13 +2712,13 @@ module.exports = !__w_pdfjs_require__(20) && !__w_pdfjs_require__(21)(function ( }); /***/ }), -/* 20 */ +/* 19 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -module.exports = !__w_pdfjs_require__(21)(function () { +module.exports = !__w_pdfjs_require__(20)(function () { return Object.defineProperty({}, 'a', { get: function get() { return 7; @@ -2991,7 +2727,7 @@ module.exports = !__w_pdfjs_require__(21)(function () { }); /***/ }), -/* 21 */ +/* 20 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3006,15 +2742,15 @@ module.exports = function (exec) { }; /***/ }), -/* 22 */ +/* 21 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); -var document = __w_pdfjs_require__(13).document; +var document = __w_pdfjs_require__(12).document; var is = isObject(document) && isObject(document.createElement); @@ -3023,13 +2759,13 @@ module.exports = function (it) { }; /***/ }), -/* 23 */ +/* 22 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); module.exports = function (it, S) { if (!isObject(it)) return it; @@ -3041,7 +2777,7 @@ module.exports = function (it, S) { }; /***/ }), -/* 24 */ +/* 23 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3057,25 +2793,26 @@ module.exports = function (bitmap, value) { }; /***/ }), -/* 25 */ +/* 24 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); + +var hide = __w_pdfjs_require__(14); -var hide = __w_pdfjs_require__(15); +var has = __w_pdfjs_require__(25); -var has = __w_pdfjs_require__(26); +var SRC = __w_pdfjs_require__(26)('src'); -var SRC = __w_pdfjs_require__(27)('src'); +var $toString = __w_pdfjs_require__(27); var TO_STRING = 'toString'; -var $toString = Function[TO_STRING]; var TPL = ('' + $toString).split(TO_STRING); -__w_pdfjs_require__(14).inspectSource = function (it) { +__w_pdfjs_require__(13).inspectSource = function (it) { return $toString.call(it); }; @@ -3100,7 +2837,7 @@ __w_pdfjs_require__(14).inspectSource = function (it) { }); /***/ }), -/* 26 */ +/* 25 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3113,7 +2850,7 @@ module.exports = function (it, key) { }; /***/ }), -/* 27 */ +/* 26 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3126,6 +2863,15 @@ module.exports = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; +/***/ }), +/* 27 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = __w_pdfjs_require__(28)('native-function-to-string', Function.toString); + /***/ }), /* 28 */ /***/ (function(module, exports, __w_pdfjs_require__) { @@ -3133,7 +2879,37 @@ module.exports = function (key) { "use strict"; -var aFunction = __w_pdfjs_require__(29); +var core = __w_pdfjs_require__(13); + +var global = __w_pdfjs_require__(12); + +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: core.version, + mode: __w_pdfjs_require__(29) ? 'pure' : 'global', + copyright: '© 2019 Denis Pushkarev (zloirock.ru)' +}); + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +module.exports = false; + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +var aFunction = __w_pdfjs_require__(31); module.exports = function (fn, that, length) { aFunction(fn); @@ -3162,7 +2938,7 @@ module.exports = function (fn, that, length) { }; /***/ }), -/* 29 */ +/* 31 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3174,13 +2950,13 @@ module.exports = function (it) { }; /***/ }), -/* 30 */ +/* 32 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var toInteger = __w_pdfjs_require__(31); +var toInteger = __w_pdfjs_require__(33); var min = Math.min; @@ -3189,7 +2965,7 @@ module.exports = function (it) { }; /***/ }), -/* 31 */ +/* 33 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3203,13 +2979,13 @@ module.exports = function (it) { }; /***/ }), -/* 32 */ +/* 34 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var isRegExp = __w_pdfjs_require__(33); +var isRegExp = __w_pdfjs_require__(35); var defined = __w_pdfjs_require__(38); @@ -3219,17 +2995,17 @@ module.exports = function (that, searchString, NAME) { }; /***/ }), -/* 33 */ +/* 35 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); -var cof = __w_pdfjs_require__(34); +var cof = __w_pdfjs_require__(36); -var MATCH = __w_pdfjs_require__(35)('match'); +var MATCH = __w_pdfjs_require__(37)('match'); module.exports = function (it) { var isRegExp; @@ -3237,7 +3013,7 @@ module.exports = function (it) { }; /***/ }), -/* 34 */ +/* 36 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -3250,17 +3026,17 @@ module.exports = function (it) { }; /***/ }), -/* 35 */ +/* 37 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var store = __w_pdfjs_require__(36)('wks'); +var store = __w_pdfjs_require__(28)('wks'); -var uid = __w_pdfjs_require__(27); +var uid = __w_pdfjs_require__(26); -var _Symbol = __w_pdfjs_require__(13).Symbol; +var _Symbol = __w_pdfjs_require__(12).Symbol; var USE_SYMBOL = typeof _Symbol == 'function'; @@ -3270,36 +3046,6 @@ var $exports = module.exports = function (name) { $exports.store = store; -/***/ }), -/* 36 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -var core = __w_pdfjs_require__(14); - -var global = __w_pdfjs_require__(13); - -var SHARED = '__core-js_shared__'; -var store = global[SHARED] || (global[SHARED] = {}); -(module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); -})('versions', []).push({ - version: core.version, - mode: __w_pdfjs_require__(37) ? 'pure' : 'global', - copyright: '© 2019 Denis Pushkarev (zloirock.ru)' -}); - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -module.exports = false; - /***/ }), /* 38 */ /***/ (function(module, exports, __w_pdfjs_require__) { @@ -3319,7 +3065,7 @@ module.exports = function (it) { "use strict"; -var MATCH = __w_pdfjs_require__(35)('match'); +var MATCH = __w_pdfjs_require__(37)('match'); module.exports = function (KEY) { var re = /./; @@ -3345,7 +3091,7 @@ module.exports = function (KEY) { __w_pdfjs_require__(41); -module.exports = __w_pdfjs_require__(14).String.endsWith; +module.exports = __w_pdfjs_require__(13).String.endsWith; /***/ }), /* 41 */ @@ -3354,11 +3100,11 @@ module.exports = __w_pdfjs_require__(14).String.endsWith; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); -var toLength = __w_pdfjs_require__(30); +var toLength = __w_pdfjs_require__(32); -var context = __w_pdfjs_require__(32); +var context = __w_pdfjs_require__(34); var ENDS_WITH = 'endsWith'; var $endsWith = ''[ENDS_WITH]; @@ -3382,7 +3128,7 @@ $export($export.P + $export.F * __w_pdfjs_require__(39)(ENDS_WITH), 'String', { __w_pdfjs_require__(43); -module.exports = __w_pdfjs_require__(14).String.includes; +module.exports = __w_pdfjs_require__(13).String.includes; /***/ }), /* 43 */ @@ -3391,9 +3137,9 @@ module.exports = __w_pdfjs_require__(14).String.includes; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); -var context = __w_pdfjs_require__(32); +var context = __w_pdfjs_require__(34); var INCLUDES = 'includes'; $export($export.P + $export.F * __w_pdfjs_require__(39)(INCLUDES), 'String', { @@ -3411,7 +3157,7 @@ $export($export.P + $export.F * __w_pdfjs_require__(39)(INCLUDES), 'String', { __w_pdfjs_require__(45); -module.exports = __w_pdfjs_require__(14).Array.includes; +module.exports = __w_pdfjs_require__(13).Array.includes; /***/ }), /* 45 */ @@ -3420,7 +3166,7 @@ module.exports = __w_pdfjs_require__(14).Array.includes; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); var $includes = __w_pdfjs_require__(46)(true); @@ -3441,7 +3187,7 @@ __w_pdfjs_require__(50)('includes'); var toIObject = __w_pdfjs_require__(47); -var toLength = __w_pdfjs_require__(30); +var toLength = __w_pdfjs_require__(32); var toAbsoluteIndex = __w_pdfjs_require__(49); @@ -3485,7 +3231,7 @@ module.exports = function (it) { "use strict"; -var cof = __w_pdfjs_require__(34); +var cof = __w_pdfjs_require__(36); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return cof(it) == 'String' ? it.split('') : Object(it); @@ -3498,7 +3244,7 @@ module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { "use strict"; -var toInteger = __w_pdfjs_require__(31); +var toInteger = __w_pdfjs_require__(33); var max = Math.max; var min = Math.min; @@ -3515,10 +3261,10 @@ module.exports = function (index, length) { "use strict"; -var UNSCOPABLES = __w_pdfjs_require__(35)('unscopables'); +var UNSCOPABLES = __w_pdfjs_require__(37)('unscopables'); var ArrayProto = Array.prototype; -if (ArrayProto[UNSCOPABLES] == undefined) __w_pdfjs_require__(15)(ArrayProto, UNSCOPABLES, {}); +if (ArrayProto[UNSCOPABLES] == undefined) __w_pdfjs_require__(14)(ArrayProto, UNSCOPABLES, {}); module.exports = function (key) { ArrayProto[UNSCOPABLES][key] = true; @@ -3535,7 +3281,7 @@ __w_pdfjs_require__(52); __w_pdfjs_require__(67); -module.exports = __w_pdfjs_require__(14).Array.from; +module.exports = __w_pdfjs_require__(13).Array.from; /***/ }), /* 52 */ @@ -3572,7 +3318,7 @@ __w_pdfjs_require__(54)(String, 'String', function (iterated) { "use strict"; -var toInteger = __w_pdfjs_require__(31); +var toInteger = __w_pdfjs_require__(33); var defined = __w_pdfjs_require__(38); @@ -3595,13 +3341,13 @@ module.exports = function (TO_STRING) { "use strict"; -var LIBRARY = __w_pdfjs_require__(37); +var LIBRARY = __w_pdfjs_require__(29); -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); -var redefine = __w_pdfjs_require__(25); +var redefine = __w_pdfjs_require__(24); -var hide = __w_pdfjs_require__(15); +var hide = __w_pdfjs_require__(14); var Iterators = __w_pdfjs_require__(55); @@ -3611,7 +3357,7 @@ var setToStringTag = __w_pdfjs_require__(64); var getPrototypeOf = __w_pdfjs_require__(65); -var ITERATOR = __w_pdfjs_require__(35)('iterator'); +var ITERATOR = __w_pdfjs_require__(37)('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); var FF_ITERATOR = '@@iterator'; @@ -3711,13 +3457,13 @@ module.exports = {}; var create = __w_pdfjs_require__(57); -var descriptor = __w_pdfjs_require__(24); +var descriptor = __w_pdfjs_require__(23); var setToStringTag = __w_pdfjs_require__(64); var IteratorPrototype = {}; -__w_pdfjs_require__(15)(IteratorPrototype, __w_pdfjs_require__(35)('iterator'), function () { +__w_pdfjs_require__(14)(IteratorPrototype, __w_pdfjs_require__(37)('iterator'), function () { return this; }); @@ -3735,7 +3481,7 @@ module.exports = function (Constructor, NAME, next) { "use strict"; -var anObject = __w_pdfjs_require__(17); +var anObject = __w_pdfjs_require__(16); var dPs = __w_pdfjs_require__(58); @@ -3748,7 +3494,7 @@ var Empty = function Empty() {}; var PROTOTYPE = 'prototype'; var _createDict = function createDict() { - var iframe = __w_pdfjs_require__(22)('iframe'); + var iframe = __w_pdfjs_require__(21)('iframe'); var i = enumBugKeys.length; var lt = '<'; @@ -3792,13 +3538,13 @@ module.exports = Object.create || function create(O, Properties) { "use strict"; -var dP = __w_pdfjs_require__(16); +var dP = __w_pdfjs_require__(15); -var anObject = __w_pdfjs_require__(17); +var anObject = __w_pdfjs_require__(16); var getKeys = __w_pdfjs_require__(59); -module.exports = __w_pdfjs_require__(20) ? Object.defineProperties : function defineProperties(O, Properties) { +module.exports = __w_pdfjs_require__(19) ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = getKeys(Properties); var length = keys.length; @@ -3834,7 +3580,7 @@ module.exports = Object.keys || function keys(O) { "use strict"; -var has = __w_pdfjs_require__(26); +var has = __w_pdfjs_require__(25); var toIObject = __w_pdfjs_require__(47); @@ -3868,9 +3614,9 @@ module.exports = function (object, names) { "use strict"; -var shared = __w_pdfjs_require__(36)('keys'); +var shared = __w_pdfjs_require__(28)('keys'); -var uid = __w_pdfjs_require__(27); +var uid = __w_pdfjs_require__(26); module.exports = function (key) { return shared[key] || (shared[key] = uid(key)); @@ -3892,7 +3638,7 @@ module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable, "use strict"; -var document = __w_pdfjs_require__(13).document; +var document = __w_pdfjs_require__(12).document; module.exports = document && document.documentElement; @@ -3903,11 +3649,11 @@ module.exports = document && document.documentElement; "use strict"; -var def = __w_pdfjs_require__(16).f; +var def = __w_pdfjs_require__(15).f; -var has = __w_pdfjs_require__(26); +var has = __w_pdfjs_require__(25); -var TAG = __w_pdfjs_require__(35)('toStringTag'); +var TAG = __w_pdfjs_require__(37)('toStringTag'); module.exports = function (it, tag, stat) { if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { @@ -3923,7 +3669,7 @@ module.exports = function (it, tag, stat) { "use strict"; -var has = __w_pdfjs_require__(26); +var has = __w_pdfjs_require__(25); var toObject = __w_pdfjs_require__(66); @@ -3962,9 +3708,9 @@ module.exports = function (it) { "use strict"; -var ctx = __w_pdfjs_require__(28); +var ctx = __w_pdfjs_require__(30); -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); var toObject = __w_pdfjs_require__(66); @@ -3972,7 +3718,7 @@ var call = __w_pdfjs_require__(68); var isArrayIter = __w_pdfjs_require__(69); -var toLength = __w_pdfjs_require__(30); +var toLength = __w_pdfjs_require__(32); var createProperty = __w_pdfjs_require__(70); @@ -4016,7 +3762,7 @@ $export($export.S + $export.F * !__w_pdfjs_require__(73)(function (iter) { "use strict"; -var anObject = __w_pdfjs_require__(17); +var anObject = __w_pdfjs_require__(16); module.exports = function (iterator, fn, value, entries) { try { @@ -4037,7 +3783,7 @@ module.exports = function (iterator, fn, value, entries) { var Iterators = __w_pdfjs_require__(55); -var ITERATOR = __w_pdfjs_require__(35)('iterator'); +var ITERATOR = __w_pdfjs_require__(37)('iterator'); var ArrayProto = Array.prototype; @@ -4052,9 +3798,9 @@ module.exports = function (it) { "use strict"; -var $defineProperty = __w_pdfjs_require__(16); +var $defineProperty = __w_pdfjs_require__(15); -var createDesc = __w_pdfjs_require__(24); +var createDesc = __w_pdfjs_require__(23); module.exports = function (object, index, value) { if (index in object) $defineProperty.f(object, index, createDesc(0, value));else object[index] = value; @@ -4069,11 +3815,11 @@ module.exports = function (object, index, value) { var classof = __w_pdfjs_require__(72); -var ITERATOR = __w_pdfjs_require__(35)('iterator'); +var ITERATOR = __w_pdfjs_require__(37)('iterator'); var Iterators = __w_pdfjs_require__(55); -module.exports = __w_pdfjs_require__(14).getIteratorMethod = function (it) { +module.exports = __w_pdfjs_require__(13).getIteratorMethod = function (it) { if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; @@ -4084,9 +3830,9 @@ module.exports = __w_pdfjs_require__(14).getIteratorMethod = function (it) { "use strict"; -var cof = __w_pdfjs_require__(34); +var cof = __w_pdfjs_require__(36); -var TAG = __w_pdfjs_require__(35)('toStringTag'); +var TAG = __w_pdfjs_require__(37)('toStringTag'); var ARG = cof(function () { return arguments; @@ -4110,7 +3856,7 @@ module.exports = function (it) { "use strict"; -var ITERATOR = __w_pdfjs_require__(35)('iterator'); +var ITERATOR = __w_pdfjs_require__(37)('iterator'); var SAFE_CLOSING = false; @@ -4159,7 +3905,7 @@ module.exports = function (exec, skipClosing) { __w_pdfjs_require__(75); -module.exports = __w_pdfjs_require__(14).Object.assign; +module.exports = __w_pdfjs_require__(13).Object.assign; /***/ }), /* 75 */ @@ -4168,7 +3914,7 @@ module.exports = __w_pdfjs_require__(14).Object.assign; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); $export($export.S + $export.F, 'Object', { assign: __w_pdfjs_require__(76) @@ -4181,6 +3927,8 @@ $export($export.S + $export.F, 'Object', { "use strict"; +var DESCRIPTORS = __w_pdfjs_require__(19); + var getKeys = __w_pdfjs_require__(59); var gOPS = __w_pdfjs_require__(77); @@ -4192,7 +3940,7 @@ var toObject = __w_pdfjs_require__(66); var IObject = __w_pdfjs_require__(48); var $assign = Object.assign; -module.exports = !$assign || __w_pdfjs_require__(21)(function () { +module.exports = !$assign || __w_pdfjs_require__(20)(function () { var A = {}; var B = {}; var S = Symbol(); @@ -4217,7 +3965,8 @@ module.exports = !$assign || __w_pdfjs_require__(21)(function () { var key; while (length > j) { - if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; + key = keys[j++]; + if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key]; } } @@ -4251,7 +4000,7 @@ exports.f = {}.propertyIsEnumerable; __w_pdfjs_require__(80); -module.exports = __w_pdfjs_require__(14).Math.log2; +module.exports = __w_pdfjs_require__(13).Math.log2; /***/ }), /* 80 */ @@ -4260,7 +4009,7 @@ module.exports = __w_pdfjs_require__(14).Math.log2; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); $export($export.S, 'Math', { log2: function log2(x) { @@ -4277,7 +4026,7 @@ $export($export.S, 'Math', { __w_pdfjs_require__(82); -module.exports = __w_pdfjs_require__(14).Number.isNaN; +module.exports = __w_pdfjs_require__(13).Number.isNaN; /***/ }), /* 82 */ @@ -4286,7 +4035,7 @@ module.exports = __w_pdfjs_require__(14).Number.isNaN; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); $export($export.S, 'Number', { isNaN: function isNaN(number) { @@ -4303,7 +4052,7 @@ $export($export.S, 'Number', { __w_pdfjs_require__(84); -module.exports = __w_pdfjs_require__(14).Number.isInteger; +module.exports = __w_pdfjs_require__(13).Number.isInteger; /***/ }), /* 84 */ @@ -4312,7 +4061,7 @@ module.exports = __w_pdfjs_require__(14).Number.isInteger; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); $export($export.S, 'Number', { isInteger: __w_pdfjs_require__(85) @@ -4325,7 +4074,7 @@ $export($export.S, 'Number', { "use strict"; -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); var floor = Math.floor; @@ -4352,7 +4101,7 @@ __w_pdfjs_require__(104); __w_pdfjs_require__(105); -module.exports = __w_pdfjs_require__(14).Promise; +module.exports = __w_pdfjs_require__(13).Promise; /***/ }), /* 87 */ @@ -4364,10 +4113,10 @@ module.exports = __w_pdfjs_require__(14).Promise; var classof = __w_pdfjs_require__(72); var test = {}; -test[__w_pdfjs_require__(35)('toStringTag')] = 'z'; +test[__w_pdfjs_require__(37)('toStringTag')] = 'z'; if (test + '' != '[object z]') { - __w_pdfjs_require__(25)(Object.prototype, 'toString', function toString() { + __w_pdfjs_require__(24)(Object.prototype, 'toString', function toString() { return '[object ' + classof(this) + ']'; }, true); } @@ -4383,15 +4132,15 @@ var $iterators = __w_pdfjs_require__(89); var getKeys = __w_pdfjs_require__(59); -var redefine = __w_pdfjs_require__(25); +var redefine = __w_pdfjs_require__(24); -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); -var hide = __w_pdfjs_require__(15); +var hide = __w_pdfjs_require__(14); var Iterators = __w_pdfjs_require__(55); -var wks = __w_pdfjs_require__(35); +var wks = __w_pdfjs_require__(37); var ITERATOR = wks('iterator'); var TO_STRING_TAG = wks('toStringTag'); @@ -4506,19 +4255,19 @@ module.exports = function (done, value) { "use strict"; -var LIBRARY = __w_pdfjs_require__(37); +var LIBRARY = __w_pdfjs_require__(29); -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); -var ctx = __w_pdfjs_require__(28); +var ctx = __w_pdfjs_require__(30); var classof = __w_pdfjs_require__(72); -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); -var aFunction = __w_pdfjs_require__(29); +var aFunction = __w_pdfjs_require__(31); var anInstance = __w_pdfjs_require__(92); @@ -4554,7 +4303,7 @@ var USE_NATIVE = !!function () { try { var promise = $Promise.resolve(1); - var FakePromise = (promise.constructor = {})[__w_pdfjs_require__(35)('species')] = function (exec) { + var FakePromise = (promise.constructor = {})[__w_pdfjs_require__(37)('species')] = function (exec) { exec(empty, empty); }; @@ -4776,7 +4525,7 @@ __w_pdfjs_require__(64)($Promise, PROMISE); __w_pdfjs_require__(103)(PROMISE); -Wrapper = __w_pdfjs_require__(14)[PROMISE]; +Wrapper = __w_pdfjs_require__(13)[PROMISE]; $export($export.S + $export.F * !USE_NATIVE, PROMISE, { reject: function reject(r) { var capability = newPromiseCapability(this); @@ -4855,15 +4604,15 @@ module.exports = function (it, Constructor, name, forbiddenField) { "use strict"; -var ctx = __w_pdfjs_require__(28); +var ctx = __w_pdfjs_require__(30); var call = __w_pdfjs_require__(68); var isArrayIter = __w_pdfjs_require__(69); -var anObject = __w_pdfjs_require__(17); +var anObject = __w_pdfjs_require__(16); -var toLength = __w_pdfjs_require__(30); +var toLength = __w_pdfjs_require__(32); var getIterFn = __w_pdfjs_require__(71); @@ -4897,11 +4646,11 @@ _exports.RETURN = RETURN; "use strict"; -var anObject = __w_pdfjs_require__(17); +var anObject = __w_pdfjs_require__(16); -var aFunction = __w_pdfjs_require__(29); +var aFunction = __w_pdfjs_require__(31); -var SPECIES = __w_pdfjs_require__(35)('species'); +var SPECIES = __w_pdfjs_require__(37)('species'); module.exports = function (O, D) { var C = anObject(O).constructor; @@ -4916,15 +4665,15 @@ module.exports = function (O, D) { "use strict"; -var ctx = __w_pdfjs_require__(28); +var ctx = __w_pdfjs_require__(30); var invoke = __w_pdfjs_require__(96); var html = __w_pdfjs_require__(63); -var cel = __w_pdfjs_require__(22); +var cel = __w_pdfjs_require__(21); -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); var process = global.process; var setTask = global.setImmediate; @@ -4971,7 +4720,7 @@ if (!setTask || !clearTask) { delete queue[id]; }; - if (__w_pdfjs_require__(34)(process) == 'process') { + if (__w_pdfjs_require__(36)(process) == 'process') { defer = function defer(id) { process.nextTick(ctx(run, id, 1)); }; @@ -5046,14 +4795,14 @@ module.exports = function (fn, args, that) { "use strict"; -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); var macrotask = __w_pdfjs_require__(95).set; var Observer = global.MutationObserver || global.WebKitMutationObserver; var process = global.process; var Promise = global.Promise; -var isNode = __w_pdfjs_require__(34)(process) == 'process'; +var isNode = __w_pdfjs_require__(36)(process) == 'process'; module.exports = function () { var head, last, notify; @@ -5127,7 +4876,7 @@ module.exports = function () { "use strict"; -var aFunction = __w_pdfjs_require__(29); +var aFunction = __w_pdfjs_require__(31); function PromiseCapability(C) { var resolve, reject; @@ -5172,7 +4921,7 @@ module.exports = function (exec) { "use strict"; -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); var navigator = global.navigator; module.exports = navigator && navigator.userAgent || ''; @@ -5184,9 +4933,9 @@ module.exports = navigator && navigator.userAgent || ''; "use strict"; -var anObject = __w_pdfjs_require__(17); +var anObject = __w_pdfjs_require__(16); -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); var newPromiseCapability = __w_pdfjs_require__(98); @@ -5206,7 +4955,7 @@ module.exports = function (C, x) { "use strict"; -var redefine = __w_pdfjs_require__(25); +var redefine = __w_pdfjs_require__(24); module.exports = function (target, src, safe) { for (var key in src) { @@ -5223,13 +4972,13 @@ module.exports = function (target, src, safe) { "use strict"; -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); -var dP = __w_pdfjs_require__(16); +var dP = __w_pdfjs_require__(15); -var DESCRIPTORS = __w_pdfjs_require__(20); +var DESCRIPTORS = __w_pdfjs_require__(19); -var SPECIES = __w_pdfjs_require__(35)('species'); +var SPECIES = __w_pdfjs_require__(37)('species'); module.exports = function (KEY) { var C = global[KEY]; @@ -5248,11 +4997,11 @@ module.exports = function (KEY) { "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); -var core = __w_pdfjs_require__(14); +var core = __w_pdfjs_require__(13); -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); var speciesConstructor = __w_pdfjs_require__(94); @@ -5281,7 +5030,7 @@ $export($export.P + $export.R, 'Promise', { "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); var newPromiseCapability = __w_pdfjs_require__(98); @@ -5313,7 +5062,7 @@ __w_pdfjs_require__(119); __w_pdfjs_require__(121); -module.exports = __w_pdfjs_require__(14).WeakMap; +module.exports = __w_pdfjs_require__(13).WeakMap; /***/ }), /* 107 */ @@ -5322,9 +5071,11 @@ module.exports = __w_pdfjs_require__(14).WeakMap; "use strict"; +var global = __w_pdfjs_require__(12); + var each = __w_pdfjs_require__(108)(0); -var redefine = __w_pdfjs_require__(25); +var redefine = __w_pdfjs_require__(24); var meta = __w_pdfjs_require__(112); @@ -5332,17 +5083,17 @@ var assign = __w_pdfjs_require__(76); var weak = __w_pdfjs_require__(113); -var isObject = __w_pdfjs_require__(18); - -var fails = __w_pdfjs_require__(21); +var isObject = __w_pdfjs_require__(17); var validate = __w_pdfjs_require__(114); +var NATIVE_WEAK_MAP = __w_pdfjs_require__(114); + +var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; var WEAK_MAP = 'WeakMap'; var getWeak = meta.getWeak; var isExtensible = Object.isExtensible; var uncaughtFrozenStore = weak.ufstore; -var tmp = {}; var InternalMap; var wrapper = function wrapper(get) { @@ -5366,9 +5117,7 @@ var methods = { var $WeakMap = module.exports = __w_pdfjs_require__(115)(WEAK_MAP, wrapper, methods, weak, true, true); -if (fails(function () { - return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; -})) { +if (NATIVE_WEAK_MAP && IS_IE11) { InternalMap = weak.getConstructor(wrapper, WEAK_MAP); assign(InternalMap.prototype, methods); meta.NEED = true; @@ -5396,13 +5145,13 @@ if (fails(function () { "use strict"; -var ctx = __w_pdfjs_require__(28); +var ctx = __w_pdfjs_require__(30); var IObject = __w_pdfjs_require__(48); var toObject = __w_pdfjs_require__(66); -var toLength = __w_pdfjs_require__(30); +var toLength = __w_pdfjs_require__(32); var asc = __w_pdfjs_require__(109); @@ -5470,11 +5219,11 @@ module.exports = function (original, length) { "use strict"; -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); var isArray = __w_pdfjs_require__(111); -var SPECIES = __w_pdfjs_require__(35)('species'); +var SPECIES = __w_pdfjs_require__(37)('species'); module.exports = function (original) { var C; @@ -5499,7 +5248,7 @@ module.exports = function (original) { "use strict"; -var cof = __w_pdfjs_require__(34); +var cof = __w_pdfjs_require__(36); module.exports = Array.isArray || function isArray(arg) { return cof(arg) == 'Array'; @@ -5514,13 +5263,13 @@ module.exports = Array.isArray || function isArray(arg) { function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var META = __w_pdfjs_require__(27)('meta'); +var META = __w_pdfjs_require__(26)('meta'); -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); -var has = __w_pdfjs_require__(26); +var has = __w_pdfjs_require__(25); -var setDesc = __w_pdfjs_require__(16).f; +var setDesc = __w_pdfjs_require__(15).f; var id = 0; @@ -5528,7 +5277,7 @@ var isExtensible = Object.isExtensible || function () { return true; }; -var FREEZE = !__w_pdfjs_require__(21)(function () { +var FREEZE = !__w_pdfjs_require__(20)(function () { return isExtensible(Object.preventExtensions({})); }); @@ -5587,9 +5336,9 @@ var redefineAll = __w_pdfjs_require__(102); var getWeak = __w_pdfjs_require__(112).getWeak; -var anObject = __w_pdfjs_require__(17); +var anObject = __w_pdfjs_require__(16); -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); var anInstance = __w_pdfjs_require__(92); @@ -5597,7 +5346,7 @@ var forOf = __w_pdfjs_require__(93); var createArrayMethod = __w_pdfjs_require__(108); -var $has = __w_pdfjs_require__(26); +var $has = __w_pdfjs_require__(25); var validate = __w_pdfjs_require__(114); @@ -5679,7 +5428,7 @@ module.exports = { "use strict"; -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); module.exports = function (it, TYPE) { if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); @@ -5693,11 +5442,11 @@ module.exports = function (it, TYPE) { "use strict"; -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); -var redefine = __w_pdfjs_require__(25); +var redefine = __w_pdfjs_require__(24); var redefineAll = __w_pdfjs_require__(102); @@ -5707,9 +5456,9 @@ var forOf = __w_pdfjs_require__(93); var anInstance = __w_pdfjs_require__(92); -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); -var fails = __w_pdfjs_require__(21); +var fails = __w_pdfjs_require__(20); var $iterDetect = __w_pdfjs_require__(73); @@ -5802,7 +5551,7 @@ module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { "use strict"; -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); var setPrototypeOf = __w_pdfjs_require__(117).set; @@ -5824,9 +5573,9 @@ module.exports = function (that, target, C) { "use strict"; -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); -var anObject = __w_pdfjs_require__(17); +var anObject = __w_pdfjs_require__(16); var check = function check(O, proto) { anObject(O); @@ -5836,7 +5585,7 @@ var check = function check(O, proto) { module.exports = { set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) { try { - set = __w_pdfjs_require__(28)(Function.call, __w_pdfjs_require__(118).f(Object.prototype, '__proto__').set, 2); + set = __w_pdfjs_require__(30)(Function.call, __w_pdfjs_require__(118).f(Object.prototype, '__proto__').set, 2); set(test, []); buggy = !(test instanceof Array); } catch (e) { @@ -5861,18 +5610,18 @@ module.exports = { var pIE = __w_pdfjs_require__(78); -var createDesc = __w_pdfjs_require__(24); +var createDesc = __w_pdfjs_require__(23); var toIObject = __w_pdfjs_require__(47); -var toPrimitive = __w_pdfjs_require__(23); +var toPrimitive = __w_pdfjs_require__(22); -var has = __w_pdfjs_require__(26); +var has = __w_pdfjs_require__(25); -var IE8_DOM_DEFINE = __w_pdfjs_require__(19); +var IE8_DOM_DEFINE = __w_pdfjs_require__(18); var gOPD = Object.getOwnPropertyDescriptor; -exports.f = __w_pdfjs_require__(20) ? gOPD : function getOwnPropertyDescriptor(O, P) { +exports.f = __w_pdfjs_require__(19) ? gOPD : function getOwnPropertyDescriptor(O, P) { O = toIObject(O); P = toPrimitive(P, true); if (IE8_DOM_DEFINE) try { @@ -5897,7 +5646,7 @@ __w_pdfjs_require__(120)('WeakMap'); "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); module.exports = function (COLLECTION) { $export($export.S, COLLECTION, { @@ -5930,11 +5679,11 @@ __w_pdfjs_require__(122)('WeakMap'); "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); -var aFunction = __w_pdfjs_require__(29); +var aFunction = __w_pdfjs_require__(31); -var ctx = __w_pdfjs_require__(28); +var ctx = __w_pdfjs_require__(30); var forOf = __w_pdfjs_require__(93); @@ -5981,7 +5730,7 @@ __w_pdfjs_require__(125); __w_pdfjs_require__(126); -module.exports = __w_pdfjs_require__(14).WeakSet; +module.exports = __w_pdfjs_require__(13).WeakSet; /***/ }), /* 124 */ @@ -6033,7 +5782,7 @@ __w_pdfjs_require__(122)('WeakSet'); __w_pdfjs_require__(128); -module.exports = __w_pdfjs_require__(14).String.codePointAt; +module.exports = __w_pdfjs_require__(13).String.codePointAt; /***/ }), /* 128 */ @@ -6042,7 +5791,7 @@ module.exports = __w_pdfjs_require__(14).String.codePointAt; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); var $at = __w_pdfjs_require__(53)(false); @@ -6061,7 +5810,7 @@ $export($export.P, 'String', { __w_pdfjs_require__(130); -module.exports = __w_pdfjs_require__(14).String.fromCodePoint; +module.exports = __w_pdfjs_require__(13).String.fromCodePoint; /***/ }), /* 130 */ @@ -6070,7 +5819,7 @@ module.exports = __w_pdfjs_require__(14).String.fromCodePoint; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); var toAbsoluteIndex = __w_pdfjs_require__(49); @@ -6104,7 +5853,7 @@ __w_pdfjs_require__(132); __w_pdfjs_require__(87); -module.exports = __w_pdfjs_require__(14).Symbol; +module.exports = __w_pdfjs_require__(13).Symbol; /***/ }), /* 132 */ @@ -6115,27 +5864,27 @@ module.exports = __w_pdfjs_require__(14).Symbol; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); -var has = __w_pdfjs_require__(26); +var has = __w_pdfjs_require__(25); -var DESCRIPTORS = __w_pdfjs_require__(20); +var DESCRIPTORS = __w_pdfjs_require__(19); -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); -var redefine = __w_pdfjs_require__(25); +var redefine = __w_pdfjs_require__(24); var META = __w_pdfjs_require__(112).KEY; -var $fails = __w_pdfjs_require__(21); +var $fails = __w_pdfjs_require__(20); -var shared = __w_pdfjs_require__(36); +var shared = __w_pdfjs_require__(28); var setToStringTag = __w_pdfjs_require__(64); -var uid = __w_pdfjs_require__(27); +var uid = __w_pdfjs_require__(26); -var wks = __w_pdfjs_require__(35); +var wks = __w_pdfjs_require__(37); var wksExt = __w_pdfjs_require__(133); @@ -6145,15 +5894,17 @@ var enumKeys = __w_pdfjs_require__(135); var isArray = __w_pdfjs_require__(111); -var anObject = __w_pdfjs_require__(17); +var anObject = __w_pdfjs_require__(16); -var isObject = __w_pdfjs_require__(18); +var isObject = __w_pdfjs_require__(17); + +var toObject = __w_pdfjs_require__(66); var toIObject = __w_pdfjs_require__(47); -var toPrimitive = __w_pdfjs_require__(23); +var toPrimitive = __w_pdfjs_require__(22); -var createDesc = __w_pdfjs_require__(24); +var createDesc = __w_pdfjs_require__(23); var _create = __w_pdfjs_require__(57); @@ -6161,7 +5912,9 @@ var gOPNExt = __w_pdfjs_require__(136); var $GOPD = __w_pdfjs_require__(118); -var $DP = __w_pdfjs_require__(16); +var $GOPS = __w_pdfjs_require__(77); + +var $DP = __w_pdfjs_require__(15); var $keys = __w_pdfjs_require__(59); @@ -6181,7 +5934,7 @@ var SymbolRegistry = shared('symbol-registry'); var AllSymbols = shared('symbols'); var OPSymbols = shared('op-symbols'); var ObjectProto = Object[PROTOTYPE]; -var USE_NATIVE = typeof $Symbol == 'function'; +var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f; var QObject = global.QObject; var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; var setSymbolDesc = DESCRIPTORS && $fails(function () { @@ -6320,9 +6073,9 @@ if (!USE_NATIVE) { $DP.f = $defineProperty; __w_pdfjs_require__(137).f = gOPNExt.f = $getOwnPropertyNames; __w_pdfjs_require__(78).f = $propertyIsEnumerable; - __w_pdfjs_require__(77).f = $getOwnPropertySymbols; + $GOPS.f = $getOwnPropertySymbols; - if (DESCRIPTORS && !__w_pdfjs_require__(37)) { + if (DESCRIPTORS && !__w_pdfjs_require__(29)) { redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } @@ -6369,6 +6122,14 @@ $export($export.S + $export.F * !USE_NATIVE, 'Object', { getOwnPropertyNames: $getOwnPropertyNames, getOwnPropertySymbols: $getOwnPropertySymbols }); +var FAILS_ON_PRIMITIVES = $fails(function () { + $GOPS.f(1); +}); +$export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', { + getOwnPropertySymbols: function getOwnPropertySymbols(it) { + return $GOPS.f(toObject(it)); + } +}); $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { var S = $Symbol(); return _stringify([S]) != '[null]' || _stringify({ @@ -6394,7 +6155,7 @@ $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { return _stringify.apply($JSON, args); } }); -$Symbol[PROTOTYPE][TO_PRIMITIVE] || __w_pdfjs_require__(15)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +$Symbol[PROTOTYPE][TO_PRIMITIVE] || __w_pdfjs_require__(14)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); setToStringTag($Symbol, 'Symbol'); setToStringTag(Math, 'Math', true); setToStringTag(global.JSON, 'JSON', true); @@ -6406,7 +6167,7 @@ setToStringTag(global.JSON, 'JSON', true); "use strict"; -exports.f = __w_pdfjs_require__(35); +exports.f = __w_pdfjs_require__(37); /***/ }), /* 134 */ @@ -6415,15 +6176,15 @@ exports.f = __w_pdfjs_require__(35); "use strict"; -var global = __w_pdfjs_require__(13); +var global = __w_pdfjs_require__(12); -var core = __w_pdfjs_require__(14); +var core = __w_pdfjs_require__(13); -var LIBRARY = __w_pdfjs_require__(37); +var LIBRARY = __w_pdfjs_require__(29); var wksExt = __w_pdfjs_require__(133); -var defineProperty = __w_pdfjs_require__(16).f; +var defineProperty = __w_pdfjs_require__(15).f; module.exports = function (name) { var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); @@ -6515,7 +6276,7 @@ exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { __w_pdfjs_require__(139); -module.exports = __w_pdfjs_require__(14).String.padStart; +module.exports = __w_pdfjs_require__(13).String.padStart; /***/ }), /* 139 */ @@ -6524,13 +6285,14 @@ module.exports = __w_pdfjs_require__(14).String.padStart; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); var $pad = __w_pdfjs_require__(140); var userAgent = __w_pdfjs_require__(100); -$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { +var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent); +$export($export.P + $export.F * WEBKIT_BUG, 'String', { padStart: function padStart(maxLength) { return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); } @@ -6543,7 +6305,7 @@ $export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAge "use strict"; -var toLength = __w_pdfjs_require__(30); +var toLength = __w_pdfjs_require__(32); var repeat = __w_pdfjs_require__(141); @@ -6568,7 +6330,7 @@ module.exports = function (that, maxLength, fillString, left) { "use strict"; -var toInteger = __w_pdfjs_require__(31); +var toInteger = __w_pdfjs_require__(33); var defined = __w_pdfjs_require__(38); @@ -6594,7 +6356,7 @@ module.exports = function repeat(count) { __w_pdfjs_require__(143); -module.exports = __w_pdfjs_require__(14).String.padEnd; +module.exports = __w_pdfjs_require__(13).String.padEnd; /***/ }), /* 143 */ @@ -6603,13 +6365,14 @@ module.exports = __w_pdfjs_require__(14).String.padEnd; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); var $pad = __w_pdfjs_require__(140); var userAgent = __w_pdfjs_require__(100); -$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { +var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent); +$export($export.P + $export.F * WEBKIT_BUG, 'String', { padEnd: function padEnd(maxLength) { return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); } @@ -6624,7 +6387,7 @@ $export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAge __w_pdfjs_require__(145); -module.exports = __w_pdfjs_require__(14).Object.values; +module.exports = __w_pdfjs_require__(13).Object.values; /***/ }), /* 145 */ @@ -6633,7 +6396,7 @@ module.exports = __w_pdfjs_require__(14).Object.values; "use strict"; -var $export = __w_pdfjs_require__(12); +var $export = __w_pdfjs_require__(11); var $values = __w_pdfjs_require__(146)(false); @@ -6650,6 +6413,8 @@ $export($export.S, 'Object', { "use strict"; +var DESCRIPTORS = __w_pdfjs_require__(19); + var getKeys = __w_pdfjs_require__(59); var toIObject = __w_pdfjs_require__(47); @@ -6666,7 +6431,9 @@ module.exports = function (isEntries) { var key; while (length > i) { - if (isEnum.call(O, key = keys[i++])) { + key = keys[i++]; + + if (!DESCRIPTORS || isEnum.call(O, key)) { result.push(isEntries ? [key, O[key]] : O[key]); } } @@ -7341,7 +7108,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (writer !== undefined) { defaultWriterClosedPromiseReject(writer, stream._storedError); - writer._closedPromise.catch(function () {}); + writer._closedPromise["catch"](function () {}); } } @@ -7389,7 +7156,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera } else if (state === 'erroring') { defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError); - this._readyPromise.catch(function () {}); + this._readyPromise["catch"](function () {}); defaultWriterClosedPromiseInitialize(this); } else if (state === 'closed') { @@ -7400,11 +7167,11 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera var storedError = stream._storedError; defaultWriterReadyPromiseInitializeAsRejected(this, storedError); - this._readyPromise.catch(function () {}); + this._readyPromise["catch"](function () {}); defaultWriterClosedPromiseInitializeAsRejected(this, storedError); - this._closedPromise.catch(function () {}); + this._closedPromise["catch"](function () {}); } } @@ -7574,7 +7341,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera defaultWriterClosedPromiseResetToRejected(writer, error); } - writer._closedPromise.catch(function () {}); + writer._closedPromise["catch"](function () {}); } function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) { @@ -7584,7 +7351,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera defaultWriterReadyPromiseResetToRejected(writer, error); } - writer._readyPromise.catch(function () {}); + writer._readyPromise["catch"](function () {}); } function WritableStreamDefaultWriterGetDesiredSize(writer) { @@ -7708,7 +7475,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera assert(stream._state === 'writable' || stream._state === 'erroring'); _this._started = true; WritableStreamDealWithRejection(stream, r); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } }]); @@ -7824,7 +7591,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera WritableStreamFinishInFlightClose(stream); }, function (reason) { WritableStreamFinishInFlightCloseWithError(stream, reason); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } function WritableStreamDefaultControllerProcessWrite(controller, chunk) { @@ -7845,7 +7612,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); }, function (reason) { WritableStreamFinishInFlightWriteWithError(stream, reason); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } function WritableStreamDefaultControllerGetBackpressure(controller) { @@ -8228,7 +7995,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera return; } - currentWrite = WritableStreamDefaultWriterWrite(writer, value).catch(function () {}); + currentWrite = WritableStreamDefaultWriterWrite(writer, value)["catch"](function () {}); }); }).then(pipeLoop); } @@ -8273,7 +8040,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera } } - pipeLoop().catch(function (err) { + pipeLoop()["catch"](function (err) { currentWrite = Promise.resolve(); rethrowAssertionErrorRejection(err); }); @@ -8289,7 +8056,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (stream._state === 'errored') { action(stream._storedError); } else { - promise.catch(action).catch(rethrowAssertionErrorRejection); + promise["catch"](action)["catch"](rethrowAssertionErrorRejection); } } @@ -8297,7 +8064,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (stream._state === 'closed') { action(); } else { - promise.then(action).catch(rethrowAssertionErrorRejection); + promise.then(action)["catch"](rethrowAssertionErrorRejection); } } @@ -8319,7 +8086,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera return finalize(originalIsError, originalError); }, function (newError) { return finalize(true, newError); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } } @@ -8333,7 +8100,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) { waitForWritesToFinish().then(function () { return finalize(isError, error); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } else { finalize(isError, error); } @@ -8454,7 +8221,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera pull._branch1 = branch1Stream._readableStreamController; pull._branch2 = branch2Stream._readableStreamController; - reader._closedPromise.catch(function (r) { + reader._closedPromise["catch"](function (r) { if (teeState.closedOrErrored === true) { return; } @@ -8655,7 +8422,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera defaultReaderClosedPromiseReject(reader, e); - reader._closedPromise.catch(function () {}); + reader._closedPromise["catch"](function () {}); } function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) { @@ -8906,7 +8673,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera assert(stream._state === 'errored', 'state must be errored'); defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError); - reader._closedPromise.catch(function () {}); + reader._closedPromise["catch"](function () {}); } } @@ -8926,7 +8693,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness')); } - reader._closedPromise.catch(function () {}); + reader._closedPromise["catch"](function () {}); reader._ownerReadableStream._reader = undefined; reader._ownerReadableStream = undefined; @@ -8994,7 +8761,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera ReadableStreamDefaultControllerCallPullIfNeeded(controller); }, function (r) { ReadableStreamDefaultControllerErrorIfNeeded(controller, r); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } _createClass(ReadableStreamDefaultController, [{ @@ -9129,7 +8896,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera return undefined; }, function (e) { ReadableStreamDefaultControllerErrorIfNeeded(controller, e); - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); return undefined; } @@ -9324,7 +9091,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (stream._state === 'readable') { ReadableByteStreamControllerError(controller, r); } - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); } _createClass(ReadableByteStreamController, [{ @@ -9526,7 +9293,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera if (controller._controlledReadableStream._state === 'readable') { ReadableByteStreamControllerError(controller, e); } - }).catch(rethrowAssertionErrorRejection); + })["catch"](rethrowAssertionErrorRejection); return undefined; } @@ -10257,7 +10024,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera } return Promise.resolve(); - }).catch(function (r) { + })["catch"](function (r) { TransformStreamErrorIfNeeded(transformStream, r); return Promise.reject(transformStream._storedError); }); @@ -10406,7 +10173,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera var transformStream = this; var startResult = InvokeOrNoop(transformer, 'start', [transformStream._transformStreamController]); startPromise_resolve(startResult); - startPromise.catch(function (e) { + startPromise["catch"](function (e) { if (transformStream._errored === false) { transformStream._errored = true; transformStream._storedError = e; @@ -10477,7 +10244,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat } else { var PolyfillURL = __w_pdfjs_require__(150).URL; - var OriginalURL = __w_pdfjs_require__(8).URL; + var OriginalURL = __w_pdfjs_require__(7).URL; if (OriginalURL) { PolyfillURL.createObjectURL = function (blob) { @@ -11170,6 +10937,331 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.clearPrimitiveCaches = clearPrimitiveCaches; +exports.isEOF = isEOF; +exports.isCmd = isCmd; +exports.isDict = isDict; +exports.isName = isName; +exports.isRef = isRef; +exports.isRefsEqual = isRefsEqual; +exports.isStream = isStream; +exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = void 0; + +var _util = __w_pdfjs_require__(5); + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var EOF = {}; +exports.EOF = EOF; + +var Name = function NameClosure() { + var nameCache = Object.create(null); + + function Name(name) { + this.name = name; + } + + Name.prototype = {}; + + Name.get = function Name_get(name) { + var nameValue = nameCache[name]; + return nameValue ? nameValue : nameCache[name] = new Name(name); + }; + + Name._clearCache = function () { + nameCache = Object.create(null); + }; + + return Name; +}(); + +exports.Name = Name; + +var Cmd = function CmdClosure() { + var cmdCache = Object.create(null); + + function Cmd(cmd) { + this.cmd = cmd; + } + + Cmd.prototype = {}; + + Cmd.get = function Cmd_get(cmd) { + var cmdValue = cmdCache[cmd]; + return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd); + }; + + Cmd._clearCache = function () { + cmdCache = Object.create(null); + }; + + return Cmd; +}(); + +exports.Cmd = Cmd; + +var Dict = function DictClosure() { + var nonSerializable = function nonSerializableClosure() { + return nonSerializable; + }; + + function Dict(xref) { + this._map = Object.create(null); + this.xref = xref; + this.objId = null; + this.suppressEncryption = false; + this.__nonSerializable__ = nonSerializable; + } + + Dict.prototype = { + assignXref: function Dict_assignXref(newXref) { + this.xref = newXref; + }, + get: function Dict_get(key1, key2, key3) { + var value; + var xref = this.xref, + suppressEncryption = this.suppressEncryption; + + if (typeof (value = this._map[key1]) !== 'undefined' || key1 in this._map || typeof key2 === 'undefined') { + return xref ? xref.fetchIfRef(value, suppressEncryption) : value; + } + + if (typeof (value = this._map[key2]) !== 'undefined' || key2 in this._map || typeof key3 === 'undefined') { + return xref ? xref.fetchIfRef(value, suppressEncryption) : value; + } + + value = this._map[key3] || null; + return xref ? xref.fetchIfRef(value, suppressEncryption) : value; + }, + getAsync: function Dict_getAsync(key1, key2, key3) { + var value; + var xref = this.xref, + suppressEncryption = this.suppressEncryption; + + if (typeof (value = this._map[key1]) !== 'undefined' || key1 in this._map || typeof key2 === 'undefined') { + if (xref) { + return xref.fetchIfRefAsync(value, suppressEncryption); + } + + return Promise.resolve(value); + } + + if (typeof (value = this._map[key2]) !== 'undefined' || key2 in this._map || typeof key3 === 'undefined') { + if (xref) { + return xref.fetchIfRefAsync(value, suppressEncryption); + } + + return Promise.resolve(value); + } + + value = this._map[key3] || null; + + if (xref) { + return xref.fetchIfRefAsync(value, suppressEncryption); + } + + return Promise.resolve(value); + }, + getArray: function Dict_getArray(key1, key2, key3) { + var value = this.get(key1, key2, key3); + var xref = this.xref, + suppressEncryption = this.suppressEncryption; + + if (!Array.isArray(value) || !xref) { + return value; + } + + value = value.slice(); + + for (var i = 0, ii = value.length; i < ii; i++) { + if (!isRef(value[i])) { + continue; + } + + value[i] = xref.fetch(value[i], suppressEncryption); + } + + return value; + }, + getRaw: function Dict_getRaw(key) { + return this._map[key]; + }, + getKeys: function Dict_getKeys() { + return Object.keys(this._map); + }, + set: function Dict_set(key, value) { + this._map[key] = value; + }, + has: function Dict_has(key) { + return key in this._map; + }, + forEach: function Dict_forEach(callback) { + for (var key in this._map) { + callback(key, this.get(key)); + } + } + }; + Dict.empty = new Dict(null); + + Dict.merge = function (xref, dictArray) { + var mergedDict = new Dict(xref); + + for (var i = 0, ii = dictArray.length; i < ii; i++) { + var dict = dictArray[i]; + + if (!isDict(dict)) { + continue; + } + + for (var keyName in dict._map) { + if (mergedDict._map[keyName] !== undefined) { + continue; + } + + mergedDict._map[keyName] = dict._map[keyName]; + } + } + + return mergedDict; + }; + + return Dict; +}(); + +exports.Dict = Dict; + +var Ref = function RefClosure() { + var refCache = Object.create(null); + + function Ref(num, gen) { + this.num = num; + this.gen = gen; + } + + Ref.prototype = { + toString: function Ref_toString() { + if (this.gen === 0) { + return "".concat(this.num, "R"); + } + + return "".concat(this.num, "R").concat(this.gen); + } + }; + + Ref.get = function (num, gen) { + var key = gen === 0 ? "".concat(num, "R") : "".concat(num, "R").concat(gen); + var refValue = refCache[key]; + return refValue ? refValue : refCache[key] = new Ref(num, gen); + }; + + Ref._clearCache = function () { + refCache = Object.create(null); + }; + + return Ref; +}(); + +exports.Ref = Ref; + +var RefSet = function RefSetClosure() { + function RefSet() { + this.dict = Object.create(null); + } + + RefSet.prototype = { + has: function RefSet_has(ref) { + return ref.toString() in this.dict; + }, + put: function RefSet_put(ref) { + this.dict[ref.toString()] = true; + }, + remove: function RefSet_remove(ref) { + delete this.dict[ref.toString()]; + } + }; + return RefSet; +}(); + +exports.RefSet = RefSet; + +var RefSetCache = function RefSetCacheClosure() { + function RefSetCache() { + this.dict = Object.create(null); + } + + RefSetCache.prototype = { + get: function RefSetCache_get(ref) { + return this.dict[ref.toString()]; + }, + has: function RefSetCache_has(ref) { + return ref.toString() in this.dict; + }, + put: function RefSetCache_put(ref, obj) { + this.dict[ref.toString()] = obj; + }, + putAlias: function RefSetCache_putAlias(ref, aliasRef) { + this.dict[ref.toString()] = this.get(aliasRef); + }, + forEach: function RefSetCache_forEach(fn, thisArg) { + for (var i in this.dict) { + fn.call(thisArg, this.dict[i]); + } + }, + clear: function RefSetCache_clear() { + this.dict = Object.create(null); + } + }; + return RefSetCache; +}(); + +exports.RefSetCache = RefSetCache; + +function isEOF(v) { + return v === EOF; +} + +function isName(v, name) { + return v instanceof Name && (name === undefined || v.name === name); +} + +function isCmd(v, cmd) { + return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); +} + +function isDict(v, type) { + return v instanceof Dict && (type === undefined || isName(v.get('Type'), type)); +} + +function isRef(v) { + return v instanceof Ref; +} + +function isRefsEqual(v1, v2) { + return v1.num === v2.num && v1.gen === v2.gen; +} + +function isStream(v) { + return _typeof(v) === 'object' && v !== null && v.getBytes !== undefined; +} + +function clearPrimitiveCaches() { + Cmd._clearCache(); + + Name._clearCache(); + + Ref._clearCache(); +} + +/***/ }), +/* 152 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + Object.defineProperty(exports, "__esModule", { value: true }); @@ -11177,15 +11269,17 @@ exports.NetworkPdfManager = exports.LocalPdfManager = void 0; var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _chunked_stream = __w_pdfjs_require__(152); +var _chunked_stream = __w_pdfjs_require__(153); -var _document = __w_pdfjs_require__(153); +var _core_utils = __w_pdfjs_require__(154); -var _stream = __w_pdfjs_require__(157); +var _document = __w_pdfjs_require__(155); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _stream = __w_pdfjs_require__(158); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -11193,12 +11287,12 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } @@ -11260,8 +11354,8 @@ function () { value: function () { var _ensure = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(obj, prop, args) { - return _regenerator.default.wrap(function _callee$(_context) { + _regenerator["default"].mark(function _callee(obj, prop, args) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -11272,7 +11366,7 @@ function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); function ensure(_x, _x2, _x3) { @@ -11354,7 +11448,7 @@ function (_BasePdfManager) { _this._docBaseUrl = docBaseUrl; _this.evaluatorOptions = evaluatorOptions; var stream = new _stream.Stream(data); - _this.pdfDocument = new _document.PDFDocument(_assertThisInitialized(_assertThisInitialized(_this)), stream); + _this.pdfDocument = new _document.PDFDocument(_assertThisInitialized(_this), stream); _this._loadedStreamPromise = Promise.resolve(stream); return _this; } @@ -11364,9 +11458,9 @@ function (_BasePdfManager) { value: function () { var _ensure2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2(obj, prop, args) { + _regenerator["default"].mark(function _callee2(obj, prop, args) { var value; - return _regenerator.default.wrap(function _callee2$(_context2) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -11387,7 +11481,7 @@ function (_BasePdfManager) { return _context2.stop(); } } - }, _callee2, this); + }, _callee2); })); function ensure(_x4, _x5, _x6) { @@ -11441,7 +11535,7 @@ function (_BasePdfManager2) { disableAutoFetch: args.disableAutoFetch, rangeChunkSize: args.rangeChunkSize }); - _this2.pdfDocument = new _document.PDFDocument(_assertThisInitialized(_assertThisInitialized(_this2)), _this2.streamManager.getStream()); + _this2.pdfDocument = new _document.PDFDocument(_assertThisInitialized(_this2), _this2.streamManager.getStream()); return _this2; } @@ -11450,9 +11544,9 @@ function (_BasePdfManager2) { value: function () { var _ensure3 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee3(obj, prop, args) { + _regenerator["default"].mark(function _callee3(obj, prop, args) { var value; - return _regenerator.default.wrap(function _callee3$(_context3) { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -11473,7 +11567,7 @@ function (_BasePdfManager2) { _context3.prev = 7; _context3.t0 = _context3["catch"](0); - if (_context3.t0 instanceof _util.MissingDataException) { + if (_context3.t0 instanceof _core_utils.MissingDataException) { _context3.next = 11; break; } @@ -11536,7 +11630,7 @@ function (_BasePdfManager2) { exports.NetworkPdfManager = NetworkPdfManager; /***/ }), -/* 152 */ +/* 153 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -11547,7 +11641,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.ChunkedStreamManager = exports.ChunkedStream = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); + +var _core_utils = __w_pdfjs_require__(154); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -11643,6 +11739,10 @@ function () { }, { key: "ensureByte", value: function ensureByte(pos) { + if (pos < this.progressiveDataLength) { + return; + } + var chunk = Math.floor(pos / this.chunkSize); if (chunk === this.lastSuccessfulEnsureByteChunk) { @@ -11650,7 +11750,7 @@ function () { } if (!this.loadedChunks[chunk]) { - throw new _util.MissingDataException(pos, pos + 1); + throw new _core_utils.MissingDataException(pos, pos + 1); } this.lastSuccessfulEnsureByteChunk = chunk; @@ -11672,7 +11772,7 @@ function () { for (var chunk = beginChunk; chunk < endChunk; ++chunk) { if (!this.loadedChunks[chunk]) { - throw new _util.MissingDataException(begin, end); + throw new _core_utils.MissingDataException(begin, end); } } } @@ -11799,7 +11899,11 @@ function () { }, { key: "makeSubStream", value: function makeSubStream(start, length, dict) { - this.ensureRange(start, start + length); + if (length) { + this.ensureRange(start, start + length); + } else { + this.ensureByte(start); + } function ChunkedStreamSubstream() {} @@ -11953,8 +12057,8 @@ function () { _iteratorError = err; } finally { try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); } } finally { if (_didIteratorError) { @@ -12003,8 +12107,8 @@ function () { _iteratorError2 = err; } finally { try { - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); + if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) { + _iterator2["return"](); } } finally { if (_didIteratorError2) { @@ -12060,8 +12164,8 @@ function () { _iteratorError3 = err; } finally { try { - if (!_iteratorNormalCompletion3 && _iterator3.return != null) { - _iterator3.return(); + if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) { + _iterator3["return"](); } } finally { if (_didIteratorError3) { @@ -12167,8 +12271,8 @@ function () { _iteratorError4 = err; } finally { try { - if (!_iteratorNormalCompletion4 && _iterator4.return != null) { - _iterator4.return(); + if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) { + _iterator4["return"](); } } finally { if (_didIteratorError4) { @@ -12196,8 +12300,8 @@ function () { } } - for (var _i = 0; _i < loadedRequests.length; _i++) { - var _requestId = loadedRequests[_i]; + for (var _i = 0, _loadedRequests = loadedRequests; _i < _loadedRequests.length; _i++) { + var _requestId = _loadedRequests[_i]; var capability = this.promisesByRequest[_requestId]; delete this.promisesByRequest[_requestId]; capability.resolve(); @@ -12244,7 +12348,139 @@ function () { exports.ChunkedStreamManager = ChunkedStreamManager; /***/ }), -/* 153 */ +/* 154 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getLookupTableFactory = getLookupTableFactory; +exports.getInheritableProperty = getInheritableProperty; +exports.toRomanNumerals = toRomanNumerals; +exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0; + +var _util = __w_pdfjs_require__(5); + +function getLookupTableFactory(initializer) { + var lookup; + return function () { + if (initializer) { + lookup = Object.create(null); + initializer(lookup); + initializer = null; + } + + return lookup; + }; +} + +var MissingDataException = function MissingDataExceptionClosure() { + function MissingDataException(begin, end) { + this.begin = begin; + this.end = end; + this.message = "Missing data [".concat(begin, ", ").concat(end, ")"); + } + + MissingDataException.prototype = new Error(); + MissingDataException.prototype.name = 'MissingDataException'; + MissingDataException.constructor = MissingDataException; + return MissingDataException; +}(); + +exports.MissingDataException = MissingDataException; + +var XRefEntryException = function XRefEntryExceptionClosure() { + function XRefEntryException(msg) { + this.message = msg; + } + + XRefEntryException.prototype = new Error(); + XRefEntryException.prototype.name = 'XRefEntryException'; + XRefEntryException.constructor = XRefEntryException; + return XRefEntryException; +}(); + +exports.XRefEntryException = XRefEntryException; + +var XRefParseException = function XRefParseExceptionClosure() { + function XRefParseException(msg) { + this.message = msg; + } + + XRefParseException.prototype = new Error(); + XRefParseException.prototype.name = 'XRefParseException'; + XRefParseException.constructor = XRefParseException; + return XRefParseException; +}(); + +exports.XRefParseException = XRefParseException; + +function getInheritableProperty(_ref) { + var dict = _ref.dict, + key = _ref.key, + _ref$getArray = _ref.getArray, + getArray = _ref$getArray === void 0 ? false : _ref$getArray, + _ref$stopWhenFound = _ref.stopWhenFound, + stopWhenFound = _ref$stopWhenFound === void 0 ? true : _ref$stopWhenFound; + var LOOP_LIMIT = 100; + var loopCount = 0; + var values; + + while (dict) { + var value = getArray ? dict.getArray(key) : dict.get(key); + + if (value !== undefined) { + if (stopWhenFound) { + return value; + } + + if (!values) { + values = []; + } + + values.push(value); + } + + if (++loopCount > LOOP_LIMIT) { + (0, _util.warn)("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\"")); + break; + } + + dict = dict.get('Parent'); + } + + return values; +} + +var ROMAN_NUMBER_MAP = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']; + +function toRomanNumerals(number) { + var lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + (0, _util.assert)(Number.isInteger(number) && number > 0, 'The number should be a positive integer.'); + var pos, + romanBuf = []; + + while (number >= 1000) { + number -= 1000; + romanBuf.push('M'); + } + + pos = number / 100 | 0; + number %= 100; + romanBuf.push(ROMAN_NUMBER_MAP[pos]); + pos = number / 10 | 0; + number %= 10; + romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); + romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); + var romanStr = romanBuf.join(''); + return lowerCase ? romanStr.toLowerCase() : romanStr; +} + +/***/ }), +/* 155 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -12255,25 +12491,27 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFDocument = exports.Page = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); + +var _obj = __w_pdfjs_require__(156); -var _obj = __w_pdfjs_require__(154); +var _primitives = __w_pdfjs_require__(151); -var _primitives = __w_pdfjs_require__(155); +var _core_utils = __w_pdfjs_require__(154); -var _stream2 = __w_pdfjs_require__(157); +var _stream2 = __w_pdfjs_require__(158); -var _annotation = __w_pdfjs_require__(169); +var _annotation = __w_pdfjs_require__(170); -var _crypto = __w_pdfjs_require__(167); +var _crypto = __w_pdfjs_require__(168); -var _parser = __w_pdfjs_require__(156); +var _parser = __w_pdfjs_require__(157); -var _operator_list = __w_pdfjs_require__(170); +var _operator_list = __w_pdfjs_require__(171); -var _evaluator = __w_pdfjs_require__(171); +var _evaluator = __w_pdfjs_require__(172); -var _function = __w_pdfjs_require__(185); +var _function = __w_pdfjs_require__(186); function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } @@ -12321,13 +12559,15 @@ function () { this.pdfFunctionFactory = pdfFunctionFactory; this.evaluatorOptions = pdfManager.evaluatorOptions; this.resourcesPromise = null; - var uniquePrefix = "p".concat(this.pageIndex, "_"); var idCounters = { obj: 0 }; this.idFactory = { createObjId: function createObjId() { - return uniquePrefix + ++idCounters.obj; + return "p".concat(pageIndex, "_").concat(++idCounters.obj); + }, + getDocId: function getDocId() { + return "g_".concat(pdfManager.docId); } }; } @@ -12336,7 +12576,7 @@ function () { key: "_getInheritableProperty", value: function _getInheritableProperty(key) { var getArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var value = (0, _util.getInheritableProperty)({ + var value = (0, _core_utils.getInheritableProperty)({ dict: this.pageDict, key: key, getArray: getArray, @@ -12376,8 +12616,8 @@ function () { _iteratorError = err; } finally { try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); } } finally { if (_didIteratorError) { @@ -12421,7 +12661,6 @@ function () { var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream'); var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']); var partialEvaluator = new _evaluator.PartialEvaluator({ - pdfManager: this.pdfManager, xref: this.xref, handler: handler, pageIndex: this.pageIndex, @@ -12479,8 +12718,8 @@ function () { _iteratorError2 = err; } finally { try { - if (!_iteratorNormalCompletion2 && _iterator2.return != null) { - _iterator2.return(); + if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) { + _iterator2["return"](); } } finally { if (_didIteratorError2) { @@ -12505,8 +12744,8 @@ function () { _iteratorError3 = err; } finally { try { - if (!_iteratorNormalCompletion3 && _iterator3.return != null) { - _iterator3.return(); + if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) { + _iterator3["return"](); } } finally { if (_didIteratorError3) { @@ -12539,7 +12778,6 @@ function () { contentStream = _ref9[0]; var partialEvaluator = new _evaluator.PartialEvaluator({ - pdfManager: _this3.pdfManager, xref: _this3.xref, handler: handler, pageIndex: _this3.pageIndex, @@ -12684,22 +12922,10 @@ exports.Page = Page; var FINGERPRINT_FIRST_BYTES = 1024; var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00'; -function find(stream, needle, limit, backwards) { - var pos = stream.pos; - var end = stream.end; - - if (pos + limit > end) { - limit = end - pos; - } - - var strBuf = []; - - for (var i = 0; i < limit; ++i) { - strBuf.push(String.fromCharCode(stream.getByte())); - } - - var str = strBuf.join(''); - stream.pos = pos; +function find(stream, needle, limit) { + var backwards = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + (0, _util.assert)(limit > 0, 'The "limit" must be a positive integer.'); + var str = (0, _util.bytesToString)(stream.peekBytes(limit)); var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle); if (index === -1) { @@ -12757,18 +12983,32 @@ function () { this.xfa = this.acroForm.get('XFA'); var fields = this.acroForm.get('Fields'); - if ((!fields || !Array.isArray(fields) || fields.length === 0) && !this.xfa) { + if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) { this.acroForm = null; } } } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } (0, _util.info)('Cannot fetch AcroForm entry; assuming no AcroForms are present'); this.acroForm = null; } + + try { + var collection = this.catalog.catDict.get('Collection'); + + if ((0, _primitives.isDict)(collection) && collection.getKeys().length > 0) { + this.collection = collection; + } + } catch (ex) { + if (ex instanceof _core_utils.MissingDataException) { + throw ex; + } + + (0, _util.info)('Cannot fetch Collection dictionary.'); + } } }, { key: "checkHeader", @@ -12814,7 +13054,9 @@ function () { var catalog = this.catalog, linearization = this.linearization; (0, _util.assert)(linearization && linearization.pageFirst === pageIndex); - var ref = new _primitives.Ref(linearization.objectNumberFirst, 0); + + var ref = _primitives.Ref.get(linearization.objectNumberFirst, 0); + return this.xref.fetchAsync(ref).then(function (obj) { if ((0, _primitives.isDict)(obj, 'Page') || (0, _primitives.isDict)(obj) && !obj.has('Type') && obj.has('Contents')) { if (ref && !catalog.pageKidsCountCache.has(ref)) { @@ -12825,7 +13067,7 @@ function () { } throw new _util.FormatError('The Linearization dictionary doesn\'t point ' + 'to a valid Page dictionary.'); - }).catch(function (reason) { + })["catch"](function (reason) { (0, _util.info)(reason); return catalog.getPageDict(pageIndex); }); @@ -12864,13 +13106,13 @@ function () { value: function checkFirstPage() { var _this6 = this; - return this.getPage(0).catch(function (reason) { - if (reason instanceof _util.XRefEntryException) { + return this.getPage(0)["catch"](function (reason) { + if (reason instanceof _core_utils.XRefEntryException) { _this6._pagePromises.length = 0; _this6.cleanup(); - throw new _util.XRefParseException(); + throw new _core_utils.XRefParseException(); } }); } @@ -12892,7 +13134,7 @@ function () { try { linearization = _parser.Linearization.create(this.stream); } catch (err) { - if (err instanceof _util.MissingDataException) { + if (err instanceof _core_utils.MissingDataException) { throw err; } @@ -12980,14 +13222,15 @@ function () { PDFFormatVersion: this.pdfFormatVersion, IsLinearized: !!this.linearization, IsAcroFormPresent: !!this.acroForm, - IsXFAPresent: !!this.xfa + IsXFAPresent: !!this.xfa, + IsCollectionPresent: !!this.collection }; var infoDict; try { infoDict = this.xref.trailer.get('Info'); } catch (err) { - if (err instanceof _util.MissingDataException) { + if (err instanceof _core_utils.MissingDataException) { throw err; } @@ -13034,8 +13277,8 @@ function () { _iteratorError4 = err; } finally { try { - if (!_iteratorNormalCompletion4 && _iterator4.return != null) { - _iterator4.return(); + if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) { + _iterator4["return"](); } } finally { if (_didIteratorError4) { @@ -13080,7 +13323,7 @@ function () { exports.PDFDocument = PDFDocument; /***/ }), -/* 154 */ +/* 156 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -13093,19 +13336,21 @@ exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = void var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); -var _parser = __w_pdfjs_require__(156); +var _parser = __w_pdfjs_require__(157); -var _chunked_stream = __w_pdfjs_require__(152); +var _core_utils = __w_pdfjs_require__(154); -var _crypto = __w_pdfjs_require__(167); +var _chunked_stream = __w_pdfjs_require__(153); -var _colorspace = __w_pdfjs_require__(168); +var _crypto = __w_pdfjs_require__(168); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _colorspace = __w_pdfjs_require__(169); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } @@ -13211,6 +13456,7 @@ function () { var title = outlineDict.get('Title'); var flags = outlineDict.get('F') || 0; var color = outlineDict.getArray('C'); + var count = outlineDict.get('Count'); var rgbColor = blackColor; if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { @@ -13224,7 +13470,7 @@ function () { newWindow: data.newWindow, title: (0, _util.stringToPDFString)(title), color: rgbColor, - count: outlineDict.get('Count'), + count: Number.isInteger(count) ? count : undefined, bold: !!(flags & 2), italic: !!(flags & 1), items: [] @@ -13302,6 +13548,8 @@ function () { } else if (this.catDict.has('Dests')) { return this.catDict.get('Dests'); } + + return undefined; } }, { key: "_readPageLabels", @@ -13376,7 +13624,7 @@ function () { case 'R': case 'r': - currentLabel = (0, _util.toRomanNumerals)(currentIndex, style === 'r'); + currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === 'r'); break; case 'A': @@ -13436,8 +13684,8 @@ function () { _iteratorError = err; } finally { try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); } } finally { if (_didIteratorError) { @@ -13452,6 +13700,7 @@ function () { value: function cleanup() { var _this = this; + (0, _primitives.clearPrimitiveCaches)(); this.pageKidsCountCache.clear(); var promises = []; this.fontCache.forEach(function (promise) { @@ -13696,7 +13945,7 @@ function () { try { metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes())); } catch (e) { - if (e instanceof _util.MissingDataException) { + if (e instanceof _core_utils.MissingDataException) { throw e; } @@ -13726,7 +13975,7 @@ function () { try { obj = this._readDocumentOutline(); } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } @@ -13743,7 +13992,7 @@ function () { try { permissions = this._readPermissions(); } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } @@ -13793,7 +14042,7 @@ function () { try { obj = this._readPageLabels(); } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } @@ -13802,6 +14051,26 @@ function () { return (0, _util.shadow)(this, 'pageLabels', obj); } + }, { + key: "pageLayout", + get: function get() { + var obj = this.catDict.get('PageLayout'); + var pageLayout = ''; + + if ((0, _primitives.isName)(obj)) { + switch (obj.name) { + case 'SinglePage': + case 'OneColumn': + case 'TwoColumnLeft': + case 'TwoColumnRight': + case 'TwoPageLeft': + case 'TwoPageRight': + pageLayout = obj.name; + } + } + + return (0, _util.shadow)(this, 'pageLayout', pageLayout); + } }, { key: "pageMode", get: function get() { @@ -13822,6 +14091,162 @@ function () { return (0, _util.shadow)(this, 'pageMode', pageMode); } + }, { + key: "viewerPreferences", + get: function get() { + var _this2 = this; + + var ViewerPreferencesValidators = { + HideToolbar: _util.isBool, + HideMenubar: _util.isBool, + HideWindowUI: _util.isBool, + FitWindow: _util.isBool, + CenterWindow: _util.isBool, + DisplayDocTitle: _util.isBool, + NonFullScreenPageMode: _primitives.isName, + Direction: _primitives.isName, + ViewArea: _primitives.isName, + ViewClip: _primitives.isName, + PrintArea: _primitives.isName, + PrintClip: _primitives.isName, + PrintScaling: _primitives.isName, + Duplex: _primitives.isName, + PickTrayByPDFSize: _util.isBool, + PrintPageRange: Array.isArray, + NumCopies: Number.isInteger + }; + var obj = this.catDict.get('ViewerPreferences'); + var prefs = Object.create(null); + + if ((0, _primitives.isDict)(obj)) { + for (var key in ViewerPreferencesValidators) { + if (!obj.has(key)) { + continue; + } + + var value = obj.get(key); + + if (!ViewerPreferencesValidators[key](value)) { + (0, _util.info)("Bad value in ViewerPreferences for \"".concat(key, "\".")); + continue; + } + + var prefValue = void 0; + + switch (key) { + case 'NonFullScreenPageMode': + switch (value.name) { + case 'UseNone': + case 'UseOutlines': + case 'UseThumbs': + case 'UseOC': + prefValue = value.name; + break; + + default: + prefValue = 'UseNone'; + } + + break; + + case 'Direction': + switch (value.name) { + case 'L2R': + case 'R2L': + prefValue = value.name; + break; + + default: + prefValue = 'L2R'; + } + + break; + + case 'ViewArea': + case 'ViewClip': + case 'PrintArea': + case 'PrintClip': + switch (value.name) { + case 'MediaBox': + case 'CropBox': + case 'BleedBox': + case 'TrimBox': + case 'ArtBox': + prefValue = value.name; + break; + + default: + prefValue = 'CropBox'; + } + + break; + + case 'PrintScaling': + switch (value.name) { + case 'None': + case 'AppDefault': + prefValue = value.name; + break; + + default: + prefValue = 'AppDefault'; + } + + break; + + case 'Duplex': + switch (value.name) { + case 'Simplex': + case 'DuplexFlipShortEdge': + case 'DuplexFlipLongEdge': + prefValue = value.name; + break; + + default: + prefValue = 'None'; + } + + break; + + case 'PrintPageRange': + var length = value.length; + + if (length % 2 !== 0) { + break; + } + + var isValid = value.every(function (page, i, arr) { + return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= _this2.numPages; + }); + + if (isValid) { + prefValue = value; + } + + break; + + case 'NumCopies': + if (value > 0) { + prefValue = value; + } + + break; + + default: + (0, _util.assert)(typeof value === 'boolean'); + prefValue = value; + } + + if (prefValue !== undefined) { + prefs[key] = prefValue; + } else { + (0, _util.info)("Bad value in ViewerPreferences for \"".concat(key, "\".")); + } + } + } + + return (0, _util.shadow)(this, 'viewerPreferences', prefs); + } }, { key: "openActionDestination", get: function get() { @@ -14140,7 +14565,7 @@ var XRef = function XRefClosure() { try { encrypt = trailerDict.get('Encrypt'); } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } @@ -14159,7 +14584,7 @@ var XRef = function XRefClosure() { try { root = trailerDict.get('Root'); } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } @@ -14170,7 +14595,7 @@ var XRef = function XRefClosure() { this.root = root; } else { if (!recoveryMode) { - throw new _util.XRefParseException(); + throw new _core_utils.XRefParseException(); } throw new _util.FormatError('Invalid root reference'); @@ -14240,10 +14665,16 @@ var XRef = function XRefClosure() { entry.gen = parser.getObj(); var type = parser.getObj(); - if ((0, _primitives.isCmd)(type, 'f')) { - entry.free = true; - } else if ((0, _primitives.isCmd)(type, 'n')) { - entry.uncompressed = true; + if (type instanceof _primitives.Cmd) { + switch (type.cmd) { + case 'f': + entry.free = true; + break; + + case 'n': + entry.uncompressed = true; + break; + } } if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) { @@ -14527,7 +14958,12 @@ var XRef = function XRefClosure() { for (i = 0, ii = trailers.length; i < ii; ++i) { stream.pos = trailers[i]; - var parser = new _parser.Parser(new _parser.Lexer(stream), true, this, true); + var parser = new _parser.Parser({ + lexer: new _parser.Lexer(stream), + xref: this, + allowStreams: true, + recoveryMode: true + }); var obj = parser.getObj(); if (!(0, _primitives.isCmd)(obj, 'trailer')) { @@ -14545,7 +14981,7 @@ var XRef = function XRefClosure() { try { rootDict = dict.get('Root'); } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } @@ -14585,7 +15021,11 @@ var XRef = function XRefClosure() { startXRefParsedCache[startXRef] = true; stream.pos = startXRef + stream.start; - var parser = new _parser.Parser(new _parser.Lexer(stream), true, this); + var parser = new _parser.Parser({ + lexer: new _parser.Lexer(stream), + xref: this, + allowStreams: true + }); var obj = parser.getObj(); var dict; @@ -14637,7 +15077,7 @@ var XRef = function XRefClosure() { return this.topDict; } catch (e) { - if (e instanceof _util.MissingDataException) { + if (e instanceof _core_utils.MissingDataException) { throw e; } @@ -14645,10 +15085,10 @@ var XRef = function XRefClosure() { } if (recoveryMode) { - return; + return undefined; } - throw new _util.XRefParseException(); + throw new _core_utils.XRefParseException(); }, getEntry: function XRef_getEntry(i) { var xrefEntry = this.entries[i]; @@ -14709,11 +15149,15 @@ var XRef = function XRefClosure() { var num = ref.num; if (xrefEntry.gen !== gen) { - throw new _util.XRefEntryException("Inconsistent generation in XRef: ".concat(ref)); + throw new _core_utils.XRefEntryException("Inconsistent generation in XRef: ".concat(ref)); } var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start); - var parser = new _parser.Parser(new _parser.Lexer(stream), true, this); + var parser = new _parser.Parser({ + lexer: new _parser.Lexer(stream), + xref: this, + allowStreams: true + }); var obj1 = parser.getObj(); var obj2 = parser.getObj(); var obj3 = parser.getObj(); @@ -14726,8 +15170,8 @@ var XRef = function XRefClosure() { obj2 = parseInt(obj2, 10); } - if (obj1 !== num || obj2 !== gen || !(0, _primitives.isCmd)(obj3)) { - throw new _util.XRefEntryException("Bad (uncompressed) XRef entry: ".concat(ref)); + if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) { + throw new _core_utils.XRefEntryException("Bad (uncompressed) XRef entry: ".concat(ref)); } if (obj3.cmd !== 'obj') { @@ -14739,7 +15183,7 @@ var XRef = function XRefClosure() { } } - throw new _util.XRefEntryException("Bad (uncompressed) XRef entry: ".concat(ref)); + throw new _core_utils.XRefEntryException("Bad (uncompressed) XRef entry: ".concat(ref)); } if (this.encrypt && !suppressEncryption) { @@ -14757,7 +15201,7 @@ var XRef = function XRefClosure() { fetchCompressed: function fetchCompressed(ref, xrefEntry) { var suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var tableOffset = xrefEntry.offset; - var stream = this.fetch(new _primitives.Ref(tableOffset, 0)); + var stream = this.fetch(_primitives.Ref.get(tableOffset, 0)); if (!(0, _primitives.isStream)(stream)) { throw new _util.FormatError('bad ObjStm stream'); @@ -14770,8 +15214,11 @@ var XRef = function XRefClosure() { throw new _util.FormatError('invalid first and n parameters for ObjStm stream'); } - var parser = new _parser.Parser(new _parser.Lexer(stream), false, this); - parser.allowStreams = true; + var parser = new _parser.Parser({ + lexer: new _parser.Lexer(stream), + xref: this, + allowStreams: true + }); var i, entries = [], num, @@ -14810,7 +15257,7 @@ var XRef = function XRefClosure() { xrefEntry = entries[xrefEntry.gen]; if (xrefEntry === undefined) { - throw new _util.XRefEntryException("Bad (compressed) XRef entry: ".concat(ref)); + throw new _core_utils.XRefEntryException("Bad (compressed) XRef entry: ".concat(ref)); } return xrefEntry; @@ -14818,8 +15265,8 @@ var XRef = function XRefClosure() { fetchIfRefAsync: function () { var _fetchIfRefAsync = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(obj, suppressEncryption) { - return _regenerator.default.wrap(function _callee$(_context) { + _regenerator["default"].mark(function _callee(obj, suppressEncryption) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -14850,8 +15297,8 @@ var XRef = function XRefClosure() { fetchAsync: function () { var _fetchAsync = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2(ref, suppressEncryption) { - return _regenerator.default.wrap(function _callee2$(_context2) { + _regenerator["default"].mark(function _callee2(ref, suppressEncryption) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -14862,7 +15309,7 @@ var XRef = function XRefClosure() { _context2.prev = 4; _context2.t0 = _context2["catch"](0); - if (_context2.t0 instanceof _util.MissingDataException) { + if (_context2.t0 instanceof _core_utils.MissingDataException) { _context2.next = 8; break; } @@ -15234,7 +15681,7 @@ var ObjectLoader = function () { return this.capability.promise; }, _walk: function _walk(nodesToVisit) { - var _this2 = this; + var _this3 = this; var nodesToRevisit = []; var pendingRequests = []; @@ -15251,7 +15698,7 @@ var ObjectLoader = function () { this.refSet.put(currentNode); currentNode = this.xref.fetch(currentNode); } catch (ex) { - if (!(ex instanceof _util.MissingDataException)) { + if (!(ex instanceof _core_utils.MissingDataException)) { throw ex; } @@ -15293,11 +15740,11 @@ var ObjectLoader = function () { var node = nodesToRevisit[_i4]; if ((0, _primitives.isRef)(node)) { - _this2.refSet.remove(node); + _this3.refSet.remove(node); } } - _this2._walk(nodesToRevisit); + _this3._walk(nodesToRevisit); }, this.capability.reject); return; } @@ -15312,7 +15759,7 @@ var ObjectLoader = function () { exports.ObjectLoader = ObjectLoader; /***/ }), -/* 155 */ +/* 157 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -15321,312 +15768,29 @@ exports.ObjectLoader = ObjectLoader; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isEOF = isEOF; -exports.isCmd = isCmd; -exports.isDict = isDict; -exports.isName = isName; -exports.isRef = isRef; -exports.isRefsEqual = isRefsEqual; -exports.isStream = isStream; -exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = void 0; - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var EOF = {}; -exports.EOF = EOF; - -var Name = function NameClosure() { - function Name(name) { - this.name = name; - } - - Name.prototype = {}; - var nameCache = Object.create(null); - - Name.get = function Name_get(name) { - var nameValue = nameCache[name]; - return nameValue ? nameValue : nameCache[name] = new Name(name); - }; - - return Name; -}(); - -exports.Name = Name; - -var Cmd = function CmdClosure() { - function Cmd(cmd) { - this.cmd = cmd; - } - - Cmd.prototype = {}; - var cmdCache = Object.create(null); - - Cmd.get = function Cmd_get(cmd) { - var cmdValue = cmdCache[cmd]; - return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd); - }; - - return Cmd; -}(); - -exports.Cmd = Cmd; - -var Dict = function DictClosure() { - var nonSerializable = function nonSerializableClosure() { - return nonSerializable; - }; - - function Dict(xref) { - this._map = Object.create(null); - this.xref = xref; - this.objId = null; - this.suppressEncryption = false; - this.__nonSerializable__ = nonSerializable; - } - - Dict.prototype = { - assignXref: function Dict_assignXref(newXref) { - this.xref = newXref; - }, - get: function Dict_get(key1, key2, key3) { - var value; - var xref = this.xref, - suppressEncryption = this.suppressEncryption; - - if (typeof (value = this._map[key1]) !== 'undefined' || key1 in this._map || typeof key2 === 'undefined') { - return xref ? xref.fetchIfRef(value, suppressEncryption) : value; - } - - if (typeof (value = this._map[key2]) !== 'undefined' || key2 in this._map || typeof key3 === 'undefined') { - return xref ? xref.fetchIfRef(value, suppressEncryption) : value; - } - - value = this._map[key3] || null; - return xref ? xref.fetchIfRef(value, suppressEncryption) : value; - }, - getAsync: function Dict_getAsync(key1, key2, key3) { - var value; - var xref = this.xref, - suppressEncryption = this.suppressEncryption; - - if (typeof (value = this._map[key1]) !== 'undefined' || key1 in this._map || typeof key2 === 'undefined') { - if (xref) { - return xref.fetchIfRefAsync(value, suppressEncryption); - } - - return Promise.resolve(value); - } - - if (typeof (value = this._map[key2]) !== 'undefined' || key2 in this._map || typeof key3 === 'undefined') { - if (xref) { - return xref.fetchIfRefAsync(value, suppressEncryption); - } - - return Promise.resolve(value); - } - - value = this._map[key3] || null; - - if (xref) { - return xref.fetchIfRefAsync(value, suppressEncryption); - } - - return Promise.resolve(value); - }, - getArray: function Dict_getArray(key1, key2, key3) { - var value = this.get(key1, key2, key3); - var xref = this.xref, - suppressEncryption = this.suppressEncryption; - - if (!Array.isArray(value) || !xref) { - return value; - } - - value = value.slice(); - - for (var i = 0, ii = value.length; i < ii; i++) { - if (!isRef(value[i])) { - continue; - } - - value[i] = xref.fetch(value[i], suppressEncryption); - } - - return value; - }, - getRaw: function Dict_getRaw(key) { - return this._map[key]; - }, - getKeys: function Dict_getKeys() { - return Object.keys(this._map); - }, - set: function Dict_set(key, value) { - this._map[key] = value; - }, - has: function Dict_has(key) { - return key in this._map; - }, - forEach: function Dict_forEach(callback) { - for (var key in this._map) { - callback(key, this.get(key)); - } - } - }; - Dict.empty = new Dict(null); - - Dict.merge = function (xref, dictArray) { - var mergedDict = new Dict(xref); - - for (var i = 0, ii = dictArray.length; i < ii; i++) { - var dict = dictArray[i]; - - if (!isDict(dict)) { - continue; - } - - for (var keyName in dict._map) { - if (mergedDict._map[keyName] !== undefined) { - continue; - } - - mergedDict._map[keyName] = dict._map[keyName]; - } - } - - return mergedDict; - }; - - return Dict; -}(); - -exports.Dict = Dict; - -var Ref = function RefClosure() { - function Ref(num, gen) { - this.num = num; - this.gen = gen; - } - - Ref.prototype = { - toString: function Ref_toString() { - if (this.gen !== 0) { - return "".concat(this.num, "R").concat(this.gen); - } - - return "".concat(this.num, "R"); - } - }; - return Ref; -}(); - -exports.Ref = Ref; - -var RefSet = function RefSetClosure() { - function RefSet() { - this.dict = Object.create(null); - } - - RefSet.prototype = { - has: function RefSet_has(ref) { - return ref.toString() in this.dict; - }, - put: function RefSet_put(ref) { - this.dict[ref.toString()] = true; - }, - remove: function RefSet_remove(ref) { - delete this.dict[ref.toString()]; - } - }; - return RefSet; -}(); - -exports.RefSet = RefSet; - -var RefSetCache = function RefSetCacheClosure() { - function RefSetCache() { - this.dict = Object.create(null); - } - - RefSetCache.prototype = { - get: function RefSetCache_get(ref) { - return this.dict[ref.toString()]; - }, - has: function RefSetCache_has(ref) { - return ref.toString() in this.dict; - }, - put: function RefSetCache_put(ref, obj) { - this.dict[ref.toString()] = obj; - }, - putAlias: function RefSetCache_putAlias(ref, aliasRef) { - this.dict[ref.toString()] = this.get(aliasRef); - }, - forEach: function RefSetCache_forEach(fn, thisArg) { - for (var i in this.dict) { - fn.call(thisArg, this.dict[i]); - } - }, - clear: function RefSetCache_clear() { - this.dict = Object.create(null); - } - }; - return RefSetCache; -}(); - -exports.RefSetCache = RefSetCache; - -function isEOF(v) { - return v === EOF; -} - -function isName(v, name) { - return v instanceof Name && (name === undefined || v.name === name); -} - -function isCmd(v, cmd) { - return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); -} - -function isDict(v, type) { - return v instanceof Dict && (type === undefined || isName(v.get('Type'), type)); -} - -function isRef(v) { - return v instanceof Ref; -} - -function isRefsEqual(v1, v2) { - return v1.num === v2.num && v1.gen === v2.gen; -} - -function isStream(v) { - return _typeof(v) === 'object' && v !== null && v.getBytes !== undefined; -} +exports.Parser = exports.Linearization = exports.Lexer = void 0; -/***/ }), -/* 156 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +var _stream = __w_pdfjs_require__(158); -"use strict"; +var _util = __w_pdfjs_require__(5); +var _primitives = __w_pdfjs_require__(151); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Parser = exports.Linearization = exports.Lexer = void 0; +var _ccitt_stream = __w_pdfjs_require__(159); -var _stream = __w_pdfjs_require__(157); +var _jbig2_stream = __w_pdfjs_require__(161); -var _util = __w_pdfjs_require__(6); +var _jpeg_stream = __w_pdfjs_require__(164); -var _primitives = __w_pdfjs_require__(155); +var _jpx_stream = __w_pdfjs_require__(166); -var _ccitt_stream = __w_pdfjs_require__(158); +var _core_utils = __w_pdfjs_require__(154); -var _jbig2_stream = __w_pdfjs_require__(160); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var _jpeg_stream = __w_pdfjs_require__(163); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -var _jpx_stream = __w_pdfjs_require__(165); +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var MAX_LENGTH_TO_CACHE = 1000; var MAX_ADLER32_LENGTH = 5552; @@ -15644,22 +15808,36 @@ function computeAdler32(bytes) { return b % 65521 << 16 | a % 65521; } -var Parser = function ParserClosure() { - function Parser(lexer, allowStreams, xref, recoveryMode) { +var Parser = +/*#__PURE__*/ +function () { + function Parser(_ref) { + var lexer = _ref.lexer, + xref = _ref.xref, + _ref$allowStreams = _ref.allowStreams, + allowStreams = _ref$allowStreams === void 0 ? false : _ref$allowStreams, + _ref$recoveryMode = _ref.recoveryMode, + recoveryMode = _ref$recoveryMode === void 0 ? false : _ref$recoveryMode; + + _classCallCheck(this, Parser); + this.lexer = lexer; - this.allowStreams = allowStreams; this.xref = xref; - this.recoveryMode = recoveryMode || false; + this.allowStreams = allowStreams; + this.recoveryMode = recoveryMode; this.imageCache = Object.create(null); this.refill(); } - Parser.prototype = { - refill: function Parser_refill() { + _createClass(Parser, [{ + key: "refill", + value: function refill() { this.buf1 = this.lexer.getObj(); this.buf2 = this.lexer.getObj(); - }, - shift: function Parser_shift() { + } + }, { + key: "shift", + value: function shift() { if ((0, _primitives.isCmd)(this.buf2, 'ID')) { this.buf1 = this.buf2; this.buf2 = null; @@ -15667,20 +15845,24 @@ var Parser = function ParserClosure() { this.buf1 = this.buf2; this.buf2 = this.lexer.getObj(); } - }, - tryShift: function Parser_tryShift() { + } + }, { + key: "tryShift", + value: function tryShift() { try { this.shift(); return true; } catch (e) { - if (e instanceof _util.MissingDataException) { + if (e instanceof _core_utils.MissingDataException) { throw e; } return false; } - }, - getObj: function Parser_getObj(cipherTransform) { + } + }, { + key: "getObj", + value: function getObj(cipherTransform) { var buf1 = this.buf1; this.shift(); @@ -15751,7 +15933,8 @@ var Parser = function ParserClosure() { var num = buf1; if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, 'R')) { - var ref = new _primitives.Ref(num, this.buf1); + var ref = _primitives.Ref.get(num, this.buf1); + this.shift(); this.shift(); return ref; @@ -15771,8 +15954,10 @@ var Parser = function ParserClosure() { } return buf1; - }, - findDefaultInlineStreamEnd: function findDefaultInlineStreamEnd(stream) { + } + }, { + key: "findDefaultInlineStreamEnd", + value: function findDefaultInlineStreamEnd(stream) { var E = 0x45, I = 0x49, SPACE = 0x20, @@ -15838,8 +16023,10 @@ var Parser = function ParserClosure() { } return stream.pos - endOffset - startPos; - }, - findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) { + } + }, { + key: "findDCTDecodeInlineStreamEnd", + value: function findDCTDecodeInlineStreamEnd(stream) { var startPos = stream.pos, foundEOI = false, b, @@ -15927,8 +16114,10 @@ var Parser = function ParserClosure() { this.inlineStreamSkipEI(stream); return length; - }, - findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) { + } + }, { + key: "findASCII85DecodeInlineStreamEnd", + value: function findASCII85DecodeInlineStreamEnd(stream) { var TILDE = 0x7E, GT = 0x3E; var startPos = stream.pos, @@ -15936,9 +16125,18 @@ var Parser = function ParserClosure() { length; while ((ch = stream.getByte()) !== -1) { - if (ch === TILDE && stream.peekByte() === GT) { - stream.skip(); - break; + if (ch === TILDE) { + ch = stream.peekByte(); + + while ((0, _util.isSpace)(ch)) { + stream.skip(); + ch = stream.peekByte(); + } + + if (ch === GT) { + stream.skip(); + break; + } } } @@ -15952,8 +16150,10 @@ var Parser = function ParserClosure() { this.inlineStreamSkipEI(stream); return length; - }, - findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) { + } + }, { + key: "findASCIIHexDecodeInlineStreamEnd", + value: function findASCIIHexDecodeInlineStreamEnd(stream) { var GT = 0x3E; var startPos = stream.pos, ch, @@ -15975,8 +16175,10 @@ var Parser = function ParserClosure() { this.inlineStreamSkipEI(stream); return length; - }, - inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) { + } + }, { + key: "inlineStreamSkipEI", + value: function inlineStreamSkipEI(stream) { var E = 0x45, I = 0x49; var state = 0, @@ -15991,12 +16193,14 @@ var Parser = function ParserClosure() { break; } } - }, - makeInlineImage: function Parser_makeInlineImage(cipherTransform) { + } + }, { + key: "makeInlineImage", + value: function makeInlineImage(cipherTransform) { var lexer = this.lexer; var stream = lexer.stream; - var dict = new _primitives.Dict(this.xref), - dictLength; + var dict = new _primitives.Dict(this.xref); + var dictLength; while (!(0, _primitives.isCmd)(this.buf1, 'ID') && !(0, _primitives.isEOF)(this.buf1)) { if (!(0, _primitives.isName)(this.buf1)) { @@ -16017,8 +16221,8 @@ var Parser = function ParserClosure() { dictLength = stream.pos - lexer.beginInlineImagePos; } - var filter = dict.get('Filter', 'F'), - filterName; + var filter = dict.get('Filter', 'F'); + var filterName; if ((0, _primitives.isName)(filter)) { filterName = filter.name; @@ -16030,8 +16234,8 @@ var Parser = function ParserClosure() { } } - var startPos = stream.pos, - length; + var startPos = stream.pos; + var length; if (filterName === 'DCTDecode' || filterName === 'DCT') { length = this.findDCTDecodeInlineStreamEnd(stream); @@ -16072,15 +16276,17 @@ var Parser = function ParserClosure() { imageStream.dict = dict; if (cacheKey !== undefined) { - imageStream.cacheKey = 'inline_' + length + '_' + cacheKey; + imageStream.cacheKey = "inline_".concat(length, "_").concat(cacheKey); this.imageCache[cacheKey] = imageStream; } this.buf2 = _primitives.Cmd.get('EI'); this.shift(); return imageStream; - }, - _findStreamLength: function _findStreamLength(startPos, signature) { + } + }, { + key: "_findStreamLength", + value: function _findStreamLength(startPos, signature) { var stream = this.lexer.stream; stream.pos = startPos; var SCAN_BLOCK_LENGTH = 2048; @@ -16115,8 +16321,10 @@ var Parser = function ParserClosure() { } return -1; - }, - makeStream: function Parser_makeStream(dict, cipherTransform) { + } + }, { + key: "makeStream", + value: function makeStream(dict, cipherTransform) { var lexer = this.lexer; var stream = lexer.stream; lexer.skipToNextLine(); @@ -16124,7 +16332,7 @@ var Parser = function ParserClosure() { var length = dict.get('Length'); if (!Number.isInteger(length)) { - (0, _util.info)('Bad ' + length + ' attribute in stream'); + (0, _util.info)("Bad length \"".concat(length, "\" in stream")); length = 0; } @@ -16181,8 +16389,10 @@ var Parser = function ParserClosure() { stream = this.filter(stream, dict, length); stream.dict = dict; return stream; - }, - filter: function Parser_filter(stream, dict, length) { + } + }, { + key: "filter", + value: function filter(stream, dict, length) { var filter = dict.get('Filter', 'F'); var params = dict.get('DecodeParms', 'DP'); @@ -16204,7 +16414,7 @@ var Parser = function ParserClosure() { filter = this.xref.fetchIfRef(filterArray[i]); if (!(0, _primitives.isName)(filter)) { - throw new _util.FormatError('Bad filter name: ' + filter); + throw new _util.FormatError("Bad filter name \"".concat(filter, "\"")); } params = null; @@ -16219,10 +16429,12 @@ var Parser = function ParserClosure() { } return stream; - }, - makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) { + } + }, { + key: "makeFilter", + value: function makeFilter(stream, name, maybeLength, params) { if (maybeLength === 0) { - (0, _util.warn)('Empty "' + name + '" stream.'); + (0, _util.warn)("Empty \"".concat(name, "\" stream.")); return new _stream.NullStream(); } @@ -16289,54 +16501,65 @@ var Parser = function ParserClosure() { return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params); } - (0, _util.warn)('filter "' + name + '" not supported yet'); + (0, _util.warn)("Filter \"".concat(name, "\" is not supported.")); return stream; } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } - (0, _util.warn)('Invalid stream: \"' + ex + '\"'); + (0, _util.warn)("Invalid stream: \"".concat(ex, "\"")); return new _stream.NullStream(); } } - }; + }]); + return Parser; }(); exports.Parser = Parser; +var specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; -var Lexer = function LexerClosure() { - function Lexer(stream, knownCommands) { - this.stream = stream; - this.nextChar(); - this.strBuf = []; - this.knownCommands = knownCommands; - this.beginInlineImagePos = -1; +function toHexDigit(ch) { + if (ch >= 0x30 && ch <= 0x39) { + return ch & 0x0F; } - var specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { + return (ch & 0x0F) + 9; + } - function toHexDigit(ch) { - if (ch >= 0x30 && ch <= 0x39) { - return ch & 0x0F; - } + return -1; +} - if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { - return (ch & 0x0F) + 9; - } +var Lexer = +/*#__PURE__*/ +function () { + function Lexer(stream) { + var knownCommands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + _classCallCheck(this, Lexer); - return -1; + this.stream = stream; + this.nextChar(); + this.strBuf = []; + this.knownCommands = knownCommands; + this.beginInlineImagePos = -1; } - Lexer.prototype = { - nextChar: function Lexer_nextChar() { + _createClass(Lexer, [{ + key: "nextChar", + value: function nextChar() { return this.currentChar = this.stream.getByte(); - }, - peekChar: function Lexer_peekChar() { + } + }, { + key: "peekChar", + value: function peekChar() { return this.stream.peekByte(); - }, - getNumber: function Lexer_getNumber() { + } + }, { + key: "getNumber", + value: function getNumber() { var ch = this.currentChar; var eNotation = false; var divideBy = 0; @@ -16399,7 +16622,7 @@ var Lexer = function LexerClosure() { break; } } else if (ch === 0x2D) { - (0, _util.warn)('Badly formatted number'); + (0, _util.warn)('Badly formatted number: minus sign in the middle'); } else if (ch === 0x45 || ch === 0x65) { ch = this.peekChar(); @@ -16425,8 +16648,10 @@ var Lexer = function LexerClosure() { } return sign * baseValue; - }, - getString: function Lexer_getString() { + } + }, { + key: "getString", + value: function getString() { var numParen = 1; var done = false; var strBuf = this.strBuf; @@ -16549,8 +16774,10 @@ var Lexer = function LexerClosure() { } return strBuf.join(''); - }, - getName: function Lexer_getName() { + } + }, { + key: "getName", + value: function getName() { var ch, previousCh; var strBuf = this.strBuf; strBuf.length = 0; @@ -16573,7 +16800,7 @@ var Lexer = function LexerClosure() { var x2 = toHexDigit(ch); if (x2 === -1) { - (0, _util.warn)('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.'); + (0, _util.warn)("Lexer_getName: Illegal digit (".concat(String.fromCharCode(ch), ") ") + 'in hexadecimal number.'); strBuf.push('#', String.fromCharCode(previousCh)); if (specialChars[ch]) { @@ -16594,18 +16821,19 @@ var Lexer = function LexerClosure() { } if (strBuf.length > 127) { - (0, _util.warn)('name token is longer than allowed by the spec: ' + strBuf.length); + (0, _util.warn)("Name token is longer than allowed by the spec: ".concat(strBuf.length)); } return _primitives.Name.get(strBuf.join('')); - }, - getHexString: function Lexer_getHexString() { + } + }, { + key: "getHexString", + value: function getHexString() { var strBuf = this.strBuf; strBuf.length = 0; var ch = this.currentChar; var isFirstHex = true; - var firstDigit; - var secondDigit; + var firstDigit, secondDigit; while (true) { if (ch < 0) { @@ -16622,7 +16850,7 @@ var Lexer = function LexerClosure() { firstDigit = toHexDigit(ch); if (firstDigit === -1) { - (0, _util.warn)('Ignoring invalid character "' + ch + '" in hex string'); + (0, _util.warn)("Ignoring invalid character \"".concat(ch, "\" in hex string")); ch = this.nextChar(); continue; } @@ -16630,7 +16858,7 @@ var Lexer = function LexerClosure() { secondDigit = toHexDigit(ch); if (secondDigit === -1) { - (0, _util.warn)('Ignoring invalid character "' + ch + '" in hex string'); + (0, _util.warn)("Ignoring invalid character \"".concat(ch, "\" in hex string")); ch = this.nextChar(); continue; } @@ -16644,8 +16872,10 @@ var Lexer = function LexerClosure() { } return strBuf.join(''); - }, - getObj: function Lexer_getObj() { + } + }, { + key: "getObj", + value: function getObj() { var comment = false; var ch = this.currentChar; @@ -16766,8 +16996,10 @@ var Lexer = function LexerClosure() { } return _primitives.Cmd.get(str); - }, - skipToNextLine: function Lexer_skipToNextLine() { + } + }, { + key: "skipToNextLine", + value: function skipToNextLine() { var ch = this.currentChar; while (ch >= 0) { @@ -16787,69 +17019,88 @@ var Lexer = function LexerClosure() { ch = this.nextChar(); } } - }; + }]); + return Lexer; }(); exports.Lexer = Lexer; -var Linearization = { - create: function LinearizationCreate(stream) { - function getInt(name, allowZeroValue) { - var obj = linDict.get(name); - if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { - return obj; +var Linearization = +/*#__PURE__*/ +function () { + function Linearization() { + _classCallCheck(this, Linearization); + } + + _createClass(Linearization, null, [{ + key: "create", + value: function create(stream) { + function getInt(linDict, name) { + var allowZeroValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var obj = linDict.get(name); + + if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { + return obj; + } + + throw new Error("The \"".concat(name, "\" parameter in the linearization ") + 'dictionary is invalid.'); } - throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.'); - } + function getHints(linDict) { + var hints = linDict.get('H'); + var hintsLength; - function getHints() { - var hints = linDict.get('H'), - hintsLength, - item; + if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { + for (var index = 0; index < hintsLength; index++) { + var hint = hints[index]; - if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { - for (var index = 0; index < hintsLength; index++) { - if (!(Number.isInteger(item = hints[index]) && item > 0)) { - throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.'); + if (!(Number.isInteger(hint) && hint > 0)) { + throw new Error("Hint (".concat(index, ") in the linearization dictionary ") + 'is invalid.'); + } } + + return hints; } - return hints; + throw new Error('Hint array in the linearization dictionary is invalid.'); } - throw new Error('Hint array in the linearization dictionary is invalid.'); - } + var parser = new Parser({ + lexer: new Lexer(stream), + xref: null + }); + var obj1 = parser.getObj(); + var obj2 = parser.getObj(); + var obj3 = parser.getObj(); + var linDict = parser.getObj(); + var obj, length; - var parser = new Parser(new Lexer(stream), false, null); - var obj1 = parser.getObj(); - var obj2 = parser.getObj(); - var obj3 = parser.getObj(); - var linDict = parser.getObj(); - var obj, length; + if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, 'obj') && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get('Linearized')) && obj > 0)) { + return null; + } else if ((length = getInt(linDict, 'L')) !== stream.length) { + throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.'); + } - if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, 'obj') && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get('Linearized')) && obj > 0)) { - return null; - } else if ((length = getInt('L')) !== stream.length) { - throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.'); + return { + length: length, + hints: getHints(linDict), + objectNumberFirst: getInt(linDict, 'O'), + endFirst: getInt(linDict, 'E'), + numPages: getInt(linDict, 'N'), + mainXRefEntriesOffset: getInt(linDict, 'T'), + pageFirst: linDict.has('P') ? getInt(linDict, 'P', true) : 0 + }; } + }]); + + return Linearization; +}(); - return { - length: length, - hints: getHints(), - objectNumberFirst: getInt('O'), - endFirst: getInt('E'), - numPages: getInt('N'), - mainXRefEntriesOffset: getInt('T'), - pageFirst: linDict.has('P') ? getInt('P', true) : 0 - }; - } -}; exports.Linearization = Linearization; /***/ }), -/* 157 */ +/* 158 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -16860,9 +17111,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } @@ -18131,7 +18382,7 @@ var NullStream = function NullStreamClosure() { exports.NullStream = NullStream; /***/ }), -/* 158 */ +/* 159 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -18142,11 +18393,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.CCITTFaxStream = void 0; -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); -var _ccitt = __w_pdfjs_require__(159); +var _ccitt = __w_pdfjs_require__(160); -var _stream = __w_pdfjs_require__(157); +var _stream = __w_pdfjs_require__(158); var CCITTFaxStream = function CCITTFaxStreamClosure() { function CCITTFaxStream(str, maybeLength, params) { @@ -18197,7 +18448,7 @@ var CCITTFaxStream = function CCITTFaxStreamClosure() { exports.CCITTFaxStream = CCITTFaxStream; /***/ }), -/* 159 */ +/* 160 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -18208,7 +18459,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.CCITTFaxDecoder = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); var CCITTFaxDecoder = function CCITTFaxDecoder() { var ccittEOL = -2; @@ -18895,7 +19146,7 @@ var CCITTFaxDecoder = function CCITTFaxDecoder() { exports.CCITTFaxDecoder = CCITTFaxDecoder; /***/ }), -/* 160 */ +/* 161 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -18906,13 +19157,13 @@ Object.defineProperty(exports, "__esModule", { }); exports.Jbig2Stream = void 0; -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); -var _stream = __w_pdfjs_require__(157); +var _stream = __w_pdfjs_require__(158); -var _jbig = __w_pdfjs_require__(161); +var _jbig = __w_pdfjs_require__(162); -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); var Jbig2Stream = function Jbig2StreamClosure() { function Jbig2Stream(stream, maybeLength, dict, params) { @@ -18978,7 +19229,7 @@ var Jbig2Stream = function Jbig2StreamClosure() { exports.Jbig2Stream = Jbig2Stream; /***/ }), -/* 161 */ +/* 162 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -18989,11 +19240,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.Jbig2Image = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _arithmetic_decoder = __w_pdfjs_require__(162); +var _arithmetic_decoder = __w_pdfjs_require__(163); -var _ccitt = __w_pdfjs_require__(159); +var _ccitt = __w_pdfjs_require__(160); var Jbig2Error = function Jbig2ErrorClosure() { function Jbig2Error(msg) { @@ -21177,7 +21428,7 @@ var Jbig2Image = function Jbig2ImageClosure() { exports.Jbig2Image = Jbig2Image; /***/ }), -/* 162 */ +/* 163 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -21547,7 +21798,7 @@ function () { exports.ArithmeticDecoder = ArithmeticDecoder; /***/ }), -/* 163 */ +/* 164 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -21558,13 +21809,13 @@ Object.defineProperty(exports, "__esModule", { }); exports.JpegStream = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _stream = __w_pdfjs_require__(157); +var _stream = __w_pdfjs_require__(158); -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); -var _jpg = __w_pdfjs_require__(164); +var _jpg = __w_pdfjs_require__(165); var JpegStream = function JpegStreamClosure() { function JpegStream(stream, maybeLength, dict, params) { @@ -21659,7 +21910,7 @@ var JpegStream = function JpegStreamClosure() { exports.JpegStream = JpegStream; /***/ }), -/* 164 */ +/* 165 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -21670,7 +21921,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.JpegImage = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -22660,6 +22911,7 @@ var JpegImage = function JpegImageClosure() { } this.numComponents = this.components.length; + return undefined; }, _getLinearizedBlockData: function _getLinearizedBlockData(width, height) { var isSourcePDF = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; @@ -22848,7 +23100,7 @@ var JpegImage = function JpegImageClosure() { exports.JpegImage = JpegImage; /***/ }), -/* 165 */ +/* 166 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -22859,11 +23111,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.JpxStream = void 0; -var _stream = __w_pdfjs_require__(157); +var _stream = __w_pdfjs_require__(158); -var _jpx = __w_pdfjs_require__(166); +var _jpx = __w_pdfjs_require__(167); -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); var JpxStream = function JpxStreamClosure() { function JpxStream(stream, maybeLength, dict, params) { @@ -22935,7 +23187,7 @@ var JpxStream = function JpxStreamClosure() { exports.JpxStream = JpxStream; /***/ }), -/* 166 */ +/* 167 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -22946,9 +23198,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.JpxImage = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _arithmetic_decoder = __w_pdfjs_require__(162); +var _arithmetic_decoder = __w_pdfjs_require__(163); var JpxError = function JpxErrorClosure() { function JpxError(msg) { @@ -25253,7 +25505,7 @@ var JpxImage = function JpxImageClosure() { exports.JpxImage = JpxImage; /***/ }), -/* 167 */ +/* 168 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -25264,11 +25516,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); -var _stream = __w_pdfjs_require__(157); +var _stream = __w_pdfjs_require__(158); function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -26901,7 +27153,7 @@ var CipherTransformFactory = function CipherTransformFactoryClosure() { exports.CipherTransformFactory = CipherTransformFactory; /***/ }), -/* 168 */ +/* 169 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -26912,9 +27164,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.ColorSpace = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -28111,7 +28363,7 @@ var LabCS = function LabCSClosure() { }(); /***/ }), -/* 169 */ +/* 170 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -28120,19 +28372,25 @@ var LabCS = function LabCSClosure() { Object.defineProperty(exports, "__esModule", { value: true }); -exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0; +exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _obj = __w_pdfjs_require__(154); +var _obj = __w_pdfjs_require__(156); -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); -var _colorspace = __w_pdfjs_require__(168); +var _colorspace = __w_pdfjs_require__(169); -var _operator_list = __w_pdfjs_require__(170); +var _core_utils = __w_pdfjs_require__(154); -var _stream = __w_pdfjs_require__(157); +var _operator_list = __w_pdfjs_require__(171); + +var _stream = __w_pdfjs_require__(158); + +function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -28140,10 +28398,6 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } - -function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } @@ -28174,16 +28428,15 @@ function () { var dict = xref.fetchIfRef(ref); if (!(0, _primitives.isDict)(dict)) { - return; + return undefined; } - var id = (0, _primitives.isRef)(ref) ? ref.toString() : 'annot_' + idFactory.createObjId(); + var id = (0, _primitives.isRef)(ref) ? ref.toString() : "annot_".concat(idFactory.createObjId()); var subtype = dict.get('Subtype'); subtype = (0, _primitives.isName)(subtype) ? subtype.name : null; var parameters = { xref: xref, dict: dict, - ref: (0, _primitives.isRef)(ref) ? ref : null, subtype: subtype, id: id, pdfManager: pdfManager @@ -28197,7 +28450,7 @@ function () { return new TextAnnotation(parameters); case 'Widget': - var fieldType = (0, _util.getInheritableProperty)({ + var fieldType = (0, _core_utils.getInheritableProperty)({ dict: dict, key: 'FT' }); @@ -28220,6 +28473,9 @@ function () { case 'Popup': return new PopupAnnotation(parameters); + case 'FreeText': + return new FreeTextAnnotation(parameters); + case 'Line': return new LineAnnotation(parameters); @@ -28235,6 +28491,9 @@ function () { case 'Polygon': return new PolygonAnnotation(parameters); + case 'Caret': + return new CaretAnnotation(parameters); + case 'Ink': return new InkAnnotation(parameters); @@ -28297,6 +28556,8 @@ function () { _classCallCheck(this, Annotation); var dict = params.dict; + this.setContents(dict.get('Contents')); + this.setModificationDate(dict.get('M')); this.setFlags(dict.get('F')); this.setRectangle(dict.getArray('Rect')); this.setColor(dict.getArray('C')); @@ -28306,8 +28567,10 @@ function () { annotationFlags: this.flags, borderStyle: this.borderStyle, color: this.color, + contents: this.contents, hasAppearance: !!this.appearance, id: params.id, + modificationDate: this.modificationDate, rect: this.rectangle, subtype: params.subtype }; @@ -28328,6 +28591,16 @@ function () { value: function _isPrintable(flags) { return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN); } + }, { + key: "setContents", + value: function setContents(contents) { + this.contents = (0, _util.stringToPDFString)(contents || ''); + } + }, { + key: "setModificationDate", + value: function setModificationDate(modificationDate) { + this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null; + } }, { key: "setFlags", value: function setFlags(flags) { @@ -28399,7 +28672,7 @@ function () { var dictType = dict.get('Type'); if (!dictType || (0, _primitives.isName)(dictType, 'Border')) { - this.borderStyle.setWidth(dict.get('W')); + this.borderStyle.setWidth(dict.get('W'), this.rectangle); this.borderStyle.setStyle(dict.get('S')); this.borderStyle.setDashArray(dict.getArray('D')); } @@ -28409,7 +28682,7 @@ function () { if (Array.isArray(array) && array.length >= 3) { this.borderStyle.setHorizontalCornerRadius(array[0]); this.borderStyle.setVerticalCornerRadius(array[1]); - this.borderStyle.setWidth(array[2]); + this.borderStyle.setWidth(array[2], this.rectangle); if (array.length === 4) { this.borderStyle.setDashArray(array[3]); @@ -28448,23 +28721,12 @@ function () { this.appearance = normalAppearanceState.get(as.name); } - }, { - key: "_preparePopup", - value: function _preparePopup(dict) { - if (!dict.has('C')) { - this.data.color = null; - } - - this.data.hasPopup = dict.has('Popup'); - this.data.title = (0, _util.stringToPDFString)(dict.get('T') || ''); - this.data.contents = (0, _util.stringToPDFString)(dict.get('Contents') || ''); - } }, { key: "loadResources", value: function loadResources(keys) { return this.appearance.dict.getAsync('Resources').then(function (resources) { if (!resources) { - return; + return undefined; } var objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref); @@ -28546,12 +28808,24 @@ function () { _createClass(AnnotationBorderStyle, [{ key: "setWidth", value: function setWidth(width) { + var rect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0]; + if ((0, _primitives.isName)(width)) { this.width = 0; return; } if (Number.isInteger(width)) { + if (width > 0) { + var maxWidth = (rect[2] - rect[0]) / 2; + var maxHeight = (rect[3] - rect[1]) / 2; + + if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) { + (0, _util.warn)("AnnotationBorderStyle.setWidth - ignoring width: ".concat(width)); + width = 1; + } + } + this.width = width; } } @@ -28636,41 +28910,78 @@ function () { exports.AnnotationBorderStyle = AnnotationBorderStyle; -var WidgetAnnotation = +var MarkupAnnotation = /*#__PURE__*/ function (_Annotation) { - _inherits(WidgetAnnotation, _Annotation); + _inherits(MarkupAnnotation, _Annotation); - function WidgetAnnotation(params) { + function MarkupAnnotation(parameters) { var _this2; + _classCallCheck(this, MarkupAnnotation); + + _this2 = _possibleConstructorReturn(this, _getPrototypeOf(MarkupAnnotation).call(this, parameters)); + var dict = parameters.dict; + + if (!dict.has('C')) { + _this2.data.color = null; + } + + _this2.setCreationDate(dict.get('CreationDate')); + + _this2.data.creationDate = _this2.creationDate; + _this2.data.hasPopup = dict.has('Popup'); + _this2.data.title = (0, _util.stringToPDFString)(dict.get('T') || ''); + return _this2; + } + + _createClass(MarkupAnnotation, [{ + key: "setCreationDate", + value: function setCreationDate(creationDate) { + this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null; + } + }]); + + return MarkupAnnotation; +}(Annotation); + +exports.MarkupAnnotation = MarkupAnnotation; + +var WidgetAnnotation = +/*#__PURE__*/ +function (_Annotation2) { + _inherits(WidgetAnnotation, _Annotation2); + + function WidgetAnnotation(params) { + var _this3; + _classCallCheck(this, WidgetAnnotation); - _this2 = _possibleConstructorReturn(this, _getPrototypeOf(WidgetAnnotation).call(this, params)); + _this3 = _possibleConstructorReturn(this, _getPrototypeOf(WidgetAnnotation).call(this, params)); var dict = params.dict; - var data = _this2.data; + var data = _this3.data; data.annotationType = _util.AnnotationType.WIDGET; - data.fieldName = _this2._constructFieldName(dict); - data.fieldValue = (0, _util.getInheritableProperty)({ + data.fieldName = _this3._constructFieldName(dict); + data.fieldValue = (0, _core_utils.getInheritableProperty)({ dict: dict, key: 'V', getArray: true }); data.alternativeText = (0, _util.stringToPDFString)(dict.get('TU') || ''); - data.defaultAppearance = (0, _util.getInheritableProperty)({ + data.defaultAppearance = (0, _core_utils.getInheritableProperty)({ dict: dict, key: 'DA' }) || ''; - var fieldType = (0, _util.getInheritableProperty)({ + var fieldType = (0, _core_utils.getInheritableProperty)({ dict: dict, key: 'FT' }); data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null; - _this2.fieldResources = (0, _util.getInheritableProperty)({ + _this3.fieldResources = (0, _core_utils.getInheritableProperty)({ dict: dict, key: 'DR' }) || _primitives.Dict.empty; - data.fieldFlags = (0, _util.getInheritableProperty)({ + data.fieldFlags = (0, _core_utils.getInheritableProperty)({ dict: dict, key: 'Ff' }); @@ -28679,15 +28990,15 @@ function (_Annotation) { data.fieldFlags = 0; } - data.readOnly = _this2.hasFieldFlag(_util.AnnotationFieldFlag.READONLY); + data.readOnly = _this3.hasFieldFlag(_util.AnnotationFieldFlag.READONLY); if (data.fieldType === 'Sig') { data.fieldValue = null; - _this2.setFlags(_util.AnnotationFlag.HIDDEN); + _this3.setFlags(_util.AnnotationFlag.HIDDEN); } - return _this2; + return _this3; } _createClass(WidgetAnnotation, [{ @@ -28749,14 +29060,14 @@ function (_WidgetAnnotation) { _inherits(TextWidgetAnnotation, _WidgetAnnotation); function TextWidgetAnnotation(params) { - var _this3; + var _this4; _classCallCheck(this, TextWidgetAnnotation); - _this3 = _possibleConstructorReturn(this, _getPrototypeOf(TextWidgetAnnotation).call(this, params)); + _this4 = _possibleConstructorReturn(this, _getPrototypeOf(TextWidgetAnnotation).call(this, params)); var dict = params.dict; - _this3.data.fieldValue = (0, _util.stringToPDFString)(_this3.data.fieldValue || ''); - var alignment = (0, _util.getInheritableProperty)({ + _this4.data.fieldValue = (0, _util.stringToPDFString)(_this4.data.fieldValue || ''); + var alignment = (0, _core_utils.getInheritableProperty)({ dict: dict, key: 'Q' }); @@ -28765,8 +29076,8 @@ function (_WidgetAnnotation) { alignment = null; } - _this3.data.textAlignment = alignment; - var maximumLength = (0, _util.getInheritableProperty)({ + _this4.data.textAlignment = alignment; + var maximumLength = (0, _core_utils.getInheritableProperty)({ dict: dict, key: 'MaxLen' }); @@ -28775,10 +29086,10 @@ function (_WidgetAnnotation) { maximumLength = null; } - _this3.data.maxLen = maximumLength; - _this3.data.multiLine = _this3.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE); - _this3.data.comb = _this3.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !_this3.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !_this3.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !_this3.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && _this3.data.maxLen !== null; - return _this3; + _this4.data.maxLen = maximumLength; + _this4.data.multiLine = _this4.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE); + _this4.data.comb = _this4.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && _this4.data.maxLen !== null; + return _this4; } _createClass(TextWidgetAnnotation, [{ @@ -28815,26 +29126,26 @@ function (_WidgetAnnotation2) { _inherits(ButtonWidgetAnnotation, _WidgetAnnotation2); function ButtonWidgetAnnotation(params) { - var _this4; + var _this5; _classCallCheck(this, ButtonWidgetAnnotation); - _this4 = _possibleConstructorReturn(this, _getPrototypeOf(ButtonWidgetAnnotation).call(this, params)); - _this4.data.checkBox = !_this4.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); - _this4.data.radioButton = _this4.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); - _this4.data.pushButton = _this4.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); - - if (_this4.data.checkBox) { - _this4._processCheckBox(params); - } else if (_this4.data.radioButton) { - _this4._processRadioButton(params); - } else if (_this4.data.pushButton) { - _this4._processPushButton(params); + _this5 = _possibleConstructorReturn(this, _getPrototypeOf(ButtonWidgetAnnotation).call(this, params)); + _this5.data.checkBox = !_this5.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); + _this5.data.radioButton = _this5.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); + _this5.data.pushButton = _this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); + + if (_this5.data.checkBox) { + _this5._processCheckBox(params); + } else if (_this5.data.radioButton) { + _this5._processRadioButton(params); + } else if (_this5.data.pushButton) { + _this5._processPushButton(params); } else { (0, _util.warn)('Invalid field flags for button widget annotation'); } - return _this4; + return _this5; } _createClass(ButtonWidgetAnnotation, [{ @@ -28925,13 +29236,13 @@ function (_WidgetAnnotation3) { _inherits(ChoiceWidgetAnnotation, _WidgetAnnotation3); function ChoiceWidgetAnnotation(params) { - var _this5; + var _this6; _classCallCheck(this, ChoiceWidgetAnnotation); - _this5 = _possibleConstructorReturn(this, _getPrototypeOf(ChoiceWidgetAnnotation).call(this, params)); - _this5.data.options = []; - var options = (0, _util.getInheritableProperty)({ + _this6 = _possibleConstructorReturn(this, _getPrototypeOf(ChoiceWidgetAnnotation).call(this, params)); + _this6.data.options = []; + var options = (0, _core_utils.getInheritableProperty)({ dict: params.dict, key: 'Opt' }); @@ -28942,20 +29253,20 @@ function (_WidgetAnnotation3) { for (var i = 0, ii = options.length; i < ii; i++) { var option = xref.fetchIfRef(options[i]); var isOptionArray = Array.isArray(option); - _this5.data.options[i] = { + _this6.data.options[i] = { exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option, displayValue: (0, _util.stringToPDFString)(isOptionArray ? xref.fetchIfRef(option[1]) : option) }; } } - if (!Array.isArray(_this5.data.fieldValue)) { - _this5.data.fieldValue = [_this5.data.fieldValue]; + if (!Array.isArray(_this6.data.fieldValue)) { + _this6.data.fieldValue = [_this6.data.fieldValue]; } - _this5.data.combo = _this5.hasFieldFlag(_util.AnnotationFieldFlag.COMBO); - _this5.data.multiSelect = _this5.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT); - return _this5; + _this6.data.combo = _this6.hasFieldFlag(_util.AnnotationFieldFlag.COMBO); + _this6.data.multiSelect = _this6.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT); + return _this6; } return ChoiceWidgetAnnotation; @@ -28963,33 +29274,31 @@ function (_WidgetAnnotation3) { var TextAnnotation = /*#__PURE__*/ -function (_Annotation2) { - _inherits(TextAnnotation, _Annotation2); +function (_MarkupAnnotation) { + _inherits(TextAnnotation, _MarkupAnnotation); function TextAnnotation(parameters) { - var _this6; + var _this7; _classCallCheck(this, TextAnnotation); var DEFAULT_ICON_SIZE = 22; - _this6 = _possibleConstructorReturn(this, _getPrototypeOf(TextAnnotation).call(this, parameters)); - _this6.data.annotationType = _util.AnnotationType.TEXT; + _this7 = _possibleConstructorReturn(this, _getPrototypeOf(TextAnnotation).call(this, parameters)); + _this7.data.annotationType = _util.AnnotationType.TEXT; - if (_this6.data.hasAppearance) { - _this6.data.name = 'NoIcon'; + if (_this7.data.hasAppearance) { + _this7.data.name = 'NoIcon'; } else { - _this6.data.rect[1] = _this6.data.rect[3] - DEFAULT_ICON_SIZE; - _this6.data.rect[2] = _this6.data.rect[0] + DEFAULT_ICON_SIZE; - _this6.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note'; + _this7.data.rect[1] = _this7.data.rect[3] - DEFAULT_ICON_SIZE; + _this7.data.rect[2] = _this7.data.rect[0] + DEFAULT_ICON_SIZE; + _this7.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note'; } - _this6._preparePopup(parameters.dict); - - return _this6; + return _this7; } return TextAnnotation; -}(Annotation); +}(MarkupAnnotation); var LinkAnnotation = /*#__PURE__*/ @@ -28997,20 +29306,20 @@ function (_Annotation3) { _inherits(LinkAnnotation, _Annotation3); function LinkAnnotation(params) { - var _this7; + var _this8; _classCallCheck(this, LinkAnnotation); - _this7 = _possibleConstructorReturn(this, _getPrototypeOf(LinkAnnotation).call(this, params)); - _this7.data.annotationType = _util.AnnotationType.LINK; + _this8 = _possibleConstructorReturn(this, _getPrototypeOf(LinkAnnotation).call(this, params)); + _this8.data.annotationType = _util.AnnotationType.LINK; _obj.Catalog.parseDestDictionary({ destDict: params.dict, - resultObj: _this7.data, + resultObj: _this8.data, docBaseUrl: params.pdfManager.docBaseUrl }); - return _this7; + return _this8; } return LinkAnnotation; @@ -29022,143 +29331,158 @@ function (_Annotation4) { _inherits(PopupAnnotation, _Annotation4); function PopupAnnotation(parameters) { - var _this8; + var _this9; _classCallCheck(this, PopupAnnotation); - _this8 = _possibleConstructorReturn(this, _getPrototypeOf(PopupAnnotation).call(this, parameters)); - _this8.data.annotationType = _util.AnnotationType.POPUP; + _this9 = _possibleConstructorReturn(this, _getPrototypeOf(PopupAnnotation).call(this, parameters)); + _this9.data.annotationType = _util.AnnotationType.POPUP; var dict = parameters.dict; var parentItem = dict.get('Parent'); if (!parentItem) { (0, _util.warn)('Popup annotation has a missing or invalid parent annotation.'); - return _possibleConstructorReturn(_this8); + return _possibleConstructorReturn(_this9); } var parentSubtype = parentItem.get('Subtype'); - _this8.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null; - _this8.data.parentId = dict.getRaw('Parent').toString(); - _this8.data.title = (0, _util.stringToPDFString)(parentItem.get('T') || ''); - _this8.data.contents = (0, _util.stringToPDFString)(parentItem.get('Contents') || ''); + _this9.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null; + _this9.data.parentId = dict.getRaw('Parent').toString(); + _this9.data.title = (0, _util.stringToPDFString)(parentItem.get('T') || ''); + _this9.data.contents = (0, _util.stringToPDFString)(parentItem.get('Contents') || ''); + + if (!parentItem.has('M')) { + _this9.data.modificationDate = null; + } else { + _this9.setModificationDate(parentItem.get('M')); + + _this9.data.modificationDate = _this9.modificationDate; + } if (!parentItem.has('C')) { - _this8.data.color = null; + _this9.data.color = null; } else { - _this8.setColor(parentItem.getArray('C')); + _this9.setColor(parentItem.getArray('C')); - _this8.data.color = _this8.color; + _this9.data.color = _this9.color; } - if (!_this8.viewable) { + if (!_this9.viewable) { var parentFlags = parentItem.get('F'); - if (_this8._isViewable(parentFlags)) { - _this8.setFlags(parentFlags); + if (_this9._isViewable(parentFlags)) { + _this9.setFlags(parentFlags); } } - return _this8; + return _this9; } return PopupAnnotation; }(Annotation); +var FreeTextAnnotation = +/*#__PURE__*/ +function (_MarkupAnnotation2) { + _inherits(FreeTextAnnotation, _MarkupAnnotation2); + + function FreeTextAnnotation(parameters) { + var _this10; + + _classCallCheck(this, FreeTextAnnotation); + + _this10 = _possibleConstructorReturn(this, _getPrototypeOf(FreeTextAnnotation).call(this, parameters)); + _this10.data.annotationType = _util.AnnotationType.FREETEXT; + return _this10; + } + + return FreeTextAnnotation; +}(MarkupAnnotation); + var LineAnnotation = /*#__PURE__*/ -function (_Annotation5) { - _inherits(LineAnnotation, _Annotation5); +function (_MarkupAnnotation3) { + _inherits(LineAnnotation, _MarkupAnnotation3); function LineAnnotation(parameters) { - var _this9; + var _this11; _classCallCheck(this, LineAnnotation); - _this9 = _possibleConstructorReturn(this, _getPrototypeOf(LineAnnotation).call(this, parameters)); - _this9.data.annotationType = _util.AnnotationType.LINE; + _this11 = _possibleConstructorReturn(this, _getPrototypeOf(LineAnnotation).call(this, parameters)); + _this11.data.annotationType = _util.AnnotationType.LINE; var dict = parameters.dict; - _this9.data.lineCoordinates = _util.Util.normalizeRect(dict.getArray('L')); - - _this9._preparePopup(dict); - - return _this9; + _this11.data.lineCoordinates = _util.Util.normalizeRect(dict.getArray('L')); + return _this11; } return LineAnnotation; -}(Annotation); +}(MarkupAnnotation); var SquareAnnotation = /*#__PURE__*/ -function (_Annotation6) { - _inherits(SquareAnnotation, _Annotation6); +function (_MarkupAnnotation4) { + _inherits(SquareAnnotation, _MarkupAnnotation4); function SquareAnnotation(parameters) { - var _this10; + var _this12; _classCallCheck(this, SquareAnnotation); - _this10 = _possibleConstructorReturn(this, _getPrototypeOf(SquareAnnotation).call(this, parameters)); - _this10.data.annotationType = _util.AnnotationType.SQUARE; - - _this10._preparePopup(parameters.dict); - - return _this10; + _this12 = _possibleConstructorReturn(this, _getPrototypeOf(SquareAnnotation).call(this, parameters)); + _this12.data.annotationType = _util.AnnotationType.SQUARE; + return _this12; } return SquareAnnotation; -}(Annotation); +}(MarkupAnnotation); var CircleAnnotation = /*#__PURE__*/ -function (_Annotation7) { - _inherits(CircleAnnotation, _Annotation7); +function (_MarkupAnnotation5) { + _inherits(CircleAnnotation, _MarkupAnnotation5); function CircleAnnotation(parameters) { - var _this11; + var _this13; _classCallCheck(this, CircleAnnotation); - _this11 = _possibleConstructorReturn(this, _getPrototypeOf(CircleAnnotation).call(this, parameters)); - _this11.data.annotationType = _util.AnnotationType.CIRCLE; - - _this11._preparePopup(parameters.dict); - - return _this11; + _this13 = _possibleConstructorReturn(this, _getPrototypeOf(CircleAnnotation).call(this, parameters)); + _this13.data.annotationType = _util.AnnotationType.CIRCLE; + return _this13; } return CircleAnnotation; -}(Annotation); +}(MarkupAnnotation); var PolylineAnnotation = /*#__PURE__*/ -function (_Annotation8) { - _inherits(PolylineAnnotation, _Annotation8); +function (_MarkupAnnotation6) { + _inherits(PolylineAnnotation, _MarkupAnnotation6); function PolylineAnnotation(parameters) { - var _this12; + var _this14; _classCallCheck(this, PolylineAnnotation); - _this12 = _possibleConstructorReturn(this, _getPrototypeOf(PolylineAnnotation).call(this, parameters)); - _this12.data.annotationType = _util.AnnotationType.POLYLINE; + _this14 = _possibleConstructorReturn(this, _getPrototypeOf(PolylineAnnotation).call(this, parameters)); + _this14.data.annotationType = _util.AnnotationType.POLYLINE; var dict = parameters.dict; var rawVertices = dict.getArray('Vertices'); - _this12.data.vertices = []; + _this14.data.vertices = []; for (var i = 0, ii = rawVertices.length; i < ii; i += 2) { - _this12.data.vertices.push({ + _this14.data.vertices.push({ x: rawVertices[i], y: rawVertices[i + 1] }); } - _this12._preparePopup(dict); - - return _this12; + return _this14; } return PolylineAnnotation; -}(Annotation); +}(MarkupAnnotation); var PolygonAnnotation = /*#__PURE__*/ @@ -29166,184 +29490,182 @@ function (_PolylineAnnotation) { _inherits(PolygonAnnotation, _PolylineAnnotation); function PolygonAnnotation(parameters) { - var _this13; + var _this15; _classCallCheck(this, PolygonAnnotation); - _this13 = _possibleConstructorReturn(this, _getPrototypeOf(PolygonAnnotation).call(this, parameters)); - _this13.data.annotationType = _util.AnnotationType.POLYGON; - return _this13; + _this15 = _possibleConstructorReturn(this, _getPrototypeOf(PolygonAnnotation).call(this, parameters)); + _this15.data.annotationType = _util.AnnotationType.POLYGON; + return _this15; } return PolygonAnnotation; }(PolylineAnnotation); +var CaretAnnotation = +/*#__PURE__*/ +function (_MarkupAnnotation7) { + _inherits(CaretAnnotation, _MarkupAnnotation7); + + function CaretAnnotation(parameters) { + var _this16; + + _classCallCheck(this, CaretAnnotation); + + _this16 = _possibleConstructorReturn(this, _getPrototypeOf(CaretAnnotation).call(this, parameters)); + _this16.data.annotationType = _util.AnnotationType.CARET; + return _this16; + } + + return CaretAnnotation; +}(MarkupAnnotation); + var InkAnnotation = /*#__PURE__*/ -function (_Annotation9) { - _inherits(InkAnnotation, _Annotation9); +function (_MarkupAnnotation8) { + _inherits(InkAnnotation, _MarkupAnnotation8); function InkAnnotation(parameters) { - var _this14; + var _this17; _classCallCheck(this, InkAnnotation); - _this14 = _possibleConstructorReturn(this, _getPrototypeOf(InkAnnotation).call(this, parameters)); - _this14.data.annotationType = _util.AnnotationType.INK; + _this17 = _possibleConstructorReturn(this, _getPrototypeOf(InkAnnotation).call(this, parameters)); + _this17.data.annotationType = _util.AnnotationType.INK; var dict = parameters.dict; var xref = parameters.xref; var originalInkLists = dict.getArray('InkList'); - _this14.data.inkLists = []; + _this17.data.inkLists = []; for (var i = 0, ii = originalInkLists.length; i < ii; ++i) { - _this14.data.inkLists.push([]); + _this17.data.inkLists.push([]); for (var j = 0, jj = originalInkLists[i].length; j < jj; j += 2) { - _this14.data.inkLists[i].push({ + _this17.data.inkLists[i].push({ x: xref.fetchIfRef(originalInkLists[i][j]), y: xref.fetchIfRef(originalInkLists[i][j + 1]) }); } } - _this14._preparePopup(dict); - - return _this14; + return _this17; } return InkAnnotation; -}(Annotation); +}(MarkupAnnotation); var HighlightAnnotation = /*#__PURE__*/ -function (_Annotation10) { - _inherits(HighlightAnnotation, _Annotation10); +function (_MarkupAnnotation9) { + _inherits(HighlightAnnotation, _MarkupAnnotation9); function HighlightAnnotation(parameters) { - var _this15; + var _this18; _classCallCheck(this, HighlightAnnotation); - _this15 = _possibleConstructorReturn(this, _getPrototypeOf(HighlightAnnotation).call(this, parameters)); - _this15.data.annotationType = _util.AnnotationType.HIGHLIGHT; - - _this15._preparePopup(parameters.dict); - - return _this15; + _this18 = _possibleConstructorReturn(this, _getPrototypeOf(HighlightAnnotation).call(this, parameters)); + _this18.data.annotationType = _util.AnnotationType.HIGHLIGHT; + return _this18; } return HighlightAnnotation; -}(Annotation); +}(MarkupAnnotation); var UnderlineAnnotation = /*#__PURE__*/ -function (_Annotation11) { - _inherits(UnderlineAnnotation, _Annotation11); +function (_MarkupAnnotation10) { + _inherits(UnderlineAnnotation, _MarkupAnnotation10); function UnderlineAnnotation(parameters) { - var _this16; + var _this19; _classCallCheck(this, UnderlineAnnotation); - _this16 = _possibleConstructorReturn(this, _getPrototypeOf(UnderlineAnnotation).call(this, parameters)); - _this16.data.annotationType = _util.AnnotationType.UNDERLINE; - - _this16._preparePopup(parameters.dict); - - return _this16; + _this19 = _possibleConstructorReturn(this, _getPrototypeOf(UnderlineAnnotation).call(this, parameters)); + _this19.data.annotationType = _util.AnnotationType.UNDERLINE; + return _this19; } return UnderlineAnnotation; -}(Annotation); +}(MarkupAnnotation); var SquigglyAnnotation = /*#__PURE__*/ -function (_Annotation12) { - _inherits(SquigglyAnnotation, _Annotation12); +function (_MarkupAnnotation11) { + _inherits(SquigglyAnnotation, _MarkupAnnotation11); function SquigglyAnnotation(parameters) { - var _this17; + var _this20; _classCallCheck(this, SquigglyAnnotation); - _this17 = _possibleConstructorReturn(this, _getPrototypeOf(SquigglyAnnotation).call(this, parameters)); - _this17.data.annotationType = _util.AnnotationType.SQUIGGLY; - - _this17._preparePopup(parameters.dict); - - return _this17; + _this20 = _possibleConstructorReturn(this, _getPrototypeOf(SquigglyAnnotation).call(this, parameters)); + _this20.data.annotationType = _util.AnnotationType.SQUIGGLY; + return _this20; } return SquigglyAnnotation; -}(Annotation); +}(MarkupAnnotation); var StrikeOutAnnotation = /*#__PURE__*/ -function (_Annotation13) { - _inherits(StrikeOutAnnotation, _Annotation13); +function (_MarkupAnnotation12) { + _inherits(StrikeOutAnnotation, _MarkupAnnotation12); function StrikeOutAnnotation(parameters) { - var _this18; + var _this21; _classCallCheck(this, StrikeOutAnnotation); - _this18 = _possibleConstructorReturn(this, _getPrototypeOf(StrikeOutAnnotation).call(this, parameters)); - _this18.data.annotationType = _util.AnnotationType.STRIKEOUT; - - _this18._preparePopup(parameters.dict); - - return _this18; + _this21 = _possibleConstructorReturn(this, _getPrototypeOf(StrikeOutAnnotation).call(this, parameters)); + _this21.data.annotationType = _util.AnnotationType.STRIKEOUT; + return _this21; } return StrikeOutAnnotation; -}(Annotation); +}(MarkupAnnotation); var StampAnnotation = /*#__PURE__*/ -function (_Annotation14) { - _inherits(StampAnnotation, _Annotation14); +function (_MarkupAnnotation13) { + _inherits(StampAnnotation, _MarkupAnnotation13); function StampAnnotation(parameters) { - var _this19; + var _this22; _classCallCheck(this, StampAnnotation); - _this19 = _possibleConstructorReturn(this, _getPrototypeOf(StampAnnotation).call(this, parameters)); - _this19.data.annotationType = _util.AnnotationType.STAMP; - - _this19._preparePopup(parameters.dict); - - return _this19; + _this22 = _possibleConstructorReturn(this, _getPrototypeOf(StampAnnotation).call(this, parameters)); + _this22.data.annotationType = _util.AnnotationType.STAMP; + return _this22; } return StampAnnotation; -}(Annotation); +}(MarkupAnnotation); var FileAttachmentAnnotation = /*#__PURE__*/ -function (_Annotation15) { - _inherits(FileAttachmentAnnotation, _Annotation15); +function (_MarkupAnnotation14) { + _inherits(FileAttachmentAnnotation, _MarkupAnnotation14); function FileAttachmentAnnotation(parameters) { - var _this20; + var _this23; _classCallCheck(this, FileAttachmentAnnotation); - _this20 = _possibleConstructorReturn(this, _getPrototypeOf(FileAttachmentAnnotation).call(this, parameters)); + _this23 = _possibleConstructorReturn(this, _getPrototypeOf(FileAttachmentAnnotation).call(this, parameters)); var file = new _obj.FileSpec(parameters.dict.get('FS'), parameters.xref); - _this20.data.annotationType = _util.AnnotationType.FILEATTACHMENT; - _this20.data.file = file.serializable; - - _this20._preparePopup(parameters.dict); - - return _this20; + _this23.data.annotationType = _util.AnnotationType.FILEATTACHMENT; + _this23.data.file = file.serializable; + return _this23; } return FileAttachmentAnnotation; -}(Annotation); +}(MarkupAnnotation); /***/ }), -/* 170 */ +/* 171 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -29354,7 +29676,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.OperatorList = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); var QueueOptimizer = function QueueOptimizerClosure() { function addState(parentState, pattern, checkFn, iterateFn, processFn) { @@ -29409,6 +29731,8 @@ var QueueOptimizer = function QueueOptimizerClosure() { case 3: return fnArray[i] === _util.OPS.restore; } + + throw new Error("iterateInlineImageGroup - invalid pos: ".concat(pos)); }, function foundInlineImageGroup(context, i) { var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; @@ -29515,6 +29839,8 @@ var QueueOptimizer = function QueueOptimizerClosure() { case 3: return fnArray[i] === _util.OPS.restore; } + + throw new Error("iterateImageMaskGroup - invalid pos: ".concat(pos)); }, function foundImageMaskGroup(context, i) { var MIN_IMAGES_IN_MASKS_BLOCK = 10; var MAX_IMAGES_IN_MASKS_BLOCK = 100; @@ -29597,7 +29923,7 @@ var QueueOptimizer = function QueueOptimizerClosure() { var argsArray = context.argsArray; var iFirstTransform = context.iCurr - 2; return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0; - }, function (context, i) { + }, function iterateImageGroup(context, i) { var fnArray = context.fnArray, argsArray = context.argsArray; var iFirstSave = context.iCurr - 3; @@ -29639,6 +29965,8 @@ var QueueOptimizer = function QueueOptimizerClosure() { case 3: return fnArray[i] === _util.OPS.restore; } + + throw new Error("iterateImageGroup - invalid pos: ".concat(pos)); }, function (context, i) { var MIN_IMAGES_IN_BLOCK = 3; var MAX_IMAGES_IN_BLOCK = 1000; @@ -29671,7 +29999,7 @@ var QueueOptimizer = function QueueOptimizerClosure() { argsArray.splice(iFirstSave, count * 4, args); return iFirstSave + 1; }); - addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function (context, i) { + addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) { var fnArray = context.fnArray, argsArray = context.argsArray; var iFirstSave = context.iCurr - 4; @@ -29705,6 +30033,8 @@ var QueueOptimizer = function QueueOptimizerClosure() { case 4: return fnArray[i] === _util.OPS.endText; } + + throw new Error("iterateShowTextGroup - invalid pos: ".concat(pos)); }, function (context, i) { var MIN_CHARS_IN_BLOCK = 3; var MAX_CHARS_IN_BLOCK = 1000; @@ -29846,7 +30176,8 @@ var NullOptimizer = function NullOptimizerClosure() { this.queue.fnArray.push(fn); this.queue.argsArray.push(args); }, - flush: function flush() {} + flush: function flush() {}, + reset: function reset() {} }; return NullOptimizer; }(); @@ -29855,36 +30186,12 @@ var OperatorList = function OperatorListClosure() { var CHUNK_SIZE = 1000; var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5; - function getTransfers(queue) { - var transfers = []; - var fnArray = queue.fnArray, - argsArray = queue.argsArray; - - for (var i = 0, ii = queue.length; i < ii; i++) { - switch (fnArray[i]) { - case _util.OPS.paintInlineImageXObject: - case _util.OPS.paintInlineImageXObjectGroup: - case _util.OPS.paintImageMaskXObject: - var arg = argsArray[i][0]; - ; - - if (!arg.cached) { - transfers.push(arg.data.buffer); - } - - break; - } - } - - return transfers; - } - function OperatorList(intent, messageHandler, pageIndex) { this.messageHandler = messageHandler; this.fnArray = []; this.argsArray = []; - if (messageHandler && this.intent !== 'oplist') { + if (messageHandler && intent !== 'oplist') { this.optimizer = new QueueOptimizer(this); } else { this.optimizer = new NullOptimizer(this); @@ -29945,9 +30252,35 @@ var OperatorList = function OperatorListClosure() { length: this.length }; }, - flush: function flush(lastChunk) { + + get _transfers() { + var transfers = []; + var fnArray = this.fnArray, + argsArray = this.argsArray, + length = this.length; + + for (var i = 0; i < length; i++) { + switch (fnArray[i]) { + case _util.OPS.paintInlineImageXObject: + case _util.OPS.paintInlineImageXObjectGroup: + case _util.OPS.paintImageMaskXObject: + var arg = argsArray[i][0]; + ; + + if (!arg.cached) { + transfers.push(arg.data.buffer); + } + + break; + } + } + + return transfers; + }, + + flush: function flush() { + var lastChunk = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; this.optimizer.flush(); - var transfers = getTransfers(this); var length = this.length; this._totalLength += length; this.messageHandler.send('RenderPageChunk', { @@ -29959,7 +30292,7 @@ var OperatorList = function OperatorListClosure() { }, pageIndex: this.pageIndex, intent: this.intent - }, transfers); + }, this._transfers); this.dependencies = Object.create(null); this.fnArray.length = 0; this.argsArray.length = 0; @@ -29973,7 +30306,7 @@ var OperatorList = function OperatorListClosure() { exports.OperatorList = OperatorList; /***/ }), -/* 171 */ +/* 172 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -29986,45 +30319,49 @@ exports.PartialEvaluator = void 0; var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _cmap = __w_pdfjs_require__(172); +var _cmap = __w_pdfjs_require__(173); -var _stream = __w_pdfjs_require__(157); +var _primitives = __w_pdfjs_require__(151); -var _primitives = __w_pdfjs_require__(155); +var _fonts = __w_pdfjs_require__(174); -var _fonts = __w_pdfjs_require__(173); +var _encodings = __w_pdfjs_require__(177); -var _encodings = __w_pdfjs_require__(176); +var _unicode = __w_pdfjs_require__(180); -var _unicode = __w_pdfjs_require__(179); +var _standard_fonts = __w_pdfjs_require__(179); -var _standard_fonts = __w_pdfjs_require__(178); +var _pattern = __w_pdfjs_require__(183); -var _pattern = __w_pdfjs_require__(182); +var _parser = __w_pdfjs_require__(157); -var _parser = __w_pdfjs_require__(156); +var _bidi = __w_pdfjs_require__(184); -var _bidi = __w_pdfjs_require__(183); +var _colorspace = __w_pdfjs_require__(169); -var _colorspace = __w_pdfjs_require__(168); +var _stream = __w_pdfjs_require__(158); -var _glyphlist = __w_pdfjs_require__(177); +var _glyphlist = __w_pdfjs_require__(178); -var _metrics = __w_pdfjs_require__(184); +var _core_utils = __w_pdfjs_require__(154); -var _function = __w_pdfjs_require__(185); +var _metrics = __w_pdfjs_require__(185); -var _jpeg_stream = __w_pdfjs_require__(163); +var _function = __w_pdfjs_require__(186); -var _murmurhash = __w_pdfjs_require__(187); +var _jpeg_stream = __w_pdfjs_require__(164); -var _operator_list = __w_pdfjs_require__(170); +var _murmurhash = __w_pdfjs_require__(188); -var _image = __w_pdfjs_require__(188); +var _image_utils = __w_pdfjs_require__(189); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _operator_list = __w_pdfjs_require__(171); + +var _image = __w_pdfjs_require__(190); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } @@ -30040,77 +30377,19 @@ var PartialEvaluator = function PartialEvaluatorClosure() { isEvalSupported: true }; - function NativeImageDecoder(_ref) { + function PartialEvaluator(_ref) { + var _this = this; + var xref = _ref.xref, - resources = _ref.resources, handler = _ref.handler, - _ref$forceDataSchema = _ref.forceDataSchema, - forceDataSchema = _ref$forceDataSchema === void 0 ? false : _ref$forceDataSchema, + pageIndex = _ref.pageIndex, + idFactory = _ref.idFactory, + fontCache = _ref.fontCache, + builtInCMapCache = _ref.builtInCMapCache, + _ref$options = _ref.options, + options = _ref$options === void 0 ? null : _ref$options, pdfFunctionFactory = _ref.pdfFunctionFactory; this.xref = xref; - this.resources = resources; - this.handler = handler; - this.forceDataSchema = forceDataSchema; - this.pdfFunctionFactory = pdfFunctionFactory; - } - - NativeImageDecoder.prototype = { - canDecode: function canDecode(image) { - return image instanceof _jpeg_stream.JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources, this.pdfFunctionFactory); - }, - decode: function decode(image) { - var dict = image.dict; - var colorSpace = dict.get('ColorSpace', 'CS'); - colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, this.resources, this.pdfFunctionFactory); - return this.handler.sendWithPromise('JpegDecode', [image.getIR(this.forceDataSchema), colorSpace.numComps]).then(function (_ref2) { - var data = _ref2.data, - width = _ref2.width, - height = _ref2.height; - return new _stream.Stream(data, 0, data.length, image.dict); - }); - } - }; - - NativeImageDecoder.isSupported = function (image, xref, res, pdfFunctionFactory) { - var dict = image.dict; - - if (dict.has('DecodeParms') || dict.has('DP')) { - return false; - } - - var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res, pdfFunctionFactory); - - return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D')); - }; - - NativeImageDecoder.isDecodable = function (image, xref, res, pdfFunctionFactory) { - var dict = image.dict; - - if (dict.has('DecodeParms') || dict.has('DP')) { - return false; - } - - var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res, pdfFunctionFactory); - - var bpc = dict.get('BitsPerComponent', 'BPC') || 1; - return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'), bpc); - }; - - function PartialEvaluator(_ref3) { - var _this = this; - - var pdfManager = _ref3.pdfManager, - xref = _ref3.xref, - handler = _ref3.handler, - pageIndex = _ref3.pageIndex, - idFactory = _ref3.idFactory, - fontCache = _ref3.fontCache, - builtInCMapCache = _ref3.builtInCMapCache, - _ref3$options = _ref3.options, - options = _ref3$options === void 0 ? null : _ref3$options, - pdfFunctionFactory = _ref3.pdfFunctionFactory; - this.pdfManager = pdfManager; - this.xref = xref; this.handler = handler; this.pageIndex = pageIndex; this.idFactory = idFactory; @@ -30118,15 +30397,16 @@ var PartialEvaluator = function PartialEvaluatorClosure() { this.builtInCMapCache = builtInCMapCache; this.options = options || DefaultPartialEvaluatorOptions; this.pdfFunctionFactory = pdfFunctionFactory; + this.parsingType3Font = false; this.fetchBuiltInCMap = /*#__PURE__*/ function () { - var _ref4 = _asyncToGenerator( + var _ref2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(name) { + _regenerator["default"].mark(function _callee(name) { var data; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -30157,11 +30437,11 @@ var PartialEvaluator = function PartialEvaluatorClosure() { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return function (_x) { - return _ref4.apply(this, arguments); + return _ref2.apply(this, arguments); }; }(); } @@ -30393,154 +30673,213 @@ var PartialEvaluator = function PartialEvaluatorClosure() { } }); }, - buildPaintImageXObject: function buildPaintImageXObject(_ref5) { - var _this2 = this; + buildPaintImageXObject: function () { + var _buildPaintImageXObject = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee2(_ref3) { + var _this2 = this; - var resources = _ref5.resources, - image = _ref5.image, - _ref5$isInline = _ref5.isInline, - isInline = _ref5$isInline === void 0 ? false : _ref5$isInline, - operatorList = _ref5.operatorList, - cacheKey = _ref5.cacheKey, - imageCache = _ref5.imageCache, - _ref5$forceDisableNat = _ref5.forceDisableNativeImageDecoder, - forceDisableNativeImageDecoder = _ref5$forceDisableNat === void 0 ? false : _ref5$forceDisableNat; - var dict = image.dict; - var w = dict.get('Width', 'W'); - var h = dict.get('Height', 'H'); + var resources, image, _ref3$isInline, isInline, operatorList, cacheKey, imageCache, _ref3$forceDisableNat, forceDisableNativeImageDecoder, dict, w, h, maxImageSize, imageMask, imgData, args, width, height, bitStrideLength, imgArray, decode, softMask, mask, SMALL_IMAGE_DIMENSIONS, imageObj, nativeImageDecoderSupport, objId, nativeImageDecoder, imgPromise; - if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) { - (0, _util.warn)('Image dimensions are missing, or not numbers.'); - return Promise.resolve(); - } + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + resources = _ref3.resources, image = _ref3.image, _ref3$isInline = _ref3.isInline, isInline = _ref3$isInline === void 0 ? false : _ref3$isInline, operatorList = _ref3.operatorList, cacheKey = _ref3.cacheKey, imageCache = _ref3.imageCache, _ref3$forceDisableNat = _ref3.forceDisableNativeImageDecoder, forceDisableNativeImageDecoder = _ref3$forceDisableNat === void 0 ? false : _ref3$forceDisableNat; + dict = image.dict; + w = dict.get('Width', 'W'); + h = dict.get('Height', 'H'); - var maxImageSize = this.options.maxImageSize; + if (!(!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h)))) { + _context2.next = 7; + break; + } - if (maxImageSize !== -1 && w * h > maxImageSize) { - (0, _util.warn)('Image exceeded maximum allowed size and was removed.'); - return Promise.resolve(); - } + (0, _util.warn)('Image dimensions are missing, or not numbers.'); + return _context2.abrupt("return", undefined); - var imageMask = dict.get('ImageMask', 'IM') || false; - var imgData, args; + case 7: + maxImageSize = this.options.maxImageSize; - if (imageMask) { - var width = dict.get('Width', 'W'); - var height = dict.get('Height', 'H'); - var bitStrideLength = width + 7 >> 3; - var imgArray = image.getBytes(bitStrideLength * height, true); - var decode = dict.getArray('Decode', 'D'); - imgData = _image.PDFImage.createMask({ - imgArray: imgArray, - width: width, - height: height, - imageIsFromDecodeStream: image instanceof _stream.DecodeStream, - inverseDecode: !!decode && decode[0] > 0 - }); - imgData.cached = true; - args = [imgData]; - operatorList.addOp(_util.OPS.paintImageMaskXObject, args); - - if (cacheKey) { - imageCache[cacheKey] = { - fn: _util.OPS.paintImageMaskXObject, - args: args - }; - } + if (!(maxImageSize !== -1 && w * h > maxImageSize)) { + _context2.next = 11; + break; + } - return Promise.resolve(); - } + (0, _util.warn)('Image exceeded maximum allowed size and was removed.'); + return _context2.abrupt("return", undefined); - var softMask = dict.get('SMask', 'SM') || false; - var mask = dict.get('Mask') || false; - var SMALL_IMAGE_DIMENSIONS = 200; + case 11: + imageMask = dict.get('ImageMask', 'IM') || false; - if (isInline && !softMask && !mask && !(image instanceof _jpeg_stream.JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) { - var imageObj = new _image.PDFImage({ - xref: this.xref, - res: resources, - image: image, - isInline: isInline, - pdfFunctionFactory: this.pdfFunctionFactory - }); - imgData = imageObj.createImageData(true); - operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]); - return Promise.resolve(); - } + if (!imageMask) { + _context2.next = 24; + break; + } - var nativeImageDecoderSupport = forceDisableNativeImageDecoder ? _util.NativeImageDecoding.NONE : this.options.nativeImageDecoderSupport; - var objId = 'img_' + this.idFactory.createObjId(); + width = dict.get('Width', 'W'); + height = dict.get('Height', 'H'); + bitStrideLength = width + 7 >> 3; + imgArray = image.getBytes(bitStrideLength * height, true); + decode = dict.getArray('Decode', 'D'); + imgData = _image.PDFImage.createMask({ + imgArray: imgArray, + width: width, + height: height, + imageIsFromDecodeStream: image instanceof _stream.DecodeStream, + inverseDecode: !!decode && decode[0] > 0 + }); + imgData.cached = !!cacheKey; + args = [imgData]; + operatorList.addOp(_util.OPS.paintImageMaskXObject, args); + + if (cacheKey) { + imageCache[cacheKey] = { + fn: _util.OPS.paintImageMaskXObject, + args: args + }; + } - if (nativeImageDecoderSupport !== _util.NativeImageDecoding.NONE && !softMask && !mask && image instanceof _jpeg_stream.JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources, this.pdfFunctionFactory)) { - return this.handler.sendWithPromise('obj', [objId, this.pageIndex, 'JpegStream', image.getIR(this.options.forceDataSchema)]).then(function () { - operatorList.addDependency(objId); - args = [objId, w, h]; - operatorList.addOp(_util.OPS.paintJpegXObject, args); + return _context2.abrupt("return", undefined); - if (cacheKey) { - imageCache[cacheKey] = { - fn: _util.OPS.paintJpegXObject, - args: args - }; - } - }, function (reason) { - (0, _util.warn)('Native JPEG decoding failed -- trying to recover: ' + (reason && reason.message)); - return _this2.buildPaintImageXObject({ - resources: resources, - image: image, - isInline: isInline, - operatorList: operatorList, - cacheKey: cacheKey, - imageCache: imageCache, - forceDisableNativeImageDecoder: true - }); - }); - } + case 24: + softMask = dict.get('SMask', 'SM') || false; + mask = dict.get('Mask') || false; + SMALL_IMAGE_DIMENSIONS = 200; - var nativeImageDecoder = null; + if (!(isInline && !softMask && !mask && !(image instanceof _jpeg_stream.JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS)) { + _context2.next = 32; + break; + } - if (nativeImageDecoderSupport === _util.NativeImageDecoding.DECODE && (image instanceof _jpeg_stream.JpegStream || mask instanceof _jpeg_stream.JpegStream || softMask instanceof _jpeg_stream.JpegStream)) { - nativeImageDecoder = new NativeImageDecoder({ - xref: this.xref, - resources: resources, - handler: this.handler, - forceDataSchema: this.options.forceDataSchema, - pdfFunctionFactory: this.pdfFunctionFactory - }); - } + imageObj = new _image.PDFImage({ + xref: this.xref, + res: resources, + image: image, + isInline: isInline, + pdfFunctionFactory: this.pdfFunctionFactory + }); + imgData = imageObj.createImageData(true); + operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]); + return _context2.abrupt("return", undefined); - operatorList.addDependency(objId); - args = [objId, w, h]; + case 32: + nativeImageDecoderSupport = forceDisableNativeImageDecoder ? _util.NativeImageDecoding.NONE : this.options.nativeImageDecoderSupport; + objId = "img_".concat(this.idFactory.createObjId()); - _image.PDFImage.buildImage({ - handler: this.handler, - xref: this.xref, - res: resources, - image: image, - isInline: isInline, - nativeDecoder: nativeImageDecoder, - pdfFunctionFactory: this.pdfFunctionFactory - }).then(function (imageObj) { - var imgData = imageObj.createImageData(false); + if (this.parsingType3Font) { + (0, _util.assert)(nativeImageDecoderSupport === _util.NativeImageDecoding.NONE, 'Type3 image resources should be completely decoded in the worker.'); + objId = "".concat(this.idFactory.getDocId(), "_type3res_").concat(objId); + } + + if (!(nativeImageDecoderSupport !== _util.NativeImageDecoding.NONE && !softMask && !mask && image instanceof _jpeg_stream.JpegStream && _image_utils.NativeImageDecoder.isSupported(image, this.xref, resources, this.pdfFunctionFactory))) { + _context2.next = 37; + break; + } - _this2.handler.send('obj', [objId, _this2.pageIndex, 'Image', imgData], [imgData.data.buffer]); - }).catch(function (reason) { - (0, _util.warn)('Unable to decode image: ' + reason); + return _context2.abrupt("return", this.handler.sendWithPromise('obj', [objId, this.pageIndex, 'JpegStream', image.getIR(this.options.forceDataSchema)]).then(function () { + operatorList.addDependency(objId); + args = [objId, w, h]; + operatorList.addOp(_util.OPS.paintJpegXObject, args); - _this2.handler.send('obj', [objId, _this2.pageIndex, 'Image', null]); - }); + if (cacheKey) { + imageCache[cacheKey] = { + fn: _util.OPS.paintJpegXObject, + args: args + }; + } + }, function (reason) { + (0, _util.warn)('Native JPEG decoding failed -- trying to recover: ' + (reason && reason.message)); + return _this2.buildPaintImageXObject({ + resources: resources, + image: image, + isInline: isInline, + operatorList: operatorList, + cacheKey: cacheKey, + imageCache: imageCache, + forceDisableNativeImageDecoder: true + }); + })); - operatorList.addOp(_util.OPS.paintImageXObject, args); + case 37: + nativeImageDecoder = null; - if (cacheKey) { - imageCache[cacheKey] = { - fn: _util.OPS.paintImageXObject, - args: args - }; + if (nativeImageDecoderSupport === _util.NativeImageDecoding.DECODE && (image instanceof _jpeg_stream.JpegStream || mask instanceof _jpeg_stream.JpegStream || softMask instanceof _jpeg_stream.JpegStream)) { + nativeImageDecoder = new _image_utils.NativeImageDecoder({ + xref: this.xref, + resources: resources, + handler: this.handler, + forceDataSchema: this.options.forceDataSchema, + pdfFunctionFactory: this.pdfFunctionFactory + }); + } + + operatorList.addDependency(objId); + args = [objId, w, h]; + imgPromise = _image.PDFImage.buildImage({ + handler: this.handler, + xref: this.xref, + res: resources, + image: image, + isInline: isInline, + nativeDecoder: nativeImageDecoder, + pdfFunctionFactory: this.pdfFunctionFactory + }).then(function (imageObj) { + var imgData = imageObj.createImageData(false); + + if (_this2.parsingType3Font) { + return _this2.handler.sendWithPromise('commonobj', [objId, 'FontType3Res', imgData], [imgData.data.buffer]); + } + + _this2.handler.send('obj', [objId, _this2.pageIndex, 'Image', imgData], [imgData.data.buffer]); + + return undefined; + })["catch"](function (reason) { + (0, _util.warn)('Unable to decode image: ' + reason); + + if (_this2.parsingType3Font) { + return _this2.handler.sendWithPromise('commonobj', [objId, 'FontType3Res', null]); + } + + _this2.handler.send('obj', [objId, _this2.pageIndex, 'Image', null]); + + return undefined; + }); + + if (!this.parsingType3Font) { + _context2.next = 45; + break; + } + + _context2.next = 45; + return imgPromise; + + case 45: + operatorList.addOp(_util.OPS.paintImageXObject, args); + + if (cacheKey) { + imageCache[cacheKey] = { + fn: _util.OPS.paintImageXObject, + args: args + }; + } + + return _context2.abrupt("return", undefined); + + case 48: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function buildPaintImageXObject(_x2) { + return _buildPaintImageXObject.apply(this, arguments); } - return Promise.resolve(); - }, + return buildPaintImageXObject; + }(), handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) { var smaskContent = smask.get('G'); var smaskOptions = { @@ -30616,7 +30955,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() { return translated.loadType3Data(_this4, resources, operatorList, task).then(function () { return translated; - }).catch(function (reason) { + })["catch"](function (reason) { _this4.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.font }); @@ -30781,7 +31120,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() { var fontCapability = (0, _util.createPromiseCapability)(); var preEvaluatedFont = this.preEvaluateFont(font); - var descriptor = preEvaluatedFont.descriptor; + var descriptor = preEvaluatedFont.descriptor, + hash = preEvaluatedFont.hash; var fontRefIsRef = (0, _primitives.isRef)(fontRef), fontID; @@ -30789,13 +31129,12 @@ var PartialEvaluator = function PartialEvaluatorClosure() { fontID = fontRef.toString(); } - if ((0, _primitives.isDict)(descriptor)) { + if (hash && (0, _primitives.isDict)(descriptor)) { if (!descriptor.fontAliases) { descriptor.fontAliases = Object.create(null); } var fontAliases = descriptor.fontAliases; - var hash = preEvaluatedFont.hash; if (fontAliases[hash]) { var aliasFontRef = fontAliases[hash].aliasRef; @@ -30824,11 +31163,11 @@ var PartialEvaluator = function PartialEvaluatorClosure() { fontID = this.idFactory.createObjId(); } - this.fontCache.put('id_' + fontID, fontCapability.promise); + this.fontCache.put("id_".concat(fontID), fontCapability.promise); } (0, _util.assert)(fontID, 'The "fontID" must be defined.'); - font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID; + font.loadedName = "".concat(this.idFactory.getDocId(), "_f").concat(fontID); font.translated = fontCapability.promise; var translatedPromise; @@ -30845,13 +31184,12 @@ var PartialEvaluator = function PartialEvaluatorClosure() { } fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font)); - }).catch(function (reason) { + })["catch"](function (reason) { _this6.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.font }); try { - var descriptor = preEvaluatedFont.descriptor; var fontFile3 = descriptor && descriptor.get('FontFile3'); var subtype = fontFile3 && fontFile3.get('Subtype'); var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name); @@ -30863,7 +31201,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() { }); return fontCapability.promise; }, - buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) { + buildPath: function buildPath(operatorList, fn, args) { + var parsingText = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; var lastIndex = operatorList.length - 1; if (!args) { @@ -30871,47 +31210,90 @@ var PartialEvaluator = function PartialEvaluatorClosure() { } if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) { + if (parsingText) { + (0, _util.warn)("Encountered path operator \"".concat(fn, "\" inside of a text object.")); + operatorList.addOp(_util.OPS.save, null); + } + operatorList.addOp(_util.OPS.constructPath, [[fn], args]); + + if (parsingText) { + operatorList.addOp(_util.OPS.restore, null); + } } else { var opArgs = operatorList.argsArray[lastIndex]; opArgs[0].push(fn); Array.prototype.push.apply(opArgs[1], args); } }, - handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task) { - var patternName = args[args.length - 1]; - var pattern; + handleColorN: function () { + var _handleColorN = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee3(operatorList, fn, args, cs, patterns, resources, task) { + var patternName, pattern, dict, typeNum, color, shading, matrix; + return _regenerator["default"].wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + patternName = args[args.length - 1]; - if ((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name))) { - var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern; - var typeNum = dict.get('PatternType'); + if (!((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name)))) { + _context3.next = 16; + break; + } - if (typeNum === TILING_PATTERN) { - var color = cs.base ? cs.base.getRgb(args, 0) : null; - return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task); - } else if (typeNum === SHADING_PATTERN) { - var shading = dict.get('Shading'); - var matrix = dict.getArray('Matrix'); - pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this.pdfFunctionFactory); - operatorList.addOp(fn, pattern.getIR()); - return Promise.resolve(); - } + dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern; + typeNum = dict.get('PatternType'); + + if (!(typeNum === TILING_PATTERN)) { + _context3.next = 9; + break; + } + + color = cs.base ? cs.base.getRgb(args, 0) : null; + return _context3.abrupt("return", this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task)); - return Promise.reject(new Error('Unknown PatternType: ' + typeNum)); + case 9: + if (!(typeNum === SHADING_PATTERN)) { + _context3.next = 15; + break; + } + + shading = dict.get('Shading'); + matrix = dict.getArray('Matrix'); + pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this.pdfFunctionFactory); + operatorList.addOp(fn, pattern.getIR()); + return _context3.abrupt("return", undefined); + + case 15: + throw new _util.FormatError("Unknown PatternType: ".concat(typeNum)); + + case 16: + throw new _util.FormatError("Unknown PatternName: ".concat(patternName)); + + case 17: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function handleColorN(_x3, _x4, _x5, _x6, _x7, _x8, _x9) { + return _handleColorN.apply(this, arguments); } - operatorList.addOp(fn, args); - return Promise.resolve(); - }, - getOperatorList: function getOperatorList(_ref6) { + return handleColorN; + }(), + getOperatorList: function getOperatorList(_ref4) { var _this7 = this; - var stream = _ref6.stream, - task = _ref6.task, - resources = _ref6.resources, - operatorList = _ref6.operatorList, - _ref6$initialState = _ref6.initialState, - initialState = _ref6$initialState === void 0 ? null : _ref6$initialState; + var stream = _ref4.stream, + task = _ref4.task, + resources = _ref4.resources, + operatorList = _ref4.operatorList, + _ref4$initialState = _ref4.initialState, + initialState = _ref4$initialState === void 0 ? null : _ref4$initialState; resources = resources || _primitives.Dict.empty; initialState = initialState || new EvalState(); @@ -30921,6 +31303,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() { var self = this; var xref = this.xref; + var parsingText = false; var imageCache = Object.create(null); var xobjs = resources.get('XObject') || _primitives.Dict.empty; @@ -31022,7 +31405,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() { } resolveXObject(); - }).catch(function (reason) { + })["catch"](function (reason) { if (self.options.ignoreErrors) { self.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown @@ -31043,6 +31426,14 @@ var PartialEvaluator = function PartialEvaluatorClosure() { })); return; + case _util.OPS.beginText: + parsingText = true; + break; + + case _util.OPS.endText: + parsingText = false; + break; + case _util.OPS.endInlineImage: var cacheKey = args[0].cacheKey; @@ -31224,11 +31615,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() { case _util.OPS.curveTo2: case _util.OPS.curveTo3: case _util.OPS.closePath: - self.buildPath(operatorList, fn, args); - continue; - case _util.OPS.rectangle: - self.buildPath(operatorList, fn, args); + self.buildPath(operatorList, fn, args, parsingText); continue; case _util.OPS.markPoint: @@ -31266,7 +31654,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() { closePendingRestoreOPS(); resolve(); - }).catch(function (reason) { + })["catch"](function (reason) { if (_this7.options.ignoreErrors) { _this7.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown @@ -31280,21 +31668,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() { throw reason; }); }, - getTextContent: function getTextContent(_ref7) { + getTextContent: function getTextContent(_ref5) { var _this8 = this; - var stream = _ref7.stream, - task = _ref7.task, - resources = _ref7.resources, - _ref7$stateManager = _ref7.stateManager, - stateManager = _ref7$stateManager === void 0 ? null : _ref7$stateManager, - _ref7$normalizeWhites = _ref7.normalizeWhitespace, - normalizeWhitespace = _ref7$normalizeWhites === void 0 ? false : _ref7$normalizeWhites, - _ref7$combineTextItem = _ref7.combineTextItems, - combineTextItems = _ref7$combineTextItem === void 0 ? false : _ref7$combineTextItem, - sink = _ref7.sink, - _ref7$seenStyles = _ref7.seenStyles, - seenStyles = _ref7$seenStyles === void 0 ? Object.create(null) : _ref7$seenStyles; + var stream = _ref5.stream, + task = _ref5.task, + resources = _ref5.resources, + _ref5$stateManager = _ref5.stateManager, + stateManager = _ref5$stateManager === void 0 ? null : _ref5$stateManager, + _ref5$normalizeWhites = _ref5.normalizeWhitespace, + normalizeWhitespace = _ref5$normalizeWhites === void 0 ? false : _ref5$normalizeWhites, + _ref5$combineTextItem = _ref5.combineTextItems, + combineTextItems = _ref5$combineTextItem === void 0 ? false : _ref5$combineTextItem, + sink = _ref5.sink, + _ref5$seenStyles = _ref5.seenStyles, + seenStyles = _ref5$seenStyles === void 0 ? Object.create(null) : _ref5$seenStyles; resources = resources || _primitives.Dict.empty; stateManager = stateManager || new StateManager(new TextState()); var WhitespaceRegexp = /\s/g; @@ -31349,12 +31737,11 @@ var PartialEvaluator = function PartialEvaluatorClosure() { textContentItem.fontName = font.loadedName; var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise]; - if (font.isType3Font && textState.fontMatrix !== _util.FONT_IDENTITY_MATRIX && textState.fontSize === 1) { + if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) { var glyphHeight = font.bbox[3] - font.bbox[1]; if (glyphHeight > 0) { - glyphHeight = glyphHeight * textState.fontMatrix[3]; - tsm[3] *= glyphHeight; + tsm[3] *= glyphHeight * textState.fontMatrix[3]; } } @@ -31804,7 +32191,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() { resolveXObject(); }, rejectXObject); - }).catch(function (reason) { + })["catch"](function (reason) { if (reason instanceof _util.AbortException) { return; } @@ -31859,7 +32246,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() { flushTextContentItem(); enqueueChunk(); resolve(); - }).catch(function (reason) { + })["catch"](function (reason) { if (reason instanceof _util.AbortException) { return; } @@ -31877,7 +32264,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() { extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) { var _this9 = this; - var xref = this.xref; + var xref = this.xref, + cidToGidBytes; var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode'); var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined); @@ -31895,7 +32283,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() { var cidToGidMap = dict.get('CIDToGIDMap'); if ((0, _primitives.isStream)(cidToGidMap)) { - properties.cidToGidMap = this.readCidToGidMap(cidToGidMap); + cidToGidBytes = cidToGidMap.getBytes(); } } @@ -31972,6 +32360,11 @@ var PartialEvaluator = function PartialEvaluatorClosure() { return _this9.buildToUnicode(properties); }).then(function (toUnicode) { properties.toUnicode = toUnicode; + + if (cidToGidBytes) { + properties.cidToGidMap = _this9.readCidToGidMap(cidToGidBytes, toUnicode); + } + return properties; }); }, @@ -32152,18 +32545,17 @@ var PartialEvaluator = function PartialEvaluatorClosure() { return Promise.resolve(null); }, - readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) { - var glyphsData = cidToGidStream.getBytes(); + readCidToGidMap: function readCidToGidMap(glyphsData, toUnicode) { var result = []; for (var j = 0, jj = glyphsData.length; j < jj; j++) { var glyphID = glyphsData[j++] << 8 | glyphsData[j]; + var code = j >> 1; - if (glyphID === 0) { + if (glyphID === 0 && !toUnicode.has(code)) { continue; } - var code = j >> 1; result[code] = glyphID; } @@ -32398,6 +32790,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() { } } + var firstChar = dict.get('FirstChar') || 0; + var lastChar = dict.get('LastChar') || (composite ? 0xFFFF : 0xFF); + hash.update("".concat(firstChar, "-").concat(lastChar)); var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode'); if ((0, _primitives.isStream)(toUnicode)) { @@ -32603,8 +32998,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() { _iteratorError = err; } finally { try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); } } finally { if (_didIteratorError) { @@ -32657,7 +33052,9 @@ var TranslatedFont = function TranslatedFontClosure() { var type3Options = Object.create(evaluator.options); type3Options.ignoreErrors = false; + type3Options.nativeImageDecoderSupport = _util.NativeImageDecoding.NONE; var type3Evaluator = evaluator.clone(type3Options); + type3Evaluator.parsingType3Font = true; var translatedFont = this.font; var loadCharProcsPromise = Promise.resolve(); var charProcs = this.dict.get('CharProcs'); @@ -32678,7 +33075,7 @@ var TranslatedFont = function TranslatedFontClosure() { }).then(function () { charProcOperatorList[key] = operatorList.getIR(); parentOperatorList.addDependencies(operatorList.dependencies); - }).catch(function (reason) { + })["catch"](function (reason) { (0, _util.warn)("Type3 font resource \"".concat(key, "\" is not available.")); var operatorList = new _operator_list.OperatorList(); charProcOperatorList[key] = operatorList.getIR(); @@ -32845,7 +33242,7 @@ var EvalState = function EvalStateClosure() { }(); var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() { - var getOPMap = (0, _util.getLookupTableFactory)(function (t) { + var getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) { t['w'] = { id: _util.OPS.setLineWidth, numArgs: 1, @@ -33226,7 +33623,10 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() { function EvaluatorPreprocessor(stream, xref, stateManager) { this.opMap = getOPMap(); - this.parser = new _parser.Parser(new _parser.Lexer(stream, this.opMap), false, xref); + this.parser = new _parser.Parser({ + lexer: new _parser.Lexer(stream, this.opMap), + xref: xref + }); this.stateManager = stateManager; this.nonProcessedArgs = []; this._numInvalidPathOPS = 0; @@ -33337,7 +33737,7 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() { }(); /***/ }), -/* 172 */ +/* 173 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -33348,13 +33748,15 @@ Object.defineProperty(exports, "__esModule", { }); exports.CMapFactory = exports.IdentityCMap = exports.CMap = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); + +var _primitives = __w_pdfjs_require__(151); -var _primitives = __w_pdfjs_require__(155); +var _parser = __w_pdfjs_require__(157); -var _parser = __w_pdfjs_require__(156); +var _core_utils = __w_pdfjs_require__(154); -var _stream = __w_pdfjs_require__(157); +var _stream = __w_pdfjs_require__(158); function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -33774,7 +34176,9 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() { var useCMap = null; var start = new Uint8Array(MAX_NUM_SIZE); var end = new Uint8Array(MAX_NUM_SIZE); - var char = new Uint8Array(MAX_NUM_SIZE); + + var _char = new Uint8Array(MAX_NUM_SIZE); + var charCode = new Uint8Array(MAX_NUM_SIZE); var tmp = new Uint8Array(MAX_NUM_SIZE); var code; @@ -33844,20 +34248,20 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() { break; case 2: - stream.readHex(char, dataSize); + stream.readHex(_char, dataSize); code = stream.readNumber(); - cMap.mapOne(hexToInt(char, dataSize), code); + cMap.mapOne(hexToInt(_char, dataSize), code); for (i = 1; i < subitemsCount; i++) { - incHex(char, dataSize); + incHex(_char, dataSize); if (!sequence) { stream.readHexNumber(tmp, dataSize); - addHex(char, tmp, dataSize); + addHex(_char, tmp, dataSize); } code = stream.readSigned() + (code + 1); - cMap.mapOne(hexToInt(char, dataSize), code); + cMap.mapOne(hexToInt(_char, dataSize), code); } break; @@ -33888,22 +34292,22 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() { break; case 4: - stream.readHex(char, ucs2DataSize); + stream.readHex(_char, ucs2DataSize); stream.readHex(charCode, dataSize); - cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); + cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize)); for (i = 1; i < subitemsCount; i++) { - incHex(char, ucs2DataSize); + incHex(_char, ucs2DataSize); if (!sequence) { stream.readHexNumber(tmp, ucs2DataSize); - addHex(char, tmp, ucs2DataSize); + addHex(_char, tmp, ucs2DataSize); } incHex(charCode, dataSize); stream.readHexSigned(tmp, dataSize); addHex(charCode, tmp, dataSize); - cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); + cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize)); } break; @@ -34183,7 +34587,7 @@ var CMapFactory = function CMapFactoryClosure() { } } } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } @@ -34289,7 +34693,7 @@ var CMapFactory = function CMapFactoryClosure() { exports.CMapFactory = CMapFactory; /***/ }), -/* 173 */ +/* 174 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -34301,25 +34705,27 @@ Object.defineProperty(exports, "__esModule", { exports.getFontType = getFontType; exports.IdentityToUnicodeMap = exports.ToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = exports.SEAC_ANALYSIS_ENABLED = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _cff_parser = __w_pdfjs_require__(174); +var _cff_parser = __w_pdfjs_require__(175); -var _glyphlist = __w_pdfjs_require__(177); +var _glyphlist = __w_pdfjs_require__(178); -var _encodings = __w_pdfjs_require__(176); +var _encodings = __w_pdfjs_require__(177); -var _standard_fonts = __w_pdfjs_require__(178); +var _standard_fonts = __w_pdfjs_require__(179); -var _unicode = __w_pdfjs_require__(179); +var _unicode = __w_pdfjs_require__(180); -var _font_renderer = __w_pdfjs_require__(180); +var _font_renderer = __w_pdfjs_require__(181); -var _cmap = __w_pdfjs_require__(172); +var _cmap = __w_pdfjs_require__(173); -var _stream = __w_pdfjs_require__(157); +var _core_utils = __w_pdfjs_require__(154); -var _type1_parser = __w_pdfjs_require__(181); +var _stream = __w_pdfjs_require__(158); + +var _type1_parser = __w_pdfjs_require__(182); function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } @@ -35696,7 +36102,7 @@ var Font = function FontClosure() { }; } - function sanitizeMetrics(font, header, metrics, numGlyphs) { + function sanitizeMetrics(font, header, metrics, numGlyphs, dupFirstEntry) { if (!header) { if (metrics) { metrics.data = null; @@ -35734,6 +36140,12 @@ var Font = function FontClosure() { if (numMissing > 0) { var entries = new Uint8Array(metrics.length + numMissing * 2); entries.set(metrics.data); + + if (dupFirstEntry) { + entries[metrics.length] = metrics.data[2]; + entries[metrics.length + 1] = metrics.data[3]; + } + metrics.data = entries; } } @@ -36489,7 +36901,7 @@ var Font = function FontClosure() { delete tables['cvt ']; } - sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphsOut); + sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphsOut, dupFirstEntry); if (!tables['head']) { throw new _util.FormatError('Required "head" table is not found'); @@ -37105,7 +37517,7 @@ var Type1Font = function Type1FontClosure() { headerBytes = stream.getBytes(suggestedLength); headerBytesLength = headerBytes.length; } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } } @@ -37329,20 +37741,22 @@ var Type1Font = function Type1FontClosure() { cff.strings = strings; cff.globalSubrIndex = new _cff_parser.CFFIndex(); var count = glyphs.length; - var charsetArray = [0]; + var charsetArray = ['.notdef']; var i, ii; for (i = 0; i < count; i++) { - var index = _cff_parser.CFFStandardStrings.indexOf(charstrings[i].glyphName); + var glyphName = charstrings[i].glyphName; + + var index = _cff_parser.CFFStandardStrings.indexOf(glyphName); if (index === -1) { - index = 0; + strings.add(glyphName); } - charsetArray.push(index >> 8 & 0xff, index & 0xff); + charsetArray.push(glyphName); } - cff.charset = new _cff_parser.CFFCharset(false, 0, [], charsetArray); + cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray); var charStringsIndex = new _cff_parser.CFFIndex(); charStringsIndex.add([0x8B, 0x0E]); @@ -37422,16 +37836,18 @@ var CFFFont = function CFFFontClosure() { if (properties.composite) { charCodeToGlyphId = Object.create(null); + var charCode; if (cff.isCIDFont) { for (glyphId = 0; glyphId < charsets.length; glyphId++) { var cid = charsets[glyphId]; - var charCode = properties.cMap.charCodeOf(cid); + charCode = properties.cMap.charCodeOf(cid); charCodeToGlyphId[charCode] = glyphId; } } else { for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { - charCodeToGlyphId[glyphId] = glyphId; + charCode = properties.cMap.charCodeOf(glyphId); + charCodeToGlyphId[charCode] = glyphId; } } @@ -37450,7 +37866,7 @@ var CFFFont = function CFFFontClosure() { }(); /***/ }), -/* 174 */ +/* 175 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -37461,15 +37877,16 @@ Object.defineProperty(exports, "__esModule", { }); exports.CFFFDSelect = exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _charsets = __w_pdfjs_require__(175); +var _charsets = __w_pdfjs_require__(176); -var _encodings = __w_pdfjs_require__(176); +var _encodings = __w_pdfjs_require__(177); var MAX_SUBR_NESTING = 10; var CFFStandardStrings = ['.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', 'periodcentered', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', 'questiondown', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine', 'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', 'dotlessi', 'lslash', 'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu', 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter', 'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', 'twosuperior', 'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright', 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde', 'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex', 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex', 'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', 'aacute', 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla', 'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex', 'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', 'odieresis', 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis', 'ugrave', 'yacute', 'ydieresis', 'zcaron', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', 'Dotaccentsmall', 'Macronsmall', 'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall', '001.000', '001.001', '001.002', '001.003', 'Black', 'Bold', 'Book', 'Light', 'Medium', 'Regular', 'Roman', 'Semibold']; exports.CFFStandardStrings = CFFStandardStrings; +var NUM_STANDARD_CFF_STRINGS = 391; var CFFParser = function CFFParserClosure() { var CharstringValidationData = [null, { @@ -38466,16 +38883,31 @@ var CFFStrings = function CFFStringsClosure() { CFFStrings.prototype = { get: function CFFStrings_get(index) { - if (index >= 0 && index <= 390) { + if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) { return CFFStandardStrings[index]; } - if (index - 391 <= this.strings.length) { - return this.strings[index - 391]; + if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) { + return this.strings[index - NUM_STANDARD_CFF_STRINGS]; } return CFFStandardStrings[0]; }, + getSID: function CFFStrings_getSID(str) { + var index = CFFStandardStrings.indexOf(str); + + if (index !== -1) { + return index; + } + + index = this.strings.indexOf(str); + + if (index !== -1) { + return index + NUM_STANDARD_CFF_STRINGS; + } + + return -1; + }, add: function CFFStrings_add(value) { this.strings.push(value); }, @@ -38812,7 +39244,7 @@ var CFFCompiler = function CFFCompilerClosure() { } } - var charset = this.compileCharset(cff.charset); + var charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont); topDictTracker.setEntryLocation('charset', [output.length], output); output.add(charset); var charStrings = this.compileCharStrings(cff.charStrings); @@ -38907,13 +39339,13 @@ var CFFCompiler = function CFFCompilerClosure() { var sanitizedName = new Array(length); for (var j = 0; j < length; j++) { - var char = name[j]; + var _char = name[j]; - if (char < '!' || char > '~' || char === '[' || char === ']' || char === '(' || char === ')' || char === '{' || char === '}' || char === '<' || char === '>' || char === '/' || char === '%') { - char = '_'; + if (_char < '!' || _char > '~' || _char === '[' || _char === ']' || _char === '(' || _char === ')' || _char === '{' || _char === '}' || _char === '<' || _char === '>' || _char === '/' || _char === '%') { + _char = '_'; } - sanitizedName[j] = char; + sanitizedName[j] = _char; } sanitizedName = sanitizedName.join(''); @@ -39078,9 +39510,42 @@ var CFFCompiler = function CFFCompilerClosure() { return this.compileIndex(charStringsIndex); }, - compileCharset: function CFFCompiler_compileCharset(charset) { - var length = 1 + (this.cff.charStrings.count - 1) * 2; - var out = new Uint8Array(length); + compileCharset: function CFFCompiler_compileCharset(charset, numGlyphs, strings, isCIDFont) { + var out; + var numGlyphsLessNotDef = numGlyphs - 1; + + if (isCIDFont) { + out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xFF, numGlyphsLessNotDef & 0xFF]); + } else { + var length = 1 + numGlyphsLessNotDef * 2; + out = new Uint8Array(length); + out[0] = 0; + var charsetIndex = 0; + var numCharsets = charset.charset.length; + var warned = false; + + for (var i = 1; i < out.length; i += 2) { + var sid = 0; + + if (charsetIndex < numCharsets) { + var name = charset.charset[charsetIndex++]; + sid = strings.getSID(name); + + if (sid === -1) { + sid = 0; + + if (!warned) { + warned = true; + (0, _util.warn)("Couldn't find ".concat(name, " in CFF strings")); + } + } + } + + out[i] = sid >> 8 & 0xFF; + out[i + 1] = sid & 0xFF; + } + } + return this.compileTypedArray(out); }, compileEncoding: function CFFCompiler_compileEncoding(encoding) { @@ -39201,7 +39666,7 @@ var CFFCompiler = function CFFCompilerClosure() { exports.CFFCompiler = CFFCompiler; /***/ }), -/* 175 */ +/* 176 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -39219,7 +39684,7 @@ var ExpertSubsetCharset = ['.notdef', 'space', 'dollaroldstyle', 'dollarsuperior exports.ExpertSubsetCharset = ExpertSubsetCharset; /***/ }), -/* 176 */ +/* 177 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -39273,10 +39738,10 @@ function getEncoding(encodingName) { } /***/ }), -/* 177 */ +/* 178 */ /***/ (function(module, exports, __w_pdfjs_require__) { -var getLookupTableFactory = __w_pdfjs_require__(6).getLookupTableFactory; +var getLookupTableFactory = __w_pdfjs_require__(154).getLookupTableFactory; var getGlyphsUnicode = getLookupTableFactory(function (t) { t['A'] = 0x0041; t['AE'] = 0x00C6; @@ -43809,7 +44274,7 @@ exports.getGlyphsUnicode = getGlyphsUnicode; exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode; /***/ }), -/* 178 */ +/* 179 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -43820,9 +44285,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = void 0; -var _util = __w_pdfjs_require__(6); +var _core_utils = __w_pdfjs_require__(154); -var getStdFontMap = (0, _util.getLookupTableFactory)(function (t) { +var getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { t['ArialNarrow'] = 'Helvetica'; t['ArialNarrow-Bold'] = 'Helvetica-Bold'; t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique'; @@ -43881,7 +44346,7 @@ var getStdFontMap = (0, _util.getLookupTableFactory)(function (t) { t['TimesNewRomanPSMT-Italic'] = 'Times-Italic'; }); exports.getStdFontMap = getStdFontMap; -var getNonStdFontMap = (0, _util.getLookupTableFactory)(function (t) { +var getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { t['Calibri'] = 'Helvetica'; t['Calibri-Bold'] = 'Helvetica-Bold'; t['Calibri-BoldItalic'] = 'Helvetica-BoldOblique'; @@ -43919,7 +44384,7 @@ var getNonStdFontMap = (0, _util.getLookupTableFactory)(function (t) { t['Wingdings'] = 'ZapfDingbats'; }); exports.getNonStdFontMap = getNonStdFontMap; -var getSerifFonts = (0, _util.getLookupTableFactory)(function (t) { +var getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) { t['Adobe Jenson'] = true; t['Adobe Text'] = true; t['Albertus'] = true; @@ -44055,13 +44520,13 @@ var getSerifFonts = (0, _util.getLookupTableFactory)(function (t) { t['XITS'] = true; }); exports.getSerifFonts = getSerifFonts; -var getSymbolsFonts = (0, _util.getLookupTableFactory)(function (t) { +var getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) { t['Dingbats'] = true; t['Symbol'] = true; t['ZapfDingbats'] = true; }); exports.getSymbolsFonts = getSymbolsFonts; -var getGlyphMapForStandardFonts = (0, _util.getLookupTableFactory)(function (t) { +var getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) { t[2] = 10; t[3] = 32; t[4] = 33; @@ -44457,13 +44922,13 @@ var getGlyphMapForStandardFonts = (0, _util.getLookupTableFactory)(function (t) t[3416] = 8377; }); exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts; -var getSupplementalGlyphMapForArialBlack = (0, _util.getLookupTableFactory)(function (t) { +var getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) { t[227] = 322; t[264] = 261; t[291] = 346; }); exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack; -var getSupplementalGlyphMapForCalibri = (0, _util.getLookupTableFactory)(function (t) { +var getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) { t[1] = 32; t[4] = 65; t[17] = 66; @@ -44552,10 +45017,10 @@ var getSupplementalGlyphMapForCalibri = (0, _util.getLookupTableFactory)(functio exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri; /***/ }), -/* 179 */ +/* 180 */ /***/ (function(module, exports, __w_pdfjs_require__) { -var getLookupTableFactory = __w_pdfjs_require__(6).getLookupTableFactory; +var getLookupTableFactory = __w_pdfjs_require__(154).getLookupTableFactory; var getSpecialPUASymbols = getLookupTableFactory(function (t) { t[63721] = 0x00A9; t[63193] = 0x00A9; @@ -46529,7 +46994,7 @@ exports.getNormalizedUnicodes = getNormalizedUnicodes; exports.getUnicodeForGlyph = getUnicodeForGlyph; /***/ }), -/* 180 */ +/* 181 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -46540,15 +47005,15 @@ Object.defineProperty(exports, "__esModule", { }); exports.FontRendererFactory = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _cff_parser = __w_pdfjs_require__(174); +var _cff_parser = __w_pdfjs_require__(175); -var _glyphlist = __w_pdfjs_require__(177); +var _glyphlist = __w_pdfjs_require__(178); -var _encodings = __w_pdfjs_require__(176); +var _encodings = __w_pdfjs_require__(177); -var _stream = __w_pdfjs_require__(157); +var _stream = __w_pdfjs_require__(158); function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -47538,7 +48003,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() { exports.FontRendererFactory = FontRendererFactory; /***/ }), -/* 181 */ +/* 182 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -47549,11 +48014,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.Type1Parser = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _encodings = __w_pdfjs_require__(176); +var _encodings = __w_pdfjs_require__(177); -var _stream = __w_pdfjs_require__(157); +var _stream = __w_pdfjs_require__(158); var HINTING_ENABLED = false; @@ -48231,7 +48696,7 @@ var Type1Parser = function Type1ParserClosure() { exports.Type1Parser = Type1Parser; /***/ }), -/* 182 */ +/* 183 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -48243,11 +48708,13 @@ Object.defineProperty(exports, "__esModule", { exports.getTilingPatternIR = getTilingPatternIR; exports.Pattern = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); + +var _colorspace = __w_pdfjs_require__(169); -var _colorspace = __w_pdfjs_require__(168); +var _primitives = __w_pdfjs_require__(151); -var _primitives = __w_pdfjs_require__(155); +var _core_utils = __w_pdfjs_require__(154); var ShadingType = { FUNCTION_BASED: 1, @@ -48290,7 +48757,7 @@ var Pattern = function PatternClosure() { throw new _util.FormatError('Unsupported ShadingType: ' + type); } } catch (ex) { - if (ex instanceof _util.MissingDataException) { + if (ex instanceof _core_utils.MissingDataException) { throw ex; } @@ -49153,7 +49620,7 @@ function getTilingPatternIR(operatorList, dict, args) { } /***/ }), -/* 183 */ +/* 184 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -49164,7 +49631,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.bidi = bidi; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); var baseTypes = ['BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'S', 'B', 'S', 'WS', 'B', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'B', 'B', 'B', 'S', 'WS', 'ON', 'ON', 'ET', 'ET', 'ET', 'ON', 'ON', 'ON', 'ON', 'ON', 'ES', 'CS', 'ES', 'CS', 'CS', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'CS', 'ON', 'ON', 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'ON', 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'ON', 'ON', 'ON', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'B', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'CS', 'ON', 'ET', 'ET', 'ET', 'ET', 'ON', 'ON', 'ON', 'ON', 'L', 'ON', 'ON', 'BN', 'ON', 'ON', 'ET', 'ET', 'EN', 'EN', 'ON', 'L', 'ON', 'ON', 'ON', 'EN', 'L', 'ON', 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L']; var arabicTypes = ['AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'ON', 'ON', 'AL', 'ET', 'ET', 'AL', 'CS', 'AL', 'ON', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', '', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'ET', 'AN', 'AN', 'AL', 'AL', 'AL', 'NSM', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AN', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', 'NSM', 'NSM', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL']; @@ -49457,7 +49924,7 @@ function bidi(str, startLevel, vertical) { } /***/ }), -/* 184 */ +/* 185 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -49468,14 +49935,14 @@ Object.defineProperty(exports, "__esModule", { }); exports.getMetrics = void 0; -var _util = __w_pdfjs_require__(6); +var _core_utils = __w_pdfjs_require__(154); -var getMetrics = (0, _util.getLookupTableFactory)(function (t) { +var getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) { t['Courier'] = 600; t['Courier-Bold'] = 600; t['Courier-BoldOblique'] = 600; t['Courier-Oblique'] = 600; - t['Helvetica'] = (0, _util.getLookupTableFactory)(function (t) { + t['Helvetica'] = (0, _core_utils.getLookupTableFactory)(function (t) { t['space'] = 278; t['exclam'] = 278; t['quotedbl'] = 355; @@ -49792,7 +50259,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) { t['imacron'] = 278; t['Euro'] = 556; }); - t['Helvetica-Bold'] = (0, _util.getLookupTableFactory)(function (t) { + t['Helvetica-Bold'] = (0, _core_utils.getLookupTableFactory)(function (t) { t['space'] = 278; t['exclam'] = 333; t['quotedbl'] = 474; @@ -50109,7 +50576,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) { t['imacron'] = 278; t['Euro'] = 556; }); - t['Helvetica-BoldOblique'] = (0, _util.getLookupTableFactory)(function (t) { + t['Helvetica-BoldOblique'] = (0, _core_utils.getLookupTableFactory)(function (t) { t['space'] = 278; t['exclam'] = 333; t['quotedbl'] = 474; @@ -50426,7 +50893,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) { t['imacron'] = 278; t['Euro'] = 556; }); - t['Helvetica-Oblique'] = (0, _util.getLookupTableFactory)(function (t) { + t['Helvetica-Oblique'] = (0, _core_utils.getLookupTableFactory)(function (t) { t['space'] = 278; t['exclam'] = 278; t['quotedbl'] = 355; @@ -50743,7 +51210,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) { t['imacron'] = 278; t['Euro'] = 556; }); - t['Symbol'] = (0, _util.getLookupTableFactory)(function (t) { + t['Symbol'] = (0, _core_utils.getLookupTableFactory)(function (t) { t['space'] = 250; t['exclam'] = 333; t['universal'] = 713; @@ -50935,7 +51402,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) { t['bracerightbt'] = 494; t['apple'] = 790; }); - t['Times-Roman'] = (0, _util.getLookupTableFactory)(function (t) { + t['Times-Roman'] = (0, _core_utils.getLookupTableFactory)(function (t) { t['space'] = 250; t['exclam'] = 333; t['quotedbl'] = 408; @@ -51252,7 +51719,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) { t['imacron'] = 278; t['Euro'] = 500; }); - t['Times-Bold'] = (0, _util.getLookupTableFactory)(function (t) { + t['Times-Bold'] = (0, _core_utils.getLookupTableFactory)(function (t) { t['space'] = 250; t['exclam'] = 333; t['quotedbl'] = 555; @@ -51569,7 +52036,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) { t['imacron'] = 278; t['Euro'] = 500; }); - t['Times-BoldItalic'] = (0, _util.getLookupTableFactory)(function (t) { + t['Times-BoldItalic'] = (0, _core_utils.getLookupTableFactory)(function (t) { t['space'] = 250; t['exclam'] = 389; t['quotedbl'] = 555; @@ -51886,7 +52353,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) { t['imacron'] = 278; t['Euro'] = 500; }); - t['Times-Italic'] = (0, _util.getLookupTableFactory)(function (t) { + t['Times-Italic'] = (0, _core_utils.getLookupTableFactory)(function (t) { t['space'] = 250; t['exclam'] = 333; t['quotedbl'] = 420; @@ -52203,7 +52670,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) { t['imacron'] = 278; t['Euro'] = 500; }); - t['ZapfDingbats'] = (0, _util.getLookupTableFactory)(function (t) { + t['ZapfDingbats'] = (0, _core_utils.getLookupTableFactory)(function (t) { t['space'] = 278; t['a1'] = 974; t['a2'] = 961; @@ -52411,7 +52878,7 @@ var getMetrics = (0, _util.getLookupTableFactory)(function (t) { exports.getMetrics = getMetrics; /***/ }), -/* 185 */ +/* 186 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -52423,11 +52890,11 @@ Object.defineProperty(exports, "__esModule", { exports.isPDFFunction = isPDFFunction; exports.PostScriptCompiler = exports.PostScriptEvaluator = exports.PDFFunctionFactory = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); -var _ps_parser = __w_pdfjs_require__(186); +var _ps_parser = __w_pdfjs_require__(187); function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -53758,7 +54225,7 @@ var PostScriptCompiler = function PostScriptCompilerClosure() { exports.PostScriptCompiler = PostScriptCompiler; /***/ }), -/* 186 */ +/* 187 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -53769,9 +54236,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.PostScriptParser = exports.PostScriptLexer = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -54051,7 +54518,7 @@ function () { exports.PostScriptLexer = PostScriptLexer; /***/ }), -/* 187 */ +/* 188 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -54062,20 +54529,31 @@ Object.defineProperty(exports, "__esModule", { }); exports.MurmurHash3_64 = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { - var MASK_HIGH = 0xffff0000; - var MASK_LOW = 0xffff; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var SEED = 0xc3d2e1f0; +var MASK_HIGH = 0xffff0000; +var MASK_LOW = 0xffff; + +var MurmurHash3_64 = +/*#__PURE__*/ +function () { function MurmurHash3_64(seed) { - var SEED = 0xc3d2e1f0; + _classCallCheck(this, MurmurHash3_64); + this.h1 = seed ? seed & 0xffffffff : SEED; this.h2 = seed ? seed & 0xffffffff : SEED; } - MurmurHash3_64.prototype = { - update: function MurmurHash3_64_update(input) { + _createClass(MurmurHash3_64, [{ + key: "update", + value: function update(input) { var data, length; if ((0, _util.isString)(input)) { @@ -54102,14 +54580,14 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { var blockCounts = length >> 2; var tailLength = length - blockCounts * 4; var dataUint32 = new Uint32Array(data.buffer, 0, blockCounts); - var k1 = 0; - var k2 = 0; - var h1 = this.h1; - var h2 = this.h2; - var C1 = 0xcc9e2d51; - var C2 = 0x1b873593; - var C1_LOW = C1 & MASK_LOW; - var C2_LOW = C2 & MASK_LOW; + var k1 = 0, + k2 = 0; + var h1 = this.h1, + h2 = this.h2; + var C1 = 0xcc9e2d51, + C2 = 0x1b873593; + var C1_LOW = C1 & MASK_LOW, + C2_LOW = C2 & MASK_LOW; for (var _i = 0; _i < blockCounts; _i++) { if (_i & 1) { @@ -54156,11 +54634,12 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { this.h1 = h1; this.h2 = h2; - return this; - }, - hexdigest: function MurmurHash3_64_hexdigest() { - var h1 = this.h1; - var h2 = this.h2; + } + }, { + key: "hexdigest", + value: function hexdigest() { + var h1 = this.h1, + h2 = this.h2; h1 ^= h2 >>> 1; h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW; h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16; @@ -54168,27 +54647,115 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW; h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16; h1 ^= h2 >>> 1; + var hex1 = (h1 >>> 0).toString(16), + hex2 = (h2 >>> 0).toString(16); + return hex1.padStart(8, '0') + hex2.padStart(8, '0'); + } + }]); - for (var i = 0, arr = [h1, h2], str = ''; i < arr.length; i++) { - var hex = (arr[i] >>> 0).toString(16); + return MurmurHash3_64; +}(); - while (hex.length < 8) { - hex = '0' + hex; - } +exports.MurmurHash3_64 = MurmurHash3_64; + +/***/ }), +/* 189 */ +/***/ (function(module, exports, __w_pdfjs_require__) { - str += hex; +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.NativeImageDecoder = void 0; + +var _colorspace = __w_pdfjs_require__(169); + +var _jpeg_stream = __w_pdfjs_require__(164); + +var _stream = __w_pdfjs_require__(158); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var NativeImageDecoder = +/*#__PURE__*/ +function () { + function NativeImageDecoder(_ref) { + var xref = _ref.xref, + resources = _ref.resources, + handler = _ref.handler, + _ref$forceDataSchema = _ref.forceDataSchema, + forceDataSchema = _ref$forceDataSchema === void 0 ? false : _ref$forceDataSchema, + pdfFunctionFactory = _ref.pdfFunctionFactory; + + _classCallCheck(this, NativeImageDecoder); + + this.xref = xref; + this.resources = resources; + this.handler = handler; + this.forceDataSchema = forceDataSchema; + this.pdfFunctionFactory = pdfFunctionFactory; + } + + _createClass(NativeImageDecoder, [{ + key: "canDecode", + value: function canDecode(image) { + return image instanceof _jpeg_stream.JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources, this.pdfFunctionFactory); + } + }, { + key: "decode", + value: function decode(image) { + var dict = image.dict; + var colorSpace = dict.get('ColorSpace', 'CS'); + colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, this.resources, this.pdfFunctionFactory); + return this.handler.sendWithPromise('JpegDecode', [image.getIR(this.forceDataSchema), colorSpace.numComps]).then(function (_ref2) { + var data = _ref2.data, + width = _ref2.width, + height = _ref2.height; + return new _stream.Stream(data, 0, data.length, dict); + }); + } + }], [{ + key: "isSupported", + value: function isSupported(image, xref, res, pdfFunctionFactory) { + var dict = image.dict; + + if (dict.has('DecodeParms') || dict.has('DP')) { + return false; } - return str; + var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res, pdfFunctionFactory); + + return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D')); } - }; - return MurmurHash3_64; + }, { + key: "isDecodable", + value: function isDecodable(image, xref, res, pdfFunctionFactory) { + var dict = image.dict; + + if (dict.has('DecodeParms') || dict.has('DP')) { + return false; + } + + var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res, pdfFunctionFactory); + + var bpc = dict.get('BitsPerComponent', 'BPC') || 1; + return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'), bpc); + } + }]); + + return NativeImageDecoder; }(); -exports.MurmurHash3_64 = MurmurHash3_64; +exports.NativeImageDecoder = NativeImageDecoder; /***/ }), -/* 188 */ +/* 190 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -54199,17 +54766,17 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFImage = void 0; -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -var _primitives = __w_pdfjs_require__(155); +var _primitives = __w_pdfjs_require__(151); -var _colorspace = __w_pdfjs_require__(168); +var _colorspace = __w_pdfjs_require__(169); -var _stream = __w_pdfjs_require__(157); +var _stream = __w_pdfjs_require__(158); -var _jpeg_stream = __w_pdfjs_require__(163); +var _jpeg_stream = __w_pdfjs_require__(164); -var _jpx = __w_pdfjs_require__(166); +var _jpx = __w_pdfjs_require__(167); function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } @@ -54222,7 +54789,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } var PDFImage = function PDFImageClosure() { function handleImageData(image, nativeDecoder) { if (nativeDecoder && nativeDecoder.canDecode(image)) { - return nativeDecoder.decode(image).catch(function (reason) { + return nativeDecoder.decode(image)["catch"](function (reason) { (0, _util.warn)('Native image decoding failed -- trying to recover: ' + (reason && reason.message)); return image; }); @@ -54859,7 +55426,7 @@ var PDFImage = function PDFImageClosure() { exports.PDFImage = PDFImage; /***/ }), -/* 189 */ +/* 191 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; @@ -54872,9 +55439,9 @@ exports.MessageHandler = MessageHandler; var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); -var _util = __w_pdfjs_require__(6); +var _util = __w_pdfjs_require__(5); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -54889,10 +55456,10 @@ function resolveCall(_x, _x2) { function _resolveCall() { _resolveCall = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(fn, args) { + _regenerator["default"].mark(function _callee(fn, args) { var thisArg, _args = arguments; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -54903,7 +55470,7 @@ function _resolveCall() { break; } - return _context.abrupt("return"); + return _context.abrupt("return", undefined); case 3: return _context.abrupt("return", fn.apply(thisArg, args)); @@ -54913,7 +55480,7 @@ function _resolveCall() { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return _resolveCall.apply(this, arguments); } @@ -54955,7 +55522,7 @@ function resolveOrReject(capability, success, reason) { } function finalize(promise) { - return Promise.resolve(promise).catch(function () {}); + return Promise.resolve(promise)["catch"](function () {}); } function MessageHandler(sourceName, targetName, comObj) { @@ -55364,6 +55931,268 @@ MessageHandler.prototype = { } }; +/***/ }), +/* 192 */ +/***/ (function(module, exports, __w_pdfjs_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFWorkerStream = void 0; + +var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2)); + +var _util = __w_pdfjs_require__(5); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var PDFWorkerStream = +/*#__PURE__*/ +function () { + function PDFWorkerStream(msgHandler) { + _classCallCheck(this, PDFWorkerStream); + + this._msgHandler = msgHandler; + this._contentLength = null; + this._fullRequestReader = null; + this._rangeRequestReaders = []; + } + + _createClass(PDFWorkerStream, [{ + key: "getFullReader", + value: function getFullReader() { + (0, _util.assert)(!this._fullRequestReader); + this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler); + return this._fullRequestReader; + } + }, { + key: "getRangeReader", + value: function getRangeReader(begin, end) { + var reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler); + + this._rangeRequestReaders.push(reader); + + return reader; + } + }, { + key: "cancelAllRequests", + value: function cancelAllRequests(reason) { + if (this._fullRequestReader) { + this._fullRequestReader.cancel(reason); + } + + var readers = this._rangeRequestReaders.slice(0); + + readers.forEach(function (reader) { + reader.cancel(reason); + }); + } + }]); + + return PDFWorkerStream; +}(); + +exports.PDFWorkerStream = PDFWorkerStream; + +var PDFWorkerStreamReader = +/*#__PURE__*/ +function () { + function PDFWorkerStreamReader(msgHandler) { + var _this = this; + + _classCallCheck(this, PDFWorkerStreamReader); + + this._msgHandler = msgHandler; + this.onProgress = null; + this._contentLength = null; + this._isRangeSupported = false; + this._isStreamingSupported = false; + + var readableStream = this._msgHandler.sendWithStream('GetReader'); + + this._reader = readableStream.getReader(); + this._headersReady = this._msgHandler.sendWithPromise('ReaderHeadersReady').then(function (data) { + _this._isStreamingSupported = data.isStreamingSupported; + _this._isRangeSupported = data.isRangeSupported; + _this._contentLength = data.contentLength; + }); + } + + _createClass(PDFWorkerStreamReader, [{ + key: "read", + value: function () { + var _read = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee() { + var _ref, value, done; + + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return this._reader.read(); + + case 2: + _ref = _context.sent; + value = _ref.value; + done = _ref.done; + + if (!done) { + _context.next = 7; + break; + } + + return _context.abrupt("return", { + value: undefined, + done: true + }); + + case 7: + return _context.abrupt("return", { + value: value.buffer, + done: false + }); + + case 8: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function read() { + return _read.apply(this, arguments); + } + + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + this._reader.cancel(reason); + } + }, { + key: "headersReady", + get: function get() { + return this._headersReady; + } + }, { + key: "contentLength", + get: function get() { + return this._contentLength; + } + }, { + key: "isStreamingSupported", + get: function get() { + return this._isStreamingSupported; + } + }, { + key: "isRangeSupported", + get: function get() { + return this._isRangeSupported; + } + }]); + + return PDFWorkerStreamReader; +}(); + +var PDFWorkerStreamRangeReader = +/*#__PURE__*/ +function () { + function PDFWorkerStreamRangeReader(begin, end, msgHandler) { + _classCallCheck(this, PDFWorkerStreamRangeReader); + + this._msgHandler = msgHandler; + this.onProgress = null; + + var readableStream = this._msgHandler.sendWithStream('GetRangeReader', { + begin: begin, + end: end + }); + + this._reader = readableStream.getReader(); + } + + _createClass(PDFWorkerStreamRangeReader, [{ + key: "read", + value: function () { + var _read2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee2() { + var _ref2, value, done; + + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return this._reader.read(); + + case 2: + _ref2 = _context2.sent; + value = _ref2.value; + done = _ref2.done; + + if (!done) { + _context2.next = 7; + break; + } + + return _context2.abrupt("return", { + value: undefined, + done: true + }); + + case 7: + return _context2.abrupt("return", { + value: value.buffer, + done: false + }); + + case 8: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function read() { + return _read2.apply(this, arguments); + } + + return read; + }() + }, { + key: "cancel", + value: function cancel(reason) { + this._reader.cancel(reason); + } + }, { + key: "isStreamingSupported", + get: function get() { + return false; + } + }]); + + return PDFWorkerStreamRangeReader; +}(); + /***/ }) /******/ ]); }); diff --git a/cps/static/js/libs/viewer.js b/cps/static/js/libs/viewer.js index 387eea34..1adf130b 100644 --- a/cps/static/js/libs/viewer.js +++ b/cps/static/js/libs/viewer.js @@ -2,7 +2,7 @@ * @licstart The following is the entire license notice for the * Javascript code in this page * - * Copyright 2018 Mozilla Foundation + * Copyright 2019 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,15 +117,15 @@ var pdfjsWebApp, pdfjsWebAppOptions; { pdfjsWebApp = __webpack_require__(1); - pdfjsWebAppOptions = __webpack_require__(12); + pdfjsWebAppOptions = __webpack_require__(6); } ; { - __webpack_require__(37); + __webpack_require__(36); } ; { - __webpack_require__(42); + __webpack_require__(41); } function getViewerConfiguration() { @@ -281,51 +281,51 @@ exports.PDFPrintServiceFactory = exports.DefaultExternalServices = exports.PDFVi var _regenerator = _interopRequireDefault(__webpack_require__(2)); -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdfjsLib = __webpack_require__(7); +var _app_options = __webpack_require__(6); -var _pdf_cursor_tools = __webpack_require__(8); +var _pdfjsLib = __webpack_require__(7); -var _pdf_rendering_queue = __webpack_require__(10); +var _pdf_cursor_tools = __webpack_require__(9); -var _pdf_sidebar = __webpack_require__(11); +var _pdf_rendering_queue = __webpack_require__(11); -var _app_options = __webpack_require__(12); +var _pdf_sidebar = __webpack_require__(12); -var _overlay_manager = __webpack_require__(14); +var _overlay_manager = __webpack_require__(13); -var _password_prompt = __webpack_require__(15); +var _password_prompt = __webpack_require__(14); -var _pdf_attachment_viewer = __webpack_require__(16); +var _pdf_attachment_viewer = __webpack_require__(15); -var _pdf_document_properties = __webpack_require__(17); +var _pdf_document_properties = __webpack_require__(16); -var _pdf_find_bar = __webpack_require__(18); +var _pdf_find_bar = __webpack_require__(17); -var _pdf_find_controller = __webpack_require__(19); +var _pdf_find_controller = __webpack_require__(18); -var _pdf_history = __webpack_require__(21); +var _pdf_history = __webpack_require__(20); -var _pdf_link_service = __webpack_require__(22); +var _pdf_link_service = __webpack_require__(21); -var _pdf_outline_viewer = __webpack_require__(23); +var _pdf_outline_viewer = __webpack_require__(22); -var _pdf_presentation_mode = __webpack_require__(24); +var _pdf_presentation_mode = __webpack_require__(23); -var _pdf_sidebar_resizer = __webpack_require__(25); +var _pdf_sidebar_resizer = __webpack_require__(24); -var _pdf_thumbnail_viewer = __webpack_require__(26); +var _pdf_thumbnail_viewer = __webpack_require__(25); -var _pdf_viewer = __webpack_require__(28); +var _pdf_viewer = __webpack_require__(27); -var _secondary_toolbar = __webpack_require__(33); +var _secondary_toolbar = __webpack_require__(32); -var _toolbar = __webpack_require__(35); +var _toolbar = __webpack_require__(34); -var _view_history = __webpack_require__(36); +var _view_history = __webpack_require__(35); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } @@ -411,11 +411,11 @@ var PDFViewerApplication = { initialize: function () { var _initialize = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(appConfig) { + _regenerator["default"].mark(function _callee(appConfig) { var _this = this; var appContainer; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -468,9 +468,9 @@ var PDFViewerApplication = { _readPreferences: function () { var _readPreferences2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2() { + _regenerator["default"].mark(function _callee2() { var prefs, name; - return _regenerator.default.wrap(function _callee2$(_context2) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -493,14 +493,15 @@ var PDFViewerApplication = { _app_options.AppOptions.set(name, prefs[name]); } - _context2.next = 11; + _context2.next = 12; break; case 9: _context2.prev = 9; _context2.t0 = _context2["catch"](2); + console.error("_readPreferences: \"".concat(_context2.t0.message, "\".")); - case 11: + case 12: case "end": return _context2.stop(); } @@ -517,9 +518,9 @@ var PDFViewerApplication = { _parseHashParameters: function () { var _parseHashParameters2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee3() { + _regenerator["default"].mark(function _callee3() { var waitOn, hash, hashParams, viewer, enabled; - return _regenerator.default.wrap(function _callee3$(_context3) { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -528,7 +529,7 @@ var PDFViewerApplication = { break; } - return _context3.abrupt("return"); + return _context3.abrupt("return", undefined); case 2: waitOn = []; @@ -602,7 +603,7 @@ var PDFViewerApplication = { _app_options.AppOptions.set('locale', hashParams['locale']); } - return _context3.abrupt("return", Promise.all(waitOn).catch(function (reason) { + return _context3.abrupt("return", Promise.all(waitOn)["catch"](function (reason) { console.error("_parseHashParameters: \"".concat(reason.message, "\".")); })); @@ -623,9 +624,9 @@ var PDFViewerApplication = { _initializeL10n: function () { var _initializeL10n2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee4() { + _regenerator["default"].mark(function _callee4() { var dir; - return _regenerator.default.wrap(function _callee4$(_context4) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: @@ -656,16 +657,15 @@ var PDFViewerApplication = { _initializeViewerComponents: function () { var _initializeViewerComponents2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee5() { - var appConfig, dispatchToDOM, eventBus, pdfRenderingQueue, pdfLinkService, downloadManager, findController, container, viewer, thumbnailContainer, sidebarConfig; - return _regenerator.default.wrap(function _callee5$(_context5) { + _regenerator["default"].mark(function _callee5() { + var appConfig, eventBus, pdfRenderingQueue, pdfLinkService, downloadManager, findController, container, viewer; + return _regenerator["default"].wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: appConfig = this.appConfig; this.overlayManager = new _overlay_manager.OverlayManager(); - dispatchToDOM = _app_options.AppOptions.get('eventBusDispatchToDOM'); - eventBus = appConfig.eventBus || (0, _ui_utils.getGlobalEventBus)(dispatchToDOM); + eventBus = appConfig.eventBus || (0, _ui_utils.getGlobalEventBus)(_app_options.AppOptions.get('eventBusDispatchToDOM')); this.eventBus = eventBus; pdfRenderingQueue = new _pdf_rendering_queue.PDFRenderingQueue(); pdfRenderingQueue.onIdle = this.cleanup.bind(this); @@ -707,9 +707,8 @@ var PDFViewerApplication = { }); pdfRenderingQueue.setViewer(this.pdfViewer); pdfLinkService.setViewer(this.pdfViewer); - thumbnailContainer = appConfig.sidebar.thumbnailView; this.pdfThumbnailViewer = new _pdf_thumbnail_viewer.PDFThumbnailViewer({ - container: thumbnailContainer, + container: appConfig.sidebar.thumbnailView, renderingQueue: pdfRenderingQueue, linkService: pdfLinkService, l10n: this.l10n @@ -751,14 +750,17 @@ var PDFViewerApplication = { eventBus: eventBus, downloadManager: downloadManager }); - sidebarConfig = Object.create(appConfig.sidebar); - sidebarConfig.pdfViewer = this.pdfViewer; - sidebarConfig.pdfThumbnailViewer = this.pdfThumbnailViewer; - this.pdfSidebar = new _pdf_sidebar.PDFSidebar(sidebarConfig, eventBus, this.l10n); + this.pdfSidebar = new _pdf_sidebar.PDFSidebar({ + elements: appConfig.sidebar, + pdfViewer: this.pdfViewer, + pdfThumbnailViewer: this.pdfThumbnailViewer, + eventBus: eventBus, + l10n: this.l10n + }); this.pdfSidebar.onToggled = this.forceRendering.bind(this); this.pdfSidebarResizer = new _pdf_sidebar_resizer.PDFSidebarResizer(appConfig.sidebarResizer, eventBus, this.l10n); - case 39: + case 34: case "end": return _context5.stop(); } @@ -797,6 +799,17 @@ var PDFViewerApplication = { this.pdfViewer.currentScaleValue = newScale; }, + zoomReset: function zoomReset() { + var ignoreDuplicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + if (this.pdfViewer.isInPresentationMode) { + return; + } else if (ignoreDuplicate && this.pdfViewer.currentScaleValue === _ui_utils.DEFAULT_SCALE_VALUE) { + return; + } + + this.pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; + }, get pagesCount() { return this.pdfDocument ? this.pdfDocument.numPages : 0; @@ -880,9 +893,9 @@ var PDFViewerApplication = { close: function () { var _close = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee6() { + _regenerator["default"].mark(function _callee6() { var errorWrapper, promise; - return _regenerator.default.wrap(function _callee6$(_context6) { + return _regenerator["default"].wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: @@ -894,7 +907,7 @@ var PDFViewerApplication = { break; } - return _context6.abrupt("return"); + return _context6.abrupt("return", undefined); case 4: promise = this.pdfLoadingTask.destroy(); @@ -944,12 +957,12 @@ var PDFViewerApplication = { open: function () { var _open = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee7(file, args) { + _regenerator["default"].mark(function _callee7(file, args) { var _this2 = this; var workerParameters, key, parameters, apiParameters, _key, prop, loadingTask; - return _regenerator.default.wrap(function _callee7$(_context7) { + return _regenerator["default"].wrap(function _callee7$(_context7) { while (1) { switch (_context7.prev = _context7.next) { case 0: @@ -962,7 +975,7 @@ var PDFViewerApplication = { return this.close(); case 3: - workerParameters = _app_options.AppOptions.getAll('worker'); + workerParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.WORKER); for (key in workerParameters) { _pdfjsLib.GlobalWorkerOptions[key] = workerParameters[key]; @@ -980,7 +993,7 @@ var PDFViewerApplication = { parameters.url = file.url; } - apiParameters = _app_options.AppOptions.getAll('api'); + apiParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.API); for (_key in apiParameters) { parameters[_key] = apiParameters[_key]; @@ -1017,7 +1030,7 @@ var PDFViewerApplication = { _this2.load(pdfDocument); }, function (exception) { if (loadingTask !== _this2.pdfLoadingTask) { - return; + return undefined; } var message = exception && exception.message; @@ -1081,7 +1094,7 @@ var PDFViewerApplication = { type: 'application/pdf' }); downloadManager.download(blob, url, filename); - }).catch(downloadByUrl); + })["catch"](downloadByUrl); }, fallback: function fallback(featureId) {}, error: function error(message, moreInfo) { @@ -1194,8 +1207,9 @@ var PDFViewerApplication = { }); }); }); - var pageModePromise = pdfDocument.getPageMode().catch(function () {}); - var openActionDestPromise = pdfDocument.getOpenActionDestination().catch(function () {}); + var pageLayoutPromise = pdfDocument.getPageLayout()["catch"](function () {}); + var pageModePromise = pdfDocument.getPageMode()["catch"](function () {}); + var openActionDestPromise = pdfDocument.getOpenActionDestination()["catch"](function () {}); this.toolbar.setPagesCount(pdfDocument.numPages, false); this.secondaryToolbar.setPagesCount(pdfDocument.numPages); var store = this.store = new _view_history.ViewHistory(pdfDocument.fingerprint); @@ -1222,20 +1236,20 @@ var PDFViewerApplication = { sidebarView: _pdf_sidebar.SidebarView.UNKNOWN, scrollMode: _ui_utils.ScrollMode.UNKNOWN, spreadMode: _ui_utils.SpreadMode.UNKNOWN - }).catch(function () {}); - Promise.all([storePromise, pageModePromise, openActionDestPromise]).then( + })["catch"](function () {}); + Promise.all([storePromise, pageLayoutPromise, pageModePromise, openActionDestPromise]).then( /*#__PURE__*/ function () { var _ref3 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee8(_ref2) { - var _ref4, _ref4$, values, pageMode, openActionDest, viewOnLoad, initialBookmark, zoom, hash, rotation, sidebarView, scrollMode, spreadMode; + _regenerator["default"].mark(function _callee8(_ref2) { + var _ref4, _ref4$, values, pageLayout, pageMode, openActionDest, viewOnLoad, initialBookmark, zoom, hash, rotation, sidebarView, scrollMode, spreadMode; - return _regenerator.default.wrap(function _callee8$(_context8) { + return _regenerator["default"].wrap(function _callee8$(_context8) { while (1) { switch (_context8.prev = _context8.next) { case 0: - _ref4 = _slicedToArray(_ref2, 3), _ref4$ = _ref4[0], values = _ref4$ === void 0 ? {} : _ref4$, pageMode = _ref4[1], openActionDest = _ref4[2]; + _ref4 = _slicedToArray(_ref2, 4), _ref4$ = _ref4[0], values = _ref4$ === void 0 ? {} : _ref4$, pageLayout = _ref4[1], pageMode = _ref4[2], openActionDest = _ref4[3]; viewOnLoad = _app_options.AppOptions.get('viewOnLoad'); _this5._initializePdfHistory({ @@ -1273,6 +1287,10 @@ var PDFViewerApplication = { sidebarView = apiPageModeToSidebarView(pageMode); } + if (pageLayout && spreadMode === _ui_utils.SpreadMode.UNKNOWN) { + spreadMode = apiPageLayoutToSpreadMode(pageLayout); + } + _this5.setInitialView(hash, { rotation: rotation, sidebarView: sidebarView, @@ -1288,45 +1306,45 @@ var PDFViewerApplication = { pdfViewer.focus(); } - _context8.next = 17; + _context8.next = 18; return Promise.race([pagesPromise, new Promise(function (resolve) { setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT); })]); - case 17: + case 18: if (!(!initialBookmark && !hash)) { - _context8.next = 19; + _context8.next = 20; break; } return _context8.abrupt("return"); - case 19: + case 20: if (!pdfViewer.hasEqualPageSizes) { - _context8.next = 21; + _context8.next = 22; break; } return _context8.abrupt("return"); - case 21: + case 22: _this5.initialBookmark = initialBookmark; pdfViewer.currentScaleValue = pdfViewer.currentScaleValue; _this5.setInitialView(hash); - case 24: + case 25: case "end": return _context8.stop(); } } - }, _callee8, this); + }, _callee8); })); return function (_x4) { return _ref3.apply(this, arguments); }; - }()).catch(function () { + }())["catch"](function () { _this5.setInitialView(); }).then(function () { pdfViewer.update(); @@ -1614,6 +1632,7 @@ var PDFViewerApplication = { eventBus.on('previouspage', webViewerPreviousPage); eventBus.on('zoomin', webViewerZoomIn); eventBus.on('zoomout', webViewerZoomOut); + eventBus.on('zoomreset', webViewerZoomReset); eventBus.on('pagenumberchanged', webViewerPageNumberChanged); eventBus.on('scalechanged', webViewerScaleChanged); eventBus.on('rotatecw', webViewerRotateCw); @@ -1659,7 +1678,9 @@ var PDFViewerApplication = { }; window.addEventListener('visibilitychange', webViewerVisibilityChange); - window.addEventListener('wheel', webViewerWheel); + window.addEventListener('wheel', webViewerWheel, { + passive: false + }); window.addEventListener('click', webViewerClick); window.addEventListener('keydown', webViewerKeyDown); window.addEventListener('resize', _boundEvents.windowResize); @@ -1694,6 +1715,7 @@ var PDFViewerApplication = { eventBus.off('previouspage', webViewerPreviousPage); eventBus.off('zoomin', webViewerZoomIn); eventBus.off('zoomout', webViewerZoomOut); + eventBus.off('zoomreset', webViewerZoomReset); eventBus.off('pagenumberchanged', webViewerPageNumberChanged); eventBus.off('scalechanged', webViewerScaleChanged); eventBus.off('rotatecw', webViewerRotateCw); @@ -1979,7 +2001,7 @@ function webViewerSidebarViewChanged(evt) { var store = PDFViewerApplication.store; if (store && PDFViewerApplication.isInitialViewSet) { - store.set('sidebarView', evt.view).catch(function () {}); + store.set('sidebarView', evt.view)["catch"](function () {}); } } @@ -1994,7 +2016,7 @@ function webViewerUpdateViewarea(evt) { 'scrollLeft': location.left, 'scrollTop': location.top, 'rotation': location.rotation - }).catch(function () {}); + })["catch"](function () {}); } var href = PDFViewerApplication.pdfLinkService.getAnchorUrl(location.pdfOpenParams); @@ -2009,7 +2031,7 @@ function webViewerScrollModeChanged(evt) { var store = PDFViewerApplication.store; if (store && PDFViewerApplication.isInitialViewSet) { - store.set('scrollMode', evt.mode).catch(function () {}); + store.set('scrollMode', evt.mode)["catch"](function () {}); } } @@ -2017,7 +2039,7 @@ function webViewerSpreadModeChanged(evt) { var store = PDFViewerApplication.store; if (store && PDFViewerApplication.isInitialViewSet) { - store.set('spreadMode', evt.mode).catch(function () {}); + store.set('spreadMode', evt.mode)["catch"](function () {}); } } @@ -2137,6 +2159,10 @@ function webViewerZoomOut() { PDFViewerApplication.zoomOut(); } +function webViewerZoomReset(evt) { + PDFViewerApplication.zoomReset(evt && evt.ignoreDuplicate); +} + function webViewerPageNumberChanged(evt) { var pdfViewer = PDFViewerApplication.pdfViewer; @@ -2392,7 +2418,7 @@ function webViewerKeyDown(evt) { case 96: if (!isViewerInPresentationMode) { setTimeout(function () { - pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; + PDFViewerApplication.zoomReset(); }); handled = false; } @@ -2619,6 +2645,24 @@ function webViewerKeyDown(evt) { } } +function apiPageLayoutToSpreadMode(layout) { + switch (layout) { + case 'SinglePage': + case 'OneColumn': + return _ui_utils.SpreadMode.NONE; + + case 'TwoColumnLeft': + case 'TwoPageLeft': + return _ui_utils.SpreadMode.ODD; + + case 'TwoColumnRight': + case 'TwoPageRight': + return _ui_utils.SpreadMode.EVEN; + } + + return _ui_utils.SpreadMode.NONE; +} + function apiPageModeToSidebarView(mode) { switch (mode) { case 'UseNone': @@ -2662,40 +2706,12 @@ module.exports = __webpack_require__(3); /* 3 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -var g = function () { - return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; -}() || Function("return this")(); - -var hadRuntime = g.regeneratorRuntime && Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; -var oldRuntime = hadRuntime && g.regeneratorRuntime; -g.regeneratorRuntime = undefined; -module.exports = __webpack_require__(4); - -if (hadRuntime) { - g.regeneratorRuntime = oldRuntime; -} else { - try { - delete g.regeneratorRuntime; - } catch (e) { - g.regeneratorRuntime = undefined; - } -} - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - "use strict"; /* WEBPACK VAR INJECTION */(function(module) { function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -!function (global) { +var runtime = function (exports) { "use strict"; var Op = Object.prototype; @@ -2705,18 +2721,6 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - var inModule = ( false ? undefined : _typeof(module)) === "object"; - var runtime = global.regeneratorRuntime; - - if (runtime) { - if (inModule) { - module.exports = runtime; - } - - return; - } - - runtime = global.regeneratorRuntime = inModule ? module.exports : {}; function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; @@ -2726,7 +2730,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return generator; } - runtime.wrap = wrap; + exports.wrap = wrap; function tryCatch(fn, obj, arg) { try { @@ -2780,12 +2784,12 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat }); } - runtime.isGeneratorFunction = function (genFun) { + exports.isGeneratorFunction = function (genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; - runtime.mark = function (genFun) { + exports.mark = function (genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { @@ -2800,7 +2804,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return genFun; }; - runtime.awrap = function (arg) { + exports.awrap = function (arg) { return { __await: arg }; @@ -2854,11 +2858,11 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return this; }; - runtime.AsyncIterator = AsyncIterator; + exports.AsyncIterator = AsyncIterator; - runtime.async = function (innerFn, outerFn, self, tryLocsList) { + exports.async = function (innerFn, outerFn, self, tryLocsList) { var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); - return runtime.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { + return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }; @@ -2936,7 +2940,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat context.delegate = null; if (context.method === "throw") { - if (delegate.iterator.return) { + if (delegate.iterator["return"]) { context.method = "return"; context.arg = undefined; maybeInvokeDelegate(delegate, context); @@ -3030,7 +3034,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat this.reset(true); } - runtime.keys = function (object) { + exports.keys = function (object) { var keys = []; for (var key in object) { @@ -3091,7 +3095,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat }; } - runtime.values = values; + exports.values = values; function doneResult() { return { @@ -3269,13 +3273,18 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat return ContinueSentinel; } }; -}(function () { - return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; -}() || Function("return this")()); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5)(module))) + return exports; +}(( false ? undefined : _typeof(module)) === "object" ? module.exports : {}); + +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + Function("r", "regeneratorRuntime = r")(runtime); +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4)(module))) /***/ }), -/* 5 */ +/* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3306,7 +3315,7 @@ module.exports = function (module) { }; /***/ }), -/* 6 */ +/* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3339,7 +3348,7 @@ exports.WaitOnType = exports.animationStarted = exports.ProgressBar = exports.Ev var _regenerator = _interopRequireDefault(__webpack_require__(2)); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -3426,8 +3435,8 @@ var NullL10n = { getLanguage: function () { var _getLanguage = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee() { - return _regenerator.default.wrap(function _callee$(_context) { + _regenerator["default"].mark(function _callee() { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -3438,7 +3447,7 @@ var NullL10n = { return _context.stop(); } } - }, _callee, this); + }, _callee); })); function getLanguage() { @@ -3450,8 +3459,8 @@ var NullL10n = { getDirection: function () { var _getDirection = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2() { - return _regenerator.default.wrap(function _callee2$(_context2) { + _regenerator["default"].mark(function _callee2() { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -3462,7 +3471,7 @@ var NullL10n = { return _context2.stop(); } } - }, _callee2, this); + }, _callee2); })); function getDirection() { @@ -3474,8 +3483,8 @@ var NullL10n = { get: function () { var _get = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee3(property, args, fallback) { - return _regenerator.default.wrap(function _callee3$(_context3) { + _regenerator["default"].mark(function _callee3(property, args, fallback) { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -3486,7 +3495,7 @@ var NullL10n = { return _context3.stop(); } } - }, _callee3, this); + }, _callee3); })); function get(_x, _x2, _x3) { @@ -3498,8 +3507,8 @@ var NullL10n = { translate: function () { var _translate = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee4(element) { - return _regenerator.default.wrap(function _callee4$(_context4) { + _regenerator["default"].mark(function _callee4(element) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: @@ -3507,7 +3516,7 @@ var NullL10n = { return _context4.stop(); } } - }, _callee4, this); + }, _callee4); })); function translate(_x4) { @@ -4189,24 +4198,7 @@ function moveToEndOfArray(arr, condition) { } /***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var pdfjsLib; - -if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) { - pdfjsLib = window['pdfjs-dist/build/pdf']; -} else { - pdfjsLib = require('../build/pdf.js'); -} - -module.exports = pdfjsLib; - -/***/ }), -/* 8 */ +/* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4215,9 +4207,13 @@ module.exports = pdfjsLib; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PDFCursorTools = exports.CursorTool = void 0; +exports.OptionKind = exports.AppOptions = void 0; + +var _pdfjsLib = __webpack_require__(7); + +var _viewer_compatibility = __webpack_require__(8); -var _grab_to_pan = __webpack_require__(9); +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -4225,39 +4221,344 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -var CursorTool = { - SELECT: 0, - HAND: 1, - ZOOM: 2 +var OptionKind = { + VIEWER: 0x02, + API: 0x04, + WORKER: 0x08, + PREFERENCE: 0x80 }; -exports.CursorTool = CursorTool; +exports.OptionKind = OptionKind; +var defaultOptions = { + cursorToolOnLoad: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + defaultUrl: { + value: 'compressed.tracemonkey-pldi-09.pdf', + kind: OptionKind.VIEWER + }, + defaultZoomValue: { + value: '', + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + disableHistory: { + value: false, + kind: OptionKind.VIEWER + }, + disablePageLabels: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enablePrintAutoRotate: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableWebGL: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + eventBusDispatchToDOM: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + externalLinkRel: { + value: 'noopener noreferrer nofollow', + kind: OptionKind.VIEWER + }, + externalLinkTarget: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + historyUpdateUrl: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + imageResourcesPath: { + value: './images/', + kind: OptionKind.VIEWER + }, + maxCanvasPixels: { + value: 16777216, + compatibility: _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels, + kind: OptionKind.VIEWER + }, + pdfBugEnabled: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + renderer: { + value: 'canvas', + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + renderInteractiveForms: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + sidebarViewOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + scrollModeOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + spreadModeOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + textLayerMode: { + value: 1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + useOnlyCssZoom: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + viewOnLoad: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + cMapPacked: { + value: true, + kind: OptionKind.API + }, + cMapUrl: { + value: '../web/cmaps/', + kind: OptionKind.API + }, + disableAutoFetch: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableCreateObjectURL: { + value: false, + compatibility: _pdfjsLib.apiCompatibilityParams.disableCreateObjectURL, + kind: OptionKind.API + }, + disableFontFace: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableRange: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableStream: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + isEvalSupported: { + value: true, + kind: OptionKind.API + }, + maxImageSize: { + value: -1, + kind: OptionKind.API + }, + pdfBug: { + value: false, + kind: OptionKind.API + }, + postMessageTransfers: { + value: true, + kind: OptionKind.API + }, + verbosity: { + value: 1, + kind: OptionKind.API + }, + workerPort: { + value: null, + kind: OptionKind.WORKER + }, + workerSrc: { + value: '../build/pdf.worker.js', + kind: OptionKind.WORKER + } +}; +{ + defaultOptions.disablePreferences = { + value: false, + kind: OptionKind.VIEWER + }; + defaultOptions.locale = { + value: typeof navigator !== 'undefined' ? navigator.language : 'en-US', + kind: OptionKind.VIEWER + }; + defaultOptions.printResolution = { + value: 150, + kind: OptionKind.VIEWER + }; +} +var userOptions = Object.create(null); -var PDFCursorTools = +var AppOptions = /*#__PURE__*/ function () { - function PDFCursorTools(_ref) { - var _this = this; + function AppOptions() { + _classCallCheck(this, AppOptions); - var container = _ref.container, - eventBus = _ref.eventBus, - _ref$cursorToolOnLoad = _ref.cursorToolOnLoad, - cursorToolOnLoad = _ref$cursorToolOnLoad === void 0 ? CursorTool.SELECT : _ref$cursorToolOnLoad; + throw new Error('Cannot initialize AppOptions.'); + } - _classCallCheck(this, PDFCursorTools); + _createClass(AppOptions, null, [{ + key: "get", + value: function get(name) { + var userOption = userOptions[name]; - this.container = container; - this.eventBus = eventBus; - this.active = CursorTool.SELECT; - this.activeBeforePresentationMode = null; - this.handTool = new _grab_to_pan.GrabToPan({ - element: this.container - }); + if (userOption !== undefined) { + return userOption; + } - this._addEventListeners(); + var defaultOption = defaultOptions[name]; - Promise.resolve().then(function () { - _this.switchTool(cursorToolOnLoad); - }); + if (defaultOption !== undefined) { + return defaultOption.compatibility || defaultOption.value; + } + + return undefined; + } + }, { + key: "getAll", + value: function getAll() { + var kind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var options = Object.create(null); + + for (var name in defaultOptions) { + var defaultOption = defaultOptions[name]; + + if (kind) { + if ((kind & defaultOption.kind) === 0) { + continue; + } + + if (kind === OptionKind.PREFERENCE) { + var value = defaultOption.value, + valueType = _typeof(value); + + if (valueType === 'boolean' || valueType === 'string' || valueType === 'number' && Number.isInteger(value)) { + options[name] = value; + continue; + } + + throw new Error("Invalid type for preference: ".concat(name)); + } + } + + var userOption = userOptions[name]; + options[name] = userOption !== undefined ? userOption : defaultOption.compatibility || defaultOption.value; + } + + return options; + } + }, { + key: "set", + value: function set(name, value) { + userOptions[name] = value; + } + }, { + key: "remove", + value: function remove(name) { + delete userOptions[name]; + } + }]); + + return AppOptions; +}(); + +exports.AppOptions = AppOptions; + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var pdfjsLib; + +if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) { + pdfjsLib = window['pdfjs-dist/build/pdf']; +} else { + pdfjsLib = require('../build/pdf.js'); +} + +module.exports = pdfjsLib; + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var compatibilityParams = Object.create(null); +{ + var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || ''; + var isAndroid = /Android/.test(userAgent); + var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); + + (function checkCanvasSizeLimitation() { + if (isIOS || isAndroid) { + compatibilityParams.maxCanvasPixels = 5242880; + } + })(); +} +exports.viewerCompatibilityParams = Object.freeze(compatibilityParams); + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFCursorTools = exports.CursorTool = void 0; + +var _grab_to_pan = __webpack_require__(10); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var CursorTool = { + SELECT: 0, + HAND: 1, + ZOOM: 2 +}; +exports.CursorTool = CursorTool; + +var PDFCursorTools = +/*#__PURE__*/ +function () { + function PDFCursorTools(_ref) { + var _this = this; + + var container = _ref.container, + eventBus = _ref.eventBus, + _ref$cursorToolOnLoad = _ref.cursorToolOnLoad, + cursorToolOnLoad = _ref$cursorToolOnLoad === void 0 ? CursorTool.SELECT : _ref$cursorToolOnLoad; + + _classCallCheck(this, PDFCursorTools); + + this.container = container; + this.eventBus = eventBus; + this.active = CursorTool.SELECT; + this.activeBeforePresentationMode = null; + this.handTool = new _grab_to_pan.GrabToPan({ + element: this.container + }); + + this._addEventListeners(); + + Promise.resolve().then(function () { + _this.switchTool(cursorToolOnLoad); + }); } _createClass(PDFCursorTools, [{ @@ -4357,7 +4658,7 @@ function () { exports.PDFCursorTools = PDFCursorTools; /***/ }), -/* 9 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4517,10 +4818,12 @@ function isLeftMouseReleased(event) { if (isChrome15OrOpera15plus || isSafari6plus) { return event.which === 0; } + + return false; } /***/ }), -/* 10 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4609,7 +4912,7 @@ function () { var numVisible = visibleViews.length; if (numVisible === 0) { - return false; + return null; } for (var i = 0; i < numVisible; ++i) { @@ -4661,12 +4964,9 @@ function () { case RenderingStates.INITIAL: this.highestPriorityPage = view.renderingId; - - var continueRendering = function continueRendering() { + view.draw()["finally"](function () { _this.renderHighestPriority(); - }; - - view.draw().then(continueRendering, continueRendering); + }); break; } @@ -4680,7 +4980,7 @@ function () { exports.PDFRenderingQueue = PDFRenderingQueue; /***/ }), -/* 11 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4691,9 +4991,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFSidebar = exports.SidebarView = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdf_rendering_queue = __webpack_require__(10); +var _pdf_rendering_queue = __webpack_require__(11); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -4715,8 +5015,15 @@ exports.SidebarView = SidebarView; var PDFSidebar = /*#__PURE__*/ function () { - function PDFSidebar(options, eventBus) { - var l10n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ui_utils.NullL10n; + function PDFSidebar(_ref) { + var elements = _ref.elements, + pdfViewer = _ref.pdfViewer, + pdfThumbnailViewer = _ref.pdfThumbnailViewer, + eventBus = _ref.eventBus, + _ref$l10n = _ref.l10n, + l10n = _ref$l10n === void 0 ? _ui_utils.NullL10n : _ref$l10n, + _ref$disableNotificat = _ref.disableNotification, + disableNotification = _ref$disableNotificat === void 0 ? false : _ref$disableNotificat; _classCallCheck(this, PDFSidebar); @@ -4724,20 +5031,20 @@ function () { this.active = SidebarView.THUMBS; this.isInitialViewSet = false; this.onToggled = null; - this.pdfViewer = options.pdfViewer; - this.pdfThumbnailViewer = options.pdfThumbnailViewer; - this.outerContainer = options.outerContainer; - this.viewerContainer = options.viewerContainer; - this.toggleButton = options.toggleButton; - this.thumbnailButton = options.thumbnailButton; - this.outlineButton = options.outlineButton; - this.attachmentsButton = options.attachmentsButton; - this.thumbnailView = options.thumbnailView; - this.outlineView = options.outlineView; - this.attachmentsView = options.attachmentsView; - this.disableNotification = options.disableNotification || false; + this.pdfViewer = pdfViewer; + this.pdfThumbnailViewer = pdfThumbnailViewer; + this.outerContainer = elements.outerContainer; + this.viewerContainer = elements.viewerContainer; + this.toggleButton = elements.toggleButton; + this.thumbnailButton = elements.thumbnailButton; + this.outlineButton = elements.outlineButton; + this.attachmentsButton = elements.attachmentsButton; + this.thumbnailView = elements.thumbnailView; + this.outlineView = elements.outlineView; + this.attachmentsView = elements.attachmentsView; this.eventBus = eventBus; this.l10n = l10n; + this._disableNotification = disableNotification; this._addEventListeners(); } @@ -4937,7 +5244,7 @@ function () { value: function _showUINotification(view) { var _this = this; - if (this.disableNotification) { + if (this._disableNotification) { return; } @@ -4966,7 +5273,7 @@ function () { value: function _hideUINotification(view) { var _this2 = this; - if (this.disableNotification) { + if (this._disableNotification) { return; } @@ -5091,255 +5398,6 @@ function () { exports.PDFSidebar = PDFSidebar; -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.OptionKind = exports.AppOptions = void 0; - -var _pdfjsLib = __webpack_require__(7); - -var _viewer_compatibility = __webpack_require__(13); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var OptionKind = { - VIEWER: 'viewer', - API: 'api', - WORKER: 'worker' -}; -exports.OptionKind = OptionKind; -var defaultOptions = { - cursorToolOnLoad: { - value: 0, - kind: OptionKind.VIEWER - }, - defaultUrl: { - kind: OptionKind.VIEWER - }, - defaultZoomValue: { - value: '', - kind: OptionKind.VIEWER - }, - disableHistory: { - value: false, - kind: OptionKind.VIEWER - }, - disablePageLabels: { - value: false, - kind: OptionKind.VIEWER - }, - enablePrintAutoRotate: { - value: false, - kind: OptionKind.VIEWER - }, - enableWebGL: { - value: false, - kind: OptionKind.VIEWER - }, - eventBusDispatchToDOM: { - value: false, - kind: OptionKind.VIEWER - }, - externalLinkRel: { - value: 'noopener noreferrer nofollow', - kind: OptionKind.VIEWER - }, - externalLinkTarget: { - value: 0, - kind: OptionKind.VIEWER - }, - historyUpdateUrl: { - value: false, - kind: OptionKind.VIEWER - }, - imageResourcesPath: { - value: '../images/', - kind: OptionKind.VIEWER - }, - maxCanvasPixels: { - value: 16777216, - compatibility: _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels, - kind: OptionKind.VIEWER - }, - pdfBugEnabled: { - value: false, - kind: OptionKind.VIEWER - }, - renderer: { - value: 'canvas', - kind: OptionKind.VIEWER - }, - renderInteractiveForms: { - value: false, - kind: OptionKind.VIEWER - }, - sidebarViewOnLoad: { - value: -1, - kind: OptionKind.VIEWER - }, - scrollModeOnLoad: { - value: -1, - kind: OptionKind.VIEWER - }, - spreadModeOnLoad: { - value: -1, - kind: OptionKind.VIEWER - }, - textLayerMode: { - value: 1, - kind: OptionKind.VIEWER - }, - useOnlyCssZoom: { - value: false, - kind: OptionKind.VIEWER - }, - viewOnLoad: { - value: 0, - kind: OptionKind.VIEWER - }, - cMapPacked: { - value: true, - kind: OptionKind.API - }, - cMapUrl: { - value: '../web/cmaps/', - kind: OptionKind.API - }, - disableAutoFetch: { - value: false, - kind: OptionKind.API - }, - disableCreateObjectURL: { - value: false, - compatibility: _pdfjsLib.apiCompatibilityParams.disableCreateObjectURL, - kind: OptionKind.API - }, - disableFontFace: { - value: false, - kind: OptionKind.API - }, - disableRange: { - value: false, - kind: OptionKind.API - }, - disableStream: { - value: false, - kind: OptionKind.API - }, - isEvalSupported: { - value: true, - kind: OptionKind.API - }, - maxImageSize: { - value: -1, - kind: OptionKind.API - }, - pdfBug: { - value: false, - kind: OptionKind.API - }, - postMessageTransfers: { - value: true, - kind: OptionKind.API - }, - verbosity: { - value: 1, - kind: OptionKind.API - }, - workerPort: { - value: null, - kind: OptionKind.WORKER - }, - workerSrc: { - value: '../build/pdf.worker.js', - kind: OptionKind.WORKER - } -}; -{ - defaultOptions.disablePreferences = { - value: false, - kind: OptionKind.VIEWER - }; - defaultOptions.locale = { - value: typeof navigator !== 'undefined' ? navigator.language : 'en-US', - kind: OptionKind.VIEWER - }; -} -var userOptions = Object.create(null); - -var AppOptions = -/*#__PURE__*/ -function () { - function AppOptions() { - _classCallCheck(this, AppOptions); - - throw new Error('Cannot initialize AppOptions.'); - } - - _createClass(AppOptions, null, [{ - key: "get", - value: function get(name) { - var userOption = userOptions[name]; - - if (userOption !== undefined) { - return userOption; - } - - var defaultOption = defaultOptions[name]; - - if (defaultOption !== undefined) { - return defaultOption.compatibility || defaultOption.value; - } - - return undefined; - } - }, { - key: "getAll", - value: function getAll() { - var kind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var options = Object.create(null); - - for (var name in defaultOptions) { - var defaultOption = defaultOptions[name]; - - if (kind && kind !== defaultOption.kind) { - continue; - } - - var userOption = userOptions[name]; - options[name] = userOption !== undefined ? userOption : defaultOption.compatibility || defaultOption.value; - } - - return options; - } - }, { - key: "set", - value: function set(name, value) { - userOptions[name] = value; - } - }, { - key: "remove", - value: function remove(name) { - delete userOptions[name]; - } - }]); - - return AppOptions; -}(); - -exports.AppOptions = AppOptions; - /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { @@ -5347,27 +5405,6 @@ exports.AppOptions = AppOptions; "use strict"; -var compatibilityParams = Object.create(null); -{ - var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || ''; - var isAndroid = /Android/.test(userAgent); - var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); - - (function checkCanvasSizeLimitation() { - if (isIOS || isAndroid) { - compatibilityParams.maxCanvasPixels = 5242880; - } - })(); -} -exports.viewerCompatibilityParams = Object.freeze(compatibilityParams); - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - Object.defineProperty(exports, "__esModule", { value: true }); @@ -5375,7 +5412,7 @@ exports.OverlayManager = void 0; var _regenerator = _interopRequireDefault(__webpack_require__(2)); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } @@ -5403,12 +5440,12 @@ function () { value: function () { var _register = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(name, element) { + _regenerator["default"].mark(function _callee(name, element) { var callerCloseMethod, canForceClose, container, _args = arguments; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -5457,8 +5494,8 @@ function () { value: function () { var _unregister = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2(name) { - return _regenerator.default.wrap(function _callee2$(_context2) { + _regenerator["default"].mark(function _callee2(name) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -5499,8 +5536,8 @@ function () { value: function () { var _open = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee3(name) { - return _regenerator.default.wrap(function _callee3$(_context3) { + _regenerator["default"].mark(function _callee3(name) { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -5566,8 +5603,8 @@ function () { value: function () { var _close = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee4(name) { - return _regenerator.default.wrap(function _callee4$(_context4) { + _regenerator["default"].mark(function _callee4(name) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: @@ -5649,7 +5686,7 @@ function () { exports.OverlayManager = OverlayManager; /***/ }), -/* 15 */ +/* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5660,7 +5697,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.PasswordPrompt = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); var _pdfjsLib = __webpack_require__(7); @@ -5737,7 +5774,7 @@ function () { if (password && password.length > 0) { this.close(); - return this.updateCallback(password); + this.updateCallback(password); } } }, { @@ -5754,7 +5791,7 @@ function () { exports.PasswordPrompt = PasswordPrompt; /***/ }), -/* 16 */ +/* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5928,7 +5965,7 @@ function () { exports.PDFAttachmentViewer = PDFAttachmentViewer; /***/ }), -/* 17 */ +/* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -5939,9 +5976,17 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFDocumentProperties = void 0; -var _ui_utils = __webpack_require__(6); +var _regenerator = _interopRequireDefault(__webpack_require__(2)); + +var _pdfjsLib = __webpack_require__(7); + +var _ui_utils = __webpack_require__(5); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _pdfjsLib = __webpack_require__(7); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } @@ -6165,136 +6210,197 @@ function () { } }, { key: "_parseFileSize", - value: function _parseFileSize() { - var fileSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - var kb = fileSize / 1024; + value: function () { + var _parseFileSize2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee() { + var fileSize, + kb, + _args = arguments; + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + fileSize = _args.length > 0 && _args[0] !== undefined ? _args[0] : 0; + kb = fileSize / 1024; - if (!kb) { - return Promise.resolve(undefined); - } else if (kb < 1024) { - return this.l10n.get('document_properties_kb', { - size_kb: (+kb.toPrecision(3)).toLocaleString(), - size_b: fileSize.toLocaleString() - }, '{{size_kb}} KB ({{size_b}} bytes)'); + if (kb) { + _context.next = 6; + break; + } + + return _context.abrupt("return", undefined); + + case 6: + if (!(kb < 1024)) { + _context.next = 8; + break; + } + + return _context.abrupt("return", this.l10n.get('document_properties_kb', { + size_kb: (+kb.toPrecision(3)).toLocaleString(), + size_b: fileSize.toLocaleString() + }, '{{size_kb}} KB ({{size_b}} bytes)')); + + case 8: + return _context.abrupt("return", this.l10n.get('document_properties_mb', { + size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(), + size_b: fileSize.toLocaleString() + }, '{{size_mb}} MB ({{size_b}} bytes)')); + + case 9: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function _parseFileSize() { + return _parseFileSize2.apply(this, arguments); } - return this.l10n.get('document_properties_mb', { - size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(), - size_b: fileSize.toLocaleString() - }, '{{size_mb}} MB ({{size_b}} bytes)'); - } + return _parseFileSize; + }() }, { key: "_parsePageSize", - value: function _parsePageSize(pageSizeInches, pagesRotation) { - var _this3 = this; + value: function () { + var _parsePageSize2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee2(pageSizeInches, pagesRotation) { + var _this3 = this; - if (!pageSizeInches) { - return Promise.resolve(undefined); - } + var isPortrait, sizeInches, sizeMillimeters, pageName, name, exactMillimeters, intMillimeters; + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (pageSizeInches) { + _context2.next = 2; + break; + } - if (pagesRotation % 180 !== 0) { - pageSizeInches = { - width: pageSizeInches.height, - height: pageSizeInches.width - }; - } + return _context2.abrupt("return", undefined); - var isPortrait = (0, _ui_utils.isPortraitOrientation)(pageSizeInches); - var sizeInches = { - width: Math.round(pageSizeInches.width * 100) / 100, - height: Math.round(pageSizeInches.height * 100) / 100 - }; - var sizeMillimeters = { - width: Math.round(pageSizeInches.width * 25.4 * 10) / 10, - height: Math.round(pageSizeInches.height * 25.4 * 10) / 10 - }; - var pageName = null; - var name = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES); + case 2: + if (pagesRotation % 180 !== 0) { + pageSizeInches = { + width: pageSizeInches.height, + height: pageSizeInches.width + }; + } - if (!name && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) { - var exactMillimeters = { - width: pageSizeInches.width * 25.4, - height: pageSizeInches.height * 25.4 - }; - var intMillimeters = { - width: Math.round(sizeMillimeters.width), - height: Math.round(sizeMillimeters.height) - }; + isPortrait = (0, _ui_utils.isPortraitOrientation)(pageSizeInches); + sizeInches = { + width: Math.round(pageSizeInches.width * 100) / 100, + height: Math.round(pageSizeInches.height * 100) / 100 + }; + sizeMillimeters = { + width: Math.round(pageSizeInches.width * 25.4 * 10) / 10, + height: Math.round(pageSizeInches.height * 25.4 * 10) / 10 + }; + pageName = null; + name = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES); + + if (!name && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) { + exactMillimeters = { + width: pageSizeInches.width * 25.4, + height: pageSizeInches.height * 25.4 + }; + intMillimeters = { + width: Math.round(sizeMillimeters.width), + height: Math.round(sizeMillimeters.height) + }; + + if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) { + name = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES); + + if (name) { + sizeInches = { + width: Math.round(intMillimeters.width / 25.4 * 100) / 100, + height: Math.round(intMillimeters.height / 25.4 * 100) / 100 + }; + sizeMillimeters = intMillimeters; + } + } + } + + if (name) { + pageName = this.l10n.get('document_properties_page_size_name_' + name.toLowerCase(), null, name); + } - if (Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 && Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1) { - name = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES); + return _context2.abrupt("return", Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get('document_properties_page_size_unit_' + (this._isNonMetricLocale ? 'inches' : 'millimeters'), null, this._isNonMetricLocale ? 'in' : 'mm'), pageName, this.l10n.get('document_properties_page_size_orientation_' + (isPortrait ? 'portrait' : 'landscape'), null, isPortrait ? 'portrait' : 'landscape')]).then(function (_ref6) { + var _ref7 = _slicedToArray(_ref6, 4), + _ref7$ = _ref7[0], + width = _ref7$.width, + height = _ref7$.height, + unit = _ref7[1], + name = _ref7[2], + orientation = _ref7[3]; + + return _this3.l10n.get('document_properties_page_size_dimension_' + (name ? 'name_' : '') + 'string', { + width: width.toLocaleString(), + height: height.toLocaleString(), + unit: unit, + name: name, + orientation: orientation + }, '{{width}} × {{height}} {{unit}} (' + (name ? '{{name}}, ' : '') + '{{orientation}})'); + })); - if (name) { - sizeInches = { - width: Math.round(intMillimeters.width / 25.4 * 100) / 100, - height: Math.round(intMillimeters.height / 25.4 * 100) / 100 - }; - sizeMillimeters = intMillimeters; + case 11: + case "end": + return _context2.stop(); + } } - } - } + }, _callee2, this); + })); - if (name) { - pageName = this.l10n.get('document_properties_page_size_name_' + name.toLowerCase(), null, name); + function _parsePageSize(_x, _x2) { + return _parsePageSize2.apply(this, arguments); } - return Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get('document_properties_page_size_unit_' + (this._isNonMetricLocale ? 'inches' : 'millimeters'), null, this._isNonMetricLocale ? 'in' : 'mm'), pageName, this.l10n.get('document_properties_page_size_orientation_' + (isPortrait ? 'portrait' : 'landscape'), null, isPortrait ? 'portrait' : 'landscape')]).then(function (_ref6) { - var _ref7 = _slicedToArray(_ref6, 4), - _ref7$ = _ref7[0], - width = _ref7$.width, - height = _ref7$.height, - unit = _ref7[1], - name = _ref7[2], - orientation = _ref7[3]; - - return _this3.l10n.get('document_properties_page_size_dimension_' + (name ? 'name_' : '') + 'string', { - width: width.toLocaleString(), - height: height.toLocaleString(), - unit: unit, - name: name, - orientation: orientation - }, '{{width}} × {{height}} {{unit}} (' + (name ? '{{name}}, ' : '') + '{{orientation}})'); - }); - } + return _parsePageSize; + }() }, { key: "_parseDate", - value: function _parseDate(inputDate) { - if (!inputDate) { - return; - } + value: function () { + var _parseDate2 = _asyncToGenerator( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee3(inputDate) { + var dateObject; + return _regenerator["default"].wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + dateObject = _pdfjsLib.PDFDateString.toDateObject(inputDate); + + if (dateObject) { + _context3.next = 3; + break; + } - var dateToParse = inputDate; + return _context3.abrupt("return", undefined); - if (dateToParse.substring(0, 2) === 'D:') { - dateToParse = dateToParse.substring(2); - } + case 3: + return _context3.abrupt("return", this.l10n.get('document_properties_date_string', { + date: dateObject.toLocaleDateString(), + time: dateObject.toLocaleTimeString() + }, '{{date}}, {{time}}')); - var year = parseInt(dateToParse.substring(0, 4), 10); - var month = parseInt(dateToParse.substring(4, 6), 10) - 1; - var day = parseInt(dateToParse.substring(6, 8), 10); - var hours = parseInt(dateToParse.substring(8, 10), 10); - var minutes = parseInt(dateToParse.substring(10, 12), 10); - var seconds = parseInt(dateToParse.substring(12, 14), 10); - var utRel = dateToParse.substring(14, 15); - var offsetHours = parseInt(dateToParse.substring(15, 17), 10); - var offsetMinutes = parseInt(dateToParse.substring(18, 20), 10); + case 4: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); - if (utRel === '-') { - hours += offsetHours; - minutes += offsetMinutes; - } else if (utRel === '+') { - hours -= offsetHours; - minutes -= offsetMinutes; + function _parseDate(_x3) { + return _parseDate2.apply(this, arguments); } - var date = new Date(Date.UTC(year, month, day, hours, minutes, seconds)); - var dateString = date.toLocaleDateString(); - var timeString = date.toLocaleTimeString(); - return this.l10n.get('document_properties_date_string', { - date: dateString, - time: timeString - }, '{{date}}, {{time}}'); - } + return _parseDate; + }() }, { key: "_parseLinearization", value: function _parseLinearization(isLinearized) { @@ -6308,7 +6414,7 @@ function () { exports.PDFDocumentProperties = PDFDocumentProperties; /***/ }), -/* 18 */ +/* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6319,9 +6425,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFFindBar = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdf_find_controller = __webpack_require__(19); +var _pdf_find_controller = __webpack_require__(18); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -6553,7 +6659,7 @@ function () { exports.PDFFindBar = PDFFindBar; /***/ }), -/* 19 */ +/* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -6564,11 +6670,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFFindController = exports.FindState = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); var _pdfjsLib = __webpack_require__(7); -var _pdf_find_utils = __webpack_require__(20); +var _pdf_find_utils = __webpack_require__(19); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -6774,8 +6880,8 @@ function () { var pageNumber = this._selected.pageIdx + 1; var linkService = this._linkService; - if (pageNumber >= 1 && pageNumber <= linkService.pagesCount && linkService.page !== pageNumber && linkService.isPageVisible && !linkService.isPageVisible(pageNumber)) { - break; + if (pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !linkService.isPageVisible(pageNumber)) { + return true; } return false; @@ -7291,7 +7397,7 @@ function () { exports.PDFFindController = PDFFindController; /***/ }), -/* 20 */ +/* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7387,7 +7493,7 @@ function getCharacterType(charCode) { } /***/ }), -/* 21 */ +/* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7400,7 +7506,7 @@ exports.isDestHashesEqual = isDestHashesEqual; exports.isDestArraysEqual = isDestArraysEqual; exports.PDFHistory = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -7984,7 +8090,7 @@ function isDestArraysEqual(firstDest, secondDest) { } /***/ }), -/* 22 */ +/* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7995,7 +8101,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.SimpleLinkService = exports.PDFLinkService = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -8068,7 +8174,7 @@ function () { namedDest: namedDest, explicitDest: explicitDest }); - }).catch(function () { + })["catch"](function () { console.error("PDFLinkService.navigateTo: \"".concat(destRef, "\" is not ") + "a valid page reference, for dest=\"".concat(dest, "\".")); }); @@ -8467,7 +8573,7 @@ function () { exports.SimpleLinkService = SimpleLinkService; /***/ }), -/* 23 */ +/* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8569,12 +8675,18 @@ function () { } }, { key: "_addToggleButton", - value: function _addToggleButton(div) { + value: function _addToggleButton(div, _ref4) { var _this = this; + var count = _ref4.count, + items = _ref4.items; var toggler = document.createElement('div'); toggler.className = 'outlineItemToggler'; + if (count < 0 && Math.abs(count) === items.length) { + toggler.classList.add('outlineItemsHidden'); + } + toggler.onclick = function (evt) { evt.stopPropagation(); toggler.classList.toggle('outlineItemsHidden'); @@ -8607,8 +8719,8 @@ function () { _iteratorError = err; } finally { try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); } } finally { if (_didIteratorError) { @@ -8628,8 +8740,8 @@ function () { } }, { key: "render", - value: function render(_ref4) { - var outline = _ref4.outline; + value: function render(_ref5) { + var outline = _ref5.outline; var outlineCount = 0; if (this.outline) { @@ -8653,41 +8765,60 @@ function () { while (queue.length > 0) { var levelData = queue.shift(); + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; - for (var i = 0, len = levelData.items.length; i < len; i++) { - var item = levelData.items[i]; - var div = document.createElement('div'); - div.className = 'outlineItem'; - var element = document.createElement('a'); + try { + for (var _iterator2 = levelData.items[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var item = _step2.value; + var div = document.createElement('div'); + div.className = 'outlineItem'; + var element = document.createElement('a'); - this._bindLink(element, item); + this._bindLink(element, item); - this._setStyles(element, item); + this._setStyles(element, item); - element.textContent = (0, _pdfjsLib.removeNullCharacters)(item.title) || DEFAULT_TITLE; - div.appendChild(element); + element.textContent = (0, _pdfjsLib.removeNullCharacters)(item.title) || DEFAULT_TITLE; + div.appendChild(element); - if (item.items.length > 0) { - hasAnyNesting = true; + if (item.items.length > 0) { + hasAnyNesting = true; - this._addToggleButton(div); + this._addToggleButton(div, item); - var itemsDiv = document.createElement('div'); - itemsDiv.className = 'outlineItems'; - div.appendChild(itemsDiv); - queue.push({ - parent: itemsDiv, - items: item.items - }); - } + var itemsDiv = document.createElement('div'); + itemsDiv.className = 'outlineItems'; + div.appendChild(itemsDiv); + queue.push({ + parent: itemsDiv, + items: item.items + }); + } - levelData.parent.appendChild(div); - outlineCount++; + levelData.parent.appendChild(div); + outlineCount++; + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) { + _iterator2["return"](); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } } } if (hasAnyNesting) { this.container.classList.add('outlineWithDeepNesting'); + this.lastToggleIsShow = fragment.querySelectorAll('.outlineItemsHidden').length === 0; } this.container.appendChild(fragment); @@ -8702,7 +8833,7 @@ function () { exports.PDFOutlineViewer = PDFOutlineViewer; /***/ }), -/* 24 */ +/* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8713,7 +8844,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFPresentationMode = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -9160,7 +9291,7 @@ function () { exports.PDFPresentationMode = PDFPresentationMode; /***/ }), -/* 25 */ +/* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9171,7 +9302,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFSidebarResizer = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -9336,7 +9467,7 @@ function () { exports.PDFSidebarResizer = PDFSidebarResizer; /***/ }), -/* 26 */ +/* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9347,9 +9478,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFThumbnailViewer = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdf_thumbnail_view = __webpack_require__(27); +var _pdf_thumbnail_view = __webpack_require__(26); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -9501,7 +9632,7 @@ function () { var thumbnailView = _this._thumbnails[_this._currentPageNumber - 1]; thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS); - }).catch(function (reason) { + })["catch"](function (reason) { console.error('Unable to initialize thumbnail viewer', reason); }); } @@ -9555,7 +9686,7 @@ function () { thumbView.setPdfPage(pdfPage); _this2._pagesRequests[pageNumber] = null; return pdfPage; - }).catch(function (reason) { + })["catch"](function (reason) { console.error('Unable to get page for thumb view', reason); _this2._pagesRequests[pageNumber] = null; }); @@ -9613,7 +9744,7 @@ function () { exports.PDFThumbnailViewer = PDFThumbnailViewer; /***/ }), -/* 27 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -9626,9 +9757,9 @@ exports.PDFThumbnailView = void 0; var _pdfjsLib = __webpack_require__(7); -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdf_rendering_queue = __webpack_require__(10); +var _pdf_rendering_queue = __webpack_require__(11); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -9757,6 +9888,7 @@ function () { key: "reset", value: function reset() { this.cancelRendering(); + this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; this.pageWidth = this.viewport.width; this.pageHeight = this.viewport.height; this.pageRatio = this.pageWidth / this.pageHeight; @@ -9807,7 +9939,6 @@ function () { this.renderTask = null; } - this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; this.resume = null; } }, { @@ -10044,7 +10175,7 @@ function () { exports.PDFThumbnailView = PDFThumbnailView; /***/ }), -/* 28 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10055,7 +10186,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFViewer = void 0; -var _base_viewer = __webpack_require__(29); +var _base_viewer = __webpack_require__(28); var _pdfjsLib = __webpack_require__(7); @@ -10162,8 +10293,8 @@ function (_BaseViewer) { _iteratorError = err; } finally { try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); + if (!_iteratorNormalCompletion && _iterator["return"] != null) { + _iterator["return"](); } } finally { if (_didIteratorError) { @@ -10191,7 +10322,7 @@ function (_BaseViewer) { exports.PDFViewer = PDFViewer; /***/ }), -/* 29 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10202,19 +10333,19 @@ Object.defineProperty(exports, "__esModule", { }); exports.BaseViewer = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdf_rendering_queue = __webpack_require__(10); +var _pdf_rendering_queue = __webpack_require__(11); -var _annotation_layer_builder = __webpack_require__(30); +var _annotation_layer_builder = __webpack_require__(29); var _pdfjsLib = __webpack_require__(7); -var _pdf_page_view = __webpack_require__(31); +var _pdf_page_view = __webpack_require__(30); -var _pdf_link_service = __webpack_require__(22); +var _pdf_link_service = __webpack_require__(21); -var _text_layer_builder = __webpack_require__(32); +var _text_layer_builder = __webpack_require__(31); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -10453,6 +10584,10 @@ function () { } onePageRenderedCapability.promise.then(function () { + if (_this2.findController) { + _this2.findController.setDocument(pdfDocument); + } + if (pdfDocument.loadingParams['disableAutoFetch']) { pagesCapability.resolve(); return; @@ -10491,14 +10626,10 @@ function () { source: _this2 }); - if (_this2.findController) { - _this2.findController.setDocument(pdfDocument); - } - if (_this2.defaultRenderingQueue) { _this2.update(); } - }).catch(function (reason) { + })["catch"](function (reason) { console.error('Unable to initialize viewer', reason); }); } @@ -10957,7 +11088,7 @@ function () { _this3._pagesRequests[pageNumber] = null; return pdfPage; - }).catch(function (reason) { + })["catch"](function (reason) { console.error('Unable to get page for page view', reason); _this3._pagesRequests[pageNumber] = null; }); @@ -11325,7 +11456,7 @@ function () { exports.BaseViewer = BaseViewer; /***/ }), -/* 30 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11338,9 +11469,9 @@ exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = void 0; var _pdfjsLib = __webpack_require__(7); -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdf_link_service = __webpack_require__(22); +var _pdf_link_service = __webpack_require__(21); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -11473,7 +11604,7 @@ function () { exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory; /***/ }), -/* 31 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11486,15 +11617,15 @@ exports.PDFPageView = void 0; var _regenerator = _interopRequireDefault(__webpack_require__(2)); -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); var _pdfjsLib = __webpack_require__(7); -var _pdf_rendering_queue = __webpack_require__(10); +var _pdf_rendering_queue = __webpack_require__(11); -var _viewer_compatibility = __webpack_require__(13); +var _viewer_compatibility = __webpack_require__(8); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } @@ -11588,7 +11719,7 @@ function () { } var zoomLayerCanvas = this.zoomLayer.firstChild; - this.paintedViewportMap.delete(zoomLayerCanvas); + this.paintedViewportMap["delete"](zoomLayerCanvas); zoomLayerCanvas.width = 0; zoomLayerCanvas.height = 0; @@ -11604,6 +11735,7 @@ function () { var keepZoomLayer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var keepAnnotations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; this.cancelRendering(keepAnnotations); + this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; var div = this.div; div.style.width = Math.floor(this.viewport.width) + 'px'; div.style.height = Math.floor(this.viewport.height) + 'px'; @@ -11632,7 +11764,7 @@ function () { if (!currentZoomLayerNode) { if (this.canvas) { - this.paintedViewportMap.delete(this.canvas); + this.paintedViewportMap["delete"](this.canvas); this.canvas.width = 0; this.canvas.height = 0; delete this.canvas; @@ -11642,7 +11774,7 @@ function () { } if (this.svg) { - this.paintedViewportMap.delete(this.svg); + this.paintedViewportMap["delete"](this.svg); delete this.svg; } @@ -11712,14 +11844,12 @@ function () { key: "cancelRendering", value: function cancelRendering() { var keepAnnotations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var renderingState = this.renderingState; if (this.paintTask) { this.paintTask.cancel(); this.paintTask = null; } - this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; this.resume = null; if (this.textLayer) { @@ -11731,14 +11861,6 @@ function () { this.annotationLayer.cancel(); this.annotationLayer = null; } - - if (renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) { - this.eventBus.dispatch('pagecancelled', { - source: this, - pageNumber: this.id, - renderingState: renderingState - }); - } } }, { key: "cssTransform", @@ -11884,8 +12006,8 @@ function () { function () { var _ref = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(error) { - return _regenerator.default.wrap(function _callee$(_context) { + _regenerator["default"].mark(function _callee(error) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -11936,7 +12058,7 @@ function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); return function finishPaintTask(_x) { @@ -12142,7 +12264,7 @@ function () { exports.PDFPageView = PDFPageView; /***/ }), -/* 32 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12153,7 +12275,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.DefaultTextLayerFactory = exports.TextLayerBuilder = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); var _pdfjsLib = __webpack_require__(7); @@ -12194,9 +12316,7 @@ function () { this.findController = findController; this.textLayerRenderTask = null; this.enhanceTextSelection = enhanceTextSelection; - this._boundEvents = Object.create(null); - - this._bindEvents(); + this._onUpdateTextLayerMatches = null; this._bindMouse(); } @@ -12249,6 +12369,16 @@ function () { _this._updateMatches(); }, function (reason) {}); + + if (!this._onUpdateTextLayerMatches) { + this._onUpdateTextLayerMatches = function (evt) { + if (evt.pageIndex === _this.pageIdx || evt.pageIndex === -1) { + _this._updateMatches(); + } + }; + + this.eventBus.on('updatetextlayermatches', this._onUpdateTextLayerMatches); + } } }, { key: "cancel", @@ -12257,6 +12387,11 @@ function () { this.textLayerRenderTask.cancel(); this.textLayerRenderTask = null; } + + if (this._onUpdateTextLayerMatches) { + this.eventBus.off('updatetextlayermatches', this._onUpdateTextLayerMatches); + this._onUpdateTextLayerMatches = null; + } } }, { key: "setTextContentStream", @@ -12457,51 +12592,16 @@ function () { this._renderMatches(this.matches); } - }, { - key: "_bindEvents", - value: function _bindEvents() { - var _this2 = this; - - var eventBus = this.eventBus, - _boundEvents = this._boundEvents; - - _boundEvents.pageCancelled = function (evt) { - if (evt.pageNumber !== _this2.pageNumber) { - return; - } - - if (_this2.textLayerRenderTask) { - console.error('TextLayerBuilder._bindEvents: `this.cancel()` should ' + 'have been called when the page was reset, or rendering cancelled.'); - return; - } - - for (var name in _boundEvents) { - eventBus.off(name.toLowerCase(), _boundEvents[name]); - delete _boundEvents[name]; - } - }; - - _boundEvents.updateTextLayerMatches = function (evt) { - if (evt.pageIndex !== _this2.pageIdx && evt.pageIndex !== -1) { - return; - } - - _this2._updateMatches(); - }; - - eventBus.on('pagecancelled', _boundEvents.pageCancelled); - eventBus.on('updatetextlayermatches', _boundEvents.updateTextLayerMatches); - } }, { key: "_bindMouse", value: function _bindMouse() { - var _this3 = this; + var _this2 = this; var div = this.textLayerDiv; var expandDivsTimer = null; div.addEventListener('mousedown', function (evt) { - if (_this3.enhanceTextSelection && _this3.textLayerRenderTask) { - _this3.textLayerRenderTask.expandTextDivs(true); + if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) { + _this2.textLayerRenderTask.expandTextDivs(true); if (expandDivsTimer) { clearTimeout(expandDivsTimer); @@ -12529,10 +12629,10 @@ function () { end.classList.add('active'); }); div.addEventListener('mouseup', function () { - if (_this3.enhanceTextSelection && _this3.textLayerRenderTask) { + if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) { expandDivsTimer = setTimeout(function () { - if (_this3.textLayerRenderTask) { - _this3.textLayerRenderTask.expandTextDivs(false); + if (_this2.textLayerRenderTask) { + _this2.textLayerRenderTask.expandTextDivs(false); } expandDivsTimer = null; @@ -12583,7 +12683,7 @@ function () { exports.DefaultTextLayerFactory = DefaultTextLayerFactory; /***/ }), -/* 33 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12594,11 +12694,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.SecondaryToolbar = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); -var _pdf_cursor_tools = __webpack_require__(8); +var _pdf_cursor_tools = __webpack_require__(9); -var _pdf_single_page_viewer = __webpack_require__(34); +var _pdf_single_page_viewer = __webpack_require__(33); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -12792,23 +12892,25 @@ function () { eventName = _this2$buttons$button.eventName, close = _this2$buttons$button.close, eventDetails = _this2$buttons$button.eventDetails; - element.addEventListener('click', function (evt) { - if (eventName !== null) { - var details = { - source: _this2 - }; - - for (var property in eventDetails) { - details[property] = eventDetails[property]; - } + if (element) { + element.addEventListener('click', function (evt) { + if (eventName !== null) { + var details = { + source: _this2 + }; + + for (var property in eventDetails) { + details[property] = eventDetails[property]; + } - _this2.eventBus.dispatch(eventName, details); - } + _this2.eventBus.dispatch(eventName, details); + } - if (close) { - _this2.close(); - } - }); + if (close) { + _this2.close(); + } + }); + } }; for (var button in this.buttons) { @@ -12933,7 +13035,7 @@ function () { exports.SecondaryToolbar = SecondaryToolbar; /***/ }), -/* 34 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12944,7 +13046,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFSinglePageViewer = void 0; -var _base_viewer = __webpack_require__(29); +var _base_viewer = __webpack_require__(28); var _pdfjsLib = __webpack_require__(7); @@ -13104,7 +13206,7 @@ function (_BaseViewer) { exports.PDFSinglePageViewer = PDFSinglePageViewer; /***/ }), -/* 35 */ +/* 34 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13115,7 +13217,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.Toolbar = void 0; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -13238,16 +13340,20 @@ function () { source: self }); }); - items.print.addEventListener('click', function () { - eventBus.dispatch('print', { - source: self - }); - }); - items.download.addEventListener('click', function () { - eventBus.dispatch('download', { - source: self - }); - }); + if (items.print) { + items.print.addEventListener('click', function () { + eventBus.dispatch('print', { + source: self + }); + }); + } + if (items.download) { + items.download.addEventListener('click', function () { + eventBus.dispatch('download', { + source: self + }); + }); + } items.scaleSelect.oncontextmenu = _ui_utils.noContextMenuHandler; eventBus.on('localized', function () { _this._localized(); @@ -13367,7 +13473,7 @@ function () { exports.Toolbar = Toolbar; /***/ }), -/* 36 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13380,7 +13486,7 @@ exports.ViewHistory = void 0; var _regenerator = _interopRequireDefault(__webpack_require__(2)); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } @@ -13444,9 +13550,9 @@ function () { value: function () { var _writeToStorage2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee() { + _regenerator["default"].mark(function _callee() { var databaseStr; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -13472,8 +13578,8 @@ function () { value: function () { var _readFromStorage2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2() { - return _regenerator.default.wrap(function _callee2$(_context2) { + _regenerator["default"].mark(function _callee2() { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -13484,7 +13590,7 @@ function () { return _context2.stop(); } } - }, _callee2, this); + }, _callee2); })); function _readFromStorage() { @@ -13498,8 +13604,8 @@ function () { value: function () { var _set = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee3(name, val) { - return _regenerator.default.wrap(function _callee3$(_context3) { + _regenerator["default"].mark(function _callee3(name, val) { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -13529,9 +13635,9 @@ function () { value: function () { var _setMultiple = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee4(properties) { + _regenerator["default"].mark(function _callee4(properties) { var name; - return _regenerator.default.wrap(function _callee4$(_context4) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: @@ -13564,9 +13670,9 @@ function () { value: function () { var _get = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee5(name, defaultValue) { + _regenerator["default"].mark(function _callee5(name, defaultValue) { var val; - return _regenerator.default.wrap(function _callee5$(_context5) { + return _regenerator["default"].wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: @@ -13596,9 +13702,9 @@ function () { value: function () { var _getMultiple = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee6(properties) { + _regenerator["default"].mark(function _callee6(properties) { var values, name, val; - return _regenerator.default.wrap(function _callee6$(_context6) { + return _regenerator["default"].wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: @@ -13637,7 +13743,7 @@ function () { exports.ViewHistory = ViewHistory; /***/ }), -/* 37 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13652,13 +13758,13 @@ var _regenerator = _interopRequireDefault(__webpack_require__(2)); var _app = __webpack_require__(1); -var _preferences = __webpack_require__(38); +var _preferences = __webpack_require__(37); -var _download_manager = __webpack_require__(39); +var _download_manager = __webpack_require__(38); -var _genericl10n = __webpack_require__(40); +var _genericl10n = __webpack_require__(39); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } @@ -13702,8 +13808,8 @@ function (_BasePreferences) { value: function () { var _writeToStorage2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(prefObj) { - return _regenerator.default.wrap(function _callee$(_context) { + _regenerator["default"].mark(function _callee(prefObj) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -13714,7 +13820,7 @@ function (_BasePreferences) { return _context.stop(); } } - }, _callee, this); + }, _callee); })); function _writeToStorage(_x) { @@ -13728,8 +13834,8 @@ function (_BasePreferences) { value: function () { var _readFromStorage2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2(prefObj) { - return _regenerator.default.wrap(function _callee2$(_context2) { + _regenerator["default"].mark(function _callee2(prefObj) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -13740,7 +13846,7 @@ function (_BasePreferences) { return _context2.stop(); } } - }, _callee2, this); + }, _callee2); })); function _readFromStorage(_x2) { @@ -13773,7 +13879,7 @@ GenericExternalServices.createL10n = function (_ref) { _app.PDFViewerApplication.externalServices = GenericExternalServices; /***/ }), -/* 38 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -13786,7 +13892,7 @@ exports.BasePreferences = void 0; var _regenerator = _interopRequireDefault(__webpack_require__(2)); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } @@ -13805,27 +13911,27 @@ var defaultPreferences = null; function getDefaultPreferences() { if (!defaultPreferences) { defaultPreferences = Promise.resolve({ - "viewOnLoad": 0, - "defaultZoomValue": "", - "sidebarViewOnLoad": -1, "cursorToolOnLoad": 0, + "defaultZoomValue": "", + "disablePageLabels": false, + "enablePrintAutoRotate": false, "enableWebGL": false, "eventBusDispatchToDOM": false, - "pdfBugEnabled": false, - "disableRange": false, - "disableStream": false, - "disableAutoFetch": false, - "disableFontFace": false, - "textLayerMode": 1, - "useOnlyCssZoom": false, "externalLinkTarget": 0, + "historyUpdateUrl": false, + "pdfBugEnabled": false, "renderer": "canvas", "renderInteractiveForms": false, - "enablePrintAutoRotate": false, - "disablePageLabels": false, - "historyUpdateUrl": false, + "sidebarViewOnLoad": -1, "scrollModeOnLoad": -1, - "spreadModeOnLoad": -1 + "spreadModeOnLoad": -1, + "textLayerMode": 1, + "useOnlyCssZoom": false, + "viewOnLoad": 0, + "disableAutoFetch": false, + "disableFontFace": false, + "disableRange": false, + "disableStream": false }); } @@ -13877,8 +13983,8 @@ function () { value: function () { var _writeToStorage2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee(prefObj) { - return _regenerator.default.wrap(function _callee$(_context) { + _regenerator["default"].mark(function _callee(prefObj) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -13889,7 +13995,7 @@ function () { return _context.stop(); } } - }, _callee, this); + }, _callee); })); function _writeToStorage(_x) { @@ -13903,8 +14009,8 @@ function () { value: function () { var _readFromStorage2 = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2(prefObj) { - return _regenerator.default.wrap(function _callee2$(_context2) { + _regenerator["default"].mark(function _callee2(prefObj) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -13915,7 +14021,7 @@ function () { return _context2.stop(); } } - }, _callee2, this); + }, _callee2); })); function _readFromStorage(_x2) { @@ -13929,8 +14035,8 @@ function () { value: function () { var _reset = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee3() { - return _regenerator.default.wrap(function _callee3$(_context3) { + _regenerator["default"].mark(function _callee3() { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -13960,9 +14066,9 @@ function () { value: function () { var _set = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee4(name, value) { + _regenerator["default"].mark(function _callee4(name, value) { var defaultValue, valueType, defaultType; - return _regenerator.default.wrap(function _callee4$(_context4) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: @@ -14043,9 +14149,9 @@ function () { value: function () { var _get = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee5(name) { + _regenerator["default"].mark(function _callee5(name) { var defaultValue, prefValue; - return _regenerator.default.wrap(function _callee5$(_context5) { + return _regenerator["default"].wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: @@ -14094,8 +14200,8 @@ function () { value: function () { var _getAll = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee6() { - return _regenerator.default.wrap(function _callee6$(_context6) { + _regenerator["default"].mark(function _callee6() { + return _regenerator["default"].wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: @@ -14127,7 +14233,7 @@ function () { exports.BasePreferences = BasePreferences; /***/ }), -/* 39 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -14193,9 +14299,10 @@ function () { key: "downloadData", value: function downloadData(data, filename, contentType) { if (navigator.msSaveBlob) { - return navigator.msSaveBlob(new Blob([data], { + navigator.msSaveBlob(new Blob([data], { type: contentType }), filename); + return; } var blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, this.disableCreateObjectURL); @@ -14230,7 +14337,7 @@ function () { exports.DownloadManager = DownloadManager; /***/ }), -/* 40 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -14243,9 +14350,9 @@ exports.GenericL10n = void 0; var _regenerator = _interopRequireDefault(__webpack_require__(2)); -__webpack_require__(41); +__webpack_require__(40); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } @@ -14278,9 +14385,9 @@ function () { value: function () { var _getLanguage = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee() { + _regenerator["default"].mark(function _callee() { var l10n; - return _regenerator.default.wrap(function _callee$(_context) { + return _regenerator["default"].wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: @@ -14310,9 +14417,9 @@ function () { value: function () { var _getDirection = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee2() { + _regenerator["default"].mark(function _callee2() { var l10n; - return _regenerator.default.wrap(function _callee2$(_context2) { + return _regenerator["default"].wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: @@ -14342,9 +14449,9 @@ function () { value: function () { var _get = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee3(property, args, fallback) { + _regenerator["default"].mark(function _callee3(property, args, fallback) { var l10n; - return _regenerator.default.wrap(function _callee3$(_context3) { + return _regenerator["default"].wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: @@ -14374,9 +14481,9 @@ function () { value: function () { var _translate = _asyncToGenerator( /*#__PURE__*/ - _regenerator.default.mark(function _callee4(element) { + _regenerator["default"].mark(function _callee4(element) { var l10n; - return _regenerator.default.wrap(function _callee4$(_context4) { + return _regenerator["default"].wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: @@ -14409,7 +14516,7 @@ function () { exports.GenericL10n = GenericL10n; /***/ }), -/* 41 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15241,7 +15348,7 @@ document.webL10n = function (window, document, undefined) { }(window, document); /***/ }), -/* 42 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -15252,10 +15359,12 @@ Object.defineProperty(exports, "__esModule", { }); exports.PDFPrintService = PDFPrintService; -var _ui_utils = __webpack_require__(6); +var _ui_utils = __webpack_require__(5); var _app = __webpack_require__(1); +var _app_options = __webpack_require__(6); + var _pdfjsLib = __webpack_require__(7); var activeService = null; @@ -15263,7 +15372,7 @@ var overlayManager = null; function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) { var scratchCanvas = activeService.scratchCanvas; - var PRINT_RESOLUTION = 150; + var PRINT_RESOLUTION = _app_options.AppOptions.get('printResolution') || 150; var PRINT_UNITS = PRINT_RESOLUTION / 72.0; scratchCanvas.width = Math.floor(size.width * PRINT_UNITS); scratchCanvas.height = Math.floor(size.height * PRINT_UNITS); @@ -15447,7 +15556,7 @@ window.print = function print() { var activeServiceOnEntry = activeService; activeService.renderPages().then(function () { return activeServiceOnEntry.performPrint(); - }).catch(function () {}).then(function () { + })["catch"](function () {}).then(function () { if (activeServiceOnEntry.active) { abort(); } diff --git a/cps/static/js/shelforder.js b/cps/static/js/shelforder.js index 3f804ad5..62b7e9f3 100644 --- a/cps/static/js/shelforder.js +++ b/cps/static/js/shelforder.js @@ -29,7 +29,7 @@ function sendData(path) { var maxElements; var tmp = []; - elements = Sortable.utils.find(sortTrue, "div"); + elements = $(".list-group-item"); maxElements = elements.length; var form = document.createElement("form"); diff --git a/cps/static/locale/ar/viewer.properties b/cps/static/locale/ar/viewer.properties index f4b53ede..b42ba74c 100644 --- a/cps/static/locale/ar/viewer.properties +++ b/cps/static/locale/ar/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=ملف PDF تالف أو غير صحيح. missing_file_error=ملف PDF غير موجود. unexpected_response_error=استجابة خادوم غير متوقعة. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}، {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/be/viewer.properties b/cps/static/locale/be/viewer.properties index f606dc32..d3f81887 100644 --- a/cps/static/locale/be/viewer.properties +++ b/cps/static/locale/be/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Няспраўны або пашкоджаны файл PDF. missing_file_error=Адсутны файл PDF. unexpected_response_error=Нечаканы адказ сервера. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/br/viewer.properties b/cps/static/locale/br/viewer.properties index ae721dd6..ac2558e1 100644 --- a/cps/static/locale/br/viewer.properties +++ b/cps/static/locale/br/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Restr PDF didalvoudek pe kontronet. missing_file_error=Restr PDF o vankout. unexpected_response_error=Respont dic'hortoz a-berzh an dafariad +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/cak/viewer.properties b/cps/static/locale/cak/viewer.properties index 780ccf5c..8086f32a 100644 --- a/cps/static/locale/cak/viewer.properties +++ b/cps/static/locale/cak/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Man oke ta o yujtajinäq ri PDF yakb'äl. missing_file_error=Man xilitäj ta ri PDF yakb'äl. unexpected_response_error=Man oyob'en ta tz'olin rutzij ruk'u'x samaj. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/cs/viewer.properties b/cps/static/locale/cs/viewer.properties index 7ba084e9..1dd8a36c 100644 --- a/cps/static/locale/cs/viewer.properties +++ b/cps/static/locale/cs/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Neplatný nebo chybný soubor PDF. missing_file_error=Chybí soubor PDF. unexpected_response_error=Neočekávaná odpověď serveru. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/cy/viewer.properties b/cps/static/locale/cy/viewer.properties index 44a3fee5..45493a54 100644 --- a/cps/static/locale/cy/viewer.properties +++ b/cps/static/locale/cy/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Ffeil PDF annilys neu llwgr. missing_file_error=Ffeil PDF coll. unexpected_response_error=Ymateb annisgwyl gan y gweinydd. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/da/viewer.properties b/cps/static/locale/da/viewer.properties index 62db0930..dce46725 100644 --- a/cps/static/locale/da/viewer.properties +++ b/cps/static/locale/da/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=PDF-filen er ugyldig eller ødelagt. missing_file_error=Manglende PDF-fil. unexpected_response_error=Uventet svar fra serveren. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/de/viewer.properties b/cps/static/locale/de/viewer.properties index 50464d86..cea73190 100644 --- a/cps/static/locale/de/viewer.properties +++ b/cps/static/locale/de/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Ungültige oder beschädigte PDF-Datei missing_file_error=Fehlende PDF-Datei unexpected_response_error=Unerwartete Antwort des Servers +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/el/viewer.properties b/cps/static/locale/el/viewer.properties index 725c547d..d7a6abc1 100644 --- a/cps/static/locale/el/viewer.properties +++ b/cps/static/locale/el/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Μη έγκυρο ή κατεστραμμένο αρχείο missing_file_error=Λείπει αρχείο PDF. unexpected_response_error=Μη αναμενόμενη απόκριση από το διακομιστή. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/en-CA/viewer.properties b/cps/static/locale/en-CA/viewer.properties index ddc42138..e52573b1 100644 --- a/cps/static/locale/en-CA/viewer.properties +++ b/cps/static/locale/en-CA/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Invalid or corrupted PDF file. missing_file_error=Missing PDF file. unexpected_response_error=Unexpected server response. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/en-GB/viewer.properties b/cps/static/locale/en-GB/viewer.properties index ddc42138..e52573b1 100644 --- a/cps/static/locale/en-GB/viewer.properties +++ b/cps/static/locale/en-GB/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Invalid or corrupted PDF file. missing_file_error=Missing PDF file. unexpected_response_error=Unexpected server response. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/en-US/viewer.properties b/cps/static/locale/en-US/viewer.properties index 22045e11..2dd7751a 100644 --- a/cps/static/locale/en-US/viewer.properties +++ b/cps/static/locale/en-US/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Invalid or corrupted PDF file. missing_file_error=Missing PDF file. unexpected_response_error=Unexpected server response. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/eo/viewer.properties b/cps/static/locale/eo/viewer.properties index 04272e4a..eb294955 100644 --- a/cps/static/locale/eo/viewer.properties +++ b/cps/static/locale/eo/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Nevalida aŭ difektita PDF dosiero. missing_file_error=Mankas dosiero PDF. unexpected_response_error=Neatendita respondo de servilo. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/es-AR/viewer.properties b/cps/static/locale/es-AR/viewer.properties index 4ba3ddc1..6f3662c7 100644 --- a/cps/static/locale/es-AR/viewer.properties +++ b/cps/static/locale/es-AR/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Archivo PDF no válido o cocrrupto. missing_file_error=Archivo PDF faltante. unexpected_response_error=Respuesta del servidor inesperada. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/es-CL/viewer.properties b/cps/static/locale/es-CL/viewer.properties index b73dab4c..7691ed7f 100644 --- a/cps/static/locale/es-CL/viewer.properties +++ b/cps/static/locale/es-CL/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Archivo PDF inválido o corrupto. missing_file_error=Falta el archivo PDF. unexpected_response_error=Respuesta del servidor inesperada. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/es-ES/viewer.properties b/cps/static/locale/es-ES/viewer.properties index e1af4d0b..0a632ece 100644 --- a/cps/static/locale/es-ES/viewer.properties +++ b/cps/static/locale/es-ES/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Fichero PDF no válido o corrupto. missing_file_error=No hay fichero PDF. unexpected_response_error=Respuesta inesperada del servidor. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/et/viewer.properties b/cps/static/locale/et/viewer.properties index 46dd2da6..11f47c1c 100644 --- a/cps/static/locale/et/viewer.properties +++ b/cps/static/locale/et/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Vigane või rikutud PDF-fail. missing_file_error=PDF-fail puudub. unexpected_response_error=Ootamatu vastus serverilt. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}} {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/eu/viewer.properties b/cps/static/locale/eu/viewer.properties index c40b884b..a3f230a5 100644 --- a/cps/static/locale/eu/viewer.properties +++ b/cps/static/locale/eu/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=PDF fitxategi baliogabe edo hondatua. missing_file_error=PDF fitxategia falta da. unexpected_response_error=Espero gabeko zerbitzariaren erantzuna. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/fi/viewer.properties b/cps/static/locale/fi/viewer.properties index 89efd773..bb4d44ae 100644 --- a/cps/static/locale/fi/viewer.properties +++ b/cps/static/locale/fi/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Virheellinen tai vioittunut PDF-tiedosto. missing_file_error=Puuttuva PDF-tiedosto. unexpected_response_error=Odottamaton vastaus palvelimelta. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/fr/viewer.properties b/cps/static/locale/fr/viewer.properties index 7cc00b93..10559f70 100644 --- a/cps/static/locale/fr/viewer.properties +++ b/cps/static/locale/fr/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Fichier PDF invalide ou corrompu. missing_file_error=Fichier PDF manquant. unexpected_response_error=Réponse inattendue du serveur. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}} à {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/fy-NL/viewer.properties b/cps/static/locale/fy-NL/viewer.properties index 0c74953d..ddba4cc0 100644 --- a/cps/static/locale/fy-NL/viewer.properties +++ b/cps/static/locale/fy-NL/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Ynfalide of korruptearre PDF-bestân. missing_file_error=PDF-bestân ûntbrekt. unexpected_response_error=Unferwacht serverantwurd. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/gn/viewer.properties b/cps/static/locale/gn/viewer.properties index 41377566..692d1d72 100644 --- a/cps/static/locale/gn/viewer.properties +++ b/cps/static/locale/gn/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=PDF marandurenda ndoikóiva térã ivaipyréva. missing_file_error=Ndaipóri PDF marandurenda unexpected_response_error=Mohendahavusu mbohovái ñeha'arõ'ỹva. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/he/viewer.properties b/cps/static/locale/he/viewer.properties index 55a79cd5..f0259f79 100644 --- a/cps/static/locale/he/viewer.properties +++ b/cps/static/locale/he/viewer.properties @@ -173,6 +173,7 @@ find_reached_bottom=הגיע לסוף הדף, ממשיך מלמעלה # "{{current}}" and "{{total}}" will be replaced by a number representing the # index of the currently active find result, respectively a number representing # the total number of matches in the document. +find_match_count={[ plural(total) ]} find_match_count[one]=תוצאה {{current}} מתוך {{total}} find_match_count[two]={{current}} מתוך {{total}} תוצאות find_match_count[few]={{current}} מתוך {{total}} תוצאות @@ -181,13 +182,14 @@ find_match_count[other]={{current}} מתוך {{total}} תוצאות # LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are # [zero|one|two|few|many|other], with [other] as the default value. # "{{limit}}" will be replaced by a numerical value. +find_match_count_limit={[ plural(limit) ]} find_match_count_limit[zero]=יותר מ־{{limit}} תוצאות find_match_count_limit[one]=יותר מתוצאה אחת find_match_count_limit[two]=יותר מ־{{limit}} תוצאות find_match_count_limit[few]=יותר מ־{{limit}} תוצאות find_match_count_limit[many]=יותר מ־{{limit}} תוצאות find_match_count_limit[other]=יותר מ־{{limit}} תוצאות -find_not_found=ביטוי לא נמצא +find_not_found=הביטוי לא נמצא # Error panel labels error_more_info=מידע נוסף @@ -224,6 +226,10 @@ invalid_file_error=קובץ PDF פגום או לא תקין. missing_file_error=קובץ PDF חסר. unexpected_response_error=תגובת שרת לא צפויה. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/hi-IN/viewer.properties b/cps/static/locale/hi-IN/viewer.properties index a27bfe44..67d00053 100644 --- a/cps/static/locale/hi-IN/viewer.properties +++ b/cps/static/locale/hi-IN/viewer.properties @@ -208,6 +208,10 @@ invalid_file_error=अमान्य या भ्रष्ट PDF फ़ाइ missing_file_error=\u0020अनुपस्थित PDF फ़ाइल. unexpected_response_error=अप्रत्याशित सर्वर प्रतिक्रिया. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/hr/viewer.properties b/cps/static/locale/hr/viewer.properties index 07d19b2d..4f1f3c49 100644 --- a/cps/static/locale/hr/viewer.properties +++ b/cps/static/locale/hr/viewer.properties @@ -65,7 +65,19 @@ cursor_text_select_tool_label=Alat za označavanje teksta cursor_hand_tool.title=Omogući ručni alat cursor_hand_tool_label=Ručni alat - +scroll_vertical.title=Koristi okomito pomicanje +scroll_vertical_label=Okomito pomicanje +scroll_horizontal.title=Koristi vodoravno pomicanje +scroll_horizontal_label=Vodoravno pomicanje +scroll_wrapped.title=Koristi omotano pomicanje +scroll_wrapped_label=Omotano pomicanje + +spread_none.title=Ne pridružuj razmake stranica +spread_none_label=Bez razmaka +spread_odd.title=Pridruži razmake stranica počinjući od neparnih stranica +spread_odd_label=Neparni razmaci +spread_even.title=Pridruži razmake stranica počinjući od parnih stranica +spread_even_label=Parni razmaci # Document properties dialog box document_properties.title=Svojstva dokumenta... @@ -91,8 +103,15 @@ document_properties_creator=Stvaratelj: document_properties_producer=PDF stvaratelj: document_properties_version=PDF inačica: document_properties_page_count=Broj stranica: +document_properties_page_size=Dimenzije stranice: +document_properties_page_size_unit_inches=in +document_properties_page_size_unit_millimeters=mm +document_properties_page_size_orientation_portrait=portret +document_properties_page_size_orientation_landscape=pejzaž document_properties_page_size_name_a3=A3 document_properties_page_size_name_a4=A4 +document_properties_page_size_name_letter=Pismo +document_properties_page_size_name_legal=Pravno # LOCALIZATION NOTE (document_properties_page_size_dimension_string): # "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by # the size, respectively their unit of measurement and orientation, of the (current) page. @@ -103,6 +122,7 @@ document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} document_properties_page_size_dimension_name_string={{width}} × {{height}} {{unit}} ({{name}}, {{orientation}}) # LOCALIZATION NOTE (document_properties_linearized): The linearization status of # the document; usually called "Fast Web View" in English locales of Adobe software. +document_properties_linearized=Brzi web pregled: document_properties_linearized_yes=Da document_properties_linearized_no=Ne document_properties_close=Zatvori @@ -145,6 +165,7 @@ find_next.title=Pronađi iduće javljanje ovog izraza find_next_label=Sljedeće find_highlight=Istankni sve find_match_case_label=Slučaj podudaranja +find_entire_word_label=Cijele riječi find_reached_top=Dosegnut vrh dokumenta, nastavak od dna find_reached_bottom=Dosegnut vrh dokumenta, nastavak od vrha # LOCALIZATION NOTE (find_match_count): The supported plural forms are @@ -152,9 +173,22 @@ find_reached_bottom=Dosegnut vrh dokumenta, nastavak od vrha # "{{current}}" and "{{total}}" will be replaced by a number representing the # index of the currently active find result, respectively a number representing # the total number of matches in the document. +find_match_count={[ plural(total) ]} +find_match_count[one]={{current}} od {{total}} se podudara +find_match_count[two]={{current}} od {{total}} se podudara +find_match_count[few]={{current}} od {{total}} se podudara +find_match_count[many]={{current}} od {{total}} se podudara +find_match_count[other]={{current}} od {{total}} se podudara # LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are # [zero|one|two|few|many|other], with [other] as the default value. # "{{limit}}" will be replaced by a numerical value. +find_match_count_limit={[ plural(limit) ]} +find_match_count_limit[zero]=Više od {{limit}} podudaranja +find_match_count_limit[one]=Više od {{limit}} podudaranja +find_match_count_limit[two]=Više od {{limit}} podudaranja +find_match_count_limit[few]=Više od {{limit}} podudaranja +find_match_count_limit[many]=Više od {{limit}} podudaranja +find_match_count_limit[other]=Više od {{limit}} podudaranja find_not_found=Izraz nije pronađen # Error panel labels @@ -192,6 +226,10 @@ invalid_file_error=Kriva ili oštećena PDF datoteka. missing_file_error=Nedostaje PDF datoteka. unexpected_response_error=Neočekivani odgovor poslužitelja. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/hsb/viewer.properties b/cps/static/locale/hsb/viewer.properties index 679ef593..790f7235 100644 --- a/cps/static/locale/hsb/viewer.properties +++ b/cps/static/locale/hsb/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Njepłaćiwa abo wobškodźena PDF-dataja. missing_file_error=Falowaca PDF-dataja. unexpected_response_error=Njewočakowana serwerowa wotmołwa. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/hu/viewer.properties b/cps/static/locale/hu/viewer.properties index 9c9ec846..fb5e35f4 100644 --- a/cps/static/locale/hu/viewer.properties +++ b/cps/static/locale/hu/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Érvénytelen vagy sérült PDF fájl. missing_file_error=Hiányzó PDF fájl. unexpected_response_error=Váratlan kiszolgálóválasz. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/ia/viewer.properties b/cps/static/locale/ia/viewer.properties index 4a5b005c..ee8842cf 100644 --- a/cps/static/locale/ia/viewer.properties +++ b/cps/static/locale/ia/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=File PDF corrumpite o non valide. missing_file_error=File PDF mancante. unexpected_response_error=Responsa del servitor inexpectate. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/id/viewer.properties b/cps/static/locale/id/viewer.properties index b6f7080b..58ebc40d 100644 --- a/cps/static/locale/id/viewer.properties +++ b/cps/static/locale/id/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Berkas PDF tidak valid atau rusak. missing_file_error=Berkas PDF tidak ada. unexpected_response_error=Balasan server yang tidak diharapkan. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/is/viewer.properties b/cps/static/locale/is/viewer.properties index 59d94b44..d24c2adf 100644 --- a/cps/static/locale/is/viewer.properties +++ b/cps/static/locale/is/viewer.properties @@ -65,7 +65,17 @@ cursor_text_select_tool_label=Textavalsáhald cursor_hand_tool.title=Virkja handarverkfæri cursor_hand_tool_label=Handarverkfæri - +scroll_vertical.title=Nota lóðrétt skrun +scroll_vertical_label=Lóðrétt skrun +scroll_horizontal.title=Nota lárétt skrun +scroll_horizontal_label=Lárétt skrun + +spread_none.title=Ekki taka þátt í dreifingu síðna +spread_none_label=Engin dreifing +spread_odd.title=Taka þátt í dreifingu síðna með oddatölum +spread_odd_label=Oddatöludreifing +spread_even.title=Taktu þátt í dreifingu síðna með jöfnuntölum +spread_even_label=Jafnatöludreifing # Document properties dialog box document_properties.title=Eiginleikar skjals… @@ -161,10 +171,21 @@ find_reached_bottom=Náði enda skjals, held áfram efst # index of the currently active find result, respectively a number representing # the total number of matches in the document. find_match_count={[ plural(total) ]} +find_match_count[one]={{current}} af {{total}} niðurstöðu +find_match_count[two]={{current}} af {{total}} niðurstöðum +find_match_count[few]={{current}} af {{total}} niðurstöðum +find_match_count[many]={{current}} af {{total}} niðurstöðum +find_match_count[other]={{current}} af {{total}} niðurstöðum # LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are # [zero|one|two|few|many|other], with [other] as the default value. # "{{limit}}" will be replaced by a numerical value. find_match_count_limit={[ plural(limit) ]} +find_match_count_limit[zero]=Fleiri en {{limit}} niðurstöður +find_match_count_limit[one]=Fleiri en {{limit}} niðurstaða +find_match_count_limit[two]=Fleiri en {{limit}} niðurstöður +find_match_count_limit[few]=Fleiri en {{limit}} niðurstöður +find_match_count_limit[many]=Fleiri en {{limit}} niðurstöður +find_match_count_limit[other]=Fleiri en {{limit}} niðurstöður find_not_found=Fann ekki orðið # Error panel labels diff --git a/cps/static/locale/it/viewer.properties b/cps/static/locale/it/viewer.properties index 754ea18a..cff0258b 100644 --- a/cps/static/locale/it/viewer.properties +++ b/cps/static/locale/it/viewer.properties @@ -146,6 +146,7 @@ loading_error = Si è verificato un errore durante il caricamento del PDF. invalid_file_error = File PDF non valido o danneggiato. missing_file_error = File PDF non disponibile. unexpected_response_error = Risposta imprevista del server +annotation_date_string = {{date}}, {{time}} text_annotation_type.alt = [Annotazione: {{type}}] password_label = Inserire la password per aprire questo file PDF. password_invalid = Password non corretta. Riprovare. diff --git a/cps/static/locale/ja/viewer.properties b/cps/static/locale/ja/viewer.properties index d2fe56bd..3a90b47b 100644 --- a/cps/static/locale/ja/viewer.properties +++ b/cps/static/locale/ja/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=無効または破損した PDF ファイル。 missing_file_error=PDF ファイルが見つかりません。 unexpected_response_error=サーバーから予期せぬ応答がありました。 +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/ka/viewer.properties b/cps/static/locale/ka/viewer.properties index e1321374..c7b2da8d 100644 --- a/cps/static/locale/ka/viewer.properties +++ b/cps/static/locale/ka/viewer.properties @@ -100,8 +100,8 @@ document_properties_modification_date=ჩასწორების თარ # will be replaced by the creation/modification date, and time, of the PDF file. document_properties_date_string={{date}}, {{time}} document_properties_creator=გამომშვები: -document_properties_producer=PDF გამომშვები: -document_properties_version=PDF ვერსია: +document_properties_producer=PDF-გამომშვები: +document_properties_version=PDF-ვერსია: document_properties_page_count=გვერდების რაოდენობა: document_properties_page_size=გვერდის ზომა: document_properties_page_size_unit_inches=დუიმი @@ -122,7 +122,7 @@ document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} document_properties_page_size_dimension_name_string={{width}} × {{height}} {{unit}} ({{name}}, {{orientation}}) # LOCALIZATION NOTE (document_properties_linearized): The linearization status of # the document; usually called "Fast Web View" in English locales of Adobe software. -document_properties_linearized=Fast Web View: +document_properties_linearized=სწრაფი შეთვალიერება: document_properties_linearized_yes=დიახ document_properties_linearized_no=არა document_properties_close=დახურვა @@ -154,7 +154,7 @@ findbar_label=ძიება thumb_page_title=გვერდი {{page}} # LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page # number. -thumb_page_canvas=გვერდის ესკიზი {{page}} +thumb_page_canvas=გვერდის შეთვალიერება {{page}} # Find panel button title and messages find_input.title=ძიება @@ -221,22 +221,26 @@ page_scale_percent={{scale}}% # Loading indicator messages loading_error_indicator=შეცდომა -loading_error=შეცდომა, PDF ფაილის ჩატვირთვისას. -invalid_file_error=არამართებული ან დაზიანებული PDF ფაილი. -missing_file_error=ნაკლული PDF ფაილი. +loading_error=შეცდომა, PDF-ფაილის ჩატვირთვისას. +invalid_file_error=არამართებული ან დაზიანებული PDF-ფაილი. +missing_file_error=ნაკლული PDF-ფაილი. unexpected_response_error=სერვერის მოულოდნელი პასუხი. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). # Some common types are e.g.: "Check", "Text", "Comment", "Note" text_annotation_type.alt=[{{type}} შენიშვნა] -password_label=შეიყვანეთ პაროლი PDF ფაილის გასახსნელად. +password_label=შეიყვანეთ პაროლი PDF-ფაილის გასახსნელად. password_invalid=არასწორი პაროლი. გთხოვთ, სცადოთ ხელახლა. password_ok=კარგი password_cancel=გაუქმება printing_not_supported=გაფრთხილება: ამობეჭდვა ამ ბრაუზერში არაა სრულად მხარდაჭერილი. printing_not_ready=გაფრთხილება: PDF სრულად ჩატვირთული არაა, ამობეჭდვის დასაწყებად. -web_fonts_disabled=ვებშრიფტები გამორთულია: ჩაშენებული PDF შრიფტების გამოყენება ვერ ხერხდება. -document_colors_not_allowed=PDF დოკუმენტებს არ აქვს საკუთარი ფერების გამოყენების ნებართვა: ბრაუზერში გამორთულია “გვერდებისთვის საკუთარი ფერების გამოყენების უფლება”. +web_fonts_disabled=ვებშრიფტები გამორთულია: ჩაშენებული PDF-შრიფტების გამოყენება ვერ ხერხდება. +document_colors_not_allowed=PDF-დოკუმენტებს არ აქვს საკუთარი ფერების გამოყენების ნებართვა: ბრაუზერში გამორთულია “გვერდებისთვის საკუთარი ფერების გამოყენების უფლება”. diff --git a/cps/static/locale/kab/viewer.properties b/cps/static/locale/kab/viewer.properties index 52ac0a55..db59ef71 100644 --- a/cps/static/locale/kab/viewer.properties +++ b/cps/static/locale/kab/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Afaylu PDF arameɣtu neɣ yexṣeṛ. missing_file_error=Ulac afaylu PDF. unexpected_response_error=Aqeddac yerra-d yir tiririt ur nettwaṛǧi ara. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/kk/viewer.properties b/cps/static/locale/kk/viewer.properties index 3f1e51a5..cc1b4f6a 100644 --- a/cps/static/locale/kk/viewer.properties +++ b/cps/static/locale/kk/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Зақымдалған немесе қате PDF файл. missing_file_error=PDF файлы жоқ. unexpected_response_error=Сервердің күтпеген жауабы. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/ko/viewer.properties b/cps/static/locale/ko/viewer.properties index db7da192..d173a242 100644 --- a/cps/static/locale/ko/viewer.properties +++ b/cps/static/locale/ko/viewer.properties @@ -26,23 +26,23 @@ of_pages=전체 {{pagesCount}} # LOCALIZATION NOTE (page_of_pages): "{{pageNumber}}" and "{{pagesCount}}" # will be replaced by a number representing the currently visible page, # respectively a number representing the total number of pages in the document. -page_of_pages=({{pagesCount}} 중 {{pageNumber}}) +page_of_pages=({{pageNumber}} / {{pagesCount}}) zoom_out.title=축소 zoom_out_label=축소 zoom_in.title=확대 zoom_in_label=확대 -zoom.title=크기 -presentation_mode.title=발표 모드로 전환 -presentation_mode_label=발표 모드 +zoom.title=확대/축소 +presentation_mode.title=프레젠테이션 모드로 전환 +presentation_mode_label=프레젠테이션 모드 open_file.title=파일 열기 open_file_label=열기 print.title=인쇄 print_label=인쇄 download.title=다운로드 download_label=다운로드 -bookmark.title=지금 보이는 그대로 (복사하거나 새 창에 열기) -bookmark_label=지금 보이는 그대로 +bookmark.title=현재 뷰 (복사하거나 새 창에 열기) +bookmark_label=현재 뷰 # Secondary toolbar and context menu tools.title=도구 @@ -83,7 +83,7 @@ spread_even_label=짝수 펼쳐짐 document_properties.title=문서 속성… document_properties_label=문서 속성… document_properties_file_name=파일 이름: -document_properties_file_size=파일 사이즈: +document_properties_file_size=파일 크기: # LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}" # will be replaced by the PDF file size in kilobytes, respectively in bytes. document_properties_kb={{size_kb}} KB ({{size_b}}바이트) @@ -91,18 +91,18 @@ document_properties_kb={{size_kb}} KB ({{size_b}}바이트) # will be replaced by the PDF file size in megabytes, respectively in bytes. document_properties_mb={{size_mb}} MB ({{size_b}}바이트) document_properties_title=제목: -document_properties_author=저자: +document_properties_author=작성자: document_properties_subject=주제: document_properties_keywords=키워드: -document_properties_creation_date=생성일: -document_properties_modification_date=수정일: +document_properties_creation_date=작성 날짜: +document_properties_modification_date=수정 날짜: # LOCALIZATION NOTE (document_properties_date_string): "{{date}}" and "{{time}}" # will be replaced by the creation/modification date, and time, of the PDF file. document_properties_date_string={{date}}, {{time}} -document_properties_creator=생성자: -document_properties_producer=PDF 생성기: +document_properties_creator=작성 프로그램: +document_properties_producer=PDF 변환 소프트웨어: document_properties_version=PDF 버전: -document_properties_page_count=총 페이지: +document_properties_page_count=페이지 수: document_properties_page_size=페이지 크기: document_properties_page_size_unit_inches=in document_properties_page_size_unit_millimeters=mm @@ -127,7 +127,7 @@ document_properties_linearized_yes=예 document_properties_linearized_no=아니오 document_properties_close=닫기 -print_progress_message=문서 출력 준비중… +print_progress_message=인쇄 문서 준비중… # LOCALIZATION NOTE (print_progress_percent): "{{progress}}" will be replaced by # a numerical per cent value. print_progress_percent={{progress}}% @@ -151,10 +151,10 @@ findbar_label=검색 # Thumbnails panel item (tooltip and alt text for images) # LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page # number. -thumb_page_title={{page}}쪽 +thumb_page_title={{page}} 페이지 # LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page # number. -thumb_page_canvas={{page}}쪽 미리보기 +thumb_page_canvas={{page}} 페이지 미리보기 # Find panel button title and messages find_input.title=찾기 @@ -164,7 +164,7 @@ find_previous_label=이전 find_next.title=지정 문자열에 일치하는 다음 부분을 검색 find_next_label=다음 find_highlight=모두 강조 표시 -find_match_case_label=대문자/소문자 구별 +find_match_case_label=대/소문자 구분 find_entire_word_label=전체 단어 find_reached_top=문서 처음까지 검색하고 끝으로 돌아와 검색했습니다. find_reached_bottom=문서 끝까지 검색하고 앞으로 돌아와 검색했습니다. @@ -208,12 +208,12 @@ error_stack=스택: {{stack}} error_file=파일: {{file}} # LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number error_line=줄 번호: {{line}} -rendering_error=페이지를 렌더링하다 오류가 났습니다. +rendering_error=페이지를 렌더링하는 중 오류가 발생했습니다. # Predefined zoom values page_scale_width=페이지 너비에 맞춤 page_scale_fit=페이지에 맞춤 -page_scale_auto=알아서 맞춤 +page_scale_auto=자동 맞춤 page_scale_actual=실제 크기에 맞춤 # LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a # numerical scale value. @@ -221,22 +221,26 @@ page_scale_percent={{scale}}% # Loading indicator messages loading_error_indicator=오류 -loading_error=PDF를 읽는 중 오류가 생겼습니다. +loading_error=PDF를 로드하는 중 오류가 발생했습니다. invalid_file_error=유효하지 않거나 파손된 PDF 파일 missing_file_error=PDF 파일이 없습니다. -unexpected_response_error=알 수 없는 서버 응답입니다. +unexpected_response_error=예상치 못한 서버 응답입니다. + +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}} {{time}} # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). # Some common types are e.g.: "Check", "Text", "Comment", "Note" text_annotation_type.alt=[{{type}} 주석] -password_label=이 PDF 파일을 열 수 있는 암호를 입력하십시오. -password_invalid=잘못된 암호입니다. 다시 시도해 주십시오. +password_label=이 PDF 파일을 열 수 있는 비밀번호를 입력하십시오. +password_invalid=잘못된 비밀번호입니다. 다시 시도해 주십시오. password_ok=확인 password_cancel=취소 printing_not_supported=경고: 이 브라우저는 인쇄를 완전히 지원하지 않습니다. printing_not_ready=경고: 이 PDF를 인쇄를 할 수 있을 정도로 읽어들이지 못했습니다. -web_fonts_disabled=웹 폰트가 꺼져있음: 내장된 PDF 글꼴을 쓸 수 없습니다. -document_colors_not_allowed=PDF 문서의 색상을 쓰지 못하게 되어 있음: '웹 페이지 자체 색상 사용 허용'이 브라우저에서 꺼져 있습니다. +web_fonts_disabled=웹 폰트가 비활성화됨: 내장된 PDF 글꼴을 사용할 수 없습니다. +document_colors_not_allowed=PDF 문서의 자체 색상 허용 안됨: “페이지 자체 색상 허용”이 브라우저에서 비활성화 되어 있습니다. diff --git a/cps/static/locale/lij/viewer.properties b/cps/static/locale/lij/viewer.properties index f0a7771b..71a53062 100644 --- a/cps/static/locale/lij/viewer.properties +++ b/cps/static/locale/lij/viewer.properties @@ -45,8 +45,8 @@ bookmark.title=Vixon corente (còpia ò arvi inte 'n neuvo barcon) bookmark_label=Vixon corente # Secondary toolbar and context menu -tools.title=Strumenti -tools_label=Strumenti +tools.title=Atressi +tools_label=Atressi first_page.title=Vanni a-a primma pagina first_page.label=Vanni a-a primma pagina first_page_label=Vanni a-a primma pagina @@ -82,8 +82,8 @@ spread_even_label=Difuxon pari # Document properties dialog box document_properties.title=Propietæ do documento… document_properties_label=Propietæ do documento… -document_properties_file_name=Nomme file: -document_properties_file_size=Dimenscion file: +document_properties_file_name=Nomme schedaio: +document_properties_file_size=Dimenscion schedaio: # LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}" # will be replaced by the PDF file size in kilobytes, respectively in bytes. document_properties_kb={{size_kb}} kB ({{size_b}} byte) @@ -205,7 +205,7 @@ error_message=Mesaggio: {{message}} # trace. error_stack=Stack: {{stack}} # LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename -error_file=File: {{file}} +error_file=Schedaio: {{file}} # LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number error_line=Linia: {{line}} rendering_error=Gh'é stæto 'n'erô itno rendering da pagina. @@ -222,8 +222,8 @@ page_scale_percent={{scale}}% # Loading indicator messages loading_error_indicator=Erô loading_error=S'é verificou 'n'erô itno caregamento do PDF. -invalid_file_error=O file PDF o l'é no valido ò aroinou. -missing_file_error=O file PDF o no gh'é. +invalid_file_error=O schedaio PDF o l'é no valido ò aroinou. +missing_file_error=O schedaio PDF o no gh'é. unexpected_response_error=Risposta inprevista do-u server # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. @@ -231,7 +231,7 @@ unexpected_response_error=Risposta inprevista do-u server # the PDF spec (32000-1:2008 Table 169 – Annotation types). # Some common types are e.g.: "Check", "Text", "Comment", "Note" text_annotation_type.alt=[Anotaçion: {{type}}] -password_label=Dimme a paròlla segreta pe arvî sto file PDF. +password_label=Dimme a paròlla segreta pe arvî sto schedaio PDF. password_invalid=Paròlla segreta sbalia. Preuva torna. password_ok=Va ben password_cancel=Anulla diff --git a/cps/static/locale/lt/viewer.properties b/cps/static/locale/lt/viewer.properties index 3cb76ed6..45ec3035 100644 --- a/cps/static/locale/lt/viewer.properties +++ b/cps/static/locale/lt/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Tai nėra PDF failas arba jis yra sugadintas. missing_file_error=PDF failas nerastas. unexpected_response_error=Netikėtas serverio atsakas. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/mr/viewer.properties b/cps/static/locale/mr/viewer.properties index c8069296..67e419ec 100644 --- a/cps/static/locale/mr/viewer.properties +++ b/cps/static/locale/mr/viewer.properties @@ -65,6 +65,10 @@ cursor_text_select_tool_label=मजकूर निवड साधन cursor_hand_tool.title=हात साधन कार्यान्वित करा cursor_hand_tool_label=हस्त साधन +scroll_vertical.title=अनुलंब स्क्रोलिंग वापरा +scroll_vertical_label=अनुलंब स्क्रोलिंग +scroll_horizontal.title=क्षैतिज स्क्रोलिंग वापरा +scroll_horizontal_label=क्षैतिज स्क्रोलिंग # Document properties dialog box @@ -95,6 +99,7 @@ document_properties_page_size=पृष्ठ आकार: document_properties_page_size_unit_inches=इंच document_properties_page_size_unit_millimeters=मीमी document_properties_page_size_orientation_portrait=उभी मांडणी +document_properties_page_size_orientation_landscape=आडवे document_properties_page_size_name_a3=A3 document_properties_page_size_name_a4=A4 document_properties_page_size_name_letter=Letter @@ -109,6 +114,7 @@ document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} document_properties_page_size_dimension_name_string={{width}} × {{height}} {{unit}} ({{name}}, {{orientation}}) # LOCALIZATION NOTE (document_properties_linearized): The linearization status of # the document; usually called "Fast Web View" in English locales of Adobe software. +document_properties_linearized=जलद वेब दृष्य: document_properties_linearized_yes=हो document_properties_linearized_no=नाही document_properties_close=बंद करा @@ -151,8 +157,23 @@ find_next.title=वाकप्रयोगची पुढील घटना find_next_label=पुढील find_highlight=सर्व ठळक करा find_match_case_label=आकार जुळवा +find_entire_word_label=संपूर्ण शब्द find_reached_top=दस्तऐवजाच्या शीर्षकास पोहचले, तळपासून पुढे find_reached_bottom=दस्तऐवजाच्या तळाला पोहचले, शीर्षकापासून पुढे +# LOCALIZATION NOTE (find_match_count): The supported plural forms are +# [one|two|few|many|other], with [other] as the default value. +# "{{current}}" and "{{total}}" will be replaced by a number representing the +# index of the currently active find result, respectively a number representing +# the total number of matches in the document. +find_match_count={[ plural(total) ]} +# LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are +# [zero|one|two|few|many|other], with [other] as the default value. +# "{{limit}}" will be replaced by a numerical value. +find_match_count_limit[zero]={{limit}} पेक्षा अधिक जुळण्या +find_match_count_limit[two]={{limit}} पेक्षा अधिक जुळण्या +find_match_count_limit[few]={{limit}} पेक्षा अधिक जुळण्या +find_match_count_limit[many]={{limit}} पेक्षा अधिक जुळण्या +find_match_count_limit[other]={{limit}} पेक्षा अधिक जुळण्या find_not_found=वाकप्रयोग आढळले नाही # Error panel labels diff --git a/cps/static/locale/nb-NO/viewer.properties b/cps/static/locale/nb-NO/viewer.properties index fc989828..8656cb4f 100644 --- a/cps/static/locale/nb-NO/viewer.properties +++ b/cps/static/locale/nb-NO/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Ugyldig eller skadet PDF-fil. missing_file_error=Manglende PDF-fil. unexpected_response_error=Uventet serverrespons. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/nl/viewer.properties b/cps/static/locale/nl/viewer.properties index 7422f849..c62110a4 100644 --- a/cps/static/locale/nl/viewer.properties +++ b/cps/static/locale/nl/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Ongeldig of beschadigd PDF-bestand. missing_file_error=PDF-bestand ontbreekt. unexpected_response_error=Onverwacht serverantwoord. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/nn-NO/viewer.properties b/cps/static/locale/nn-NO/viewer.properties index 27b4abb3..f0feeb40 100644 --- a/cps/static/locale/nn-NO/viewer.properties +++ b/cps/static/locale/nn-NO/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Ugyldig eller korrupt PDF-fil. missing_file_error=Manglande PDF-fil. unexpected_response_error=Uventa tenarrespons. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}} {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/pa-IN/viewer.properties b/cps/static/locale/pa-IN/viewer.properties index 436be51a..8c624375 100644 --- a/cps/static/locale/pa-IN/viewer.properties +++ b/cps/static/locale/pa-IN/viewer.properties @@ -168,10 +168,21 @@ find_reached_bottom=ਦਸਤਾਵੇਜ਼ ਦੇ ਅੰਤ ਉੱਤੇ ਆ ਗ # index of the currently active find result, respectively a number representing # the total number of matches in the document. find_match_count={[ plural(total) ]} +find_match_count[one]={{total}} ਵਿੱਚੋਂ {{current}} ਮੇਲ +find_match_count[two]={{total}} ਵਿੱਚੋਂ {{current}} ਮੇਲ +find_match_count[few]={{total}} ਵਿੱਚੋਂ {{current}} ਮੇਲ +find_match_count[many]={{total}} ਵਿੱਚੋਂ {{current}} ਮੇਲ +find_match_count[other]={{total}} ਵਿੱਚੋਂ {{current}} ਮੇਲ # LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are # [zero|one|two|few|many|other], with [other] as the default value. # "{{limit}}" will be replaced by a numerical value. find_match_count_limit={[ plural(limit) ]} +find_match_count_limit[zero]={{limit}} ਮੇਲਾਂ ਤੋਂ ਵੱਧ +find_match_count_limit[one]={{limit}} ਮੇਲ ਤੋਂ ਵੱਧ +find_match_count_limit[two]={{limit}} ਮੇਲਾਂ ਤੋਂ ਵੱਧ +find_match_count_limit[few]={{limit}} ਮੇਲਾਂ ਤੋਂ ਵੱਧ +find_match_count_limit[many]={{limit}} ਮੇਲਾਂ ਤੋਂ ਵੱਧ +find_match_count_limit[other]={{limit}} ਮੇਲਾਂ ਤੋਂ ਵੱਧ find_not_found=ਵਾਕ ਨਹੀਂ ਲੱਭਿਆ # Error panel labels diff --git a/cps/static/locale/pl/viewer.properties b/cps/static/locale/pl/viewer.properties index 50faadf2..64a6504f 100644 --- a/cps/static/locale/pl/viewer.properties +++ b/cps/static/locale/pl/viewer.properties @@ -12,13 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Main toolbar buttons (tooltips and alt text for images) previous.title=Poprzednia strona previous_label=Poprzednia next.title=Następna strona next_label=Następna -page.title==Strona: +# LOCALIZATION NOTE (page.title): The tooltip for the pageNumber input. +page.title=Strona +# LOCALIZATION NOTE (of_pages): "{{pagesCount}}" will be replaced by a number +# representing the total number of pages in the document. of_pages=z {{pagesCount}} +# LOCALIZATION NOTE (page_of_pages): "{{pageNumber}}" and "{{pagesCount}}" +# will be replaced by a number representing the currently visible page, +# respectively a number representing the total number of pages in the document. page_of_pages=({{pageNumber}} z {{pagesCount}}) zoom_out.title=Pomniejszenie @@ -37,6 +44,7 @@ download_label=Pobierz bookmark.title=Bieżąca pozycja (skopiuj lub otwórz jako odnośnik w nowym oknie) bookmark_label=Bieżąca pozycja +# Secondary toolbar and context menu tools.title=Narzędzia tools_label=Narzędzia first_page.title=Przechodzenie do pierwszej strony @@ -59,30 +67,37 @@ cursor_hand_tool_label=Narzędzie rączka scroll_vertical.title=Przewijaj dokument w pionie scroll_vertical_label=Przewijanie pionowe -scroll_horizontal_label=Przewijanie poziome scroll_horizontal.title=Przewijaj dokument w poziomie -scroll_wrapped_label=Widok dwóch stron +scroll_horizontal_label=Przewijanie poziome scroll_wrapped.title=Strony dokumentu wyświetlaj i przewijaj w kolumnach +scroll_wrapped_label=Widok dwóch stron -spread_none_label=Brak kolumn spread_none.title=Nie ustawiaj stron obok siebie -spread_odd_label=Nieparzyste po lewej +spread_none_label=Brak kolumn spread_odd.title=Strony nieparzyste ustawiaj na lewo od parzystych -spread_even_label=Parzyste po lewej +spread_odd_label=Nieparzyste po lewej spread_even.title=Strony parzyste ustawiaj na lewo od nieparzystych +spread_even_label=Parzyste po lewej +# Document properties dialog box document_properties.title=Właściwości dokumentu… document_properties_label=Właściwości dokumentu… document_properties_file_name=Nazwa pliku: document_properties_file_size=Rozmiar pliku: -document_properties_kb={{size_kb}} KB ({{size_b}} b) -document_properties_mb={{size_mb}} MB ({{size_b}} b) +# LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}" +# will be replaced by the PDF file size in kilobytes, respectively in bytes. +document_properties_kb={{size_kb}} KB ({{size_b}} B) +# LOCALIZATION NOTE (document_properties_mb): "{{size_mb}}" and "{{size_b}}" +# will be replaced by the PDF file size in megabytes, respectively in bytes. +document_properties_mb={{size_mb}} MB ({{size_b}} B) document_properties_title=Tytuł: document_properties_author=Autor: document_properties_subject=Temat: document_properties_keywords=Słowa kluczowe: document_properties_creation_date=Data utworzenia: document_properties_modification_date=Data modyfikacji: +# LOCALIZATION NOTE (document_properties_date_string): "{{date}}" and "{{time}}" +# will be replaced by the creation/modification date, and time, of the PDF file. document_properties_date_string={{date}}, {{time}} document_properties_creator=Utworzony przez: document_properties_producer=PDF wyprodukowany przez: @@ -97,17 +112,30 @@ document_properties_page_size_name_a3=A3 document_properties_page_size_name_a4=A4 document_properties_page_size_name_letter=US Letter document_properties_page_size_name_legal=US Legal -document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} (orientacja {{orientation}}) -document_properties_page_size_dimension_name_string={{width}} × {{height}} {{unit}} ({{name}}, orientacja {{orientation}}) +# LOCALIZATION NOTE (document_properties_page_size_dimension_string): +# "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by +# the size, respectively their unit of measurement and orientation, of the (current) page. +document_properties_page_size_dimension_string={{width}}×{{height}} {{unit}} (orientacja {{orientation}}) +# LOCALIZATION NOTE (document_properties_page_size_dimension_name_string): +# "{{width}}", "{{height}}", {{unit}}, {{name}}, and {{orientation}} will be replaced by +# the size, respectively their unit of measurement, name, and orientation, of the (current) page. +document_properties_page_size_dimension_name_string={{width}}×{{height}} {{unit}} ({{name}}, orientacja {{orientation}}) +# LOCALIZATION NOTE (document_properties_linearized): The linearization status of +# the document; usually called "Fast Web View" in English locales of Adobe software. document_properties_linearized=Szybki podgląd w Internecie: document_properties_linearized_yes=tak document_properties_linearized_no=nie document_properties_close=Zamknij print_progress_message=Przygotowywanie dokumentu do druku… +# LOCALIZATION NOTE (print_progress_percent): "{{progress}}" will be replaced by +# a numerical per cent value. print_progress_percent={{progress}}% print_progress_close=Anuluj +# Tooltips and alt text for side panel toolbar buttons +# (the _label strings are alt text for the buttons, the .title strings are +# tooltips) toggle_sidebar.title=Przełączanie panelu bocznego toggle_sidebar_notification.title=Przełączanie panelu bocznego (dokument zawiera konspekt/załączniki) toggle_sidebar_label=Przełącz panel boczny @@ -120,26 +148,40 @@ thumbs_label=Miniaturki findbar.title=Znajdź w dokumencie findbar_label=Znajdź +# Thumbnails panel item (tooltip and alt text for images) +# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page +# number. thumb_page_title=Strona {{page}} +# LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page +# number. thumb_page_canvas=Miniaturka strony {{page}} +# Find panel button title and messages find_input.title=Wyszukiwanie -find_input.placeholder=Szukaj w dokumencie… +find_input.placeholder=Znajdź w dokumencie… find_previous.title=Znajdź poprzednie wystąpienie tekstu find_previous_label=Poprzednie find_next.title=Znajdź następne wystąpienie tekstu find_next_label=Następne -find_highlight=Podświetl wszystkie +find_highlight=Wyróżnianie wszystkich find_match_case_label=Rozróżnianie wielkości liter find_entire_word_label=Całe słowa find_reached_top=Początek dokumentu. Wyszukiwanie od końca. find_reached_bottom=Koniec dokumentu. Wyszukiwanie od początku. +# LOCALIZATION NOTE (find_match_count): The supported plural forms are +# [one|two|few|many|other], with [other] as the default value. +# "{{current}}" and "{{total}}" will be replaced by a number representing the +# index of the currently active find result, respectively a number representing +# the total number of matches in the document. find_match_count={[ plural(total) ]} find_match_count[one]=Pierwsze z {{total}} trafień find_match_count[two]=Drugie z {{total}} trafień find_match_count[few]={{current}}. z {{total}} trafień find_match_count[many]={{current}}. z {{total}} trafień find_match_count[other]={{current}}. z {{total}} trafień +# LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are +# [zero|one|two|few|many|other], with [other] as the default value. +# "{{limit}}" will be replaced by a numerical value. find_match_count_limit={[ plural(limit) ]} find_match_count_limit[zero]=Brak trafień. find_match_count_limit[one]=Więcej niż jedno trafienie. @@ -149,28 +191,49 @@ find_match_count_limit[many]=Więcej niż {{limit}} trafień. find_match_count_limit[other]=Więcej niż {{limit}} trafień. find_not_found=Nie znaleziono tekstu +# Error panel labels error_more_info=Więcej informacji error_less_info=Mniej informacji error_close=Zamknij +# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be +# replaced by the PDF.JS version and build ID. error_version_info=PDF.js v{{version}} (kompilacja: {{build}}) +# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an +# english string describing the error. error_message=Wiadomość: {{message}} +# LOCALIZATION NOTE (error_stack): "{{stack}}" will be replaced with a stack +# trace. error_stack=Stos: {{stack}} +# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename error_file=Plik: {{file}} +# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number error_line=Wiersz: {{line}} rendering_error=Podczas renderowania strony wystąpił błąd. +# Predefined zoom values page_scale_width=Szerokość strony page_scale_fit=Dopasowanie strony page_scale_auto=Skala automatyczna page_scale_actual=Rozmiar rzeczywisty +# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a +# numerical scale value. page_scale_percent={{scale}}% +# Loading indicator messages loading_error_indicator=Błąd loading_error=Podczas wczytywania dokumentu PDF wystąpił błąd. invalid_file_error=Nieprawidłowy lub uszkodzony plik PDF. missing_file_error=Brak pliku PDF. unexpected_response_error=Nieoczekiwana odpowiedź serwera. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + +# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. +# "{{type}}" will be replaced with an annotation type from a list defined in +# the PDF spec (32000-1:2008 Table 169 – Annotation types). +# Some common types are e.g.: "Check", "Text", "Comment", "Note" text_annotation_type.alt=[Adnotacja: {{type}}] password_label=Wprowadź hasło, aby otworzyć ten dokument PDF. password_invalid=Nieprawidłowe hasło. Proszę spróbować ponownie. diff --git a/cps/static/locale/pt-BR/viewer.properties b/cps/static/locale/pt-BR/viewer.properties index 078e5ada..d62dd5f9 100644 --- a/cps/static/locale/pt-BR/viewer.properties +++ b/cps/static/locale/pt-BR/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Arquivo PDF corrompido ou inválido. missing_file_error=Arquivo PDF ausente. unexpected_response_error=Resposta inesperada do servidor. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). @@ -238,5 +242,5 @@ password_cancel=Cancelar printing_not_supported=Aviso: a impressão não é totalmente suportada neste navegador. printing_not_ready=Aviso: o PDF não está totalmente carregado para impressão. -web_fonts_disabled=As fontes web estão desabilitadas: não foi possível usar fontes incorporadas do PDF. -document_colors_not_allowed=Os documentos em PDF não estão autorizados a usar suas próprias cores: “Permitir que as páginas escolham suas próprias cores” está desabilitado no navegador. +web_fonts_disabled=As fontes web estão desativadas: não foi possível usar fontes incorporadas do PDF. +document_colors_not_allowed=Documentos PDF não estão autorizados a usar as próprias cores: a opção “Permitir que as páginas escolham suas próprias cores” está desativada no navegador. diff --git a/cps/static/locale/pt-PT/viewer.properties b/cps/static/locale/pt-PT/viewer.properties index 591c0eff..6fec54d9 100644 --- a/cps/static/locale/pt-PT/viewer.properties +++ b/cps/static/locale/pt-PT/viewer.properties @@ -140,7 +140,7 @@ toggle_sidebar.title=Alternar barra lateral toggle_sidebar_notification.title=Alternar barra lateral (documento contém contorno/anexos) toggle_sidebar_label=Alternar barra lateral document_outline.title=Mostrar esquema do documento (duplo clique para expandir/colapsar todos os itens) -document_outline_label=Estrutura do documento +document_outline_label=Esquema do documento attachments.title=Mostrar anexos attachments_label=Anexos thumbs.title=Mostrar miniaturas @@ -226,6 +226,10 @@ invalid_file_error=Ficheiro PDF inválido ou danificado. missing_file_error=Ficheiro PDF inexistente. unexpected_response_error=Resposta inesperada do servidor. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/ro/viewer.properties b/cps/static/locale/ro/viewer.properties index 72a4a069..f3a6b83c 100644 --- a/cps/static/locale/ro/viewer.properties +++ b/cps/static/locale/ro/viewer.properties @@ -83,7 +83,7 @@ spread_even_label=Broșare pagini pare document_properties.title=Proprietățile documentului… document_properties_label=Proprietățile documentului… document_properties_file_name=Numele fișierului: -document_properties_file_size=Dimensiunea fișierului: +document_properties_file_size=Mărimea fișierului: # LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}" # will be replaced by the PDF file size in kilobytes, respectively in bytes. document_properties_kb={{size_kb}} KB ({{size_b}} byți) @@ -103,7 +103,7 @@ document_properties_creator=Autor: document_properties_producer=Producător PDF: document_properties_version=Versiune PDF: document_properties_page_count=Număr de pagini: -document_properties_page_size=Dimensiunea paginii: +document_properties_page_size=Mărimea paginii: document_properties_page_size_unit_inches=in document_properties_page_size_unit_millimeters=mm document_properties_page_size_orientation_portrait=portret @@ -214,7 +214,7 @@ rendering_error=A intervenit o eroare la randarea paginii. page_scale_width=Lățimea paginii page_scale_fit=Potrivire la pagină page_scale_auto=Zoom automat -page_scale_actual=Dimensiune reală +page_scale_actual=Mărime reală # LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a # numerical scale value. page_scale_percent={{scale}}% @@ -226,6 +226,10 @@ invalid_file_error=Fișier PDF nevalid sau corupt. missing_file_error=Fișier PDF lipsă. unexpected_response_error=Răspuns neașteptat de la server. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/ru/viewer.properties b/cps/static/locale/ru/viewer.properties index 65eb8768..be8aa5b0 100644 --- a/cps/static/locale/ru/viewer.properties +++ b/cps/static/locale/ru/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Некорректный или повреждённый PDF- missing_file_error=PDF-файл отсутствует. unexpected_response_error=Неожиданный ответ сервера. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/si/viewer.properties b/cps/static/locale/si/viewer.properties index 4137ec1c..9a1d1e8b 100644 --- a/cps/static/locale/si/viewer.properties +++ b/cps/static/locale/si/viewer.properties @@ -58,6 +58,9 @@ page_rotate_ccw.title=වාමාවර්තව භ්‍රමණය page_rotate_ccw.label=වාමාවර්තව භ්‍රමණය page_rotate_ccw_label=වාමාවර්තව භ්‍රමණය +cursor_hand_tool_label=අත් මෙවලම + + # Document properties dialog box document_properties.title=ලේඛන වත්කම්... @@ -83,11 +86,32 @@ document_properties_creator=නිර්මාපක: document_properties_producer=PDF නිශ්පාදක: document_properties_version=PDF නිකුතුව: document_properties_page_count=පිටු ගණන: +document_properties_page_size=පිටුවේ විශාලත්වය: +document_properties_page_size_unit_inches=අඟල් +document_properties_page_size_unit_millimeters=මිමි +document_properties_page_size_orientation_portrait=සිරස් +document_properties_page_size_orientation_landscape=තිරස් +document_properties_page_size_name_a3=A3 +document_properties_page_size_name_a4=A4 +# LOCALIZATION NOTE (document_properties_page_size_dimension_string): +# "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by +# the size, respectively their unit of measurement and orientation, of the (current) page. +document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} ({{orientation}}) +# LOCALIZATION NOTE (document_properties_page_size_dimension_name_string): +# "{{width}}", "{{height}}", {{unit}}, {{name}}, and {{orientation}} will be replaced by +# the size, respectively their unit of measurement, name, and orientation, of the (current) page. +document_properties_page_size_dimension_name_string={{width}}×{{height}}{{unit}}{{name}}{{orientation}} +# LOCALIZATION NOTE (document_properties_linearized): The linearization status of +# the document; usually called "Fast Web View" in English locales of Adobe software. +document_properties_linearized=වේගවත් ජාල දසුන: +document_properties_linearized_yes=ඔව් +document_properties_linearized_no=නැහැ document_properties_close=වසන්න print_progress_message=ලේඛනය මුද්‍රණය සඳහා සූදානම් කරමින්… # LOCALIZATION NOTE (print_progress_percent): "{{progress}}" will be replaced by # a numerical per cent value. +print_progress_percent={{progress}}% print_progress_close=අවලංගු කරන්න # Tooltips and alt text for side panel toolbar buttons @@ -95,6 +119,7 @@ print_progress_close=අවලංගු කරන්න # tooltips) toggle_sidebar.title=පැති තීරුවට මාරුවන්න toggle_sidebar_label=පැති තීරුවට මාරුවන්න +document_outline_label=ලේඛනයේ පිට මායිම attachments.title=ඇමිණුම් පෙන්වන්න attachments_label=ඇමිණුම් thumbs.title=සිඟිති රූ පෙන්වන්න @@ -111,14 +136,25 @@ thumb_page_title=පිටුව {{page}} thumb_page_canvas=පිටුවෙ සිඟිත රූව {{page}} # Find panel button title and messages +find_input.title=සොයන්න find_previous.title=මේ වාක්‍ය ඛණ්ඩය මීට පෙර යෙදුණු ස්ථානය සොයන්න find_previous_label=පෙර: find_next.title=මේ වාක්‍ය ඛණ්ඩය මීළඟට යෙදෙන ස්ථානය සොයන්න find_next_label=මීළඟ find_highlight=සියල්ල උද්දීපනය find_match_case_label=අකුරු ගළපන්න +find_entire_word_label=සම්පූර්ණ වචන find_reached_top=පිටුවේ ඉහළ කෙළවරට ලගාවිය, පහළ සිට ඉදිරියට යමින් find_reached_bottom=පිටුවේ පහළ කෙළවරට ලගාවිය, ඉහළ සිට ඉදිරියට යමින් +# LOCALIZATION NOTE (find_match_count): The supported plural forms are +# [one|two|few|many|other], with [other] as the default value. +# "{{current}}" and "{{total}}" will be replaced by a number representing the +# index of the currently active find result, respectively a number representing +# the total number of matches in the document. +# LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are +# [zero|one|two|few|many|other], with [other] as the default value. +# "{{limit}}" will be replaced by a numerical value. +find_match_count_limit[zero]=ගැලපුම් {{limit}} ට වඩා find_not_found=ඔබ සෙව් වචන හමු නොවීය # Error panel labels diff --git a/cps/static/locale/sk/viewer.properties b/cps/static/locale/sk/viewer.properties index f18c6334..00cf62e3 100644 --- a/cps/static/locale/sk/viewer.properties +++ b/cps/static/locale/sk/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Neplatný alebo poškodený súbor PDF. missing_file_error=Chýbajúci súbor PDF. unexpected_response_error=Neočakávaná odpoveď zo servera. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/sl/viewer.properties b/cps/static/locale/sl/viewer.properties index 073ea3a3..790205de 100644 --- a/cps/static/locale/sl/viewer.properties +++ b/cps/static/locale/sl/viewer.properties @@ -53,12 +53,12 @@ first_page_label=Pojdi na prvo stran last_page.title=Pojdi na zadnjo stran last_page.label=Pojdi na zadnjo stran last_page_label=Pojdi na zadnjo stran -page_rotate_cw.title=Zavrti v smeri urninega kazalca -page_rotate_cw.label=Zavrti v smeri urninega kazalca -page_rotate_cw_label=Zavrti v smeri urninega kazalca -page_rotate_ccw.title=Zavrti v nasprotni smeri urninega kazalca -page_rotate_ccw.label=Zavrti v nasprotni smeri urninega kazalca -page_rotate_ccw_label=Zavrti v nasprotni smeri urninega kazalca +page_rotate_cw.title=Zavrti v smeri urnega kazalca +page_rotate_cw.label=Zavrti v smeri urnega kazalca +page_rotate_cw_label=Zavrti v smeri urnega kazalca +page_rotate_ccw.title=Zavrti v nasprotni smeri urnega kazalca +page_rotate_ccw.label=Zavrti v nasprotni smeri urnega kazalca +page_rotate_ccw_label=Zavrti v nasprotni smeri urnega kazalca cursor_text_select_tool.title=Omogoči orodje za izbor besedila cursor_text_select_tool_label=Orodje za izbor besedila @@ -226,6 +226,10 @@ invalid_file_error=Neveljavna ali pokvarjena datoteka PDF. missing_file_error=Ni datoteke PDF. unexpected_response_error=Nepričakovan odgovor strežnika. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/sq/viewer.properties b/cps/static/locale/sq/viewer.properties index f4b91d1b..153ab56e 100644 --- a/cps/static/locale/sq/viewer.properties +++ b/cps/static/locale/sq/viewer.properties @@ -219,6 +219,10 @@ invalid_file_error=Kartelë PDF e pavlefshme ose e dëmtuar. missing_file_error=Kartelë PDF që mungon. unexpected_response_error=Përgjigje shërbyesi e papritur. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/sv-SE/viewer.properties b/cps/static/locale/sv-SE/viewer.properties index d0da9147..b1b60bd4 100644 --- a/cps/static/locale/sv-SE/viewer.properties +++ b/cps/static/locale/sv-SE/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Ogiltig eller korrupt PDF-fil. missing_file_error=Saknad PDF-fil. unexpected_response_error=Oväntat svar från servern. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}} {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/te/viewer.properties b/cps/static/locale/te/viewer.properties index c7bd7855..56f954d4 100644 --- a/cps/static/locale/te/viewer.properties +++ b/cps/static/locale/te/viewer.properties @@ -202,6 +202,10 @@ invalid_file_error=చెల్లని లేదా పాడైన PDF ఫై missing_file_error=దొరకని PDF ఫైలు. unexpected_response_error=అనుకోని సర్వర్ స్పందన. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/th/viewer.properties b/cps/static/locale/th/viewer.properties index 2f401e90..34d46147 100644 --- a/cps/static/locale/th/viewer.properties +++ b/cps/static/locale/th/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=ไฟล์ PDF ไม่ถูกต้องหรือ missing_file_error=ไฟล์ PDF หายไป unexpected_response_error=การตอบสนองของเซิร์ฟเวอร์ที่ไม่คาดคิด +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/tr/viewer.properties b/cps/static/locale/tr/viewer.properties index c1ed154c..792ea052 100644 --- a/cps/static/locale/tr/viewer.properties +++ b/cps/static/locale/tr/viewer.properties @@ -137,10 +137,10 @@ print_progress_close=İptal # (the _label strings are alt text for the buttons, the .title strings are # tooltips) toggle_sidebar.title=Kenar çubuğunu aç/kapat -toggle_sidebar_notification.title=Kenar çubuğunu aç/kapat (Belge anahat/ekler içeriyor) +toggle_sidebar_notification.title=Kenar çubuğunu aç/kapat (Belge ana hat/ekler içeriyor) toggle_sidebar_label=Kenar çubuğunu aç/kapat -document_outline.title=Belge şemasını göster (Tüm öğeleri genişletmek/daraltmak için çift tıklayın) -document_outline_label=Belge şeması +document_outline.title=Belge ana hatlarını göster (Tüm öğeleri genişletmek/daraltmak için çift tıklayın) +document_outline_label=Belge ana hatları attachments.title=Ekleri göster attachments_label=Ekler thumbs.title=Küçük resimleri göster @@ -226,6 +226,10 @@ invalid_file_error=Geçersiz veya bozulmuş PDF dosyası. missing_file_error=PDF dosyası eksik. unexpected_response_error=Beklenmeyen sunucu yanıtı. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/uk/viewer.properties b/cps/static/locale/uk/viewer.properties index 01d02882..6eb22772 100644 --- a/cps/static/locale/uk/viewer.properties +++ b/cps/static/locale/uk/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=Недійсний або пошкоджений PDF-файл missing_file_error=Відсутній PDF-файл. unexpected_response_error=Неочікувана відповідь сервера. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/ur/viewer.properties b/cps/static/locale/ur/viewer.properties index ea6ba27c..31928bcb 100644 --- a/cps/static/locale/ur/viewer.properties +++ b/cps/static/locale/ur/viewer.properties @@ -93,6 +93,7 @@ document_properties_page_size_unit_millimeters=mm document_properties_page_size_orientation_portrait=عمودی انداز document_properties_page_size_name_a3=A3 document_properties_page_size_name_a4=A4 +document_properties_page_size_name_letter=خط document_properties_page_size_name_legal=قانونی # LOCALIZATION NOTE (document_properties_page_size_dimension_string): # "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by @@ -191,6 +192,9 @@ invalid_file_error=ناجائز یا خراب PDF مسل missing_file_error=PDF مسل غائب ہے۔ unexpected_response_error=غیرمتوقع پیش کار جواب +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/vi/viewer.properties b/cps/static/locale/vi/viewer.properties index 0800f710..39d4b2bd 100644 --- a/cps/static/locale/vi/viewer.properties +++ b/cps/static/locale/vi/viewer.properties @@ -13,7 +13,7 @@ # limitations under the License. # Main toolbar buttons (tooltips and alt text for images) -previous.title=Trang Trước +previous.title=Trang trước previous_label=Trước next.title=Trang Sau next_label=Tiếp @@ -69,7 +69,15 @@ scroll_vertical.title=Sử dụng cuộn dọc scroll_vertical_label=Cuộn dọc scroll_horizontal.title=Sử dụng cuộn ngang scroll_horizontal_label=Cuộn ngang +scroll_wrapped.title=Sử dụng cuộn ngắt dòng +scroll_wrapped_label=Cuộn ngắt dòng +spread_none.title=Không nối rộng trang +spread_none_label=Không có phân cách +spread_odd.title=Nối trang bài bắt đầu với các trang được đánh số lẻ +spread_odd_label=Phân cách theo số lẻ +spread_even.title=Nối trang bài bắt đầu với các trang được đánh số chẵn +spread_even_label=Phân cách theo số chẵn # Document properties dialog box document_properties.title=Thuộc tính của tài liệu… @@ -102,6 +110,7 @@ document_properties_page_size_orientation_portrait=khổ dọc document_properties_page_size_orientation_landscape=khổ ngang document_properties_page_size_name_a3=A3 document_properties_page_size_name_a4=A4 +document_properties_page_size_name_letter=Thư document_properties_page_size_name_legal=Pháp lý # LOCALIZATION NOTE (document_properties_page_size_dimension_string): # "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by @@ -217,6 +226,10 @@ invalid_file_error=Tập tin PDF hỏng hoặc không hợp lệ. missing_file_error=Thiếu tập tin PDF. unexpected_response_error=Máy chủ có phản hồi lạ. +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}}, {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/static/locale/zh-CN/viewer.properties b/cps/static/locale/zh-CN/viewer.properties index 463d9faa..5c4c5367 100644 --- a/cps/static/locale/zh-CN/viewer.properties +++ b/cps/static/locale/zh-CN/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=无效或损坏的 PDF 文件。 missing_file_error=缺少 PDF 文件。 unexpected_response_error=意外的服务器响应。 +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}},{{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). @@ -237,6 +241,6 @@ password_ok=确定 password_cancel=取消 printing_not_supported=警告:此浏览器尚未完整支持打印功能。 -printing_not_ready=警告:该 PDF 未完全载入以供打印。 +printing_not_ready=警告:此 PDF 未完成载入,无法打印。 web_fonts_disabled=Web 字体已被禁用:无法使用嵌入的 PDF 字体。 document_colors_not_allowed=PDF 文档无法使用自己的颜色:浏览器中“允许页面选择自己的颜色”的选项未被勾选。 diff --git a/cps/static/locale/zh-TW/viewer.properties b/cps/static/locale/zh-TW/viewer.properties index 79b8a5cb..70e7a456 100644 --- a/cps/static/locale/zh-TW/viewer.properties +++ b/cps/static/locale/zh-TW/viewer.properties @@ -226,6 +226,10 @@ invalid_file_error=無效或毀損的 PDF 檔案。 missing_file_error=找不到 PDF 檔案。 unexpected_response_error=伺服器回應未預期的內容。 +# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be +# replaced by the modification date, and time, of the annotation. +annotation_date_string={{date}} {{time}} + # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. # "{{type}}" will be replaced with an annotation type from a list defined in # the PDF spec (32000-1:2008 Table 169 – Annotation types). diff --git a/cps/templates/generate_kobo_auth_url.html b/cps/templates/generate_kobo_auth_url.html index 307b26bd..79f6c46d 100644 --- a/cps/templates/generate_kobo_auth_url.html +++ b/cps/templates/generate_kobo_auth_url.html @@ -8,7 +8,7 @@ {{_('api_endpoint=')}}{{kobo_auth_url}}

- {{_('Please note that every visit to this current page invalidates any previously generated Authentication url for this user.')}}. + {{_('Please note that every visit to this current page invalidates any previously generated Authentication url for this user.')}}

{% endblock %} diff --git a/cps/templates/layout.html b/cps/templates/layout.html index fc0009f9..07a9b5b6 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -44,7 +44,7 @@ - + @@ -52,7 +52,7 @@